@combeenation/custom-code-sdk 0.0.1-alpha10 → 0.0.1-alpha12
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/bundle.cjs.js +1 -1
- package/dist/bundle.es.js +195 -191
- package/dist/index.d.ts +72 -61
- package/package.json +3 -2
package/dist/bundle.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var we=Object.defineProperty;var K=e=>{throw TypeError(e)};var Ae=(e,n,t)=>n in e?we(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>Ae(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"),N="0.0.1-alpha10";var z,g;class Ve{constructor(n){d(this,"id");a(this,z,"v1");a(this,g);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,z));if(u(this,g,t==null?void 0:t.getButtonSdkBridge(this.id)),!i(this,g))throw new Error(`Cannot access API for Button "${this.id}".`)}onRendered(n){var t;return((t=i(this,g))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}onClick(n){var t;return((t=i(this,g))==null?void 0:t.addOnClickCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,g))==null?void 0:t.setVisible(n))}setText(n){var t;(t=i(this,g))==null||t.setText(n)}}z=new WeakMap,g=new WeakMap;var F,p;class ke{constructor(n){d(this,"id");a(this,F,"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,F));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))}}F=new WeakMap,p=new WeakMap;var T,b;class Ie{constructor(n){d(this,"id");a(this,T,"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,T));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))}}T=new WeakMap,b=new WeakMap;var O,c;class Pe{constructor(n){d(this,"id");a(this,O,"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,O));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))}}O=new WeakMap,c=new WeakMap;var $,m;class ye{constructor(n){d(this,"id");a(this,$,"v1");a(this,m);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,m,t==null?void 0:t.getDataviewSdkBridge(this.id)),!i(this,m))throw new Error(`Cannot access API for Dataview "${this.id}".`)}onRendered(n){var t;return((t=i(this,m))==null?void 0:t.addOnRenderedCallback(n))??{unsubscribe:()=>{}}}async setVisible(n){var t;await((t=i(this,m))==null?void 0:t.setVisible(n))}}$=new WeakMap,m=new WeakMap;var x,f;class Ee{constructor(n){d(this,"id");a(this,x,"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,x));if(u(this,f,t==null?void 0:t.getInputSdkBridge(this.id)),!i(this,f))throw new Error(`Cannot access API for Input "${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))}}x=new WeakMap,f=new WeakMap;var M,w;class Be{constructor(n){d(this,"id");a(this,M,"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,M));if(u(this,w,t==null?void 0:t.getPanelSdkBridge(this.id)),!i(this,w))throw new Error(`Cannot access API for Panel "${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))}}M=new WeakMap,w=new WeakMap;var L,l;class Re{constructor(n){d(this,"id");a(this,L,"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,L));if(u(this,l,t==null?void 0:t.getTextSdkBridge(this.id)),!i(this,l))throw new Error(`Cannot access API for Text "${this.id}".`)}onRendered(n){var t;return((t=i(this,l))==null?void 0:t.addOnRenderedCallback(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)}}L=new WeakMap,l=new WeakMap;const X=1,v=[];function ve(e,n){if(v.length>=X)throw new Error(`Only ${X} \`ConfiguratorClient\` can be created at a time.`);v.push({client:e,internals:n})}function q(){const e=v[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.client}function Se(){const e=v[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.internals}const ze="v1";var R,J;const _=(J=(R=window.Cbn)==null?void 0:R.getCustomCodeSdkBridge)==null?void 0:J.call(R,"v1");if(!_)throw new Error("Cannot access Configurator SDK bridge. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");const H=_.createCfgrClient(ze,ve);if(!H)throw new Error("Cannot create Configurator Client. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");const A=_.getParentPageUtilsSdkBridge(),V=_.getCfgrUtilsSdkBridge(),S=H;var Z=(e=>(e[e.Any=1]="Any",e[e.Image=2]="Image",e))(Z||{}),h=(e=>(e[e.PdfAsset=0]="PdfAsset",e[e.Asset=1]="Asset",e[e.Merge=2]="Merge",e[e.Watermark=3]="Watermark",e[e.OutputToCfgnFile=4]="OutputToCfgnFile",e))(h||{}),W=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(W||{}),ee=(e=>(e[e.Top=0]="Top",e[e.Center=1]="Center",e[e.Bottom=2]="Bottom",e))(ee||{}),j=(e=>(e[e.PdfAsset=h.PdfAsset]="PdfAsset",e[e.Asset=h.Asset]="Asset",e))(j||{});const te=e=>V.uploadCfgnFiles(e,Z.Image),ne=e=>V.uploadCfgnFiles(e,Z.Any),se=e=>V.convertDocument(e);async function ie(e,n,t,s){const o=n.length>1,k="MergeTask",I="Task_",P=n.map((C,D)=>C.type===j.PdfAsset?{type:h.PdfAsset,name:`${I}${D}`,bundleAliasName:e,assetPath:C.assetPath,context:C.context}:{type:h.Asset,name:`${I}${D}`,bundleAliasName:e,assetPath:C.assetPath});return o&&P.push({type:h.Merge,name:k,inputTaskNames:P.map(C=>C.name)}),P.push({type:h.OutputToCfgnFile,inputTaskName:o?k:P[0].name,name:"OutputPdfTask",cfgnFileExtension:"pdf",cfgnFileName:t,cfgnFileDisplayName:s}),V.convertDocument(P)}const U={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 B=e=>typeof e=="string";r.z.string();r.z.enum([U.Text,U.Number,U.Logic]);r.z.string();r.z.custom(e=>B(e)&&e.toLowerCase()===e);const oe=e=>(e==null?void 0:e.toLowerCase())??"";r.z.string();const Fe=r.z.custom(e=>B(e)?new RegExp(`^${y.ValueComponent}<.*>$`).test(e):!1),Te=r.z.custom(e=>B(e)?new RegExp(`^${y.RecordComponent}<.*>$`).test(e):!1),Oe=r.z.custom(e=>B(e)?new RegExp(`^${y.ResourceComponent}<.*>$`).test(e):!1),$e=r.z.custom(e=>B(e)?new RegExp(`^${y.TableComponent}<.*>$`).test(e):!1);r.z.union([Fe,$e,Te,Oe,r.z.literal(y.GraphicComponent),r.z.literal(y.CheckoutComponent)]);const Q=r.z.union([r.z.string(),r.z.number(),r.z.boolean()]),xe=r.z.union([Q,r.z.array(Q),r.z.object({}),r.z.unknown()]),Me=r.z.object({$typ:r.z.literal("Error"),Id:r.z.string(),Message:r.z.string(),route:r.z.unknown().optional()});Me.or(xe);const Y=new Map;function Le(e){const n=oe(e.name);Y.has(n)||Y.set(n,e)}class _e{constructor(n,t){d(this,"name");d(this,"zodType");this.name=n,this.zodType=t,Le(this)}async getValue(){return await q().getCmpValue(this.name)}async setInput(n){const t=oe(this.name);await Se().setCmpInput(t,n,this.zodType)}onValueChanged(n,t=!1,s){q().onCmpValueChanged(this.name,n,s,t)}}const re=()=>V.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 Ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=",de=S.onAnyCmpValueChanged.bind(S),ce=async e=>{if(await S.finishConfiguration(e==null?void 0:e.input),e.sendDataToParentPage){const n=e.transformParentPageData();await A.sendConfigurationFinished(n)}},ue=async e=>{const n=ae[e.platform],t=e.imageUrl??Ue,s={...e,platform:n,imageUrl:t},o=await S.shareConfiguration(s);await V.openShareWindow(e.platform,o);const{shareUrl:k,shareConfigurationId:I}=o;return{shareUrl:k,shareConfigurationId:I}},ge=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},Ce=()=>A.isInIFrame(),le=e=>A.setIFrameSize(e),he=e=>V.navigateToLogin(e),pe=(e,n)=>A.sendCustomMsg(e,n),be=e=>A.redirectParentPage(e),me=()=>A.getParentPageUrl(),fe=(e,n)=>A.fireAnalyticsEvent(e,n),Ne=Object.freeze(Object.defineProperty({__proto__:null,configuratorIsInIFrame:Ce,convertDocument:se,createPdfFromAssets:ie,createSyncCmpValuesStore:ge,finishConfiguration:ce,fireAnalyticsEvent:fe,getAssetPaths:re,getParentPageUrl:me,navigateToLogin:he,onAnyCmpValueChanged:de,redirectParentPage:be,sendCustomMsgToParentPage:pe,setConfiguratorIFrameSize:le,shareConfiguration:ue,uploadFiles:ne,uploadImages:te,version:N},Symbol.toStringTag,{value:"Module"}));console.log(`Loading custom code SDK v${N}`);exports.Button=Ve;exports.CbnSdk=Ne;exports.Checkbox=ke;exports.Collapsible=Ie;exports.CreatePdfTaskTypes=j;exports.CustomControl=Pe;exports.Dataview=ye;exports.DocumentConvertTaskTypes=h;exports.Input=Ee;exports.Panel=Be;exports.Text=Re;exports.ValueComponent=_e;exports.WatermarkHorizontalAlignment=W;exports.WatermarkVerticalAlignment=ee;exports.configuratorIsInIFrame=Ce;exports.convertDocument=se;exports.createPdfFromAssets=ie;exports.createSyncCmpValuesStore=ge;exports.finishConfiguration=ce;exports.fireAnalyticsEvent=fe;exports.getAssetPaths=re;exports.getParentPageUrl=me;exports.navigateToLogin=he;exports.onAnyCmpValueChanged=de;exports.redirectParentPage=be;exports.sendCustomMsgToParentPage=pe;exports.setConfiguratorIFrameSize=le;exports.shareConfiguration=ue;exports.uploadFiles=ne;exports.uploadImages=te;exports.version=N;
|
|
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;
|
package/dist/bundle.es.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
var te = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var D = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
5
|
var ne = (e, n, t) => n in e ? te(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
6
|
-
var d = (e, n, t) => ne(e, typeof n != "symbol" ? n + "" : n, t),
|
|
7
|
-
var i = (e, n, t) => (
|
|
6
|
+
var d = (e, n, t) => ne(e, typeof n != "symbol" ? n + "" : n, t), j = (e, n, t) => n.has(e) || D("Cannot " + t);
|
|
7
|
+
var i = (e, n, t) => (j(e, n, "read from private field"), t ? t.call(e) : n.get(e)), a = (e, n, t) => n.has(e) ? D("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), l = (e, n, t, s) => (j(e, n, "write to private field"), s ? s.call(e, t) : n.set(e, t), t);
|
|
8
8
|
import { z as r } from "zod";
|
|
9
|
-
const
|
|
10
|
-
var
|
|
11
|
-
class
|
|
9
|
+
const Q = "0.0.1-alpha12";
|
|
10
|
+
var O, u;
|
|
11
|
+
class Me {
|
|
12
12
|
constructor(n) {
|
|
13
13
|
d(this, "id");
|
|
14
|
-
a(this,
|
|
15
|
-
a(this,
|
|
14
|
+
a(this, O, "v1");
|
|
15
|
+
a(this, u);
|
|
16
16
|
var s, o;
|
|
17
17
|
this.id = n;
|
|
18
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
19
|
-
if (
|
|
18
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, O));
|
|
19
|
+
if (l(this, u, t == null ? void 0 : t.getButtonSdkBridge(this.id)), !i(this, u))
|
|
20
20
|
throw new Error(`Cannot access API for Button "${this.id}".`);
|
|
21
21
|
}
|
|
22
22
|
onRendered(n) {
|
|
23
23
|
var t;
|
|
24
|
-
return ((t = i(this,
|
|
24
|
+
return ((t = i(this, u)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
25
25
|
} };
|
|
26
26
|
}
|
|
27
27
|
onClick(n) {
|
|
28
28
|
var t;
|
|
29
|
-
return ((t = i(this,
|
|
29
|
+
return ((t = i(this, u)) == null ? void 0 : t.addOnClickCallback(n)) ?? { unsubscribe: () => {
|
|
30
30
|
} };
|
|
31
31
|
}
|
|
32
32
|
async setVisible(n) {
|
|
33
33
|
var t;
|
|
34
|
-
await ((t = i(this,
|
|
34
|
+
await ((t = i(this, u)) == null ? void 0 : t.setVisible(n));
|
|
35
35
|
}
|
|
36
36
|
setText(n) {
|
|
37
37
|
var t;
|
|
38
|
-
(t = i(this,
|
|
38
|
+
(t = i(this, u)) == null || t.setText(n);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
class
|
|
41
|
+
O = new WeakMap(), u = new WeakMap();
|
|
42
|
+
var $, m;
|
|
43
|
+
class _e {
|
|
44
44
|
constructor(n) {
|
|
45
45
|
d(this, "id");
|
|
46
|
-
a(this,
|
|
47
|
-
a(this,
|
|
46
|
+
a(this, $, "v1");
|
|
47
|
+
a(this, m);
|
|
48
48
|
var s, o;
|
|
49
49
|
this.id = n;
|
|
50
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
51
|
-
if (
|
|
50
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, $));
|
|
51
|
+
if (l(this, m, t == null ? void 0 : t.getCheckboxSdkBridge(this.id)), !i(this, m))
|
|
52
52
|
throw new Error(`Cannot access API for Checkbox "${this.id}".`);
|
|
53
53
|
}
|
|
54
54
|
onRendered(n) {
|
|
55
55
|
var t;
|
|
56
|
-
return ((t = i(this,
|
|
56
|
+
return ((t = i(this, m)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
57
57
|
} };
|
|
58
58
|
}
|
|
59
59
|
async setVisible(n) {
|
|
60
60
|
var t;
|
|
61
|
-
await ((t = i(this,
|
|
61
|
+
await ((t = i(this, m)) == null ? void 0 : t.setVisible(n));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
class
|
|
64
|
+
$ = new WeakMap(), m = new WeakMap();
|
|
65
|
+
var x, b;
|
|
66
|
+
class Le {
|
|
67
67
|
constructor(n) {
|
|
68
68
|
d(this, "id");
|
|
69
|
-
a(this,
|
|
69
|
+
a(this, x, "v1");
|
|
70
70
|
a(this, b);
|
|
71
71
|
var s, o;
|
|
72
72
|
this.id = n;
|
|
73
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
74
|
-
if (
|
|
73
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, x));
|
|
74
|
+
if (l(this, b, t == null ? void 0 : t.getCollapsibleSdkBridge(this.id)), !i(this, b))
|
|
75
75
|
throw new Error(`Cannot access API for Collapsible "${this.id}".`);
|
|
76
76
|
}
|
|
77
77
|
onRendered(n) {
|
|
@@ -84,17 +84,17 @@ class Me {
|
|
|
84
84
|
await ((t = i(this, b)) == null ? void 0 : t.setVisible(n));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
class
|
|
87
|
+
x = new WeakMap(), b = new WeakMap();
|
|
88
|
+
var M, c;
|
|
89
|
+
class Ue {
|
|
90
90
|
constructor(n) {
|
|
91
91
|
d(this, "id");
|
|
92
|
-
a(this,
|
|
92
|
+
a(this, M, "v1");
|
|
93
93
|
a(this, c);
|
|
94
94
|
var s, o;
|
|
95
95
|
this.id = n;
|
|
96
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
97
|
-
if (
|
|
96
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, M));
|
|
97
|
+
if (l(this, c, t == null ? void 0 : t.getCustomCtrlSdkBridge(this.id)), !i(this, c))
|
|
98
98
|
throw new Error(`Cannot access API for Custom Control "${this.id}".`);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -172,169 +172,169 @@ class _e {
|
|
|
172
172
|
await ((t = i(this, c)) == null ? void 0 : t.setVisible(n));
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
class
|
|
175
|
+
M = new WeakMap(), c = new WeakMap();
|
|
176
|
+
var _, f;
|
|
177
|
+
class Ne {
|
|
178
178
|
constructor(n) {
|
|
179
179
|
d(this, "id");
|
|
180
|
-
a(this,
|
|
181
|
-
a(this,
|
|
180
|
+
a(this, _, "v1");
|
|
181
|
+
a(this, f);
|
|
182
182
|
var s, o;
|
|
183
183
|
this.id = n;
|
|
184
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
185
|
-
if (
|
|
184
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, _));
|
|
185
|
+
if (l(this, f, t == null ? void 0 : t.getDataviewSdkBridge(this.id)), !i(this, f))
|
|
186
186
|
throw new Error(`Cannot access API for Dataview "${this.id}".`);
|
|
187
187
|
}
|
|
188
188
|
onRendered(n) {
|
|
189
189
|
var t;
|
|
190
|
-
return ((t = i(this,
|
|
190
|
+
return ((t = i(this, f)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
191
191
|
} };
|
|
192
192
|
}
|
|
193
193
|
async setVisible(n) {
|
|
194
194
|
var t;
|
|
195
|
-
await ((t = i(this,
|
|
195
|
+
await ((t = i(this, f)) == null ? void 0 : t.setVisible(n));
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
var
|
|
200
|
-
class
|
|
198
|
+
_ = new WeakMap(), f = new WeakMap();
|
|
199
|
+
var L, w;
|
|
200
|
+
class Ze {
|
|
201
201
|
constructor(n) {
|
|
202
202
|
d(this, "id");
|
|
203
|
-
a(this,
|
|
204
|
-
a(this,
|
|
203
|
+
a(this, L, "v1");
|
|
204
|
+
a(this, w);
|
|
205
205
|
var s, o;
|
|
206
206
|
this.id = n;
|
|
207
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
208
|
-
if (
|
|
207
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, L));
|
|
208
|
+
if (l(this, w, t == null ? void 0 : t.getInputSdkBridge(this.id)), !i(this, w))
|
|
209
209
|
throw new Error(`Cannot access API for Input "${this.id}".`);
|
|
210
210
|
}
|
|
211
211
|
onRendered(n) {
|
|
212
212
|
var t;
|
|
213
|
-
return ((t = i(this,
|
|
213
|
+
return ((t = i(this, w)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
214
214
|
} };
|
|
215
215
|
}
|
|
216
216
|
async setVisible(n) {
|
|
217
217
|
var t;
|
|
218
|
-
await ((t = i(this,
|
|
218
|
+
await ((t = i(this, w)) == null ? void 0 : t.setVisible(n));
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
var
|
|
223
|
-
class
|
|
221
|
+
L = new WeakMap(), w = new WeakMap();
|
|
222
|
+
var U, A;
|
|
223
|
+
class ze {
|
|
224
224
|
constructor(n) {
|
|
225
225
|
d(this, "id");
|
|
226
|
-
a(this,
|
|
227
|
-
a(this,
|
|
226
|
+
a(this, U, "v1");
|
|
227
|
+
a(this, A);
|
|
228
228
|
var s, o;
|
|
229
229
|
this.id = n;
|
|
230
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
231
|
-
if (
|
|
230
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, U));
|
|
231
|
+
if (l(this, A, t == null ? void 0 : t.getPanelSdkBridge(this.id)), !i(this, A))
|
|
232
232
|
throw new Error(`Cannot access API for Panel "${this.id}".`);
|
|
233
233
|
}
|
|
234
234
|
onRendered(n) {
|
|
235
235
|
var t;
|
|
236
|
-
return ((t = i(this,
|
|
236
|
+
return ((t = i(this, A)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
237
237
|
} };
|
|
238
238
|
}
|
|
239
239
|
async setVisible(n) {
|
|
240
240
|
var t;
|
|
241
|
-
await ((t = i(this,
|
|
241
|
+
await ((t = i(this, A)) == null ? void 0 : t.setVisible(n));
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
var
|
|
246
|
-
class
|
|
244
|
+
U = new WeakMap(), A = new WeakMap();
|
|
245
|
+
var N, h;
|
|
246
|
+
class De {
|
|
247
247
|
constructor(n) {
|
|
248
248
|
d(this, "id");
|
|
249
|
-
a(this,
|
|
250
|
-
a(this,
|
|
249
|
+
a(this, N, "v1");
|
|
250
|
+
a(this, h);
|
|
251
251
|
var s, o;
|
|
252
252
|
this.id = n;
|
|
253
|
-
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this,
|
|
254
|
-
if (
|
|
253
|
+
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, N));
|
|
254
|
+
if (l(this, h, t == null ? void 0 : t.getTextSdkBridge(this.id)), !i(this, h))
|
|
255
255
|
throw new Error(`Cannot access API for Text "${this.id}".`);
|
|
256
256
|
}
|
|
257
257
|
onRendered(n) {
|
|
258
258
|
var t;
|
|
259
|
-
return ((t = i(this,
|
|
259
|
+
return ((t = i(this, h)) == null ? void 0 : t.addOnRenderedCallback(n)) ?? { unsubscribe: () => {
|
|
260
260
|
} };
|
|
261
261
|
}
|
|
262
262
|
async setVisible(n) {
|
|
263
263
|
var t;
|
|
264
|
-
await ((t = i(this,
|
|
264
|
+
await ((t = i(this, h)) == null ? void 0 : t.setVisible(n));
|
|
265
265
|
}
|
|
266
266
|
setText(n) {
|
|
267
267
|
var t;
|
|
268
|
-
(t = i(this,
|
|
268
|
+
(t = i(this, h)) == null || t.setText(n);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
|
|
272
|
-
const
|
|
271
|
+
N = new WeakMap(), h = new WeakMap();
|
|
272
|
+
const K = 1, T = [];
|
|
273
273
|
function se(e, n) {
|
|
274
|
-
if (
|
|
275
|
-
throw new Error(`Only ${
|
|
276
|
-
|
|
274
|
+
if (T.length >= K)
|
|
275
|
+
throw new Error(`Only ${K} \`ConfiguratorClient\` can be created at a time.`);
|
|
276
|
+
T.push({ client: e, internals: n });
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
const e =
|
|
278
|
+
function G() {
|
|
279
|
+
const e = T[0];
|
|
280
280
|
if (!e)
|
|
281
281
|
throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");
|
|
282
282
|
return e.client;
|
|
283
283
|
}
|
|
284
284
|
function ie() {
|
|
285
|
-
const e =
|
|
285
|
+
const e = T[0];
|
|
286
286
|
if (!e)
|
|
287
287
|
throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");
|
|
288
288
|
return e.internals;
|
|
289
289
|
}
|
|
290
290
|
const oe = "v1";
|
|
291
|
-
var
|
|
292
|
-
const
|
|
293
|
-
if (!
|
|
291
|
+
var v, X;
|
|
292
|
+
const P = (X = (v = window.Cbn) == null ? void 0 : v.getCustomCodeSdkBridge) == null ? void 0 : X.call(v, "v1");
|
|
293
|
+
if (!P)
|
|
294
294
|
throw new Error(
|
|
295
295
|
"Cannot access Configurator SDK bridge. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator."
|
|
296
296
|
);
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
297
|
+
const q = P.createCfgrClient(oe, se);
|
|
298
|
+
if (!q)
|
|
299
299
|
throw new Error(
|
|
300
300
|
"Cannot create Configurator Client. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator."
|
|
301
301
|
);
|
|
302
|
-
const
|
|
303
|
-
var
|
|
304
|
-
const
|
|
305
|
-
async function
|
|
306
|
-
const o = n.length > 1, k = "MergeTask",
|
|
307
|
-
(
|
|
308
|
-
type:
|
|
309
|
-
name: `${
|
|
302
|
+
const V = P.getParentPageUtilsSdkBridge(), g = P.getCfgrUtilsSdkBridge(), re = P.getViewer3dSdkBridge(), F = q;
|
|
303
|
+
var R = /* @__PURE__ */ ((e) => (e[e.Any = 1] = "Any", e[e.Image = 2] = "Image", e))(R || {}), p = /* @__PURE__ */ ((e) => (e[e.PdfAsset = 0] = "PdfAsset", e[e.Asset = 1] = "Asset", e[e.Merge = 2] = "Merge", e[e.OutputToCfgnFile = 4] = "OutputToCfgnFile", e))(p || {}), Y = ((e) => (e[e.PdfAsset = p.PdfAsset] = "PdfAsset", e[e.Asset = p.Asset] = "Asset", e))(Y || {});
|
|
304
|
+
const ae = (e) => g.uploadCfgnFiles(e, R.Image), de = (e) => g.uploadCfgnFiles(e, R.Any), ce = (e) => g.uploadTempCfgnFiles(e, R.Image), le = (e) => g.uploadTempCfgnFiles(e, R.Any), ue = (e) => g.convertDocument(e);
|
|
305
|
+
async function ge(e, n, t, s) {
|
|
306
|
+
const o = n.length > 1, k = "MergeTask", I = "Task_", E = n.map(
|
|
307
|
+
(C, z) => C.type === Y.PdfAsset ? {
|
|
308
|
+
type: p.PdfAsset,
|
|
309
|
+
name: `${I}${z}`,
|
|
310
310
|
bundleAliasName: e,
|
|
311
|
-
assetPath:
|
|
312
|
-
context:
|
|
311
|
+
assetPath: C.assetPath,
|
|
312
|
+
context: C.context
|
|
313
313
|
} : {
|
|
314
|
-
type:
|
|
315
|
-
name: `${
|
|
314
|
+
type: p.Asset,
|
|
315
|
+
name: `${I}${z}`,
|
|
316
316
|
bundleAliasName: e,
|
|
317
|
-
assetPath:
|
|
317
|
+
assetPath: C.assetPath
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
return o &&
|
|
321
|
-
type:
|
|
320
|
+
return o && E.push({
|
|
321
|
+
type: p.Merge,
|
|
322
322
|
name: k,
|
|
323
|
-
inputTaskNames:
|
|
324
|
-
}),
|
|
325
|
-
type:
|
|
326
|
-
inputTaskName: o ? k :
|
|
323
|
+
inputTaskNames: E.map((C) => C.name)
|
|
324
|
+
}), E.push({
|
|
325
|
+
type: p.OutputToCfgnFile,
|
|
326
|
+
inputTaskName: o ? k : E[0].name,
|
|
327
327
|
name: "OutputPdfTask",
|
|
328
328
|
cfgnFileExtension: "pdf",
|
|
329
329
|
cfgnFileName: t,
|
|
330
330
|
cfgnFileDisplayName: s
|
|
331
|
-
}),
|
|
331
|
+
}), g.convertDocument(E);
|
|
332
332
|
}
|
|
333
|
-
const
|
|
333
|
+
const Z = {
|
|
334
334
|
Text: "Text",
|
|
335
335
|
Number: "Number",
|
|
336
336
|
Logic: "Logic"
|
|
337
|
-
},
|
|
337
|
+
}, y = {
|
|
338
338
|
ValueComponent: "ValueComponent",
|
|
339
339
|
TableComponent: "TableComponent",
|
|
340
340
|
// TODO WTT: We're not actively supporting the following cmp types (yet). Neither in editor v2, nor in the headless
|
|
@@ -349,7 +349,7 @@ const N = {
|
|
|
349
349
|
ResourceComponent: "ResourceComponent",
|
|
350
350
|
GraphicComponent: "GraphicComponent",
|
|
351
351
|
CheckoutComponent: "CheckoutComponent"
|
|
352
|
-
},
|
|
352
|
+
}, B = {
|
|
353
353
|
ValueEditor: "ValueEditor",
|
|
354
354
|
TableEditor: "TableEditor",
|
|
355
355
|
Fiber: "Fiber",
|
|
@@ -357,38 +357,38 @@ const N = {
|
|
|
357
357
|
CfgrField: "CfgrField"
|
|
358
358
|
};
|
|
359
359
|
r.enum([
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
360
|
+
B.ValueEditor,
|
|
361
|
+
B.TableEditor,
|
|
362
|
+
B.Fiber,
|
|
363
|
+
B.FiberEditor,
|
|
364
|
+
B.CfgrField
|
|
365
365
|
]);
|
|
366
366
|
r.union([r.string(), r.number(), r.boolean()]);
|
|
367
|
-
const
|
|
367
|
+
const S = (e) => typeof e == "string";
|
|
368
368
|
r.string();
|
|
369
|
-
r.enum([
|
|
369
|
+
r.enum([Z.Text, Z.Number, Z.Logic]);
|
|
370
370
|
r.string();
|
|
371
|
-
r.custom((e) =>
|
|
372
|
-
const
|
|
371
|
+
r.custom((e) => S(e) && e.toLowerCase() === e);
|
|
372
|
+
const J = (e) => (e == null ? void 0 : e.toLowerCase()) ?? "";
|
|
373
373
|
r.string();
|
|
374
|
-
const
|
|
375
|
-
(e) =>
|
|
376
|
-
), le = r.custom(
|
|
377
|
-
(e) => y(e) ? new RegExp(`^${B.RecordComponent}<.*>$`).test(e) : !1
|
|
374
|
+
const Ce = r.custom(
|
|
375
|
+
(e) => S(e) ? new RegExp(`^${y.ValueComponent}<.*>$`).test(e) : !1
|
|
378
376
|
), he = r.custom(
|
|
379
|
-
(e) =>
|
|
377
|
+
(e) => S(e) ? new RegExp(`^${y.RecordComponent}<.*>$`).test(e) : !1
|
|
380
378
|
), pe = r.custom(
|
|
381
|
-
(e) =>
|
|
379
|
+
(e) => S(e) ? new RegExp(`^${y.ResourceComponent}<.*>$`).test(e) : !1
|
|
380
|
+
), me = r.custom(
|
|
381
|
+
(e) => S(e) ? new RegExp(`^${y.TableComponent}<.*>$`).test(e) : !1
|
|
382
382
|
);
|
|
383
383
|
r.union([
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
le,
|
|
384
|
+
Ce,
|
|
385
|
+
me,
|
|
387
386
|
he,
|
|
388
|
-
|
|
389
|
-
r.literal(
|
|
387
|
+
pe,
|
|
388
|
+
r.literal(y.GraphicComponent),
|
|
389
|
+
r.literal(y.CheckoutComponent)
|
|
390
390
|
]);
|
|
391
|
-
const
|
|
391
|
+
const W = r.union([r.string(), r.number(), r.boolean()]), be = r.union([W, r.array(W), r.object({}), r.unknown()]), fe = r.object({
|
|
392
392
|
$typ: r.literal("Error"),
|
|
393
393
|
// TODO WTT: Introduce more specific typing here for known error IDs etc.? Maybe in combination w/ some server
|
|
394
394
|
// generated enum?
|
|
@@ -402,29 +402,29 @@ const z = r.union([r.string(), r.number(), r.boolean()]), be = r.union([z, r.arr
|
|
|
402
402
|
*/
|
|
403
403
|
route: r.unknown().optional()
|
|
404
404
|
});
|
|
405
|
-
|
|
406
|
-
const
|
|
407
|
-
function
|
|
408
|
-
const n =
|
|
409
|
-
|
|
405
|
+
fe.or(be);
|
|
406
|
+
const H = /* @__PURE__ */ new Map();
|
|
407
|
+
function we(e) {
|
|
408
|
+
const n = J(e.name);
|
|
409
|
+
H.has(n) || H.set(n, e);
|
|
410
410
|
}
|
|
411
411
|
class je {
|
|
412
412
|
constructor(n, t) {
|
|
413
413
|
d(this, "name");
|
|
414
414
|
d(this, "zodType");
|
|
415
|
-
this.name = n, this.zodType = t,
|
|
415
|
+
this.name = n, this.zodType = t, we(this);
|
|
416
416
|
}
|
|
417
417
|
/**
|
|
418
418
|
* Function for receiving the value of a component.
|
|
419
419
|
*/
|
|
420
420
|
async getValue() {
|
|
421
|
-
return await
|
|
421
|
+
return await G().getCmpValue(this.name);
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
424
424
|
* Sends the ChangeConfigurationValue request to the server
|
|
425
425
|
*/
|
|
426
426
|
async setInput(n) {
|
|
427
|
-
const t =
|
|
427
|
+
const t = J(this.name);
|
|
428
428
|
await ie().setCmpInput(t, n, this.zodType);
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
@@ -437,79 +437,83 @@ class je {
|
|
|
437
437
|
* The function can decide on whether the listener is called or not by returning true or false.
|
|
438
438
|
*/
|
|
439
439
|
onValueChanged(n, t = !1, s) {
|
|
440
|
-
|
|
440
|
+
G().onCmpValueChanged(this.name, n, s, t);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
const
|
|
443
|
+
const Ae = () => g.getAssetPaths();
|
|
444
444
|
var ee = /* @__PURE__ */ ((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))(ee || {});
|
|
445
|
-
const
|
|
446
|
-
if (await
|
|
445
|
+
const Ve = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=", ke = F.onAnyCmpValueChanged.bind(F), Ie = async (e) => {
|
|
446
|
+
if (await F.finishConfiguration(e == null ? void 0 : e.input), e.sendDataToParentPage) {
|
|
447
447
|
const n = e.transformParentPageData();
|
|
448
|
-
await
|
|
448
|
+
await V.sendConfigurationFinished(n);
|
|
449
449
|
}
|
|
450
450
|
}, Ee = async (e) => {
|
|
451
|
-
const n = ee[e.platform], t = e.imageUrl ??
|
|
452
|
-
await
|
|
453
|
-
const { shareUrl: k, shareConfigurationId:
|
|
454
|
-
return { shareUrl: k, shareConfigurationId:
|
|
455
|
-
},
|
|
451
|
+
const n = ee[e.platform], t = e.imageUrl ?? Ve, s = { ...e, platform: n, imageUrl: t }, o = await F.shareConfiguration(s);
|
|
452
|
+
await g.openShareWindow(e.platform, o);
|
|
453
|
+
const { shareUrl: k, shareConfigurationId: I } = o;
|
|
454
|
+
return { shareUrl: k, shareConfigurationId: I };
|
|
455
|
+
}, ye = () => V.isInIFrame(), Be = (e) => V.setIFrameSize(e), Pe = (e) => g.navigateToLogin(e), Re = async (e) => {
|
|
456
456
|
const { promise: n, resolve: t } = Promise.withResolvers(), s = {};
|
|
457
457
|
for (const [o, k] of Object.entries(e))
|
|
458
|
-
k.onValueChanged((
|
|
459
|
-
s[o] =
|
|
458
|
+
k.onValueChanged((I) => {
|
|
459
|
+
s[o] = I, Object.keys(e).every((C) => C in s) && t(s);
|
|
460
460
|
}, !0);
|
|
461
461
|
return n;
|
|
462
|
-
},
|
|
462
|
+
}, Se = (e, n) => V.sendCustomMsg(e, n), ve = (e) => V.redirectParentPage(e), Te = () => V.getParentPageUrl(), Fe = (e, n) => V.fireAnalyticsEvent(e, n), Oe = async (e, n) => re.createArPage(e, n), Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
463
463
|
__proto__: null,
|
|
464
|
-
configuratorIsInIFrame:
|
|
464
|
+
configuratorIsInIFrame: ye,
|
|
465
465
|
convertDocument: ue,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
createArPage: Oe,
|
|
467
|
+
createPdfFromAssets: ge,
|
|
468
|
+
createSyncCmpValuesStore: Re,
|
|
469
|
+
finishConfiguration: Ie,
|
|
469
470
|
fireAnalyticsEvent: Fe,
|
|
470
|
-
getAssetPaths:
|
|
471
|
-
getParentPageUrl:
|
|
472
|
-
navigateToLogin:
|
|
473
|
-
onAnyCmpValueChanged:
|
|
474
|
-
redirectParentPage:
|
|
475
|
-
sendCustomMsgToParentPage:
|
|
476
|
-
setConfiguratorIFrameSize:
|
|
471
|
+
getAssetPaths: Ae,
|
|
472
|
+
getParentPageUrl: Te,
|
|
473
|
+
navigateToLogin: Pe,
|
|
474
|
+
onAnyCmpValueChanged: ke,
|
|
475
|
+
redirectParentPage: ve,
|
|
476
|
+
sendCustomMsgToParentPage: Se,
|
|
477
|
+
setConfiguratorIFrameSize: Be,
|
|
477
478
|
shareConfiguration: Ee,
|
|
478
|
-
uploadFiles:
|
|
479
|
-
uploadImages:
|
|
480
|
-
|
|
479
|
+
uploadFiles: de,
|
|
480
|
+
uploadImages: ae,
|
|
481
|
+
uploadTempFiles: le,
|
|
482
|
+
uploadTempImages: ce,
|
|
483
|
+
version: Q
|
|
481
484
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
482
|
-
console.log(`Loading custom code SDK v${
|
|
485
|
+
console.log(`Loading custom code SDK v${Q}`);
|
|
483
486
|
export {
|
|
484
|
-
|
|
487
|
+
Me as Button,
|
|
485
488
|
Ke as CbnSdk,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
489
|
+
_e as Checkbox,
|
|
490
|
+
Le as Collapsible,
|
|
491
|
+
Y as CreatePdfTaskTypes,
|
|
492
|
+
Ue as CustomControl,
|
|
493
|
+
Ne as Dataview,
|
|
494
|
+
p as DocumentConvertTaskTypes,
|
|
495
|
+
Ze as Input,
|
|
496
|
+
ze as Panel,
|
|
497
|
+
De as Text,
|
|
495
498
|
je as ValueComponent,
|
|
496
|
-
|
|
497
|
-
ae as WatermarkVerticalAlignment,
|
|
498
|
-
Be as configuratorIsInIFrame,
|
|
499
|
+
ye as configuratorIsInIFrame,
|
|
499
500
|
ue as convertDocument,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
501
|
+
Oe as createArPage,
|
|
502
|
+
ge as createPdfFromAssets,
|
|
503
|
+
Re as createSyncCmpValuesStore,
|
|
504
|
+
Ie as finishConfiguration,
|
|
503
505
|
Fe as fireAnalyticsEvent,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
Ae as getAssetPaths,
|
|
507
|
+
Te as getParentPageUrl,
|
|
508
|
+
Pe as navigateToLogin,
|
|
509
|
+
ke as onAnyCmpValueChanged,
|
|
510
|
+
ve as redirectParentPage,
|
|
511
|
+
Se as sendCustomMsgToParentPage,
|
|
512
|
+
Be as setConfiguratorIFrameSize,
|
|
511
513
|
Ee as shareConfiguration,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
514
|
+
de as uploadFiles,
|
|
515
|
+
ae as uploadImages,
|
|
516
|
+
le as uploadTempFiles,
|
|
517
|
+
ce as uploadTempImages,
|
|
518
|
+
Q as version
|
|
515
519
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -34,8 +34,11 @@ export declare namespace CbnSdk {
|
|
|
34
34
|
createSyncCmpValuesStore,
|
|
35
35
|
uploadFiles,
|
|
36
36
|
uploadImages,
|
|
37
|
+
uploadTempFiles,
|
|
38
|
+
uploadTempImages,
|
|
37
39
|
convertDocument,
|
|
38
40
|
createPdfFromAssets,
|
|
41
|
+
createArPage,
|
|
39
42
|
version
|
|
40
43
|
}
|
|
41
44
|
}
|
|
@@ -108,8 +111,7 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
108
111
|
* Create and convert a document (e.g. HTML to PDF).\
|
|
109
112
|
* The conversion consists of multiple individual tasks to allow full flexibility when creating documents.
|
|
110
113
|
*
|
|
111
|
-
* Example case: Create a PDF with dynamic content (PDF asset)
|
|
112
|
-
* and put a watermark on each page.
|
|
114
|
+
* Example case: Create a PDF with dynamic content (PDF asset) and append a static product datasheet.
|
|
113
115
|
*
|
|
114
116
|
* See also {@link createPdfFromAssets} for a simplified version to create a PDF.
|
|
115
117
|
* @param tasks The tasks are executed based on their connection with the properties `name` and `inputTaskName`
|
|
@@ -129,18 +131,9 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
129
131
|
* },
|
|
130
132
|
* },
|
|
131
133
|
* {
|
|
132
|
-
* type: DocumentConvertTaskTypes.Watermark,
|
|
133
|
-
* inputTaskName: 'HtmlToPdfTask',
|
|
134
|
-
* name: 'WatermarkTask',
|
|
135
|
-
* options: {
|
|
136
|
-
* text: 'My Watermark',
|
|
137
|
-
* opacity: 50
|
|
138
|
-
* },
|
|
139
|
-
* },
|
|
140
|
-
* {
|
|
141
134
|
* type: DocumentConvertTaskTypes.OutputToCfgnFile,
|
|
142
135
|
* name: 'OutputPdfTask',
|
|
143
|
-
* inputTaskName: '
|
|
136
|
+
* inputTaskName: 'HtmlToPdfTask',
|
|
144
137
|
* cfgnFileName: 'QuotePdf',
|
|
145
138
|
* cfgnFileExtension: 'pdf',
|
|
146
139
|
* cfgnFileDisplayName: `Your_quote_${new Date().toISOString()}`,
|
|
@@ -150,11 +143,20 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
150
143
|
*/
|
|
151
144
|
export declare const convertDocument: (tasks: DocumentConvertTask[]) => Promise<string | undefined>;
|
|
152
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Uploads the given GLB file to a peristent storage and creates a dedicated page with an AR viewer that loads the GLB.
|
|
148
|
+
*
|
|
149
|
+
* After successful creation, it either redirects to that page or shows a dialog with a QR code linking to that page.
|
|
150
|
+
*
|
|
151
|
+
* Whether it redirects or shows a dialog depends on the browsers capabilities to directly open AR experiences.
|
|
152
|
+
*/
|
|
153
|
+
export declare const createArPage: (glb: File, options?: SdkCreateArPageOptions) => Promise<void>;
|
|
154
|
+
|
|
153
155
|
/**
|
|
154
156
|
* Creates a PDF from one or more assets which will be merged in the given order.
|
|
155
157
|
*
|
|
156
158
|
* Simplified helper built on top of {@link convertDocument}.
|
|
157
|
-
* Use {@link convertDocument} directly for advanced scenarios
|
|
159
|
+
* Use {@link convertDocument} directly for advanced scenarios.
|
|
158
160
|
*
|
|
159
161
|
* @param bundleAliasName Bundle name where the assets are stored
|
|
160
162
|
* @param assetTasks One or more "assets tasks" which will be merged in the given order
|
|
@@ -362,13 +364,6 @@ export declare type DocumentConvertTask = {
|
|
|
362
364
|
name: string;
|
|
363
365
|
/** Names of the tasks which should be merged in the given order */
|
|
364
366
|
inputTaskNames: string[];
|
|
365
|
-
} | {
|
|
366
|
-
type: DocumentConvertTaskTypes.Watermark;
|
|
367
|
-
name: string;
|
|
368
|
-
inputTaskName: string;
|
|
369
|
-
/** Minimum property requirement is either a `text` or a `imageInputTaskName`
|
|
370
|
-
* (which points to a task of type {@link DocumentConvertTaskTypes.Asset}) */
|
|
371
|
-
options: WatermarkImageOptions | WatermarkTextOptions;
|
|
372
367
|
} | {
|
|
373
368
|
type: DocumentConvertTaskTypes.OutputToCfgnFile;
|
|
374
369
|
name: string;
|
|
@@ -383,12 +378,10 @@ export declare type DocumentConvertTask = {
|
|
|
383
378
|
export declare enum DocumentConvertTaskTypes {
|
|
384
379
|
/** Create a PDF with dynamic content based on the given `context` */
|
|
385
380
|
PdfAsset = 0,
|
|
386
|
-
/** Retrieve an asset to be used for suceeding tasks (e.g. static PDF for merge
|
|
381
|
+
/** Retrieve an asset to be used for suceeding tasks (e.g. static PDF for merge) */
|
|
387
382
|
Asset = 1,
|
|
388
383
|
/** Merge multiple input tasks into a single document */
|
|
389
384
|
Merge = 2,
|
|
390
|
-
/** Add a repeating watermark onto the whole document */
|
|
391
|
-
Watermark = 3,
|
|
392
385
|
/** Finalize the conversion by storing it as `Configuration file` */
|
|
393
386
|
OutputToCfgnFile = 4
|
|
394
387
|
}
|
|
@@ -656,10 +649,29 @@ declare type SdkCfgnFileUploadResult<T extends string = string> = {
|
|
|
656
649
|
} | {
|
|
657
650
|
success: true;
|
|
658
651
|
urls: {
|
|
659
|
-
[fileName in T]:
|
|
652
|
+
[fileName in T]: string;
|
|
660
653
|
};
|
|
661
654
|
};
|
|
662
655
|
|
|
656
|
+
declare type SdkCfgnTempFileUploadResult = {
|
|
657
|
+
success: false;
|
|
658
|
+
urls?: never;
|
|
659
|
+
} | {
|
|
660
|
+
success: true;
|
|
661
|
+
urls: string[];
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare type SdkCreateArPageOptions = {
|
|
665
|
+
qrSubTitle?: string;
|
|
666
|
+
qrDescription?: string;
|
|
667
|
+
preparationText?: string;
|
|
668
|
+
popupBlockedTitle?: string;
|
|
669
|
+
popupBlockedDescription?: string;
|
|
670
|
+
popupBlockedLinkText?: string;
|
|
671
|
+
environment?: UrlString;
|
|
672
|
+
loadingScreenImg?: UrlString;
|
|
673
|
+
};
|
|
674
|
+
|
|
663
675
|
/**
|
|
664
676
|
* Send a custom message to the parent page via the "CustomMessage".\
|
|
665
677
|
* The parent page can handle those messages by implementing the function `Combeenation.on{msgName}`.
|
|
@@ -830,19 +842,53 @@ export { Text_2 as Text }
|
|
|
830
842
|
/**
|
|
831
843
|
* Upload one or more files into the current configuration
|
|
832
844
|
*
|
|
845
|
+
* Consider using {@link uploadTempFiles} if the files don't need to be persisted and
|
|
846
|
+
* aren't relevant for the finished configuration.
|
|
847
|
+
*
|
|
833
848
|
* @param files The key represents the name, which can be used in Hive with `configuration.GetFile("")`
|
|
834
849
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
835
850
|
*/
|
|
836
851
|
export declare const uploadFiles: <T extends string>(files: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
837
852
|
|
|
838
853
|
/**
|
|
839
|
-
* Upload one or more images into the current configuration
|
|
854
|
+
* Upload one or more images into the current configuration.
|
|
855
|
+
*
|
|
856
|
+
* Consider using {@link uploadTempImages} if the images don't need to be persisted and
|
|
857
|
+
* aren't relevant for the finished configuration.
|
|
840
858
|
*
|
|
841
|
-
* @param
|
|
859
|
+
* @param images The key represents the name, which can be used in Hive with `configuration.GetImage("")`
|
|
842
860
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
843
861
|
*/
|
|
844
862
|
export declare const uploadImages: <T extends string>(images: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
845
863
|
|
|
864
|
+
/**
|
|
865
|
+
* Upload temporary files into the current configuration. This should only be used for files which don't need to be
|
|
866
|
+
* persisted or aren't relevant for the finished configuration.
|
|
867
|
+
* Examples:
|
|
868
|
+
* - The user can upload multiple files but he still has to apply them on the product in a second step.
|
|
869
|
+
* It's recommended to upload the files as temporary files and only upload them as cfgn files after they were
|
|
870
|
+
* actually applied.
|
|
871
|
+
*
|
|
872
|
+
* @param files files to be uploaded
|
|
873
|
+
* @returns on success it returns the URLs of the uploaded files in the same order as they were provided.
|
|
874
|
+
*/
|
|
875
|
+
export declare const uploadTempFiles: (files: FileOrDataUri[]) => Promise<SdkCfgnTempFileUploadResult>;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Upload temporary images into the current configuration. This should only be used for files which don't need to be
|
|
879
|
+
* persisted or aren't relevant for the finished configuration.
|
|
880
|
+
* Examples:
|
|
881
|
+
* - When creating a PDF with screenshots of the 3d model, the images can be uploaded as temporary files, as they
|
|
882
|
+
* will be embedded in the PDF.
|
|
883
|
+
* - The user can upload multiple images but he still has to apply them on the product in a second step.
|
|
884
|
+
* It's recommended to upload the images as temporary files and only upload them as cfgn files after they were
|
|
885
|
+
* actually applied.
|
|
886
|
+
*
|
|
887
|
+
* @param images images to be uploaded
|
|
888
|
+
* @returns on success it returns the URLs of the uploaded images in the same order as they were provided.
|
|
889
|
+
*/
|
|
890
|
+
export declare const uploadTempImages: (images: FileOrDataUri[]) => Promise<SdkCfgnTempFileUploadResult>;
|
|
891
|
+
|
|
846
892
|
declare type UrlString = z.infer<typeof ZUrlString>;
|
|
847
893
|
|
|
848
894
|
/**
|
|
@@ -874,41 +920,6 @@ export declare class ValueComponent<TName extends CmpName = CmpName, TValue exte
|
|
|
874
920
|
|
|
875
921
|
export declare const version: string;
|
|
876
922
|
|
|
877
|
-
export declare enum WatermarkHorizontalAlignment {
|
|
878
|
-
Left = 0,
|
|
879
|
-
Center = 1,
|
|
880
|
-
Right = 2
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
declare type WatermarkImageOptions = WatermarkOptionsBase & {
|
|
884
|
-
imageInputTaskName: string;
|
|
885
|
-
imageHeight?: number;
|
|
886
|
-
imageWidth?: number;
|
|
887
|
-
text?: never;
|
|
888
|
-
};
|
|
889
|
-
|
|
890
|
-
declare type WatermarkOptionsBase = {
|
|
891
|
-
/** Opacity in % to make the watermark transparent. A value of 100 means it is fully visible. */
|
|
892
|
-
opacity?: number;
|
|
893
|
-
rotation?: number;
|
|
894
|
-
positionVertical?: WatermarkVerticalAlignment;
|
|
895
|
-
positionHorizontal?: WatermarkHorizontalAlignment;
|
|
896
|
-
};
|
|
897
|
-
|
|
898
|
-
declare type WatermarkTextOptions = WatermarkOptionsBase & {
|
|
899
|
-
text: string;
|
|
900
|
-
textFontSize?: number;
|
|
901
|
-
textFontColor?: string;
|
|
902
|
-
textFontName?: string;
|
|
903
|
-
imageInputTaskName?: never;
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
export declare enum WatermarkVerticalAlignment {
|
|
907
|
-
Top = 0,
|
|
908
|
-
Center = 1,
|
|
909
|
-
Bottom = 2
|
|
910
|
-
}
|
|
911
|
-
|
|
912
923
|
declare const ZAssetName: z.ZodString;
|
|
913
924
|
|
|
914
925
|
declare const ZCmpValue: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodUnknown]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combeenation/custom-code-sdk",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-alpha12",
|
|
4
4
|
"description": "Combeenation custom code SDK package",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"pack": "npm run build:clean && npm pack",
|
|
21
21
|
"pub:alpha": "npm run build:clean && npm publish --tag alpha",
|
|
22
22
|
"pub:beta": "npm run build:clean && npm publish --tag beta",
|
|
23
|
-
"pub:final": "npm run build:clean && npm publish",
|
|
23
|
+
"pub:final": "npm run build:clean && npm publish --tag latest",
|
|
24
24
|
"pub:rc": "npm run build:clean && npm publish --tag rc",
|
|
25
25
|
"ts:check": "tsc --noEmit --incremental --preserveWatchOutput --pretty",
|
|
26
26
|
"ts:watch": "npm run ts:check -- --watch"
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@combeenation/configurator-client": "*",
|
|
33
33
|
"@repo/std-configs": "*",
|
|
34
|
+
"@repo/std-lib": "*",
|
|
34
35
|
"typescript": "5.8.2",
|
|
35
36
|
"vite": "6.2.1",
|
|
36
37
|
"vite-plugin-dts": "4.5.4"
|