@spiffcommerce/theme-bridge 1.14.0 → 1.14.1
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.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ interface ListField extends ConfigurableField, RequiredOption {
|
|
|
142
142
|
/**
|
|
143
143
|
* Defines the configuration schema for the entries in this list.
|
|
144
144
|
*/
|
|
145
|
-
items:
|
|
145
|
+
items: DistributiveOmit<ThemeConfigurationConfigurableFields, "key" | "title" | "description">;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* A collection of any number of different fields.
|
|
@@ -154,6 +154,8 @@ interface ObjectField extends ConfigurableField, RequiredOption {
|
|
|
154
154
|
*/
|
|
155
155
|
fields: ThemeConfigurationSchemaField[];
|
|
156
156
|
}
|
|
157
|
+
/** https://stackoverflow.com/a/57103940/23523714 */
|
|
158
|
+
type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
157
159
|
/**
|
|
158
160
|
* All fields that are configurable by a user in Hub.
|
|
159
161
|
*/
|
package/dist/index.js
CHANGED
|
@@ -551,7 +551,7 @@ function mt(e, ...t) {
|
|
|
551
551
|
asset: void 0
|
|
552
552
|
}));
|
|
553
553
|
}
|
|
554
|
-
const Je = "@spiffcommerce/theme-bridge", Ye = "1.14.
|
|
554
|
+
const Je = "@spiffcommerce/theme-bridge", Ye = "1.14.1", qe = "module", Ke = {
|
|
555
555
|
build: "tsc && vite build",
|
|
556
556
|
preview: "vite preview",
|
|
557
557
|
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(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.theme={},h.fs,h.path))})(this,function(h,k,w){"use strict";var nt=Object.defineProperty;var _t=(h,k,w)=>k in h?nt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):h[k]=w;var ne=(h,k,w)=>(_t(h,typeof k!="symbol"?k+"":k,w),w);var H=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(H||{}),_e=(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))(_e||{}),oe=(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))(oe||{});function B(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=B(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>B(t[_],t))),n}function re(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(B(_,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 He(e){return{...e,configurationSchema:re(e.configurationSchema)}}function Q(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Q(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Q(t[_],t))),n}function Ve(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Q(_,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 V,f,ie,T,se,le,Z,$={},ce=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function ue(e){var t=e.parentNode;t&&t.removeChild(e)}function je(e,t,n){var _,o,i,c={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?V.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,_,o,null)}function I(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ie,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function N(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(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"?D(e):null}function ae(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 ae(e)}}function fe(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!L.__r++||se!==f.debounceRendering)&&((se=f.debounceRendering)||le)(L)}function L(){var e,t,n,_,o,i,c,l,u;for(T.sort(Z);e=T.shift();)e.__d&&(t=T.length,_=void 0,i=(o=(n=e).__v).__e,l=[],u=[],(c=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),J(c,_,o,n.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),u),_.__.__k[_.__i]=_,ye(l,_,u),_.__e!=i&&ae(_)),T.length>t&&T.sort(Z));L.__r=0}function pe(e,t,n,_,o,i,c,l,u,s,p){var r,d,a,y,S,g=_&&_.__k||ce,m=t.length;for(n.__d=u,Ne(n,t,g),u=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?$:g[a.__i]||$,a.__i=r,J(e,a,d,o,i,c,l,u,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&q(d.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||d.__k===a.__k?u=de(a,u,e):typeof a.type=="function"&&a.__d!==void 0?u=a.__d:y&&(u=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=u,n.__e=S}function Ne(e,t,n){var _,o,i,c,l,u=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<u;_++)(o=e.__k[_]=(o=t[_])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):z(o)?I(j,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Le(o,n,c=_+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==c&&(l===c+1?r++:l>c?p>u-c?r+=l-c:r--:r=l<c&&l==c-1?l-c:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i,!1),n[_]=null,p--);if(p)for(_=0;_<s;_++)(i=n[_])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i))}function de(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=de(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Le(e,t,n,_){var o=e.key,i=e.type,c=n-1,l=n+1,u=t[n];if(u===null||u&&o==u.key&&i===u.type)return n;if(_>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||l<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(l<t.length){if((u=t[l])&&!(131072&u.__u)&&o==u.key&&i===u.type)return l;l++}}return-1}function he(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ie.test(t)?n:n+"px"}function F(e,t,n,_,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof _=="string"&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||he(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||he(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?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?ve:me,i)):e.removeEventListener(t,i?ve:me,i);else{if(o)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 me(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 ve(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,n,_,o,i,c,l,u,s){var p,r,d,a,y,S,g,m,b,E,W,P,Pe,O,te,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(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)&&_[p.__c],E=p?b?b.props.value:p.__:_,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 N(m,E),r.constructor=C,r.render=Me),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=_,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=x({},r.__s)),x(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,d)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(G){G&&(G.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);r._sb=[],r.__h.length&&c.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,Pe=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),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);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&&++Pe<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),pe(e,z(te=p!=null&&p.type===j&&p.key==null?p.props.children:p)?te:[te],t,n,_,o,i,c,l,u,s),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(G){t.__v=null,u||i!=null?(t.__e=l,t.__u|=u?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(G,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fe(n.__e,t,n,_,o,i,c,u,s);(p=f.diffed)&&p(t)}function ye(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)q(n[_],n[++_],n[++_]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Fe(e,t,n,_,o,i,c,l,u){var s,p,r,d,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(o=!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=o?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&&V.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||F(e,s,null,a,o));for(s in m)a=m[s],s=="children"?d=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||F(e,s,a,g[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),pe(e,z(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,c,i?i[0]:n.__k&&D(n,0),l,u),i!=null)for(s=i.length;s--;)i[s]!=null&&ue(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&F(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&F(e,s,S,g[s],!1))}return e}function q(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function Y(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||q(_,null,t)),(_=e.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(i){f.__e(i,t)}_.base=_.__P=null,e.__c=void 0}if(_=e.__k)for(o=0;o<_.length;o++)_[o]&&Y(_[o],t,n||typeof e.type!="function");n||e.__e==null||ue(e.__e),e.__=e.__e=e.__d=void 0}function Me(e,t,n){return this.constructor(e,n)}function Ue(e,t,n){var _,o,i,c;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],c=[],J(t,e=(!_&&n||t).__k=je(j,null,[e]),o||$,$,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?V.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,c),ye(i,e,c)}V=ce.slice,f={__e:function(e,t,n,_){for(var o,i,c;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),c=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),c=o.__d),c)return o.__E=o}catch(l){e=l}throw e}},ie=0,N.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=x({},this.state),typeof e=="function"&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fe(this))},N.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fe(this))},N.prototype.render=j,T=[],le=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var M,v,K,ge,X=0,be=[],U=[],ke=f.__b,Ce=f.__r,Se=f.diffed,xe=f.__c,Ee=f.unmount;function we(e,t){f.__h&&f.__h(v,e,X||t),X=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:U}),n.__[e]}function Re(e){return X=1,Ae(De,e)}function Ae(e,t,n){var _=we(M++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):De(void 0,t),function(l){var u=_.__N?_.__N[0]:_.__[0],s=_.t(u,l);u!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,u,s){if(!_.__c.__H)return!0;var p=_.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,u,s);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&_.__c.props===l)&&(!i||i.call(this,l,u,s))};v.u=!0;var i=v.shouldComponentUpdate,c=v.componentWillUpdate;v.componentWillUpdate=function(l,u,s){if(this.__e){var p=i;i=void 0,o(l,u,s),i=p}c&&c.call(this,l,u,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function We(e,t){var n=we(M++,3);!f.__s&&Be(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Oe(){for(var e;e=be.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(R),e.__H.__h.forEach(ee),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,ke&&ke(e)},f.__r=function(e){Ce&&Ce(e),M=0;var t=(v=e.__c).__H;t&&(K===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=U,n.__N=n.i=void 0})):(t.__h.forEach(R),t.__h.forEach(ee),t.__h=[],M=0)),K=v},f.diffed=function(e){Se&&Se(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(be.push(t)!==1&&ge===f.requestAnimationFrame||((ge=f.requestAnimationFrame)||Ge)(Oe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==U&&(n.__=n.__V),n.i=void 0,n.__V=U})),K=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(R),n.__h=n.__h.filter(function(_){return!_.__||ee(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),xe&&xe(e,t)},f.unmount=function(e){Ee&&Ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{R(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var Te=typeof requestAnimationFrame=="function";function Ge(e){var t,n=function(){clearTimeout(_),Te&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);Te&&(t=requestAnimationFrame(n))}function R(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ee(e){var t=v;e.__c=e.__(),v=t}function Be(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function De(e,t){return typeof t=="function"?t(e):t}var Qe=0;function $e(e,t,n,_,o,i){var c,l,u={};for(l in t)l=="ref"?c=t[l]:u[l]=t[l];var s={type:e,props:u,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Qe,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)u[l]===void 0&&(u[l]=c[l]);return f.vnode&&f.vnode(s),s}class Ze{constructor(){ne(this,"_context");ne(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 A;const ze=({context:e})=>{const[t,n]=Re(null);return We(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),$e("div",{ref:n,id:"spiffThemeWrapper"})};function Je(e,t){A=new Ze,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ue($e(ze,{context:t}),n)}function qe(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 Ye=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function Ke(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:Ye(n),type:n.type,asset:void 0}))}const Xe={name:"@spiffcommerce/theme-bridge",version:"1.14.0",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 et(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:H.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:H.CSS,mimeType:"text/css",filename:e};return null}function tt(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:Xe.version,config(i,c){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,c){const l=t?Object.keys(c).map(s=>o!=null&&o.some(p=>p.filename===s)?null:et(s,c[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const u={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}h.AssetType=oe,h.FieldType=_e,h.ThemeFileType=H,h.exampleThemeInstallConfig=qe,h.getDefaultsForSchema=Ke,h.setSpiffDevOptions=Je,h.spiffThemePlugin=tt,h.themeInstallConfigurationGraphQlToResource=Ve,h.themeVersionConfigurationGraphQlToResource=re,h.themeVersionGraphQlToResource=He,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.theme={},h.fs,h.path))})(this,function(h,k,w){"use strict";var nt=Object.defineProperty;var _t=(h,k,w)=>k in h?nt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):h[k]=w;var ne=(h,k,w)=>(_t(h,typeof k!="symbol"?k+"":k,w),w);var H=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(H||{}),_e=(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))(_e||{}),oe=(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))(oe||{});function B(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=B(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>B(t[_],t))),n}function re(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(B(_,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 He(e){return{...e,configurationSchema:re(e.configurationSchema)}}function Q(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Q(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Q(t[_],t))),n}function Ve(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Q(_,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 V,f,ie,T,se,le,Z,$={},ce=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function ue(e){var t=e.parentNode;t&&t.removeChild(e)}function je(e,t,n){var _,o,i,c={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?V.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,_,o,null)}function I(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ie,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function N(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(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"?D(e):null}function ae(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 ae(e)}}function fe(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!L.__r++||se!==f.debounceRendering)&&((se=f.debounceRendering)||le)(L)}function L(){var e,t,n,_,o,i,c,l,u;for(T.sort(Z);e=T.shift();)e.__d&&(t=T.length,_=void 0,i=(o=(n=e).__v).__e,l=[],u=[],(c=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),J(c,_,o,n.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),u),_.__.__k[_.__i]=_,ye(l,_,u),_.__e!=i&&ae(_)),T.length>t&&T.sort(Z));L.__r=0}function pe(e,t,n,_,o,i,c,l,u,s,p){var r,d,a,y,S,g=_&&_.__k||ce,m=t.length;for(n.__d=u,Ne(n,t,g),u=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?$:g[a.__i]||$,a.__i=r,J(e,a,d,o,i,c,l,u,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&q(d.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||d.__k===a.__k?u=de(a,u,e):typeof a.type=="function"&&a.__d!==void 0?u=a.__d:y&&(u=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=u,n.__e=S}function Ne(e,t,n){var _,o,i,c,l,u=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<u;_++)(o=e.__k[_]=(o=t[_])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):z(o)?I(j,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Le(o,n,c=_+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==c&&(l===c+1?r++:l>c?p>u-c?r+=l-c:r--:r=l<c&&l==c-1?l-c:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i,!1),n[_]=null,p--);if(p)for(_=0;_<s;_++)(i=n[_])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i))}function de(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=de(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Le(e,t,n,_){var o=e.key,i=e.type,c=n-1,l=n+1,u=t[n];if(u===null||u&&o==u.key&&i===u.type)return n;if(_>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||l<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(l<t.length){if((u=t[l])&&!(131072&u.__u)&&o==u.key&&i===u.type)return l;l++}}return-1}function he(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ie.test(t)?n:n+"px"}function F(e,t,n,_,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof _=="string"&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||he(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||he(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?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?ve:me,i)):e.removeEventListener(t,i?ve:me,i);else{if(o)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 me(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 ve(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,n,_,o,i,c,l,u,s){var p,r,d,a,y,S,g,m,b,E,W,P,Pe,O,te,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(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)&&_[p.__c],E=p?b?b.props.value:p.__:_,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 N(m,E),r.constructor=C,r.render=Me),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=_,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=x({},r.__s)),x(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,d)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(G){G&&(G.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);r._sb=[],r.__h.length&&c.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,Pe=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),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);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&&++Pe<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),pe(e,z(te=p!=null&&p.type===j&&p.key==null?p.props.children:p)?te:[te],t,n,_,o,i,c,l,u,s),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(G){t.__v=null,u||i!=null?(t.__e=l,t.__u|=u?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(G,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fe(n.__e,t,n,_,o,i,c,u,s);(p=f.diffed)&&p(t)}function ye(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)q(n[_],n[++_],n[++_]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Fe(e,t,n,_,o,i,c,l,u){var s,p,r,d,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(o=!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=o?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&&V.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||F(e,s,null,a,o));for(s in m)a=m[s],s=="children"?d=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||F(e,s,a,g[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),pe(e,z(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,c,i?i[0]:n.__k&&D(n,0),l,u),i!=null)for(s=i.length;s--;)i[s]!=null&&ue(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&F(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&F(e,s,S,g[s],!1))}return e}function q(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function Y(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||q(_,null,t)),(_=e.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(i){f.__e(i,t)}_.base=_.__P=null,e.__c=void 0}if(_=e.__k)for(o=0;o<_.length;o++)_[o]&&Y(_[o],t,n||typeof e.type!="function");n||e.__e==null||ue(e.__e),e.__=e.__e=e.__d=void 0}function Me(e,t,n){return this.constructor(e,n)}function Ue(e,t,n){var _,o,i,c;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],c=[],J(t,e=(!_&&n||t).__k=je(j,null,[e]),o||$,$,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?V.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,c),ye(i,e,c)}V=ce.slice,f={__e:function(e,t,n,_){for(var o,i,c;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),c=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),c=o.__d),c)return o.__E=o}catch(l){e=l}throw e}},ie=0,N.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=x({},this.state),typeof e=="function"&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fe(this))},N.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fe(this))},N.prototype.render=j,T=[],le=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var M,v,K,ge,X=0,be=[],U=[],ke=f.__b,Ce=f.__r,Se=f.diffed,xe=f.__c,Ee=f.unmount;function we(e,t){f.__h&&f.__h(v,e,X||t),X=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:U}),n.__[e]}function Re(e){return X=1,Ae(De,e)}function Ae(e,t,n){var _=we(M++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):De(void 0,t),function(l){var u=_.__N?_.__N[0]:_.__[0],s=_.t(u,l);u!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,u,s){if(!_.__c.__H)return!0;var p=_.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,u,s);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&_.__c.props===l)&&(!i||i.call(this,l,u,s))};v.u=!0;var i=v.shouldComponentUpdate,c=v.componentWillUpdate;v.componentWillUpdate=function(l,u,s){if(this.__e){var p=i;i=void 0,o(l,u,s),i=p}c&&c.call(this,l,u,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function We(e,t){var n=we(M++,3);!f.__s&&Be(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Oe(){for(var e;e=be.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(R),e.__H.__h.forEach(ee),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,ke&&ke(e)},f.__r=function(e){Ce&&Ce(e),M=0;var t=(v=e.__c).__H;t&&(K===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=U,n.__N=n.i=void 0})):(t.__h.forEach(R),t.__h.forEach(ee),t.__h=[],M=0)),K=v},f.diffed=function(e){Se&&Se(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(be.push(t)!==1&&ge===f.requestAnimationFrame||((ge=f.requestAnimationFrame)||Ge)(Oe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==U&&(n.__=n.__V),n.i=void 0,n.__V=U})),K=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(R),n.__h=n.__h.filter(function(_){return!_.__||ee(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),xe&&xe(e,t)},f.unmount=function(e){Ee&&Ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{R(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var Te=typeof requestAnimationFrame=="function";function Ge(e){var t,n=function(){clearTimeout(_),Te&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);Te&&(t=requestAnimationFrame(n))}function R(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ee(e){var t=v;e.__c=e.__(),v=t}function Be(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function De(e,t){return typeof t=="function"?t(e):t}var Qe=0;function $e(e,t,n,_,o,i){var c,l,u={};for(l in t)l=="ref"?c=t[l]:u[l]=t[l];var s={type:e,props:u,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Qe,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)u[l]===void 0&&(u[l]=c[l]);return f.vnode&&f.vnode(s),s}class Ze{constructor(){ne(this,"_context");ne(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 A;const ze=({context:e})=>{const[t,n]=Re(null);return We(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),$e("div",{ref:n,id:"spiffThemeWrapper"})};function Je(e,t){A=new Ze,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ue($e(ze,{context:t}),n)}function qe(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 Ye=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function Ke(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:Ye(n),type:n.type,asset:void 0}))}const Xe={name:"@spiffcommerce/theme-bridge",version:"1.14.1",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 et(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:H.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:H.CSS,mimeType:"text/css",filename:e};return null}function tt(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:Xe.version,config(i,c){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,c){const l=t?Object.keys(c).map(s=>o!=null&&o.some(p=>p.filename===s)?null:et(s,c[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const u={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}h.AssetType=oe,h.FieldType=_e,h.ThemeFileType=H,h.exampleThemeInstallConfig=qe,h.getDefaultsForSchema=Ke,h.setSpiffDevOptions=Je,h.spiffThemePlugin=tt,h.themeInstallConfigurationGraphQlToResource=Ve,h.themeVersionConfigurationGraphQlToResource=re,h.themeVersionGraphQlToResource=He,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|