@spiffcommerce/theme-bridge 1.14.1 → 1.15.0
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 +9 -1
- package/dist/index.js +182 -162
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,14 @@ interface AssetResource {
|
|
|
254
254
|
fileLink: string;
|
|
255
255
|
type: AssetType;
|
|
256
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Maps a `ThemeInstallConfigurationResource`'s fields (which is essentially `{ key: string; value: string; }[]`), to the form `{ [key: string]: any }`.
|
|
259
|
+
* This allows you to reference field values in the format `config.key` instead of having to iterate over an array to find the field with a matching key.
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
declare function themeInstallConfigurationFieldsToRecordObject(configuration: ThemeInstallConfigurationResource): {
|
|
263
|
+
[key: string]: any;
|
|
264
|
+
};
|
|
257
265
|
|
|
258
266
|
interface ThemeContextBase {
|
|
259
267
|
applicationKey: string;
|
|
@@ -413,4 +421,4 @@ interface PluginOptions {
|
|
|
413
421
|
*/
|
|
414
422
|
declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
|
|
415
423
|
|
|
416
|
-
export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationGraphQlToResource, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
|
424
|
+
export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,80 @@
|
|
|
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
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
var B = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(B || {}),
|
|
8
|
-
function
|
|
2
|
+
var $e = Object.defineProperty;
|
|
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 A = (e, t, n) => (Te(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
|
+
import Pe from "fs";
|
|
6
|
+
import He from "path";
|
|
7
|
+
var B = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(B || {}), G = /* @__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))(G || {}), 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
|
+
function de(e) {
|
|
9
|
+
return Object.assign({}, ...e.map((t) => {
|
|
10
|
+
if (t.key)
|
|
11
|
+
return {
|
|
12
|
+
[t.key]: he(t)
|
|
13
|
+
};
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
function he(e) {
|
|
17
|
+
if (e.type !== G.List && e.type !== G.Object)
|
|
18
|
+
return e.value;
|
|
19
|
+
if (e.listValues)
|
|
20
|
+
return e.listValues.map(he);
|
|
21
|
+
if (e.objectValues)
|
|
22
|
+
return de(e.objectValues);
|
|
23
|
+
}
|
|
24
|
+
function dt(e) {
|
|
25
|
+
return de(e.fields);
|
|
26
|
+
}
|
|
27
|
+
function Z(e, t) {
|
|
9
28
|
const n = {
|
|
10
29
|
...e,
|
|
11
30
|
items: void 0,
|
|
12
31
|
fields: void 0
|
|
13
32
|
};
|
|
14
|
-
return e.items !== void 0 && (n.items =
|
|
33
|
+
return e.items !== void 0 && (n.items = Z(t[e.items], t)), e.fields !== void 0 && (n.fields = e.fields.map((_) => Z(t[_], t))), n;
|
|
15
34
|
}
|
|
16
|
-
function
|
|
35
|
+
function je(e) {
|
|
17
36
|
const t = {
|
|
18
37
|
...e,
|
|
19
38
|
fields: []
|
|
20
39
|
}, n = [];
|
|
21
40
|
if (e.fields.forEach((_) => {
|
|
22
|
-
_.root && n.push(
|
|
41
|
+
_.root && n.push(Z(_, e.fields));
|
|
23
42
|
}), e.fields.length > 0 && n.length === 0)
|
|
24
43
|
throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");
|
|
25
44
|
return t.fields = n, t;
|
|
26
45
|
}
|
|
27
|
-
function
|
|
46
|
+
function ht(e) {
|
|
28
47
|
return {
|
|
29
48
|
...e,
|
|
30
|
-
configurationSchema:
|
|
49
|
+
configurationSchema: je(e.configurationSchema)
|
|
31
50
|
};
|
|
32
51
|
}
|
|
33
|
-
function
|
|
52
|
+
function Q(e, t) {
|
|
34
53
|
const n = {
|
|
35
54
|
...e,
|
|
36
55
|
listValues: void 0,
|
|
37
56
|
objectValues: void 0
|
|
38
57
|
};
|
|
39
|
-
return e.listValues !== void 0 && (n.listValues = e.listValues.map((_) =>
|
|
58
|
+
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;
|
|
40
59
|
}
|
|
41
|
-
function
|
|
60
|
+
function mt(e) {
|
|
42
61
|
const t = {
|
|
43
62
|
...e,
|
|
44
63
|
fields: []
|
|
45
64
|
}, n = [];
|
|
46
65
|
if (e.fields.forEach((_) => {
|
|
47
|
-
_.root && n.push(
|
|
66
|
+
_.root && n.push(Q(_, e.fields));
|
|
48
67
|
}), e.fields.length > 0 && n.length === 0)
|
|
49
68
|
throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
|
|
50
69
|
return t.fields = n, t;
|
|
51
70
|
}
|
|
52
|
-
var M, f,
|
|
71
|
+
var M, 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;
|
|
53
72
|
function x(e, t) {
|
|
54
73
|
for (var n in t)
|
|
55
74
|
e[n] = t[n];
|
|
56
75
|
return e;
|
|
57
76
|
}
|
|
58
|
-
function
|
|
77
|
+
function ye(e) {
|
|
59
78
|
var t = e.parentNode;
|
|
60
79
|
t && t.removeChild(e);
|
|
61
80
|
}
|
|
@@ -69,13 +88,13 @@ function Ne(e, t, n) {
|
|
|
69
88
|
return V(e, c, _, o, null);
|
|
70
89
|
}
|
|
71
90
|
function V(e, t, n, _, o) {
|
|
72
|
-
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 ?? ++
|
|
91
|
+
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 };
|
|
73
92
|
return o == null && f.vnode != null && f.vnode(i), i;
|
|
74
93
|
}
|
|
75
|
-
function
|
|
94
|
+
function O(e) {
|
|
76
95
|
return e.children;
|
|
77
96
|
}
|
|
78
|
-
function
|
|
97
|
+
function j(e, t) {
|
|
79
98
|
this.props = e, this.context = t;
|
|
80
99
|
}
|
|
81
100
|
function S(e, t) {
|
|
@@ -86,7 +105,7 @@ function S(e, t) {
|
|
|
86
105
|
return n.__e;
|
|
87
106
|
return typeof e.type == "function" ? S(e) : null;
|
|
88
107
|
}
|
|
89
|
-
function
|
|
108
|
+
function be(e) {
|
|
90
109
|
var t, n;
|
|
91
110
|
if ((e = e.__) != null && e.__c != null) {
|
|
92
111
|
for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++)
|
|
@@ -94,42 +113,42 @@ function ve(e) {
|
|
|
94
113
|
e.__e = e.__c.base = n.__e;
|
|
95
114
|
break;
|
|
96
115
|
}
|
|
97
|
-
return
|
|
116
|
+
return be(e);
|
|
98
117
|
}
|
|
99
118
|
}
|
|
100
|
-
function
|
|
101
|
-
(!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ ||
|
|
119
|
+
function _e(e) {
|
|
120
|
+
(!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ || ne !== f.debounceRendering) && ((ne = f.debounceRendering) || ve)(L);
|
|
102
121
|
}
|
|
103
122
|
function L() {
|
|
104
123
|
var e, t, n, _, o, i, c, l, u;
|
|
105
|
-
for (E.sort(
|
|
106
|
-
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(_),
|
|
124
|
+
for (E.sort(z); e = E.shift(); )
|
|
125
|
+
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));
|
|
107
126
|
L.__r = 0;
|
|
108
127
|
}
|
|
109
|
-
function
|
|
110
|
-
var r, d, a, v, k, g = _ && _.__k ||
|
|
111
|
-
for (n.__d = u,
|
|
112
|
-
(a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D : g[a.__i] || D, a.__i = r,
|
|
128
|
+
function ke(e, t, n, _, o, i, c, l, u, s, p) {
|
|
129
|
+
var r, d, a, v, k, g = _ && _.__k || ge, h = t.length;
|
|
130
|
+
for (n.__d = u, Le(n, t, g), u = n.__d, r = 0; r < h; r++)
|
|
131
|
+
(a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D : g[a.__i] || D, a.__i = r, X(e, a, d, o, i, c, l, u, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && ee(d.ref, null, a), p.push(a.ref, a.__c || v, a)), k == null && v != null && (k = v), 65536 & a.__u || d.__k === a.__k ? u = Ce(a, u, e) : typeof a.type == "function" && a.__d !== void 0 ? u = a.__d : v && (u = v.nextSibling), a.__d = void 0, a.__u &= -196609);
|
|
113
132
|
n.__d = u, n.__e = k;
|
|
114
133
|
}
|
|
115
|
-
function
|
|
134
|
+
function Le(e, t, n) {
|
|
116
135
|
var _, o, i, c, l, u = t.length, s = n.length, p = s, r = 0;
|
|
117
136
|
for (e.__k = [], _ = 0; _ < u; _++)
|
|
118
|
-
(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 ? V(null, o, null, null, o) :
|
|
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 ? V(null, o, null, null, o) : K(o) ? V(O, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? V(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--);
|
|
119
138
|
if (p)
|
|
120
139
|
for (_ = 0; _ < s; _++)
|
|
121
|
-
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)),
|
|
140
|
+
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)), J(i, i));
|
|
122
141
|
}
|
|
123
|
-
function
|
|
142
|
+
function Ce(e, t, n) {
|
|
124
143
|
var _, o;
|
|
125
144
|
if (typeof e.type == "function") {
|
|
126
145
|
for (_ = e.__k, o = 0; _ && o < _.length; o++)
|
|
127
|
-
_[o] && (_[o].__ = e, t =
|
|
146
|
+
_[o] && (_[o].__ = e, t = Ce(_[o], t, n));
|
|
128
147
|
return t;
|
|
129
148
|
}
|
|
130
149
|
return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
|
|
131
150
|
}
|
|
132
|
-
function
|
|
151
|
+
function Fe(e, t, n, _) {
|
|
133
152
|
var o = e.key, i = e.type, c = n - 1, l = n + 1, u = t[n];
|
|
134
153
|
if (u === null || u && o == u.key && i === u.type)
|
|
135
154
|
return n;
|
|
@@ -148,8 +167,8 @@ function je(e, t, n, _) {
|
|
|
148
167
|
}
|
|
149
168
|
return -1;
|
|
150
169
|
}
|
|
151
|
-
function
|
|
152
|
-
t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" ||
|
|
170
|
+
function oe(e, t, n) {
|
|
171
|
+
t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ie.test(t) ? n : n + "px";
|
|
153
172
|
}
|
|
154
173
|
function H(e, t, n, _, o) {
|
|
155
174
|
var i;
|
|
@@ -160,13 +179,13 @@ function H(e, t, n, _, o) {
|
|
|
160
179
|
else {
|
|
161
180
|
if (typeof _ == "string" && (e.style.cssText = _ = ""), _)
|
|
162
181
|
for (t in _)
|
|
163
|
-
n && t in n ||
|
|
182
|
+
n && t in n || oe(e.style, t, "");
|
|
164
183
|
if (n)
|
|
165
184
|
for (t in n)
|
|
166
|
-
_ && n[t] === _[t] ||
|
|
185
|
+
_ && n[t] === _[t] || oe(e.style, t, n[t]);
|
|
167
186
|
}
|
|
168
187
|
else if (t[0] === "o" && t[1] === "n")
|
|
169
|
-
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 ?
|
|
188
|
+
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 ? ie : re, i)) : e.removeEventListener(t, i ? ie : re, i);
|
|
170
189
|
else {
|
|
171
190
|
if (o)
|
|
172
191
|
t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
@@ -179,7 +198,7 @@ function H(e, t, n, _, o) {
|
|
|
179
198
|
typeof n == "function" || (n == null || n === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, n));
|
|
180
199
|
}
|
|
181
200
|
}
|
|
182
|
-
function
|
|
201
|
+
function re(e) {
|
|
183
202
|
var t = this.l[e.type + !1];
|
|
184
203
|
if (e.t) {
|
|
185
204
|
if (e.t <= t.u)
|
|
@@ -188,23 +207,23 @@ function oe(e) {
|
|
|
188
207
|
e.t = Date.now();
|
|
189
208
|
return t(f.event ? f.event(e) : e);
|
|
190
209
|
}
|
|
191
|
-
function
|
|
210
|
+
function ie(e) {
|
|
192
211
|
return this.l[e.type + !0](f.event ? f.event(e) : e);
|
|
193
212
|
}
|
|
194
|
-
function
|
|
195
|
-
var p, r, d, a, v, k, g, h, y, C, $, w,
|
|
213
|
+
function X(e, t, n, _, o, i, c, l, u, s) {
|
|
214
|
+
var p, r, d, a, v, k, g, h, y, C, $, w, te, T, W, b = t.type;
|
|
196
215
|
if (t.constructor !== void 0)
|
|
197
216
|
return null;
|
|
198
217
|
128 & n.__u && (u = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
|
|
199
218
|
e:
|
|
200
219
|
if (typeof b == "function")
|
|
201
220
|
try {
|
|
202
|
-
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
|
|
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 j(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)
|
|
203
222
|
b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
204
223
|
else {
|
|
205
224
|
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)) {
|
|
206
|
-
for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(
|
|
207
|
-
|
|
225
|
+
for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(P) {
|
|
226
|
+
P && (P.__ = t);
|
|
208
227
|
}), $ = 0; $ < r._sb.length; $++)
|
|
209
228
|
r.__h.push(r._sb[$]);
|
|
210
229
|
r._sb = [], r.__h.length && c.push(r);
|
|
@@ -214,26 +233,26 @@ function K(e, t, n, _, o, i, c, l, u, s) {
|
|
|
214
233
|
r.componentDidUpdate(a, v, k);
|
|
215
234
|
});
|
|
216
235
|
}
|
|
217
|
-
if (r.context = C, r.props = h, r.__P = e, r.__e = !1, w = f.__r,
|
|
218
|
-
for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context),
|
|
219
|
-
r.__h.push(r._sb[
|
|
236
|
+
if (r.context = C, r.props = h, r.__P = e, r.__e = !1, w = f.__r, te = 0, "prototype" in b && b.prototype.render) {
|
|
237
|
+
for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), T = 0; T < r._sb.length; T++)
|
|
238
|
+
r.__h.push(r._sb[T]);
|
|
220
239
|
r._sb = [];
|
|
221
240
|
} else
|
|
222
241
|
do
|
|
223
242
|
r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
224
|
-
while (r.__d && ++
|
|
225
|
-
r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)),
|
|
226
|
-
} catch (
|
|
227
|
-
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(
|
|
243
|
+
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 === O && 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
|
+
} catch (P) {
|
|
246
|
+
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);
|
|
228
247
|
}
|
|
229
248
|
else
|
|
230
|
-
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e =
|
|
249
|
+
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Ue(n.__e, t, n, _, o, i, c, u, s);
|
|
231
250
|
(p = f.diffed) && p(t);
|
|
232
251
|
}
|
|
233
|
-
function
|
|
252
|
+
function xe(e, t, n) {
|
|
234
253
|
t.__d = void 0;
|
|
235
254
|
for (var _ = 0; _ < n.length; _++)
|
|
236
|
-
|
|
255
|
+
ee(n[_], n[++_], n[++_]);
|
|
237
256
|
f.__c && f.__c(t, e), e.some(function(o) {
|
|
238
257
|
try {
|
|
239
258
|
e = o.__h, o.__h = [], e.some(function(i) {
|
|
@@ -244,7 +263,7 @@ function be(e, t, n) {
|
|
|
244
263
|
}
|
|
245
264
|
});
|
|
246
265
|
}
|
|
247
|
-
function
|
|
266
|
+
function Ue(e, t, n, _, o, i, c, l, u) {
|
|
248
267
|
var s, p, r, d, a, v, k, g = n.props, h = t.props, y = t.type;
|
|
249
268
|
if (y === "svg" && (o = !0), i != null) {
|
|
250
269
|
for (s = 0; s < i.length; s++)
|
|
@@ -270,23 +289,23 @@ function Le(e, t, n, _, o, i, c, l, u) {
|
|
|
270
289
|
a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" || g[s] === a || H(e, s, a, g[s], o);
|
|
271
290
|
if (p)
|
|
272
291
|
l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
|
|
273
|
-
else if (r && (e.innerHTML = ""),
|
|
292
|
+
else if (r && (e.innerHTML = ""), ke(e, K(d) ? d : [d], t, n, _, o && y !== "foreignObject", i, c, i ? i[0] : n.__k && S(n, 0), l, u), i != null)
|
|
274
293
|
for (s = i.length; s--; )
|
|
275
|
-
i[s] != null &&
|
|
294
|
+
i[s] != null && ye(i[s]);
|
|
276
295
|
l || (s = "value", v !== void 0 && (v !== e[s] || y === "progress" && !v || y === "option" && v !== g[s]) && H(e, s, v, g[s], !1), s = "checked", k !== void 0 && k !== e[s] && H(e, s, k, g[s], !1));
|
|
277
296
|
}
|
|
278
297
|
return e;
|
|
279
298
|
}
|
|
280
|
-
function
|
|
299
|
+
function ee(e, t, n) {
|
|
281
300
|
try {
|
|
282
301
|
typeof e == "function" ? e(t) : e.current = t;
|
|
283
302
|
} catch (_) {
|
|
284
303
|
f.__e(_, n);
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
|
-
function
|
|
306
|
+
function J(e, t, n) {
|
|
288
307
|
var _, o;
|
|
289
|
-
if (f.unmount && f.unmount(e), (_ = e.ref) && (_.current && _.current !== e.__e ||
|
|
308
|
+
if (f.unmount && f.unmount(e), (_ = e.ref) && (_.current && _.current !== e.__e || ee(_, null, t)), (_ = e.__c) != null) {
|
|
290
309
|
if (_.componentWillUnmount)
|
|
291
310
|
try {
|
|
292
311
|
_.componentWillUnmount();
|
|
@@ -297,17 +316,17 @@ function z(e, t, n) {
|
|
|
297
316
|
}
|
|
298
317
|
if (_ = e.__k)
|
|
299
318
|
for (o = 0; o < _.length; o++)
|
|
300
|
-
_[o] &&
|
|
301
|
-
n || e.__e == null ||
|
|
319
|
+
_[o] && J(_[o], t, n || typeof e.type != "function");
|
|
320
|
+
n || e.__e == null || ye(e.__e), e.__ = e.__e = e.__d = void 0;
|
|
302
321
|
}
|
|
303
|
-
function
|
|
322
|
+
function Me(e, t, n) {
|
|
304
323
|
return this.constructor(e, n);
|
|
305
324
|
}
|
|
306
|
-
function
|
|
325
|
+
function Oe(e, t, n) {
|
|
307
326
|
var _, o, i, c;
|
|
308
|
-
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, 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(O, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? M.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, c), xe(i, e, c);
|
|
309
328
|
}
|
|
310
|
-
M =
|
|
329
|
+
M = ge.slice, f = { __e: function(e, t, n, _) {
|
|
311
330
|
for (var o, i, c; t = t.__; )
|
|
312
331
|
if ((o = t.__c) && !o.__)
|
|
313
332
|
try {
|
|
@@ -317,26 +336,26 @@ M = he.slice, f = { __e: function(e, t, n, _) {
|
|
|
317
336
|
e = l;
|
|
318
337
|
}
|
|
319
338
|
throw e;
|
|
320
|
-
} },
|
|
339
|
+
} }, me = 0, j.prototype.setState = function(e, t) {
|
|
321
340
|
var n;
|
|
322
|
-
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),
|
|
323
|
-
},
|
|
324
|
-
this.__v && (this.__e = !0, e && this.__h.push(e),
|
|
325
|
-
},
|
|
341
|
+
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
|
+
}, j.prototype.forceUpdate = function(e) {
|
|
343
|
+
this.__v && (this.__e = !0, e && this.__h.push(e), _e(this));
|
|
344
|
+
}, j.prototype.render = O, E = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
|
|
326
345
|
return e.__v.__b - t.__v.__b;
|
|
327
346
|
}, L.__r = 0;
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
f.__h && f.__h(m, e,
|
|
347
|
+
var F, m, R, se, Y = 0, Ee = [], I = [], le = f.__b, ce = f.__r, ue = f.diffed, ae = f.__c, fe = f.unmount;
|
|
348
|
+
function Se(e, t) {
|
|
349
|
+
f.__h && f.__h(m, e, Y || t), Y = 0;
|
|
331
350
|
var n = m.__H || (m.__H = { __: [], __h: [] });
|
|
332
351
|
return e >= n.__.length && n.__.push({ __V: I }), n.__[e];
|
|
333
352
|
}
|
|
334
|
-
function
|
|
335
|
-
return
|
|
353
|
+
function We(e) {
|
|
354
|
+
return Y = 1, Ae(we, e);
|
|
336
355
|
}
|
|
337
|
-
function
|
|
338
|
-
var _ =
|
|
339
|
-
if (_.t = e, !_.__c && (_.__ = [n ? n(t) :
|
|
356
|
+
function Ae(e, t, n) {
|
|
357
|
+
var _ = Se(F++, 2);
|
|
358
|
+
if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(l) {
|
|
340
359
|
var u = _.__N ? _.__N[0] : _.__[0], s = _.t(u, l);
|
|
341
360
|
u !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
|
|
342
361
|
}], _.__c = m, !m.u)) {
|
|
@@ -370,94 +389,94 @@ function We(e, t, n) {
|
|
|
370
389
|
}
|
|
371
390
|
return _.__N || _.__;
|
|
372
391
|
}
|
|
373
|
-
function
|
|
374
|
-
var n =
|
|
375
|
-
!f.__s &&
|
|
392
|
+
function Re(e, t) {
|
|
393
|
+
var n = Se(F++, 3);
|
|
394
|
+
!f.__s && Ze(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
|
|
376
395
|
}
|
|
377
|
-
function
|
|
378
|
-
for (var e; e =
|
|
396
|
+
function Be() {
|
|
397
|
+
for (var e; e = Ee.shift(); )
|
|
379
398
|
if (e.__P && e.__H)
|
|
380
399
|
try {
|
|
381
|
-
e.__H.__h.forEach(
|
|
400
|
+
e.__H.__h.forEach(N), e.__H.__h.forEach(q), e.__H.__h = [];
|
|
382
401
|
} catch (t) {
|
|
383
402
|
e.__H.__h = [], f.__e(t, e.__v);
|
|
384
403
|
}
|
|
385
404
|
}
|
|
386
405
|
f.__b = function(e) {
|
|
387
|
-
m = null,
|
|
406
|
+
m = null, le && le(e);
|
|
388
407
|
}, f.__r = function(e) {
|
|
389
|
-
|
|
408
|
+
ce && ce(e), F = 0;
|
|
390
409
|
var t = (m = e.__c).__H;
|
|
391
|
-
t && (
|
|
410
|
+
t && (R === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
|
|
392
411
|
n.__N && (n.__ = n.__N), n.__V = I, n.__N = n.i = void 0;
|
|
393
|
-
})) : (t.__h.forEach(
|
|
412
|
+
})) : (t.__h.forEach(N), t.__h.forEach(q), t.__h = [], F = 0)), R = m;
|
|
394
413
|
}, f.diffed = function(e) {
|
|
395
|
-
|
|
414
|
+
ue && ue(e);
|
|
396
415
|
var t = e.__c;
|
|
397
|
-
t && t.__H && (t.__H.__h.length && (
|
|
416
|
+
t && t.__H && (t.__H.__h.length && (Ee.push(t) !== 1 && se === f.requestAnimationFrame || ((se = f.requestAnimationFrame) || Ge)(Be)), t.__H.__.forEach(function(n) {
|
|
398
417
|
n.i && (n.__H = n.i), n.__V !== I && (n.__ = n.__V), n.i = void 0, n.__V = I;
|
|
399
|
-
})),
|
|
418
|
+
})), R = m = null;
|
|
400
419
|
}, f.__c = function(e, t) {
|
|
401
420
|
t.some(function(n) {
|
|
402
421
|
try {
|
|
403
|
-
n.__h.forEach(
|
|
404
|
-
return !_.__ ||
|
|
422
|
+
n.__h.forEach(N), n.__h = n.__h.filter(function(_) {
|
|
423
|
+
return !_.__ || q(_);
|
|
405
424
|
});
|
|
406
425
|
} catch (_) {
|
|
407
426
|
t.some(function(o) {
|
|
408
427
|
o.__h && (o.__h = []);
|
|
409
428
|
}), t = [], f.__e(_, n.__v);
|
|
410
429
|
}
|
|
411
|
-
}),
|
|
430
|
+
}), ae && ae(e, t);
|
|
412
431
|
}, f.unmount = function(e) {
|
|
413
|
-
|
|
432
|
+
fe && fe(e);
|
|
414
433
|
var t, n = e.__c;
|
|
415
434
|
n && n.__H && (n.__H.__.forEach(function(_) {
|
|
416
435
|
try {
|
|
417
|
-
|
|
436
|
+
N(_);
|
|
418
437
|
} catch (o) {
|
|
419
438
|
t = o;
|
|
420
439
|
}
|
|
421
440
|
}), n.__H = void 0, t && f.__e(t, n.__v));
|
|
422
441
|
};
|
|
423
|
-
var
|
|
424
|
-
function
|
|
442
|
+
var pe = typeof requestAnimationFrame == "function";
|
|
443
|
+
function Ge(e) {
|
|
425
444
|
var t, n = function() {
|
|
426
|
-
clearTimeout(_),
|
|
445
|
+
clearTimeout(_), pe && cancelAnimationFrame(t), setTimeout(e);
|
|
427
446
|
}, _ = setTimeout(n, 100);
|
|
428
|
-
|
|
447
|
+
pe && (t = requestAnimationFrame(n));
|
|
429
448
|
}
|
|
430
|
-
function
|
|
449
|
+
function N(e) {
|
|
431
450
|
var t = m, n = e.__c;
|
|
432
451
|
typeof n == "function" && (e.__c = void 0, n()), m = t;
|
|
433
452
|
}
|
|
434
|
-
function
|
|
453
|
+
function q(e) {
|
|
435
454
|
var t = m;
|
|
436
455
|
e.__c = e.__(), m = t;
|
|
437
456
|
}
|
|
438
|
-
function
|
|
457
|
+
function Ze(e, t) {
|
|
439
458
|
return !e || e.length !== t.length || t.some(function(n, _) {
|
|
440
459
|
return n !== e[_];
|
|
441
460
|
});
|
|
442
461
|
}
|
|
443
|
-
function
|
|
462
|
+
function we(e, t) {
|
|
444
463
|
return typeof t == "function" ? t(e) : t;
|
|
445
464
|
}
|
|
446
|
-
var
|
|
447
|
-
function
|
|
465
|
+
var Qe = 0;
|
|
466
|
+
function De(e, t, n, _, o, i) {
|
|
448
467
|
var c, l, u = {};
|
|
449
468
|
for (l in t)
|
|
450
469
|
l == "ref" ? c = t[l] : u[l] = t[l];
|
|
451
|
-
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: --
|
|
470
|
+
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 };
|
|
452
471
|
if (typeof e == "function" && (c = e.defaultProps))
|
|
453
472
|
for (l in c)
|
|
454
473
|
u[l] === void 0 && (u[l] = c[l]);
|
|
455
474
|
return f.vnode && f.vnode(s), s;
|
|
456
475
|
}
|
|
457
|
-
class
|
|
476
|
+
class ze {
|
|
458
477
|
constructor() {
|
|
459
|
-
|
|
460
|
-
|
|
478
|
+
A(this, "_context");
|
|
479
|
+
A(this, "_getContextCallbacks", []);
|
|
461
480
|
}
|
|
462
481
|
async getContext() {
|
|
463
482
|
return this._context ? this._context : new Promise((t) => {
|
|
@@ -483,33 +502,33 @@ class Ze {
|
|
|
483
502
|
console.log("Navigating to customer portal");
|
|
484
503
|
}
|
|
485
504
|
}
|
|
486
|
-
let
|
|
487
|
-
const
|
|
505
|
+
let U;
|
|
506
|
+
const Je = ({
|
|
488
507
|
context: e
|
|
489
508
|
}) => {
|
|
490
|
-
const [t, n] =
|
|
491
|
-
return
|
|
509
|
+
const [t, n] = We(null);
|
|
510
|
+
return Re(() => {
|
|
492
511
|
if (t) {
|
|
493
|
-
if (
|
|
512
|
+
if (U === void 0)
|
|
494
513
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
495
|
-
|
|
514
|
+
U.setContext({
|
|
496
515
|
...e,
|
|
497
516
|
container: t
|
|
498
517
|
});
|
|
499
518
|
}
|
|
500
|
-
}, [t, e]),
|
|
519
|
+
}, [t, e]), De("div", {
|
|
501
520
|
ref: n,
|
|
502
521
|
id: "spiffThemeWrapper"
|
|
503
522
|
});
|
|
504
523
|
};
|
|
505
|
-
function
|
|
506
|
-
|
|
524
|
+
function vt(e, t) {
|
|
525
|
+
U = new ze(), window.SpiffThemeLoader = U;
|
|
507
526
|
let n;
|
|
508
|
-
typeof e == "string" ? n = document.getElementById(e) : n = e,
|
|
527
|
+
typeof e == "string" ? n = document.getElementById(e) : n = e, Oe(De(Je, {
|
|
509
528
|
context: t
|
|
510
529
|
}), n);
|
|
511
530
|
}
|
|
512
|
-
function
|
|
531
|
+
function gt(e) {
|
|
513
532
|
return {
|
|
514
533
|
id: "example",
|
|
515
534
|
themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
|
|
@@ -538,30 +557,30 @@ function ht(e) {
|
|
|
538
557
|
...e
|
|
539
558
|
};
|
|
540
559
|
}
|
|
541
|
-
const
|
|
560
|
+
const Ye = (e) => {
|
|
542
561
|
if (Object.keys(e).includes("defaultValue"))
|
|
543
562
|
return e.defaultValue;
|
|
544
563
|
};
|
|
545
|
-
function
|
|
564
|
+
function yt(e, ...t) {
|
|
546
565
|
return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
|
|
547
566
|
key: n.key,
|
|
548
567
|
fallbackToDefaultConfiguration: !1,
|
|
549
|
-
value:
|
|
568
|
+
value: Ye(n),
|
|
550
569
|
type: n.type,
|
|
551
570
|
asset: void 0
|
|
552
571
|
}));
|
|
553
572
|
}
|
|
554
|
-
const
|
|
573
|
+
const qe = "@spiffcommerce/theme-bridge", Ke = "1.15.0", Xe = "module", et = {
|
|
555
574
|
build: "tsc && vite build",
|
|
556
575
|
preview: "vite preview",
|
|
557
576
|
dev: "ladle serve",
|
|
558
577
|
schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
|
|
559
|
-
},
|
|
578
|
+
}, tt = "./dist/index.umd.cjs", nt = "./dist/index.js", _t = "./dist/index.d.ts", ot = [
|
|
560
579
|
"./dist"
|
|
561
|
-
],
|
|
580
|
+
], rt = {
|
|
562
581
|
import: "./dist/index.js",
|
|
563
582
|
require: "./dist/index.umd.cjs"
|
|
564
|
-
},
|
|
583
|
+
}, it = {}, st = {
|
|
565
584
|
"@ladle/react": "^4.0.2",
|
|
566
585
|
"@preact/preset-vite": "^2.7.0",
|
|
567
586
|
"@spiffcommerce/core": "^21.0.1",
|
|
@@ -581,23 +600,23 @@ const Je = "@spiffcommerce/theme-bridge", Ye = "1.14.1", qe = "module", Ke = {
|
|
|
581
600
|
vite: "^5.0.8",
|
|
582
601
|
"vite-plugin-css-injected-by-js": "^3.4.0",
|
|
583
602
|
"vite-plugin-externalize-deps": "^0.8.0"
|
|
584
|
-
},
|
|
603
|
+
}, lt = {
|
|
585
604
|
"@spiffcommerce/core": "^21.0.1"
|
|
586
|
-
},
|
|
587
|
-
name:
|
|
588
|
-
version:
|
|
589
|
-
type:
|
|
590
|
-
scripts:
|
|
591
|
-
main:
|
|
592
|
-
module:
|
|
593
|
-
types:
|
|
594
|
-
files:
|
|
595
|
-
exports:
|
|
596
|
-
dependencies:
|
|
597
|
-
devDependencies:
|
|
598
|
-
peerDependencies:
|
|
605
|
+
}, ct = {
|
|
606
|
+
name: qe,
|
|
607
|
+
version: Ke,
|
|
608
|
+
type: Xe,
|
|
609
|
+
scripts: et,
|
|
610
|
+
main: tt,
|
|
611
|
+
module: nt,
|
|
612
|
+
types: _t,
|
|
613
|
+
files: ot,
|
|
614
|
+
exports: rt,
|
|
615
|
+
dependencies: it,
|
|
616
|
+
devDependencies: st,
|
|
617
|
+
peerDependencies: lt
|
|
599
618
|
};
|
|
600
|
-
function
|
|
619
|
+
function ut(e, t, n) {
|
|
601
620
|
if (t.type === "chunk") {
|
|
602
621
|
if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !n)
|
|
603
622
|
return null;
|
|
@@ -616,7 +635,7 @@ function lt(e, t, n) {
|
|
|
616
635
|
};
|
|
617
636
|
return null;
|
|
618
637
|
}
|
|
619
|
-
function
|
|
638
|
+
function bt(e) {
|
|
620
639
|
const {
|
|
621
640
|
autoGenerateTargetFiles: t = !0,
|
|
622
641
|
configurationSchema: n,
|
|
@@ -625,12 +644,12 @@ function vt(e) {
|
|
|
625
644
|
} = e ?? {};
|
|
626
645
|
return {
|
|
627
646
|
name: "spiff-theme-plugin",
|
|
628
|
-
version:
|
|
647
|
+
version: ct.version,
|
|
629
648
|
config(i, c) {
|
|
630
649
|
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 = "";
|
|
631
650
|
},
|
|
632
651
|
writeBundle(i, c) {
|
|
633
|
-
const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null :
|
|
652
|
+
const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null : ut(s, c[s], _)).filter((s) => s !== null) : [];
|
|
634
653
|
o && l.push(...o);
|
|
635
654
|
const u = {
|
|
636
655
|
launchData: {
|
|
@@ -638,19 +657,20 @@ function vt(e) {
|
|
|
638
657
|
},
|
|
639
658
|
configurationSchema: n
|
|
640
659
|
};
|
|
641
|
-
|
|
660
|
+
Pe.writeFileSync(He.join(i.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
|
|
642
661
|
}
|
|
643
662
|
};
|
|
644
663
|
}
|
|
645
664
|
export {
|
|
646
|
-
|
|
647
|
-
|
|
665
|
+
Ve as AssetType,
|
|
666
|
+
G as FieldType,
|
|
648
667
|
B as ThemeFileType,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
668
|
+
gt as exampleThemeInstallConfig,
|
|
669
|
+
yt as getDefaultsForSchema,
|
|
670
|
+
vt as setSpiffDevOptions,
|
|
671
|
+
bt as spiffThemePlugin,
|
|
672
|
+
dt as themeInstallConfigurationFieldsToRecordObject,
|
|
673
|
+
mt as themeInstallConfigurationGraphQlToResource,
|
|
674
|
+
je as themeVersionConfigurationGraphQlToResource,
|
|
675
|
+
ht as themeVersionGraphQlToResource
|
|
656
676
|
};
|
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.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"})});
|
|
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"})});
|