@telia-ace/widget-services 1.0.27-next.0 → 1.0.27-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/storage/types.ts","../src/storage/storage.ts","../src/storage/utils.ts","../src/storage/legacy-storage-provider.ts","../../../node_modules/.pnpm/@webprovisions+platform@1.1.3-rc.3/node_modules/@webprovisions/platform/dist/index.js","../src/storage/storage-policy-configuration-api.ts"],"sourcesContent":["export enum StorageMedium {\n Cookie = 'cookie',\n Local = 'local',\n Session = 'session',\n}\n\nexport enum StorageScope {\n Tenant = 'tenant',\n Implementation = 'implementation',\n Widget = 'widget',\n}\n\nexport type Store = {\n tenant: StorageContainer;\n implementation: StorageContainer;\n widget: StorageContainer;\n};\n\nexport type StorageContainer = { [key: string]: StoredValue };\n\nexport type StoredValue = {\n value: any;\n expiration?: string;\n category: StorageCategory;\n};\n\nexport enum StorageCategory {\n Necessary = 'necessary',\n Functional = 'functional',\n Analytical = 'analytical',\n Marketing = 'marketing',\n}\n\nexport type StorageWriter = (value?: any) => Promise<void>;\n\nexport type StorageConfigurationOptions = {\n consent?: StorageConsent;\n};\n\nexport type StorageConsent = number | number[] | StorageCategory | StorageCategory[];\n\nexport type Duration = {\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport type StorageWriterOptions = {\n scope?: StorageScope;\n duration?: Duration;\n medium?: StorageMedium;\n};\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n StorageCategory,\n StorageMedium,\n StorageScope,\n StorageWriter,\n StorageWriterOptions,\n} from './types';\nimport {\n createEmptyStore,\n createValue,\n getApplicationStoreAsync,\n getCookieStoreAsync,\n getValue,\n isNotAllowedAsync,\n processStorage,\n setApplicationStoreAsync,\n setCookieStoreAsync,\n} from './utils';\n\n/**\n * Creates a writer to be used to write to cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to use when writing.\n * @param category StorageCategory to use when writing.\n * @param options StorageWriterOptions to use when writing default {scope: StorageScope.Widget, medium = StorageMedium.Session, duration = infinite }.\n * @returns a function to be used to write a value to the storage using given settings.\n */\nexport const createStorageWriter = (\n container: Container,\n key: string,\n category: StorageCategory,\n options: StorageWriterOptions = {}\n): Promise<StorageWriter> => {\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (process.env.NODE_ENV !== 'production') {\n if (notAllowed) {\n Logger.warn(\n `createStorageWriter: Attempted to create storage writer using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Options: ${JSON.stringify(options)}`\n );\n }\n }\n\n return (value: any) => {\n processStorage(container);\n\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (notAllowed) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storageWriter: Attempted to write to storage using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}`\n );\n }\n return;\n }\n\n const {\n scope = StorageScope.Widget,\n medium = StorageMedium.Session,\n duration,\n } = options;\n\n const store = createEmptyStore();\n store[scope][key] = createValue(value, category, duration);\n\n if (medium === StorageMedium.Cookie) return setCookieStoreAsync(container, store);\n else return setApplicationStoreAsync(container, medium, store);\n });\n };\n });\n};\n\n/**\n * Read the widget cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to read.\n * @param medium Storage medium to read from (default: session).\n * @returns the value stored with passed key.\n */\nexport const readStorage = <Type>(\n container: Container,\n key: string,\n medium: StorageMedium = StorageMedium.Session\n): Promise<Type | undefined> => {\n processStorage(container);\n\n if (typeof key === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn('readStorage: Undefined key passed when reading storage. ', key, medium);\n }\n return Promise.resolve(undefined);\n }\n\n if (medium === StorageMedium.Cookie)\n return getCookieStoreAsync(container).then((store) => getValue(store, key));\n else return getApplicationStoreAsync(container, medium).then((store) => getValue(store, key));\n};\n","import { deepClone, hash, lock } from '@telia-ace/widget-utilities';\nimport { Container, Widget } from '@webprovisions/platform';\nimport { readStorage } from './storage';\nimport {\n Duration,\n StorageCategory,\n StorageContainer,\n StorageMedium,\n Store,\n StoredValue\n} from './types';\n\nconst hasEntries = (object: object) =>\n !!Object.entries(object).filter(([_, value]) => typeof value !== 'undefined').length;\n\nconst cleanUndefined = (object: StorageContainer) =>\n Object.entries(object)\n .filter(([_, value]) => typeof value !== 'undefined')\n .forEach(([key, { value }]) => {\n if (typeof value === 'undefined') {\n delete object[key];\n }\n });\n\nconst mergeAndClean = (target: Store, source: Store): Store => {\n const merged: Store = {\n tenant: { ...target.tenant, ...source.tenant },\n implementation: { ...target.implementation, ...source.implementation },\n widget: { ...target.widget, ...source.widget }\n };\n\n cleanUndefined(merged.tenant);\n cleanUndefined(merged.implementation);\n cleanUndefined(merged.widget);\n\n return merged;\n};\n\nconst getLongestExpirationDate = (store: Store): string => {\n const expirationDates = Object.entries(store).reduce<string[]>((acc, storeEntry) => {\n const [_, container] = storeEntry;\n Object.entries(container).forEach((containerEntry) => {\n const [_, { expiration }] = containerEntry;\n if (expiration) acc.push(expiration);\n });\n return acc;\n }, []);\n\n return (\n expirationDates\n .slice()\n .sort((a, b) => new Date(b).valueOf() - new Date(a).valueOf())\n .shift() || createExpirationDate()\n );\n};\n\nconst createStorageKeys = (\n container: Container\n): [tenant: string, implementation: string, widget: string] => {\n const {\n name: widgetName,\n implementation: { name: implementationName, tenant: tenantName },\n } = <Widget>container.get('$widget');\n\n return [\n `humany_${tenantName}`,\n `humany_${hash(tenantName + implementationName)}`,\n `humany_${hash(tenantName + implementationName + widgetName)}`,\n ];\n};\n\nconst getCookie = <Type>(cookieName: string): Type | undefined => {\n const regExp = new RegExp(`(?:^|;)\\\\s?${cookieName}=(.*?)(?:;|$)`, 'i');\n const cookie = document.cookie.match(regExp);\n const value = cookie && cookie[1] && JSON.parse(cookie[1]);\n\n return value || undefined;\n};\n\nconst setCookie = (cookieName: string, value: any, expires: string) => {\n const cookie = `${cookieName}=${JSON.stringify(value).trim()}`;\n const expiration = `expires=${new Date(expires).toUTCString()}`;\n const path = 'path=/';\n const options = 'SameSite=None;Secure'\n return (document.cookie = `${cookie}; ${expiration}; ${path}; ${options}`);\n};\n\nconst getCookieStore = (container: Container): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = getCookie<StorageContainer>(tenantKey) || {};\n const implementation = getCookie<StorageContainer>(implementationKey) || {};\n const widget = getCookie<StorageContainer>(widgetKey) || {};\n\n return {\n tenant,\n implementation,\n widget,\n };\n};\n\nconst setCookieStore = (container: Container, store: Store): void => {\n const current = getCookieStore(container);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n const expirationDate = getLongestExpirationDate(store);\n const deleteDate = createExpirationDate({ days: -1 });\n\n setCookie(tenantKey, tenant, hasEntries(tenant) ? expirationDate : deleteDate);\n setCookie(\n implementationKey,\n implementation,\n hasEntries(implementation) ? expirationDate : deleteDate\n );\n setCookie(widgetKey, widget, hasEntries(widget) ? expirationDate : deleteDate);\n};\n\nconst getApplicationStore = (container: Container, storage: Storage): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = storage.getItem(tenantKey) || '{}';\n const implementation = storage.getItem(implementationKey) || '{}';\n const widget = storage.getItem(widgetKey) || '{}';\n\n return {\n tenant: JSON.parse(tenant),\n implementation: JSON.parse(implementation),\n widget: JSON.parse(widget),\n };\n};\n\nconst setApplicationStore = (\n container: Container,\n applicationStorage: Storage,\n store: Store\n): void => {\n const current = getApplicationStore(container, applicationStorage);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n\n hasEntries(tenant)\n ? applicationStorage.setItem(tenantKey, JSON.stringify(tenant))\n : applicationStorage.removeItem(tenantKey);\n hasEntries(implementation)\n ? applicationStorage.setItem(implementationKey, JSON.stringify(implementation))\n : applicationStorage.removeItem(implementationKey);\n hasEntries(widget)\n ? applicationStorage.setItem(widgetKey, JSON.stringify(widget))\n : applicationStorage.removeItem(widgetKey);\n};\n\nexport const createEmptyStore = (): Store => ({ tenant: {}, implementation: {}, widget: {} });\n\nexport const isExpired = (isoDateString?: string) => {\n if (!isoDateString) return false;\n return !!isoDateString && new Date() > new Date(isoDateString);\n};\n\nexport const getValue = <Type>(store: Store, key: string): Type | undefined => {\n const storedValue = store.widget[key] || store.implementation[key] || store.tenant[key];\n return storedValue?.value;\n};\n\nexport const createValue = (\n value: any,\n category: StorageCategory,\n duration?: Duration | string\n): StoredValue => {\n if (duration) {\n return {\n value,\n category,\n expiration: typeof duration === 'object' ? createExpirationDate(duration) : duration,\n };\n }\n return {\n value,\n category,\n };\n};\n\nexport const processStore = (store: Store, policy?: StorageCategory[]): Store => {\n const clone = deepClone(store);\n\n Object.entries(clone).forEach(([_, storageContainer]) => {\n Object.entries(storageContainer).forEach(([key, storedValue]) => {\n const { expiration, category } = storedValue;\n\n if (isExpired(expiration) || isNotAllowed(policy, category))\n storageContainer[key] = createValue(undefined, category, expiration);\n });\n });\n\n return clone;\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowedAsync = (\n container: Container,\n category?: StorageCategory\n): Promise<boolean> => {\n return readStorage<StorageCategory[]>(container, 'storagePolicy', StorageMedium.Cookie).then(\n (policy = [StorageCategory.Necessary]) => !!category && policy.indexOf(category) === -1\n );\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowed = (\n policy: StorageCategory[] = [StorageCategory.Necessary],\n category?: StorageCategory\n): boolean => {\n return !!category && policy.indexOf(category) === -1;\n};\n\n/**\n * Processes storage and removes items if they are expired or if\n * the storage policy is defined and the category of the stored\n * value is not allowed.\n * @param container Widget Container\n */\nexport const processStorage = (container: Container): void => {\n const cookieStore = getCookieStore(container);\n const localStore = getApplicationStore(container, window.localStorage);\n const sessionStore = getApplicationStore(container, sessionStorage);\n const policy = getValue<StorageCategory[]>(cookieStore, 'storagePolicy');\n\n const [processedCookieStore, processedLocalStore, processedSessionStore] = [\n cookieStore,\n localStore,\n sessionStore,\n ].map((store) => processStore(store, policy));\n\n setCookieStore(container, processedCookieStore);\n setApplicationStore(container, window.localStorage, processedLocalStore);\n setApplicationStore(container, window.sessionStorage, processedSessionStore);\n};\n\n/**\n * Creates an expiration date string with the passed options.\n * @param options Duration options.\n * @returns ISO formatted date string.\n */\nexport const createExpirationDate = (options: Duration = { days: 30 }): string => {\n const { days = 0, hours = 0, minutes = 0, seconds = 0 } = options;\n const date = new Date();\n date.setTime(date.getTime() + hours * 60 * 60 * 1000);\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n date.setTime(date.getTime() + minutes * 60 * 1000);\n date.setTime(date.getTime() + seconds * 1000);\n return date.toISOString();\n};\n\nexport const getCookieStoreAsync = (container: Container): Promise<Store> => {\n return lock(document)(() => getCookieStore(container));\n};\n\nexport const setCookieStoreAsync = (container: Container, store: Store): Promise<any> => {\n return lock(document)(() => setCookieStore(container, store));\n};\n\nexport const getApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session\n): Promise<Store> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => getApplicationStore(container, storage));\n};\n\nexport const setApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session,\n store: Store\n): Promise<void> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => setApplicationStore(container, storage, store));\n};\n","import { lock, Logger } from '@telia-ace/widget-utilities';\nimport { StorageCategory } from '.';\nimport { StorageScope, Store } from './types';\nimport { createExpirationDate, createValue, getValue, processStore } from './utils';\n\ntype LegacyOptions = {\n scope?: StorageScope;\n expiration?: Date;\n};\n\ninterface LegacyMedium {\n setItem(key: string, value: any, options?: LegacyOptions): Promise<void>;\n getItem(key: string): Promise<any>;\n removeItem(key: string): Promise<void>;\n clear(): Promise<void>;\n}\n\nexport class LegacyStorage implements LegacyMedium {\n private memory: Store = {\n tenant: {},\n implementation: {},\n widget: {},\n };\n async setItem(key: string, value: any, options: LegacyOptions = {}): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n const { scope = StorageScope.Tenant, expiration } = options;\n\n processedStore[scope][key] = createValue(\n value,\n StorageCategory.Necessary,\n expiration?.toISOString() || createExpirationDate()\n );\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.\n Key: ${key}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async getItem(key: string): Promise<any> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n\n const value = getValue(processedStore, key);\n this.memory = processedStore;\n\n return value;\n });\n }\n async removeItem(key: string): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n delete processedStore.tenant[key];\n delete processedStore.implementation[key];\n delete processedStore.widget[key];\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async clear(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport default class LegacyStorageProvider {\n cookies: LegacyStorage;\n session: LegacyStorage;\n local: LegacyStorage;\n constructor() {\n this.cookies = new LegacyStorage();\n this.session = new LegacyStorage();\n this.local = new LegacyStorage();\n }\n}\n","const z = /* @__PURE__ */ new WeakMap();\nfunction b() {\n return (s) => (z.has(s) || z.set(s, {}), z.get(s));\n}\nconst I = (s, t, e, ...n) => {\n const o = `[${s.get(\"$environment\").name || \"webprovisions\"}] ${e}`;\n switch (t) {\n case \"info\":\n console.info(o, ...n);\n break;\n case \"warning\":\n console.warn(o, ...n);\n break;\n case \"error\":\n console.error(o, ...n);\n break;\n }\n}, u = (s) => {\n const t = s.container || s;\n return {\n info: (e, ...n) => I(t, \"info\", e, ...n),\n warn: (e, ...n) => I(t, \"warning\", e, ...n),\n error: (e, ...n) => I(t, \"error\", e, ...n)\n };\n}, c = b(), M = (() => {\n let s = 0;\n return () => ++s;\n})(), _ = (s, t, e) => {\n const n = c(s).touchQueue.get(t);\n n && n.forEach((i) => {\n i(e, s);\n });\n};\nclass G {\n constructor(t, e, n, i) {\n this.key = t, this.factory = e, this.parent = n, this.container = i, this.id = M(), this.resolved = !1, this.constructed = !1, this.async = !0;\n }\n resolve() {\n if (!this.constructed) {\n const t = this.factory(this.parent, this.container);\n return this.constructed = !0, this.value = Promise.resolve(t).then((e) => (this.resolved = !0, _(this.container, this.key, e), e));\n }\n return this.value;\n }\n}\nclass J {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, _(this.container, this.key, this.value), this.value);\n }\n}\nclass X {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {\n this.resolved = !0, this.constructed = !0;\n const r = this.value(this.parent, this.container);\n return _(this.container, this.key, this.value), r;\n };\n }\n}\nclass W {\n /**\n * Creates a new instance of `Container`.\n * @param owner The object owning this inctance.\n * @param name Optional name for the container.\n * @param parent Parent container this should be a child of.\n */\n constructor(t, e, n) {\n this.owner = t, this.name = e, this.parent = n, c(this).resolvers = /* @__PURE__ */ new Map(), c(this).touchQueue = /* @__PURE__ */ new Map(), c(this).children = [];\n }\n /**\n * Deletes an existing resolver by its unique id.\n * @param id Resolver id.\n */\n delete(t) {\n const e = c(this).resolvers, i = Array.from(e.values()).find((r) => r.id === t);\n return i ? (c(this).touchQueue.delete(i.key), Promise.resolve(e.delete(i.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);\n }\n /**\n * Clears the `Container` and any child containers by deleteing all registered resolvers.\n */\n clear() {\n const t = c(this).resolvers, e = Array.from(t.values());\n return Promise.all(e.map((n) => {\n if (n.constructed)\n return Promise.resolve(n.resolve()).then((i) => {\n if (i !== null && typeof i == \"object\" && typeof i.dispose == \"function\")\n return i.dispose.call(i, this, n);\n });\n })).then(() => {\n e.forEach((n) => this.delete(n.id)), c(this).children.forEach((n) => n.clear());\n });\n }\n /**\n * Detaches this `Container` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = c(this.parent).children, e = t.indexOf(this);\n e > -1 && (t.splice(e, 1), delete this.parent);\n }\n }\n /**\n * Provides a way of touching a value in the `Container` without forcing it to be resolved.\n * @param key Key of the resolved value to touch.\n * @param handler Handler function for touching the resolved value.\n */\n touch(t, e) {\n const i = c(this).resolvers.get(t);\n if (i && i.constructed)\n Promise.resolve(i.resolve()).then((o) => {\n e(o, this);\n });\n else {\n const o = c(this).touchQueue;\n let a = o.get(t);\n a || (a = [], o.set(t, a)), a.push(e);\n }\n return this.parent && !i ? this.parent.touch(t, e) : Promise.resolve();\n }\n /**\n * Registers an asynchronous resolver.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerAsync(t, e) {\n const n = c(this).resolvers.get(t);\n n && !n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);\n const i = new G(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers a factory resolver for constructing the value to be resolved.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerFactory(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new X(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers an synchronous resolver.\n * @param key Key of the resolver.\n * @param value Value.\n */\n register(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new J(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Gets the value for a synchronous resolver.\n * @param key Key of resolver to get.\n */\n get(t) {\n const e = c(this).resolvers.get(t);\n if (e)\n return e.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();\n if (this.parent)\n return this.parent.get(t);\n }\n /**\n * Gets the value for a asynchronous resolver.\n * @param key Key of resolver to get.\n */\n getAsync(t) {\n const e = c(this).resolvers.get(t);\n if (e) {\n if (!e.async)\n throw process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), \"Mismatching resolver type\";\n return e.resolve();\n }\n return this.parent ? this.parent.getAsync(t) : Promise.resolve(void 0);\n }\n getMany(...t) {\n const e = {};\n return t.forEach((n) => e[n] = this.get(n)), e;\n }\n getManyAsync(...t) {\n const e = {};\n return Promise.all(t.map((n) => this.getAsync(n).then((i) => e[n] = i))).then(() => e);\n }\n createChild(t, e) {\n const n = new W(t, e, this);\n return c(this).children.push(n), n;\n }\n}\nclass L {\n /**\n * \n * @param type Type of event.\n * @param target The target of the event, which will handle the default behavour.\n * @param cancelable Whether the event is cancelable by calling preventDefault().\n * @param bubbles Whether the event will bubble up the parent hierarchy.\n */\n constructor(t, e, n = !1, i = !1) {\n this.type = t, this.target = e, this.cancelable = !!n, this.bubbles = !!i, this.defaultPrevented = !1;\n }\n /**\n * Cancels the default behaviour (if the event is cancelable).\n */\n preventDefault() {\n this.cancelable && (this.defaultPrevented = !0);\n }\n}\nconst p = b(), q = (s, t) => [].concat(\n p(s).listenerLookup.get(t.toLowerCase()) || [],\n p(s).listenerLookup.get(\"*\") || []\n), F = (s, t, e, n) => {\n let i, r;\n return t instanceof L ? (i = t, r = t.type) : (i = new L(t, s.target, !!e.cancelable, !!e.bubbles), r = t), { event: i, type: r, async: n };\n};\nclass D {\n /**\n * Creates a new Event Manager instance.\n * @param target The target of events dispatched from this Event Manager instance.\n * @param parent Parent Event Manager instance.\n */\n constructor(t, e) {\n this.target = t, this.parent = e, p(this).listenerLookup = /* @__PURE__ */ new Map(), p(this).children = [];\n }\n /**\n * Clears registered event listeners in this `EventManager` as well as in any children.\n */\n clear() {\n p(this).listenerLookup.clear(), p(this).children.forEach((t) => t.clear());\n }\n /**\n * Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = p(this.parent).children, e = t.indexOf(this);\n e > -1 && t.splice(e, 1);\n }\n }\n /**\n * Creates an event subscription by registering an listener for an event type.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribe(t, e, n) {\n const i = p(this).listenerLookup, r = t.toLowerCase();\n return i.has(r) || i.set(r, []), i.get(r).push(e), () => this.unsubscribe(t, e);\n }\n /**\n * Similar to `subscribe()` but immediately removes the subscription after the first call.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribeOnce(t, e) {\n const n = this.subscribe(t, (i, r) => (n(), e(i, r)));\n }\n /**\n * Removes a listener for the specified event type.\n * @param type Event type to remove subscription for.\n * @param listener Event listener to remove.\n */\n unsubscribe(t, e) {\n const n = p(this).listenerLookup.get(t.toLowerCase());\n if (n) {\n const i = n.indexOf(e);\n i > -1 && n.splice(i, 1);\n }\n }\n /**\n * Dispatches an asynchonous event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatchAsync(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !0), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = Promise.resolve();\n for (a = 0; a < l; a++)\n ((m) => {\n h = h.then((y) => y ? Promise.resolve(!0) : Promise.resolve(m(i, e)).then(() => i.defaultPrevented));\n })(o[a]);\n return h.then((m) => !m && i.bubbles && this.parent ? this.parent.dispatchAsync(i, e) : m);\n }\n /**\n * Dispatches an event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatch(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !1), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = !1;\n for (a = 0; a < l; a++)\n if (o[a](i, e), i.defaultPrevented) {\n h = !0;\n break;\n }\n return !h && i.bubbles && this.parent && (h = this.parent.dispatch(i, e)), h;\n }\n /**\n * Creates a child instance to the current Event manager.\n */\n createChild(t) {\n const e = new D(t, this);\n return p(this).children.push(e), e;\n }\n}\nconst P = (s, t, e) => {\n const i = s.get(\"$plugins\").map((r) => {\n try {\n return r.invoke(t, e);\n } catch (o) {\n u(s).error(\"An error occured when invoking a plugin.\", r, o);\n }\n });\n return Promise.all(i);\n};\nclass Z {\n constructor(t) {\n this.widget = t.get(\"$widget\"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();\n }\n createInstance() {\n if (!this.widget.container.get(\"$instance\")) {\n const t = this.widget.container.get(\"$types\"), e = this.widget.container.get(\"$type\");\n !e && u(this).error(\"Unable to create widget. No type is specified.\");\n const n = t[e];\n !n && u(this).error(`Unable to create widget. Type '${e}' is not registered.`), this.widget.events.dispatch(\"widget:create-instance\", {}, { bubbles: !0 });\n try {\n this.widget.container.register(\n \"$instance\",\n new n(this.container)\n );\n } catch (i) {\n u(this).error(\"Unable to create widget type.\", i);\n }\n this.widget.events.dispatch(\"widget:instance-created\", {}, { bubbles: !0 });\n }\n }\n /**\n * The initialization is performed before the widget is activated but after it's configured\n * and thus all required services are available. This hook is a good place to bind events that\n * should trigger activation (e.g. click on \"trigger links\" or routing events)\n * @param {object} data Custom initialization data passed to the widget.\n */\n initialize(t) {\n return this.initialized = this.initialized || (() => {\n const e = this.container.get(\"$instance\"), n = e.initialize || (() => {\n });\n return this.initialized = Promise.resolve(n.call(e, t)).then(() => P(this.container, \"initialize\", t)).then(() => {\n });\n })();\n }\n /**\n * The activation is where the widget is actually created and rendered.\n * Activation can be initialized from the outside or from an event originated\n * in the \"initialize\" hook.\n * @param {object} data Custom activation data passed to the widget.\n */\n activate(t) {\n return (this.initialized || this.initialize()).then(() => {\n this.activated = this.activated || (() => P(this.container, \"activate\").then(() => {\n const n = this.container.get(\"$instance\");\n return this.activated = n.activate(t);\n }))();\n });\n }\n deactivate() {\n const t = this.container.get(\"$instance\"), e = t.deactivate || (() => {\n });\n return P(this.container, \"deactivate\").then(() => Promise.resolve(e.call(t))).then(() => {\n this.initialized = null, this.activated = null;\n }).then(() => {\n });\n }\n /**\n * Invokes a command on the widget component.\n * @param command Name of command\n * @param args Command arguments\n */\n invoke(t, ...e) {\n return P(this.container, \"invoke\", { command: t, args: e }).then(() => {\n const n = this.container.get(\"$instance\");\n if (n[t])\n return n[t].apply(n, e);\n const i = n.invoke;\n if (i)\n return i.call(n, t, ...e);\n });\n }\n}\nconst w = (s, t) => {\n if (!t)\n return !0;\n if (typeof t == \"string\") {\n const e = t.split(\",\");\n for (let n = 0, i = e.length; n < i; n++) {\n const r = e[n].trim();\n if (r === s || r === \"*\")\n return !0;\n }\n }\n return t instanceof Array ? t.indexOf(s) > -1 : !1;\n}, K = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? nt(t) : t;\n return !(!w(s.implementation.tenant || \"\", e.tenant || \"\") || !w(s.implementation.name, e.implementation || \"\") || !w(s.name, e.widget || \"\") || !w(s.container.get(\"$type\"), e.type || \"\"));\n}, tt = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? st(t) : t;\n return !(!w(s.tenant || \"\", e.tenant || \"\") || !w(s.name, e.implementation || \"\"));\n}, Q = (s) => (t) => K(t, s), et = (s) => (t) => tt(t, s), f = (s) => s instanceof Array && s.length === 1 ? s[0] : s, nt = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.widget = f(e[0].split(\",\")) : e.length === 2 ? (t.implementation = f(e[0].split(\",\")), t.widget = f(e[1].split(\",\"))) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\")), t.widget = f(e[2].split(\",\"))), t;\n}, st = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.implementation = f(e[0].split(\",\")) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\"))), t;\n}, E = b(), V = (s, t, e) => s.filter((n) => n.stage === t && Q(n.selector)(e));\nfunction it(s) {\n const t = s.container.get(\"$environment\");\n let e = E(t).configurationCache;\n e && (e = e.filter((n) => n[0] !== s), E(t).configurationCache = e);\n}\nvar k = /* @__PURE__ */ ((s) => (s.Implementation = \"implementation\", s.Widget = \"widget\", s))(k || {}), g = /* @__PURE__ */ ((s) => (s.Pre = \"pre\", s.Post = \"post\", s))(g || {});\nconst T = (s, t, e) => (Object.keys(t).forEach((n) => {\n const i = t[n];\n if (typeof i == \"function\") {\n const r = i();\n typeof r.defaultArgs != \"undefined\" && e(r, ...r.defaultArgs), s[n] = (...o) => {\n const a = Object.assign(\n {},\n r,\n { handlerResolver: r.handlerResolver.bind({}) }\n );\n return e(a, ...o), s;\n };\n } else\n s[n] = T(\n {},\n i,\n e\n );\n}), s), rt = (s, t) => {\n switch (t) {\n case \"implementation\":\n return s.implementation;\n case \"widget\":\n return s;\n }\n}, O = (s, t, e, n) => (n.forEach((i) => {\n T(\n s,\n i,\n (r, ...o) => {\n const a = {\n selector: t,\n stage: r.stage,\n handler: (l) => {\n const h = rt(l, r.scope), m = { container: h.container, events: h.events }, y = r.handlerResolver, x = y(m);\n let v = E(e.environment).configurationCache;\n return v || (v = E(e.environment).configurationCache = []), v.find((R) => R.indexOf(h) > -1 && R.indexOf(y) > -1) ? Promise.resolve() : (v.push([h, y]), Promise.resolve(x(...o)));\n }\n };\n e.instructions.push(a);\n }\n );\n}), s);\nfunction ot(s, t) {\n function e(n) {\n return O(\n {},\n n,\n s,\n t\n );\n }\n return O(\n e,\n \"*\",\n s,\n t\n );\n}\nclass $t {\n constructor(t, e) {\n this.container = t, this.settings = e, this.widget = t.get(\"$widget\"), this.events = this.widget.events;\n }\n}\nconst at = (s, t, e, n) => {\n try {\n const i = new t(e, n);\n return {\n name: s,\n invoke: (r, o) => {\n let a;\n return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);\n },\n getInstance: () => i\n };\n } catch (i) {\n if (i.message && i.message.indexOf(\"is not a constructor\") >= 0)\n return {\n name: s,\n invoke: (r) => {\n let o;\n return r === \"initialize\" && (o = t(e, n)), Promise.resolve(o);\n },\n getInstance: () => t\n };\n throw i;\n }\n};\nfunction j(s, t) {\n return typeof s == \"undefined\" ? t : s;\n}\nclass ct {\n constructor(t = {}) {\n this.part = t;\n }\n createCommand(t, e, n) {\n let i;\n typeof e == \"function\" ? i = {\n scope: k.Widget,\n stage: g.Post,\n defaultArgs: void 0,\n handlerResolver: e\n } : i = {\n scope: j(e.scope, k.Widget),\n stage: j(e.stage, g.Post),\n defaultArgs: e.defaultArgs,\n handlerResolver: n\n };\n let r = this.part;\n const o = t.split(\".\");\n return o.forEach((a, l) => {\n l === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};\n }), this;\n }\n get() {\n return this.part;\n }\n}\nconst ht = (s) => {\n const t = new ct({});\n return s(t), t.get();\n}, lt = ht((s) => {\n s.createCommand(\n \"types.register\",\n { scope: k.Implementation, stage: g.Pre },\n (t) => (e, n) => {\n t.container.get(\"$types\")[e] = n;\n }\n ).createCommand(\n \"type\",\n { stage: g.Pre },\n (t) => (e) => {\n t.container.register(\"$type\", e);\n }\n ).createCommand(\n \"settings\",\n { stage: g.Pre, defaultArgs: [null] },\n (t) => (e) => {\n t.events.dispatch(\n \"settings:change\",\n e,\n { bubbles: !0 }\n ), t.container.register(\"$settings\", e);\n }\n ).createCommand(\n \"plugin\",\n { stage: g.Pre },\n (t) => (e, n, i) => {\n const { container: r } = t;\n let o = null, a = e, l = n;\n typeof e == \"string\" && (o = e, a = n, l = i);\n const h = (m) => {\n const { transformPluginSettings: y } = t.container.get(\"$environmentOptions\"), x = y ? y(\n l || {},\n o,\n t.container,\n a\n ) : n;\n try {\n const v = at(\n o,\n a,\n r,\n x\n );\n r.get(\"$plugins\").push(v), m && v.invoke(\"initialize\", null);\n } catch (v) {\n u(t).warn(\"Error when initializing plugin\", v);\n }\n };\n t.container.get(\"$instance\") ? h(!0) : t.events.subscribeOnce(\"widget:instance-created\", () => h(!1));\n }\n ).createCommand(\n \"container.register\",\n (t) => (e, n) => {\n t.container.register(e, n);\n }\n ).createCommand(\n \"container.registerAsync\",\n (t) => (e, n) => {\n t.container.registerAsync(e, n);\n }\n ).createCommand(\n \"container.registerFactory\",\n (t) => (e, n) => {\n t.container.registerFactory(e, n);\n }\n ).createCommand(\n \"container.touch\",\n (t) => (e, n) => {\n t.container.touch(e, n);\n }\n ).createCommand(\n \"csp\",\n {},\n (t) => (e) => {\n t.container.register(\"csp\", e);\n }\n );\n}), ut = lt;\nfunction dt(s, t, e = []) {\n const n = [ut].concat(e), i = ot(\n t,\n n\n );\n s(i, t);\n}\nclass pt {\n constructor() {\n this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);\n }\n add(t, e, n, i) {\n this.tasks.push({ task: t, resolve: e, reject: n, done: i }), this.next();\n }\n next() {\n this.current = this.current.then(() => {\n const t = this.tasks.shift();\n if (t) {\n const e = Promise.resolve(t.task());\n return Promise.resolve(e).then(this.next).then(() => e.then((n) => {\n t.done(), t.resolve(n);\n })).catch((n) => (t.done(), t.reject(n), this.next()));\n }\n return Promise.resolve();\n });\n }\n}\nconst A = /* @__PURE__ */ new WeakMap();\nfunction vt(s) {\n return A.has(s) || A.set(s, new pt()), (t) => new Promise((e, n) => {\n const i = A.get(s);\n i.add(t, e, n, () => {\n i.tasks.length || A.delete(s);\n });\n });\n}\nconst U = (s) => typeof s != \"undefined\";\nvar ft = /* @__PURE__ */ ((s) => (s.Activating = \"activating\", s.Loading = \"loading\", s.Activated = \"activated\", s.Deactivating = \"deactivating\", s.Deactivated = \"deactivated\", s))(ft || {});\nconst $ = (s, t) => {\n s.events.dispatch(\"widget:state-change\", { state: t }, { bubbles: !0 }), s.state = t, s.events.dispatch(\"widget:state-changed\", {}, { bubbles: !0 });\n}, d = b(), gt = (s) => {\n const { container: t, events: e } = s;\n t.get(\"$controller\") || (t.register(\"$controller\", new Z(t)), e.dispatch(\"widget:controller-created\", {}, { bubbles: !0 }));\n};\nclass mt {\n /**\n * Creates a new `Widget` instance.\n * @param name Name of widget.\n * @param implementation The implementation this instance belongs to.\n * @param configuration Configuration for the widget.\n */\n constructor(t, e, n) {\n this.state = \"deactivated\", this.name = t, this.implementation = e, this.container = e.container.createChild(this, t), this.events = e.events.createChild(this), d(this).subscriptions = [], n && e.configure((i) => {\n const r = i(t);\n U(n.type) && r.type(n.type), U(n.settings) && r.settings(n.settings), n.plugins && Object.keys(n.plugins).forEach((o) => {\n var l;\n const a = (l = n.plugins) == null ? void 0 : l[o];\n r.plugin(o, a);\n });\n }), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);\n }\n /**\n * Initializes the widget, if not already initialized, and applies any\n * pending configuration.\n */\n load() {\n return vt(this)(() => {\n d(this).deactivatedPromise = null;\n const t = this.state === \"deactivated\";\n t && ($(\n this,\n \"activating\"\n /* Activating */\n ), this.container.register(\"$widget\", this), this.container.register(\"$controller\", null), this.container.register(\"$plugins\", []), this.container.register(\"$type\", null), this.container.register(\"$instance\", null)), $(\n this,\n \"loading\"\n /* Loading */\n );\n const e = this.implementation.instructions, n = V(e, g.Pre, this);\n return Promise.all(n.map((i) => i.handler(this))).then(() => {\n gt(this);\n const i = V(e, g.Post, this);\n return Promise.all(i.map((r) => r.handler(this))).then(() => {\n t && this.container.get(\"$controller\").initialize();\n });\n }).then(() => ($(\n this,\n \"activated\"\n /* Activated */\n ), this));\n });\n }\n /**\n * Activates the widget and makes it ready for receiving commands.\n * @param data Activation data\n */\n activate(t) {\n d(this).subscriptions.push(\n this.implementation.events.subscribe(\"implementation:configured\", () => {\n [\n \"activated\",\n \"activating\",\n \"loading\"\n /* Loading */\n ].indexOf(this.state) > -1 && this.load();\n })\n );\n const e = d(this).activatedPromise;\n return e ? (process.env.NODE_ENV !== \"production\" && u(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : d(this).activatedPromise = this.load().then(() => this.container.get(\"$controller\").activate(t));\n }\n /**\n * Invokes a command on a widget. If the widget isn't activate the invocation \n * will be suspended until activation.\n * @param command Command to invoke.\n * @param args Command arguments.\n */\n invoke(t, ...e) {\n const n = d(this).activatedPromise, i = (r, ...o) => n.then(this.load).then(() => this.container.get(\"$controller\").invoke(r, ...o));\n return n ? i(t, ...e) : (process.env.NODE_ENV !== \"production\" && u(this).warn(\"You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.\", this), new Promise((r) => {\n const o = this.events.subscribe(\"widget:state-changed\", () => {\n this.state === \"activated\" && (o(), r(i(t, ...e)));\n });\n }));\n }\n /**\n * Deactivates the widget by clearing the `Container` and removing any event subscriptions in the\n * `EventManager`.\n */\n deactivate() {\n const t = d(this).deactivatedPromise;\n return t || (this.state === \"deactivated\" ? Promise.resolve() : ($(\n this,\n \"deactivating\"\n /* Deactivating */\n ), d(this).deactivatedPromise = this.container.get(\"$controller\").deactivate().then(() => (d(this).activatedPromise = null, d(this).subscriptions.forEach((e) => e()), d(this).subscriptions = [], this.container.clear().then(() => {\n this.events.clear(), it(this), $(\n this,\n \"deactivated\"\n /* Deactivated */\n );\n })))));\n }\n}\nconst Pt = (s) => s.deactivate().then(() => {\n s.events.detach(), s.container.detach(), s.implementation.widgets.delete(s.name);\n});\nclass At {\n /**\n * Creates a new `Widget` instance.\n * @param container The `Container` instance to base the widget upon.\n */\n constructor(t) {\n this.container = t, this.widget = t.get(\"$widget\"), this.settings = t.get(\"$settings\"), this.events = this.widget.events, this.widget.events.subscribe(\"settings:change\", (e, n) => {\n this.settings = n;\n });\n }\n}\nconst Y = b();\nclass yt {\n /**\n * Creates a new Implementation instance.\n * @param configuration Configuration for the implementation.\n * @param environment The parent environment.\n * @param configurationApiExtensions Optional configuration API extensions.\n */\n constructor(t, e, n = []) {\n this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = t.name, this.tenant = t.tenant, this.environment = e, this.container = e.container.createChild(this, this.name), this.events = e.events.createChild(this), this.container.register(\"$types\", {}), Y(this).configurationApiExtensions = n;\n }\n /**\n * Loads all widgets in the implementation.\n */\n load() {\n const t = Array.from(this.widgets.values());\n return Promise.all(t.map((e) => e.load())).then(() => t);\n }\n /**\n * Configures the implementation by adding a configuration callback.\n * @param configFn Callback function for configuration.\n */\n configure(t) {\n return dt(t, this, Y(this).configurationApiExtensions), this.events.dispatch(\n \"implementation:configured\",\n { implementation: this },\n { bubbles: !0 }\n ), this;\n }\n /**\n * Creates a widget on the implementation and returns its `WidgetData`.\n * @param name Widget name.\n * @param configuration Widget configuration.\n */\n createWidget(t, e) {\n const n = new mt(t, this, e);\n return this.widgets.set(n.name, n), n;\n }\n}\nfunction wt(s, t, e) {\n const n = new yt(s, t, e);\n return s.widgets && Object.keys(s.widgets).forEach((i) => {\n var o;\n const r = (o = s.widgets) == null ? void 0 : o[i];\n n.createWidget(i, r);\n }), n;\n}\nclass C {\n constructor(t, e) {\n this.selectorFactory = e, typeof t == \"function\" ? this.resolver = t : this.resolver = () => t;\n }\n append(t) {\n const e = typeof t == \"function\" ? t : () => t;\n return new C(\n () => this.all().concat(e()),\n this.selectorFactory\n );\n }\n all() {\n return this.resolver().concat([]);\n }\n query(t) {\n return this.all().filter(this.selectorFactory(t));\n }\n find(t) {\n const e = this.query(t);\n if (e.length)\n return e[0];\n }\n}\nconst S = \"#____version____#\";\nfunction Et(s, t) {\n const e = B.create(s);\n return Promise.all(\n (t || []).map((n) => Promise.resolve(n(e)))\n ).then(() => e);\n}\nconst N = b(), bt = (s) => s.tenant ? `${s.name}:${s.tenant}` : s.name, H = class {\n constructor(s, t = [], e = {}) {\n this.widgets = new C(\n () => {\n let n = [];\n return this.implementations.all().forEach((i) => {\n n = n.concat(Array.from(i.widgets.values()));\n }), n;\n },\n Q\n ), this.implementations = new C([], et), this.name = s, this.container = new W(this, s), this.events = new D(this), this.container.register(\"$version\", S), this.container.register(\"$environment\", this), this.container.register(\"$environmentOptions\", e), N(this).configurationApiExtensions = t;\n }\n /**\n * Creates an implementation based on the provided configuration.\n * @param config Implementation configuration.\n */\n createImplementation(s) {\n const t = bt(s);\n let e = this.implementations.find(t);\n if (e)\n return process.env.NODE_ENV !== \"production\" && u(e).warn(`Implementation \"${t}\" already exist on current environment.`), e;\n const n = N(this).configurationApiExtensions;\n return e = wt(\n s,\n this,\n n\n ), this.implementations = this.implementations.append([e]), this.events.dispatch(\"implementation:created\", { implementation: e }), e;\n }\n /**\n * Patches the Environment instance configuration.\n * @param configuration Environment configuration.\n */\n patch(s = {}) {\n const { name: t, configurationApiExtensions: e } = s;\n typeof t != \"undefined\" && t !== null && (this.name = t), e && e.forEach(\n (n) => {\n N(this).configurationApiExtensions.push(n);\n }\n );\n }\n /**\n * Creates a new Environment instance based on the provided configuration.\n * @param configuration Environment configuration.\n */\n static create(s = {}) {\n return new H(\n s.name || \"\",\n s.configurationApiExtensions,\n s.options\n );\n }\n};\nlet B = H;\nB.version = S;\nexport {\n k as ConfigurationScope,\n g as ConfigurationStage,\n W as Container,\n B as Environment,\n D as EventManager,\n L as EventObject,\n yt as Implementation,\n $t as Plugin,\n mt as Widget,\n Z as WidgetController,\n ft as WidgetState,\n At as WidgetType,\n ht as createConfigurationApi,\n Et as createEnvironment,\n Pt as destroy,\n Pt as destroyWidget,\n u as logger,\n et as selectImplementations,\n Q as selectWidgets,\n S as version\n};\n//# sourceMappingURL=index.js.map\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { createConfigurationApi } from '@webprovisions/platform';\nimport { createStorageWriter } from './storage';\nimport { StorageCategory, StorageConfigurationOptions, StorageMedium, StorageScope } from './types';\nimport { processStorage } from './utils';\n\nexport default createConfigurationApi((builder) => {\n builder.createCommand('storage', (context) => (options: StorageConfigurationOptions = {}) => {\n const { consent } = options;\n if (typeof consent !== 'undefined') {\n if (\n typeof consent !== 'number' &&\n typeof consent !== 'string' &&\n !Array.isArray(consent)\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n if (\n Array.isArray(consent) &&\n !(consent as string[]).every(\n (c: any) => typeof c === 'number' || typeof c === 'string'\n )\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n const policy: StorageCategory[] = [\n StorageCategory.Necessary,\n StorageCategory.Functional,\n StorageCategory.Analytical,\n StorageCategory.Marketing,\n ].filter((category, index, array) => {\n if (typeof consent === 'number') {\n // Passed consent is a category level (number)\n // Include the passed category level and all categories below it\n return consent > index;\n } else if (typeof consent === 'string') {\n // Passed consent is a category (string)\n // Include the passed category and all categories below its level\n return array.indexOf(consent) + 1 > index;\n } else if (Array.isArray(consent)) {\n // Passed consent is an array with category levels (number), categories (string) or both\n // Include all categories in passed array\n return (\n consent.findIndex((c: number | StorageCategory) => {\n return c === index + 1 || c === category;\n }) > -1\n );\n } else {\n return true;\n }\n });\n\n if (policy.indexOf(StorageCategory.Necessary) === -1) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent does not include category: '${\n StorageCategory.Necessary\n }'. Consent has to atleast include the '${\n StorageCategory.Necessary\n }' category.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n policy.unshift(StorageCategory.Necessary);\n }\n\n return createStorageWriter(\n context.container,\n 'storagePolicy',\n StorageCategory.Necessary,\n {\n medium: StorageMedium.Cookie,\n scope: StorageScope.Tenant,\n duration: { days: 365 },\n }\n )\n .then((write) => write(policy))\n .then(() => {\n processStorage(context.container);\n\n context.events.dispatch('storage:policy-changed', policy);\n });\n }\n });\n});\n"],"names":["StorageMedium","StorageScope","StorageCategory","createStorageWriter","container","key","category","options","isNotAllowedAsync","notAllowed","Logger","value","processStorage","scope","medium","duration","store","createEmptyStore","createValue","setCookieStoreAsync","setApplicationStoreAsync","readStorage","getCookieStoreAsync","getValue","getApplicationStoreAsync","hasEntries","object","_","cleanUndefined","mergeAndClean","target","source","merged","__spreadValues","getLongestExpirationDate","acc","storeEntry","containerEntry","expiration","a","b","createExpirationDate","createStorageKeys","widgetName","implementationName","tenantName","hash","getCookie","cookieName","regExp","cookie","setCookie","expires","path","getCookieStore","tenantKey","implementationKey","widgetKey","tenant","implementation","widget","setCookieStore","current","expirationDate","deleteDate","getApplicationStore","storage","setApplicationStore","applicationStorage","isExpired","isoDateString","storedValue","processStore","policy","clone","deepClone","storageContainer","isNotAllowed","cookieStore","localStore","sessionStore","processedCookieStore","processedLocalStore","processedSessionStore","days","hours","minutes","seconds","date","lock","type","LegacyStorage","_0","_1","__async","processedStore","LegacyStorageProvider","I","s","t","e","n","o","u","k","g","at","i","r","j","ct","l","ht","h","m","y","x","v","storagePolicyConfigurationApi","createConfigurationApi","builder","context","consent","c","index","array","write"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,iBAAiB,kBACjBA,EAAA,SAAS,UAHDA,IAAAA,KAAA,CAAA,CAAA,GAoBAC,sBAAAA,OACRA,EAAA,YAAY,aACZA,EAAA,aAAa,cACbA,EAAA,aAAa,cACbA,EAAA,YAAY,aAJJA,IAAAA,KAAA,CAAA,CAAA;ACGL,MAAMC,IAAsB,CAC/BC,GACAC,GACAC,GACAC,IAAgC,CAAA,MAEzBC,EAAkBJ,GAAWE,CAAQ,EAAE,KAAK,CAACG,OAC5C,QAAQ,IAAI,aAAa,gBACrBA,KACOC,EAAA;AAAA,EACH;AAAA,2BACOL;AAAA,gCACK,KAAK,UAAUC,CAAQ;AAAA,+BACxB,KAAK,UAAUC,CAAO;AAAA,GAKtC,CAACI,OACJC,EAAeR,CAAS,GAEjBI,EAAkBJ,GAAWE,CAAQ,EAAE,KAAK,CAACG,MAAe;AAC/D,MAAIA,GAAY;AACR,IAAA,QAAQ,IAAI,aAAa,gBAClBC,EAAA;AAAA,MACH;AAAA,uCACWL;AAAA,4CACK,KAAK,UAAUC,CAAQ;AAAA,yCAC1B,KAAK,UAAUK,CAAK;AAAA,2CAClB,KAAK,UAAUJ,CAAO;AAAA,IA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AA,0CAEF,KAAK,UAAUwH,CAAO;AAAA,MAAA,GAGzCjD,EAAA,QAAQvE,EAAgB,SAAS,IAGrCC;AAAA,QACHsH,EAAQ;AAAA,QACR;AAAA,QACAvH,EAAgB;AAAA,QAChB;AAAA,UACI,QAAQF,EAAc;AAAA,UACtB,OAAOC,EAAa;AAAA,UACpB,UAAU,EAAE,MAAM,IAAI;AAAA,QAC1B;AAAA,MAAA,EAEC,KAAK,CAAC6H,MAAUA,EAAMrD,CAAM,CAAC,EAC7B,KAAK,MAAM;AACR,QAAA7D,EAAe6G,EAAQ,SAAS,GAExBA,EAAA,OAAO,SAAS,0BAA0BhD,CAAM;AAAA,MAAA,CAC3D;AAAA;AAAA,EACT,CACH;AACL,CAAC;","x_google_ignoreList":[4]}
1
+ {"version":3,"file":"index.js","sources":["../src/storage/types.ts","../src/storage/storage.ts","../src/storage/utils.ts","../src/storage/legacy-storage-provider.ts","../../../node_modules/.pnpm/@webprovisions+platform@1.1.3/node_modules/@webprovisions/platform/dist/index.js","../src/storage/storage-policy-configuration-api.ts"],"sourcesContent":["export enum StorageMedium {\n Cookie = 'cookie',\n Local = 'local',\n Session = 'session',\n}\n\nexport enum StorageScope {\n Tenant = 'tenant',\n Implementation = 'implementation',\n Widget = 'widget',\n}\n\nexport type Store = {\n tenant: StorageContainer;\n implementation: StorageContainer;\n widget: StorageContainer;\n};\n\nexport type StorageContainer = { [key: string]: StoredValue };\n\nexport type StoredValue = {\n value: any;\n expiration?: string;\n category: StorageCategory;\n};\n\nexport enum StorageCategory {\n Necessary = 'necessary',\n Functional = 'functional',\n Analytical = 'analytical',\n Marketing = 'marketing',\n}\n\nexport type StorageWriter = (value?: any) => Promise<void>;\n\nexport type StorageConfigurationOptions = {\n consent?: StorageConsent;\n};\n\nexport type StorageConsent = number | number[] | StorageCategory | StorageCategory[];\n\nexport type Duration = {\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport type StorageWriterOptions = {\n scope?: StorageScope;\n duration?: Duration;\n medium?: StorageMedium;\n};\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n StorageCategory,\n StorageMedium,\n StorageScope,\n StorageWriter,\n StorageWriterOptions,\n} from './types';\nimport {\n createEmptyStore,\n createValue,\n getApplicationStoreAsync,\n getCookieStoreAsync,\n getValue,\n isNotAllowedAsync,\n processStorage,\n setApplicationStoreAsync,\n setCookieStoreAsync,\n} from './utils';\n\n/**\n * Creates a writer to be used to write to cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to use when writing.\n * @param category StorageCategory to use when writing.\n * @param options StorageWriterOptions to use when writing default {scope: StorageScope.Widget, medium = StorageMedium.Session, duration = infinite }.\n * @returns a function to be used to write a value to the storage using given settings.\n */\nexport const createStorageWriter = (\n container: Container,\n key: string,\n category: StorageCategory,\n options: StorageWriterOptions = {}\n): Promise<StorageWriter> => {\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (process.env.NODE_ENV !== 'production') {\n if (notAllowed) {\n Logger.warn(\n `createStorageWriter: Attempted to create storage writer using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Options: ${JSON.stringify(options)}`\n );\n }\n }\n\n return (value: any) => {\n processStorage(container);\n\n return isNotAllowedAsync(container, category).then((notAllowed) => {\n if (notAllowed) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storageWriter: Attempted to write to storage using unallowed category.\n Key: ${key}\n Category: ${JSON.stringify(category)}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}`\n );\n }\n return;\n }\n\n const {\n scope = StorageScope.Widget,\n medium = StorageMedium.Session,\n duration,\n } = options;\n\n const store = createEmptyStore();\n store[scope][key] = createValue(value, category, duration);\n\n if (medium === StorageMedium.Cookie) return setCookieStoreAsync(container, store);\n else return setApplicationStoreAsync(container, medium, store);\n });\n };\n });\n};\n\n/**\n * Read the widget cookie, local or session storage.\n * @param container Widget Container.\n * @param key Key to read.\n * @param medium Storage medium to read from (default: session).\n * @returns the value stored with passed key.\n */\nexport const readStorage = <Type>(\n container: Container,\n key: string,\n medium: StorageMedium = StorageMedium.Session\n): Promise<Type | undefined> => {\n processStorage(container);\n\n if (typeof key === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn('readStorage: Undefined key passed when reading storage. ', key, medium);\n }\n return Promise.resolve(undefined);\n }\n\n if (medium === StorageMedium.Cookie)\n return getCookieStoreAsync(container).then((store) => getValue(store, key));\n else return getApplicationStoreAsync(container, medium).then((store) => getValue(store, key));\n};\n","import { deepClone, hash, lock } from '@telia-ace/widget-utilities';\nimport { Container, Widget } from '@webprovisions/platform';\nimport { readStorage } from './storage';\nimport {\n Duration,\n StorageCategory,\n StorageContainer,\n StorageMedium,\n Store,\n StoredValue\n} from './types';\n\nconst hasEntries = (object: object) =>\n !!Object.entries(object).filter(([_, value]) => typeof value !== 'undefined').length;\n\nconst cleanUndefined = (object: StorageContainer) =>\n Object.entries(object)\n .filter(([_, value]) => typeof value !== 'undefined')\n .forEach(([key, { value }]) => {\n if (typeof value === 'undefined') {\n delete object[key];\n }\n });\n\nconst mergeAndClean = (target: Store, source: Store): Store => {\n const merged: Store = {\n tenant: { ...target.tenant, ...source.tenant },\n implementation: { ...target.implementation, ...source.implementation },\n widget: { ...target.widget, ...source.widget }\n };\n\n cleanUndefined(merged.tenant);\n cleanUndefined(merged.implementation);\n cleanUndefined(merged.widget);\n\n return merged;\n};\n\nconst getLongestExpirationDate = (store: Store): string => {\n const expirationDates = Object.entries(store).reduce<string[]>((acc, storeEntry) => {\n const [_, container] = storeEntry;\n Object.entries(container).forEach((containerEntry) => {\n const [_, { expiration }] = containerEntry;\n if (expiration) acc.push(expiration);\n });\n return acc;\n }, []);\n\n return (\n expirationDates\n .slice()\n .sort((a, b) => new Date(b).valueOf() - new Date(a).valueOf())\n .shift() || createExpirationDate()\n );\n};\n\nconst createStorageKeys = (\n container: Container\n): [tenant: string, implementation: string, widget: string] => {\n const {\n name: widgetName,\n implementation: { name: implementationName, tenant: tenantName },\n } = <Widget>container.get('$widget');\n\n return [\n `humany_${tenantName}`,\n `humany_${hash(tenantName + implementationName)}`,\n `humany_${hash(tenantName + implementationName + widgetName)}`,\n ];\n};\n\nconst getCookie = <Type>(cookieName: string): Type | undefined => {\n const regExp = new RegExp(`(?:^|;)\\\\s?${cookieName}=(.*?)(?:;|$)`, 'i');\n const cookie = document.cookie.match(regExp);\n const value = cookie && cookie[1] && JSON.parse(cookie[1]);\n\n return value || undefined;\n};\n\nconst setCookie = (cookieName: string, value: any, expires: string) => {\n const cookie = `${cookieName}=${JSON.stringify(value).trim()}`;\n const expiration = `expires=${new Date(expires).toUTCString()}`;\n const path = 'path=/';\n const options = 'SameSite=None;Secure'\n return (document.cookie = `${cookie}; ${expiration}; ${path}; ${options}`);\n};\n\nconst getCookieStore = (container: Container): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = getCookie<StorageContainer>(tenantKey) || {};\n const implementation = getCookie<StorageContainer>(implementationKey) || {};\n const widget = getCookie<StorageContainer>(widgetKey) || {};\n\n return {\n tenant,\n implementation,\n widget,\n };\n};\n\nconst setCookieStore = (container: Container, store: Store): void => {\n const current = getCookieStore(container);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n const expirationDate = getLongestExpirationDate(store);\n const deleteDate = createExpirationDate({ days: -1 });\n\n setCookie(tenantKey, tenant, hasEntries(tenant) ? expirationDate : deleteDate);\n setCookie(\n implementationKey,\n implementation,\n hasEntries(implementation) ? expirationDate : deleteDate\n );\n setCookie(widgetKey, widget, hasEntries(widget) ? expirationDate : deleteDate);\n};\n\nconst getApplicationStore = (container: Container, storage: Storage): Store => {\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const tenant = storage.getItem(tenantKey) || '{}';\n const implementation = storage.getItem(implementationKey) || '{}';\n const widget = storage.getItem(widgetKey) || '{}';\n\n return {\n tenant: JSON.parse(tenant),\n implementation: JSON.parse(implementation),\n widget: JSON.parse(widget),\n };\n};\n\nconst setApplicationStore = (\n container: Container,\n applicationStorage: Storage,\n store: Store\n): void => {\n const current = getApplicationStore(container, applicationStorage);\n const merged = mergeAndClean(current, store);\n\n const [tenantKey, implementationKey, widgetKey] = createStorageKeys(container);\n const { tenant, implementation, widget } = merged;\n\n hasEntries(tenant)\n ? applicationStorage.setItem(tenantKey, JSON.stringify(tenant))\n : applicationStorage.removeItem(tenantKey);\n hasEntries(implementation)\n ? applicationStorage.setItem(implementationKey, JSON.stringify(implementation))\n : applicationStorage.removeItem(implementationKey);\n hasEntries(widget)\n ? applicationStorage.setItem(widgetKey, JSON.stringify(widget))\n : applicationStorage.removeItem(widgetKey);\n};\n\nexport const createEmptyStore = (): Store => ({ tenant: {}, implementation: {}, widget: {} });\n\nexport const isExpired = (isoDateString?: string) => {\n if (!isoDateString) return false;\n return !!isoDateString && new Date() > new Date(isoDateString);\n};\n\nexport const getValue = <Type>(store: Store, key: string): Type | undefined => {\n const storedValue = store.widget[key] || store.implementation[key] || store.tenant[key];\n return storedValue?.value;\n};\n\nexport const createValue = (\n value: any,\n category: StorageCategory,\n duration?: Duration | string\n): StoredValue => {\n if (duration) {\n return {\n value,\n category,\n expiration: typeof duration === 'object' ? createExpirationDate(duration) : duration,\n };\n }\n return {\n value,\n category,\n };\n};\n\nexport const processStore = (store: Store, policy?: StorageCategory[]): Store => {\n const clone = deepClone(store);\n\n Object.entries(clone).forEach(([_, storageContainer]) => {\n Object.entries(storageContainer).forEach(([key, storedValue]) => {\n const { expiration, category } = storedValue;\n\n if (isExpired(expiration) || isNotAllowed(policy, category))\n storageContainer[key] = createValue(undefined, category, expiration);\n });\n });\n\n return clone;\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowedAsync = (\n container: Container,\n category?: StorageCategory\n): Promise<boolean> => {\n return readStorage<StorageCategory[]>(container, 'storagePolicy', StorageMedium.Cookie).then(\n (policy = [StorageCategory.Necessary]) => !!category && policy.indexOf(category) === -1\n );\n};\n\n/**\n * @param category Storage Category.\n * @param policy Current Storage Policy.\n * @returns true if not allowed, false if allowed.\n */\nexport const isNotAllowed = (\n policy: StorageCategory[] = [StorageCategory.Necessary],\n category?: StorageCategory\n): boolean => {\n return !!category && policy.indexOf(category) === -1;\n};\n\n/**\n * Processes storage and removes items if they are expired or if\n * the storage policy is defined and the category of the stored\n * value is not allowed.\n * @param container Widget Container\n */\nexport const processStorage = (container: Container): void => {\n const cookieStore = getCookieStore(container);\n const localStore = getApplicationStore(container, window.localStorage);\n const sessionStore = getApplicationStore(container, sessionStorage);\n const policy = getValue<StorageCategory[]>(cookieStore, 'storagePolicy');\n\n const [processedCookieStore, processedLocalStore, processedSessionStore] = [\n cookieStore,\n localStore,\n sessionStore,\n ].map((store) => processStore(store, policy));\n\n setCookieStore(container, processedCookieStore);\n setApplicationStore(container, window.localStorage, processedLocalStore);\n setApplicationStore(container, window.sessionStorage, processedSessionStore);\n};\n\n/**\n * Creates an expiration date string with the passed options.\n * @param options Duration options.\n * @returns ISO formatted date string.\n */\nexport const createExpirationDate = (options: Duration = { days: 30 }): string => {\n const { days = 0, hours = 0, minutes = 0, seconds = 0 } = options;\n const date = new Date();\n date.setTime(date.getTime() + hours * 60 * 60 * 1000);\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n date.setTime(date.getTime() + minutes * 60 * 1000);\n date.setTime(date.getTime() + seconds * 1000);\n return date.toISOString();\n};\n\nexport const getCookieStoreAsync = (container: Container): Promise<Store> => {\n return lock(document)(() => getCookieStore(container));\n};\n\nexport const setCookieStoreAsync = (container: Container, store: Store): Promise<any> => {\n return lock(document)(() => setCookieStore(container, store));\n};\n\nexport const getApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session\n): Promise<Store> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => getApplicationStore(container, storage));\n};\n\nexport const setApplicationStoreAsync = (\n container: Container,\n type: StorageMedium.Local | StorageMedium.Session,\n store: Store\n): Promise<void> => {\n const storage = type === StorageMedium.Local ? window.localStorage : window.sessionStorage;\n return lock(storage)(() => setApplicationStore(container, storage, store));\n};\n","import { lock, Logger } from '@telia-ace/widget-utilities';\nimport { StorageCategory } from '.';\nimport { StorageScope, Store } from './types';\nimport { createExpirationDate, createValue, getValue, processStore } from './utils';\n\ntype LegacyOptions = {\n scope?: StorageScope;\n expiration?: Date;\n};\n\ninterface LegacyMedium {\n setItem(key: string, value: any, options?: LegacyOptions): Promise<void>;\n getItem(key: string): Promise<any>;\n removeItem(key: string): Promise<void>;\n clear(): Promise<void>;\n}\n\nexport class LegacyStorage implements LegacyMedium {\n private memory: Store = {\n tenant: {},\n implementation: {},\n widget: {},\n };\n async setItem(key: string, value: any, options: LegacyOptions = {}): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n const { scope = StorageScope.Tenant, expiration } = options;\n\n processedStore[scope][key] = createValue(\n value,\n StorageCategory.Necessary,\n expiration?.toISOString() || createExpirationDate()\n );\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.\n Key: ${key}\n Value: ${JSON.stringify(value)}\n Options: ${JSON.stringify(options)}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async getItem(key: string): Promise<any> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n\n const value = getValue(processedStore, key);\n this.memory = processedStore;\n\n return value;\n });\n }\n async removeItem(key: string): Promise<void> {\n return lock(this)(() => {\n const processedStore = processStore(this.memory, [StorageCategory.Necessary]);\n\n delete processedStore.tenant[key];\n delete processedStore.implementation[key];\n delete processedStore.widget[key];\n this.memory = processedStore;\n\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.\n Key: ${key}\n Memory: ${JSON.stringify(processedStore)}`\n );\n }\n });\n }\n async clear(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport default class LegacyStorageProvider {\n cookies: LegacyStorage;\n session: LegacyStorage;\n local: LegacyStorage;\n constructor() {\n this.cookies = new LegacyStorage();\n this.session = new LegacyStorage();\n this.local = new LegacyStorage();\n }\n}\n","const z = /* @__PURE__ */ new WeakMap();\nfunction b() {\n return (s) => (z.has(s) || z.set(s, {}), z.get(s));\n}\nconst I = (s, t, e, ...n) => {\n const o = `[${s.get(\"$environment\").name || \"webprovisions\"}] ${e}`;\n switch (t) {\n case \"info\":\n console.info(o, ...n);\n break;\n case \"warning\":\n console.warn(o, ...n);\n break;\n case \"error\":\n console.error(o, ...n);\n break;\n }\n}, u = (s) => {\n const t = s.container || s;\n return {\n info: (e, ...n) => I(t, \"info\", e, ...n),\n warn: (e, ...n) => I(t, \"warning\", e, ...n),\n error: (e, ...n) => I(t, \"error\", e, ...n)\n };\n}, c = b(), M = (() => {\n let s = 0;\n return () => ++s;\n})(), _ = (s, t, e) => {\n const n = c(s).touchQueue.get(t);\n n && n.forEach((i) => {\n i(e, s);\n });\n};\nclass G {\n constructor(t, e, n, i) {\n this.key = t, this.factory = e, this.parent = n, this.container = i, this.id = M(), this.resolved = !1, this.constructed = !1, this.async = !0;\n }\n resolve() {\n if (!this.constructed) {\n const t = this.factory(this.parent, this.container);\n return this.constructed = !0, this.value = Promise.resolve(t).then((e) => (this.resolved = !0, _(this.container, this.key, e), e));\n }\n return this.value;\n }\n}\nclass J {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, _(this.container, this.key, this.value), this.value);\n }\n}\nclass X {\n constructor(t, e, n, i) {\n this.key = t, this.value = e, this.parent = n, this.container = i, this.id = M(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {\n this.resolved = !0, this.constructed = !0;\n const r = this.value(this.parent, this.container);\n return _(this.container, this.key, this.value), r;\n };\n }\n}\nclass W {\n /**\n * Creates a new instance of `Container`.\n * @param owner The object owning this inctance.\n * @param name Optional name for the container.\n * @param parent Parent container this should be a child of.\n */\n constructor(t, e, n) {\n this.owner = t, this.name = e, this.parent = n, c(this).resolvers = /* @__PURE__ */ new Map(), c(this).touchQueue = /* @__PURE__ */ new Map(), c(this).children = [];\n }\n /**\n * Deletes an existing resolver by its unique id.\n * @param id Resolver id.\n */\n delete(t) {\n const e = c(this).resolvers, i = Array.from(e.values()).find((r) => r.id === t);\n return i ? (c(this).touchQueue.delete(i.key), Promise.resolve(e.delete(i.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);\n }\n /**\n * Clears the `Container` and any child containers by deleteing all registered resolvers.\n */\n clear() {\n const t = c(this).resolvers, e = Array.from(t.values());\n return Promise.all(e.map((n) => {\n if (n.constructed)\n return Promise.resolve(n.resolve()).then((i) => {\n if (i !== null && typeof i == \"object\" && typeof i.dispose == \"function\")\n return i.dispose.call(i, this, n);\n });\n })).then(() => {\n e.forEach((n) => this.delete(n.id)), c(this).children.forEach((n) => n.clear());\n });\n }\n /**\n * Detaches this `Container` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = c(this.parent).children, e = t.indexOf(this);\n e > -1 && (t.splice(e, 1), delete this.parent);\n }\n }\n /**\n * Provides a way of touching a value in the `Container` without forcing it to be resolved.\n * @param key Key of the resolved value to touch.\n * @param handler Handler function for touching the resolved value.\n */\n touch(t, e) {\n const i = c(this).resolvers.get(t);\n if (i && i.constructed)\n Promise.resolve(i.resolve()).then((o) => {\n e(o, this);\n });\n else {\n const o = c(this).touchQueue;\n let a = o.get(t);\n a || (a = [], o.set(t, a)), a.push(e);\n }\n return this.parent && !i ? this.parent.touch(t, e) : Promise.resolve();\n }\n /**\n * Registers an asynchronous resolver.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerAsync(t, e) {\n const n = c(this).resolvers.get(t);\n n && !n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);\n const i = new G(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers a factory resolver for constructing the value to be resolved.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerFactory(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new X(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers an synchronous resolver.\n * @param key Key of the resolver.\n * @param value Value.\n */\n register(t, e) {\n const n = c(this).resolvers.get(t);\n n && n.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new J(t, e, n, this);\n return c(this).resolvers.set(t, i), i.id;\n }\n /**\n * Gets the value for a synchronous resolver.\n * @param key Key of resolver to get.\n */\n get(t) {\n const e = c(this).resolvers.get(t);\n if (e)\n return e.async && process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();\n if (this.parent)\n return this.parent.get(t);\n }\n /**\n * Gets the value for a asynchronous resolver.\n * @param key Key of resolver to get.\n */\n getAsync(t) {\n const e = c(this).resolvers.get(t);\n if (e) {\n if (!e.async)\n throw process.env.NODE_ENV !== \"production\" && u(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), \"Mismatching resolver type\";\n return e.resolve();\n }\n return this.parent ? this.parent.getAsync(t) : Promise.resolve(void 0);\n }\n getMany(...t) {\n const e = {};\n return t.forEach((n) => e[n] = this.get(n)), e;\n }\n getManyAsync(...t) {\n const e = {};\n return Promise.all(t.map((n) => this.getAsync(n).then((i) => e[n] = i))).then(() => e);\n }\n createChild(t, e) {\n const n = new W(t, e, this);\n return c(this).children.push(n), n;\n }\n}\nclass L {\n /**\n * \n * @param type Type of event.\n * @param target The target of the event, which will handle the default behavour.\n * @param cancelable Whether the event is cancelable by calling preventDefault().\n * @param bubbles Whether the event will bubble up the parent hierarchy.\n */\n constructor(t, e, n = !1, i = !1) {\n this.type = t, this.target = e, this.cancelable = !!n, this.bubbles = !!i, this.defaultPrevented = !1;\n }\n /**\n * Cancels the default behaviour (if the event is cancelable).\n */\n preventDefault() {\n this.cancelable && (this.defaultPrevented = !0);\n }\n}\nconst p = b(), q = (s, t) => [].concat(\n p(s).listenerLookup.get(t.toLowerCase()) || [],\n p(s).listenerLookup.get(\"*\") || []\n), F = (s, t, e, n) => {\n let i, r;\n return t instanceof L ? (i = t, r = t.type) : (i = new L(t, s.target, !!e.cancelable, !!e.bubbles), r = t), { event: i, type: r, async: n };\n};\nclass D {\n /**\n * Creates a new Event Manager instance.\n * @param target The target of events dispatched from this Event Manager instance.\n * @param parent Parent Event Manager instance.\n */\n constructor(t, e) {\n this.target = t, this.parent = e, p(this).listenerLookup = /* @__PURE__ */ new Map(), p(this).children = [];\n }\n /**\n * Clears registered event listeners in this `EventManager` as well as in any children.\n */\n clear() {\n p(this).listenerLookup.clear(), p(this).children.forEach((t) => t.clear());\n }\n /**\n * Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = p(this.parent).children, e = t.indexOf(this);\n e > -1 && t.splice(e, 1);\n }\n }\n /**\n * Creates an event subscription by registering an listener for an event type.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribe(t, e, n) {\n const i = p(this).listenerLookup, r = t.toLowerCase();\n return i.has(r) || i.set(r, []), i.get(r).push(e), () => this.unsubscribe(t, e);\n }\n /**\n * Similar to `subscribe()` but immediately removes the subscription after the first call.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribeOnce(t, e) {\n const n = this.subscribe(t, (i, r) => (n(), e(i, r)));\n }\n /**\n * Removes a listener for the specified event type.\n * @param type Event type to remove subscription for.\n * @param listener Event listener to remove.\n */\n unsubscribe(t, e) {\n const n = p(this).listenerLookup.get(t.toLowerCase());\n if (n) {\n const i = n.indexOf(e);\n i > -1 && n.splice(i, 1);\n }\n }\n /**\n * Dispatches an asynchonous event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatchAsync(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !0), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = Promise.resolve();\n for (a = 0; a < l; a++)\n ((m) => {\n h = h.then((y) => y ? Promise.resolve(!0) : Promise.resolve(m(i, e)).then(() => i.defaultPrevented));\n })(o[a]);\n return h.then((m) => !m && i.bubbles && this.parent ? this.parent.dispatchAsync(i, e) : m);\n }\n /**\n * Dispatches an event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatch(t, e, n = {}) {\n const { event: i, type: r } = F(this, t, n, !1), o = q(this, r);\n let a = 0;\n const l = o.length;\n let h = !1;\n for (a = 0; a < l; a++)\n if (o[a](i, e), i.defaultPrevented) {\n h = !0;\n break;\n }\n return !h && i.bubbles && this.parent && (h = this.parent.dispatch(i, e)), h;\n }\n /**\n * Creates a child instance to the current Event manager.\n */\n createChild(t) {\n const e = new D(t, this);\n return p(this).children.push(e), e;\n }\n}\nconst P = (s, t, e) => {\n const i = s.get(\"$plugins\").map((r) => {\n try {\n return r.invoke(t, e);\n } catch (o) {\n u(s).error(\"An error occured when invoking a plugin.\", r, o);\n }\n });\n return Promise.all(i);\n};\nclass Z {\n constructor(t) {\n this.widget = t.get(\"$widget\"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();\n }\n createInstance() {\n if (!this.widget.container.get(\"$instance\")) {\n const t = this.widget.container.get(\"$types\"), e = this.widget.container.get(\"$type\");\n !e && u(this).error(\"Unable to create widget. No type is specified.\");\n const n = t[e];\n !n && u(this).error(`Unable to create widget. Type '${e}' is not registered.`), this.widget.events.dispatch(\"widget:create-instance\", {}, { bubbles: !0 });\n try {\n this.widget.container.register(\n \"$instance\",\n new n(this.container)\n );\n } catch (i) {\n u(this).error(\"Unable to create widget type.\", i);\n }\n this.widget.events.dispatch(\"widget:instance-created\", {}, { bubbles: !0 });\n }\n }\n /**\n * The initialization is performed before the widget is activated but after it's configured\n * and thus all required services are available. This hook is a good place to bind events that\n * should trigger activation (e.g. click on \"trigger links\" or routing events)\n * @param {object} data Custom initialization data passed to the widget.\n */\n initialize(t) {\n return this.initialized = this.initialized || (() => {\n const e = this.container.get(\"$instance\"), n = e.initialize || (() => {\n });\n return this.initialized = Promise.resolve(n.call(e, t)).then(() => P(this.container, \"initialize\", t)).then(() => {\n });\n })();\n }\n /**\n * The activation is where the widget is actually created and rendered.\n * Activation can be initialized from the outside or from an event originated\n * in the \"initialize\" hook.\n * @param {object} data Custom activation data passed to the widget.\n */\n activate(t) {\n return (this.initialized || this.initialize()).then(() => {\n this.activated = this.activated || (() => P(this.container, \"activate\").then(() => {\n const n = this.container.get(\"$instance\");\n return this.activated = n.activate(t);\n }))();\n });\n }\n deactivate() {\n const t = this.container.get(\"$instance\"), e = t.deactivate || (() => {\n });\n return P(this.container, \"deactivate\").then(() => Promise.resolve(e.call(t))).then(() => {\n this.initialized = null, this.activated = null;\n }).then(() => {\n });\n }\n /**\n * Invokes a command on the widget component.\n * @param command Name of command\n * @param args Command arguments\n */\n invoke(t, ...e) {\n return P(this.container, \"invoke\", { command: t, args: e }).then(() => {\n const n = this.container.get(\"$instance\");\n if (n[t])\n return n[t].apply(n, e);\n const i = n.invoke;\n if (i)\n return i.call(n, t, ...e);\n });\n }\n}\nconst w = (s, t) => {\n if (!t)\n return !0;\n if (typeof t == \"string\") {\n const e = t.split(\",\");\n for (let n = 0, i = e.length; n < i; n++) {\n const r = e[n].trim();\n if (r === s || r === \"*\")\n return !0;\n }\n }\n return t instanceof Array ? t.indexOf(s) > -1 : !1;\n}, K = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? nt(t) : t;\n return !(!w(s.implementation.tenant || \"\", e.tenant || \"\") || !w(s.implementation.name, e.implementation || \"\") || !w(s.name, e.widget || \"\") || !w(s.container.get(\"$type\"), e.type || \"\"));\n}, tt = (s, t) => {\n if (typeof t == \"function\")\n return t(s);\n const e = typeof t == \"string\" ? st(t) : t;\n return !(!w(s.tenant || \"\", e.tenant || \"\") || !w(s.name, e.implementation || \"\"));\n}, Q = (s) => (t) => K(t, s), et = (s) => (t) => tt(t, s), f = (s) => s instanceof Array && s.length === 1 ? s[0] : s, nt = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.widget = f(e[0].split(\",\")) : e.length === 2 ? (t.implementation = f(e[0].split(\",\")), t.widget = f(e[1].split(\",\"))) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\")), t.widget = f(e[2].split(\",\"))), t;\n}, st = (s) => {\n const t = {}, e = s.split(\":\");\n return e.length === 1 ? t.implementation = f(e[0].split(\",\")) : (t.tenant = f(e[0].split(\",\")), t.implementation = f(e[1].split(\",\"))), t;\n}, E = b(), V = (s, t, e) => s.filter((n) => n.stage === t && Q(n.selector)(e));\nfunction it(s) {\n const t = s.container.get(\"$environment\");\n let e = E(t).configurationCache;\n e && (e = e.filter((n) => n[0] !== s), E(t).configurationCache = e);\n}\nvar k = /* @__PURE__ */ ((s) => (s.Implementation = \"implementation\", s.Widget = \"widget\", s))(k || {}), g = /* @__PURE__ */ ((s) => (s.Pre = \"pre\", s.Post = \"post\", s))(g || {});\nconst T = (s, t, e) => (Object.keys(t).forEach((n) => {\n const i = t[n];\n if (typeof i == \"function\") {\n const r = i();\n typeof r.defaultArgs != \"undefined\" && e(r, ...r.defaultArgs), s[n] = (...o) => {\n const a = Object.assign(\n {},\n r,\n { handlerResolver: r.handlerResolver.bind({}) }\n );\n return e(a, ...o), s;\n };\n } else\n s[n] = T(\n {},\n i,\n e\n );\n}), s), rt = (s, t) => {\n switch (t) {\n case \"implementation\":\n return s.implementation;\n case \"widget\":\n return s;\n }\n}, O = (s, t, e, n) => (n.forEach((i) => {\n T(\n s,\n i,\n (r, ...o) => {\n const a = {\n selector: t,\n stage: r.stage,\n handler: (l) => {\n const h = rt(l, r.scope), m = { container: h.container, events: h.events }, y = r.handlerResolver, x = y(m);\n let v = E(e.environment).configurationCache;\n return v || (v = E(e.environment).configurationCache = []), v.find((R) => R.indexOf(h) > -1 && R.indexOf(y) > -1) ? Promise.resolve() : (v.push([h, y]), Promise.resolve(x(...o)));\n }\n };\n e.instructions.push(a);\n }\n );\n}), s);\nfunction ot(s, t) {\n function e(n) {\n return O(\n {},\n n,\n s,\n t\n );\n }\n return O(\n e,\n \"*\",\n s,\n t\n );\n}\nclass $t {\n constructor(t, e) {\n this.container = t, this.settings = e, this.widget = t.get(\"$widget\"), this.events = this.widget.events;\n }\n}\nconst at = (s, t, e, n) => {\n try {\n const i = new t(e, n);\n return {\n name: s,\n invoke: (r, o) => {\n let a;\n return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);\n },\n getInstance: () => i\n };\n } catch (i) {\n if (i.message && i.message.indexOf(\"is not a constructor\") >= 0)\n return {\n name: s,\n invoke: (r) => {\n let o;\n return r === \"initialize\" && (o = t(e, n)), Promise.resolve(o);\n },\n getInstance: () => t\n };\n throw i;\n }\n};\nfunction j(s, t) {\n return typeof s == \"undefined\" ? t : s;\n}\nclass ct {\n constructor(t = {}) {\n this.part = t;\n }\n createCommand(t, e, n) {\n let i;\n typeof e == \"function\" ? i = {\n scope: k.Widget,\n stage: g.Post,\n defaultArgs: void 0,\n handlerResolver: e\n } : i = {\n scope: j(e.scope, k.Widget),\n stage: j(e.stage, g.Post),\n defaultArgs: e.defaultArgs,\n handlerResolver: n\n };\n let r = this.part;\n const o = t.split(\".\");\n return o.forEach((a, l) => {\n l === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};\n }), this;\n }\n get() {\n return this.part;\n }\n}\nconst ht = (s) => {\n const t = new ct({});\n return s(t), t.get();\n}, lt = ht((s) => {\n s.createCommand(\n \"types.register\",\n { scope: k.Implementation, stage: g.Pre },\n (t) => (e, n) => {\n t.container.get(\"$types\")[e] = n;\n }\n ).createCommand(\n \"type\",\n { stage: g.Pre },\n (t) => (e) => {\n t.container.register(\"$type\", e);\n }\n ).createCommand(\n \"settings\",\n { stage: g.Pre, defaultArgs: [null] },\n (t) => (e) => {\n t.events.dispatch(\n \"settings:change\",\n e,\n { bubbles: !0 }\n ), t.container.register(\"$settings\", e);\n }\n ).createCommand(\n \"plugin\",\n { stage: g.Pre },\n (t) => (e, n, i) => {\n const { container: r } = t;\n let o = null, a = e, l = n;\n typeof e == \"string\" && (o = e, a = n, l = i);\n const h = (m) => {\n const { transformPluginSettings: y } = t.container.get(\"$environmentOptions\"), x = y ? y(\n l || {},\n o,\n t.container,\n a\n ) : n;\n try {\n const v = at(\n o,\n a,\n r,\n x\n );\n r.get(\"$plugins\").push(v), m && v.invoke(\"initialize\", null);\n } catch (v) {\n u(t).warn(\"Error when initializing plugin\", v);\n }\n };\n t.container.get(\"$instance\") ? h(!0) : t.events.subscribeOnce(\"widget:instance-created\", () => h(!1));\n }\n ).createCommand(\n \"container.register\",\n (t) => (e, n) => {\n t.container.register(e, n);\n }\n ).createCommand(\n \"container.registerAsync\",\n (t) => (e, n) => {\n t.container.registerAsync(e, n);\n }\n ).createCommand(\n \"container.registerFactory\",\n (t) => (e, n) => {\n t.container.registerFactory(e, n);\n }\n ).createCommand(\n \"container.touch\",\n (t) => (e, n) => {\n t.container.touch(e, n);\n }\n ).createCommand(\n \"csp\",\n {},\n (t) => (e) => {\n t.container.register(\"csp\", e);\n }\n );\n}), ut = lt;\nfunction dt(s, t, e = []) {\n const n = [ut].concat(e), i = ot(\n t,\n n\n );\n s(i, t);\n}\nclass pt {\n constructor() {\n this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);\n }\n add(t, e, n, i) {\n this.tasks.push({ task: t, resolve: e, reject: n, done: i }), this.next();\n }\n next() {\n this.current = this.current.then(() => {\n const t = this.tasks.shift();\n if (t) {\n const e = Promise.resolve(t.task());\n return Promise.resolve(e).then(this.next).then(() => e.then((n) => {\n t.done(), t.resolve(n);\n })).catch((n) => (t.done(), t.reject(n), this.next()));\n }\n return Promise.resolve();\n });\n }\n}\nconst A = /* @__PURE__ */ new WeakMap();\nfunction vt(s) {\n return A.has(s) || A.set(s, new pt()), (t) => new Promise((e, n) => {\n const i = A.get(s);\n i.add(t, e, n, () => {\n i.tasks.length || A.delete(s);\n });\n });\n}\nconst U = (s) => typeof s != \"undefined\";\nvar ft = /* @__PURE__ */ ((s) => (s.Activating = \"activating\", s.Loading = \"loading\", s.Activated = \"activated\", s.Deactivating = \"deactivating\", s.Deactivated = \"deactivated\", s))(ft || {});\nconst $ = (s, t) => {\n s.events.dispatch(\"widget:state-change\", { state: t }, { bubbles: !0 }), s.state = t, s.events.dispatch(\"widget:state-changed\", {}, { bubbles: !0 });\n}, d = b(), gt = (s) => {\n const { container: t, events: e } = s;\n t.get(\"$controller\") || (t.register(\"$controller\", new Z(t)), e.dispatch(\"widget:controller-created\", {}, { bubbles: !0 }));\n};\nclass mt {\n /**\n * Creates a new `Widget` instance.\n * @param name Name of widget.\n * @param implementation The implementation this instance belongs to.\n * @param configuration Configuration for the widget.\n */\n constructor(t, e, n) {\n this.state = \"deactivated\", this.name = t, this.implementation = e, this.container = e.container.createChild(this, t), this.events = e.events.createChild(this), d(this).subscriptions = [], n && e.configure((i) => {\n const r = i(t);\n U(n.type) && r.type(n.type), U(n.settings) && r.settings(n.settings), n.plugins && Object.keys(n.plugins).forEach((o) => {\n var l;\n const a = (l = n.plugins) == null ? void 0 : l[o];\n r.plugin(o, a);\n });\n }), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);\n }\n /**\n * Initializes the widget, if not already initialized, and applies any\n * pending configuration.\n */\n load() {\n return vt(this)(() => {\n d(this).deactivatedPromise = null;\n const t = this.state === \"deactivated\";\n t && ($(\n this,\n \"activating\"\n /* Activating */\n ), this.container.register(\"$widget\", this), this.container.register(\"$controller\", null), this.container.register(\"$plugins\", []), this.container.register(\"$type\", null), this.container.register(\"$instance\", null)), $(\n this,\n \"loading\"\n /* Loading */\n );\n const e = this.implementation.instructions, n = V(e, g.Pre, this);\n return Promise.all(n.map((i) => i.handler(this))).then(() => {\n gt(this);\n const i = V(e, g.Post, this);\n return Promise.all(i.map((r) => r.handler(this))).then(() => {\n t && this.container.get(\"$controller\").initialize();\n });\n }).then(() => ($(\n this,\n \"activated\"\n /* Activated */\n ), this));\n });\n }\n /**\n * Activates the widget and makes it ready for receiving commands.\n * @param data Activation data\n */\n activate(t) {\n d(this).subscriptions.push(\n this.implementation.events.subscribe(\"implementation:configured\", () => {\n [\n \"activated\",\n \"activating\",\n \"loading\"\n /* Loading */\n ].indexOf(this.state) > -1 && this.load();\n })\n );\n const e = d(this).activatedPromise;\n return e ? (process.env.NODE_ENV !== \"production\" && u(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : d(this).activatedPromise = this.load().then(() => this.container.get(\"$controller\").activate(t));\n }\n /**\n * Invokes a command on a widget. If the widget isn't activate the invocation \n * will be suspended until activation.\n * @param command Command to invoke.\n * @param args Command arguments.\n */\n invoke(t, ...e) {\n const n = d(this).activatedPromise, i = (r, ...o) => n.then(this.load).then(() => this.container.get(\"$controller\").invoke(r, ...o));\n return n ? i(t, ...e) : (process.env.NODE_ENV !== \"production\" && u(this).warn(\"You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.\", this), new Promise((r) => {\n const o = this.events.subscribe(\"widget:state-changed\", () => {\n this.state === \"activated\" && (o(), r(i(t, ...e)));\n });\n }));\n }\n /**\n * Deactivates the widget by clearing the `Container` and removing any event subscriptions in the\n * `EventManager`.\n */\n deactivate() {\n const t = d(this).deactivatedPromise;\n return t || (this.state === \"deactivated\" ? Promise.resolve() : ($(\n this,\n \"deactivating\"\n /* Deactivating */\n ), d(this).deactivatedPromise = this.container.get(\"$controller\").deactivate().then(() => (d(this).activatedPromise = null, d(this).subscriptions.forEach((e) => e()), d(this).subscriptions = [], this.container.clear().then(() => {\n this.events.clear(), it(this), $(\n this,\n \"deactivated\"\n /* Deactivated */\n );\n })))));\n }\n}\nconst Pt = (s) => s.deactivate().then(() => {\n s.events.detach(), s.container.detach(), s.implementation.widgets.delete(s.name);\n});\nclass At {\n /**\n * Creates a new `Widget` instance.\n * @param container The `Container` instance to base the widget upon.\n */\n constructor(t) {\n this.container = t, this.widget = t.get(\"$widget\"), this.settings = t.get(\"$settings\"), this.events = this.widget.events, this.widget.events.subscribe(\"settings:change\", (e, n) => {\n this.settings = n;\n });\n }\n}\nconst Y = b();\nclass yt {\n /**\n * Creates a new Implementation instance.\n * @param configuration Configuration for the implementation.\n * @param environment The parent environment.\n * @param configurationApiExtensions Optional configuration API extensions.\n */\n constructor(t, e, n = []) {\n this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = t.name, this.tenant = t.tenant, this.environment = e, this.container = e.container.createChild(this, this.name), this.events = e.events.createChild(this), this.container.register(\"$types\", {}), Y(this).configurationApiExtensions = n;\n }\n /**\n * Loads all widgets in the implementation.\n */\n load() {\n const t = Array.from(this.widgets.values());\n return Promise.all(t.map((e) => e.load())).then(() => t);\n }\n /**\n * Configures the implementation by adding a configuration callback.\n * @param configFn Callback function for configuration.\n */\n configure(t) {\n return dt(t, this, Y(this).configurationApiExtensions), this.events.dispatch(\n \"implementation:configured\",\n { implementation: this },\n { bubbles: !0 }\n ), this;\n }\n /**\n * Creates a widget on the implementation and returns its `WidgetData`.\n * @param name Widget name.\n * @param configuration Widget configuration.\n */\n createWidget(t, e) {\n const n = new mt(t, this, e);\n return this.widgets.set(n.name, n), n;\n }\n}\nfunction wt(s, t, e) {\n const n = new yt(s, t, e);\n return s.widgets && Object.keys(s.widgets).forEach((i) => {\n var o;\n const r = (o = s.widgets) == null ? void 0 : o[i];\n n.createWidget(i, r);\n }), n;\n}\nclass C {\n constructor(t, e) {\n this.selectorFactory = e, typeof t == \"function\" ? this.resolver = t : this.resolver = () => t;\n }\n append(t) {\n const e = typeof t == \"function\" ? t : () => t;\n return new C(\n () => this.all().concat(e()),\n this.selectorFactory\n );\n }\n all() {\n return this.resolver().concat([]);\n }\n query(t) {\n return this.all().filter(this.selectorFactory(t));\n }\n find(t) {\n const e = this.query(t);\n if (e.length)\n return e[0];\n }\n}\nconst S = \"#____version____#\";\nfunction Et(s, t) {\n const e = B.create(s);\n return Promise.all(\n (t || []).map((n) => Promise.resolve(n(e)))\n ).then(() => e);\n}\nconst N = b(), bt = (s) => s.tenant ? `${s.name}:${s.tenant}` : s.name, H = class {\n constructor(s, t = [], e = {}) {\n this.widgets = new C(\n () => {\n let n = [];\n return this.implementations.all().forEach((i) => {\n n = n.concat(Array.from(i.widgets.values()));\n }), n;\n },\n Q\n ), this.implementations = new C([], et), this.name = s, this.container = new W(this, s), this.events = new D(this), this.container.register(\"$version\", S), this.container.register(\"$environment\", this), this.container.register(\"$environmentOptions\", e), N(this).configurationApiExtensions = t;\n }\n /**\n * Creates an implementation based on the provided configuration.\n * @param config Implementation configuration.\n */\n createImplementation(s) {\n const t = bt(s);\n let e = this.implementations.find(t);\n if (e)\n return process.env.NODE_ENV !== \"production\" && u(e).warn(`Implementation \"${t}\" already exist on current environment.`), e;\n const n = N(this).configurationApiExtensions;\n return e = wt(\n s,\n this,\n n\n ), this.implementations = this.implementations.append([e]), this.events.dispatch(\"implementation:created\", { implementation: e }), e;\n }\n /**\n * Patches the Environment instance configuration.\n * @param configuration Environment configuration.\n */\n patch(s = {}) {\n const { name: t, configurationApiExtensions: e } = s;\n typeof t != \"undefined\" && t !== null && (this.name = t), e && e.forEach(\n (n) => {\n N(this).configurationApiExtensions.push(n);\n }\n );\n }\n /**\n * Creates a new Environment instance based on the provided configuration.\n * @param configuration Environment configuration.\n */\n static create(s = {}) {\n return new H(\n s.name || \"\",\n s.configurationApiExtensions,\n s.options\n );\n }\n};\nlet B = H;\nB.version = S;\nexport {\n k as ConfigurationScope,\n g as ConfigurationStage,\n W as Container,\n B as Environment,\n D as EventManager,\n L as EventObject,\n yt as Implementation,\n $t as Plugin,\n mt as Widget,\n Z as WidgetController,\n ft as WidgetState,\n At as WidgetType,\n ht as createConfigurationApi,\n Et as createEnvironment,\n Pt as destroy,\n Pt as destroyWidget,\n u as logger,\n et as selectImplementations,\n Q as selectWidgets,\n S as version\n};\n//# sourceMappingURL=index.js.map\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { createConfigurationApi } from '@webprovisions/platform';\nimport { createStorageWriter } from './storage';\nimport { StorageCategory, StorageConfigurationOptions, StorageMedium, StorageScope } from './types';\nimport { processStorage } from './utils';\n\nexport default createConfigurationApi((builder) => {\n builder.createCommand('storage', (context) => (options: StorageConfigurationOptions = {}) => {\n const { consent } = options;\n if (typeof consent !== 'undefined') {\n if (\n typeof consent !== 'number' &&\n typeof consent !== 'string' &&\n !Array.isArray(consent)\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n if (\n Array.isArray(consent) &&\n !(consent as string[]).every(\n (c: any) => typeof c === 'number' || typeof c === 'string'\n )\n ) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n return;\n }\n\n const policy: StorageCategory[] = [\n StorageCategory.Necessary,\n StorageCategory.Functional,\n StorageCategory.Analytical,\n StorageCategory.Marketing,\n ].filter((category, index, array) => {\n if (typeof consent === 'number') {\n // Passed consent is a category level (number)\n // Include the passed category level and all categories below it\n return consent > index;\n } else if (typeof consent === 'string') {\n // Passed consent is a category (string)\n // Include the passed category and all categories below its level\n return array.indexOf(consent) + 1 > index;\n } else if (Array.isArray(consent)) {\n // Passed consent is an array with category levels (number), categories (string) or both\n // Include all categories in passed array\n return (\n consent.findIndex((c: number | StorageCategory) => {\n return c === index + 1 || c === category;\n }) > -1\n );\n } else {\n return true;\n }\n });\n\n if (policy.indexOf(StorageCategory.Necessary) === -1) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn(\n `storagePolicyConfigurationApi: passed consent does not include category: '${\n StorageCategory.Necessary\n }'. Consent has to atleast include the '${\n StorageCategory.Necessary\n }' category.\n Passed consent: ${JSON.stringify(consent)}`\n );\n }\n policy.unshift(StorageCategory.Necessary);\n }\n\n return createStorageWriter(\n context.container,\n 'storagePolicy',\n StorageCategory.Necessary,\n {\n medium: StorageMedium.Cookie,\n scope: StorageScope.Tenant,\n duration: { days: 365 },\n }\n )\n .then((write) => write(policy))\n .then(() => {\n processStorage(context.container);\n\n context.events.dispatch('storage:policy-changed', policy);\n });\n }\n });\n});\n"],"names":["StorageMedium","StorageScope","StorageCategory","createStorageWriter","container","key","category","options","isNotAllowedAsync","notAllowed","Logger","value","processStorage","scope","medium","duration","store","createEmptyStore","createValue","setCookieStoreAsync","setApplicationStoreAsync","readStorage","getCookieStoreAsync","getValue","getApplicationStoreAsync","hasEntries","object","_","cleanUndefined","mergeAndClean","target","source","merged","__spreadValues","getLongestExpirationDate","acc","storeEntry","containerEntry","expiration","a","b","createExpirationDate","createStorageKeys","widgetName","implementationName","tenantName","hash","getCookie","cookieName","regExp","cookie","setCookie","expires","path","getCookieStore","tenantKey","implementationKey","widgetKey","tenant","implementation","widget","setCookieStore","current","expirationDate","deleteDate","getApplicationStore","storage","setApplicationStore","applicationStorage","isExpired","isoDateString","storedValue","processStore","policy","clone","deepClone","storageContainer","isNotAllowed","cookieStore","localStore","sessionStore","processedCookieStore","processedLocalStore","processedSessionStore","days","hours","minutes","seconds","date","lock","type","LegacyStorage","_0","_1","__async","processedStore","LegacyStorageProvider","I","s","t","e","n","o","u","k","g","at","i","r","j","ct","l","ht","h","m","y","x","v","storagePolicyConfigurationApi","createConfigurationApi","builder","context","consent","c","index","array","write"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,iBAAiB,kBACjBA,EAAA,SAAS,UAHDA,IAAAA,KAAA,CAAA,CAAA,GAoBAC,sBAAAA,OACRA,EAAA,YAAY,aACZA,EAAA,aAAa,cACbA,EAAA,aAAa,cACbA,EAAA,YAAY,aAJJA,IAAAA,KAAA,CAAA,CAAA;ACGL,MAAMC,IAAsB,CAC/BC,GACAC,GACAC,GACAC,IAAgC,CAAA,MAEzBC,EAAkBJ,GAAWE,CAAQ,EAAE,KAAK,CAACG,OAC5C,QAAQ,IAAI,aAAa,gBACrBA,KACOC,EAAA;AAAA,EACH;AAAA,2BACOL;AAAA,gCACK,KAAK,UAAUC,CAAQ;AAAA,+B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ZA,IAAUE,IACV,OAAOF,KAAY,WAGnBG,EAAM,QAAQH,CAAO,IAAI,IAAIE,IAC7B,MAAM,QAAQF,CAAO,IAIxBA,EAAQ,UAAU,CAACC,MACRA,MAAMC,IAAQ,KAAKD,MAAMrH,CACnC,IAAI,KAGF,EAEd;AAED,aAAImE,EAAO,QAAQvE,EAAgB,SAAS,MAAM,OAC1C,QAAQ,IAAI,aAAa,gBAClBQ,EAAA;AAAA,QACH,6EACIR,EAAgB,mDAEhBA,EAAgB;AAAA,0CAEF,KAAK,UAAUwH,CAAO;AAAA,MAAA,GAGzCjD,EAAA,QAAQvE,EAAgB,SAAS,IAGrCC;AAAA,QACHsH,EAAQ;AAAA,QACR;AAAA,QACAvH,EAAgB;AAAA,QAChB;AAAA,UACI,QAAQF,EAAc;AAAA,UACtB,OAAOC,EAAa;AAAA,UACpB,UAAU,EAAE,MAAM,IAAI;AAAA,QAC1B;AAAA,MAAA,EAEC,KAAK,CAAC6H,MAAUA,EAAMrD,CAAM,CAAC,EAC7B,KAAK,MAAM;AACR,QAAA7D,EAAe6G,EAAQ,SAAS,GAExBA,EAAA,OAAO,SAAS,0BAA0BhD,CAAM;AAAA,MAAA,CAC3D;AAAA;AAAA,EACT,CACH;AACL,CAAC;","x_google_ignoreList":[4]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-services",
3
- "version": "1.0.27-next.0",
3
+ "version": "1.0.27-next.2",
4
4
  "description": "Services for ACE Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@telia-ace/widget-utilities": "1.0.16-next.0"
24
+ "@telia-ace/widget-utilities": "1.0.16-next.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@telia-ace/widget-developer-tools": "1.0.22-next.0",
28
- "@webprovisions/platform": "^1.1.3-rc.3"
27
+ "@telia-ace/widget-developer-tools": "1.0.22-next.2",
28
+ "@webprovisions/platform": "^1.1.3"
29
29
  },
30
30
  "scripts": {
31
31
  "clean": "rimraf ./dist",