@spiffcommerce/theme-bridge 1.17.2 → 1.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -595,7 +595,7 @@ function kt(e, ...t) {
|
|
|
595
595
|
asset: void 0
|
|
596
596
|
}));
|
|
597
597
|
}
|
|
598
|
-
const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.
|
|
598
|
+
const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.3", et = "module", tt = {
|
|
599
599
|
build: "tsc && vite build",
|
|
600
600
|
preview: "vite preview",
|
|
601
601
|
dev: "ladle serve",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(d,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(d=typeof globalThis<"u"?globalThis:d||self,k(d.theme={},d.fs,d.path))})(this,function(d,k,x){"use strict";var st=Object.defineProperty;var lt=(d,k,x)=>k in d?st(d,k,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[k]=x;var _e=(d,k,x)=>(lt(d,typeof k!="symbol"?k+"":k,x),x);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),w=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(w||{}),re=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(re||{}),ie=(e=>(e.Object="Object",e.Union="Union",e))(ie||{});function Z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t),schema:t.schema??void 0}}))}function se(e){if(e.type===w.Asset)return e.asset;if(e.type!==w.List&&e.type!==w.Object){if(e.value===void 0)return;if(e.type===w.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===w.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(se);if(e.objectValues)return Z(e.objectValues)}function He(e){return Z(e)}function Ne(e){return Z(e.fields)}function I(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=I(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(o=>I(t[o],t))),n}function le(e){var o;const t={...e,fields:[],customSchemas:(o=e.customSchemas)==null?void 0:o.map(_=>{var i;return{..._,fields:(i=_.fields)==null?void 0:i.map(u=>I(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(I(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Fe(e){return{...e,configurationSchema:le(e.configurationSchema)}}function z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(o=>z(t[o],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(o=>z(t[o],t))),n}function Oe(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(o=>{o.root&&n.push(z(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,ue,D,ce,ae,J,$={},fe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Re(e,t,n){var o,_,i,u={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,o,_,null)}function N(e,t,n,o,_){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ue,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function j(e,t){if(t==null)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?j(e):null}function de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!L.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(L)}function L(){var e,t,n,o,_,i,u,l,c;for(D.sort(J);e=D.shift();)e.__d&&(t=D.length,o=void 0,i=(_=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((o=T({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),K(u,o,_,n.__n,u.ownerSVGElement!==void 0,32&_.__u?[i]:null,l,i??j(_),!!(32&_.__u),c),o.__.__k[o.__i]=o,ke(l,o,c),o.__e!=i&&de(o)),D.length>t&&D.sort(J));L.__r=0}function me(e,t,n,o,_,i,u,l,c,s,p){var r,h,a,y,S,g=o&&o.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(h=a.__i===-1?$:g[a.__i]||$,a.__i=r,K(e,a,h,_,i,u,l,c,s,p),y=a.__e,a.ref&&h.ref!=a.ref&&(h.ref&&X(h.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||h.__k===a.__k?c=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var o,_,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<c;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?N(null,_,null,null,_):Y(_)?N(F,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?N(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,l=Me(_,n,u=o+r,p),_.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i,!1),n[o]=null,p--);if(p)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i))}function ve(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ve(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Me(e,t,n,o){var _=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&_==c.key&&i===c.type)return n;if(o>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&_==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&_==c.key&&i===c.type)return l;l++}}return-1}function ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function R(e,t,n,o,_){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ye(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,i);else{if(_)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function K(e,t,n,o,_,i,u,l,c,s){var p,r,h,a,y,S,g,m,b,E,G,P,Ie,B,oe,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&o[p.__c],E=p?b?b.props.value:p.__:o,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new O(m,E),r.constructor=C,r.render=We),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=T({},r.__s)),T(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,h)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,Ie=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Ie<25);r.state=r.__s,r.getChildContext!=null&&(o=T(T({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,Y(oe=p!=null&&p.type===F&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ae(n.__e,t,n,o,_,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)X(n[o],n[++o],n[++o]);f.__c&&f.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(i){i.call(_)})}catch(i){f.__e(i,_.__v)}})}function Ae(e,t,n,o,_,i,u,l,c){var s,p,r,h,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=_?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),g=n.props||$,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||R(e,s,null,a,_));for(s in m)a=m[s],s=="children"?h=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||R(e,s,a,g[s],_);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),me(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,u,i?i[0]:n.__k&&j(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&R(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&R(e,s,S,g[s],!1))}return e}function X(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function q(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||X(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){f.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&q(o[_],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function We(e,t,n){return this.constructor(e,n)}function Ge(e,t,n){var o,_,i,u;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],K(t,e=(!o&&n||t).__k=Re(F,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?H.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,u),ke(i,e,u)}H=fe.slice,f={__e:function(e,t,n,o){for(var _,i,u;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),u=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),u=_.__d),u)return _.__E=_}catch(l){e=l}throw e}},ue=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),he(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},O.prototype.render=F,D=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var U,v,ee,Ce,te=0,Se=[],M=[],Te=f.__b,Ee=f.__r,xe=f.diffed,we=f.__c,De=f.unmount;function je(e,t){f.__h&&f.__h(v,e,te||t),te=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function Be(e){return te=1,Qe(Pe,e)}function Qe(e,t,n){var o=je(U++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Pe(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],s=o.t(c,l);c!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(l,c,s){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(h){return h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(h){if(h.__N){var a=h.__[0];h.__=h.__N,h.__N=void 0,a!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,_(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Ze(e,t){var n=je(U++,3);!f.__s&&Ye(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Te&&Te(e)},f.__r=function(e){Ee&&Ee(e),U=0;var t=(v=e.__c).__H;t&&(ee===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(ne),t.__h=[],U=0)),ee=v},f.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||Je)(ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{A(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Je(e){var t,n=function(){clearTimeout(o),$e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function A(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ne(e){var t=v;e.__c=e.__(),v=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Ke=0;function Ve(e,t,n,o,_,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ke,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class Xe{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const qe=({context:e})=>{const[t,n]=Be(null);return Ze(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function et(e,t){W=new Xe,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ge(Ve(qe,{context:t}),n)}function tt(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const nt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function ot(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:nt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.17.2",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function rt(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function it(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>_!=null&&_.some(p=>p.filename===s)?null:rt(s,u[s],o)).filter(s=>s!==null):[];_&&l.push(..._);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(x.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}d.AssetType=re,d.CustomSchemaType=ie,d.FieldType=w,d.ThemeFileType=V,d.exampleThemeInstallConfig=tt,d.getDefaultsForSchema=ot,d.setSpiffDevOptions=et,d.spiffThemePlugin=it,d.themeInstallConfigurationFieldsToRecordObject=He,d.themeInstallConfigurationGraphQlToResource=Oe,d.themeInstallConfigurationToRecordObject=Ne,d.themeVersionConfigurationGraphQlToResource=le,d.themeVersionGraphQlToResource=Fe,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(d,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(d=typeof globalThis<"u"?globalThis:d||self,k(d.theme={},d.fs,d.path))})(this,function(d,k,x){"use strict";var st=Object.defineProperty;var lt=(d,k,x)=>k in d?st(d,k,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[k]=x;var _e=(d,k,x)=>(lt(d,typeof k!="symbol"?k+"":k,x),x);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),w=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(w||{}),re=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(re||{}),ie=(e=>(e.Object="Object",e.Union="Union",e))(ie||{});function Z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t),schema:t.schema??void 0}}))}function se(e){if(e.type===w.Asset)return e.asset;if(e.type!==w.List&&e.type!==w.Object){if(e.value===void 0)return;if(e.type===w.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===w.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(se);if(e.objectValues)return Z(e.objectValues)}function He(e){return Z(e)}function Ne(e){return Z(e.fields)}function I(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=I(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(o=>I(t[o],t))),n}function le(e){var o;const t={...e,fields:[],customSchemas:(o=e.customSchemas)==null?void 0:o.map(_=>{var i;return{..._,fields:(i=_.fields)==null?void 0:i.map(u=>I(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(I(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Fe(e){return{...e,configurationSchema:le(e.configurationSchema)}}function z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(o=>z(t[o],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(o=>z(t[o],t))),n}function Oe(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(o=>{o.root&&n.push(z(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,ue,D,ce,ae,J,$={},fe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Re(e,t,n){var o,_,i,u={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,o,_,null)}function N(e,t,n,o,_){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ue,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function j(e,t){if(t==null)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?j(e):null}function de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!L.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(L)}function L(){var e,t,n,o,_,i,u,l,c;for(D.sort(J);e=D.shift();)e.__d&&(t=D.length,o=void 0,i=(_=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((o=T({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),K(u,o,_,n.__n,u.ownerSVGElement!==void 0,32&_.__u?[i]:null,l,i??j(_),!!(32&_.__u),c),o.__.__k[o.__i]=o,ke(l,o,c),o.__e!=i&&de(o)),D.length>t&&D.sort(J));L.__r=0}function me(e,t,n,o,_,i,u,l,c,s,p){var r,h,a,y,S,g=o&&o.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(h=a.__i===-1?$:g[a.__i]||$,a.__i=r,K(e,a,h,_,i,u,l,c,s,p),y=a.__e,a.ref&&h.ref!=a.ref&&(h.ref&&X(h.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||h.__k===a.__k?c=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var o,_,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<c;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?N(null,_,null,null,_):Y(_)?N(F,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?N(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,l=Me(_,n,u=o+r,p),_.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i,!1),n[o]=null,p--);if(p)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i))}function ve(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ve(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Me(e,t,n,o){var _=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&_==c.key&&i===c.type)return n;if(o>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&_==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&_==c.key&&i===c.type)return l;l++}}return-1}function ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function R(e,t,n,o,_){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ye(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,i);else{if(_)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function K(e,t,n,o,_,i,u,l,c,s){var p,r,h,a,y,S,g,m,b,E,G,P,Ie,B,oe,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&o[p.__c],E=p?b?b.props.value:p.__:o,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new O(m,E),r.constructor=C,r.render=We),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=T({},r.__s)),T(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,h)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,Ie=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Ie<25);r.state=r.__s,r.getChildContext!=null&&(o=T(T({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,Y(oe=p!=null&&p.type===F&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ae(n.__e,t,n,o,_,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)X(n[o],n[++o],n[++o]);f.__c&&f.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(i){i.call(_)})}catch(i){f.__e(i,_.__v)}})}function Ae(e,t,n,o,_,i,u,l,c){var s,p,r,h,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=_?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),g=n.props||$,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||R(e,s,null,a,_));for(s in m)a=m[s],s=="children"?h=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||R(e,s,a,g[s],_);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),me(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,u,i?i[0]:n.__k&&j(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&R(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&R(e,s,S,g[s],!1))}return e}function X(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function q(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||X(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){f.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&q(o[_],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function We(e,t,n){return this.constructor(e,n)}function Ge(e,t,n){var o,_,i,u;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],K(t,e=(!o&&n||t).__k=Re(F,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?H.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,u),ke(i,e,u)}H=fe.slice,f={__e:function(e,t,n,o){for(var _,i,u;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),u=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),u=_.__d),u)return _.__E=_}catch(l){e=l}throw e}},ue=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),he(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},O.prototype.render=F,D=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var U,v,ee,Ce,te=0,Se=[],M=[],Te=f.__b,Ee=f.__r,xe=f.diffed,we=f.__c,De=f.unmount;function je(e,t){f.__h&&f.__h(v,e,te||t),te=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function Be(e){return te=1,Qe(Pe,e)}function Qe(e,t,n){var o=je(U++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Pe(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],s=o.t(c,l);c!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(l,c,s){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(h){return h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(h){if(h.__N){var a=h.__[0];h.__=h.__N,h.__N=void 0,a!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,_(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Ze(e,t){var n=je(U++,3);!f.__s&&Ye(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Te&&Te(e)},f.__r=function(e){Ee&&Ee(e),U=0;var t=(v=e.__c).__H;t&&(ee===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(ne),t.__h=[],U=0)),ee=v},f.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||Je)(ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{A(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Je(e){var t,n=function(){clearTimeout(o),$e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function A(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ne(e){var t=v;e.__c=e.__(),v=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Ke=0;function Ve(e,t,n,o,_,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ke,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class Xe{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const qe=({context:e})=>{const[t,n]=Be(null);return Ze(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function et(e,t){W=new Xe,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ge(Ve(qe,{context:t}),n)}function tt(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const nt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function ot(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:nt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.17.3",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function rt(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function it(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>_!=null&&_.some(p=>p.filename===s)?null:rt(s,u[s],o)).filter(s=>s!==null):[];_&&l.push(..._);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(x.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}d.AssetType=re,d.CustomSchemaType=ie,d.FieldType=w,d.ThemeFileType=V,d.exampleThemeInstallConfig=tt,d.getDefaultsForSchema=ot,d.setSpiffDevOptions=et,d.spiffThemePlugin=it,d.themeInstallConfigurationFieldsToRecordObject=He,d.themeInstallConfigurationGraphQlToResource=Oe,d.themeInstallConfigurationToRecordObject=Ne,d.themeVersionConfigurationGraphQlToResource=le,d.themeVersionGraphQlToResource=Fe,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|