@axinom/mosaic-fe-samples-host 0.1.4-rc.9 → 0.2.0-rc.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ScenarioHost.d.ts","sourceRoot":"","sources":["../../src/ScenarioHost/ScenarioHost.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAa3E,OAAO,EAAa,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAW7E,oBAAY,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6NpD,CAAC;AAMF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,eAAe,EAAE,CAAC;IACtC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,kBAUlC,CAAC"}
1
+ {"version":3,"file":"ScenarioHost.d.ts","sourceRoot":"","sources":["../../src/ScenarioHost/ScenarioHost.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAaf,OAAO,EAAa,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAa7E,oBAAY,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyOpD,CAAC;AAMF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,eAAe,EAAE,CAAC;IACtC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,kBAUlC,CAAC"}
@@ -28,4 +28,6 @@ export declare const setUserSettings: (value: UserSettings) => void;
28
28
  * Generate a Short ID with the given length. The ID will be in hexadecimal.
29
29
  */
30
30
  export declare const generateShortUniqueId: (length?: number) => string;
31
+ export declare const getActiveProfileId: () => string;
32
+ export declare const setActiveProfileId: (value: string | number | boolean | (string | number | boolean)[] | undefined) => void;
31
33
  //# sourceMappingURL=storage-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-utils.d.ts","sourceRoot":"","sources":["../../../src/common/utils/storage-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,YAkD3C,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,aAAa,EAE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AAO,MAAM,oCAAoC,YAQhD,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,YAMlC,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,IAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,YAAY,MAAM,WAKnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,MAErC,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACtB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,KAC3E,IAEF,CAAC"}
package/dist/index.es.js CHANGED
@@ -140,6 +140,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
140
140
 
141
141
  const KEY_PROFILE_DATA = 'AX_PROFILE_DATA';
142
142
  const KEY_USER_SETTINGS = 'AX_USER_SETTINGS';
143
+ const KEY_ACTIVE_PROFILE = 'AX_ACTIVE_PROFILE';
143
144
  /**
144
145
  * The structure of the `ProfileConfig` type maintained in code can undergo several structural changes overtime.
145
146
  * However, there may exist objects that were created using prior versions of the type persisted on client local-storages.
@@ -242,6 +243,12 @@ const setUserSettings = (value) => {
242
243
  const generateShortUniqueId = (length = 8) => {
243
244
  const randomId = Math.floor(Math.random() * Math.pow(16, length)).toString(16);
244
245
  return ('0'.repeat(length - randomId.length) + randomId).toUpperCase();
246
+ };
247
+ const getActiveProfileId = () => {
248
+ return JSON.parse(localStorage.getItem(KEY_ACTIVE_PROFILE) || '');
249
+ };
250
+ const setActiveProfileId = (value) => {
251
+ localStorage.setItem(KEY_ACTIVE_PROFILE, JSON.stringify(value));
245
252
  };
246
253
 
247
254
  /**
@@ -297,7 +304,15 @@ const ScenarioHost = ({ scenarios }) => {
297
304
  const handleProfileChanged = (event, data) => {
298
305
  const activeProfileIndex = profiles.findIndex((profile) => profile.id === data.value);
299
306
  setActiveProfile(profiles[activeProfileIndex]);
307
+ setActiveProfileId(data.value);
300
308
  };
309
+ useEffect(() => {
310
+ const storageProfileId = getActiveProfileId();
311
+ if (storageProfileId !== (activeProfile === null || activeProfile === void 0 ? void 0 : activeProfile.id)) {
312
+ const activeProfileIndex = profiles.findIndex((profile) => profile.id === storageProfileId);
313
+ setActiveProfile(profiles[activeProfileIndex]);
314
+ }
315
+ }, [activeProfile === null || activeProfile === void 0 ? void 0 : activeProfile.id, profiles]);
301
316
  const ScenarioErrorFallback = (info) => {
302
317
  return (React.createElement(Segment, { basic: true },
303
318
  React.createElement(Header, { size: "huge" }, "Something went wrong"),