@axinom/mosaic-fe-samples-host 0.1.4 → 0.2.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.
- package/CHANGELOG.md +10 -0
- package/dist/ScenarioHost/ScenarioHost.d.ts.map +1 -1
- package/dist/common/utils/storage-utils.d.ts +2 -0
- package/dist/common/utils/storage-utils.d.ts.map +1 -1
- package/dist/index.es.js +15 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.2.0](https://dev.azure.com/axinom/CMS/_git/Navy/branchCompare?baseVersion=GT@axinom/mosaic-fe-samples-host@0.1.4&targetVersion=GT@axinom/mosaic-fe-samples-host@0.2.0) (2022-10-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* reset activated profile from local storage ([d8fffed](https://dev.azure.com/axinom/CMS/_git/Navy/commit/d8fffed135b053166746c8ce5c604394c8fa0cd5))
|
|
12
|
+
* store active profile id to local storage ([63afb21](https://dev.azure.com/axinom/CMS/_git/Navy/commit/63afb21c3059f854f2865b752882c30e0cb8d092))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
### [0.1.4](https://dev.azure.com/axinom/CMS/_git/Navy/branchCompare?baseVersion=GT@axinom/mosaic-fe-samples-host@0.1.3&targetVersion=GT@axinom/mosaic-fe-samples-host@0.1.4) (2022-09-30)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @axinom/mosaic-fe-samples-host
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScenarioHost.d.ts","sourceRoot":"","sources":["../../src/ScenarioHost/ScenarioHost.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
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;
|
|
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;AAMtD;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,YAkD3C,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,aAAa,EAE9C,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,aAAa,EAAE,KAAG,IAO3D,CAAC;AAEF,eAAO,MAAM,WAAW,kBAAmB,aAAa,KAAG,IAe1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,eACpB,aAAa,OACjB,MAAM,MAGZ,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACrB,aAAa,KACrB,eAAe,EAEjB,CAAC;AAEF,eAAO,MAAM,kBAAkB,YACpB,aAAa,OACjB,MAAM,SACJ,OAAO,WACL,MAAM,KACd,IAYF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,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"),
|