@myop/sdk 0.3.36 → 0.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled-declarations.d.ts +406 -166
- package/dist/cjs/{_IframeSDK.3283252f.js → _IframeSDK.096d8320.js} +1325 -915
- package/dist/cjs/_IframeSDK.096d8320.js.map +7 -0
- package/dist/cjs/_IframeSDK.8e791f92.min.js +1 -0
- package/dist/cjs/_MyopHelpers.91004b19.min.js +1 -0
- package/dist/cjs/{_MyopHelpers.08d1cf5d.js → _MyopHelpers.efed13e4.js} +362 -2
- package/dist/cjs/_MyopHelpers.efed13e4.js.map +7 -0
- package/dist/cjs/_WebComponentSDK.4a87f826.min.js +1 -0
- package/dist/cjs/{_WebComponentSDK.e84be6ea.js → _WebComponentSDK.e9e877db.js} +893 -486
- package/dist/cjs/_WebComponentSDK.e9e877db.js.map +7 -0
- package/dist/cjs/{_hostSDK.fa5b3ccf.js → _hostSDK.0c271647.js} +1348 -941
- package/dist/cjs/_hostSDK.0c271647.js.map +7 -0
- package/dist/cjs/_hostSDK.7d759290.min.js +1 -0
- package/dist/cjs/myop_sdk.js +35 -24
- package/dist/cjs/myop_sdk.js.map +2 -2
- package/dist/cjs/myop_sdk.min.js +1 -1
- package/dist/cjs-bundled/myop_sdk.bundled.js +1820 -1379
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +4 -4
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +1501 -1079
- package/dist/module/Iframe/index.js.map +4 -4
- package/dist/module/SDK.d.ts +5 -1
- package/dist/module/SDK.js +1974 -1523
- package/dist/module/SDK.js.map +4 -4
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/helpers/CloudRepository.d.ts +96 -0
- package/dist/module/helpers/cloudRepositoryHelpers.d.ts +99 -0
- package/dist/module/helpers/deliveryStore.d.ts +51 -0
- package/dist/module/helpers/index.js +370 -3
- package/dist/module/helpers/index.js.map +4 -4
- package/dist/module/host/components/myopIframeComponent.d.ts +6 -0
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/hostSDK.d.ts +2 -0
- package/dist/module/host/index.js +1516 -1097
- package/dist/module/host/index.js.map +4 -4
- package/dist/module/webcomponent/index.js +1202 -783
- package/dist/module/webcomponent/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/cjs/_IframeSDK.3283252f.js.map +0 -7
- package/dist/cjs/_IframeSDK.652f4774.min.js +0 -1
- package/dist/cjs/_MyopHelpers.08d1cf5d.js.map +0 -7
- package/dist/cjs/_MyopHelpers.59521d8f.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.8fe7c9bf.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.e84be6ea.js.map +0 -7
- package/dist/cjs/_hostSDK.de2d767e.min.js +0 -1
- package/dist/cjs/_hostSDK.fa5b3ccf.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/uuid.ts", "../../../src/messages/BaseMessage.ts", "../../../src/messages/ExecuteScriptMessage.ts", "../../../src/messages/CustomRefMessage.ts", "../../../src/helpers/applyStylesheet.ts", "../../../src/helpers/iframeSkinUrlTokenizer.ts", "../../../src/helpers/classList.ts", "../../../src/helpers/configBuilder.ts", "../../../src/common/index.ts", "../../../src/helpers/CloudRepository.ts", "../../../src/helpers/exec.ts", "../../../src/helpers/cloudRepositoryHelpers.ts"],
|
|
4
|
-
"sourcesContent": ["//TODO : reuse from one place.\n// needs to be used in myop-sdk, myop-dashbaord, myop-server, myop-cli ..\n\nexport const uuidv4 = () => {\n return \"10000000-1000-4000-8000-100000000000\".replace(/[018]/g, c =>\n (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)\n );\n}\n\n// Convert UUID string to bytes\nexport const uuidToBytes = (uuid: string): Uint8Array => {\n return Uint8Array.from(\n uuid.replace(/-/g, '').match(/.{1,2}/g)!.map(byte => parseInt(byte, 16))\n );\n};\n\n// Convert bytes to UUID string\nexport const bytesToUuid = (bytes: Uint8Array): string => {\n const hex = [...bytes].map(b => b.toString(16).padStart(2, '0')).join('');\n return [\n hex.slice(0, 8),\n hex.slice(8, 12),\n hex.slice(12, 16),\n hex.slice(16, 20),\n hex.slice(20)\n ].join('-');\n};\n\n// Base64 URL-safe encode\nexport const base64UrlEncode = (bytes: Uint8Array): string => {\n const base64 = btoa(String.fromCharCode(...bytes));\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n};\n\n// Base64 URL-safe decode\nexport const base64UrlDecode = (str: string): Uint8Array => {\n let base64 = str.replace(/-/g, '+').replace(/_/g, '/');\n while (base64.length % 4) base64 += '=';\n const binary = atob(base64);\n return Uint8Array.from(binary, char => char.charCodeAt(0));\n};\n\n// Compress an array of UUIDs into a short URL-safe string\nexport const compressUUIDs = (uuids: string[]): string => {\n const allBytes = uuids.flatMap(uuid => Array.from(uuidToBytes(uuid)));\n return base64UrlEncode(new Uint8Array(allBytes));\n};\n\n// Decompress from URL-safe string back to an array of UUIDs\nexport const decompressUUIDs = (encoded: string): string[] => {\n const bytes = base64UrlDecode(encoded);\n if (bytes.length % 16 !== 0) throw new Error('Invalid input length');\n\n const uuids: string[] = [];\n for (let i = 0; i < bytes.length; i += 16) {\n uuids.push(bytesToUuid(bytes.slice(i, i + 16)));\n }\n return uuids;\n};\n", "import {MyopMessageKey} from \"../common/MyopMessages\";\nimport {uuidv4} from \"../utils/utils\";\nimport {IMyopComponent} from \"../host\";\nimport {IRefConfig} from \"../common\";\n\nexport class MessageDirection {\n static down = 'down' as const\n static up = 'up' as const\n}\n\nexport type MessageDirectionOption = 'up' | 'down';\n\nexport abstract class BaseMyopMessage<T = any> {\n id = uuidv4()\n\n static create<T, U extends new (...args: ConstructorParameters<U>) => T = typeof this>(\n this: U,\n ...args: ConstructorParameters<U>\n ): InstanceType<typeof this> {\n // @ts-ignore\n return new this(...args);\n }\n\n constructor() {\n //console.log('meesage id created', this.id, document.location.href);\n }\n\n myop = true\n\n abstract messageType: MyopMessageKey | string;\n\n content?: T\n\n // TODO : cant be optional \n source?: string\n destination?: string\n\n route?: string[]\n\n ref?: Ref\n\n direction?: MessageDirectionOption\n\n cleanable: boolean = false\n\n isTypeof(msg: BaseMyopMessage): boolean {\n return msg.messageType === this.messageType\n }\n}\n\nexport abstract class MyopElementMessage<T = any> extends BaseMyopMessage<T> {\n constructor(public ref: Ref) {\n super()\n }\n}\n\nexport abstract class MyopBindReplayMessage<T = any> extends BaseMyopMessage<T> {\n constructor(public replayToHandler?: string) {\n super();\n }\n}\n\nexport abstract class MyopBindMessage<T = any, R extends MyopBindReplayMessage = any> extends BaseMyopMessage<T> {\n\n public abstract replyMessageKey: MyopMessageKey;\n\n public handlerUniqueId = uuidv4()\n\n constructor(public handler: (message: R) => void) {\n super()\n }\n}\n\nexport class Ref {\n public myop = true;\n\n public __nonProxied?: Ref;\n\n static create(selector: string, refConfig?: IRefConfig, component?: IMyopComponent) {\n let _refConfig = refConfig;\n if (!_refConfig) {\n _refConfig = {\n id: '',\n name: '',\n description: '',\n selectorType: 'id-attribute',\n selector: selector,\n behavior: {\n type: 'code'\n }\n } as IRefConfig\n }\n return new Ref(_refConfig, component);\n }\n\n constructor(public refConfig: IRefConfig, public component?: IMyopComponent) {\n this.__nonProxied = {\n ...this,\n component: null // in order to be serializable\n }\n }\n}\n", "import {MyopBindMessage, MyopBindReplayMessage} from \"./BaseMessage\";\nimport {MyopMessageKey} from \"../common/MyopMessages\";\nimport {RootRef} from \"../common\";\nimport {makeSerializable} from \"../common/utils/serialization.ts\";\n\nconst ReplayMessageKey = 'ExecuteScriptReplyMessage'\n\nconst functionBodyRegex = /(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/;\nconst expressionBodyRegex = /\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/;\n\nexport const stripFunction = (content: string) => {\n let match = content.match(functionBodyRegex);\n if (match) {\n return match[1] || match[3];\n } else {\n let match = content.match(expressionBodyRegex);\n if (match)\n return match[1].trim();\n }\n}\n\nexport type scriptInputs = {\n [key: string]: string | number | boolean\n} | {};\n\nexport type scriptVars<T> = {\n send: (data: T) => void;\n // completeStream: () => void;\n rootRef: RootRef;\n makeSerializable: typeof makeSerializable\n}\n\nexport type extendedScriptVars<T, I> = {\n [K in keyof I]: I[K];\n} & scriptVars<T>\n\nexport class ExecuteScriptMessage<T = any, I extends scriptInputs = any> extends MyopBindMessage<string, ExecuteScriptReplyMessage<T>> {\n\n replyMessageKey: MyopMessageKey = ReplayMessageKey;\n messageType = 'ExecuteScriptMessage';\n script: string = ''\n\n static replierKey = 'send';\n static completeStreamKey = 'completeStream';\n\n constructor(script: (vars: extendedScriptVars<T, I>) => T, handler: (message: ExecuteScriptReplyMessage<T>) => void = () => {\n }, public scriptInputs?: I) {\n super(handler);\n this.script = script.toString();\n\n //TODO: can be remove\n this.content = script.toString()\n this.content = stripFunction(this.content);\n }\n}\n\nexport class ExecuteScriptReplyMessage<T = any> extends MyopBindReplayMessage<T> {\n\n messageType = ReplayMessageKey;\n\n constructor(public replayToHandler: string, public content: T) {\n super(replayToHandler);\n }\n}\n", "import {\n ExecuteScriptMessage,\n ExecuteScriptReplyMessage,\n extendedScriptVars,\n scriptInputs, stripFunction\n} from \"./ExecuteScriptMessage.ts\";\n\nexport type customRefScriptInputs = {\n elementId: string,\n ref?: HTMLElement,\n _script?: string,\n __scriptInputs?: Object\n};\n\nexport class CustomRefMessage<T = any, I extends scriptInputs = customRefScriptInputs> extends ExecuteScriptMessage<T, I & customRefScriptInputs> {\n\n constructor(script: (vars: extendedScriptVars<T, I & customRefScriptInputs>) => T,\n public scriptInputs: I & customRefScriptInputs,\n handler: (message: ExecuteScriptReplyMessage<T>) => void = () => {\n }) {\n\n //mock vars\n // let rootRef, elementId, _script, __scriptInputs;\n super(({rootRef, elementId, _script, __scriptInputs}) => {\n const refs = (rootRef.shadowRoot || rootRef.container).querySelectorAll(`[${'myop-id'}='${elementId}']`);\n if (refs.length) {\n // const ref = refs[0];\n\n //TODO : think about exposing \"refs\" and not only \"ref\"\n //for cases where the Ref has multiplate implementations\n\n // @ts-ignore\n __scriptInputs.ref = refs[0];\n\n const dynamicFunction = new Function(`return (${_script})(...arguments)`);\n return dynamicFunction(__scriptInputs);\n\n // @ts-ignore\n //return Function('ref', 'rootRef', ...Object.keys(__scriptInputs), _script!)(ref, rootRef, ...Object.values(__scriptInputs))\n }\n return null as T;\n }, handler);\n\n this.scriptInputs = {\n ...scriptInputs,\n //_script: stripFunction(script.toString()),\n _script: script.toString()\n };\n }\n}\n", "import type * as CSS from \"csstype\";\nimport {IMyopComponent} from \"../host\";\nimport {uuidv4} from \"../utils/utils.ts\";\nimport {ExecuteScriptMessage} from \"../messages\";\n\n// ignoring documentation\n/** @ignore */\nexport interface CSSProperties extends CSS.Properties<string | number> {\n}\n\nexport type StylesheetDefinition = { [key: string]: CSSProperties };\n\nexport const applyStylesheet = (component: IMyopComponent, stylesheet: StylesheetDefinition, css?: string) => {\n const tagId = `myop-css-${uuidv4()}`;\n component.send(new ExecuteScriptMessage(({rootRef, _stylesheet, _tagId, _css}) => {\n const styleTag = document.createElement('style');\n styleTag.type = 'text/css';\n\n // Build the CSS string from the styles object\n let cssString = _css;\n\n for (const selector in _stylesheet) {\n cssString += `${selector} { `;\n const properties = _stylesheet[selector];\n for (const property in properties) {\n cssString += `${property}: ${properties[property]}; `;\n }\n cssString += '} ';\n }\n\n // Set the CSS string as the content of the <style> element\n styleTag.appendChild(document.createTextNode(cssString));\n styleTag.id = _tagId;\n // Append the <style> element\n (rootRef.shadowRoot || rootRef.container).appendChild(styleTag);\n\n }, () => {\n }, {\n _stylesheet: stylesheet,\n _css : css ? css : '',\n _tagId: tagId\n }));\n\n return () => {\n component.send(new ExecuteScriptMessage(({rootRef, _tagId}) => {\n const element = (rootRef.shadowRoot || document).getElementById(_tagId);\n if (element) {\n element.remove();\n }\n }, () => {\n }, {\n _tagId: tagId\n }))\n }\n}\n\nexport const applyStylesheetLink = (component: IMyopComponent, link: string) => {\n const tagId = `myop-css-${uuidv4()}`;\n component.send(new ExecuteScriptMessage(({rootRef, _tagId, _link}) => {\n const linkElement = document.createElement('link');\n linkElement.id = _tagId;\n linkElement.rel = 'stylesheet';\n linkElement.href = _link;\n document.head.appendChild(linkElement);\n\n // Append the <style> element\n (rootRef.shadowRoot || rootRef.container).appendChild(linkElement);\n }, () => {\n }, {\n _link : link,\n _tagId: tagId\n }));\n\n return () => {\n component.send(new ExecuteScriptMessage(({rootRef, _tagId}) => {\n const element = (rootRef.shadowRoot || document).getElementById(_tagId);\n if (element) {\n element.remove();\n }\n }, () => {\n }, {\n _tagId: tagId\n }))\n }\n}\n", "import {IIframeLoaderConfig, ISkinConfig} from \"../common\";\n\nexport type TokenMap = Record<string, string| number>\n\nconst replaceTokens = (input: string, tokenMap: TokenMap): string => {\n // Create a regex pattern from the keys of the tokenMap\n const pattern = new RegExp(Object.keys(tokenMap).join('|'), 'g');\n\n // Replace tokens in the input string using the regex\n return input.replace(pattern, (matched) => {\n // Return the replacement value from the tokenMap\n return (tokenMap[matched] || matched).toString();\n });\n}\n\nexport const createIframeSkinByTokenizer = (selectedSkin: ISkinConfig, tokenMap: TokenMap) => {\n const typedSkinConfig = (selectedSkin.loader as IIframeLoaderConfig)\n if (typedSkinConfig.type !== 'IframeLoader') {\n throw new Error(`iframeSkinUrlTokenizer received skin with loader type \"${typedSkinConfig.type}\", currently only \"IframeLoader\" is supported`)\n }\n\n selectedSkin.loader = {\n ...selectedSkin.loader\n }\n\n selectedSkin.loader.url = replaceTokens(selectedSkin.loader.url, tokenMap);\n\n return selectedSkin;\n}\n\nexport const changeSkinUrlByTokenizer = (tokenMap: TokenMap) => {\n return async (selectedSkin: ISkinConfig) => {\n return createIframeSkinByTokenizer(selectedSkin, tokenMap);\n }\n}", "import {CustomRefMessage} from \"../messages\";\nimport {IMyopComponent} from \"../host\";\n\n// const space = ' ';\n// export const getClasses = async (connectedRef: Ref): Promise<string[]> => (await exec(actAs<HTMLDivElement>(connectedRef).classList)).value.split(space);\n// export const addClass = async (connectedRef: Ref, className: string) => {\n// const classes = await getClasses(connectedRef);\n// classes.includes(className) || classes.push(className);\n// // @ts-ignore\n// connectedRef.classList = classes.join(space);\n// }\n// export const removeClass = async (connectedRef: Ref, className: string,) => {\n// let classes = await getClasses(connectedRef);\n// // @ts-ignore\n// connectedRef.classList = classes.filter(c => c !== className).join(space);\n// }\n//\n//\n\nexport const addClass = (component: IMyopComponent, className: string, myopId: string) => {\n component.send(new CustomRefMessage(({ref, _className}) => {\n ref?.classList.add(_className);\n }, {\n elementId: myopId,\n _className: className\n }));\n}\n\nexport const removeClass = (component: IMyopComponent, className: string, myopId: string) => {\n component.send(new CustomRefMessage(({ref, _className}) => {\n ref?.classList.remove(_className);\n }, {\n elementId: myopId,\n _className: className\n }));\n}", "import {\n IComponentConfig,\n IComponentDefinitionConfig,\n IComponentInstanceConfig, IHTMLLoaderConfig, IRefConfig,\n ISkinLoaderConfig,\n ISkinSelectorConfig,\n IDedicatedSkinConfig, ISkinConfig\n} from \"../common\";\nimport {uuidv4} from \"../utils/utils.ts\";\n\nexport class SkinConfig implements ISkinConfig {\n _runTimeInstanceId = 'runtime-instance-id-' + uuidv4();\n _runTimeId = 'runtime-id-' + uuidv4();\n _runTimeName = 'runtime-name-' + uuidv4();\n\n static create = () => {\n return new SkinConfig();\n }\n\n id = this._runTimeId;\n name = this._runTimeName;\n description = '';\n loader = null as unknown as ISkinLoaderConfig;\n\n withLoader = (loader: ISkinLoaderConfig) => {\n this.loader = loader;\n return this;\n }\n\n withHTMLLoader = (loader: Omit<IHTMLLoaderConfig, 'type'>) => {\n loader.type = 'HTMLLoader';\n this.loader = loader as IHTMLLoaderConfig;\n return this;\n }\n\n build = () => {\n return this;\n }\n}\n\nexport class ComponentConfig implements IComponentConfig {\n _runTimeInstanceId = 'runtime-instance-id-' + uuidv4();\n _runTimeId = 'runtime-id-' + uuidv4();\n _runTimeName = 'runtime-name-' + uuidv4();\n\n static create = () => {\n return new ComponentConfig();\n }\n\n instance = {\n id: this._runTimeInstanceId,\n componentId: this._runTimeId,\n componentName: this._runTimeName,\n skinSelector: null as unknown as ISkinSelectorConfig\n } as IComponentInstanceConfig;\n\n name = this._runTimeName\n type = {\n id: this._runTimeId,\n name: this._runTimeName,\n description: '',\n props: [],\n refs: [],\n skins: [],\n defaultSkin: 0\n } as IComponentDefinitionConfig\n\n withInstance = (instance: IComponentInstanceConfig) => {\n this.instance = instance;\n return this;\n }\n\n withType = (type: IComponentDefinitionConfig) => {\n this.type = type;\n return this;\n }\n\n withName = (name: string) => {\n this.name = name;\n return this;\n }\n\n withDefaultSkin = (defaultSkin: ISkinConfig) => {\n this.type.skins.push(defaultSkin);\n this.type.defaultSkin = this.type.skins.length - 1;\n this.instance.skinSelector = {\n type: 'Dedicated',\n skin: {\n id: defaultSkin.id\n }\n } as IDedicatedSkinConfig\n\n return this;\n }\n\n withRef = (ref: IRefConfig) => {\n this.type.refs.push(ref);\n return this;\n }\n\n withBasicRef = (refSelector: string) => {\n const newBasicRef = {\n id: '',\n name: refSelector,\n description: '',\n selectorType: 'id-attribute',\n selector: refSelector,\n behavior: {\n type: 'code'\n }\n } as IRefConfig\n\n this.type.refs.push(newBasicRef);\n return this;\n }\n\n build = () => {\n return JSON.parse(JSON.stringify(this))\n }\n}\n", "import {MyopMessageKey} from \"./MyopMessages\";\n\nexport * from './MyopElementRef';\nexport * from './baseMessageHandler';\nexport * from './BaseMyopSDK';\n\nexport type CleanupHandler = () => void\n\nexport type Dictionary<T> = { [key: string]: T; };\n\n//export type SkinLoaderType = 'IframeLoader' | 'WebComponentLoader' | 'HTMLLoader' | string;\n\nexport const SkinLoaders = {\n \"IframeLoader\": \"IframeLoader\",\n \"WebComponentLoader\": \"WebComponentLoader\",\n \"HTMLLoader\": \"HTMLLoader\",\n \"MinimizedLoader\": \"MinimizedLoader\"\n} as const;\nexport type SkinLoaderType = keyof typeof SkinLoaders;\n\nexport type PropType = 'any' | 'string' | 'number' | string; // TODO : <\nexport type RefSelectorType = 'id-attribute' | 'css-selector' | 'xpath' | string;\n\nexport const LoaderFrameworks = {\n \"react\": \"react\",\n \"vue\": \"vue\",\n \"angular\": \"angular\",\n} as const\nexport type LoaderFrameworkType = keyof typeof LoaderFrameworks;\n\nexport interface IWebComponentLoaderConfig extends ISkinLoaderConfig {\n type: \"WebComponentLoader\";\n url: string,\n tag: string,\n framework?: LoaderFrameworkType\n}\n\nexport interface IIframeLoaderConfig extends ISkinLoaderConfig {\n type: \"IframeLoader\";\n url: string\n autoHeight: boolean\n height?: string\n width?: string\n}\n\nexport const ShadowRootModeType = {\n \"open\": \"open\",\n \"closed\": \"closed\",\n \"none\": \"none\",\n \"localFrame\": \"localFrame\"\n} as const;\n\n\nexport interface IHTMLLoaderConfig extends ISkinLoaderConfig {\n type: \"HTMLLoader\";\n HTML: string;\n //TODO: rename(rootMode/customElementMode) + db migration\n shadowRootMode?: keyof typeof ShadowRootModeType;\n autoHeight?: boolean;\n height?: string;\n width?: string;\n /**\n * When true, an inline-HTML (localFrame) component is rendered in a sandboxed,\n * cross-origin iframe with NO access to the host document (untrusted code).\n * The host render policy can also force this regardless of the config value.\n */\n isolation?: boolean;\n}\n\n/**\n * How a component is rendered on the host page, in ascending isolation:\n * - 'webComponent' \u2014 custom element on the host document (most privileged)\n * - 'iframe' \u2014 same-origin inline-HTML iframe (today's default)\n * - 'isolatedIframe' \u2014 sandboxed, cross-origin iframe (untrusted code)\n */\nexport type RenderMode = 'webComponent' | 'iframe' | 'isolatedIframe';\n\nexport interface RenderPolicyContext {\n componentDefinition: IComponentDefinitionConfig;\n skin: ISkinConfig;\n /** What the component asked for (marker \u21D2 'webComponent', config.isolation \u21D2 'isolatedIframe'). */\n requestedMode: RenderMode;\n /** Whether the HTML carries the `<!-- myop-web-component -->` marker. */\n isWebComponent: boolean;\n}\n\n/**\n * Host-supplied gate deciding how (or whether) a component renders. Return a\n * RenderMode to use, or `false` to block rendering entirely.\n */\nexport type RenderPolicy =\n (ctx: RenderPolicyContext) => RenderMode | false | Promise<RenderMode | false>;\n\n//for internal dashboard usage\nexport interface IMinimizedLoaderConfig extends ISkinLoaderConfig {\n type: \"MinimizedLoader\";\n}\n\ninterface DashboardObject {\n _temp_client_id?: string,\n}\n\ntype Extend<T, U> = T & U;\n\ntype ExtendRecursively<T, E> = {\n [K in keyof E]: E[K];\n} & {\n [K in keyof T]: T[K] extends object\n ? ExtendRecursively<T[K], E>\n : T[K];\n};\n\nexport type IDashboard<T> = ExtendRecursively<T, DashboardObject>;\n\nexport interface ISkinLoaderConfig {\n type: SkinLoaderType\n\n [key: string]: any; // Allows any additional properties\n}\n\nexport interface v2_IReleaseMetadata {\n environmentId: string;\n environmentIdentifier: string;\n releasedOn?: string;\n releasedBy?: string;\n}\n\nexport interface v2_IVariantConfig extends v2_IMyopStoredObject {\n loader: ISkinLoaderConfig\n componentId: string;\n\n releases?: v2_IReleaseMetadata[]\n}\n\nexport interface ISkinConfig {\n id: string\n name: string\n description: string\n loader: ISkinLoaderConfig\n createdBy?: string\n createdOn?: string\n}\n\nexport interface v2_ISkinConfig extends ISkinConfig {\n componentId: string\n}\n\nexport interface IMessagePropConfig extends IPropConfig {\n type: PropType\n messageType: MyopMessageKey\n}\n\nexport interface IBindMessagePropConfig extends IPropConfig {\n type: PropType\n messageType: MyopMessageKey\n}\n\nexport const PropMessageModes = {\n \"input\": \"input\",\n \"output\": \"output\"\n} as const;\n\nexport const PropConfigBehaviorTypes = {\n \"message\": \"message\",\n \"code\": \"code\"\n} as const;\n\nexport interface IPropMessageBehaviorParam {\n value: string\n}\n\nexport interface IPropBehavior {\n type: keyof typeof PropConfigBehaviorTypes\n}\n\nexport interface IPropCodeBehavior extends IPropBehavior {\n type: \"code\"\n remap?: string\n}\n\nexport interface IPropMessageBehavior extends IPropBehavior {\n type: \"message\"\n message: MyopMessageKey\n ref: string, //TODO make it id\n params: IPropMessageBehaviorParam[]\n mode: keyof typeof PropMessageModes\n}\n\nexport interface IPropConfig {\n id: string\n name: string\n description: string\n type: PropType\n behavior: IPropBehavior\n}\n\n\nexport class RefBehaviorType {\n static code = 'code' as const\n static component = 'component' as const\n}\n\nexport type IRefBehaviorType = 'code' | 'component';\n\nexport interface IRefBehavior {\n type: IRefBehaviorType\n}\n\nexport interface IComponentRefBehavior extends IRefBehavior {\n type: 'component'\n componentId: string\n\n /**\n * @deprecated\n * Property instance is deprecated and will be removed in future versions.\n */\n instance: IComponentInstanceConfig\n}\n\nexport interface ICodeRefBehavior extends IRefBehavior {\n type: 'code'\n}\n\nexport interface IRefConfig {\n id: string\n name: string\n description: string\n selectorType: RefSelectorType\n selector: string\n behavior: IRefBehavior\n}\n\n/**\n * Experience segment rule\n */\nexport interface IExperienceSegmentRule {\n property: string;\n operator: string;\n value: string;\n}\n\n/**\n * Experience A/B split version\n */\nexport interface IExperienceABSplitVersion {\n id: string;\n percentage: number;\n}\n\n/**\n * Experience A/B split configuration\n */\nexport interface IExperienceABSplit {\n versions: IExperienceABSplitVersion[];\n}\n\n/**\n * Experience segment configuration\n */\nexport interface IExperienceSegment {\n id: string;\n name: string;\n description: string;\n rules: IExperienceSegmentRule[];\n useAb: boolean;\n componentVariants: Record<string, string | Record<string, string>>;\n abSplit?: IExperienceABSplit;\n stickyProperties?: string[];\n}\n\n/**\n * Experience definition config (v2)\n */\nexport interface IExperienceDefinitionConfig extends v2_IMyopStoredObject {\n /** Selected component IDs */\n components: string[];\n /** Segment configurations */\n segments: IExperienceSegment[];\n /** Fallback variant per component */\n fallback: Record<string, string>;\n /** Tags */\n tags: string[];\n}\n\nexport interface IComponentDefinitionConfig {\n id: string;\n name: string,\n description: string,\n // props: Record<string, IPropConfig> //id - type\n // refs: Record<string, IRefConfig>,\n // skins: Record<string, ISkinConfig>\n props: IPropConfig[],\n refs: IRefConfig[],\n skins: ISkinConfig[],\n defaultSkin: number;\n\n //TODO : think about that\n //resolvedDefinitions?: IComponentDefinitionConfig[]\n //TODO : move to base class ( IStorableItem or so...)\n\n createdOn?: string\n createdBy?: string\n updatedBy?: string\n}\n\n\nexport interface v2_IBaseMyopObject {\n id: string,\n name: string,\n description: string,\n}\n\nexport interface v2_IMyopStoredObject extends v2_IBaseMyopObject {\n updatedOn?: string\n updatedBy?: string\n}\n\nexport interface ComponentAccess {\n visibility: 'private' | 'unlisted' | 'public';\n unlisted?: {\n slug: string;\n };\n marketplace?: {\n status: 'draft' | 'submitted' | 'claimed' | 'closed';\n description: string;\n contactEmail: string;\n deadline: string;\n };\n}\n\nexport interface v2_IComponentDefinitionConfig extends v2_IMyopStoredObject {\n variants_ids: string[],\n DTOs: v2_IDTO[],\n tags: string[],\n access?: ComponentAccess,\n\n //\n variants_names: string[],\n variants_data: {\n name: string;\n id: string\n description?: string\n updatedOn?: string\n updatedBy?: string\n has_releases?: boolean\n }[],\n\n preview_variant: v2_IVariantConfig;\n extra?: {\n firstVariant: v2_IVariantConfig; //when new component creates at the client\n }\n}\n\nexport interface v2_IDTO extends v2_IMyopStoredObject {\n data: object\n methodName: string\n}\n\nexport interface ISkinInstanceConfig {\n id: string\n}\n\nexport interface ISkinSelectorConfig {\n type: keyof typeof SkinSelectorTypes,\n //skins: ISkinInstanceConfig[]\n}\n\nexport const SegmentType = {\n \"FunctionResult\": \"FunctionResult\",\n} as const;\n\nexport interface ISegmentInstance {\n segmentId: string;\n skinSelector: ISkinSelectorConfig\n}\n\nexport interface ISegmentDefinition {\n id: string;\n type: keyof typeof SegmentType\n}\n\nexport interface IFunctionResultsSegment extends ISegmentDefinition {\n id: string;\n type: typeof SegmentType.FunctionResult\n name: string\n description: string\n function: string\n}\n\nexport const SkinSelectorTypes = {\n \"Segmented\": \"Segmented\",\n \"Dedicated\": \"Dedicated\",\n\n /**\n * This Selector Type is not yet supported but will be added in a future release.\n * Please check the documentation for updates.\n *\n * @type {string}\n */\n \"Default\": \"Default\"\n} as const;\n\n\n/**\n * This Skin Config Type is not yet supported but will be added in a future release.\n * Please check the documentation for updates.\n *\n * @type {IDefaultSkinConfig}\n */\nexport interface IDefaultSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Default,\n}\n\nexport interface ISegmentedSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Segmented,\n segments: ISegmentInstance[]\n}\n\nexport interface IDedicatedSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Dedicated,\n\n /**\n * @deprecated Use {@link skin} instead.\n * Property skins is deprecated and will be removed in future versions.\n * Please update your code to use {@link skin} for better compatibility.\n *\n * @type {string}\n */\n skins?: ISkinInstanceConfig[] // deprecated\n skin: ISkinInstanceConfig\n}\n\nexport interface IComponentInstanceConfig {\n id: string;\n componentId: string;\n\n //TODO :\n // RefID ? to support more than 1 component from the same type in composites ?\n\n //TODO : remove\n componentName: string; // << check\n\n skinSelector: ISkinSelectorConfig\n\n // storing the nested config for ref components\n nestedComponents?: IComponentInstanceConfig[]\n\n //only on GET?\n //TODO : think about that\n resolvedExperiences?: IExperience[]\n // will include instance and def config in order to render in production\n resolvedNestedComponents?: IComponentConfig[]\n}\n\nexport const ExperienceTypes = {\n \"Segment\": \"Segment\",\n \"Promo\": \"Promo\",\n \"AB\": \"AB\"\n} as const;\n\nexport interface IExperience {\n id: string\n name: string\n description: string\n type: keyof typeof ExperienceTypes\n experiences: IExperience[]\n //stickinessFactor\n //EndDate\n}\n\n// export interface IABExperienceGroup {\n// id: string\n// name: string\n// percentage: number\n// }\n\nexport interface IABExperience extends IExperience {\n type: typeof ExperienceTypes.AB\n // groups: IABExperienceGroup[]\n experiences: IExperience[]\n percentage: number\n}\n\nexport interface IDateRange {\n id: string\n start: Date\n end: Date\n timezone: string\n}\n\nexport interface ISegmentExperience extends IExperience {\n type: keyof typeof ExperienceTypes\n segment: ISegmentDefinition\n dateRange?: IDateRange\n}\n\nexport interface IUserFlowDefinition {\n id: string;\n name: string;\n description: string;\n components: IComponentInstanceConfig[];\n origins: string[],\n experiences: IExperience[]\n branch?: string\n}\n\nexport interface IComponentConfig {\n instance: IComponentInstanceConfig\n type: IComponentDefinitionConfig\n\n // TODO : verify uniqueness (dashboard & server)\n name: string\n}\n\ninterface IBranchable {\n branch?: string\n}\n\nexport interface IUserFlow extends Omit<IUserFlowDefinition, 'components'>, IBranchable {\n components: IComponentConfig[]\n}\n\nexport class RootRef {\n constructor(public container: HTMLElement, public shadowRoot?: ShadowRoot) {\n\n }\n\n getRootDiv = () => {\n return (this.shadowRoot || this.container).querySelector('div')\n }\n\n getRoot = () => {\n return (this.shadowRoot || this.container);\n }\n}\n", "import {\n IComponentConfig,\n IComponentDefinitionConfig,\n IComponentInstanceConfig,\n IDedicatedSkinConfig,\n IPropConfig,\n ISkinConfig,\n IUserFlow,\n PropConfigBehaviorTypes,\n v2_IVariantConfig\n} from \"../common\";\n\nconst convertV2VariantToComponentConfig = (config: v2_IVariantConfig): IComponentConfig => {\n return {\n instance: {\n id: 'auto',\n componentId: config.componentId,\n componentName: config.name,\n\n skinSelector: {\n type: 'Dedicated',\n skin: {\n id: 'skin_auto_v2_converted'\n }\n } as IDedicatedSkinConfig\n\n } as IComponentInstanceConfig,\n type: {\n id: config.id,\n name: config.name,\n description: config.description,\n props: [\n {\n id: 'in_auto_v2_converted',\n name: 'myop_init_interface',\n type: 'any',\n behavior: {\n type: PropConfigBehaviorTypes.code\n }\n } as IPropConfig,\n\n {\n id: 'out_auto_v2_converted',\n name: 'myop_cta_handler',\n type: 'any',\n behavior: {\n type: PropConfigBehaviorTypes.code\n }\n } as IPropConfig\n ],\n refs: [],\n skins: [\n {\n id: 'skin_auto_v2_converted',\n name: 'auto_v2_converted',\n description: '',\n //TODO : handle empty :\n // @ts-ignore\n loader: config.consume_variant[0].loader\n } as ISkinConfig\n ],\n defaultSkin: 0\n } as IComponentDefinitionConfig,\n name: config.name\n } as IComponentConfig;\n};\n\n/**\n * CloudRepository - Unified cloud data access layer for Myop components\n *\n * Supports both v2 (default) and v1 modes:\n * - v2: Uses /consume endpoint for fetching variants\n * - v1: Uses /flow endpoint for fetching user flows\n */\n// Use a global singleton to ensure only one CloudRepository.Main exists\n// even when the module is loaded multiple times by different bundlers\nconst GLOBAL_KEY = '__MYOP_CLOUD_REPOSITORY_MAIN__';\n\nconst getGlobalMain = (): CloudRepository | undefined => {\n if (typeof window !== 'undefined') {\n return (window as any)[GLOBAL_KEY];\n }\n if (typeof globalThis !== 'undefined') {\n return (globalThis as any)[GLOBAL_KEY];\n }\n return undefined;\n};\n\nconst setGlobalMain = (instance: CloudRepository) => {\n if (typeof window !== 'undefined') {\n (window as any)[GLOBAL_KEY] = instance;\n }\n if (typeof globalThis !== 'undefined') {\n (globalThis as any)[GLOBAL_KEY] = instance;\n }\n};\n\nexport class CloudRepository {\n private static _main: CloudRepository | null = null;\n\n static get Main(): CloudRepository {\n // Check if a global instance already exists (from another bundle)\n const globalMain = getGlobalMain();\n if (globalMain) {\n return globalMain;\n }\n\n // Create new instance if needed\n if (!CloudRepository._main) {\n CloudRepository._main = new CloudRepository();\n setGlobalMain(CloudRepository._main);\n }\n return CloudRepository._main;\n }\n\n // v2 cache - keyed by componentId:env:preview|live\n // Each Promise is tagged with a `resolved` property after settling (see fetchComponentV2).\n private variants: Record<string, Promise<IComponentConfig> & { resolved?: IComponentConfig }> = {};\n\n // Track which components were preloaded and with what params\n // Key: componentId, Value: { env, preview }\n private preloadedComponents: Record<string, { env: string; preview: boolean }> = {};\n\n // v1 cache\n private userFlows: Record<string, Promise<IUserFlow>> = {};\n\n private _defaultEnv = 'production';\n private _envExplicitlySet = false;\n private _staticMode = false;\n private _queryParams: Record<string, string> = {};\n\n constructor(private _baseUrl = 'https://cloud.myop.dev') {\n }\n\n /**\n * Enable static mode for self-hosted component registries.\n * In static mode, URLs are constructed as file paths instead of query params:\n * ${baseUrl}/components/${componentId}/${env}.json\n */\n enableStaticMode() {\n this._staticMode = true;\n }\n\n /**\n * Set query parameters to append to all fetch URLs (e.g. for CDN cache busting).\n * Example: `setQueryParams({ lastupdate: '11112026' })`\n */\n setQueryParams(params: Record<string, string>) {\n this._queryParams = params;\n }\n\n /**\n * Set the default environment for this CloudRepository instance\n */\n setEnvironment(env: string) {\n this._defaultEnv = env;\n this._envExplicitlySet = true;\n }\n\n /**\n * Get the current default environment\n */\n getDefaultEnvironment(): string {\n return this._defaultEnv;\n }\n\n // ============ V2 Methods (Default) ============\n\n /**\n * Check if a component is already cached/preloaded (v2)\n * If env and preview are not provided, checks if ANY version is preloaded\n */\n isPreloaded(componentId: string, env?: string, preview?: boolean): boolean {\n // If specific env/preview requested, check exact match\n if (env !== undefined || preview !== undefined) {\n const cacheKey = `${componentId}:${env || this._defaultEnv}:${preview ? 'preview' : 'live'}`;\n return cacheKey in this.variants;\n }\n // Otherwise check if any version was preloaded\n return componentId in this.preloadedComponents;\n }\n\n /**\n * Get the preloaded params for a component (if preloaded)\n * Returns undefined if not preloaded\n */\n getPreloadedParams(componentId: string): { env: string; preview: boolean } | undefined {\n return this.preloadedComponents[componentId];\n }\n\n /**\n * Resolve a component config: fetch it once, then serve it from this\n * repository's cache.\n *\n * This is the name to use. `fetchComponentV2` is the same method under its\n * versioned name and stays for backward compatibility \u2014 note that the\n * unversioned `fetchComponent` is a *deprecated v1* API and is NOT this.\n *\n * Completes the trio with {@link getResolvedConfig} (synchronous read of an\n * already-resolved config) and {@link hydrateComponent} (seed one you\n * already hold).\n *\n * Prefer the module-level `preloadComponents([id])` in app code; reach for\n * this when you need an isolated repository instance whose cache lifetime\n * you control \u2014 a server with its own TTL, for example.\n */\n async resolveComponent(componentId: string, env?: string, preview?: boolean): Promise<IComponentConfig> {\n return this.fetchComponentV2(componentId, env, preview);\n }\n\n /**\n * Fetch a v2 component config\n * If env/preview not specified and component was preloaded, uses preloaded params\n *\n * @see resolveComponent \u2014 the unversioned name for this method\n */\n async fetchComponentV2(componentId: string, environmentIdentifier?: string, preview?: boolean): Promise<IComponentConfig> {\n const { env, usePreview, cacheKey } = this.resolveParams(componentId, environmentIdentifier, preview);\n\n console.log('[CloudRepository] fetchComponentV2', {\n componentId: componentId.slice(0, 8) + '...',\n env,\n usePreview,\n cacheKey,\n cached: cacheKey in this.variants\n });\n\n if (!this.variants[cacheKey]) {\n // Track this as preloaded (first fetch counts as preload)\n if (!this.preloadedComponents[componentId]) {\n this.preloadedComponents[componentId] = { env, preview: usePreview };\n }\n\n // eslint-disable-next-line no-async-promise-executor\n this.variants[cacheKey] = new Promise(\n async (resolve, reject) => {\n try {\n let url: string;\n if (this._staticMode) {\n const file = usePreview ? 'preview' : env;\n url = `${this._baseUrl}/components/${componentId}/${file}.json`;\n const qs = new URLSearchParams(this._queryParams).toString();\n if (qs) url += `?${qs}`;\n } else {\n url = `${this._baseUrl}/consume?id=${componentId}&env=${env}`;\n if (usePreview) {\n url += '&preview=true';\n }\n }\n const res = await fetch(url);\n if (!res.ok) {\n reject(new Error(`Failed to load component \"${componentId}\" (${res.status}${this._staticMode ? ` from ${url}` : ''})`));\n return;\n }\n const json = await res.json();\n const variant = json.item;\n\n if (!variant) {\n reject(new Error(`Component \"${componentId}\" not found`));\n return;\n }\n\n if (!variant.consume_variant || !variant.consume_variant.length) {\n reject(new Error(`Component \"${componentId}\" has no implementation for environment \"${env}\"`));\n return;\n }\n\n const componentConfig = convertV2VariantToComponentConfig(variant);\n // Tag the Promise so getResolvedConfig can read it synchronously\n (this.variants[cacheKey] as any).resolved = componentConfig;\n resolve(componentConfig);\n } catch (e) {\n // Clear the cached rejected promise so the next call\n // makes a fresh request (e.g. after network recovery)\n delete this.variants[cacheKey];\n reject(e);\n }\n }\n );\n }\n\n return await this.variants[cacheKey];\n }\n\n /**\n * Synchronous version of fetchComponentV2 \u2014 returns the config only if\n * the fetch already completed, null otherwise.\n *\n * Uses the same `this.variants` cache that fetchComponentV2/preloadComponents\n * populate. Each cached Promise is tagged with a `.resolved` property when\n * it settles \u2014 this method just reads that property. No separate cache.\n *\n * Why this exists: React Native needs the config at render time to embed it\n * in the WebView HTML (can't await in useState). If preloadComponents ran\n * earlier and the fetch completed, this returns the result synchronously,\n * skipping the WEBVIEW_READY \u2192 fetch \u2192 inject round trip entirely.\n */\n getResolvedConfig(componentId: string, env?: string, preview?: boolean): IComponentConfig | null {\n const { cacheKey } = this.resolveParams(componentId, env, preview);\n return this.variants[cacheKey]?.resolved || null;\n }\n\n /**\n * Resolve which (env, preview) pair \u2014 and therefore which cache key \u2014 a call\n * for `componentId` refers to.\n *\n * Single source of truth for fetchComponentV2, getResolvedConfig and\n * hydrateComponent, so a hydrated config always lands on the key a later\n * fetch will look under.\n */\n private resolveParams(componentId: string, environmentIdentifier?: string, preview?: boolean) {\n // If no explicit env/preview and component was preloaded, use preloaded params\n const preloaded = this.preloadedComponents[componentId];\n const hasExplicitParams = environmentIdentifier !== undefined || preview !== undefined;\n\n let env: string;\n let usePreview: boolean;\n\n if (!hasExplicitParams && preloaded) {\n // Use preloaded params\n env = preloaded.env;\n usePreview = preloaded.preview;\n } else {\n // Use provided params or defaults\n env = environmentIdentifier || this._defaultEnv;\n // If preview explicitly true \u2192 true\n // If preview explicitly false \u2192 false\n // If preview undefined: env was specified (via param or setEnvironment) \u2192 false, otherwise \u2192 true\n const hasEffectiveEnv = environmentIdentifier || this._envExplicitlySet;\n usePreview = preview === true ? true : (preview === false ? false : !hasEffectiveEnv);\n }\n\n return { env, usePreview, cacheKey: `${componentId}:${env}:${usePreview ? 'preview' : 'live'}` };\n }\n\n /**\n * Seed an already-resolved component config into the cache, without any\n * network request.\n *\n * The counterpart to {@link fetchComponentV2}: use it when the config was\n * resolved somewhere else \u2014 most often on a server, then embedded in the\n * page \u2014 so the browser can render the component with no round trip.\n *\n * After hydrating, `fetchComponentV2`, `getResolvedConfig` and `isPreloaded`\n * all answer for this component from memory.\n *\n * Pass the same `env` / `preview` the config was resolved with; the defaults\n * match what a plain `fetchComponentV2(componentId)` would have used.\n */\n hydrateComponent(componentId: string, config: IComponentConfig, env?: string, preview?: boolean): void {\n const { env: resolvedEnv, usePreview, cacheKey } = this.resolveParams(componentId, env, preview);\n\n const promise = Promise.resolve(config) as Promise<IComponentConfig> & { resolved?: IComponentConfig };\n // Tag it the same way fetchComponentV2 does, so getResolvedConfig can\n // read it synchronously.\n promise.resolved = config;\n\n this.variants[cacheKey] = promise;\n this.preloadedComponents[componentId] = { env: resolvedEnv, preview: usePreview };\n }\n\n // ============ V1 Methods (Legacy) ============\n\n /**\n * Fetch a v1 component from a flow\n */\n async fetchComponentV1(componentId: string, flowId?: string) {\n if (flowId) {\n const flow = await this.fetchFlow(flowId);\n return flow.components.find(c => c.type.id === componentId);\n } else {\n const flow = await this.fetchAutoFlow(componentId);\n return flow.components[0];\n }\n }\n\n async fetchAutoFlow(componentId: string) {\n if (!this.userFlows[componentId]) {\n // eslint-disable-next-line no-async-promise-executor\n this.userFlows[componentId] = new Promise(\n async (resolve, reject) => {\n try {\n const res = await fetch(\n `${this._baseUrl}/flow?id=${componentId}&auto=true`\n );\n const json = await res.json();\n resolve(json.item);\n } catch (e) {\n delete this.userFlows[componentId];\n reject(e);\n }\n }\n );\n }\n\n return await this.userFlows[componentId];\n }\n\n async fetchFlow(flowId: string) {\n if (!this.userFlows[flowId]) {\n // eslint-disable-next-line no-async-promise-executor\n this.userFlows[flowId] = new Promise(\n async (resolve, reject) => {\n try {\n const res = await fetch(\n `${this._baseUrl}/flow?id=${flowId}&resolve=components`\n );\n const json = await res.json();\n resolve(json.item);\n } catch (e) {\n delete this.userFlows[flowId];\n reject(e);\n }\n }\n );\n }\n\n return await this.userFlows[flowId];\n }\n\n // ============ Backward Compatibility ============\n\n /**\n * @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly\n * Defaults to v1 behavior for backward compatibility with existing code\n */\n async fetchComponent(componentId: string, flowId?: string) {\n return this.fetchComponentV1(componentId, flowId);\n }\n}\n\n/**\n * @deprecated Use CloudRepository instead\n */\nexport const v2_CloudRepository = CloudRepository;\n", "export const exec = async (getter: any) => {\n return await getter()\n}\n", "import { CloudRepository } from \"./CloudRepository\";\nimport { IComponentConfig } from \"../common\";\n\nlet _cloudRepository = CloudRepository.Main;\n\nexport const getCloudRepository = () => _cloudRepository;\n\nexport const isPreloaded = (componentId: string, env?: string, preview?: boolean): boolean => {\n return _cloudRepository.isPreloaded(componentId, env, preview);\n};\n\nexport const getPreloadedParams = (componentId: string) => {\n return _cloudRepository.getPreloadedParams(componentId);\n};\n\nexport const enableLocalDev = () => {\n _cloudRepository = new CloudRepository(\"http://localhost:9292\");\n};\n\nexport const setCloudRepositoryUrl = (url: string) => {\n _cloudRepository = new CloudRepository(url);\n};\n\n/**\n * Configure the SDK to fetch components from a self-hosted static registry (S3, CDN, etc.)\n * instead of the Myop cloud. Components are served as static JSON files:\n * `${cdnUrl}/components/${componentId}/${environment}.json`\n */\nexport const enableSelfHosted = (cdnUrl: string, queryParams?: Record<string, string>) => {\n _cloudRepository = new CloudRepository(cdnUrl);\n _cloudRepository.enableStaticMode();\n if (queryParams) {\n _cloudRepository.setQueryParams(queryParams);\n }\n};\n\nexport const setCloudRepository = (repository: CloudRepository) => {\n _cloudRepository = repository;\n};\n\nexport const setEnvironment = (env: string) => {\n _cloudRepository.setEnvironment(env);\n};\n\nexport const getResolvedConfig = (componentId: string, env?: string, preview?: boolean) => {\n return _cloudRepository.getResolvedConfig(componentId, env, preview);\n};\n\nexport const preloadComponents = async (ids: string[], env?: string, preview?: boolean) => {\n return Promise.allSettled(\n ids.map((id) => _cloudRepository.fetchComponentV2(id, env, preview)),\n );\n};\n\n/**\n * Seed already-resolved component configs into the SDK cache, with no network\n * request. The counterpart to {@link preloadComponents}.\n *\n * Use it when the configs were resolved somewhere else \u2014 typically on a server\n * and embedded in the page \u2014 so the component renders with zero round trips:\n *\n * ```ts\n * // server: const configs = { [id]: await new CloudRepository().fetchComponentV2(id) }\n * // client:\n * hydrateComponents(configs);\n * // <MyopComponent componentId={id} /> now renders without fetching\n * ```\n *\n * Pass the same `env` / `preview` the configs were resolved with; the defaults\n * match what a plain `preloadComponents([id])` would have used.\n */\nexport const hydrateComponents = (\n configs: Record<string, IComponentConfig>,\n env?: string,\n preview?: boolean,\n) => {\n for (const [id, config] of Object.entries(configs)) {\n _cloudRepository.hydrateComponent(id, config, env, preview);\n }\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,SAAS,MAAM;AACxB,SAAO,uCAAuC;AAAA,IAAQ;AAAA,IAAU,QAC3D,CAAC,IAAI,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,SAAS,EAAE;AAAA,EAClF;AACJ;;;ACKO,IAAe,kBAAf,MAAwC;AAAA,EAW3C,cAAc;AAVd,8BAAK,OAAO;AAcZ,gCAAO;AAIP;AAGA;AAAA;AACA;AAEA;AAEA;AAEA;AAEA,qCAAqB;AAAA,EAlBrB;AAAA,EAVA,OAAO,UAEA,MACsB;AAEzB,WAAO,IAAI,KAAK,GAAG,IAAI;AAAA,EAC3B;AAAA,EAwBA,SAAS,KAA+B;AACpC,WAAO,IAAI,gBAAgB,KAAK;AAAA,EACpC;AACJ;AAcO,IAAe,kBAAf,cAAuF,gBAAmB;AAAA,EAM7G,YAAmB,SAA+B;AAC9C,UAAM;AADS;AAFnB,wBAAO,mBAAkB,OAAO;AAAA,EAIhC;AACJ;;;AClEA,IAAM,mBAAmB;AAEzB,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB;AAErB,IAAM,gBAAgB,CAAC,YAAoB;AAC9C,MAAI,QAAQ,QAAQ,MAAM,iBAAiB;AAC3C,MAAI,OAAO;AACP,WAAO,MAAM,CAAC,KAAK,MAAM,CAAC;AAAA,EAC9B,OAAO;AACH,QAAIA,SAAQ,QAAQ,MAAM,m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B,iBAAiB,IAAI,KAAK,OAAO,CAAC;AAAA,EACvE;AACJ;AAmBO,IAAM,oBAAoB,CAC7B,SACA,KACA,YACC;AACD,aAAW,CAAC,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAChD,qBAAiB,iBAAiB,IAAI,QAAQ,KAAK,OAAO;AAAA,EAC9D;AACJ;",
|
|
6
|
-
"names": ["match", "scriptInputs", "scriptInputs"]
|
|
3
|
+
"sources": ["../../../src/utils/uuid.ts", "../../../src/messages/BaseMessage.ts", "../../../src/messages/ExecuteScriptMessage.ts", "../../../src/messages/CustomRefMessage.ts", "../../../src/helpers/applyStylesheet.ts", "../../../src/helpers/iframeSkinUrlTokenizer.ts", "../../../src/helpers/classList.ts", "../../../src/helpers/configBuilder.ts", "../../../src/common/index.ts", "../../../src/helpers/deliveryStore.ts", "../../../src/helpers/CloudRepository.ts", "../../../src/helpers/exec.ts", "../../../src/helpers/cloudRepositoryHelpers.ts"],
|
|
4
|
+
"sourcesContent": ["//TODO : reuse from one place.\n// needs to be used in myop-sdk, myop-dashbaord, myop-server, myop-cli ..\n\nexport const uuidv4 = () => {\n return \"10000000-1000-4000-8000-100000000000\".replace(/[018]/g, c =>\n (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)\n );\n}\n\n// Convert UUID string to bytes\nexport const uuidToBytes = (uuid: string): Uint8Array => {\n return Uint8Array.from(\n uuid.replace(/-/g, '').match(/.{1,2}/g)!.map(byte => parseInt(byte, 16))\n );\n};\n\n// Convert bytes to UUID string\nexport const bytesToUuid = (bytes: Uint8Array): string => {\n const hex = [...bytes].map(b => b.toString(16).padStart(2, '0')).join('');\n return [\n hex.slice(0, 8),\n hex.slice(8, 12),\n hex.slice(12, 16),\n hex.slice(16, 20),\n hex.slice(20)\n ].join('-');\n};\n\n// Base64 URL-safe encode\nexport const base64UrlEncode = (bytes: Uint8Array): string => {\n const base64 = btoa(String.fromCharCode(...bytes));\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n};\n\n// Base64 URL-safe decode\nexport const base64UrlDecode = (str: string): Uint8Array => {\n let base64 = str.replace(/-/g, '+').replace(/_/g, '/');\n while (base64.length % 4) base64 += '=';\n const binary = atob(base64);\n return Uint8Array.from(binary, char => char.charCodeAt(0));\n};\n\n// Compress an array of UUIDs into a short URL-safe string\nexport const compressUUIDs = (uuids: string[]): string => {\n const allBytes = uuids.flatMap(uuid => Array.from(uuidToBytes(uuid)));\n return base64UrlEncode(new Uint8Array(allBytes));\n};\n\n// Decompress from URL-safe string back to an array of UUIDs\nexport const decompressUUIDs = (encoded: string): string[] => {\n const bytes = base64UrlDecode(encoded);\n if (bytes.length % 16 !== 0) throw new Error('Invalid input length');\n\n const uuids: string[] = [];\n for (let i = 0; i < bytes.length; i += 16) {\n uuids.push(bytesToUuid(bytes.slice(i, i + 16)));\n }\n return uuids;\n};\n", "import {MyopMessageKey} from \"../common/MyopMessages\";\nimport {uuidv4} from \"../utils/utils\";\nimport {IMyopComponent} from \"../host\";\nimport {IRefConfig} from \"../common\";\n\nexport class MessageDirection {\n static down = 'down' as const\n static up = 'up' as const\n}\n\nexport type MessageDirectionOption = 'up' | 'down';\n\nexport abstract class BaseMyopMessage<T = any> {\n id = uuidv4()\n\n static create<T, U extends new (...args: ConstructorParameters<U>) => T = typeof this>(\n this: U,\n ...args: ConstructorParameters<U>\n ): InstanceType<typeof this> {\n // @ts-ignore\n return new this(...args);\n }\n\n constructor() {\n //console.log('meesage id created', this.id, document.location.href);\n }\n\n myop = true\n\n abstract messageType: MyopMessageKey | string;\n\n content?: T\n\n // TODO : cant be optional \n source?: string\n destination?: string\n\n route?: string[]\n\n ref?: Ref\n\n direction?: MessageDirectionOption\n\n cleanable: boolean = false\n\n isTypeof(msg: BaseMyopMessage): boolean {\n return msg.messageType === this.messageType\n }\n}\n\nexport abstract class MyopElementMessage<T = any> extends BaseMyopMessage<T> {\n constructor(public ref: Ref) {\n super()\n }\n}\n\nexport abstract class MyopBindReplayMessage<T = any> extends BaseMyopMessage<T> {\n constructor(public replayToHandler?: string) {\n super();\n }\n}\n\nexport abstract class MyopBindMessage<T = any, R extends MyopBindReplayMessage = any> extends BaseMyopMessage<T> {\n\n public abstract replyMessageKey: MyopMessageKey;\n\n public handlerUniqueId = uuidv4()\n\n constructor(public handler: (message: R) => void) {\n super()\n }\n}\n\nexport class Ref {\n public myop = true;\n\n public __nonProxied?: Ref;\n\n static create(selector: string, refConfig?: IRefConfig, component?: IMyopComponent) {\n let _refConfig = refConfig;\n if (!_refConfig) {\n _refConfig = {\n id: '',\n name: '',\n description: '',\n selectorType: 'id-attribute',\n selector: selector,\n behavior: {\n type: 'code'\n }\n } as IRefConfig\n }\n return new Ref(_refConfig, component);\n }\n\n constructor(public refConfig: IRefConfig, public component?: IMyopComponent) {\n this.__nonProxied = {\n ...this,\n component: null // in order to be serializable\n }\n }\n}\n", "import {MyopBindMessage, MyopBindReplayMessage} from \"./BaseMessage\";\nimport {MyopMessageKey} from \"../common/MyopMessages\";\nimport {RootRef} from \"../common\";\nimport {makeSerializable} from \"../common/utils/serialization.ts\";\n\nconst ReplayMessageKey = 'ExecuteScriptReplyMessage'\n\nconst functionBodyRegex = /(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/;\nconst expressionBodyRegex = /\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/;\n\nexport const stripFunction = (content: string) => {\n let match = content.match(functionBodyRegex);\n if (match) {\n return match[1] || match[3];\n } else {\n let match = content.match(expressionBodyRegex);\n if (match)\n return match[1].trim();\n }\n}\n\nexport type scriptInputs = {\n [key: string]: string | number | boolean\n} | {};\n\nexport type scriptVars<T> = {\n send: (data: T) => void;\n // completeStream: () => void;\n rootRef: RootRef;\n makeSerializable: typeof makeSerializable\n}\n\nexport type extendedScriptVars<T, I> = {\n [K in keyof I]: I[K];\n} & scriptVars<T>\n\nexport class ExecuteScriptMessage<T = any, I extends scriptInputs = any> extends MyopBindMessage<string, ExecuteScriptReplyMessage<T>> {\n\n replyMessageKey: MyopMessageKey = ReplayMessageKey;\n messageType = 'ExecuteScriptMessage';\n script: string = ''\n\n static replierKey = 'send';\n static completeStreamKey = 'completeStream';\n\n constructor(script: (vars: extendedScriptVars<T, I>) => T, handler: (message: ExecuteScriptReplyMessage<T>) => void = () => {\n }, public scriptInputs?: I) {\n super(handler);\n this.script = script.toString();\n\n //TODO: can be remove\n this.content = script.toString()\n this.content = stripFunction(this.content);\n }\n}\n\nexport class ExecuteScriptReplyMessage<T = any> extends MyopBindReplayMessage<T> {\n\n messageType = ReplayMessageKey;\n\n constructor(public replayToHandler: string, public content: T) {\n super(replayToHandler);\n }\n}\n", "import {\n ExecuteScriptMessage,\n ExecuteScriptReplyMessage,\n extendedScriptVars,\n scriptInputs, stripFunction\n} from \"./ExecuteScriptMessage.ts\";\n\nexport type customRefScriptInputs = {\n elementId: string,\n ref?: HTMLElement,\n _script?: string,\n __scriptInputs?: Object\n};\n\nexport class CustomRefMessage<T = any, I extends scriptInputs = customRefScriptInputs> extends ExecuteScriptMessage<T, I & customRefScriptInputs> {\n\n constructor(script: (vars: extendedScriptVars<T, I & customRefScriptInputs>) => T,\n public scriptInputs: I & customRefScriptInputs,\n handler: (message: ExecuteScriptReplyMessage<T>) => void = () => {\n }) {\n\n //mock vars\n // let rootRef, elementId, _script, __scriptInputs;\n super(({rootRef, elementId, _script, __scriptInputs}) => {\n const refs = (rootRef.shadowRoot || rootRef.container).querySelectorAll(`[${'myop-id'}='${elementId}']`);\n if (refs.length) {\n // const ref = refs[0];\n\n //TODO : think about exposing \"refs\" and not only \"ref\"\n //for cases where the Ref has multiplate implementations\n\n // @ts-ignore\n __scriptInputs.ref = refs[0];\n\n const dynamicFunction = new Function(`return (${_script})(...arguments)`);\n return dynamicFunction(__scriptInputs);\n\n // @ts-ignore\n //return Function('ref', 'rootRef', ...Object.keys(__scriptInputs), _script!)(ref, rootRef, ...Object.values(__scriptInputs))\n }\n return null as T;\n }, handler);\n\n this.scriptInputs = {\n ...scriptInputs,\n //_script: stripFunction(script.toString()),\n _script: script.toString()\n };\n }\n}\n", "import type * as CSS from \"csstype\";\nimport {IMyopComponent} from \"../host\";\nimport {uuidv4} from \"../utils/utils.ts\";\nimport {ExecuteScriptMessage} from \"../messages\";\n\n// ignoring documentation\n/** @ignore */\nexport interface CSSProperties extends CSS.Properties<string | number> {\n}\n\nexport type StylesheetDefinition = { [key: string]: CSSProperties };\n\nexport const applyStylesheet = (component: IMyopComponent, stylesheet: StylesheetDefinition, css?: string) => {\n const tagId = `myop-css-${uuidv4()}`;\n component.send(new ExecuteScriptMessage(({rootRef, _stylesheet, _tagId, _css}) => {\n const styleTag = document.createElement('style');\n styleTag.type = 'text/css';\n\n // Build the CSS string from the styles object\n let cssString = _css;\n\n for (const selector in _stylesheet) {\n cssString += `${selector} { `;\n const properties = _stylesheet[selector];\n for (const property in properties) {\n cssString += `${property}: ${properties[property]}; `;\n }\n cssString += '} ';\n }\n\n // Set the CSS string as the content of the <style> element\n styleTag.appendChild(document.createTextNode(cssString));\n styleTag.id = _tagId;\n // Append the <style> element\n (rootRef.shadowRoot || rootRef.container).appendChild(styleTag);\n\n }, () => {\n }, {\n _stylesheet: stylesheet,\n _css : css ? css : '',\n _tagId: tagId\n }));\n\n return () => {\n component.send(new ExecuteScriptMessage(({rootRef, _tagId}) => {\n const element = (rootRef.shadowRoot || document).getElementById(_tagId);\n if (element) {\n element.remove();\n }\n }, () => {\n }, {\n _tagId: tagId\n }))\n }\n}\n\nexport const applyStylesheetLink = (component: IMyopComponent, link: string) => {\n const tagId = `myop-css-${uuidv4()}`;\n component.send(new ExecuteScriptMessage(({rootRef, _tagId, _link}) => {\n const linkElement = document.createElement('link');\n linkElement.id = _tagId;\n linkElement.rel = 'stylesheet';\n linkElement.href = _link;\n document.head.appendChild(linkElement);\n\n // Append the <style> element\n (rootRef.shadowRoot || rootRef.container).appendChild(linkElement);\n }, () => {\n }, {\n _link : link,\n _tagId: tagId\n }));\n\n return () => {\n component.send(new ExecuteScriptMessage(({rootRef, _tagId}) => {\n const element = (rootRef.shadowRoot || document).getElementById(_tagId);\n if (element) {\n element.remove();\n }\n }, () => {\n }, {\n _tagId: tagId\n }))\n }\n}\n", "import {IIframeLoaderConfig, ISkinConfig} from \"../common\";\n\nexport type TokenMap = Record<string, string| number>\n\nconst replaceTokens = (input: string, tokenMap: TokenMap): string => {\n // Create a regex pattern from the keys of the tokenMap\n const pattern = new RegExp(Object.keys(tokenMap).join('|'), 'g');\n\n // Replace tokens in the input string using the regex\n return input.replace(pattern, (matched) => {\n // Return the replacement value from the tokenMap\n return (tokenMap[matched] || matched).toString();\n });\n}\n\nexport const createIframeSkinByTokenizer = (selectedSkin: ISkinConfig, tokenMap: TokenMap) => {\n const typedSkinConfig = (selectedSkin.loader as IIframeLoaderConfig)\n if (typedSkinConfig.type !== 'IframeLoader') {\n throw new Error(`iframeSkinUrlTokenizer received skin with loader type \"${typedSkinConfig.type}\", currently only \"IframeLoader\" is supported`)\n }\n\n selectedSkin.loader = {\n ...selectedSkin.loader\n }\n\n selectedSkin.loader.url = replaceTokens(selectedSkin.loader.url, tokenMap);\n\n return selectedSkin;\n}\n\nexport const changeSkinUrlByTokenizer = (tokenMap: TokenMap) => {\n return async (selectedSkin: ISkinConfig) => {\n return createIframeSkinByTokenizer(selectedSkin, tokenMap);\n }\n}", "import {CustomRefMessage} from \"../messages\";\nimport {IMyopComponent} from \"../host\";\n\n// const space = ' ';\n// export const getClasses = async (connectedRef: Ref): Promise<string[]> => (await exec(actAs<HTMLDivElement>(connectedRef).classList)).value.split(space);\n// export const addClass = async (connectedRef: Ref, className: string) => {\n// const classes = await getClasses(connectedRef);\n// classes.includes(className) || classes.push(className);\n// // @ts-ignore\n// connectedRef.classList = classes.join(space);\n// }\n// export const removeClass = async (connectedRef: Ref, className: string,) => {\n// let classes = await getClasses(connectedRef);\n// // @ts-ignore\n// connectedRef.classList = classes.filter(c => c !== className).join(space);\n// }\n//\n//\n\nexport const addClass = (component: IMyopComponent, className: string, myopId: string) => {\n component.send(new CustomRefMessage(({ref, _className}) => {\n ref?.classList.add(_className);\n }, {\n elementId: myopId,\n _className: className\n }));\n}\n\nexport const removeClass = (component: IMyopComponent, className: string, myopId: string) => {\n component.send(new CustomRefMessage(({ref, _className}) => {\n ref?.classList.remove(_className);\n }, {\n elementId: myopId,\n _className: className\n }));\n}", "import {\n IComponentConfig,\n IComponentDefinitionConfig,\n IComponentInstanceConfig, IHTMLLoaderConfig, IRefConfig,\n ISkinLoaderConfig,\n ISkinSelectorConfig,\n IDedicatedSkinConfig, ISkinConfig\n} from \"../common\";\nimport {uuidv4} from \"../utils/utils.ts\";\n\nexport class SkinConfig implements ISkinConfig {\n _runTimeInstanceId = 'runtime-instance-id-' + uuidv4();\n _runTimeId = 'runtime-id-' + uuidv4();\n _runTimeName = 'runtime-name-' + uuidv4();\n\n static create = () => {\n return new SkinConfig();\n }\n\n id = this._runTimeId;\n name = this._runTimeName;\n description = '';\n loader = null as unknown as ISkinLoaderConfig;\n\n withLoader = (loader: ISkinLoaderConfig) => {\n this.loader = loader;\n return this;\n }\n\n withHTMLLoader = (loader: Omit<IHTMLLoaderConfig, 'type'>) => {\n loader.type = 'HTMLLoader';\n this.loader = loader as IHTMLLoaderConfig;\n return this;\n }\n\n build = () => {\n return this;\n }\n}\n\nexport class ComponentConfig implements IComponentConfig {\n _runTimeInstanceId = 'runtime-instance-id-' + uuidv4();\n _runTimeId = 'runtime-id-' + uuidv4();\n _runTimeName = 'runtime-name-' + uuidv4();\n\n static create = () => {\n return new ComponentConfig();\n }\n\n instance = {\n id: this._runTimeInstanceId,\n componentId: this._runTimeId,\n componentName: this._runTimeName,\n skinSelector: null as unknown as ISkinSelectorConfig\n } as IComponentInstanceConfig;\n\n name = this._runTimeName\n type = {\n id: this._runTimeId,\n name: this._runTimeName,\n description: '',\n props: [],\n refs: [],\n skins: [],\n defaultSkin: 0\n } as IComponentDefinitionConfig\n\n withInstance = (instance: IComponentInstanceConfig) => {\n this.instance = instance;\n return this;\n }\n\n withType = (type: IComponentDefinitionConfig) => {\n this.type = type;\n return this;\n }\n\n withName = (name: string) => {\n this.name = name;\n return this;\n }\n\n withDefaultSkin = (defaultSkin: ISkinConfig) => {\n this.type.skins.push(defaultSkin);\n this.type.defaultSkin = this.type.skins.length - 1;\n this.instance.skinSelector = {\n type: 'Dedicated',\n skin: {\n id: defaultSkin.id\n }\n } as IDedicatedSkinConfig\n\n return this;\n }\n\n withRef = (ref: IRefConfig) => {\n this.type.refs.push(ref);\n return this;\n }\n\n withBasicRef = (refSelector: string) => {\n const newBasicRef = {\n id: '',\n name: refSelector,\n description: '',\n selectorType: 'id-attribute',\n selector: refSelector,\n behavior: {\n type: 'code'\n }\n } as IRefConfig\n\n this.type.refs.push(newBasicRef);\n return this;\n }\n\n build = () => {\n return JSON.parse(JSON.stringify(this))\n }\n}\n", "import {MyopMessageKey} from \"./MyopMessages\";\n\nexport * from './MyopElementRef';\nexport * from './baseMessageHandler';\nexport * from './BaseMyopSDK';\n\nexport type CleanupHandler = () => void\n\nexport type Dictionary<T> = { [key: string]: T; };\n\n//export type SkinLoaderType = 'IframeLoader' | 'WebComponentLoader' | 'HTMLLoader' | string;\n\nexport const SkinLoaders = {\n \"IframeLoader\": \"IframeLoader\",\n \"WebComponentLoader\": \"WebComponentLoader\",\n \"HTMLLoader\": \"HTMLLoader\",\n \"MinimizedLoader\": \"MinimizedLoader\"\n} as const;\nexport type SkinLoaderType = keyof typeof SkinLoaders;\n\nexport type PropType = 'any' | 'string' | 'number' | string; // TODO : <\nexport type RefSelectorType = 'id-attribute' | 'css-selector' | 'xpath' | string;\n\nexport const LoaderFrameworks = {\n \"react\": \"react\",\n \"vue\": \"vue\",\n \"angular\": \"angular\",\n} as const\nexport type LoaderFrameworkType = keyof typeof LoaderFrameworks;\n\nexport interface IWebComponentLoaderConfig extends ISkinLoaderConfig {\n type: \"WebComponentLoader\";\n url: string,\n tag: string,\n framework?: LoaderFrameworkType\n}\n\nexport interface IIframeLoaderConfig extends ISkinLoaderConfig {\n type: \"IframeLoader\";\n url: string\n autoHeight: boolean\n height?: string\n width?: string\n}\n\nexport const ShadowRootModeType = {\n \"open\": \"open\",\n \"closed\": \"closed\",\n \"none\": \"none\",\n \"localFrame\": \"localFrame\"\n} as const;\n\n\nexport interface IHTMLLoaderConfig extends ISkinLoaderConfig {\n type: \"HTMLLoader\";\n HTML: string;\n //TODO: rename(rootMode/customElementMode) + db migration\n shadowRootMode?: keyof typeof ShadowRootModeType;\n autoHeight?: boolean;\n height?: string;\n width?: string;\n /**\n * When true, an inline-HTML (localFrame) component is rendered in a sandboxed,\n * cross-origin iframe with NO access to the host document (untrusted code).\n * The host render policy can also force this regardless of the config value.\n */\n isolation?: boolean;\n}\n\n/**\n * How a component is rendered on the host page, in ascending isolation:\n * - 'webComponent' \u2014 custom element on the host document (most privileged)\n * - 'iframe' \u2014 same-origin inline-HTML iframe (today's default)\n * - 'isolatedIframe' \u2014 sandboxed, cross-origin iframe (untrusted code)\n */\nexport type RenderMode = 'webComponent' | 'iframe' | 'isolatedIframe';\n\nexport interface RenderPolicyContext {\n componentDefinition: IComponentDefinitionConfig;\n skin: ISkinConfig;\n /** What the component asked for (marker \u21D2 'webComponent', config.isolation \u21D2 'isolatedIframe'). */\n requestedMode: RenderMode;\n /** Whether the HTML carries the `<!-- myop-web-component -->` marker. */\n isWebComponent: boolean;\n}\n\n/**\n * Host-supplied gate deciding how (or whether) a component renders. Return a\n * RenderMode to use, or `false` to block rendering entirely.\n */\nexport type RenderPolicy =\n (ctx: RenderPolicyContext) => RenderMode | false | Promise<RenderMode | false>;\n\n//for internal dashboard usage\nexport interface IMinimizedLoaderConfig extends ISkinLoaderConfig {\n type: \"MinimizedLoader\";\n}\n\ninterface DashboardObject {\n _temp_client_id?: string,\n}\n\ntype Extend<T, U> = T & U;\n\ntype ExtendRecursively<T, E> = {\n [K in keyof E]: E[K];\n} & {\n [K in keyof T]: T[K] extends object\n ? ExtendRecursively<T[K], E>\n : T[K];\n};\n\nexport type IDashboard<T> = ExtendRecursively<T, DashboardObject>;\n\nexport interface ISkinLoaderConfig {\n type: SkinLoaderType\n\n [key: string]: any; // Allows any additional properties\n}\n\nexport interface v2_IReleaseMetadata {\n environmentId: string;\n environmentIdentifier: string;\n releasedOn?: string;\n releasedBy?: string;\n}\n\nexport interface v2_IVariantConfig extends v2_IMyopStoredObject {\n loader: ISkinLoaderConfig\n componentId: string;\n\n releases?: v2_IReleaseMetadata[]\n}\n\nexport interface ISkinConfig {\n id: string\n name: string\n description: string\n loader: ISkinLoaderConfig\n createdBy?: string\n createdOn?: string\n}\n\nexport interface v2_ISkinConfig extends ISkinConfig {\n componentId: string\n}\n\nexport interface IMessagePropConfig extends IPropConfig {\n type: PropType\n messageType: MyopMessageKey\n}\n\nexport interface IBindMessagePropConfig extends IPropConfig {\n type: PropType\n messageType: MyopMessageKey\n}\n\nexport const PropMessageModes = {\n \"input\": \"input\",\n \"output\": \"output\"\n} as const;\n\nexport const PropConfigBehaviorTypes = {\n \"message\": \"message\",\n \"code\": \"code\"\n} as const;\n\nexport interface IPropMessageBehaviorParam {\n value: string\n}\n\nexport interface IPropBehavior {\n type: keyof typeof PropConfigBehaviorTypes\n}\n\nexport interface IPropCodeBehavior extends IPropBehavior {\n type: \"code\"\n remap?: string\n}\n\nexport interface IPropMessageBehavior extends IPropBehavior {\n type: \"message\"\n message: MyopMessageKey\n ref: string, //TODO make it id\n params: IPropMessageBehaviorParam[]\n mode: keyof typeof PropMessageModes\n}\n\nexport interface IPropConfig {\n id: string\n name: string\n description: string\n type: PropType\n behavior: IPropBehavior\n}\n\n\nexport class RefBehaviorType {\n static code = 'code' as const\n static component = 'component' as const\n}\n\nexport type IRefBehaviorType = 'code' | 'component';\n\nexport interface IRefBehavior {\n type: IRefBehaviorType\n}\n\nexport interface IComponentRefBehavior extends IRefBehavior {\n type: 'component'\n componentId: string\n\n /**\n * @deprecated\n * Property instance is deprecated and will be removed in future versions.\n */\n instance: IComponentInstanceConfig\n}\n\nexport interface ICodeRefBehavior extends IRefBehavior {\n type: 'code'\n}\n\nexport interface IRefConfig {\n id: string\n name: string\n description: string\n selectorType: RefSelectorType\n selector: string\n behavior: IRefBehavior\n}\n\n/**\n * Experience segment rule\n */\nexport interface IExperienceSegmentRule {\n property: string;\n operator: string;\n value: string;\n}\n\n/**\n * Experience A/B split version\n */\nexport interface IExperienceABSplitVersion {\n id: string;\n percentage: number;\n}\n\n/**\n * Experience A/B split configuration\n */\nexport interface IExperienceABSplit {\n versions: IExperienceABSplitVersion[];\n}\n\n/**\n * Experience segment configuration\n */\nexport interface IExperienceSegment {\n id: string;\n name: string;\n description: string;\n rules: IExperienceSegmentRule[];\n useAb: boolean;\n componentVariants: Record<string, string | Record<string, string>>;\n abSplit?: IExperienceABSplit;\n stickyProperties?: string[];\n}\n\n/**\n * Experience definition config (v2)\n */\nexport interface IExperienceDefinitionConfig extends v2_IMyopStoredObject {\n /** Selected component IDs */\n components: string[];\n /** Segment configurations */\n segments: IExperienceSegment[];\n /** Fallback variant per component */\n fallback: Record<string, string>;\n /** Tags */\n tags: string[];\n}\n\nexport interface IComponentDefinitionConfig {\n id: string;\n name: string,\n description: string,\n // props: Record<string, IPropConfig> //id - type\n // refs: Record<string, IRefConfig>,\n // skins: Record<string, ISkinConfig>\n props: IPropConfig[],\n refs: IRefConfig[],\n skins: ISkinConfig[],\n defaultSkin: number;\n\n //TODO : think about that\n //resolvedDefinitions?: IComponentDefinitionConfig[]\n //TODO : move to base class ( IStorableItem or so...)\n\n createdOn?: string\n createdBy?: string\n updatedBy?: string\n}\n\n\nexport interface v2_IBaseMyopObject {\n id: string,\n name: string,\n description: string,\n}\n\nexport interface v2_IMyopStoredObject extends v2_IBaseMyopObject {\n updatedOn?: string\n updatedBy?: string\n}\n\nexport interface ComponentAccess {\n visibility: 'private' | 'unlisted' | 'public';\n unlisted?: {\n slug: string;\n };\n marketplace?: {\n status: 'draft' | 'submitted' | 'claimed' | 'closed';\n description: string;\n contactEmail: string;\n deadline: string;\n };\n}\n\nexport interface v2_IComponentDefinitionConfig extends v2_IMyopStoredObject {\n variants_ids: string[],\n DTOs: v2_IDTO[],\n tags: string[],\n access?: ComponentAccess,\n\n //\n variants_names: string[],\n variants_data: {\n name: string;\n id: string\n description?: string\n updatedOn?: string\n updatedBy?: string\n has_releases?: boolean\n }[],\n\n preview_variant: v2_IVariantConfig;\n extra?: {\n firstVariant: v2_IVariantConfig; //when new component creates at the client\n }\n}\n\nexport interface v2_IDTO extends v2_IMyopStoredObject {\n data: object\n methodName: string\n}\n\nexport interface ISkinInstanceConfig {\n id: string\n}\n\nexport interface ISkinSelectorConfig {\n type: keyof typeof SkinSelectorTypes,\n //skins: ISkinInstanceConfig[]\n}\n\nexport const SegmentType = {\n \"FunctionResult\": \"FunctionResult\",\n} as const;\n\nexport interface ISegmentInstance {\n segmentId: string;\n skinSelector: ISkinSelectorConfig\n}\n\nexport interface ISegmentDefinition {\n id: string;\n type: keyof typeof SegmentType\n}\n\nexport interface IFunctionResultsSegment extends ISegmentDefinition {\n id: string;\n type: typeof SegmentType.FunctionResult\n name: string\n description: string\n function: string\n}\n\nexport const SkinSelectorTypes = {\n \"Segmented\": \"Segmented\",\n \"Dedicated\": \"Dedicated\",\n\n /**\n * This Selector Type is not yet supported but will be added in a future release.\n * Please check the documentation for updates.\n *\n * @type {string}\n */\n \"Default\": \"Default\"\n} as const;\n\n\n/**\n * This Skin Config Type is not yet supported but will be added in a future release.\n * Please check the documentation for updates.\n *\n * @type {IDefaultSkinConfig}\n */\nexport interface IDefaultSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Default,\n}\n\nexport interface ISegmentedSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Segmented,\n segments: ISegmentInstance[]\n}\n\nexport interface IDedicatedSkinConfig extends ISkinSelectorConfig {\n type: typeof SkinSelectorTypes.Dedicated,\n\n /**\n * @deprecated Use {@link skin} instead.\n * Property skins is deprecated and will be removed in future versions.\n * Please update your code to use {@link skin} for better compatibility.\n *\n * @type {string}\n */\n skins?: ISkinInstanceConfig[] // deprecated\n skin: ISkinInstanceConfig\n}\n\nexport interface IComponentInstanceConfig {\n id: string;\n componentId: string;\n\n //TODO :\n // RefID ? to support more than 1 component from the same type in composites ?\n\n //TODO : remove\n componentName: string; // << check\n\n skinSelector: ISkinSelectorConfig\n\n // storing the nested config for ref components\n nestedComponents?: IComponentInstanceConfig[]\n\n //only on GET?\n //TODO : think about that\n resolvedExperiences?: IExperience[]\n // will include instance and def config in order to render in production\n resolvedNestedComponents?: IComponentConfig[]\n}\n\nexport const ExperienceTypes = {\n \"Segment\": \"Segment\",\n \"Promo\": \"Promo\",\n \"AB\": \"AB\"\n} as const;\n\nexport interface IExperience {\n id: string\n name: string\n description: string\n type: keyof typeof ExperienceTypes\n experiences: IExperience[]\n //stickinessFactor\n //EndDate\n}\n\n// export interface IABExperienceGroup {\n// id: string\n// name: string\n// percentage: number\n// }\n\nexport interface IABExperience extends IExperience {\n type: typeof ExperienceTypes.AB\n // groups: IABExperienceGroup[]\n experiences: IExperience[]\n percentage: number\n}\n\nexport interface IDateRange {\n id: string\n start: Date\n end: Date\n timezone: string\n}\n\nexport interface ISegmentExperience extends IExperience {\n type: keyof typeof ExperienceTypes\n segment: ISegmentDefinition\n dateRange?: IDateRange\n}\n\nexport interface IUserFlowDefinition {\n id: string;\n name: string;\n description: string;\n components: IComponentInstanceConfig[];\n origins: string[],\n experiences: IExperience[]\n branch?: string\n}\n\nexport interface IComponentConfig {\n instance: IComponentInstanceConfig\n type: IComponentDefinitionConfig\n\n // TODO : verify uniqueness (dashboard & server)\n name: string\n}\n\ninterface IBranchable {\n branch?: string\n}\n\nexport interface IUserFlow extends Omit<IUserFlowDefinition, 'components'>, IBranchable {\n components: IComponentConfig[]\n}\n\nexport class RootRef {\n constructor(public container: HTMLElement, public shadowRoot?: ShadowRoot) {\n\n }\n\n getRootDiv = () => {\n return (this.shadowRoot || this.container).querySelector('div')\n }\n\n getRoot = () => {\n return (this.shadowRoot || this.container);\n }\n}\n", "/**\n * The client window: what a returning visitor does NOT ask for.\n *\n * A component the browser already holds, still inside its freshness window, is rendered\n * with no network at all. Once the window ends the browser does not re-download it either\n * \u2014 it sends back the version it holds and is usually told \"unchanged\" in a few hundred\n * bytes.\n *\n * THE WINDOW IS THE SERVER'S, NOT OURS. It comes from the response: `s-maxage` is the\n * freshness the server promised, and `Age` is how much of it a CDN already spent before\n * the bytes reached us. The window we may keep is therefore `s-maxage - Age`, never\n * `s-maxage` \u2014 otherwise a copy that sat at the edge for 55 of its 60 seconds would be\n * held for another 60 here, and a publish would take twice as long to be seen as promised.\n * This is the single easiest thing to get wrong in a client cache, and it is invisible in\n * testing because it only shows up as \"sometimes stale\".\n *\n * IndexedDB, not localStorage: components run to hundreds of KB, localStorage caps around\n * 5 MB and blocks the main thread. Every path degrades to the network \u2014 a browser in\n * private mode, with storage disabled or over quota, must render the page, not fail it.\n */\n\nconst DB_NAME = 'myop-delivery';\nconst STORE = 'components';\nconst DB_VERSION = 1;\n\nexport interface StoredEntry {\n key: string;\n /** the resolved component config, exactly as the network path produces it */\n config: any;\n /** the server's version token for these bytes: `<rev>~<opt>` */\n tag: string | null;\n /** when this browser stored it */\n storedAt: number;\n /** how long it may be used without asking, in ms (already Age-adjusted) */\n windowMs: number;\n /** which host produced it \u2014 a key from another host is never reused */\n host: string;\n /** wire size of the response it came from, so stats can say what the window saved */\n bytes?: number;\n}\n\nlet dbPromise: Promise<IDBDatabase | null> | null = null;\n\nfunction openDb(): Promise<IDBDatabase | null> {\n if (dbPromise) return dbPromise;\n dbPromise = new Promise((resolve) => {\n try {\n if (typeof indexedDB === 'undefined') return resolve(null);\n const req = indexedDB.open(DB_NAME, DB_VERSION);\n req.onupgradeneeded = () => {\n const db = req.result;\n if (!db.objectStoreNames.contains(STORE)) db.createObjectStore(STORE, { keyPath: 'key' });\n };\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => resolve(null);\n // A blocked upgrade must not hang the page load.\n req.onblocked = () => resolve(null);\n } catch {\n resolve(null);\n }\n });\n return dbPromise;\n}\n\nfunction tx<T>(mode: IDBTransactionMode, fn: (store: IDBObjectStore) => IDBRequest): Promise<T | null> {\n return openDb().then(db => new Promise<T | null>((resolve) => {\n if (!db) return resolve(null);\n try {\n const t = db.transaction(STORE, mode);\n const req = fn(t.objectStore(STORE));\n req.onsuccess = () => resolve(req.result as T);\n req.onerror = () => resolve(null);\n t.onabort = () => resolve(null);\n } catch {\n resolve(null);\n }\n }));\n}\n\n/**\n * A SYNCHRONOUS shadow of what we hold, for code that runs before IndexedDB can answer.\n *\n * The page's HTML can start the component request while the JS bundle is still downloading\n * \u2014 but only if it knows, at parse time, whether a request is needed at all and which one.\n * IndexedDB is async, so an inline script cannot ask it. localStorage can be read\n * synchronously, so each entry mirrors two tiny facts here: the version tag and when the\n * window ends. Nothing else \u2014 the component itself stays in IndexedDB where it belongs.\n *\n * Without this the preload hint is actively harmful: it downloads the whole component\n * every time, including on the visits where the stored copy was going to answer for free.\n * Measured on myop.dev before it existed \u2014 98 KB fetched, then discarded, on every reload.\n */\nconst HINT_PREFIX = 'myop.d.';\n\nfunction writeHint(key: string, tag: string | null, expiresAt: number) {\n try { localStorage.setItem(HINT_PREFIX + key, JSON.stringify({ t: tag, e: expiresAt })); }\n catch { /* private mode, quota, disabled \u2014 the hint is an optimisation, never a requirement */ }\n}\n\nfunction clearHint(key: string) {\n try { localStorage.removeItem(HINT_PREFIX + key); } catch { /* as above */ }\n}\n\n/** A memory layer in front of storage: a second component on the same page must not wait on IO. */\nconst memory = new Map<string, StoredEntry>();\n\nexport const deliveryStore = {\n key(host: string, componentId: string, env: string, preview: boolean, opt: string) {\n // The HOST is part of the key. Two stacks can serve the same component with\n // different freshness, and entries from one must never be read as the other's.\n return `${host}|${componentId}|${env}|${preview ? 'preview' : 'live'}|${opt || 'raw'}`;\n },\n\n async get(key: string): Promise<StoredEntry | null> {\n const m = memory.get(key);\n if (m) return m;\n const e = await tx<StoredEntry>('readonly', s => s.get(key));\n if (e) {\n memory.set(key, e);\n // SELF-HEAL. The two stores can disagree: an entry written before the hint\n // existed, a browser that evicted localStorage but not IndexedDB, a user who\n // cleared one. A missing hint makes the preload fall back to the FULL component\n // while the SDK, which can see IndexedDB, only wants the version check -- two\n // requests where there should be one. Seen in the wild on the first load after\n // the hint shipped. Rewriting it here costs nothing and closes the gap for good.\n writeHint(key, e.tag, e.storedAt + e.windowMs);\n }\n return e;\n },\n\n async put(entry: StoredEntry): Promise<void> {\n memory.set(entry.key, entry);\n writeHint(entry.key, entry.tag, entry.storedAt + entry.windowMs);\n await tx('readwrite', s => s.put(entry));\n },\n\n async drop(key: string): Promise<void> {\n memory.delete(key);\n clearHint(key);\n await tx('readwrite', s => s.delete(key));\n },\n\n /** Still usable without asking the server? */\n fresh(e: StoredEntry | null): boolean {\n return !!e && (Date.now() - e.storedAt) < e.windowMs;\n },\n\n /**\n * The window this response licenses: the server's freshness minus what a CDN already\n * spent. Returns 0 when the server said nothing about caching, which means \"do not\n * hold this\" \u2014 the safe reading, and what production sends today.\n */\n windowFrom(headers: Headers): number {\n const cc = headers.get('cache-control') || '';\n if (/no-store|no-cache/i.test(cc)) return 0;\n const m = /s-maxage\\s*=\\s*(\\d+)/i.exec(cc) || /max-age\\s*=\\s*(\\d+)/i.exec(cc);\n if (!m) return 0;\n const total = Number(m[1]);\n const age = Number(headers.get('age') || 0);\n return Math.max(0, (total - (isNaN(age) ? 0 : age))) * 1000;\n },\n\n /** For tests and for `refresh()`: forget everything this browser holds. */\n async clear(): Promise<void> {\n memory.clear();\n try {\n for (let i = localStorage.length - 1; i >= 0; i--) {\n const k = localStorage.key(i);\n if (k && k.startsWith(HINT_PREFIX)) localStorage.removeItem(k);\n }\n } catch { /* nothing to clean up if it was never writable */ }\n await tx('readwrite', s => s.clear());\n },\n};\n", "import {\n IComponentConfig,\n IComponentDefinitionConfig,\n IComponentInstanceConfig,\n IDedicatedSkinConfig,\n IPropConfig,\n ISkinConfig,\n IUserFlow,\n PropConfigBehaviorTypes,\n v2_IVariantConfig\n} from \"../common\";\nimport { deliveryStore } from \"./deliveryStore\";\n\nconst convertV2VariantToComponentConfig = (config: v2_IVariantConfig): IComponentConfig => {\n return {\n instance: {\n id: 'auto',\n componentId: config.componentId,\n componentName: config.name,\n\n skinSelector: {\n type: 'Dedicated',\n skin: {\n id: 'skin_auto_v2_converted'\n }\n } as IDedicatedSkinConfig\n\n } as IComponentInstanceConfig,\n type: {\n id: config.id,\n name: config.name,\n description: config.description,\n props: [\n {\n id: 'in_auto_v2_converted',\n name: 'myop_init_interface',\n type: 'any',\n behavior: {\n type: PropConfigBehaviorTypes.code\n }\n } as IPropConfig,\n\n {\n id: 'out_auto_v2_converted',\n name: 'myop_cta_handler',\n type: 'any',\n behavior: {\n type: PropConfigBehaviorTypes.code\n }\n } as IPropConfig\n ],\n refs: [],\n skins: [\n {\n id: 'skin_auto_v2_converted',\n name: 'auto_v2_converted',\n description: '',\n //TODO : handle empty :\n // @ts-ignore\n loader: config.consume_variant[0].loader\n } as ISkinConfig\n ],\n defaultSkin: 0\n } as IComponentDefinitionConfig,\n name: config.name\n } as IComponentConfig;\n};\n\n/**\n * CloudRepository - Unified cloud data access layer for Myop components\n *\n * Supports both v2 (default) and v1 modes:\n * - v2: Uses /consume endpoint for fetching variants\n * - v1: Uses /flow endpoint for fetching user flows\n */\n// Use a global singleton to ensure only one CloudRepository.Main exists\n// even when the module is loaded multiple times by different bundlers\nconst GLOBAL_KEY = '__MYOP_CLOUD_REPOSITORY_MAIN__';\n\nconst getGlobalMain = (): CloudRepository | undefined => {\n if (typeof window !== 'undefined') {\n return (window as any)[GLOBAL_KEY];\n }\n if (typeof globalThis !== 'undefined') {\n return (globalThis as any)[GLOBAL_KEY];\n }\n return undefined;\n};\n\nconst setGlobalMain = (instance: CloudRepository) => {\n if (typeof window !== 'undefined') {\n (window as any)[GLOBAL_KEY] = instance;\n }\n if (typeof globalThis !== 'undefined') {\n (globalThis as any)[GLOBAL_KEY] = instance;\n }\n};\n\nexport class CloudRepository {\n private static _main: CloudRepository | null = null;\n\n static get Main(): CloudRepository {\n // Check if a global instance already exists (from another bundle)\n const globalMain = getGlobalMain();\n if (globalMain) {\n return globalMain;\n }\n\n // Create new instance if needed\n if (!CloudRepository._main) {\n CloudRepository._main = new CloudRepository();\n setGlobalMain(CloudRepository._main);\n }\n return CloudRepository._main;\n }\n\n // v2 cache - keyed by componentId:env:preview|live\n // Each Promise is tagged with a `resolved` property after settling (see fetchComponentV2).\n private variants: Record<string, Promise<IComponentConfig> & { resolved?: IComponentConfig }> = {};\n\n // Track which components were preloaded and with what params\n // Key: componentId, Value: { env, preview }\n private preloadedComponents: Record<string, { env: string; preview: boolean }> = {};\n\n // v1 cache\n private userFlows: Record<string, Promise<IUserFlow>> = {};\n\n private _defaultEnv = 'production';\n private _envExplicitlySet = false;\n private _staticMode = false;\n private _queryParams: Record<string, string> = {};\n\n constructor(private _baseUrl = 'https://cloud.myop.dev') {\n }\n\n /**\n * How big the component we are NOT re-downloading is. Deliberately measured from what\n * we hold rather than from Content-Length: once a response is compressed the header is\n * not readable cross-origin, so reading it there reported 0 every single time.\n */\n private static sizeOfHeld(e: any): number {\n try { return (e?.config?.type?.skins?.[0]?.loader?.HTML || '').length; } catch { return 0; }\n }\n\n /** The host every request goes to unless delivery() moved it. Never changes. */\n private static readonly DEFAULT_HOST = 'https://cloud.myop.dev';\n\n /**\n * Opt-in delivery settings, set by myop.delivery(). Off means: this file behaves\n * EXACTLY as it did before \u2014 same host, same URL, same everything.\n */\n private _delivery: { minify: boolean; host: string | null; cache: boolean } =\n { minify: false, host: null, cache: false };\n\n /**\n * What actually happened, for myop.delivery.stats(). `fellBack` is the number that\n * matters: it is how you find out the lane is unhealthy without waiting for a\n * bug report, because a fallback is INVISIBLE to the page (it still renders).\n */\n private _deliveryStats = {\n requests: 0, viaDelivery: 0, fellBack: 0, lastError: null as string | null,\n /** where the last loads were answered from \u2014 the number the client window exists to move */\n fromMemory: 0, fromStorage: 0, fromNetwork: 0,\n /** re-checks after the window ended, and how many were answered \"nothing changed\" */\n revalidations: 0, unchanged: 0, bytesSaved: 0,\n };\n\n /**\n * Turn on the opt-in delivery path.\n *\n * Opting in IS choosing the delivery stack: this points /consume at `host` (a second,\n * complete stack reading the same data) and asks for the minified artifact. Leave this\n * uncalled and nothing about the SDK changes.\n *\n * Deliberately mutates THIS instance rather than constructing a new repository:\n * CloudRepository.Main is a global singleton shared across bundles (see getGlobalMain),\n * so a second instance would be ignored by every component already using the first.\n */\n setDelivery(opts: { minify?: boolean; host?: string | null; cache?: boolean } = {}) {\n if (opts.minify !== undefined) this._delivery.minify = !!opts.minify;\n if (opts.host !== undefined) this._delivery.host = opts.host;\n if (opts.cache !== undefined) this._delivery.cache = !!opts.cache;\n }\n\n deliveryStats() {\n return { ...this._deliveryStats, host: this._delivery.host ?? CloudRepository.DEFAULT_HOST,\n minify: this._delivery.minify, cache: this._delivery.cache };\n }\n\n /**\n * Forget what this browser holds, so the next load asks the server.\n * `refresh()` with no ids drops everything; the counterpart to the window for the case\n * where a change has to be visible on THIS load \u2014 right after someone publishes.\n */\n async refreshDelivery(): Promise<void> {\n await deliveryStore.clear();\n }\n\n /**\n * Local serves waiting to be reported: componentId -> {env, count}.\n *\n * THE MEASUREMENT PROBLEM THIS SOLVES. The better this cache works, the more usage\n * vanishes: a visitor inside their freshness window renders the page with no request,\n * so neither the server nor the CDN can see them. Left alone, a successful rollout\n * looks in the ledger exactly like customers leaving.\n *\n * So local serves are counted here and reported afterwards, batched, on a path that\n * never blocks rendering: flushed when the page is hidden (keepalive, so it survives\n * the tab closing) and opportunistically whenever the SDK is talking to the server\n * anyway. Nothing is sent while the page is loading, which is the point of the window.\n */\n private _localServes = new Map<string, {env: string; count: number}>();\n private _flushBound = false;\n\n private noteLocalServe(componentId: string, env: string) {\n const cur = this._localServes.get(componentId);\n if (cur) cur.count++;\n else this._localServes.set(componentId, {env, count: 1});\n this.bindFlush();\n }\n\n /** Report on page-hide, which is the only event that reliably fires on mobile. */\n private bindFlush() {\n if (this._flushBound || typeof document === 'undefined') return;\n this._flushBound = true;\n const onHide = () => { if (document.visibilityState === 'hidden') this.flushLocalServes(); };\n document.addEventListener('visibilitychange', onHide);\n window.addEventListener('pagehide', () => this.flushLocalServes());\n }\n\n /**\n * Send what we have. `keepalive` is what makes this work at page-hide: the request\n * outlives the document. Failure is ignored \u2014 a lost usage report must never be\n * visible to a visitor, and the next page load will report its own.\n */\n flushLocalServes(): void {\n if (!this._localServes.size) return;\n const batch = [...this._localServes.entries()]\n .map(([id, v]) => `${id}:${v.env}:${v.count}`).join(',');\n this._localServes.clear();\n try {\n const url = `${this.deliveryHost()}/clientUsage?b=${encodeURIComponent(batch)}`;\n fetch(url, {keepalive: true, mode: 'cors', credentials: 'omit'}).catch(() => {});\n } catch { /* never the visitor's problem */ }\n }\n\n /** Where /consume should be fetched from right now. */\n private deliveryHost(): string {\n return this._delivery.host || this._baseUrl;\n }\n\n /**\n * Fetch a delivery URL with ONE fallback to the default host.\n *\n * The fallback is the kill switch: break or disable the lane and every client drifts\n * back to cloud.myop.dev on its own, with no customer deploy. It must therefore be\n * genuinely silent to the page and genuinely LOUD in stats() \u2014 a fallback that nobody\n * counts is an outage nobody notices.\n *\n * Only transport failures and 5xx fall back. A 404 is an answer: the component really\n * is missing, and retrying elsewhere would only hide it.\n */\n private async deliveryFetch(path: string): Promise<Response> {\n // We are about to use the network anyway: a good moment to hand over whatever the\n // window served offline, rather than waiting for the page to be closed.\n if (this._localServes.size) this.flushLocalServes();\n const host = this.deliveryHost();\n const primary = `${host}${path}`;\n this._deliveryStats.requests++;\n const usingLane = host !== this._baseUrl;\n try {\n const res = await fetch(primary);\n if (res.ok || res.status < 500 || !usingLane) {\n if (usingLane && res.ok) this._deliveryStats.viaDelivery++;\n return res;\n }\n this._deliveryStats.lastError = `HTTP ${res.status} from ${host}`;\n } catch (e: any) {\n if (!usingLane) throw e;\n this._deliveryStats.lastError = String(e?.message ?? e);\n }\n this._deliveryStats.fellBack++;\n console.warn(`[myop] delivery host failed (${this._deliveryStats.lastError}) \u2014 falling back to ${this._baseUrl}`);\n return await fetch(`${this._baseUrl}${path}`);\n }\n\n /**\n * Enable static mode for self-hosted component registries.\n * In static mode, URLs are constructed as file paths instead of query params:\n * ${baseUrl}/components/${componentId}/${env}.json\n */\n enableStaticMode() {\n this._staticMode = true;\n }\n\n /**\n * Set query parameters to append to all fetch URLs (e.g. for CDN cache busting).\n * Example: `setQueryParams({ lastupdate: '11112026' })`\n */\n setQueryParams(params: Record<string, string>) {\n this._queryParams = params;\n }\n\n /**\n * Set the default environment for this CloudRepository instance\n */\n setEnvironment(env: string) {\n this._defaultEnv = env;\n this._envExplicitlySet = true;\n }\n\n /**\n * Get the current default environment\n */\n getDefaultEnvironment(): string {\n return this._defaultEnv;\n }\n\n // ============ V2 Methods (Default) ============\n\n /**\n * Check if a component is already cached/preloaded (v2)\n * If env and preview are not provided, checks if ANY version is preloaded\n */\n isPreloaded(componentId: string, env?: string, preview?: boolean): boolean {\n // If specific env/preview requested, check exact match\n if (env !== undefined || preview !== undefined) {\n const cacheKey = `${componentId}:${env || this._defaultEnv}:${preview ? 'preview' : 'live'}`;\n return cacheKey in this.variants;\n }\n // Otherwise check if any version was preloaded\n return componentId in this.preloadedComponents;\n }\n\n /**\n * Get the preloaded params for a component (if preloaded)\n * Returns undefined if not preloaded\n */\n getPreloadedParams(componentId: string): { env: string; preview: boolean } | undefined {\n return this.preloadedComponents[componentId];\n }\n\n /**\n * Resolve a component config: fetch it once, then serve it from this\n * repository's cache.\n *\n * This is the name to use. `fetchComponentV2` is the same method under its\n * versioned name and stays for backward compatibility \u2014 note that the\n * unversioned `fetchComponent` is a *deprecated v1* API and is NOT this.\n *\n * Completes the trio with {@link getResolvedConfig} (synchronous read of an\n * already-resolved config) and {@link hydrateComponent} (seed one you\n * already hold).\n *\n * Prefer the module-level `preloadComponents([id])` in app code; reach for\n * this when you need an isolated repository instance whose cache lifetime\n * you control \u2014 a server with its own TTL, for example.\n */\n async resolveComponent(componentId: string, env?: string, preview?: boolean): Promise<IComponentConfig> {\n return this.fetchComponentV2(componentId, env, preview);\n }\n\n /**\n * Fetch a v2 component config\n * If env/preview not specified and component was preloaded, uses preloaded params\n *\n * @see resolveComponent \u2014 the unversioned name for this method\n */\n async fetchComponentV2(componentId: string, environmentIdentifier?: string, preview?: boolean): Promise<IComponentConfig> {\n const { env, usePreview, cacheKey } = this.resolveParams(componentId, environmentIdentifier, preview);\n\n console.log('[CloudRepository] fetchComponentV2', {\n componentId: componentId.slice(0, 8) + '...',\n env,\n usePreview,\n cacheKey,\n cached: cacheKey in this.variants\n });\n\n if (!this.variants[cacheKey]) {\n // Track this as preloaded (first fetch counts as preload)\n if (!this.preloadedComponents[componentId]) {\n this.preloadedComponents[componentId] = { env, preview: usePreview };\n }\n\n // eslint-disable-next-line no-async-promise-executor\n this.variants[cacheKey] = new Promise(\n async (resolve, reject) => {\n try {\n let url: string;\n if (this._staticMode) {\n const file = usePreview ? 'preview' : env;\n url = `${this._baseUrl}/components/${componentId}/${file}.json`;\n const qs = new URLSearchParams(this._queryParams).toString();\n if (qs) url += `?${qs}`;\n } else {\n url = `/consume?id=${componentId}&env=${env}`;\n if (usePreview) {\n url += '&preview=true';\n }\n // A preview is never minified: the artifact is built from the\n // released variant, and an author must see their own edit.\n if (this._delivery.minify && !usePreview) {\n url += '&opt=min';\n }\n }\n\n // ---- the client window -------------------------------------\n // A preview is never held: an author has to see their own edit.\n const cacheable = this._delivery.cache && !this._staticMode && !usePreview;\n const storeKey = cacheable ? deliveryStore.key(\n this.deliveryHost(), componentId, env,\n usePreview, this._delivery.minify ? 'min' : 'raw') : '';\n let held = cacheable ? await deliveryStore.get(storeKey) : null;\n\n if (held && deliveryStore.fresh(held)) {\n // Inside the window: no request at all. Counted locally and\n // reported later, or this visit is invisible to the ledger.\n this._deliveryStats.fromStorage++;\n this.noteLocalServe(componentId, env);\n (this.variants[cacheKey] as any).resolved = held.config;\n resolve(held.config);\n return;\n }\n\n if (held && held.tag) {\n // The window ended. Send back the version we hold rather than\n // re-downloading: the answer is usually a few hundred bytes.\n //\n // Deliberately the `ids=`/`have=` route and NOT If-None-Match:\n // a request header triggers a CORS preflight, there is no OPTIONS\n // route, and it fails in a browser while working perfectly in curl.\n // The validator travels in the query string, so it is a plain GET.\n const checkUrl = `/consume?ids=${componentId}&env=${env}` +\n (this._delivery.minify ? '&opt=min' : '') +\n `&have=${encodeURIComponent(held.tag)}`;\n this._deliveryStats.revalidations++;\n try {\n const check = await this.deliveryFetch(checkUrl);\n if (check.ok) {\n const body = await check.json();\n if ((body.unchanged || []).includes(componentId)) {\n this._deliveryStats.unchanged++;\n this._deliveryStats.bytesSaved += CloudRepository.sizeOfHeld(held);\n held.storedAt = Date.now();\n held.windowMs = deliveryStore.windowFrom(check.headers) || held.windowMs;\n await deliveryStore.put(held);\n (this.variants[cacheKey] as any).resolved = held.config;\n resolve(held.config);\n return;\n }\n // It changed. The answer already carries the new bytes.\n const item = (body.items || [])[0];\n if (item) {\n const cfg = convertV2VariantToComponentConfig(item);\n this._deliveryStats.fromNetwork++;\n await deliveryStore.put({\n key: storeKey, config: cfg, tag: item.tag || null,\n storedAt: Date.now(),\n windowMs: deliveryStore.windowFrom(check.headers),\n host: this.deliveryHost(),\n } as any);\n (this.variants[cacheKey] as any).resolved = cfg;\n resolve(cfg);\n return;\n }\n }\n } catch {\n // A failed re-check must not fail the page: fall through to\n // the ordinary fetch below.\n }\n }\n\n const res = this._staticMode\n ? await fetch(url)\n : await this.deliveryFetch(url);\n if (!res.ok) {\n reject(new Error(`Failed to load component \"${componentId}\" (${res.status}${this._staticMode ? ` from ${url}` : ''})`));\n return;\n }\n const json = await res.json();\n const variant = json.item;\n\n if (!variant) {\n reject(new Error(`Component \"${componentId}\" not found`));\n return;\n }\n\n if (!variant.consume_variant || !variant.consume_variant.length) {\n reject(new Error(`Component \"${componentId}\" has no implementation for environment \"${env}\"`));\n return;\n }\n\n const componentConfig = convertV2VariantToComponentConfig(variant);\n this._deliveryStats.fromNetwork++;\n if (cacheable) {\n // Hold it for exactly as long as the server said, minus what a\n // CDN already spent (deliveryStore.windowFrom).\n await deliveryStore.put({\n key: storeKey, config: componentConfig,\n tag: (variant as any).tag || null,\n storedAt: Date.now(),\n windowMs: deliveryStore.windowFrom(res.headers),\n host: this.deliveryHost(),\n } as any);\n }\n // Tag the Promise so getResolvedConfig can read it synchronously\n (this.variants[cacheKey] as any).resolved = componentConfig;\n resolve(componentConfig);\n } catch (e) {\n // Clear the cached rejected promise so the next call\n // makes a fresh request (e.g. after network recovery)\n delete this.variants[cacheKey];\n reject(e);\n }\n }\n );\n }\n\n return await this.variants[cacheKey];\n }\n\n /**\n * Synchronous version of fetchComponentV2 \u2014 returns the config only if\n * the fetch already completed, null otherwise.\n *\n * Uses the same `this.variants` cache that fetchComponentV2/preloadComponents\n * populate. Each cached Promise is tagged with a `.resolved` property when\n * it settles \u2014 this method just reads that property. No separate cache.\n *\n * Why this exists: React Native needs the config at render time to embed it\n * in the WebView HTML (can't await in useState). If preloadComponents ran\n * earlier and the fetch completed, this returns the result synchronously,\n * skipping the WEBVIEW_READY \u2192 fetch \u2192 inject round trip entirely.\n */\n getResolvedConfig(componentId: string, env?: string, preview?: boolean): IComponentConfig | null {\n const { cacheKey } = this.resolveParams(componentId, env, preview);\n return this.variants[cacheKey]?.resolved || null;\n }\n\n /**\n * Resolve which (env, preview) pair \u2014 and therefore which cache key \u2014 a call\n * for `componentId` refers to.\n *\n * Single source of truth for fetchComponentV2, getResolvedConfig and\n * hydrateComponent, so a hydrated config always lands on the key a later\n * fetch will look under.\n */\n private resolveParams(componentId: string, environmentIdentifier?: string, preview?: boolean) {\n // If no explicit env/preview and component was preloaded, use preloaded params\n const preloaded = this.preloadedComponents[componentId];\n const hasExplicitParams = environmentIdentifier !== undefined || preview !== undefined;\n\n let env: string;\n let usePreview: boolean;\n\n if (!hasExplicitParams && preloaded) {\n // Use preloaded params\n env = preloaded.env;\n usePreview = preloaded.preview;\n } else {\n // Use provided params or defaults\n env = environmentIdentifier || this._defaultEnv;\n // If preview explicitly true \u2192 true\n // If preview explicitly false \u2192 false\n // If preview undefined: env was specified (via param or setEnvironment) \u2192 false, otherwise \u2192 true\n const hasEffectiveEnv = environmentIdentifier || this._envExplicitlySet;\n usePreview = preview === true ? true : (preview === false ? false : !hasEffectiveEnv);\n }\n\n return { env, usePreview, cacheKey: `${componentId}:${env}:${usePreview ? 'preview' : 'live'}` };\n }\n\n /**\n * Seed an already-resolved component config into the cache, without any\n * network request.\n *\n * The counterpart to {@link fetchComponentV2}: use it when the config was\n * resolved somewhere else \u2014 most often on a server, then embedded in the\n * page \u2014 so the browser can render the component with no round trip.\n *\n * After hydrating, `fetchComponentV2`, `getResolvedConfig` and `isPreloaded`\n * all answer for this component from memory.\n *\n * Pass the same `env` / `preview` the config was resolved with; the defaults\n * match what a plain `fetchComponentV2(componentId)` would have used.\n */\n hydrateComponent(componentId: string, config: IComponentConfig, env?: string, preview?: boolean): void {\n const { env: resolvedEnv, usePreview, cacheKey } = this.resolveParams(componentId, env, preview);\n\n const promise = Promise.resolve(config) as Promise<IComponentConfig> & { resolved?: IComponentConfig };\n // Tag it the same way fetchComponentV2 does, so getResolvedConfig can\n // read it synchronously.\n promise.resolved = config;\n\n this.variants[cacheKey] = promise;\n this.preloadedComponents[componentId] = { env: resolvedEnv, preview: usePreview };\n }\n\n // ============ V1 Methods (Legacy) ============\n\n /**\n * Fetch a v1 component from a flow\n */\n async fetchComponentV1(componentId: string, flowId?: string) {\n if (flowId) {\n const flow = await this.fetchFlow(flowId);\n return flow.components.find(c => c.type.id === componentId);\n } else {\n const flow = await this.fetchAutoFlow(componentId);\n return flow.components[0];\n }\n }\n\n async fetchAutoFlow(componentId: string) {\n if (!this.userFlows[componentId]) {\n // eslint-disable-next-line no-async-promise-executor\n this.userFlows[componentId] = new Promise(\n async (resolve, reject) => {\n try {\n const res = await fetch(\n `${this._baseUrl}/flow?id=${componentId}&auto=true`\n );\n const json = await res.json();\n resolve(json.item);\n } catch (e) {\n delete this.userFlows[componentId];\n reject(e);\n }\n }\n );\n }\n\n return await this.userFlows[componentId];\n }\n\n async fetchFlow(flowId: string) {\n if (!this.userFlows[flowId]) {\n // eslint-disable-next-line no-async-promise-executor\n this.userFlows[flowId] = new Promise(\n async (resolve, reject) => {\n try {\n const res = await fetch(\n `${this._baseUrl}/flow?id=${flowId}&resolve=components`\n );\n const json = await res.json();\n resolve(json.item);\n } catch (e) {\n delete this.userFlows[flowId];\n reject(e);\n }\n }\n );\n }\n\n return await this.userFlows[flowId];\n }\n\n // ============ Backward Compatibility ============\n\n /**\n * @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly\n * Defaults to v1 behavior for backward compatibility with existing code\n */\n async fetchComponent(componentId: string, flowId?: string) {\n return this.fetchComponentV1(componentId, flowId);\n }\n}\n\n/**\n * @deprecated Use CloudRepository instead\n */\nexport const v2_CloudRepository = CloudRepository;\n", "export const exec = async (getter: any) => {\n return await getter()\n}\n", "import { CloudRepository } from \"./CloudRepository\";\nimport { IComponentConfig } from \"../common\";\n\nlet _cloudRepository = CloudRepository.Main;\n\nexport const getCloudRepository = () => _cloudRepository;\n\nexport const isPreloaded = (componentId: string, env?: string, preview?: boolean): boolean => {\n return _cloudRepository.isPreloaded(componentId, env, preview);\n};\n\nexport const getPreloadedParams = (componentId: string) => {\n return _cloudRepository.getPreloadedParams(componentId);\n};\n\nexport const enableLocalDev = () => {\n _cloudRepository = new CloudRepository(\"http://localhost:9292\");\n};\n\nexport const setCloudRepositoryUrl = (url: string) => {\n _cloudRepository = new CloudRepository(url);\n};\n\n/**\n * Configure the SDK to fetch components from a self-hosted static registry (S3, CDN, etc.)\n * instead of the Myop cloud. Components are served as static JSON files:\n * `${cdnUrl}/components/${componentId}/${environment}.json`\n */\nexport const enableSelfHosted = (cdnUrl: string, queryParams?: Record<string, string>) => {\n _cloudRepository = new CloudRepository(cdnUrl);\n _cloudRepository.enableStaticMode();\n if (queryParams) {\n _cloudRepository.setQueryParams(queryParams);\n }\n};\n\n/**\n * THE OPT-IN. One call, and nothing changes for anyone who does not make it.\n *\n * myop.delivery({ minify: true });\n *\n * Opting in IS choosing the delivery lane: a second, complete Myop stack (its own server\n * and CDN) reading the same component data. So this call does two things at once \u2014 it\n * points `/consume` at that stack and asks it for the minified artifact \u2014 which is why\n * turning the feature off is a config value on our side or one line on yours, and never\n * a DNS change.\n *\n * Safety properties, all deliberate:\n * - If the lane fails (transport error or 5xx), the SDK retries ONCE against\n * cloud.myop.dev and the page renders anyway. `delivery.stats().fellBack` counts it.\n * - `cache: true` adds the client window: a component this browser already holds, still\n * inside the freshness the server promised, is rendered with NO request. Once the\n * window ends the browser sends back the version it holds instead of re-downloading.\n * - A preview is never minified and never cached.\n * - Only /consume moves. Everything else keeps the host it has today.\n * - Asking for `minify` does not force it: the server decides per component, and a\n * component that is not enabled is served raw, which is not an error.\n *\n * `host` is for us (a staging lane, a local server); leave it out.\n */\nexport const DELIVERY_HOST = 'https://delivery.myop.dev';\n\nexport const delivery = (opts: { minify?: boolean; cache?: boolean; host?: string | null } = {}) => {\n const wantsLane = opts.minify !== false || opts.cache === true;\n _cloudRepository.setDelivery({\n minify: opts.minify ?? false,\n cache: opts.cache ?? false,\n host: opts.host !== undefined ? opts.host : (wantsLane ? DELIVERY_HOST : null),\n });\n return deliveryStats();\n};\n\n/**\n * Forget what this browser holds, so the next load asks the server. Use it when a change\n * has to be visible on THIS load \u2014 right after someone publishes \u2014 rather than within the\n * freshness window.\n */\nexport const deliveryRefresh = async () => {\n await _cloudRepository.refreshDelivery();\n return deliveryStats();\n};\n\n/**\n * What answered the last requests, and \u2014 the number worth watching \u2014 how many times the\n * SDK had to fall back to the default host because the lane did not answer.\n */\nexport const deliveryStats = () => _cloudRepository.deliveryStats();\n\n/** Undo delivery(): back to the default host and raw bytes, with no reload. */\nexport const deliveryOff = () => {\n _cloudRepository.setDelivery({ minify: false, cache: false, host: null });\n return deliveryStats();\n};\n\nexport const setCloudRepository = (repository: CloudRepository) => {\n _cloudRepository = repository;\n};\n\nexport const setEnvironment = (env: string) => {\n _cloudRepository.setEnvironment(env);\n};\n\nexport const getResolvedConfig = (componentId: string, env?: string, preview?: boolean) => {\n return _cloudRepository.getResolvedConfig(componentId, env, preview);\n};\n\nexport const preloadComponents = async (ids: string[], env?: string, preview?: boolean) => {\n return Promise.allSettled(\n ids.map((id) => _cloudRepository.fetchComponentV2(id, env, preview)),\n );\n};\n\n/**\n * Seed already-resolved component configs into the SDK cache, with no network\n * request. The counterpart to {@link preloadComponents}.\n *\n * Use it when the configs were resolved somewhere else \u2014 typically on a server\n * and embedded in the page \u2014 so the component renders with zero round trips:\n *\n * ```ts\n * // server: const configs = { [id]: await new CloudRepository().fetchComponentV2(id) }\n * // client:\n * hydrateComponents(configs);\n * // <MyopComponent componentId={id} /> now renders without fetching\n * ```\n *\n * Pass the same `env` / `preview` the configs were resolved with; the defaults\n * match what a plain `preloadComponents([id])` would have used.\n */\nexport const hydrateComponents = (\n configs: Record<string, IComponentConfig>,\n env?: string,\n preview?: boolean,\n) => {\n for (const [id, config] of Object.entries(configs)) {\n _cloudRepository.hydrateComponent(id, config, env, preview);\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,SAAS,MAAM;AACxB,SAAO,uCAAuC;AAAA,IAAQ;AAAA,IAAU,QAC3D,CAAC,IAAI,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,SAAS,EAAE;AAAA,EAClF;AACJ;;;ACKO,IAAe,kBAAf,MAAwC;AAAA,EAW3C,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
|
* @returns Cleanup function to stop observing
|
|
54
54
|
*/
|
|
55
55
|
observeAutoSize: (options?: AutoSizeOptions) => CleanupHandler;
|
|
56
|
+
private _bridgeSizeCleanup?;
|
|
57
|
+
/**
|
|
58
|
+
* Auto-height for a frame the host can't read (cross-origin). Runs after the IframeSDK
|
|
59
|
+
* handshake: the frame reports body resizes and the host re-reads the scroll height.
|
|
60
|
+
*/
|
|
61
|
+
observeHeightViaBridge: () => CleanupHandler;
|
|
56
62
|
setSizeBasedOnDocumentElement: () => void;
|
|
57
63
|
setHeightBasedOnScrollHeight: () => void;
|
|
58
64
|
send: (message: BaseMyopMessage) => CleanupHandler;
|