@flipdish/portal-library 1.0.48 → 1.0.49

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.
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("react");const e=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}];module.exports=(n=[])=>{const[r,o]=t.useState((()=>{const t=[...e.map((t=>"string"==typeof t?t:t.key)),...n.map((t=>"string"==typeof t?t:t.key))],r={};return t.forEach((t=>{r[t]=null})),r}));return t.useEffect((()=>{const t=document.getElementById("flipdish-micro-frontend");if(!t)return void console.warn("Micro-frontend div not found");const r=[...e.map((t=>"string"==typeof t?t:t.key)),...n.map((t=>"string"==typeof t?t:t.key))],s=()=>{o((o=>{const s={...o};let i=!1;return r.forEach((r=>{const o=[...e,...n].find((t=>"string"==typeof t?t===r:t.key===r)),u=o&&"string"!=typeof o&&"type"in o?o.type:"string",p=(void 0)[`VITE_${("string"==typeof r?r:r.key).toUpperCase()}_OVERRIDE`];let f=null;if(p)f="boolean"===u?"true"===p.toString():"number"===u?Number(p):p;else{const e=`data-${"string"==typeof r?r:r.key}`,n=t.getAttribute(e);f="boolean"===u?"true"===n:"number"===u?n?Number(n):null:n}s[r]!==f&&(s[r]=f,i=!0)})),i?s:o}))};s();const i=new MutationObserver((()=>{s()}));return i.observe(t,{attributes:!0}),()=>i.disconnect()}),[n]),r};
2
+ //# sourceMappingURL=useMicroFrontendAttributes.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMicroFrontendAttributes.cjs.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\n/**\n * Custom hook to manage micro-frontend attributes.\n *\n * This hook initializes and updates a set of attributes based on a combination of predefined keys (ALWAYS_RETURN_KEYS)\n * and custom keys provided as arguments. The attributes are fetched from environment variables or DOM attributes\n * and are updated dynamically using a MutationObserver.\n *\n * @template T - The type of custom keys, which can be either a string or a KeyConfig object.\n *\n * @param {Array<T | KeyConfig>} [customKeys=[]] - An array of custom keys or KeyConfig objects to be included in the attributes.\n *\n * @returns {Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>} - A record of attributes with their values.\n *\n * @example\n * const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);\n * console.log(attributes);\n */\nconst useMicroFrontendAttributes = <T extends string | KeyConfig>(\n customKeys: (T | KeyConfig)[] = [],\n): Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> => {\n const [attributes, setAttributes] = useState(() => {\n // Create a union of all keys (ALWAYS_RETURN_KEYS and customKeys) and ensure they are all strings\n const allKeys: ExtractKey<AlwaysReturnKeys | T>[] = [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n\n // Initialize the state with null values for each of the keys\n const initialState: Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> = {} as Record<\n ExtractKey<AlwaysReturnKeys | T>,\n string | boolean | number | null\n >;\n\n allKeys.forEach((key) => {\n initialState[key] = null; // Set the value to null initially\n });\n\n return initialState;\n });\n\n useEffect(() => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n if (!microFrontendDiv) {\n console.warn('Micro-frontend div not found');\n return;\n }\n\n const allKeys: (string | T | AlwaysReturnKeys)[] = [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n\n const updateValues = () => {\n setAttributes((prev) => {\n const newAttributes: Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> = { ...prev };\n\n let isChanged = false; // To track if any attribute is changed\n\n allKeys.forEach((key) => {\n // Find the config for the current key (either in ALWAYS_RETURN_KEYS or customKeys)\n const keyConfig = [...ALWAYS_RETURN_KEYS, ...customKeys].find((config) =>\n typeof config === 'string' ? config === key : config.key === key,\n );\n const type = keyConfig && typeof keyConfig !== 'string' && 'type' in keyConfig ? keyConfig.type : 'string';\n\n // Fetch value from environment variable or DOM attribute\n const envVar = import.meta.env[`VITE_${(typeof key === 'string' ? key : key.key).toUpperCase()}_OVERRIDE`];\n let newValue: string | boolean | number | null = null;\n\n if (envVar) {\n if (type === 'boolean') {\n newValue = envVar.toString() === 'true';\n } else if (type === 'number') {\n newValue = Number(envVar);\n } else {\n newValue = envVar;\n }\n } else {\n const attributeKey = `data-${typeof key === 'string' ? key : key.key}`;\n const value = microFrontendDiv.getAttribute(attributeKey);\n\n if (type === 'boolean') {\n newValue = value === 'true';\n } else if (type === 'number') {\n newValue = value ? Number(value) : null;\n } else {\n newValue = value;\n }\n }\n\n // Check if the value has actually changed\n if (newAttributes[key as ExtractKey<AlwaysReturnKeys | T>] !== newValue) {\n newAttributes[key as ExtractKey<AlwaysReturnKeys | T>] = newValue;\n isChanged = true; // Mark that at least one value has changed\n }\n });\n\n return isChanged ? newAttributes : prev; // Only update if something has changed\n });\n };\n\n updateValues();\n\n const observer = new MutationObserver(() => {\n updateValues();\n });\n\n observer.observe(microFrontendDiv, { attributes: true });\n\n return () => observer.disconnect();\n }, [customKeys]);\n\n return attributes;\n};\n\nexport default useMicroFrontendAttributes;\n"],"names":["ALWAYS_RETURN_KEYS","key","type","customKeys","attributes","setAttributes","useState","allKeys","map","initialState","forEach","useEffect","microFrontendDiv","document","getElementById","console","warn","updateValues","prev","newAttributes","isChanged","keyConfig","find","config","envVar","undefined","toUpperCase","newValue","toString","Number","attributeKey","value","getAttribute","observer","MutationObserver","observe","disconnect"],"mappings":"oCASA,MAAMA,EAA6C,CAAC,QAAS,QAAS,CAAEC,IAAK,kBAAmBC,KAAM,2BAyBnE,CAC/BC,EAAgC,MAEhC,MAAOC,EAAYC,GAAiBC,EAAQA,UAAC,KAEzC,MAAMC,EAA8C,IAC7CP,EAAmBQ,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEE,EAAWK,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,OAI9DQ,EAA2F,CAAA,EASjG,OAJAF,EAAQG,SAAST,IACbQ,EAAaR,GAAO,IAAI,IAGrBQ,CAAY,IA2EvB,OAxEAE,EAAAA,WAAU,KACN,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,IAAKF,EAED,YADAG,QAAQC,KAAK,gCAIjB,MAAMT,EAA6C,IAC5CP,EAAmBQ,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEE,EAAWK,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,OAG9DgB,EAAe,KACjBZ,GAAea,IACX,MAAMC,EAA4F,IAAKD,GAEvG,IAAIE,GAAY,EAyChB,OAvCAb,EAAQG,SAAST,IAEb,MAAMoB,EAAY,IAAIrB,KAAuBG,GAAYmB,MAAMC,GACzC,iBAAXA,EAAsBA,IAAWtB,EAAMsB,EAAOtB,MAAQA,IAE3DC,EAAOmB,GAAkC,iBAAdA,GAA0B,SAAUA,EAAYA,EAAUnB,KAAO,SAG5FsB,QAASC,GAAgB,SAAwB,iBAARxB,EAAmBA,EAAMA,EAAIA,KAAKyB,0BACjF,IAAIC,EAA6C,KAEjD,GAAIH,EAEIG,EADS,YAATzB,EACiC,SAAtBsB,EAAOI,WACF,WAAT1B,EACI2B,OAAOL,GAEPA,MAEZ,CACH,MAAMM,EAAe,QAAuB,iBAAR7B,EAAmBA,EAAMA,EAAIA,MAC3D8B,EAAQnB,EAAiBoB,aAAaF,GAGxCH,EADS,YAATzB,EACqB,SAAV6B,EACK,WAAT7B,EACI6B,EAAQF,OAAOE,GAAS,KAExBA,CAElB,CAGGZ,EAAclB,KAA6C0B,IAC3DR,EAAclB,GAA2C0B,EACzDP,GAAY,EACf,IAGEA,EAAYD,EAAgBD,CAAI,GACzC,EAGND,IAEA,MAAMgB,EAAW,IAAIC,kBAAiB,KAClCjB,GAAc,IAKlB,OAFAgB,EAASE,QAAQvB,EAAkB,CAAER,YAAY,IAE1C,IAAM6B,EAASG,YAAY,GACnC,CAACjC,IAEGC,CAAU"}
@@ -0,0 +1,28 @@
1
+ type KeyType = 'string' | 'boolean' | 'number';
2
+ interface KeyConfig {
3
+ key: string;
4
+ type?: KeyType;
5
+ }
6
+ declare const ALWAYS_RETURN_KEYS: (string | KeyConfig)[];
7
+ type AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig ? (typeof ALWAYS_RETURN_KEYS)[number]['key'] : (typeof ALWAYS_RETURN_KEYS)[number];
8
+ type ExtractKey<T> = T extends KeyConfig ? T['key'] : T;
9
+ /**
10
+ * Custom hook to manage micro-frontend attributes.
11
+ *
12
+ * This hook initializes and updates a set of attributes based on a combination of predefined keys (ALWAYS_RETURN_KEYS)
13
+ * and custom keys provided as arguments. The attributes are fetched from environment variables or DOM attributes
14
+ * and are updated dynamically using a MutationObserver.
15
+ *
16
+ * @template T - The type of custom keys, which can be either a string or a KeyConfig object.
17
+ *
18
+ * @param {Array<T | KeyConfig>} [customKeys=[]] - An array of custom keys or KeyConfig objects to be included in the attributes.
19
+ *
20
+ * @returns {Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>} - A record of attributes with their values.
21
+ *
22
+ * @example
23
+ * const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);
24
+ * console.log(attributes);
25
+ */
26
+ declare const useMicroFrontendAttributes: <T extends string | KeyConfig>(customKeys?: (T | KeyConfig)[]) => Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>;
27
+
28
+ export { useMicroFrontendAttributes as default };
@@ -0,0 +1,2 @@
1
+ import{useState as t,useEffect as e}from"react";const n=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}],o=(o=[])=>{const[r,i]=t((()=>{const t=[...n.map((t=>"string"==typeof t?t:t.key)),...o.map((t=>"string"==typeof t?t:t.key))],e={};return t.forEach((t=>{e[t]=null})),e}));return e((()=>{const t=document.getElementById("flipdish-micro-frontend");if(!t)return void console.warn("Micro-frontend div not found");const e=[...n.map((t=>"string"==typeof t?t:t.key)),...o.map((t=>"string"==typeof t?t:t.key))],r=()=>{i((r=>{const i={...r};let s=!1;return e.forEach((e=>{const r=[...n,...o].find((t=>"string"==typeof t?t===e:t.key===e)),p=r&&"string"!=typeof r&&"type"in r?r.type:"string",a=import.meta.env[`VITE_${("string"==typeof e?e:e.key).toUpperCase()}_OVERRIDE`];let f=null;if(a)f="boolean"===p?"true"===a.toString():"number"===p?Number(a):a;else{const n=`data-${"string"==typeof e?e:e.key}`,o=t.getAttribute(n);f="boolean"===p?"true"===o:"number"===p?o?Number(o):null:o}i[e]!==f&&(i[e]=f,s=!0)})),s?i:r}))};r();const s=new MutationObserver((()=>{r()}));return s.observe(t,{attributes:!0}),()=>s.disconnect()}),[o]),r};export{o as default};
2
+ //# sourceMappingURL=useMicroFrontendAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMicroFrontendAttributes.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\n/**\n * Custom hook to manage micro-frontend attributes.\n *\n * This hook initializes and updates a set of attributes based on a combination of predefined keys (ALWAYS_RETURN_KEYS)\n * and custom keys provided as arguments. The attributes are fetched from environment variables or DOM attributes\n * and are updated dynamically using a MutationObserver.\n *\n * @template T - The type of custom keys, which can be either a string or a KeyConfig object.\n *\n * @param {Array<T | KeyConfig>} [customKeys=[]] - An array of custom keys or KeyConfig objects to be included in the attributes.\n *\n * @returns {Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>} - A record of attributes with their values.\n *\n * @example\n * const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);\n * console.log(attributes);\n */\nconst useMicroFrontendAttributes = <T extends string | KeyConfig>(\n customKeys: (T | KeyConfig)[] = [],\n): Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> => {\n const [attributes, setAttributes] = useState(() => {\n // Create a union of all keys (ALWAYS_RETURN_KEYS and customKeys) and ensure they are all strings\n const allKeys: ExtractKey<AlwaysReturnKeys | T>[] = [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n\n // Initialize the state with null values for each of the keys\n const initialState: Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> = {} as Record<\n ExtractKey<AlwaysReturnKeys | T>,\n string | boolean | number | null\n >;\n\n allKeys.forEach((key) => {\n initialState[key] = null; // Set the value to null initially\n });\n\n return initialState;\n });\n\n useEffect(() => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n if (!microFrontendDiv) {\n console.warn('Micro-frontend div not found');\n return;\n }\n\n const allKeys: (string | T | AlwaysReturnKeys)[] = [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n\n const updateValues = () => {\n setAttributes((prev) => {\n const newAttributes: Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null> = { ...prev };\n\n let isChanged = false; // To track if any attribute is changed\n\n allKeys.forEach((key) => {\n // Find the config for the current key (either in ALWAYS_RETURN_KEYS or customKeys)\n const keyConfig = [...ALWAYS_RETURN_KEYS, ...customKeys].find((config) =>\n typeof config === 'string' ? config === key : config.key === key,\n );\n const type = keyConfig && typeof keyConfig !== 'string' && 'type' in keyConfig ? keyConfig.type : 'string';\n\n // Fetch value from environment variable or DOM attribute\n const envVar = import.meta.env[`VITE_${(typeof key === 'string' ? key : key.key).toUpperCase()}_OVERRIDE`];\n let newValue: string | boolean | number | null = null;\n\n if (envVar) {\n if (type === 'boolean') {\n newValue = envVar.toString() === 'true';\n } else if (type === 'number') {\n newValue = Number(envVar);\n } else {\n newValue = envVar;\n }\n } else {\n const attributeKey = `data-${typeof key === 'string' ? key : key.key}`;\n const value = microFrontendDiv.getAttribute(attributeKey);\n\n if (type === 'boolean') {\n newValue = value === 'true';\n } else if (type === 'number') {\n newValue = value ? Number(value) : null;\n } else {\n newValue = value;\n }\n }\n\n // Check if the value has actually changed\n if (newAttributes[key as ExtractKey<AlwaysReturnKeys | T>] !== newValue) {\n newAttributes[key as ExtractKey<AlwaysReturnKeys | T>] = newValue;\n isChanged = true; // Mark that at least one value has changed\n }\n });\n\n return isChanged ? newAttributes : prev; // Only update if something has changed\n });\n };\n\n updateValues();\n\n const observer = new MutationObserver(() => {\n updateValues();\n });\n\n observer.observe(microFrontendDiv, { attributes: true });\n\n return () => observer.disconnect();\n }, [customKeys]);\n\n return attributes;\n};\n\nexport default useMicroFrontendAttributes;\n"],"names":["ALWAYS_RETURN_KEYS","key","type","useMicroFrontendAttributes","customKeys","attributes","setAttributes","useState","allKeys","map","initialState","forEach","useEffect","microFrontendDiv","document","getElementById","console","warn","updateValues","prev","newAttributes","isChanged","keyConfig","find","config","envVar","env","toUpperCase","newValue","toString","Number","attributeKey","value","getAttribute","observer","MutationObserver","observe","disconnect"],"mappings":"gDASA,MAAMA,EAA6C,CAAC,QAAS,QAAS,CAAEC,IAAK,kBAAmBC,KAAM,YAyBhGC,EAA6B,CAC/BC,EAAgC,MAEhC,MAAOC,EAAYC,GAAiBC,GAAS,KAEzC,MAAMC,EAA8C,IAC7CR,EAAmBS,KAAKR,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEG,EAAWK,KAAKR,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,OAI9DS,EAA2F,CAAA,EASjG,OAJAF,EAAQG,SAASV,IACbS,EAAaT,GAAO,IAAI,IAGrBS,CAAY,IA2EvB,OAxEAE,GAAU,KACN,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,IAAKF,EAED,YADAG,QAAQC,KAAK,gCAIjB,MAAMT,EAA6C,IAC5CR,EAAmBS,KAAKR,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEG,EAAWK,KAAKR,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,OAG9DiB,EAAe,KACjBZ,GAAea,IACX,MAAMC,EAA4F,IAAKD,GAEvG,IAAIE,GAAY,EAyChB,OAvCAb,EAAQG,SAASV,IAEb,MAAMqB,EAAY,IAAItB,KAAuBI,GAAYmB,MAAMC,GACzC,iBAAXA,EAAsBA,IAAWvB,EAAMuB,EAAOvB,MAAQA,IAE3DC,EAAOoB,GAAkC,iBAAdA,GAA0B,SAAUA,EAAYA,EAAUpB,KAAO,SAG5FuB,cAAqBC,IAAI,SAAwB,iBAARzB,EAAmBA,EAAMA,EAAIA,KAAK0B,0BACjF,IAAIC,EAA6C,KAEjD,GAAIH,EAEIG,EADS,YAAT1B,EACiC,SAAtBuB,EAAOI,WACF,WAAT3B,EACI4B,OAAOL,GAEPA,MAEZ,CACH,MAAMM,EAAe,QAAuB,iBAAR9B,EAAmBA,EAAMA,EAAIA,MAC3D+B,EAAQnB,EAAiBoB,aAAaF,GAGxCH,EADS,YAAT1B,EACqB,SAAV8B,EACK,WAAT9B,EACI8B,EAAQF,OAAOE,GAAS,KAExBA,CAElB,CAGGZ,EAAcnB,KAA6C2B,IAC3DR,EAAcnB,GAA2C2B,EACzDP,GAAY,EACf,IAGEA,EAAYD,EAAgBD,CAAI,GACzC,EAGND,IAEA,MAAMgB,EAAW,IAAIC,kBAAiB,KAClCjB,GAAc,IAKlB,OAFAgB,EAASE,QAAQvB,EAAkB,CAAER,YAAY,IAE1C,IAAM6B,EAASG,YAAY,GACnC,CAACjC,IAEGC,CAAU"}
@@ -0,0 +1,13 @@
1
+ type Props = {
2
+ fieldError?: string;
3
+ showError?: boolean;
4
+ touched: boolean;
5
+ value: string;
6
+ };
7
+ /**
8
+ * @description Use this with Formik - the touched field state is not available immediately because ```form.setFieldValue``` is async
9
+ * @description https://github.com/formium/formik/issues/529#issuecomment-571294217
10
+ */
11
+ declare const useRenderValidText: ({ fieldError, showError, touched, value }: Props) => string | JSX.Element;
12
+
13
+ export { useRenderValidText as default };
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),t=require("./ui/PageLayout/PageLayout.cjs.js"),o=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),a=require("./ui/Spacer/Spacer.cjs.js"),c=require("./ui/Chip/Chip.cjs.js"),u=require("./ui/Switch/Switch.cjs.js"),n=require("./ui/Form/utilities/formValidation.cjs.js"),l=require("./ui/Form/GenericAutocompleteField.cjs.js"),p=require("./ui/Form/GenericFormContainer.cjs.js"),d=require("./ui/Form/GenericTextField.cjs.js"),j=require("./ui/Form/PaginatedAutocompleteField.cjs.js"),x=require("./ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js"),m=require("./ui/GenericRadioButtons/GenericRadioButtons.cjs.js"),F=require("./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.cjs.js"),q=require("./ui/GenericTable/GenericTable.cjs.js"),T=require("./ui/GenericTableBody/GenericTableBody.cjs.js"),G=require("./ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js"),P=require("./ui/GenericTableTitle/GenericTableTitle.cjs.js");require("react/jsx-runtime"),require("react"),require("../providers/TranslationProvider.cjs.js");var g=require("./renderUtilities/renderUtilities.cjs.js");exports.flipdishPublicTheme=e,exports.NotFoundPage=i,exports.FlipdishStaffContainer=r,exports.PageLayout=t.default,exports.PortalMock=o,exports.LazyComponent=s,exports.Spacer=a,exports.Chip=c,exports.Switch=u,exports.formikValidate=n.formikValidate,exports.GenericAutocompleteField=l,exports.GenericFormContainer=p,exports.GenericTextField=d,exports.PaginatedAutocompleteField=j,exports.GenericDatePickerField=x,exports.GenericRadioButtons=m,exports.DateTimeLocalizationProvider=F,exports.GenericTable=q,exports.GenericTableBody=T,exports.GenericTableBodyRow=G,exports.GenericTableTitle=P,exports.getAppId=g.getAppId,exports.getIsFlipdishStaff=g.getIsFlipdishStaff,exports.getMicroFrontendAttribute=g.getMicroFrontendAttribute,exports.getOrgId=g.getOrgId,exports.lazyWithRetry=g.lazyWithRetry;
1
+ "use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),t=require("./ui/PageLayout/PageLayout.cjs.js"),o=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),c=require("./ui/Spacer/Spacer.cjs.js"),u=require("./ui/Chip/Chip.cjs.js"),a=require("./ui/Switch/Switch.cjs.js"),n=require("./ui/Form/utilities/formValidation.cjs.js"),l=require("./ui/Form/GenericAutocompleteField.cjs.js"),p=require("./ui/Form/GenericFormContainer.cjs.js"),d=require("./ui/Form/GenericTextField.cjs.js"),j=require("./ui/Form/PaginatedAutocompleteField.cjs.js"),x=require("./ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js"),F=require("./ui/GenericRadioButtons/GenericRadioButtons.cjs.js"),m=require("./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.cjs.js"),T=require("./ui/GenericTable/GenericTable.cjs.js"),q=require("./ui/GenericTableBody/GenericTableBody.cjs.js"),G=require("./ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js"),h=require("./ui/GenericTableTitle/GenericTableTitle.cjs.js"),P=require("./custom-hooks/useRenderValidText.cjs.js"),b=require("./custom-hooks/useMicroFrontendAttributes.cjs.js"),g=require("./renderUtilities/renderUtilities.cjs.js");exports.flipdishPublicTheme=e,exports.NotFoundPage=i,exports.FlipdishStaffContainer=r,exports.PageLayout=t.default,exports.PortalMock=o,exports.LazyComponent=s,exports.Spacer=c,exports.Chip=u,exports.Switch=a,exports.formikValidate=n.formikValidate,exports.GenericAutocompleteField=l,exports.GenericFormContainer=p,exports.GenericTextField=d,exports.PaginatedAutocompleteField=j,exports.GenericDatePickerField=x,exports.GenericRadioButtons=F,exports.DateTimeLocalizationProvider=m,exports.GenericTable=T,exports.GenericTableBody=q,exports.GenericTableBodyRow=G,exports.GenericTableTitle=h,exports.useRenderValidText=P,exports.useMicroFrontendAttributes=b,exports.getAppId=g.getAppId,exports.getIsFlipdishStaff=g.getIsFlipdishStaff,exports.getMicroFrontendAttribute=g.getMicroFrontendAttribute,exports.getOrgId=g.getOrgId,exports.lazyWithRetry=g.lazyWithRetry;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -20,4 +20,6 @@ export { default as GenericTable } from './ui/GenericTable/GenericTable.js';
20
20
  export { default as GenericTableBody } from './ui/GenericTableBody/GenericTableBody.js';
