@flipdish/ui-library 0.31.4 → 0.31.5

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.
Files changed (128) hide show
  1. package/dist/components/molecules/CodeSnippet/index.cjs.map +1 -1
  2. package/dist/components/molecules/CodeSnippet/index.d.ts.map +1 -1
  3. package/dist/components/molecules/CodeSnippet/index.js.map +1 -1
  4. package/dist/components/molecules/Pagination/index.cjs.map +1 -1
  5. package/dist/components/molecules/Pagination/index.d.ts.map +1 -1
  6. package/dist/components/molecules/Pagination/index.js.map +1 -1
  7. package/dist/components/organisms/Charts/index.d.ts +0 -2
  8. package/dist/components/organisms/Charts/index.d.ts.map +1 -1
  9. package/dist/components/templates/AppShell/index.cjs +5 -7
  10. package/dist/components/templates/AppShell/index.cjs.map +1 -1
  11. package/dist/components/templates/AppShell/index.d.ts +5 -7
  12. package/dist/components/templates/AppShell/index.d.ts.map +1 -1
  13. package/dist/components/templates/AppShell/index.js +5 -7
  14. package/dist/components/templates/AppShell/index.js.map +1 -1
  15. package/dist/components/templates/NotFoundPage/index.cjs +3 -9
  16. package/dist/components/templates/NotFoundPage/index.cjs.map +1 -1
  17. package/dist/components/templates/NotFoundPage/index.d.ts +3 -9
  18. package/dist/components/templates/NotFoundPage/index.d.ts.map +1 -1
  19. package/dist/components/templates/NotFoundPage/index.js +3 -9
  20. package/dist/components/templates/NotFoundPage/index.js.map +1 -1
  21. package/dist/components/templates/PageLayout/index.cjs +5 -12
  22. package/dist/components/templates/PageLayout/index.cjs.map +1 -1
  23. package/dist/components/templates/PageLayout/index.d.ts +5 -12
  24. package/dist/components/templates/PageLayout/index.d.ts.map +1 -1
  25. package/dist/components/templates/PageLayout/index.js +5 -12
  26. package/dist/components/templates/PageLayout/index.js.map +1 -1
  27. package/dist/hooks/useBreakpoints/index.cjs +5 -5
  28. package/dist/hooks/useBreakpoints/index.d.ts +5 -5
  29. package/dist/hooks/useBreakpoints/index.js +5 -5
  30. package/dist/hooks/useClipboard/index.cjs +5 -2
  31. package/dist/hooks/useClipboard/index.cjs.map +1 -1
  32. package/dist/hooks/useClipboard/index.d.ts +5 -2
  33. package/dist/hooks/useClipboard/index.d.ts.map +1 -1
  34. package/dist/hooks/useClipboard/index.js +5 -2
  35. package/dist/hooks/useClipboard/index.js.map +1 -1
  36. package/dist/hooks/usePlatform/index.cjs +4 -5
  37. package/dist/hooks/usePlatform/index.cjs.map +1 -1
  38. package/dist/hooks/usePlatform/index.d.ts +4 -5
  39. package/dist/hooks/usePlatform/index.d.ts.map +1 -1
  40. package/dist/hooks/usePlatform/index.js +4 -5
  41. package/dist/hooks/usePlatform/index.js.map +1 -1
  42. package/dist/hooks/useResizeObserver/index.cjs +7 -2
  43. package/dist/hooks/useResizeObserver/index.cjs.map +1 -1
  44. package/dist/hooks/useResizeObserver/index.d.ts +7 -2
  45. package/dist/hooks/useResizeObserver/index.d.ts.map +1 -1
  46. package/dist/hooks/useResizeObserver/index.js +7 -2
  47. package/dist/hooks/useResizeObserver/index.js.map +1 -1
  48. package/dist/hooks/useSidePanel/index.cjs +7 -5
  49. package/dist/hooks/useSidePanel/index.cjs.map +1 -1
  50. package/dist/hooks/useSidePanel/index.d.ts +7 -5
  51. package/dist/hooks/useSidePanel/index.d.ts.map +1 -1
  52. package/dist/hooks/useSidePanel/index.js +7 -5
  53. package/dist/hooks/useSidePanel/index.js.map +1 -1
  54. package/dist/native/utilities/cx/index.d.ts +9 -9
  55. package/dist/native/utilities/cx/index.d.ts.map +1 -1
  56. package/dist/native/utilities/cx/index.js +9 -9
  57. package/dist/native/utilities/cx/index.js.map +1 -1
  58. package/dist/native/utilities/testIdUtils/index.d.ts +44 -10
  59. package/dist/native/utilities/testIdUtils/index.d.ts.map +1 -1
  60. package/dist/native/utilities/testIdUtils/index.js +44 -10
  61. package/dist/native/utilities/testIdUtils/index.js.map +1 -1
  62. package/dist/providers/ErrorBoundary/index.cjs +5 -7
  63. package/dist/providers/ErrorBoundary/index.cjs.map +1 -1
  64. package/dist/providers/ErrorBoundary/index.d.ts +4 -7
  65. package/dist/providers/ErrorBoundary/index.d.ts.map +1 -1
  66. package/dist/providers/ErrorBoundary/index.js +5 -7
  67. package/dist/providers/ErrorBoundary/index.js.map +1 -1
  68. package/dist/providers/RouteProvider/index.cjs +5 -1
  69. package/dist/providers/RouteProvider/index.cjs.map +1 -1
  70. package/dist/providers/RouteProvider/index.d.ts +5 -1
  71. package/dist/providers/RouteProvider/index.d.ts.map +1 -1
  72. package/dist/providers/RouteProvider/index.js +5 -1
  73. package/dist/providers/RouteProvider/index.js.map +1 -1
  74. package/dist/providers/ThemeProvider/index.cjs +11 -1
  75. package/dist/providers/ThemeProvider/index.cjs.map +1 -1
  76. package/dist/providers/ThemeProvider/index.d.ts +11 -1
  77. package/dist/providers/ThemeProvider/index.d.ts.map +1 -1
  78. package/dist/providers/ThemeProvider/index.js +11 -1
  79. package/dist/providers/ThemeProvider/index.js.map +1 -1
  80. package/dist/providers/UIProvider/index.cjs +5 -1
  81. package/dist/providers/UIProvider/index.cjs.map +1 -1
  82. package/dist/providers/UIProvider/index.d.ts +5 -1
  83. package/dist/providers/UIProvider/index.d.ts.map +1 -1
  84. package/dist/providers/UIProvider/index.js +5 -1
  85. package/dist/providers/UIProvider/index.js.map +1 -1
  86. package/dist/utilities/cssScopeUtils/index.cjs +6 -5
  87. package/dist/utilities/cssScopeUtils/index.cjs.map +1 -1
  88. package/dist/utilities/cssScopeUtils/index.d.ts +6 -5
  89. package/dist/utilities/cssScopeUtils/index.d.ts.map +1 -1
  90. package/dist/utilities/cssScopeUtils/index.js +6 -5
  91. package/dist/utilities/cssScopeUtils/index.js.map +1 -1
  92. package/dist/utilities/cx/index.cjs +9 -9
  93. package/dist/utilities/cx/index.cjs.map +1 -1
  94. package/dist/utilities/cx/index.d.ts +9 -9
  95. package/dist/utilities/cx/index.d.ts.map +1 -1
  96. package/dist/utilities/cx/index.js +9 -9
  97. package/dist/utilities/cx/index.js.map +1 -1
  98. package/dist/utilities/hrefUtils/index.cjs +10 -11
  99. package/dist/utilities/hrefUtils/index.cjs.map +1 -1
  100. package/dist/utilities/hrefUtils/index.d.ts +10 -11
  101. package/dist/utilities/hrefUtils/index.d.ts.map +1 -1
  102. package/dist/utilities/hrefUtils/index.js +10 -11
  103. package/dist/utilities/hrefUtils/index.js.map +1 -1
  104. package/dist/utilities/localStorageUtils/index.cjs +8 -5
  105. package/dist/utilities/localStorageUtils/index.cjs.map +1 -1
  106. package/dist/utilities/localStorageUtils/index.d.ts +8 -5
  107. package/dist/utilities/localStorageUtils/index.d.ts.map +1 -1
  108. package/dist/utilities/localStorageUtils/index.js +8 -5
  109. package/dist/utilities/localStorageUtils/index.js.map +1 -1
  110. package/dist/utilities/renderUtils/index.cjs +31 -30
  111. package/dist/utilities/renderUtils/index.cjs.map +1 -1
  112. package/dist/utilities/renderUtils/index.d.ts +31 -30
  113. package/dist/utilities/renderUtils/index.d.ts.map +1 -1
  114. package/dist/utilities/renderUtils/index.js +31 -30
  115. package/dist/utilities/renderUtils/index.js.map +1 -1
  116. package/dist/utilities/sessionStorageUtils/index.cjs +8 -5
  117. package/dist/utilities/sessionStorageUtils/index.cjs.map +1 -1
  118. package/dist/utilities/sessionStorageUtils/index.d.ts +8 -5
  119. package/dist/utilities/sessionStorageUtils/index.d.ts.map +1 -1
  120. package/dist/utilities/sessionStorageUtils/index.js +8 -5
  121. package/dist/utilities/sessionStorageUtils/index.js.map +1 -1
  122. package/dist/utilities/testIdUtils/index.cjs +44 -10
  123. package/dist/utilities/testIdUtils/index.cjs.map +1 -1
  124. package/dist/utilities/testIdUtils/index.d.ts +44 -10
  125. package/dist/utilities/testIdUtils/index.d.ts.map +1 -1
  126. package/dist/utilities/testIdUtils/index.js +44 -10
  127. package/dist/utilities/testIdUtils/index.js.map +1 -1
  128. package/package.json +1 -1
