@combeenation/custom-code-sdk 0.0.1-alpha12 → 0.0.1-alpha13

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.
@@ -1 +1 @@
1
- "use strict";var Ae=Object.defineProperty;var K=e=>{throw TypeError(e)};var Ve=(e,n,t)=>n in e?Ae(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>Ve(e,typeof n!="symbol"?n+"":n,t),G=(e,n,t)=>n.has(e)||K("Cannot "+t);var i=(e,n,t)=>(G(e,n,"read from private field"),t?t.call(e):n.get(e)),a=(e,n,t)=>n.has(e)?K("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),u=(e,n,t,s)=>(G(e,n,"write to private field"),s?s.call(e,t):n.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("zod"),D="0.0.1-alpha12";var F,l;class ke{constructor(n){d(this,"id");a(this,F,"v1");a(this,l);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,F));if(u(this,l,t==null?void 0:t.getButtonSdkBridge(this.id)),!i(this,l))throw new Error(`Cannot access API for Button "${this.id}".`)}onRendered(n){var t;return((t=i(this,l))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}onClick(n){var t;return((t=i(this,l))==null?void 0:t.addOnClickCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,l))==null?void 0:t.setVisible(n))}setText(n){var t;(t=i(this,l))==null||t.setText(n)}}F=new WeakMap,l=new WeakMap;var O,p;class Ie{constructor(n){d(this,"id");a(this,O,"v1");a(this,p);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,O));if(u(this,p,t==null?void 0:t.getCheckboxSdkBridge(this.id)),!i(this,p))throw new Error(`Cannot access API for Checkbox "${this.id}".`)}onRendered(n){var t;return((t=i(this,p))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,p))==null?void 0:t.setVisible(n))}}O=new WeakMap,p=new WeakMap;var $,b;class Pe{constructor(n){d(this,"id");a(this,$,"v1");a(this,b);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,$));if(u(this,b,t==null?void 0:t.getCollapsibleSdkBridge(this.id)),!i(this,b))throw new Error(`Cannot access API for Collapsible "${this.id}".`)}onRendered(n){var t;return((t=i(this,b))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,b))==null?void 0:t.setVisible(n))}}$=new WeakMap,b=new WeakMap;var x,c;class ye{constructor(n){d(this,"id");a(this,x,"v1");a(this,c);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,x));if(u(this,c,t==null?void 0:t.getCustomCtrlSdkBridge(this.id)),!i(this,c))throw new Error(`Cannot access API for Custom Control "${this.id}".`)}set renderFn(n){var t;(t=i(this,c))==null||t.setRenderFn(n)}async render(n){var t;typeof n=="function"&&(this.renderFn=n),await((t=i(this,c))==null?void 0:t.render())}onRendered(n){var t;return((t=i(this,c))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}getElement(){var t;return(t=i(this,c))==null?void 0:t.getElement()}async setVisible(n){var t;await((t=i(this,c))==null?void 0:t.setVisible(n))}}x=new WeakMap,c=new WeakMap;var M,f;class Ee{constructor(n){d(this,"id");a(this,M,"v1");a(this,f);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,M));if(u(this,f,t==null?void 0:t.getDataviewSdkBridge(this.id)),!i(this,f))throw new Error(`Cannot access API for Dataview "${this.id}".`)}onRendered(n){var t;return((t=i(this,f))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,f))==null?void 0:t.setVisible(n))}}M=new WeakMap,f=new WeakMap;var _,w;class Be{constructor(n){d(this,"id");a(this,_,"v1");a(this,w);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,_));if(u(this,w,t==null?void 0:t.getInputSdkBridge(this.id)),!i(this,w))throw new Error(`Cannot access API for Input "${this.id}".`)}onRendered(n){var t;return((t=i(this,w))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,w))==null?void 0:t.setVisible(n))}}_=new WeakMap,w=new WeakMap;var L,A;class Se{constructor(n){d(this,"id");a(this,L,"v1");a(this,A);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,L));if(u(this,A,t==null?void 0:t.getPanelSdkBridge(this.id)),!i(this,A))throw new Error(`Cannot access API for Panel "${this.id}".`)}onRendered(n){var t;return((t=i(this,A))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,A))==null?void 0:t.setVisible(n))}}L=new WeakMap,A=new WeakMap;var U,h;class ve{constructor(n){d(this,"id");a(this,U,"v1");a(this,h);var s,o;this.id=n;const t=(o=(s=window.Cbn)==null?void 0:s.getCustomCodeSdkBridge)==null?void 0:o.call(s,i(this,U));if(u(this,h,t==null?void 0:t.getTextSdkBridge(this.id)),!i(this,h))throw new Error(`Cannot access API for Text "${this.id}".`)}onRendered(n){var t;return((t=i(this,h))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,h))==null?void 0:t.setVisible(n))}setText(n){var t;(t=i(this,h))==null||t.setText(n)}}U=new WeakMap,h=new WeakMap;const W=1,R=[];function ze(e,n){if(R.length>=W)throw new Error(`Only ${W} \`ConfiguratorClient\` can be created at a time.`);R.push({client:e,internals:n})}function H(){const e=R[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.client}function Re(){const e=R[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.internals}const Te="v1";var z,Q;const B=(Q=(z=window.Cbn)==null?void 0:z.getCustomCodeSdkBridge)==null?void 0:Q.call(z,"v1");if(!B)throw new Error("Cannot access Configurator SDK bridge. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");const Y=B.createCfgrClient(Te,ze);if(!Y)throw new Error("Cannot create Configurator Client. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");const V=B.getParentPageUtilsSdkBridge(),g=B.getCfgrUtilsSdkBridge(),Fe=B.getViewer3dSdkBridge(),T=Y;var S=(e=>(e[e.Any=1]="Any",e[e.Image=2]="Image",e))(S||{}),m=(e=>(e[e.PdfAsset=0]="PdfAsset",e[e.Asset=1]="Asset",e[e.Merge=2]="Merge",e[e.OutputToCfgnFile=4]="OutputToCfgnFile",e))(m||{}),Z=(e=>(e[e.PdfAsset=m.PdfAsset]="PdfAsset",e[e.Asset=m.Asset]="Asset",e))(Z||{});const J=e=>g.uploadCfgnFiles(e,S.Image),ee=e=>g.uploadCfgnFiles(e,S.Any),te=e=>g.uploadTempCfgnFiles(e,S.Image),ne=e=>g.uploadTempCfgnFiles(e,S.Any),se=e=>g.convertDocument(e);async function ie(e,n,t,s){const o=n.length>1,k="MergeTask",I="Task_",P=n.map((C,j)=>C.type===Z.PdfAsset?{type:m.PdfAsset,name:`${I}${j}`,bundleAliasName:e,assetPath:C.assetPath,context:C.context}:{type:m.Asset,name:`${I}${j}`,bundleAliasName:e,assetPath:C.assetPath});return o&&P.push({type:m.Merge,name:k,inputTaskNames:P.map(C=>C.name)}),P.push({type:m.OutputToCfgnFile,inputTaskName:o?k:P[0].name,name:"OutputPdfTask",cfgnFileExtension:"pdf",cfgnFileName:t,cfgnFileDisplayName:s}),g.convertDocument(P)}const N={Text:"Text",Number:"Number",Logic:"Logic"},y={ValueComponent:"ValueComponent",TableComponent:"TableComponent",RecordComponent:"RecordComponent",ResourceComponent:"ResourceComponent",GraphicComponent:"GraphicComponent",CheckoutComponent:"CheckoutComponent"},E={ValueEditor:"ValueEditor",TableEditor:"TableEditor",Fiber:"Fiber",FiberEditor:"FiberEditor",CfgrField:"CfgrField"};r.z.enum([E.ValueEditor,E.TableEditor,E.Fiber,E.FiberEditor,E.CfgrField]);r.z.union([r.z.string(),r.z.number(),r.z.boolean()]);const v=e=>typeof e=="string";r.z.string();r.z.enum([N.Text,N.Number,N.Logic]);r.z.string();r.z.custom(e=>v(e)&&e.toLowerCase()===e);const oe=e=>(e==null?void 0:e.toLowerCase())??"";r.z.string();const Oe=r.z.custom(e=>v(e)?new RegExp(`^${y.ValueComponent}<.*>$`).test(e):!1),$e=r.z.custom(e=>v(e)?new RegExp(`^${y.RecordComponent}<.*>$`).test(e):!1),xe=r.z.custom(e=>v(e)?new RegExp(`^${y.ResourceComponent}<.*>$`).test(e):!1),Me=r.z.custom(e=>v(e)?new RegExp(`^${y.TableComponent}<.*>$`).test(e):!1);r.z.union([Oe,Me,$e,xe,r.z.literal(y.GraphicComponent),r.z.literal(y.CheckoutComponent)]);const X=r.z.union([r.z.string(),r.z.number(),r.z.boolean()]),_e=r.z.union([X,r.z.array(X),r.z.object({}),r.z.unknown()]),Le=r.z.object({$typ:r.z.literal("Error"),Id:r.z.string(),Message:r.z.string(),route:r.z.unknown().optional()});Le.or(_e);const q=new Map;function Ue(e){const n=oe(e.name);q.has(n)||q.set(n,e)}class Ne{constructor(n,t){d(this,"name");d(this,"zodType");this.name=n,this.zodType=t,Ue(this)}async getValue(){return await H().getCmpValue(this.name)}async setInput(n){const t=oe(this.name);await Re().setCmpInput(t,n,this.zodType)}onValueChanged(n,t=!1,s){H().onCmpValueChanged(this.name,n,s,t)}}const re=()=>g.getAssetPaths();var ae=(e=>(e[e.Facebook=0]="Facebook",e[e.Pinterest=1]="Pinterest",e[e.Twitter=2]="Twitter",e[e.LinkedIn=3]="LinkedIn",e[e.WhatsApp=4]="WhatsApp",e[e.Custom=5]="Custom",e[e.NativeShare=6]="NativeShare",e))(ae||{});const De="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=",de=T.onAnyCmpValueChanged.bind(T),ce=async e=>{if(await T.finishConfiguration(e==null?void 0:e.input),e.sendDataToParentPage){const n=e.transformParentPageData();await V.sendConfigurationFinished(n)}},ue=async e=>{const n=ae[e.platform],t=e.imageUrl??De,s={...e,platform:n,imageUrl:t},o=await T.shareConfiguration(s);await g.openShareWindow(e.platform,o);const{shareUrl:k,shareConfigurationId:I}=o;return{shareUrl:k,shareConfigurationId:I}},le=()=>V.isInIFrame(),ge=e=>V.setIFrameSize(e),Ce=e=>g.navigateToLogin(e),he=async e=>{const{promise:n,resolve:t}=Promise.withResolvers(),s={};for(const[o,k]of Object.entries(e))k.onValueChanged(I=>{s[o]=I,Object.keys(e).every(C=>C in s)&&t(s)},!0);return n},me=(e,n)=>V.sendCustomMsg(e,n),pe=e=>V.redirectParentPage(e),be=()=>V.getParentPageUrl(),fe=(e,n)=>V.fireAnalyticsEvent(e,n),we=async(e,n)=>Fe.createArPage(e,n),Ze=Object.freeze(Object.defineProperty({__proto__:null,configuratorIsInIFrame:le,convertDocument:se,createArPage:we,createPdfFromAssets:ie,createSyncCmpValuesStore:he,finishConfiguration:ce,fireAnalyticsEvent:fe,getAssetPaths:re,getParentPageUrl:be,navigateToLogin:Ce,onAnyCmpValueChanged:de,redirectParentPage:pe,sendCustomMsgToParentPage:me,setConfiguratorIFrameSize:ge,shareConfiguration:ue,uploadFiles:ee,uploadImages:J,uploadTempFiles:ne,uploadTempImages:te,version:D},Symbol.toStringTag,{value:"Module"}));console.log(`Loading custom code SDK v${D}`);exports.Button=ke;exports.CbnSdk=Ze;exports.Checkbox=Ie;exports.Collapsible=Pe;exports.CreatePdfTaskTypes=Z;exports.CustomControl=ye;exports.Dataview=Ee;exports.DocumentConvertTaskTypes=m;exports.Input=Be;exports.Panel=Se;exports.Text=ve;exports.ValueComponent=Ne;exports.configuratorIsInIFrame=le;exports.convertDocument=se;exports.createArPage=we;exports.createPdfFromAssets=ie;exports.createSyncCmpValuesStore=he;exports.finishConfiguration=ce;exports.fireAnalyticsEvent=fe;exports.getAssetPaths=re;exports.getParentPageUrl=be;exports.navigateToLogin=Ce;exports.onAnyCmpValueChanged=de;exports.redirectParentPage=pe;exports.sendCustomMsgToParentPage=me;exports.setConfiguratorIFrameSize=ge;exports.shareConfiguration=ue;exports.uploadFiles=ee;exports.uploadImages=J;exports.uploadTempFiles=ne;exports.uploadTempImages=te;exports.version=D;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};let n=require("zod");var r=`0.0.1-alpha13`,i=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getButtonSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Button "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}onClick(e){return this.#t?.addOnClickCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}setText(e){this.#t?.setText(e)}},a=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getCheckboxSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Checkbox "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}},o=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getCollapsibleSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Collapsible "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}},s=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getComboboxSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Combobox "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}onItemRendered(e){return this.#t?.addOnItemRenderedCallback(e)??{unsubscribe:()=>{}}}onValueItemRendered(e){return this.#t?.addOnValueItemRenderedCallback(e)??{unsubscribe:()=>{}}}onGroupHeaderRendered(e){return this.#t?.addOnGroupHeaderRenderedCallback(e)??{unsubscribe:()=>{}}}onValueChange(e){return this.#t?.addOnValueChangeCallback(e)??{unsubscribe:()=>{}}}onItemClicked(e){return this.#t?.addOnItemClickedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}setEntries(e){this.#t?.setEntries(e)}setGroupData(e){this.#t?.setGroupData(e)}},c=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getCustomCtrlSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Custom Control "${this.id}".`)}set renderFn(e){this.#t?.setRenderFn(e)}async render(e){typeof e==`function`&&(this.renderFn=e),await this.#t?.render()}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}getElement(){return this.#t?.getElement()}async setVisible(e){await this.#t?.setVisible(e)}},l=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getDataviewSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Dataview "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}onItemRendered(e){return this.#t?.addOnItemRenderedCallback(e)??{unsubscribe:()=>{}}}onGroupHeaderRendered(e){return this.#t?.addOnGroupHeaderRenderedCallback(e)??{unsubscribe:()=>{}}}onValueChange(e){return this.#t?.addOnValueChangeCallback(e)??{unsubscribe:()=>{}}}onItemClicked(e){return this.#t?.addOnItemClickedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}setEntries(e){this.#t?.setEntries(e)}setGroupData(e){this.#t?.setGroupData(e)}},ee=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getInputSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Input "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}},u=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getPanelSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Panel "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}},te=class{id;#e=`v1`;#t=void 0;constructor(e){this.id=e;let t=window.Cbn?.getCustomCodeSdkBridge?.(this.#e);if(this.#t=t?.getTextSdkBridge(this.id),!this.#t)throw Error(`Cannot access API for Text "${this.id}".`)}onRendered(e){return this.#t?.addOnRenderedCallback(e)??{unsubscribe:()=>{}}}async setVisible(e){await this.#t?.setVisible(e)}setText(e){this.#t?.setText(e)}},d=1,f=[];function ne(e,t){if(f.length>=d)throw Error(`Only ${d} \`ConfiguratorClient\` can be created at a time.`);f.push({client:e,internals:t})}function p(){let e=f[0];if(!e)throw Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.client}function m(){let e=f[0];if(!e)throw Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.internals}var h=window.Cbn?.getCustomCodeSdkBridge?.(`v1`);if(!h)throw Error("Cannot access Configurator SDK bridge. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");var g=h.createCfgrClient(`v1`,ne);if(!g)throw Error("Cannot create Configurator Client. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");var _=h.getParentPageUtilsSdkBridge(),v=h.getCfgrUtilsSdkBridge(),re=h.getViewer3dSdkBridge(),y=g,b=function(e){return e[e.Any=1]=`Any`,e[e.Image=2]=`Image`,e}({}),x=function(e){return e[e.PdfAsset=0]=`PdfAsset`,e[e.Asset=1]=`Asset`,e[e.Merge=2]=`Merge`,e[e.OutputToCfgnFile=4]=`OutputToCfgnFile`,e}({}),S=function(e){return e[e.PdfAsset=x.PdfAsset]=`PdfAsset`,e[e.Asset=x.Asset]=`Asset`,e}({}),C=e=>v.uploadCfgnFiles(e,b.Image),w=e=>v.uploadCfgnFiles(e,b.Any),T=e=>v.uploadTempCfgnFiles(e,b.Image),E=e=>v.uploadTempCfgnFiles(e,b.Any),D=e=>v.convertDocument(e);async function O(e,t,n,r){let i=t.length>1,a=`MergeTask`,o=`Task_`,s=t.map((t,n)=>t.type===S.PdfAsset?{type:x.PdfAsset,name:`${o}${n}`,bundleAliasName:e,assetPath:t.assetPath,context:t.context}:{type:x.Asset,name:`${o}${n}`,bundleAliasName:e,assetPath:t.assetPath});return i&&s.push({type:x.Merge,name:a,inputTaskNames:s.map(e=>e.name)}),s.push({type:x.OutputToCfgnFile,inputTaskName:i?a:s[0].name,name:`OutputPdfTask`,cfgnFileExtension:`pdf`,cfgnFileName:n,cfgnFileDisplayName:r}),v.convertDocument(s)}var k={Text:`Text`,Number:`Number`,Logic:`Logic`,Image:`Image`,FileUrl:`FileUrl`,TextAsset:`TextAsset`,Table:`Table`};`${k.Text}`,`${k.Number}`;var A={ValueComponent:`ValueComponent`,TableComponent:`TableComponent`,RecordComponent:`RecordComponent`,ResourceComponent:`ResourceComponent`,GraphicComponent:`GraphicComponent`,CheckoutComponent:`CheckoutComponent`};A.GraphicComponent,A.CheckoutComponent,A.ResourceComponent,A.RecordComponent;var j={ValueEditor:`ValueEditor`,TableEditor:`TableEditor`,Fiber:`Fiber`,FiberEditor:`FiberEditor`,CfgrField:`CfgrField`};n.z.enum([j.ValueEditor,j.TableEditor,j.Fiber,j.FiberEditor,j.CfgrField]),n.z.union([n.z.string(),n.z.number(),n.z.boolean()]);var M=e=>typeof e==`string`;n.z.string(),n.z.enum([k.Text,k.Number,k.Logic]),n.z.string(),n.z.custom(e=>M(e)&&e.toLowerCase()===e);var N=e=>e?.toLowerCase()??``;n.z.string();var P=n.z.custom(e=>M(e)?RegExp(`^${A.ValueComponent}<.*>$`).test(e):!1),F=n.z.custom(e=>M(e)?RegExp(`^${A.RecordComponent}<.*>$`).test(e):!1),I=n.z.custom(e=>M(e)?RegExp(`^${A.ResourceComponent}<.*>$`).test(e):!1),ie=n.z.custom(e=>M(e)?RegExp(`^${A.TableComponent}<.*>$`).test(e):!1);n.z.union([P,ie,F,I,n.z.literal(A.GraphicComponent),n.z.literal(A.CheckoutComponent)]);var L=n.z.union([n.z.string(),n.z.number(),n.z.boolean()]),ae=n.z.union([L,n.z.array(L),n.z.object({}),n.z.unknown()]);n.z.object({$typ:n.z.literal(`Error`),Id:n.z.string(),Message:n.z.string(),route:n.z.unknown().optional()}).or(ae);var R=new Map;function oe(e){let t=N(e.name);R.has(t)||R.set(t,e)}var se=class{name;zodType;constructor(e,t){this.name=e,this.zodType=t,oe(this)}async getValue(){return await p().getCmpValue(this.name)}async setInput(e){let t=N(this.name);await m().setCmpInput(t,e,this.zodType)}onValueChanged(e,t=!1,n){p().onCmpValueChanged(this.name,e,n,t)}},z=()=>v.getAssetPaths(),B=function(e){return e[e.Facebook=0]=`Facebook`,e[e.Pinterest=1]=`Pinterest`,e[e.Twitter=2]=`Twitter`,e[e.LinkedIn=3]=`LinkedIn`,e[e.WhatsApp=4]=`WhatsApp`,e[e.Custom=5]=`Custom`,e[e.NativeShare=6]=`NativeShare`,e}({}),V=y.onAnyCmpValueChanged.bind(y),H=async e=>{if(await y.finishConfiguration(e?.input),e.sendDataToParentPage){let t=e.transformParentPageData();await _.sendConfigurationFinished(t)}},U=async e=>{let t=B[e.platform],n=e.imageUrl??`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=`,r={...e,platform:t,imageUrl:n},i=await y.shareConfiguration(r);await v.openShareWindow(e.platform,i);let{shareUrl:a,shareConfigurationId:o}=i;return{shareUrl:a,shareConfigurationId:o}},W=()=>_.isInIFrame(),G=e=>_.setIFrameSize(e),K=e=>v.navigateToLogin(e),q=async e=>{let{promise:t,resolve:n}=Promise.withResolvers(),r={};for(let[t,i]of Object.entries(e))i.onValueChanged(i=>{r[t]=i,Object.keys(e).every(e=>e in r)&&n(r)},!0);return t},J=(e,t)=>_.sendCustomMsg(e,t),Y=e=>_.redirectParentPage(e),X=()=>_.getParentPageUrl(),Z=(e,t)=>_.fireAnalyticsEvent(e,t),Q=e=>_.onParentPageEvent(e),$=async(e,t)=>re.createArPage(e,t),ce=t({configuratorIsInIFrame:()=>W,convertDocument:()=>D,createArPage:()=>$,createPdfFromAssets:()=>O,createSyncCmpValuesStore:()=>q,finishConfiguration:()=>H,fireAnalyticsEvent:()=>Z,getAssetPaths:()=>z,getParentPageUrl:()=>X,navigateToLogin:()=>K,onAnyCmpValueChanged:()=>V,onParentPageEvent:()=>Q,redirectParentPage:()=>Y,sendCustomMsgToParentPage:()=>J,setConfiguratorIFrameSize:()=>G,shareConfiguration:()=>U,uploadFiles:()=>w,uploadImages:()=>C,uploadTempFiles:()=>E,uploadTempImages:()=>T,version:()=>r});console.log(`Loading custom code SDK v${r}`),exports.Button=i,Object.defineProperty(exports,"CbnSdk",{enumerable:!0,get:function(){return ce}}),exports.Checkbox=a,exports.Collapsible=o,exports.Combobox=s,exports.CreatePdfTaskTypes=S,exports.CustomControl=c,exports.Dataview=l,exports.DocumentConvertTaskTypes=x,exports.Input=ee,exports.Panel=u,exports.Text=te,exports.ValueComponent=se,exports.configuratorIsInIFrame=W,exports.convertDocument=D,exports.createArPage=$,exports.createPdfFromAssets=O,exports.createSyncCmpValuesStore=q,exports.finishConfiguration=H,exports.fireAnalyticsEvent=Z,exports.getAssetPaths=z,exports.getParentPageUrl=X,exports.navigateToLogin=K,exports.onAnyCmpValueChanged=V,exports.onParentPageEvent=Q,exports.redirectParentPage=Y,exports.sendCustomMsgToParentPage=J,exports.setConfiguratorIFrameSize=G,exports.shareConfiguration=U,exports.uploadFiles=w,exports.uploadImages=C,exports.uploadTempFiles=E,exports.uploadTempImages=T,exports.version=r;