@spiffcommerce/theme-bridge 1.15.0 → 1.15.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.js +53 -51
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
2
|
var $e = Object.defineProperty;
|
|
3
3
|
var Te = (e, t, n) => t in e ? $e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
|
-
var
|
|
4
|
+
var R = (e, t, n) => (Te(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
5
|
import Pe from "fs";
|
|
6
6
|
import He from "path";
|
|
7
|
-
var
|
|
7
|
+
var G = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(G || {}), V = /* @__PURE__ */ ((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))(V || {}), Ve = /* @__PURE__ */ ((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))(Ve || {});
|
|
8
8
|
function de(e) {
|
|
9
9
|
return Object.assign({}, ...e.map((t) => {
|
|
10
10
|
if (t.key)
|
|
@@ -14,7 +14,9 @@ function de(e) {
|
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
16
|
function he(e) {
|
|
17
|
-
if (e.type
|
|
17
|
+
if (e.type === V.Asset)
|
|
18
|
+
return e.asset;
|
|
19
|
+
if (e.type !== V.List && e.type !== V.Object)
|
|
18
20
|
return e.value;
|
|
19
21
|
if (e.listValues)
|
|
20
22
|
return e.listValues.map(he);
|
|
@@ -68,7 +70,7 @@ function mt(e) {
|
|
|
68
70
|
throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
|
|
69
71
|
return t.fields = n, t;
|
|
70
72
|
}
|
|
71
|
-
var
|
|
73
|
+
var O, f, me, E, ne, ve, z, D = {}, ge = [], Ie = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, K = Array.isArray;
|
|
72
74
|
function x(e, t) {
|
|
73
75
|
for (var n in t)
|
|
74
76
|
e[n] = t[n];
|
|
@@ -82,19 +84,19 @@ function Ne(e, t, n) {
|
|
|
82
84
|
var _, o, i, c = {};
|
|
83
85
|
for (i in t)
|
|
84
86
|
i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
|
|
85
|
-
if (arguments.length > 2 && (c.children = arguments.length > 3 ?
|
|
87
|
+
if (arguments.length > 2 && (c.children = arguments.length > 3 ? O.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
|
|
86
88
|
for (i in e.defaultProps)
|
|
87
89
|
c[i] === void 0 && (c[i] = e.defaultProps[i]);
|
|
88
|
-
return
|
|
90
|
+
return j(e, c, _, o, null);
|
|
89
91
|
}
|
|
90
|
-
function
|
|
92
|
+
function j(e, t, n, _, o) {
|
|
91
93
|
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 ?? ++me, __i: -1, __u: 0 };
|
|
92
94
|
return o == null && f.vnode != null && f.vnode(i), i;
|
|
93
95
|
}
|
|
94
|
-
function
|
|
96
|
+
function A(e) {
|
|
95
97
|
return e.children;
|
|
96
98
|
}
|
|
97
|
-
function
|
|
99
|
+
function I(e, t) {
|
|
98
100
|
this.props = e, this.context = t;
|
|
99
101
|
}
|
|
100
102
|
function S(e, t) {
|
|
@@ -117,13 +119,13 @@ function be(e) {
|
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
function _e(e) {
|
|
120
|
-
(!e.__d && (e.__d = !0) && E.push(e) && !
|
|
122
|
+
(!e.__d && (e.__d = !0) && E.push(e) && !F.__r++ || ne !== f.debounceRendering) && ((ne = f.debounceRendering) || ve)(F);
|
|
121
123
|
}
|
|
122
|
-
function
|
|
124
|
+
function F() {
|
|
123
125
|
var e, t, n, _, o, i, c, l, u;
|
|
124
126
|
for (E.sort(z); e = E.shift(); )
|
|
125
127
|
e.__d && (t = E.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], u = [], (c = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), X(c, _, o, n.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? S(o), !!(32 & o.__u), u), _.__.__k[_.__i] = _, xe(l, _, u), _.__e != i && be(_)), E.length > t && E.sort(z));
|
|
126
|
-
|
|
128
|
+
F.__r = 0;
|
|
127
129
|
}
|
|
128
130
|
function ke(e, t, n, _, o, i, c, l, u, s, p) {
|
|
129
131
|
var r, d, a, v, k, g = _ && _.__k || ge, h = t.length;
|
|
@@ -134,7 +136,7 @@ function ke(e, t, n, _, o, i, c, l, u, s, p) {
|
|
|
134
136
|
function Le(e, t, n) {
|
|
135
137
|
var _, o, i, c, l, u = t.length, s = n.length, p = s, r = 0;
|
|
136
138
|
for (e.__k = [], _ = 0; _ < u; _++)
|
|
137
|
-
(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 ?
|
|
139
|
+
(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 ? j(null, o, null, null, o) : K(o) ? j(A, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? j(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = Fe(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 = S(i)), J(i, i, !1), n[_] = null, p--);
|
|
138
140
|
if (p)
|
|
139
141
|
for (_ = 0; _ < s; _++)
|
|
140
142
|
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)), J(i, i));
|
|
@@ -218,7 +220,7 @@ function X(e, t, n, _, o, i, c, l, u, s) {
|
|
|
218
220
|
e:
|
|
219
221
|
if (typeof b == "function")
|
|
220
222
|
try {
|
|
221
|
-
if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new
|
|
223
|
+
if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new I(h, C), r.constructor = b, r.render = Me), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = x({}, r.__s)), x(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, v = r.state, r.__v = t, d)
|
|
222
224
|
b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
223
225
|
else {
|
|
224
226
|
if (b.getDerivedStateFromProps == null && h !== a && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, C), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, C) === !1 || t.__v === n.__v)) {
|
|
@@ -241,7 +243,7 @@ function X(e, t, n, _, o, i, c, l, u, s) {
|
|
|
241
243
|
do
|
|
242
244
|
r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
243
245
|
while (r.__d && ++te < 25);
|
|
244
|
-
r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, K(W = p != null && p.type ===
|
|
246
|
+
r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, K(W = p != null && p.type === A && p.key == null ? p.props.children : p) ? W : [W], 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);
|
|
245
247
|
} catch (P) {
|
|
246
248
|
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(P, t, n);
|
|
247
249
|
}
|
|
@@ -280,7 +282,7 @@ function Ue(e, t, n, _, o, i, c, l, u) {
|
|
|
280
282
|
if (y === null)
|
|
281
283
|
g === h || l && e.data === h || (e.data = h);
|
|
282
284
|
else {
|
|
283
|
-
if (i = i &&
|
|
285
|
+
if (i = i && O.call(e.childNodes), g = n.props || D, !l && i != null)
|
|
284
286
|
for (g = {}, s = 0; s < e.attributes.length; s++)
|
|
285
287
|
g[(a = e.attributes[s]).name] = a.value;
|
|
286
288
|
for (s in g)
|
|
@@ -324,9 +326,9 @@ function Me(e, t, n) {
|
|
|
324
326
|
}
|
|
325
327
|
function Oe(e, t, n) {
|
|
326
328
|
var _, o, i, c;
|
|
327
|
-
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [], X(t, e = (!_ && n || t).__k = Ne(
|
|
329
|
+
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [], X(t, e = (!_ && n || t).__k = Ne(A, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? O.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, c), xe(i, e, c);
|
|
328
330
|
}
|
|
329
|
-
|
|
331
|
+
O = ge.slice, f = { __e: function(e, t, n, _) {
|
|
330
332
|
for (var o, i, c; t = t.__; )
|
|
331
333
|
if ((o = t.__c) && !o.__)
|
|
332
334
|
try {
|
|
@@ -336,25 +338,25 @@ M = ge.slice, f = { __e: function(e, t, n, _) {
|
|
|
336
338
|
e = l;
|
|
337
339
|
}
|
|
338
340
|
throw e;
|
|
339
|
-
} }, me = 0,
|
|
341
|
+
} }, me = 0, I.prototype.setState = function(e, t) {
|
|
340
342
|
var n;
|
|
341
343
|
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), _e(this));
|
|
342
|
-
},
|
|
344
|
+
}, I.prototype.forceUpdate = function(e) {
|
|
343
345
|
this.__v && (this.__e = !0, e && this.__h.push(e), _e(this));
|
|
344
|
-
},
|
|
346
|
+
}, I.prototype.render = A, E = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
|
|
345
347
|
return e.__v.__b - t.__v.__b;
|
|
346
|
-
},
|
|
347
|
-
var
|
|
348
|
+
}, F.__r = 0;
|
|
349
|
+
var U, m, B, se, Y = 0, Ee = [], N = [], le = f.__b, ce = f.__r, ue = f.diffed, ae = f.__c, fe = f.unmount;
|
|
348
350
|
function Se(e, t) {
|
|
349
351
|
f.__h && f.__h(m, e, Y || t), Y = 0;
|
|
350
352
|
var n = m.__H || (m.__H = { __: [], __h: [] });
|
|
351
|
-
return e >= n.__.length && n.__.push({ __V:
|
|
353
|
+
return e >= n.__.length && n.__.push({ __V: N }), n.__[e];
|
|
352
354
|
}
|
|
353
|
-
function
|
|
354
|
-
return Y = 1,
|
|
355
|
+
function Ae(e) {
|
|
356
|
+
return Y = 1, We(we, e);
|
|
355
357
|
}
|
|
356
|
-
function
|
|
357
|
-
var _ = Se(
|
|
358
|
+
function We(e, t, n) {
|
|
359
|
+
var _ = Se(U++, 2);
|
|
358
360
|
if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(l) {
|
|
359
361
|
var u = _.__N ? _.__N[0] : _.__[0], s = _.t(u, l);
|
|
360
362
|
u !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
|
|
@@ -390,14 +392,14 @@ function Ae(e, t, n) {
|
|
|
390
392
|
return _.__N || _.__;
|
|
391
393
|
}
|
|
392
394
|
function Re(e, t) {
|
|
393
|
-
var n = Se(
|
|
395
|
+
var n = Se(U++, 3);
|
|
394
396
|
!f.__s && Ze(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
|
|
395
397
|
}
|
|
396
398
|
function Be() {
|
|
397
399
|
for (var e; e = Ee.shift(); )
|
|
398
400
|
if (e.__P && e.__H)
|
|
399
401
|
try {
|
|
400
|
-
e.__H.__h.forEach(
|
|
402
|
+
e.__H.__h.forEach(L), e.__H.__h.forEach(q), e.__H.__h = [];
|
|
401
403
|
} catch (t) {
|
|
402
404
|
e.__H.__h = [], f.__e(t, e.__v);
|
|
403
405
|
}
|
|
@@ -405,21 +407,21 @@ function Be() {
|
|
|
405
407
|
f.__b = function(e) {
|
|
406
408
|
m = null, le && le(e);
|
|
407
409
|
}, f.__r = function(e) {
|
|
408
|
-
ce && ce(e),
|
|
410
|
+
ce && ce(e), U = 0;
|
|
409
411
|
var t = (m = e.__c).__H;
|
|
410
|
-
t && (
|
|
411
|
-
n.__N && (n.__ = n.__N), n.__V =
|
|
412
|
-
})) : (t.__h.forEach(
|
|
412
|
+
t && (B === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
|
|
413
|
+
n.__N && (n.__ = n.__N), n.__V = N, n.__N = n.i = void 0;
|
|
414
|
+
})) : (t.__h.forEach(L), t.__h.forEach(q), t.__h = [], U = 0)), B = m;
|
|
413
415
|
}, f.diffed = function(e) {
|
|
414
416
|
ue && ue(e);
|
|
415
417
|
var t = e.__c;
|
|
416
418
|
t && t.__H && (t.__H.__h.length && (Ee.push(t) !== 1 && se === f.requestAnimationFrame || ((se = f.requestAnimationFrame) || Ge)(Be)), t.__H.__.forEach(function(n) {
|
|
417
|
-
n.i && (n.__H = n.i), n.__V !==
|
|
418
|
-
})),
|
|
419
|
+
n.i && (n.__H = n.i), n.__V !== N && (n.__ = n.__V), n.i = void 0, n.__V = N;
|
|
420
|
+
})), B = m = null;
|
|
419
421
|
}, f.__c = function(e, t) {
|
|
420
422
|
t.some(function(n) {
|
|
421
423
|
try {
|
|
422
|
-
n.__h.forEach(
|
|
424
|
+
n.__h.forEach(L), n.__h = n.__h.filter(function(_) {
|
|
423
425
|
return !_.__ || q(_);
|
|
424
426
|
});
|
|
425
427
|
} catch (_) {
|
|
@@ -433,7 +435,7 @@ f.__b = function(e) {
|
|
|
433
435
|
var t, n = e.__c;
|
|
434
436
|
n && n.__H && (n.__H.__.forEach(function(_) {
|
|
435
437
|
try {
|
|
436
|
-
|
|
438
|
+
L(_);
|
|
437
439
|
} catch (o) {
|
|
438
440
|
t = o;
|
|
439
441
|
}
|
|
@@ -446,7 +448,7 @@ function Ge(e) {
|
|
|
446
448
|
}, _ = setTimeout(n, 100);
|
|
447
449
|
pe && (t = requestAnimationFrame(n));
|
|
448
450
|
}
|
|
449
|
-
function
|
|
451
|
+
function L(e) {
|
|
450
452
|
var t = m, n = e.__c;
|
|
451
453
|
typeof n == "function" && (e.__c = void 0, n()), m = t;
|
|
452
454
|
}
|
|
@@ -475,8 +477,8 @@ function De(e, t, n, _, o, i) {
|
|
|
475
477
|
}
|
|
476
478
|
class ze {
|
|
477
479
|
constructor() {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
+
R(this, "_context");
|
|
481
|
+
R(this, "_getContextCallbacks", []);
|
|
480
482
|
}
|
|
481
483
|
async getContext() {
|
|
482
484
|
return this._context ? this._context : new Promise((t) => {
|
|
@@ -502,16 +504,16 @@ class ze {
|
|
|
502
504
|
console.log("Navigating to customer portal");
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
|
-
let
|
|
507
|
+
let M;
|
|
506
508
|
const Je = ({
|
|
507
509
|
context: e
|
|
508
510
|
}) => {
|
|
509
|
-
const [t, n] =
|
|
511
|
+
const [t, n] = Ae(null);
|
|
510
512
|
return Re(() => {
|
|
511
513
|
if (t) {
|
|
512
|
-
if (
|
|
514
|
+
if (M === void 0)
|
|
513
515
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
514
|
-
|
|
516
|
+
M.setContext({
|
|
515
517
|
...e,
|
|
516
518
|
container: t
|
|
517
519
|
});
|
|
@@ -522,7 +524,7 @@ const Je = ({
|
|
|
522
524
|
});
|
|
523
525
|
};
|
|
524
526
|
function vt(e, t) {
|
|
525
|
-
|
|
527
|
+
M = new ze(), window.SpiffThemeLoader = M;
|
|
526
528
|
let n;
|
|
527
529
|
typeof e == "string" ? n = document.getElementById(e) : n = e, Oe(De(Je, {
|
|
528
530
|
context: t
|
|
@@ -570,7 +572,7 @@ function yt(e, ...t) {
|
|
|
570
572
|
asset: void 0
|
|
571
573
|
}));
|
|
572
574
|
}
|
|
573
|
-
const qe = "@spiffcommerce/theme-bridge", Ke = "1.15.
|
|
575
|
+
const qe = "@spiffcommerce/theme-bridge", Ke = "1.15.1", Xe = "module", et = {
|
|
574
576
|
build: "tsc && vite build",
|
|
575
577
|
preview: "vite preview",
|
|
576
578
|
dev: "ladle serve",
|
|
@@ -622,14 +624,14 @@ function ut(e, t, n) {
|
|
|
622
624
|
return null;
|
|
623
625
|
if (!t.isDynamicEntry)
|
|
624
626
|
return {
|
|
625
|
-
type:
|
|
627
|
+
type: G.Javascript,
|
|
626
628
|
mimeType: "text/javascript",
|
|
627
629
|
preload: !t.isEntry,
|
|
628
630
|
filename: e
|
|
629
631
|
};
|
|
630
632
|
} else if (e.endsWith(".css"))
|
|
631
633
|
return {
|
|
632
|
-
type:
|
|
634
|
+
type: G.CSS,
|
|
633
635
|
mimeType: "text/css",
|
|
634
636
|
filename: e
|
|
635
637
|
};
|
|
@@ -663,8 +665,8 @@ function bt(e) {
|
|
|
663
665
|
}
|
|
664
666
|
export {
|
|
665
667
|
Ve as AssetType,
|
|
666
|
-
|
|
667
|
-
|
|
668
|
+
V as FieldType,
|
|
669
|
+
G as ThemeFileType,
|
|
668
670
|
gt as exampleThemeInstallConfig,
|
|
669
671
|
yt as getDefaultsForSchema,
|
|
670
672
|
vt as setSpiffDevOptions,
|
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,T){"use strict";var rt=Object.defineProperty;var it=(h,k,T)=>k in h?rt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var _e=(h,k,T)=>(it(h,typeof k!="symbol"?k+"":k,T),T);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),j=(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))(j||{}),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 re(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:ie(t)}}))}function ie(e){if(e.type!==j.List&&e.type!==j.Object)return e.value;if(e.listValues)return e.listValues.map(ie);if(e.objectValues)return re(e.objectValues)}function He(e){return re(e.fields)}function Q(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=Q(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>Q(t[_],t))),n}function se(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 ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Ie(e){return{...e,configurationSchema:se(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(_=>Z(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Z(t[_],t))),n}function Ne(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Z(_,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,le,w,ue,ce,z,$={},ae=[],Fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function fe(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,n){var _,o,i,u={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=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 I(e,u,_,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??++le,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function N(e){return e.children}function F(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 pe(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 pe(e)}}function de(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!L.__r++||ue!==f.debounceRendering)&&((ue=f.debounceRendering)||ce)(L)}function L(){var e,t,n,_,o,i,u,l,c;for(w.sort(z);e=w.shift();)e.__d&&(t=w.length,_=void 0,i=(o=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),q(u,_,o,n.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),c),_.__.__k[_.__i]=_,be(l,_,c),_.__e!=i&&pe(_)),w.length>t&&w.sort(z));L.__r=0}function he(e,t,n,_,o,i,u,l,c,s,p){var r,d,a,y,S,g=_&&_.__k||ae,m=t.length;for(n.__d=c,Oe(n,t,g),c=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,q(e,a,d,o,i,u,l,c,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&Y(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?c=me(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 Oe(e,t,n){var _,o,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<c;_++)(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):J(o)?I(N,{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=Re(o,n,u=_+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!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),K(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)),K(i,i))}function me(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=me(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Re(e,t,n,_){var o=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&o==c.key&&i===c.type)return n;if(_>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&o==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&o==c.key&&i===c.type)return l;l++}}return-1}function ve(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Fe.test(t)?n:n+"px"}function O(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||ve(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||ve(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?ge:ye,i)):e.removeEventListener(t,i?ge:ye,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 ye(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 ge(e){return this.l[e.type+!0](f.event?f.event(e):e)}function q(e,t,n,_,o,i,u,l,c,s){var p,r,d,a,y,S,g,m,b,E,W,P,je,G,ne,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)&&_[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 F(m,E),r.constructor=C,r.render=Ue),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(B){B&&(B.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);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,je=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),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);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&&++je<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),he(e,J(ne=p!=null&&p.type===N&&p.key==null?p.props.children:p)?ne:[ne],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(B){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(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Me(n.__e,t,n,_,o,i,u,c,s);(p=f.diffed)&&p(t)}function be(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)Y(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 Me(e,t,n,_,o,i,u,l,c){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&&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||O(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||O(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=""),he(e,J(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,u,i?i[0]:n.__k&&D(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&fe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&O(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&O(e,s,S,g[s],!1))}return e}function Y(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function K(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||Y(_,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]&&K(_[o],t,n||typeof e.type!="function");n||e.__e==null||fe(e.__e),e.__=e.__e=e.__d=void 0}function Ue(e,t,n){return this.constructor(e,n)}function Ae(e,t,n){var _,o,i,u;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],q(t,e=(!_&&n||t).__k=Le(N,null,[e]),o||$,$,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?H.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,u),be(i,e,u)}H=ae.slice,f={__e:function(e,t,n,_){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),u=o.__d),u)return o.__E=o}catch(l){e=l}throw e}},le=0,F.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),de(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),de(this))},F.prototype.render=N,w=[],ce=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 R,v,X,ke,ee=0,Ce=[],M=[],Se=f.__b,xe=f.__r,Ee=f.diffed,Te=f.__c,we=f.unmount;function De(e,t){f.__h&&f.__h(v,e,ee||t),ee=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function We(e){return ee=1,Ge(Pe,e)}function Ge(e,t,n){var _=De(R++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):Pe(void 0,t),function(l){var c=_.__N?_.__N[0]:_.__[0],s=_.t(c,l);c!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,c,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,c,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,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,o(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function Be(e,t){var n=De(R++,3);!f.__s&&ze(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Qe(){for(var e;e=Ce.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(te),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Se&&Se(e)},f.__r=function(e){xe&&xe(e),R=0;var t=(v=e.__c).__H;t&&(X===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(U),t.__h.forEach(te),t.__h=[],R=0)),X=v},f.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ce.push(t)!==1&&ke===f.requestAnimationFrame||((ke=f.requestAnimationFrame)||Ze)(Qe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),X=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(_){return!_.__||te(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),Te&&Te(e,t)},f.unmount=function(e){we&&we(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{U(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Ze(e){var t,n=function(){clearTimeout(_),$e&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function U(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function te(e){var t=v;e.__c=e.__(),v=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Je=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:--Je,__i:-1,__u:0,__source:o,__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 qe{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 A;const Ye=({context:e})=>{const[t,n]=We(null);return Be(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function Ke(e,t){A=new qe,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ae(Ve(Ye,{context:t}),n)}function Xe(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 et=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function tt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:et(n),type:n.type,asset:void 0}))}const nt={name:"@spiffcommerce/theme-bridge",version:"1.15.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 _t(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 ot(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:nt.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=>o!=null&&o.some(p=>p.filename===s)?null:_t(s,u[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(T.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}h.AssetType=oe,h.FieldType=j,h.ThemeFileType=V,h.exampleThemeInstallConfig=Xe,h.getDefaultsForSchema=tt,h.setSpiffDevOptions=Ke,h.spiffThemePlugin=ot,h.themeInstallConfigurationFieldsToRecordObject=He,h.themeInstallConfigurationGraphQlToResource=Ne,h.themeVersionConfigurationGraphQlToResource=se,h.themeVersionGraphQlToResource=Ie,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,T){"use strict";var rt=Object.defineProperty;var it=(h,k,T)=>k in h?rt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var _e=(h,k,T)=>(it(h,typeof k!="symbol"?k+"":k,T),T);var j=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(j||{}),$=(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))($||{}),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 re(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:ie(t)}}))}function ie(e){if(e.type===$.Asset)return e.asset;if(e.type!==$.List&&e.type!==$.Object)return e.value;if(e.listValues)return e.listValues.map(ie);if(e.objectValues)return re(e.objectValues)}function He(e){return re(e.fields)}function Q(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=Q(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>Q(t[_],t))),n}function se(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 ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Ie(e){return{...e,configurationSchema:se(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(_=>Z(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Z(t[_],t))),n}function Ne(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Z(_,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,le,w,ue,ce,z,P={},ae=[],Fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function fe(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,n){var _,o,i,u={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=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 I(e,u,_,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??++le,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function N(e){return e.children}function F(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 pe(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 pe(e)}}function de(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!L.__r++||ue!==f.debounceRendering)&&((ue=f.debounceRendering)||ce)(L)}function L(){var e,t,n,_,o,i,u,l,c;for(w.sort(z);e=w.shift();)e.__d&&(t=w.length,_=void 0,i=(o=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),q(u,_,o,n.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),c),_.__.__k[_.__i]=_,be(l,_,c),_.__e!=i&&pe(_)),w.length>t&&w.sort(z));L.__r=0}function he(e,t,n,_,o,i,u,l,c,s,p){var r,d,a,y,S,g=_&&_.__k||ae,m=t.length;for(n.__d=c,Oe(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?P:g[a.__i]||P,a.__i=r,q(e,a,d,o,i,u,l,c,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&Y(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?c=me(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 Oe(e,t,n){var _,o,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<c;_++)(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):J(o)?I(N,{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=Re(o,n,u=_+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!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),K(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)),K(i,i))}function me(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=me(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Re(e,t,n,_){var o=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&o==c.key&&i===c.type)return n;if(_>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&o==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&o==c.key&&i===c.type)return l;l++}}return-1}function ve(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Fe.test(t)?n:n+"px"}function O(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||ve(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||ve(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?ge:ye,i)):e.removeEventListener(t,i?ge:ye,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 ye(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 ge(e){return this.l[e.type+!0](f.event?f.event(e):e)}function q(e,t,n,_,o,i,u,l,c,s){var p,r,d,a,y,S,g,m,b,E,W,V,je,G,ne,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)&&_[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 F(m,E),r.constructor=C,r.render=Ue),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(B){B&&(B.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);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,V=f.__r,je=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,V&&V(t),p=r.render(r.props,r.state,r.context),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[]}else do r.__d=!1,V&&V(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++je<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),he(e,J(ne=p!=null&&p.type===N&&p.key==null?p.props.children:p)?ne:[ne],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(B){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(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Me(n.__e,t,n,_,o,i,u,c,s);(p=f.diffed)&&p(t)}function be(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)Y(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 Me(e,t,n,_,o,i,u,l,c){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&&H.call(e.childNodes),g=n.props||P,!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||O(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||O(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=""),he(e,J(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,u,i?i[0]:n.__k&&D(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&fe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&O(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&O(e,s,S,g[s],!1))}return e}function Y(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function K(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||Y(_,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]&&K(_[o],t,n||typeof e.type!="function");n||e.__e==null||fe(e.__e),e.__=e.__e=e.__d=void 0}function Ue(e,t,n){return this.constructor(e,n)}function Ae(e,t,n){var _,o,i,u;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],q(t,e=(!_&&n||t).__k=Le(N,null,[e]),o||P,P,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?H.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,u),be(i,e,u)}H=ae.slice,f={__e:function(e,t,n,_){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),u=o.__d),u)return o.__E=o}catch(l){e=l}throw e}},le=0,F.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),de(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),de(this))},F.prototype.render=N,w=[],ce=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 R,v,X,ke,ee=0,Ce=[],M=[],Se=f.__b,xe=f.__r,Ee=f.diffed,Te=f.__c,we=f.unmount;function De(e,t){f.__h&&f.__h(v,e,ee||t),ee=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function We(e){return ee=1,Ge(Pe,e)}function Ge(e,t,n){var _=De(R++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):Pe(void 0,t),function(l){var c=_.__N?_.__N[0]:_.__[0],s=_.t(c,l);c!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,c,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,c,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,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,o(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function Be(e,t){var n=De(R++,3);!f.__s&&ze(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Qe(){for(var e;e=Ce.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(te),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Se&&Se(e)},f.__r=function(e){xe&&xe(e),R=0;var t=(v=e.__c).__H;t&&(X===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(U),t.__h.forEach(te),t.__h=[],R=0)),X=v},f.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ce.push(t)!==1&&ke===f.requestAnimationFrame||((ke=f.requestAnimationFrame)||Ze)(Qe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),X=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(_){return!_.__||te(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),Te&&Te(e,t)},f.unmount=function(e){we&&we(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{U(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Ze(e){var t,n=function(){clearTimeout(_),$e&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function U(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function te(e){var t=v;e.__c=e.__(),v=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Je=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:--Je,__i:-1,__u:0,__source:o,__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 qe{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 A;const Ye=({context:e})=>{const[t,n]=We(null);return Be(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function Ke(e,t){A=new qe,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ae(Ve(Ye,{context:t}),n)}function Xe(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 et=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function tt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:et(n),type:n.type,asset:void 0}))}const nt={name:"@spiffcommerce/theme-bridge",version:"1.15.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 _t(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:j.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:j.CSS,mimeType:"text/css",filename:e};return null}function ot(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:nt.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=>o!=null&&o.some(p=>p.filename===s)?null:_t(s,u[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(T.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}h.AssetType=oe,h.FieldType=$,h.ThemeFileType=j,h.exampleThemeInstallConfig=Xe,h.getDefaultsForSchema=tt,h.setSpiffDevOptions=Ke,h.spiffThemePlugin=ot,h.themeInstallConfigurationFieldsToRecordObject=He,h.themeInstallConfigurationGraphQlToResource=Ne,h.themeVersionConfigurationGraphQlToResource=se,h.themeVersionGraphQlToResource=Ie,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|