21
21
  export { default as GenericTableBodyRow } from './ui/GenericTableBodyRow/GenericTableBodyRow.js';
22
22
  export { default as GenericTableTitle } from './ui/GenericTableTitle/GenericTableTitle.js';
23
+ export { default as useRenderValidText } from './custom-hooks/useRenderValidText.js';
24
+ export { default as useMicroFrontendAttributes } from './custom-hooks/useMicroFrontendAttributes.js';
23
25
  export { getAppId, getIsFlipdishStaff, getMicroFrontendAttribute, getOrgId, lazyWithRetry } from './renderUtilities/renderUtilities.js';
@@ -1,2 +1,2 @@
1
- export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as GenericDatePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";import"react/jsx-runtime";import"react";import"../providers/TranslationProvider.js";export{getAppId,getIsFlipdishStaff,getMicroFrontendAttribute,getOrgId,lazyWithRetry}from"./renderUtilities/renderUtilities.js";
1
+ export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as GenericDatePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";export{default as useRenderValidText}from"./custom-hooks/useRenderValidText.js";export{default as useMicroFrontendAttributes}from"./custom-hooks/useMicroFrontendAttributes.js";export{getAppId,getIsFlipdishStaff,getMicroFrontendAttribute,getOrgId,lazyWithRetry}from"./renderUtilities/renderUtilities.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderUtilities.cjs.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","undefined","VITE_APPID_OVERRIDE","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","VITE_ORGID_OVERRIDE","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"oCAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,mBAGzC,UACbK,GAAgBC,qBAAuBP,EAA0B,yCAO1C,KAC9B,MAAMQ,QAAcF,GAAgBG,8BAAgCT,EAA0B,wBAC9F,MAAmC,SAA5BQ,GAAaE,UAAqB,uDANrB,UACbJ,GAAgBK,qBAAuBX,EAA0B,oCAS9CY,GAC1BC,EAAAA,MAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
1
+ {"version":3,"file":"renderUtilities.cjs.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\n/**\n * Retrieves the AppId.\n *\n * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-appId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\n/**\n * Retrieves the OrgId.\n *\n * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-orgId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\n/**\n * Retrieves the isFlipdishStaff attribute.\n *\n * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-isFlipdishStaff`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","undefined","VITE_APPID_OVERRIDE","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","VITE_ORGID_OVERRIDE","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"oCAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,mBAWzC,UACbK,GAAgBC,qBAAuBP,EAA0B,yCAuB1C,KAC9B,MAAMQ,QAAcF,GAAgBG,8BAAgCT,EAA0B,wBAC9F,MAAmC,SAA5BQ,GAAaE,UAAqB,uDAdrB,UACbJ,GAAgBK,qBAAuBX,EAA0B,oCAiB9CY,GAC1BC,EAAAA,MAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
@@ -1,8 +1,32 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  declare const getMicroFrontendAttribute: (key: string) => string | null;
4
+ /**
5
+ * Retrieves the AppId.
6
+ *
7
+ * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.
8
+ * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-appId`.
9
+ *
10
+ * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
11
+ */
4
12
  declare const getAppId: () => string | null;
13
+ /**
14
+ * Retrieves the OrgId.
15
+ *
16
+ * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.
17
+ * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-orgId`.
18
+ *
19
+ * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
20
+ */
5
21
  declare const getOrgId: () => string | null;
22
+ /**
23
+ * Retrieves the isFlipdishStaff attribute.
24
+ *
25
+ * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.
26
+ * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-isFlipdishStaff`.
27
+ *
28
+ * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.
29
+ */
6
30
  declare const getIsFlipdishStaff: () => boolean;
7
31
  declare const lazyWithRetry: (componentImport: () => any) => React.LazyExoticComponent<React.ComponentType<any>>;
8
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"renderUtilities.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","getAppId","env","VITE_APPID_OVERRIDE","getOrgId","VITE_ORGID_OVERRIDE","getIsFlipdishStaff","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","lazyWithRetry","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"6BAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,EAGpDK,EAAW,gBACDC,IAAIC,qBAAuBR,EAA0B,cAG/DS,EAAW,gBACDF,IAAIG,qBAAuBV,EAA0B,cAG/DW,EAAqB,KAC9B,MAAMC,cAA0BL,IAAIM,8BAAgCb,EAA0B,wBAC9F,MAAmC,SAA5BY,GAAaE,UAAqB,EAIhCC,EAAiBC,GAC1BC,GAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
1
+ {"version":3,"file":"renderUtilities.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv && microFrontendDiv.getAttribute(key);\n};\n\n/**\n * Retrieves the AppId.\n *\n * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-appId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\n/**\n * Retrieves the OrgId.\n *\n * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-orgId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\n/**\n * Retrieves the isFlipdishStaff attribute.\n *\n * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-isFlipdishStaff`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","getAppId","env","VITE_APPID_OVERRIDE","getOrgId","VITE_ORGID_OVERRIDE","getIsFlipdishStaff","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","lazyWithRetry","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"6BAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAoBA,EAAiBG,aAAaJ,EAAI,EAWpDK,EAAW,gBACDC,IAAIC,qBAAuBR,EAA0B,cAW/DS,EAAW,gBACDF,IAAIG,qBAAuBV,EAA0B,cAW/DW,EAAqB,KAC9B,MAAMC,cAA0BL,IAAIM,8BAAgCb,EAA0B,wBAC9F,MAAmC,SAA5BY,GAAaE,UAAqB,EAIhCC,EAAiBC,GAC1BC,GAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/portal-library",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "files": [
5
5
  "dist"
6
6
  ],