bruce-models 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-models.es5.js +41 -3
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +41 -3
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/environment.js +40 -2
- package/dist/lib/environment.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/environment.d.ts +21 -0
- package/package.json +1 -1
package/dist/lib/bruce-models.js
CHANGED
|
@@ -113,5 +113,5 @@ __exportStar(require("./data-source/data-source"), exports);
|
|
|
113
113
|
__exportStar(require("./scenario/scenario"), exports);
|
|
114
114
|
__exportStar(require("./tracking/tracking"), exports);
|
|
115
115
|
// This is updated with the package.json version on build.
|
|
116
|
-
exports.VERSION = "6.3.
|
|
116
|
+
exports.VERSION = "6.3.2";
|
|
117
117
|
//# sourceMappingURL=bruce-models.js.map
|
package/dist/lib/environment.js
CHANGED
|
@@ -6,8 +6,46 @@ const api_getters_1 = require("./api/api-getters");
|
|
|
6
6
|
const bruce_event_1 = require("./common/bruce-event");
|
|
7
7
|
// Global instance for smaller use-cases where you don't want to manage the getters yourself.
|
|
8
8
|
let _getters;
|
|
9
|
+
const LOCAL_STORAGE_SESSION_ID = "nxt-ssid";
|
|
10
|
+
function setLocalValue(key, value) {
|
|
11
|
+
if (typeof window !== "undefined" && window["localStorage"]) {
|
|
12
|
+
window["localStorage"].setItem(key, value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function getLocalValue(key) {
|
|
16
|
+
if (typeof window !== "undefined" && window["localStorage"]) {
|
|
17
|
+
return window["localStorage"].getItem(key);
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
9
21
|
var ENVIRONMENT;
|
|
10
22
|
(function (ENVIRONMENT) {
|
|
23
|
+
/**
|
|
24
|
+
* Sets the local-storage session ID.
|
|
25
|
+
* This is read by default when the ENVIRONMENT is initially created on load.
|
|
26
|
+
* This is used by scenarios where the app doesn't manage its own session ID.
|
|
27
|
+
*
|
|
28
|
+
* If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
|
|
29
|
+
* Eg: ENVIRONMENT.SetPageLoadSessionId = (sessionId: string) => { ... };
|
|
30
|
+
* @param sessionId
|
|
31
|
+
*/
|
|
32
|
+
ENVIRONMENT.SetPageLoadSessionId = (sessionId) => {
|
|
33
|
+
setLocalValue(LOCAL_STORAGE_SESSION_ID, sessionId ? sessionId : "anonymous");
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Loads the session ID from local-storage.
|
|
37
|
+
* This is used by default when the ENVIRONMENT is initially created on load.
|
|
38
|
+
* This is used by scenarios where the app doesn't manage its own session ID.
|
|
39
|
+
*
|
|
40
|
+
* If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
|
|
41
|
+
* Eg: ENVIRONMENT.GetPageLoadSessionId = () => { ... };
|
|
42
|
+
* @param sessionId
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
ENVIRONMENT.GetPageLoadSessionId = () => {
|
|
46
|
+
const ssid = getLocalValue(LOCAL_STORAGE_SESSION_ID);
|
|
47
|
+
return ssid ? ssid : "anonymous";
|
|
48
|
+
};
|
|
11
49
|
// If true, then defaults are not touched and it's assumed this is being managed.
|
|
12
50
|
ENVIRONMENT.IS_SELF_MANAGED = false;
|
|
13
51
|
// Unused if IS_SELF_MANAGED is false.
|
|
@@ -15,9 +53,9 @@ var ENVIRONMENT;
|
|
|
15
53
|
// Default client account ID.
|
|
16
54
|
accountId: "",
|
|
17
55
|
// Default environment.
|
|
18
|
-
env: api_1.Api.EEnv.
|
|
56
|
+
env: api_1.Api.EEnv.PROD,
|
|
19
57
|
// Default session ID.
|
|
20
|
-
sessionId:
|
|
58
|
+
sessionId: ENVIRONMENT.GetPageLoadSessionId()
|
|
21
59
|
};
|
|
22
60
|
// Subscribe to get notified when someone calls Reset.
|
|
23
61
|
// If you are manually updating params, call OnParamsChange.Trigger() to notify others.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AACrC,mDAA+C;AAC/C,sDAAkD;AAUlD,6FAA6F;AAC7F,IAAI,QAAoB,CAAC;AAEzB,IAAiB,WAAW,
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AACrC,mDAA+C;AAC/C,sDAAkD;AAUlD,6FAA6F;AAC7F,IAAI,QAAoB,CAAC;AAEzB,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAE5C,SAAS,aAAa,CAAC,GAAW,EAAE,KAAa;IAC7C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;QACzD,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAC9C;AACL,CAAC;AACD,SAAS,aAAa,CAAC,GAAW;IAC9B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;QACzD,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;KAC9C;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAGD,IAAiB,WAAW,CA0F3B;AA1FD,WAAiB,WAAW;IACxB;;;;;;;;OAQG;IACQ,gCAAoB,GAAG,CAAC,SAAkB,EAAE,EAAE;QACrD,aAAa,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACjF,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACQ,gCAAoB,GAAG,GAAG,EAAE;QACnC,MAAM,IAAI,GAAG,aAAa,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AS,EAAE;gBAClB,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;aAC3C;YACD,IAAI,MAAM,CAAC,GAAG,EAAE;gBACZ,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAC/B;SACJ;QACD,YAAA,MAAM,mCACC,YAAA,MAAM,GACN,MAAM,CACZ,CAAC;QACF,MAAA,WAAW,CAAC,cAAc,0CAAE,OAAO,EAAE,CAAC;IAC1C,CAAC;IArBe,iBAAK,QAqBpB,CAAA;AACL,CAAC,EA1FgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QA0F3B"}
|
|
@@ -9,6 +9,27 @@ interface IParams {
|
|
|
9
9
|
apiGetters?: ApiGetters;
|
|
10
10
|
}
|
|
11
11
|
export declare namespace ENVIRONMENT {
|
|
12
|
+
/**
|
|
13
|
+
* Sets the local-storage session ID.
|
|
14
|
+
* This is read by default when the ENVIRONMENT is initially created on load.
|
|
15
|
+
* This is used by scenarios where the app doesn't manage its own session ID.
|
|
16
|
+
*
|
|
17
|
+
* If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
|
|
18
|
+
* Eg: ENVIRONMENT.SetPageLoadSessionId = (sessionId: string) => { ... };
|
|
19
|
+
* @param sessionId
|
|
20
|
+
*/
|
|
21
|
+
let SetPageLoadSessionId: (sessionId?: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Loads the session ID from local-storage.
|
|
24
|
+
* This is used by default when the ENVIRONMENT is initially created on load.
|
|
25
|
+
* This is used by scenarios where the app doesn't manage its own session ID.
|
|
26
|
+
*
|
|
27
|
+
* If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
|
|
28
|
+
* Eg: ENVIRONMENT.GetPageLoadSessionId = () => { ... };
|
|
29
|
+
* @param sessionId
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
let GetPageLoadSessionId: () => string;
|
|
12
33
|
let IS_SELF_MANAGED: boolean;
|
|
13
34
|
let PARAMS: IParams;
|
|
14
35
|
const OnParamsChange: BruceEvent<void>;
|