@@ -1,19 +1,18 @@
1
1
  /**
2
- * Validates a consumer-supplied `href` for safe use on an anchor.
2
+ * Validates a consumer-supplied `href` before it reaches an anchor: strips control characters
3
+ * and rejects schemes outside http, https, mailto and tel, blocking `javascript:` and `data:`
4
+ * URLs.
3
5
  *
4
- * Strips ASCII control characters, then rejects any explicit scheme outside
5
- * http/https/mailto/tel — blocking `javascript:`, `data:` and friends. Scheme-less
6
- * values (relative paths, fragments, bare domains) are allowed.
7
- *
8
- * @returns the cleaned href, or `undefined` when the href is not allowed (rendering
9
- * an anchor with no `href` rather than an executable one).
6
+ * @param href The value a consumer passed, possibly from user or CMS data.
7
+ * @returns The cleaned href, or `undefined` when blocked so the anchor renders without one.
10
8
  */
11
9
  export declare const safeHref: (href: string | undefined) => string | undefined;
12
10
  /**
13
- * Whether an href points at an external site (http/https), for `target="_blank"`
14
- * decisions. Unlike a bare `startsWith('http')`, this requires a real scheme match on
15
- * the control-character-stripped value, so `javascript:` never classifies as internal
16
- * by falling through, and `httpfoo` never classifies as external.
11
+ * Whether an href points at an external http/https site, for `target="_blank"` decisions,
12
+ * matched on the real scheme so `javascript:` and `httpfoo` never misclassify.
13
+ *
14
+ * @param href The value to classify; control characters are stripped first.
15
+ * @returns `true` only for an explicit `http:` or `https:` scheme.
17
16
  */
18
17
  export declare const isExternalHref: (href: string | undefined) => boolean;
