@combeenation/custom-code-sdk 0.0.1-alpha11 → 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 +169 -167
- package/dist/index.d.ts +51 -61
- package/package.json +3 -2
package/dist/bundle.cjs.js
CHANGED
|
@@ -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"),N="0.0.1-alpha11";var F,g;class ke{constructor(n){d(this,"id");a(this,F,"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,F));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)}}F=new WeakMap,g=new WeakMap;var T,p;class Pe{constructor(n){d(this,"id");a(this,T,"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,T));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))}}T=new WeakMap,p=new WeakMap;var O,b;class Ie{constructor(n){d(this,"id");a(this,O,"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,O));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))}}O=new WeakMap,b=new WeakMap;var $,c;class ye{constructor(n){d(this,"id");a(this,$,"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,$));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))}}$=new WeakMap,c=new WeakMap;var x,m;class Ee{constructor(n){d(this,"id");a(this,x,"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,x));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))}}x=new WeakMap,m=new WeakMap;var M,f;class Be{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.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))}}M=new WeakMap,f=new WeakMap;var L,w;class Se{constructor(n){d(this,"id");a(this,L,"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,L));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))}}L=new WeakMap,w=new WeakMap;var _,l;class ve{constructor(n){d(this,"id");a(this,_,"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,_));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)}}_=new WeakMap,l=new WeakMap;const X=1,R=[];function Re(e,n){if(R.length>=X)throw new Error(`Only ${X} \`ConfiguratorClient\` can be created at a time.`);R.push({client:e,internals:n})}function q(){const e=R[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.client}function ze(){const e=R[0];if(!e)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return e.internals}const Fe="v1";var v,J;const B=(J=(v=window.Cbn)==null?void 0:v.getCustomCodeSdkBridge)==null?void 0:J.call(v,"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 H=B.createCfgrClient(Fe,Re);if(!H)throw new Error("Cannot create Configurator Client. Make sure to only use the `custom-code-sdk` inside a Combeenation Configurator.");const A=B.getParentPageUtilsSdkBridge(),V=B.getCfgrUtilsSdkBridge(),Te=B.getViewer3dSdkBridge(),z=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",P="Task_",I=n.map((C,D)=>C.type===j.PdfAsset?{type:h.PdfAsset,name:`${P}${D}`,bundleAliasName:e,assetPath:C.assetPath,context:C.context}:{type:h.Asset,name:`${P}${D}`,bundleAliasName:e,assetPath:C.assetPath});return o&&I.push({type:h.Merge,name:k,inputTaskNames:I.map(C=>C.name)}),I.push({type:h.OutputToCfgnFile,inputTaskName:o?k:I[0].name,name:"OutputPdfTask",cfgnFileExtension:"pdf",cfgnFileName:t,cfgnFileDisplayName:s}),V.convertDocument(I)}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 S=e=>typeof e=="string";r.z.string();r.z.enum([U.Text,U.Number,U.Logic]);r.z.string();r.z.custom(e=>S(e)&&e.toLowerCase()===e);const oe=e=>(e==null?void 0:e.toLowerCase())??"";r.z.string();const Oe=r.z.custom(e=>S(e)?new RegExp(`^${y.ValueComponent}<.*>$`).test(e):!1),$e=r.z.custom(e=>S(e)?new RegExp(`^${y.RecordComponent}<.*>$`).test(e):!1),xe=r.z.custom(e=>S(e)?new RegExp(`^${y.ResourceComponent}<.*>$`).test(e):!1),Me=r.z.custom(e=>S(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 Q=r.z.union([r.z.string(),r.z.number(),r.z.boolean()]),Le=r.z.union([Q,r.z.array(Q),r.z.object({}),r.z.unknown()]),_e=r.z.object({$typ:r.z.literal("Error"),Id:r.z.string(),Message:r.z.string(),route:r.z.unknown().optional()});_e.or(Le);const Y=new Map;function Ue(e){const n=oe(e.name);Y.has(n)||Y.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 q().getCmpValue(this.name)}async setInput(n){const t=oe(this.name);await ze().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 Ze="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=",de=z.onAnyCmpValueChanged.bind(z),ce=async e=>{if(await z.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??Ze,s={...e,platform:n,imageUrl:t},o=await z.shareConfiguration(s);await V.openShareWindow(e.platform,o);const{shareUrl:k,shareConfigurationId:P}=o;return{shareUrl:k,shareConfigurationId:P}},ge=()=>A.isInIFrame(),Ce=e=>A.setIFrameSize(e),le=e=>V.navigateToLogin(e),he=async e=>{const{promise:n,resolve:t}=Promise.withResolvers(),s={};for(const[o,k]of Object.entries(e))k.onValueChanged(P=>{s[o]=P,Object.keys(e).every(C=>C in s)&&t(s)},!0);return n},pe=(e,n)=>A.sendCustomMsg(e,n),be=e=>A.redirectParentPage(e),me=()=>A.getParentPageUrl(),fe=(e,n)=>A.fireAnalyticsEvent(e,n),we=async(e,n)=>Te.createArPage(e,n),je=Object.freeze(Object.defineProperty({__proto__:null,configuratorIsInIFrame:ge,convertDocument:se,createArPage:we,createPdfFromAssets:ie,createSyncCmpValuesStore:he,finishConfiguration:ce,fireAnalyticsEvent:fe,getAssetPaths:re,getParentPageUrl:me,navigateToLogin:le,onAnyCmpValueChanged:de,redirectParentPage:be,sendCustomMsgToParentPage:pe,setConfiguratorIFrameSize:Ce,shareConfiguration:ue,uploadFiles:ne,uploadImages:te,version:N},Symbol.toStringTag,{value:"Module"}));console.log(`Loading custom code SDK v${N}`);exports.Button=ke;exports.CbnSdk=je;exports.Checkbox=Pe;exports.Collapsible=Ie;exports.CreatePdfTaskTypes=j;exports.CustomControl=ye;exports.Dataview=Ee;exports.DocumentConvertTaskTypes=h;exports.Input=Be;exports.Panel=Se;exports.Text=ve;exports.ValueComponent=Ne;exports.WatermarkHorizontalAlignment=W;exports.WatermarkVerticalAlignment=ee;exports.configuratorIsInIFrame=ge;exports.convertDocument=se;exports.createArPage=we;exports.createPdfFromAssets=ie;exports.createSyncCmpValuesStore=he;exports.finishConfiguration=ce;exports.fireAnalyticsEvent=fe;exports.getAssetPaths=re;exports.getParentPageUrl=me;exports.navigateToLogin=le;exports.onAnyCmpValueChanged=de;exports.redirectParentPage=be;exports.sendCustomMsgToParentPage=pe;exports.setConfiguratorIFrameSize=Ce;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 O,
|
|
9
|
+
const Q = "0.0.1-alpha12";
|
|
10
|
+
var O, u;
|
|
11
11
|
class Me {
|
|
12
12
|
constructor(n) {
|
|
13
13
|
d(this, "id");
|
|
14
14
|
a(this, O, "v1");
|
|
15
|
-
a(this,
|
|
15
|
+
a(this, u);
|
|
16
16
|
var s, o;
|
|
17
17
|
this.id = n;
|
|
18
18
|
const t = (o = (s = window.Cbn) == null ? void 0 : s.getCustomCodeSdkBridge) == null ? void 0 : o.call(s, i(this, O));
|
|
19
|
-
if (
|
|
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
|
-
O = new WeakMap(),
|
|
42
|
-
var
|
|
41
|
+
O = new WeakMap(), u = new WeakMap();
|
|
42
|
+
var $, m;
|
|
43
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
|
|
64
|
+
$ = new WeakMap(), m = new WeakMap();
|
|
65
|
+
var x, b;
|
|
66
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 Le {
|
|
|
84
84
|
await ((t = i(this, b)) == null ? void 0 : t.setVisible(n));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
var
|
|
87
|
+
x = new WeakMap(), b = new WeakMap();
|
|
88
|
+
var M, c;
|
|
89
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 Ue {
|
|
|
172
172
|
await ((t = i(this, c)) == null ? void 0 : t.setVisible(n));
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
var
|
|
175
|
+
M = new WeakMap(), c = new WeakMap();
|
|
176
|
+
var _, f;
|
|
177
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
|
|
198
|
+
_ = new WeakMap(), f = new WeakMap();
|
|
199
|
+
var L, w;
|
|
200
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
|
|
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
305
|
async function ge(e, n, t, s) {
|
|
306
|
-
const o = n.length > 1, k = "MergeTask",
|
|
307
|
-
(
|
|
308
|
-
type:
|
|
309
|
-
name: `${
|
|
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
320
|
return o && E.push({
|
|
321
|
-
type:
|
|
321
|
+
type: p.Merge,
|
|
322
322
|
name: k,
|
|
323
|
-
inputTaskNames: E.map((
|
|
323
|
+
inputTaskNames: E.map((C) => C.name)
|
|
324
324
|
}), E.push({
|
|
325
|
-
type:
|
|
325
|
+
type: p.OutputToCfgnFile,
|
|
326
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) =>
|
|
374
|
+
const Ce = r.custom(
|
|
375
|
+
(e) => S(e) ? new RegExp(`^${y.ValueComponent}<.*>$`).test(e) : !1
|
|
376
376
|
), he = r.custom(
|
|
377
|
-
(e) =>
|
|
377
|
+
(e) => S(e) ? new RegExp(`^${y.RecordComponent}<.*>$`).test(e) : !1
|
|
378
378
|
), pe = r.custom(
|
|
379
|
-
(e) =>
|
|
380
|
-
),
|
|
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
|
-
|
|
384
|
+
Ce,
|
|
385
|
+
me,
|
|
386
386
|
he,
|
|
387
387
|
pe,
|
|
388
|
-
r.literal(
|
|
389
|
-
r.literal(
|
|
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,13 +402,13 @@ const z = r.union([r.string(), r.number(), r.boolean()]), me = r.union([z, r.arr
|
|
|
402
402
|
*/
|
|
403
403
|
route: r.unknown().optional()
|
|
404
404
|
});
|
|
405
|
-
fe.or(
|
|
406
|
-
const
|
|
405
|
+
fe.or(be);
|
|
406
|
+
const H = /* @__PURE__ */ new Map();
|
|
407
407
|
function we(e) {
|
|
408
|
-
const n =
|
|
409
|
-
|
|
408
|
+
const n = J(e.name);
|
|
409
|
+
H.has(n) || H.set(n, e);
|
|
410
410
|
}
|
|
411
|
-
class
|
|
411
|
+
class je {
|
|
412
412
|
constructor(n, t) {
|
|
413
413
|
d(this, "name");
|
|
414
414
|
d(this, "zodType");
|
|
@@ -418,13 +418,13 @@ class De {
|
|
|
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,81 +437,83 @@ class De {
|
|
|
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 Ae = () =>
|
|
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 Ve = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=", ke = F.onAnyCmpValueChanged.bind(F),
|
|
445
|
+
const Ve = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2ZkAAAAASUVORK5CYII=", ke = F.onAnyCmpValueChanged.bind(F), Ie = async (e) => {
|
|
446
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
451
|
const n = ee[e.platform], t = e.imageUrl ?? Ve, s = { ...e, platform: n, imageUrl: t }, o = await F.shareConfiguration(s);
|
|
452
|
-
await
|
|
453
|
-
const { shareUrl: k, shareConfigurationId:
|
|
454
|
-
return { shareUrl: k, shareConfigurationId:
|
|
455
|
-
},
|
|
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
|
-
}, Se = (e, n) =>
|
|
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:
|
|
465
|
-
convertDocument:
|
|
466
|
-
createArPage:
|
|
464
|
+
configuratorIsInIFrame: ye,
|
|
465
|
+
convertDocument: ue,
|
|
466
|
+
createArPage: Oe,
|
|
467
467
|
createPdfFromAssets: ge,
|
|
468
|
-
createSyncCmpValuesStore:
|
|
469
|
-
finishConfiguration:
|
|
470
|
-
fireAnalyticsEvent:
|
|
468
|
+
createSyncCmpValuesStore: Re,
|
|
469
|
+
finishConfiguration: Ie,
|
|
470
|
+
fireAnalyticsEvent: Fe,
|
|
471
471
|
getAssetPaths: Ae,
|
|
472
|
-
getParentPageUrl:
|
|
473
|
-
navigateToLogin:
|
|
472
|
+
getParentPageUrl: Te,
|
|
473
|
+
navigateToLogin: Pe,
|
|
474
474
|
onAnyCmpValueChanged: ke,
|
|
475
475
|
redirectParentPage: ve,
|
|
476
476
|
sendCustomMsgToParentPage: Se,
|
|
477
|
-
setConfiguratorIFrameSize:
|
|
477
|
+
setConfiguratorIFrameSize: Be,
|
|
478
478
|
shareConfiguration: Ee,
|
|
479
|
-
uploadFiles:
|
|
480
|
-
uploadImages:
|
|
481
|
-
|
|
479
|
+
uploadFiles: de,
|
|
480
|
+
uploadImages: ae,
|
|
481
|
+
uploadTempFiles: le,
|
|
482
|
+
uploadTempImages: ce,
|
|
483
|
+
version: Q
|
|
482
484
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
483
|
-
console.log(`Loading custom code SDK v${
|
|
485
|
+
console.log(`Loading custom code SDK v${Q}`);
|
|
484
486
|
export {
|
|
485
487
|
Me as Button,
|
|
486
|
-
|
|
488
|
+
Ke as CbnSdk,
|
|
487
489
|
_e as Checkbox,
|
|
488
490
|
Le as Collapsible,
|
|
489
|
-
|
|
491
|
+
Y as CreatePdfTaskTypes,
|
|
490
492
|
Ue as CustomControl,
|
|
491
493
|
Ne as Dataview,
|
|
492
|
-
|
|
494
|
+
p as DocumentConvertTaskTypes,
|
|
493
495
|
Ze as Input,
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
Ce as convertDocument,
|
|
501
|
-
Te as createArPage,
|
|
496
|
+
ze as Panel,
|
|
497
|
+
De as Text,
|
|
498
|
+
je as ValueComponent,
|
|
499
|
+
ye as configuratorIsInIFrame,
|
|
500
|
+
ue as convertDocument,
|
|
501
|
+
Oe as createArPage,
|
|
502
502
|
ge as createPdfFromAssets,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
503
|
+
Re as createSyncCmpValuesStore,
|
|
504
|
+
Ie as finishConfiguration,
|
|
505
|
+
Fe as fireAnalyticsEvent,
|
|
506
506
|
Ae as getAssetPaths,
|
|
507
|
-
|
|
508
|
-
|
|
507
|
+
Te as getParentPageUrl,
|
|
508
|
+
Pe as navigateToLogin,
|
|
509
509
|
ke as onAnyCmpValueChanged,
|
|
510
510
|
ve as redirectParentPage,
|
|
511
511
|
Se as sendCustomMsgToParentPage,
|
|
512
|
-
|
|
512
|
+
Be as setConfiguratorIFrameSize,
|
|
513
513
|
Ee as shareConfiguration,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
514
|
+
de as uploadFiles,
|
|
515
|
+
ae as uploadImages,
|
|
516
|
+
le as uploadTempFiles,
|
|
517
|
+
ce as uploadTempImages,
|
|
518
|
+
Q as version
|
|
517
519
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export declare namespace CbnSdk {
|
|
|
34
34
|
createSyncCmpValuesStore,
|
|
35
35
|
uploadFiles,
|
|
36
36
|
uploadImages,
|
|
37
|
+
uploadTempFiles,
|
|
38
|
+
uploadTempImages,
|
|
37
39
|
convertDocument,
|
|
38
40
|
createPdfFromAssets,
|
|
39
41
|
createArPage,
|
|
@@ -109,8 +111,7 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
109
111
|
* Create and convert a document (e.g. HTML to PDF).\
|
|
110
112
|
* The conversion consists of multiple individual tasks to allow full flexibility when creating documents.
|
|
111
113
|
*
|
|
112
|
-
* Example case: Create a PDF with dynamic content (PDF asset)
|
|
113
|
-
* and put a watermark on each page.
|
|
114
|
+
* Example case: Create a PDF with dynamic content (PDF asset) and append a static product datasheet.
|
|
114
115
|
*
|
|
115
116
|
* See also {@link createPdfFromAssets} for a simplified version to create a PDF.
|
|
116
117
|
* @param tasks The tasks are executed based on their connection with the properties `name` and `inputTaskName`
|
|
@@ -130,18 +131,9 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
130
131
|
* },
|
|
131
132
|
* },
|
|
132
133
|
* {
|
|
133
|
-
* type: DocumentConvertTaskTypes.Watermark,
|
|
134
|
-
* inputTaskName: 'HtmlToPdfTask',
|
|
135
|
-
* name: 'WatermarkTask',
|
|
136
|
-
* options: {
|
|
137
|
-
* text: 'My Watermark',
|
|
138
|
-
* opacity: 50
|
|
139
|
-
* },
|
|
140
|
-
* },
|
|
141
|
-
* {
|
|
142
134
|
* type: DocumentConvertTaskTypes.OutputToCfgnFile,
|
|
143
135
|
* name: 'OutputPdfTask',
|
|
144
|
-
* inputTaskName: '
|
|
136
|
+
* inputTaskName: 'HtmlToPdfTask',
|
|
145
137
|
* cfgnFileName: 'QuotePdf',
|
|
146
138
|
* cfgnFileExtension: 'pdf',
|
|
147
139
|
* cfgnFileDisplayName: `Your_quote_${new Date().toISOString()}`,
|
|
@@ -164,7 +156,7 @@ export declare const createArPage: (glb: File, options?: SdkCreateArPageOptions)
|
|
|
164
156
|
* Creates a PDF from one or more assets which will be merged in the given order.
|
|
165
157
|
*
|
|
166
158
|
* Simplified helper built on top of {@link convertDocument}.
|
|
167
|
-
* Use {@link convertDocument} directly for advanced scenarios
|
|
159
|
+
* Use {@link convertDocument} directly for advanced scenarios.
|
|
168
160
|
*
|
|
169
161
|
* @param bundleAliasName Bundle name where the assets are stored
|
|
170
162
|
* @param assetTasks One or more "assets tasks" which will be merged in the given order
|
|
@@ -372,13 +364,6 @@ export declare type DocumentConvertTask = {
|
|
|
372
364
|
name: string;
|
|
373
365
|
/** Names of the tasks which should be merged in the given order */
|
|
374
366
|
inputTaskNames: string[];
|
|
375
|
-
} | {
|
|
376
|
-
type: DocumentConvertTaskTypes.Watermark;
|
|
377
|
-
name: string;
|
|
378
|
-
inputTaskName: string;
|
|
379
|
-
/** Minimum property requirement is either a `text` or a `imageInputTaskName`
|
|
380
|
-
* (which points to a task of type {@link DocumentConvertTaskTypes.Asset}) */
|
|
381
|
-
options: WatermarkImageOptions | WatermarkTextOptions;
|
|
382
367
|
} | {
|
|
383
368
|
type: DocumentConvertTaskTypes.OutputToCfgnFile;
|
|
384
369
|
name: string;
|
|
@@ -393,12 +378,10 @@ export declare type DocumentConvertTask = {
|
|
|
393
378
|
export declare enum DocumentConvertTaskTypes {
|
|
394
379
|
/** Create a PDF with dynamic content based on the given `context` */
|
|
395
380
|
PdfAsset = 0,
|
|
396
|
-
/** 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) */
|
|
397
382
|
Asset = 1,
|
|
398
383
|
/** Merge multiple input tasks into a single document */
|
|
399
384
|
Merge = 2,
|
|
400
|
-
/** Add a repeating watermark onto the whole document */
|
|
401
|
-
Watermark = 3,
|
|
402
385
|
/** Finalize the conversion by storing it as `Configuration file` */
|
|
403
386
|
OutputToCfgnFile = 4
|
|
404
387
|
}
|
|
@@ -666,10 +649,18 @@ declare type SdkCfgnFileUploadResult<T extends string = string> = {
|
|
|
666
649
|
} | {
|
|
667
650
|
success: true;
|
|
668
651
|
urls: {
|
|
669
|
-
[fileName in T]:
|
|
652
|
+
[fileName in T]: string;
|
|
670
653
|
};
|
|
671
654
|
};
|
|
672
655
|
|
|
656
|
+
declare type SdkCfgnTempFileUploadResult = {
|
|
657
|
+
success: false;
|
|
658
|
+
urls?: never;
|
|
659
|
+
} | {
|
|
660
|
+
success: true;
|
|
661
|
+
urls: string[];
|
|
662
|
+
};
|
|
663
|
+
|
|
673
664
|
declare type SdkCreateArPageOptions = {
|
|
674
665
|
qrSubTitle?: string;
|
|
675
666
|
qrDescription?: string;
|
|
@@ -851,19 +842,53 @@ export { Text_2 as Text }
|
|
|
851
842
|
/**
|
|
852
843
|
* Upload one or more files into the current configuration
|
|
853
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
|
+
*
|
|
854
848
|
* @param files The key represents the name, which can be used in Hive with `configuration.GetFile("")`
|
|
855
849
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
856
850
|
*/
|
|
857
851
|
export declare const uploadFiles: <T extends string>(files: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
858
852
|
|
|
859
853
|
/**
|
|
860
|
-
* 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.
|
|
861
858
|
*
|
|
862
|
-
* @param
|
|
859
|
+
* @param images The key represents the name, which can be used in Hive with `configuration.GetImage("")`
|
|
863
860
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
864
861
|
*/
|
|
865
862
|
export declare const uploadImages: <T extends string>(images: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
866
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
|
+
|
|
867
892
|
declare type UrlString = z.infer<typeof ZUrlString>;
|
|
868
893
|
|
|
869
894
|
/**
|
|
@@ -895,41 +920,6 @@ export declare class ValueComponent<TName extends CmpName = CmpName, TValue exte
|
|
|
895
920
|
|
|
896
921
|
export declare const version: string;
|
|
897
922
|
|
|
898
|
-
export declare enum WatermarkHorizontalAlignment {
|
|
899
|
-
Left = 0,
|
|
900
|
-
Center = 1,
|
|
901
|
-
Right = 2
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
declare type WatermarkImageOptions = WatermarkOptionsBase & {
|
|
905
|
-
imageInputTaskName: string;
|
|
906
|
-
imageHeight?: number;
|
|
907
|
-
imageWidth?: number;
|
|
908
|
-
text?: never;
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
declare type WatermarkOptionsBase = {
|
|
912
|
-
/** Opacity in % to make the watermark transparent. A value of 100 means it is fully visible. */
|
|
913
|
-
opacity?: number;
|
|
914
|
-
rotation?: number;
|
|
915
|
-
positionVertical?: WatermarkVerticalAlignment;
|
|
916
|
-
positionHorizontal?: WatermarkHorizontalAlignment;
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
declare type WatermarkTextOptions = WatermarkOptionsBase & {
|
|
920
|
-
text: string;
|
|
921
|
-
textFontSize?: number;
|
|
922
|
-
textFontColor?: string;
|
|
923
|
-
textFontName?: string;
|
|
924
|
-
imageInputTaskName?: never;
|
|
925
|
-
};
|
|
926
|
-
|
|
927
|
-
export declare enum WatermarkVerticalAlignment {
|
|
928
|
-
Top = 0,
|
|
929
|
-
Center = 1,
|
|
930
|
-
Bottom = 2
|
|
931
|
-
}
|
|
932
|
-
|
|
933
923
|
declare const ZAssetName: z.ZodString;
|
|
934
924
|
|
|
935
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"
|