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.
@@ -1668,7 +1668,45 @@
1668
1668
 
1669
1669
  // Global instance for smaller use-cases where you don't want to manage the getters yourself.
1670
1670
  let _getters;
1671
+ const LOCAL_STORAGE_SESSION_ID = "nxt-ssid";
1672
+ function setLocalValue(key, value) {
1673
+ if (typeof window !== "undefined" && window["localStorage"]) {
1674
+ window["localStorage"].setItem(key, value);
1675
+ }
1676
+ }
1677
+ function getLocalValue(key) {
1678
+ if (typeof window !== "undefined" && window["localStorage"]) {
1679
+ return window["localStorage"].getItem(key);
1680
+ }
1681
+ return null;
1682
+ }
1671
1683
  (function (ENVIRONMENT) {
1684
+ /**
1685
+ * Sets the local-storage session ID.
1686
+ * This is read by default when the ENVIRONMENT is initially created on load.
1687
+ * This is used by scenarios where the app doesn't manage its own session ID.
1688
+ *
1689
+ * If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
1690
+ * Eg: ENVIRONMENT.SetPageLoadSessionId = (sessionId: string) => { ... };
1691
+ * @param sessionId
1692
+ */
1693
+ ENVIRONMENT.SetPageLoadSessionId = (sessionId) => {
1694
+ setLocalValue(LOCAL_STORAGE_SESSION_ID, sessionId ? sessionId : "anonymous");
1695
+ };
1696
+ /**
1697
+ * Loads the session ID from local-storage.
1698
+ * This is used by default when the ENVIRONMENT is initially created on load.
1699
+ * This is used by scenarios where the app doesn't manage its own session ID.
1700
+ *
1701
+ * If you want to override this logic so default widgets call your function, simply re-assign this function to your own.
1702
+ * Eg: ENVIRONMENT.GetPageLoadSessionId = () => { ... };
1703
+ * @param sessionId
1704
+ * @returns
1705
+ */
1706
+ ENVIRONMENT.GetPageLoadSessionId = () => {
1707
+ const ssid = getLocalValue(LOCAL_STORAGE_SESSION_ID);
1708
+ return ssid ? ssid : "anonymous";
1709
+ };
1672
1710
  // If true, then defaults are not touched and it's assumed this is being managed.
1673
1711
  ENVIRONMENT.IS_SELF_MANAGED = false;
1674
1712
  // Unused if IS_SELF_MANAGED is false.
@@ -1676,9 +1714,9 @@
1676
1714
  // Default client account ID.
1677
1715
  accountId: "",
1678
1716
  // Default environment.
1679
- env: exports.Api.EEnv.UAT,
1717
+ env: exports.Api.EEnv.PROD,
1680
1718
  // Default session ID.
1681
- sessionId: ""
1719
+ sessionId: ENVIRONMENT.GetPageLoadSessionId()
1682
1720
  };
1683
1721
  // Subscribe to get notified when someone calls Reset.
1684
1722
  // If you are manually updating params, call OnParamsChange.Trigger() to notify others.
@@ -15627,7 +15665,7 @@
15627
15665
  })(exports.Tracking || (exports.Tracking = {}));
15628
15666
 
15629
15667
  // This is updated with the package.json version on build.
15630
- const VERSION = "6.3.1";
15668
+ const VERSION = "6.3.2";
15631
15669
 
15632
15670
  exports.VERSION = VERSION;
15633
15671
  exports.AbstractApi = AbstractApi;