19
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/hrefUtils/index.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAoB5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,OAAgF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/hrefUtils/index.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAoB5D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,OAAgF,CAAC"}
@@ -8,14 +8,12 @@ const KNOWN_BLOCKED_SCHEMES = ['javascript:', 'data:', 'vbscript:', 'file:', 'bl
8
8
  // biome-ignore lint/suspicious/noControlCharactersInRegex: removing control characters is the point
9
9
  const CONTROL_CHARACTERS = /[\u0000-\u001F\u007F]/g;
10
10
  /**
11
- * Validates a consumer-supplied `href` for safe use on an anchor.
11
+ * Validates a consumer-supplied `href` before it reaches an anchor: strips control characters
12
+ * and rejects schemes outside http, https, mailto and tel, blocking `javascript:` and `data:`
13
+ * URLs.
12
14
  *
13
- * Strips ASCII control characters, then rejects any explicit scheme outside
14
- * http/https/mailto/tel — blocking `javascript:`, `data:` and friends. Scheme-less
15
- * values (relative paths, fragments, bare domains) are allowed.
16
- *
17
- * @returns the cleaned href, or `undefined` when the href is not allowed (rendering
18
- * an anchor with no `href` rather than an executable one).
15
+ * @param href The value a consumer passed, possibly from user or CMS data.
16
+ * @returns The cleaned href, or `undefined` when blocked so the anchor renders without one.
19
17
  */
20
18
  const safeHref = (href) => {
21
19
  if (href === undefined) {
@@ -36,10 +34,11 @@ const safeHref = (href) => {
36
34
  return cleaned;
37
35
  };
38
36
  /**
39
- * Whether an href points at an external site (http/https), for `target="_blank"`
40
- * decisions. Unlike a bare `startsWith('http')`, this requires a real scheme match on
41
- * the control-character-stripped value, so `javascript:` never classifies as internal
42
- * by falling through, and `httpfoo` never classifies as external.
37
+ * Whether an href points at an external http/https site, for `target="_blank"` decisions,
38
+ * matched on the real scheme so `javascript:` and `httpfoo` never misclassify.
39
+ *
40
+ * @param href The value to classify; control characters are stripped first.
41
+ * @returns `true` only for an explicit `http:` or `https:` scheme.
43
42
  */
44
43
  const isExternalHref = (href) => /^https?:/i.test((href ?? '').replace(CONTROL_CHARACTERS, '').trim());
45
44
 
@@ -1 +1 @@
1
- {"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,EAAE;;"}
@@ -14,12 +14,15 @@ var localStorageUtils_constants = require('./localStorageUtils.constants.cjs');
14
14
  * — check there for the full list before adding a new one.
15
15
  */
16
16
  /**
17
- * Build a typed, failure-safe accessor for a single `localStorage` key.
17
+ * Builds a typed, failure-safe accessor for a single `localStorage` key.
18
18
  *
19
- * @example
20
- * const draft = createLocalStorageItem<Draft>('fd-draft');
21
- * draft.set({ title: 'Hi' });
22
- * const value = draft.get(); // Draft | null
19
+ * const draft = createLocalStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
20
+ *
21
+ * @param key The storage key; register it in `LOCAL_STORAGE_KEYS` first.
22
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
23
+ * `LocalStorageItemOptions`.
24
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
25
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
23
26
  */
24
27
  const createLocalStorageItem = (key, options = {}) => webStorage_utils.createWebStorageItem(() => window.localStorage, key, options);
25
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/utilities/localStorageUtils/index.ts"],"sourcesContent":[null],"names":["createWebStorageItem","LOCAL_STORAGE_KEYS","parseBooleanString","isBoolean","isString"],"mappings":";;;;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;AAOG;AACI,MAAM,sBAAsB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAsC,EAAE,KAC7FA,qCAAoB,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO;AAE9D;;;AAGG;MACU,uBAAuB,GAAG,sBAAsB,CAAUC,8CAAkB,CAAC,gBAAgB,EAAE;AAC1G,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAKC,mCAAkB,CAAC,GAAG,EAAE,iCAAiC,CAAC;AAChF,IAAA,QAAQ,EAAEC,0BAAS;AACpB,CAAA;AAED;MACa,gBAAgB,GAAG,sBAAsB,CAASF,8CAAkB,CAAC,SAAS,EAAE;AAC3F,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AACzB,IAAA,QAAQ,EAAEG,yBAAQ;AACnB,CAAA;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/utilities/localStorageUtils/index.ts"],"sourcesContent":[null],"names":["createWebStorageItem","LOCAL_STORAGE_KEYS","parseBooleanString","isBoolean","isString"],"mappings":";;;;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;;;;AAUG;AACI,MAAM,sBAAsB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAsC,EAAE,KAC7FA,qCAAoB,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO;AAE9D;;;AAGG;MACU,uBAAuB,GAAG,sBAAsB,CAAUC,8CAAkB,CAAC,gBAAgB,EAAE;AAC1G,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAKC,mCAAkB,CAAC,GAAG,EAAE,iCAAiC,CAAC;AAChF,IAAA,QAAQ,EAAEC,0BAAS;AACpB,CAAA;AAED;MACa,gBAAgB,GAAG,sBAAsB,CAASF,8CAAkB,CAAC,SAAS,EAAE;AAC3F,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AACzB,IAAA,QAAQ,EAAEG,yBAAQ;AACnB,CAAA;;;;;"}
@@ -27,12 +27,15 @@ export interface LocalStorageItemOptions<T> {
27
27
  validate?: (value: unknown) => value is T;
28
28
  }
29
29
  /**
30
- * Build a typed, failure-safe accessor for a single `localStorage` key.
30
+ * Builds a typed, failure-safe accessor for a single `localStorage` key.
31
31
  *
32
- * @example
33
- * const draft = createLocalStorageItem<Draft>('fd-draft');
34
- * draft.set({ title: 'Hi' });
35
- * const value = draft.get(); // Draft | null
32
+ * const draft = createLocalStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
33
+ *
34
+ * @param key The storage key; register it in `LOCAL_STORAGE_KEYS` first.
35
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
36
+ * `LocalStorageItemOptions`.
37
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
38
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
36
39
  */
37
40
  export declare const createLocalStorageItem: <T>(key: string, options?: LocalStorageItemOptions<T>) => LocalStorageItem<T>;
38
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/localStorageUtils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAI9B,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,KAAK,MAAM,EAAE,UAAS,uBAAuB,CAAC,CAAC,CAAM,KAAG,gBAAgB,CAAC,CAAC,CACrD,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,2BAIlC,CAAC;AAEH,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,0BAI3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/localStorageUtils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAI9B,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,KAAK,MAAM,EAAE,UAAS,uBAAuB,CAAC,CAAC,CAAM,KAAG,gBAAgB,CAAC,CAAC,CACrD,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,2BAIlC,CAAC;AAEH,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,0BAI3B,CAAC"}
@@ -12,12 +12,15 @@ import { LOCAL_STORAGE_KEYS } from './localStorageUtils.constants.js';
12
12
  * — check there for the full list before adding a new one.
13
13
  */
14
14
  /**
15
- * Build a typed, failure-safe accessor for a single `localStorage` key.
15
+ * Builds a typed, failure-safe accessor for a single `localStorage` key.
16
16
  *
17
- * @example
18
- * const draft = createLocalStorageItem<Draft>('fd-draft');
19
- * draft.set({ title: 'Hi' });
20
- * const value = draft.get(); // Draft | null
17
+ * const draft = createLocalStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
18
+ *
19
+ * @param key The storage key; register it in `LOCAL_STORAGE_KEYS` first.
20
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
21
+ * `LocalStorageItemOptions`.
22
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
23
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
21
24
  */
22
25
  const createLocalStorageItem = (key, options = {}) => createWebStorageItem(() => window.localStorage, key, options);
23
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utilities/localStorageUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;AAOG;AACI,MAAM,sBAAsB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAsC,EAAE,KAC7F,oBAAoB,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO;AAE9D;;;AAGG;MACU,uBAAuB,GAAG,sBAAsB,CAAU,kBAAkB,CAAC,gBAAgB,EAAE;AAC1G,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAK,kBAAkB,CAAC,GAAG,EAAE,iCAAiC,CAAC;AAChF,IAAA,QAAQ,EAAE,SAAS;AACpB,CAAA;AAED;MACa,gBAAgB,GAAG,sBAAsB,CAAS,kBAAkB,CAAC,SAAS,EAAE;AAC3F,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AACzB,IAAA,QAAQ,EAAE,QAAQ;AACnB,CAAA;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utilities/localStorageUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;;;;AAUG;AACI,MAAM,sBAAsB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAsC,EAAE,KAC7F,oBAAoB,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO;AAE9D;;;AAGG;MACU,uBAAuB,GAAG,sBAAsB,CAAU,kBAAkB,CAAC,gBAAgB,EAAE;AAC1G,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAK,kBAAkB,CAAC,GAAG,EAAE,iCAAiC,CAAC;AAChF,IAAA,QAAQ,EAAE,SAAS;AACpB,CAAA;AAED;MACa,gBAAgB,GAAG,sBAAsB,CAAS,kBAAkB,CAAC,SAAS,EAAE;AAC3F,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AACzB,IAAA,QAAQ,EAAE,QAAQ;AACnB,CAAA;;"}
@@ -4,10 +4,11 @@ var React = require('react');
4
4
  var importWithRetry_utils = require('./importWithRetry.utils.cjs');
5
5
 
6
6
  /**
7
- * Retrieves an environment variable.
7
+ * Reads an environment variable from `process.env` first (tests, SSR), then Vite's
8
+ * `import.meta.env`.
8
9
  *
9
- * @param key The key of the environment variable to retrieve.
10
- * @returns The value of the environment variable.
10
+ * @param key The variable name, such as `VITE_APPID_OVERRIDE`.
11
+ * @returns Its value, or an empty string when neither source defines it.
11
12
  */
12
13
  const getEnvironmentVariable = (key) => {
13
14
  // Prefer Node env in tests/SSR
@@ -23,10 +24,10 @@ const getEnvironmentVariable = (key) => {
23
24
  return viteEnv?.[key] ?? '';
24
25
  };
25
26
  /**
26
- * Retrieves a micro-frontend attribute.
27
+ * Reads an attribute from the `#flipdish-micro-frontend` container Portal mounts the app into.
27
28
  *
28
- * @param key The key of the attribute to retrieve.
29
- * @returns The value of the attribute.
29
+ * @param key The attribute name, such as `data-app-id`.
30
+ * @returns Its value, or an empty string when there is no document or no such attribute.
30
31
  */
31
32
  const getMicroFrontendAttribute = (key) => {
32
33
  if (typeof document === 'undefined') {
@@ -36,49 +37,42 @@ const getMicroFrontendAttribute = (key) => {
36
37
  return microFrontendDiv?.getAttribute(key) || '';
37
38
  };
38
39
  /**
39
- * Retrieves the AppId.
40
+ * Reads the app id: the `VITE_APPID_OVERRIDE` environment variable first, then the container's
41
+ * `data-app-id` attribute (`data-appid` for portal-library 5.1.0 and below). Read once at call
42
+ * time; a component will not re-render when the value changes.
40
43
  *
41
- * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.
42
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-app-id`.
43
- * Fallbacks to `data-appid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
44
- *
45
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
44
+ * @returns The app id, or an empty string when neither source provides one.
46
45
  */
47
46
  const getAppId = () => {
48
47
  return getEnvironmentVariable('VITE_APPID_OVERRIDE') || getMicroFrontendAttribute('data-app-id') || getMicroFrontendAttribute('data-appid');
49
48
  };
50
49
  /**
51
- * Retrieves the OrgId.
52
- *
53
- * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.
54
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-org-id`.
55
- * Fallbacks to `data-orgid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
50
+ * Reads the org id: the `VITE_ORGID_OVERRIDE` environment variable first, then the container's
51
+ * `data-org-id` attribute (`data-orgid` for portal-library 5.1.0 and below). Read once at call
52
+ * time; a component will not re-render when the value changes.
56
53
  *
57
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
54
+ * @returns The org id, or an empty string when neither source provides one.
58
55
  */
59
56
  const getOrgId = () => {
60
57
  return getEnvironmentVariable('VITE_ORGID_OVERRIDE') || getMicroFrontendAttribute('data-org-id') || getMicroFrontendAttribute('data-orgid');
61
58
  };
62
59
  /**
63
- * Retrieves the BrandId.
60
+ * Reads the brand id: the `VITE_BRANDID_OVERRIDE` environment variable first, then the
61
+ * container's `data-brand-id` attribute (`data-brandid` for portal-library 5.1.0 and below).
62
+ * Read once at call time; a component will not re-render when the value changes.
64
63
  *
65
- * Attempts to get the value from the environment variable `VITE_BRANDID_OVERRIDE`.
66
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-brand-id`.
67
- * Fallbacks to `data-brandid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
68
- *
69
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
64
+ * @returns The brand id, or an empty string when neither source provides one.
70
65
  */
71
66
  const getBrandId = () => {
72
67
  return getEnvironmentVariable('VITE_BRANDID_OVERRIDE') || getMicroFrontendAttribute('data-brand-id') || getMicroFrontendAttribute('data-brandid');
73
68
  };
74
69
  /**
75
- * Retrieves the isFlipdishStaff attribute.
76
- *
77
- * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.
78
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-is-flipdish-staff`.
79
- * Fallbacks to `data-isflipdishstaff` for backwards compatibility @flipdish/portal-library@5.1.0 and below
70
+ * Reads the Flipdish-staff flag: the `VITE_ISFLIPDISHSTAFFOVERRIDE` environment variable
71
+ * first, then the container's `data-is-flipdish-staff` attribute (`data-isflipdishstaff` for
72
+ * portal-library 5.1.0 and below). Read once at call time; a component will not re-render when
73
+ * the value changes.
80
74
  *
81
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
75
+ * @returns `true` when the value reads as true, otherwise `false`.
82
76
  */
83
77
  const getIsFlipdishStaff = () => {
84
78
  const stringValue = getEnvironmentVariable('VITE_ISFLIPDISHSTAFFOVERRIDE') ||
@@ -86,6 +80,13 @@ const getIsFlipdishStaff = () => {
86
80
  getMicroFrontendAttribute('data-isflipdishstaff');
87
81
  return stringValue?.toString() === 'true';
88
82
  };
83
+ /**
84
+ * `React.lazy` that reloads the page once when a dynamic import fails, on the assumption that
85
+ * a deploy replaced the chunk; a second failure after the reload is thrown as a real error.
86
+ *
87
+ * @param componentImport The `() => import('./Page')` factory you would pass to `React.lazy`.
88
+ * @returns A lazy component to render inside `Suspense`.
89
+ */
89
90
  // biome-ignore lint/suspicious/noExplicitAny: dynamic import factory shape isn't expressible without `any`; preserved from portal-library implementation
90
91
  const lazyWithRetry = (componentImport) => React.lazy(() => importWithRetry_utils.importWithRetry(componentImport));
91
92
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/utilities/renderUtils/index.ts"],"sourcesContent":[null],"names":["lazy","importWithRetry"],"mappings":";;;;;AAIA;;;;;AAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAW,KAAY;;AAE5D,IAAA,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;AACzF,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAW;IACnC;;;;;;AAMA,IAAA,MAAM,OAAO,GAAI,SAA6E;AAC9F,IAAA,OAAO,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE;AAC7B;AAEA;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,CAAC,GAAW,KAAY;AAC/D,IAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACnC,QAAA,OAAO,EAAE;IACX;IACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAC;IAC3E,OAAO,gBAAgB,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE;AAClD;AAEA;;;;;;;;AAQG;AACI,MAAM,QAAQ,GAAG,MAAa;AACnC,IAAA,OAAO,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,yBAAyB,CAAC,aAAa,CAAC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CAAC,GAAW,KAAY;AAC/D,IAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACnC,QAAA,OAAO,EAAE;IACX;IACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAC;IAC3E,OAAO,gBAAgB,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE;AAClD;AAEA;;;;;;AAMG;AACI,MAAM,QAAQ,GAAG,MAAa;AACnC,IAAA,OAAO,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,yBAAyB,CAAC,aAAa,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC;AAC7I;AAEA;;;;;;AAMG;AACI,MAAM,QAAQ,GAAG,MAAa;AACnC,IAAA,OAAO,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,yBAAyB,CAAC,aAAa,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC;AAC7I;AAEA;;;;;;AAMG;AACI,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,sBAAsB,CAAC,uBAAuB,CAAC,IAAI,yBAAyB,CAAC,eAAe,CAAC,IAAI,yBAAyB,CAAC,cAAc,CAAC;AACnJ;AAEA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,MAAc;AAC9C,IAAA,MAAM,WAAW,GACf,sBAAsB,CAAC,8BAA8B,CAAC;QACtD,yBAAyB,CAAC,wBAAwB,CAAC;QACnD,yBAAyB,CAAC,sBAAsB,CAAC;AACnD,IAAA,OAAO,WAAW,EAAE,QAAQ,EAAE,KAAK,MAAM;AAC3C;AAEA;;;;;;AAMG;AACH;AACO,MAAM,aAAa,GAAG,CAAC,eAA0B,KAAKA,UAAI,CAAC,MAAMC,qCAAe,CAAC,eAAe,CAAC;;;;;;;;"}
@@ -1,56 +1,57 @@
1
1
  /**
2
- * Retrieves an environment variable.
2
+ * Reads an environment variable from `process.env` first (tests, SSR), then Vite's
3
+ * `import.meta.env`.
3
4
  *
4
- * @param key The key of the environment variable to retrieve.
5
- * @returns The value of the environment variable.
5
+ * @param key The variable name, such as `VITE_APPID_OVERRIDE`.
6
+ * @returns Its value, or an empty string when neither source defines it.
6
7
  */
7
8
  export declare const getEnvironmentVariable: (key: string) => string;
8
9
  /**
9
- * Retrieves a micro-frontend attribute.
10
+ * Reads an attribute from the `#flipdish-micro-frontend` container Portal mounts the app into.
10
11
  *
11
- * @param key The key of the attribute to retrieve.
12
- * @returns The value of the attribute.
12
+ * @param key The attribute name, such as `data-app-id`.
13
+ * @returns Its value, or an empty string when there is no document or no such attribute.
13
14
  */
14
15
  export declare const getMicroFrontendAttribute: (key: string) => string;
15
16
  /**
16
- * Retrieves the AppId.
17
+ * Reads the app id: the `VITE_APPID_OVERRIDE` environment variable first, then the container's
18
+ * `data-app-id` attribute (`data-appid` for portal-library 5.1.0 and below). Read once at call
19
+ * time; a component will not re-render when the value changes.
17
20
  *
18
- * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.
19
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-app-id`.
20
- * Fallbacks to `data-appid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
21
- *
22
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
21
+ * @returns The app id, or an empty string when neither source provides one.
23
22
  */
24
23
  export declare const getAppId: () => string;
25
24
  /**
26
- * Retrieves the OrgId.
27
- *
28
- * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.
29
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-org-id`.
30
- * Fallbacks to `data-orgid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
25
+ * Reads the org id: the `VITE_ORGID_OVERRIDE` environment variable first, then the container's
26
+ * `data-org-id` attribute (`data-orgid` for portal-library 5.1.0 and below). Read once at call
27
+ * time; a component will not re-render when the value changes.
31
28
  *
32
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
29
+ * @returns The org id, or an empty string when neither source provides one.
33
30
  */
34
31
  export declare const getOrgId: () => string;
35
32
  /**
36
- * Retrieves the BrandId.
33
+ * Reads the brand id: the `VITE_BRANDID_OVERRIDE` environment variable first, then the
34
+ * container's `data-brand-id` attribute (`data-brandid` for portal-library 5.1.0 and below).
35
+ * Read once at call time; a component will not re-render when the value changes.
37
36
  *
38
- * Attempts to get the value from the environment variable `VITE_BRANDID_OVERRIDE`.
39
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-brand-id`.
40
- * Fallbacks to `data-brandid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
41
- *
42
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
37
+ * @returns The brand id, or an empty string when neither source provides one.
43
38
  */
44
39
  export declare const getBrandId: () => string;
45
40
  /**
46
- * Retrieves the isFlipdishStaff attribute.
47
- *
48
- * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.
49
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-is-flipdish-staff`.
50
- * Fallbacks to `data-isflipdishstaff` for backwards compatibility @flipdish/portal-library@5.1.0 and below
41
+ * Reads the Flipdish-staff flag: the `VITE_ISFLIPDISHSTAFFOVERRIDE` environment variable
42
+ * first, then the container's `data-is-flipdish-staff` attribute (`data-isflipdishstaff` for
43
+ * portal-library 5.1.0 and below). Read once at call time; a component will not re-render when
44
+ * the value changes.
51
45
  *
52
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
46
+ * @returns `true` when the value reads as true, otherwise `false`.
53
47
  */
54
48
  export declare const getIsFlipdishStaff: () => boolean;
49
+ /**
50
+ * `React.lazy` that reloads the page once when a dynamic import fails, on the assumption that
51
+ * a deploy replaced the chunk; a second failure after the reload is thrown as a real error.
52
+ *
53
+ * @param componentImport The `() => import('./Page')` factory you would pass to `React.lazy`.
54
+ * @returns A lazy component to render inside `Suspense`.
55
+ */
55
56
  export declare const lazyWithRetry: (componentImport: () => any) => import("react").LazyExoticComponent<import("react").ComponentType<any>>;
56
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/renderUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,MAYpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,KAAK,MAAM,KAAG,MAMvD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,QAAO,MAE3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,QAAO,MAE3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,QAAO,OAMrC,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,iBAAiB,MAAM,GAAG,4EAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/renderUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,MAYpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,KAAK,MAAM,KAAG,MAMvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,QAAO,MAE3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,QAAO,MAE3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAO,OAMrC,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,aAAa,GAAI,iBAAiB,MAAM,GAAG,4EAAiD,CAAC"}
@@ -2,10 +2,11 @@ import { lazy } from 'react';
2
2
  import { importWithRetry } from './importWithRetry.utils.js';
3
3
 
4
4
  /**
5
- * Retrieves an environment variable.
5
+ * Reads an environment variable from `process.env` first (tests, SSR), then Vite's
6
+ * `import.meta.env`.
6
7
  *
7
- * @param key The key of the environment variable to retrieve.
8
- * @returns The value of the environment variable.
8
+ * @param key The variable name, such as `VITE_APPID_OVERRIDE`.
9
+ * @returns Its value, or an empty string when neither source defines it.
9
10
  */
10
11
  const getEnvironmentVariable = (key) => {
11
12
  // Prefer Node env in tests/SSR
@@ -21,10 +22,10 @@ const getEnvironmentVariable = (key) => {
21
22
  return viteEnv?.[key] ?? '';
22
23
  };
23
24
  /**
24
- * Retrieves a micro-frontend attribute.
25
+ * Reads an attribute from the `#flipdish-micro-frontend` container Portal mounts the app into.
25
26
  *
26
- * @param key The key of the attribute to retrieve.
27
- * @returns The value of the attribute.
27
+ * @param key The attribute name, such as `data-app-id`.
28
+ * @returns Its value, or an empty string when there is no document or no such attribute.
28
29
  */
29
30
  const getMicroFrontendAttribute = (key) => {
30
31
  if (typeof document === 'undefined') {
@@ -34,49 +35,42 @@ const getMicroFrontendAttribute = (key) => {
34
35
  return microFrontendDiv?.getAttribute(key) || '';
35
36
  };
36
37
  /**
37
- * Retrieves the AppId.
38
+ * Reads the app id: the `VITE_APPID_OVERRIDE` environment variable first, then the container's
39
+ * `data-app-id` attribute (`data-appid` for portal-library 5.1.0 and below). Read once at call
40
+ * time; a component will not re-render when the value changes.
38
41
  *
39
- * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.
40
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-app-id`.
41
- * Fallbacks to `data-appid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
42
- *
43
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
42
+ * @returns The app id, or an empty string when neither source provides one.
44
43
  */
45
44
  const getAppId = () => {
46
45
  return getEnvironmentVariable('VITE_APPID_OVERRIDE') || getMicroFrontendAttribute('data-app-id') || getMicroFrontendAttribute('data-appid');
47
46
  };
48
47
  /**
49
- * Retrieves the OrgId.
50
- *
51
- * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.
52
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-org-id`.
53
- * Fallbacks to `data-orgid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
48
+ * Reads the org id: the `VITE_ORGID_OVERRIDE` environment variable first, then the container's
49
+ * `data-org-id` attribute (`data-orgid` for portal-library 5.1.0 and below). Read once at call
50
+ * time; a component will not re-render when the value changes.
54
51
  *
55
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
52
+ * @returns The org id, or an empty string when neither source provides one.
56
53
  */
57
54
  const getOrgId = () => {
58
55
  return getEnvironmentVariable('VITE_ORGID_OVERRIDE') || getMicroFrontendAttribute('data-org-id') || getMicroFrontendAttribute('data-orgid');
59
56
  };
60
57
  /**
61
- * Retrieves the BrandId.
58
+ * Reads the brand id: the `VITE_BRANDID_OVERRIDE` environment variable first, then the
59
+ * container's `data-brand-id` attribute (`data-brandid` for portal-library 5.1.0 and below).
60
+ * Read once at call time; a component will not re-render when the value changes.
62
61
  *
63
- * Attempts to get the value from the environment variable `VITE_BRANDID_OVERRIDE`.
64
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-brand-id`.
65
- * Fallbacks to `data-brandid` for backwards compatibility @flipdish/portal-library@5.1.0 and below
66
- *
67
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
62
+ * @returns The brand id, or an empty string when neither source provides one.
68
63
  */
69
64
  const getBrandId = () => {
70
65
  return getEnvironmentVariable('VITE_BRANDID_OVERRIDE') || getMicroFrontendAttribute('data-brand-id') || getMicroFrontendAttribute('data-brandid');
71
66
  };
72
67
  /**
73
- * Retrieves the isFlipdishStaff attribute.
74
- *
75
- * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.
76
- * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-is-flipdish-staff`.
77
- * Fallbacks to `data-isflipdishstaff` for backwards compatibility @flipdish/portal-library@5.1.0 and below
68
+ * Reads the Flipdish-staff flag: the `VITE_ISFLIPDISHSTAFFOVERRIDE` environment variable
69
+ * first, then the container's `data-is-flipdish-staff` attribute (`data-isflipdishstaff` for
70
+ * portal-library 5.1.0 and below). Read once at call time; a component will not re-render when
71
+ * the value changes.
78
72
  *
79
- * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
73
+ * @returns `true` when the value reads as true, otherwise `false`.
80
74
  */
81
75
  const getIsFlipdishStaff = () => {
82
76
  const stringValue = getEnvironmentVariable('VITE_ISFLIPDISHSTAFFOVERRIDE') ||
@@ -84,6 +78,13 @@ const getIsFlipdishStaff = () => {
84
78
  getMicroFrontendAttribute('data-isflipdishstaff');
85
79
  return stringValue?.toString() === 'true';
86
80
  };
81
+ /**
82
+ * `React.lazy` that reloads the page once when a dynamic import fails, on the assumption that
83
+ * a deploy replaced the chunk; a second failure after the reload is thrown as a real error.
84
+ *
85
+ * @param componentImport The `() => import('./Page')` factory you would pass to `React.lazy`.
86
+ * @returns A lazy component to render inside `Suspense`.
87
+ */
87
88
  // biome-ignore lint/suspicious/noExplicitAny: dynamic import factory shape isn't expressible without `any`; preserved from portal-library implementation
88
89
  const lazyWithRetry = (componentImport) => lazy(() => importWithRetry(componentImport));
89
90
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utilities/renderUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;;;;;AAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAW,KAAY;;AAE5D,IAAA,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,OAAO,CA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AAU,GAAG,MAAa;AACrC,IAAA,OAAO,sBAAsB,CAAC,uBAAuB,CAAC,IAAI,yBAAyB,CAAC,eAAe,CAAC,IAAI,yBAAyB,CAAC,cAAc,CAAC;AACnJ;AAEA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,MAAc;AAC9C,IAAA,MAAM,WAAW,GACf,sBAAsB,CAAC,8BAA8B,CAAC;QACtD,yBAAyB,CAAC,wBAAwB,CAAC;QACnD,yBAAyB,CAAC,sBAAsB,CAAC;AACnD,IAAA,OAAO,WAAW,EAAE,QAAQ,EAAE,KAAK,MAAM;AAC3C;AAEA;;;;;;AAMG;AACH;AACO,MAAM,aAAa,GAAG,CAAC,eAA0B,KAAK,IAAI,CAAC,MAAM,eAAe,CAAC,eAAe,CAAC;;"}
@@ -14,12 +14,15 @@ var sessionStorageUtils_constants = require('./sessionStorageUtils.constants.cjs
14
14
  * — check there for the full list before adding a new one.
15
15
  */
16
16
  /**
17
- * Build a typed, failure-safe accessor for a single `sessionStorage` key.
17
+ * Builds a typed, failure-safe accessor for a single `sessionStorage` key.
18
18
  *
19
- * @example
20
- * const draft = createSessionStorageItem<Draft>('fd-draft');
21
- * draft.set({ title: 'Hi' });
22
- * const value = draft.get(); // Draft | null
19
+ * const draft = createSessionStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
20
+ *
21
+ * @param key The storage key; register it in `SESSION_STORAGE_KEYS` first.
22
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
23
+ * `SessionStorageItemOptions`.
24
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
25
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
23
26
  */
24
27
  const createSessionStorageItem = (key, options = {}) => webStorage_utils.createWebStorageItem(() => window.sessionStorage, key, options);
25
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"sourcesContent":[null],"names":["createWebStorageItem","SESSION_STORAGE_KEYS","parseBooleanString","isBoolean"],"mappings":";;;;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;AAOG;AACI,MAAM,wBAAwB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAwC,EAAE,KACjGA,qCAAoB,CAAC,MAAM,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO;AAEhE;;;AAGG;MACU,yBAAyB,GAAG,wBAAwB,CAAUC,kDAAoB,CAAC,yBAAyB,EAAE;AACzH,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAKC,mCAAkB,CAAC,GAAG,EAAE,oCAAoC,CAAC;AACnF,IAAA,QAAQ,EAAEC,0BAAS;AACpB,CAAA;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"sourcesContent":[null],"names":["createWebStorageItem","SESSION_STORAGE_KEYS","parseBooleanString","isBoolean"],"mappings":";;;;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;;;;AAUG;AACI,MAAM,wBAAwB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAwC,EAAE,KACjGA,qCAAoB,CAAC,MAAM,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO;AAEhE;;;AAGG;MACU,yBAAyB,GAAG,wBAAwB,CAAUC,kDAAoB,CAAC,yBAAyB,EAAE;AACzH,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAKC,mCAAkB,CAAC,GAAG,EAAE,oCAAoC,CAAC;AACnF,IAAA,QAAQ,EAAEC,0BAAS;AACpB,CAAA;;;;"}
@@ -27,12 +27,15 @@ export interface SessionStorageItemOptions<T> {
27
27
  validate?: (value: unknown) => value is T;
28
28
  }
29
29
  /**
30
- * Build a typed, failure-safe accessor for a single `sessionStorage` key.
30
+ * Builds a typed, failure-safe accessor for a single `sessionStorage` key.
31
31
  *
32
- * @example
33
- * const draft = createSessionStorageItem<Draft>('fd-draft');
34
- * draft.set({ title: 'Hi' });
35
- * const value = draft.get(); // Draft | null
32
+ * const draft = createSessionStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
33
+ *
34
+ * @param key The storage key; register it in `SESSION_STORAGE_KEYS` first.
35
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
36
+ * `SessionStorageItemOptions`.
37
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
38
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
36
39
  */
37
40
  export declare const createSessionStorageItem: <T>(key: string, options?: SessionStorageItemOptions<T>) => SessionStorageItem<T>;
38
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAIhC,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,KAAK,MAAM,EAAE,UAAS,yBAAyB,CAAC,CAAC,CAAM,KAAG,kBAAkB,CAAC,CAAC,CACzD,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,6BAIpC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAIhC,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,KAAK,MAAM,EAAE,UAAS,yBAAyB,CAAC,CAAC,CAAM,KAAG,kBAAkB,CAAC,CAAC,CACzD,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,6BAIpC,CAAC"}
@@ -12,12 +12,15 @@ import { SESSION_STORAGE_KEYS } from './sessionStorageUtils.constants.js';
12
12
  * — check there for the full list before adding a new one.
13
13
  */
14
14
  /**
15
- * Build a typed, failure-safe accessor for a single `sessionStorage` key.
15
+ * Builds a typed, failure-safe accessor for a single `sessionStorage` key.
16
16
  *
17
- * @example
18
- * const draft = createSessionStorageItem<Draft>('fd-draft');
19
- * draft.set({ title: 'Hi' });
20
- * const value = draft.get(); // Draft | null
17
+ * const draft = createSessionStorageItem<Draft>('fd-draft'); draft.set({ title: 'Hi' }); draft.get(); // Draft | null
18
+ *
19
+ * @param key The storage key; register it in `SESSION_STORAGE_KEYS` first.
20
+ * @param options Custom `serialize`/`deserialize` and a `validate` guard; see
21
+ * `SessionStorageItemOptions`.
22
+ * @returns `get`, `set` and `clear` that never throw; `get()` returns `null` when storage is
23
+ * unavailable, while `set()` and `clear()` return `void` and ignore failures.
21
24
  */
22
25
  const createSessionStorageItem = (key, options = {}) => createWebStorageItem(() => window.sessionStorage, key, options);
23
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;AAOG;AACI,MAAM,wBAAwB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAwC,EAAE,KACjG,oBAAoB,CAAC,MAAM,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO;AAEhE;;;AAGG;MACU,yBAAyB,GAAG,wBAAwB,CAAU,oBAAoB,CAAC,yBAAyB,EAAE;AACzH,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAK,kBAAkB,CAAC,GAAG,EAAE,oCAAoC,CAAC;AACnF,IAAA,QAAQ,EAAE,SAAS;AACpB,CAAA;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utilities/sessionStorageUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;AASG;AA2BH;;;;;;;;;;AAUG;AACI,MAAM,wBAAwB,GAAG,CAAI,GAAW,EAAE,OAAA,GAAwC,EAAE,KACjG,oBAAoB,CAAC,MAAM,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO;AAEhE;;;AAGG;MACU,yBAAyB,GAAG,wBAAwB,CAAU,oBAAoB,CAAC,yBAAyB,EAAE;AACzH,IAAA,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,CAAC,GAAG,KAAK,kBAAkB,CAAC,GAAG,EAAE,oCAAoC,CAAC;AACnF,IAAA,QAAQ,EAAE,SAAS;AACpB,CAAA;;"}