This repository has been archived by the owner on May 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This changeset prepares Bloombox JS for public beta. Here's what's cooking: - [x] Configuration structure that is extensible and makes sense - [x] No ability to mutate configuration outside of proper channels - [ ] Improvements to the docs, especially w.r.t. enums - [ ] Some kind of formal unit testing - [ ] Better hosting and a proper universal redirect - [ ] Fix the debug build and cleanup the build chain - [ ] Buildout the ability to fetch and cache the menu, in entirety or by section. - [ ] Figure out some caching mechanism - [ ] Allow subscribing to menu changes - [ ] Embedding Firebase would be useful here - [ ] Basic integrations - [ ] Google Analytics - [ ] Relay for non-internal events to GA - [ ] Prep/wiring to hook commercial events up - [ ] Keen IO - [ ] Relay for non-internal events - [ ] Segment IO - [ ] Relay for non-internal events - [ ] Internal support code - [ ] Error reporting to Stackdriver - [ ] Updates to internal telemetry events, if any - [ ] Prep NPM etc. for distribution
- Loading branch information
Sam Gammon
committed
Nov 28, 2017
1 parent
c06ab5e
commit a9de574
Showing
20 changed files
with
271 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
Portions of this code are from MochiKit, received by Momentum Ideas under the MIT license via The Closure Authors. | ||
All remaining Closure library code is Copyright 2005-2009 The Closure Authors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
|
||
/** | ||
* Bloombox JS: Config | ||
* | ||
* @fileoverview Provides initial boot code for Bloombox JS. | ||
*/ | ||
|
||
/*global goog */ | ||
|
||
goog.provide('bloombox.config.active'); | ||
goog.provide('bloombox.config.buildDefault'); | ||
goog.provide('bloombox.config.configure'); | ||
|
||
goog.require('bloombox.DEBUG'); | ||
goog.require('bloombox.VERSION'); | ||
|
||
goog.require('bloombox.config.integration.GoogleAnalyticsConfig'); | ||
goog.require('bloombox.config.integration.KeenIOConfig'); | ||
goog.require('bloombox.config.integration.SegmentConfig'); | ||
|
||
|
||
/** | ||
* Specifies the structure of Bloombox JS's global configuration object. | ||
* | ||
* @public | ||
* @nocollapse | ||
* @typedef {{key: ?string, | ||
* partner: ?string, | ||
* location: ?string, | ||
* channel: ?string, | ||
* integrations: bloombox.config.JSIntegrationConfig, | ||
* endpoints: { | ||
* shop: ?string, | ||
* telemetry: ?string}}} | ||
*/ | ||
bloombox.config.JSConfig; | ||
|
||
|
||
/** | ||
* Specifies the structure of configuration related to integrations that plug | ||
* into the JS client. As of this writing, that includes Google Analytics, Keen | ||
* IO, and Segment. | ||
* | ||
* @public | ||
* @nocollapse | ||
* @typedef {{google: { | ||
* analytics: bloombox.config.integrations.GoogleAnalyticsConfig}, | ||
* segment: bloombox.config.integrations.SegmentConfig, | ||
* keen: bloombox.config.integrations.KeenIOConfig}} | ||
*/ | ||
bloombox.config.JSIntegrationConfig; | ||
|
||
|
||
/** | ||
* Reference to the active global configuration. | ||
* | ||
* @type {bloombox.config.JSConfig} | ||
* @private | ||
*/ | ||
bloombox.config._ACTIVE_CONFIG_ = bloombox.config.buildDefault(); | ||
|
||
|
||
/** | ||
* @typedef {bloombox.config.integrations.GoogleAnalyticsConfig} | ||
* @package | ||
*/ | ||
let GoogleAnalyticsConfig; | ||
|
||
|
||
/** | ||
* @typedef {bloombox.config.integrations.SegmentConfig} | ||
* @package | ||
*/ | ||
let SegmentConfig; | ||
|
||
|
||
/** | ||
* @typedef {bloombox.config.integrations.KeenIOConfig} | ||
* @package | ||
*/ | ||
let KeenIOConfig; | ||
|
||
|
||
/** | ||
* Resolve the active configuration object. | ||
* | ||
* @return {bloombox.config.JSConfig} Active JS config. | ||
* @public | ||
*/ | ||
bloombox.config.buildDefault = function() { | ||
return { | ||
key: null, | ||
partner: null, | ||
location: null, | ||
channel: null, | ||
endpoints: { | ||
shop: null, | ||
telemetry: null | ||
}, | ||
integrations: { | ||
google: { | ||
analytics: /** @type {GoogleAnalyticsConfig} */ ({ | ||
enabled: false, | ||
trackingId: null | ||
}) | ||
}, | ||
segment: /** @type {SegmentConfig} */ ({ | ||
writeKey: null | ||
}), | ||
keen: /** @type {KeenIOConfig} */ ({ | ||
projectId: null, | ||
writeKey: null | ||
}) | ||
} | ||
}; | ||
}; | ||
|
||
|
||
/** | ||
* Resolve the active configuration object. | ||
* | ||
* @param {bloombox.config.JSConfig} config Replace the active JS config. | ||
* @public | ||
*/ | ||
bloombox.config.configure = function(config) { | ||
if (Object.isFrozen && !Object.isFrozen(config)) | ||
Object.freeze(config); | ||
bloombox.config._ACTIVE_CONFIG_ = config; | ||
}; | ||
|
||
|
||
/** | ||
* Resolve the active configuration object. | ||
* | ||
* @return {bloombox.config.JSConfig} Active JS config. | ||
* @public | ||
*/ | ||
bloombox.config.active = function() { | ||
return bloombox.config._ACTIVE_CONFIG_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
/** | ||
* Bloombox JS Config: Google Analytics | ||
* | ||
* @fileoverview Provides configuration structure for the Google Analytics | ||
* integration layer with Bloombox JS. | ||
*/ | ||
|
||
/*global goog */ | ||
|
||
goog.provide('bloombox.config.integration.GoogleAnalyticsConfig'); | ||
|
||
|
||
/** | ||
* Specifies configuration structure for Google Analytics integration features. | ||
* | ||
* @public | ||
* @nocollapse | ||
* @typedef {{enabled: boolean, | ||
* trackingId: ?Array<string>}} | ||
*/ | ||
bloombox.config.integration.GoogleAnalyticsConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
/** | ||
* Bloombox JS Config: Keen IO | ||
* | ||
* @fileoverview Provides configuration structure for the Keen IO integration | ||
* layer with Bloombox JS. | ||
*/ | ||
|
||
/*global goog */ | ||
|
||
goog.provide('bloombox.config.integration.KeenIOConfig'); | ||
|
||
|
||
/** | ||
* Specifies configuration structure for Keen IO integration features. | ||
* | ||
* @public | ||
* @nocollapse | ||
* @typedef {{enabled: boolean, | ||
* projectId: string, | ||
* writeKey: string}} | ||
*/ | ||
bloombox.config.integration.KeenIOConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
/** | ||
* Bloombox JS Config: Segment IO | ||
* | ||
* @fileoverview Provides configuration structure for the Segment IO integration | ||
* layer with Bloombox JS. | ||
*/ | ||
|
||
/*global goog */ | ||
|
||
goog.provide('bloombox.config.integration.SegmentConfig'); | ||
|
||
|
||
/** | ||
* Specifies configuration structure for Segment IO integration features. | ||
* | ||
* @public | ||
* @nocollapse | ||
* @typedef {{enabled: boolean, | ||
* writeKey: string}} | ||
*/ | ||
bloombox.config.integration.SegmentConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
/** | ||
* Bloombox: Logging | ||
* Bloombox JS: Logging | ||
* | ||
* @fileoverview Provides logging tools. | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.