@spiffcommerce/theme-bridge 1.17.0 → 1.17.2

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 CHANGED
@@ -327,7 +327,15 @@ interface AssetResource {
327
327
  * 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.
328
328
  * @returns
329
329
  */
330
- declare function themeInstallConfigurationFieldsToRecordObject(configuration: ThemeInstallConfigurationResource): {
330
+ declare function themeInstallConfigurationFieldsToRecordObject(fields: ThemeInstallConfigurationFieldResource[]): {
331
+ [key: string]: any;
332
+ };
333
+ /**
334
+ * Maps a `ThemeInstallConfigurationResource`'s fields (which is essentially `{ key: string; value: string; }[]`), to the form `{ [key: string]: any }`.
335
+ * 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.
336
+ * @returns
337
+ */
338
+ declare function themeInstallConfigurationToRecordObject(configuration: ThemeInstallConfigurationResource): {
331
339
  [key: string]: any;
332
340
  };
333
341
 
@@ -493,4 +501,4 @@ interface PluginOptions {
493
501
  */
494
502
  declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
495
503
 
496
- export { type AssetResource, AssetType, CustomSchemaType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, 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 };
504
+ export { type AssetResource, AssetType, CustomSchemaType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, 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, themeInstallConfigurationToRecordObject, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
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
- var Pe = (e, t, n) => t in e ? $e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var B = (e, t, n) => (Pe(e, typeof t != "symbol" ? t + "" : t, n), n);
5
- import Te from "fs";
6
- import je from "path";
7
- var Z = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Z || {}), H = /* @__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))(H || {}), He = /* @__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))(He || {}), Ve = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(Ve || {});
8
- function de(e) {
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 B = (e, t, n) => (Te(e, typeof t != "symbol" ? t + "" : t, n), n);
5
+ import je from "fs";
6
+ import Pe from "path";
7
+ var Z = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Z || {}), E = /* @__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))(E || {}), He = /* @__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))(He || {}), Ve = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(Ve || {});
8
+ function X(e) {
9
9
  return Object.assign({}, ...e.map((t) => {
10
10
  if (t.key)
11
11
  return {
@@ -15,17 +15,31 @@ function de(e) {
15
15
  }));
16
16
  }
17
17
  function he(e) {
18
- if (e.type === H.Asset)
18
+ if (e.type === E.Asset)
19
19
  return e.asset;
20
- if (e.type !== H.List && e.type !== H.Object)
20
+ if (e.type !== E.List && e.type !== E.Object) {
21
+ if (e.value === void 0)
22
+ return;
23
+ if (e.type === E.Number)
24
+ try {
25
+ return Number.parseFloat(e.value);
26
+ } catch {
27
+ return;
28
+ }
29
+ else if (e.type === E.Boolean)
30
+ return e.value === "true";
21
31
  return e.value;
32
+ }
22
33
  if (e.listValues)
23
34
  return e.listValues.map(he);
24
35
  if (e.objectValues)
25
- return de(e.objectValues);
36
+ return X(e.objectValues);
26
37
  }
27
38
  function ht(e) {
28
- return de(e.fields);
39
+ return X(e);
40
+ }
41
+ function mt(e) {
42
+ return X(e.fields);
29
43
  }
30
44
  function F(e, t) {
31
45
  const n = {
@@ -44,7 +58,7 @@ function Ie(e) {
44
58
  var i;
45
59
  return {
46
60
  ...o,
47
- fields: (i = o.fields) == null ? void 0 : i.map((c) => F(e.fields[c], e.fields))
61
+ fields: (i = o.fields) == null ? void 0 : i.map((u) => F(e.fields[u], e.fields))
48
62
  };
49
63
  })
50
64
  }, n = [];
@@ -54,7 +68,7 @@ function Ie(e) {
54
68
  throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");
55
69
  return t.fields = n, t;
56
70
  }
57
- function mt(e) {
71
+ function vt(e) {
58
72
  return {
59
73
  ...e,
60
74
  configurationSchema: Ie(e.configurationSchema)
@@ -68,7 +82,7 @@ function Q(e, t) {
68
82
  };
69
83
  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;
70
84
  }
71
- function vt(e) {
85
+ function yt(e) {
72
86
  const t = {
73
87
  ...e,
74
88
  fields: []
@@ -79,7 +93,7 @@ function vt(e) {
79
93
  throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
80
94
  return t.fields = n, t;
81
95
  }
82
- var A, f, me, S, ne, ve, z, D = {}, ye = [], Ne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, X = Array.isArray;
96
+ var A, f, me, S, _e, ve, z, $ = {}, ye = [], Ne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
83
97
  function x(e, t) {
84
98
  for (var n in t)
85
99
  e[n] = t[n];
@@ -90,31 +104,31 @@ function ge(e) {
90
104
  t && t.removeChild(e);
91
105
  }
92
106
  function Le(e, t, n) {
93
- var _, o, i, c = {};
107
+ var _, o, i, u = {};
94
108
  for (i in t)
95
- i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
96
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? A.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
109
+ i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : u[i] = t[i];
110
+ if (arguments.length > 2 && (u.children = arguments.length > 3 ? A.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
97
111
  for (i in e.defaultProps)
98
- c[i] === void 0 && (c[i] = e.defaultProps[i]);
99
- return V(e, c, _, o, null);
112
+ u[i] === void 0 && (u[i] = e.defaultProps[i]);
113
+ return V(e, u, _, o, null);
100
114
  }
101
115
  function V(e, t, n, _, o) {
102
116
  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 };
103
117
  return o == null && f.vnode != null && f.vnode(i), i;
104
118
  }
105
- function W(e) {
119
+ function R(e) {
106
120
  return e.children;
107
121
  }
108
122
  function I(e, t) {
109
123
  this.props = e, this.context = t;
110
124
  }
111
- function E(e, t) {
125
+ function w(e, t) {
112
126
  if (t == null)
113
- return e.__ ? E(e.__, e.__i + 1) : null;
127
+ return e.__ ? w(e.__, e.__i + 1) : null;
114
128
  for (var n; t < e.__k.length; t++)
115
129
  if ((n = e.__k[t]) != null && n.__e != null)
116
130
  return n.__e;
117
- return typeof e.type == "function" ? E(e) : null;
131
+ return typeof e.type == "function" ? w(e) : null;
118
132
  }
119
133
  function be(e) {
120
134
  var t, n;
@@ -127,28 +141,28 @@ function be(e) {
127
141
  return be(e);
128
142
  }
129
143
  }
130
- function _e(e) {
131
- (!e.__d && (e.__d = !0) && S.push(e) && !U.__r++ || ne !== f.debounceRendering) && ((ne = f.debounceRendering) || ve)(U);
144
+ function oe(e) {
145
+ (!e.__d && (e.__d = !0) && S.push(e) && !O.__r++ || _e !== f.debounceRendering) && ((_e = f.debounceRendering) || ve)(O);
132
146
  }
133
- function U() {
134
- var e, t, n, _, o, i, c, l, u;
147
+ function O() {
148
+ var e, t, n, _, o, i, u, l, c;
135
149
  for (S.sort(z); e = S.shift(); )
136
- e.__d && (t = S.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], u = [], (c = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), q(c, _, o, n.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? E(o), !!(32 & o.__u), u), _.__.__k[_.__i] = _, xe(l, _, u), _.__e != i && be(_)), S.length > t && S.sort(z));
137
- U.__r = 0;
150
+ e.__d && (t = S.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], c = [], (u = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), ee(u, _, o, n.__n, u.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? w(o), !!(32 & o.__u), c), _.__.__k[_.__i] = _, xe(l, _, c), _.__e != i && be(_)), S.length > t && S.sort(z));
151
+ O.__r = 0;
138
152
  }
139
- function ke(e, t, n, _, o, i, c, l, u, s, p) {
153
+ function ke(e, t, n, _, o, i, u, l, c, s, p) {
140
154
  var r, d, a, v, k, y = _ && _.__k || ye, h = t.length;
141
- for (n.__d = u, Fe(n, t, y), u = n.__d, r = 0; r < h; r++)
142
- (a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D : y[a.__i] || D, a.__i = r, q(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);
143
- n.__d = u, n.__e = k;
155
+ for (n.__d = c, Fe(n, t, y), c = n.__d, r = 0; r < h; r++)
156
+ (a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? $ : y[a.__i] || $, a.__i = r, ee(e, a, d, o, i, u, l, c, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && te(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 ? c = Ce(a, c, e) : typeof a.type == "function" && a.__d !== void 0 ? c = a.__d : v && (c = v.nextSibling), a.__d = void 0, a.__u &= -196609);
157
+ n.__d = c, n.__e = k;
144
158
  }
145
159
  function Fe(e, t, n) {
146
- var _, o, i, c, l, u = t.length, s = n.length, p = s, r = 0;
147
- for (e.__k = [], _ = 0; _ < u; _++)
148
- (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) : X(o) ? V(W, { 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 = Ue(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 = E(i)), J(i, i, !1), n[_] = null, p--);
160
+ var _, o, i, u, l, c = t.length, s = n.length, p = s, r = 0;
161
+ for (e.__k = [], _ = 0; _ < c; _++)
162
+ (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) : q(o) ? V(R, { 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 = Oe(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 = w(i)), J(i, i, !1), n[_] = null, p--);
149
163
  if (p)
150
164
  for (_ = 0; _ < s; _++)
151
- (i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = E(i)), J(i, i));
165
+ (i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = w(i)), J(i, i));
152
166
  }
153
167
  function Ce(e, t, n) {
154
168
  var _, o;
@@ -159,29 +173,29 @@ function Ce(e, t, n) {
159
173
  }
160
174
  return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
161
175
  }
162
- function Ue(e, t, n, _) {
163
- var o = e.key, i = e.type, c = n - 1, l = n + 1, u = t[n];
164
- if (u === null || u && o == u.key && i === u.type)
176
+ function Oe(e, t, n, _) {
177
+ var o = e.key, i = e.type, u = n - 1, l = n + 1, c = t[n];
178
+ if (c === null || c && o == c.key && i === c.type)
165
179
  return n;
166
- if (_ > (u != null && !(131072 & u.__u) ? 1 : 0))
167
- for (; c >= 0 || l < t.length; ) {
168
- if (c >= 0) {
169
- if ((u = t[c]) && !(131072 & u.__u) && o == u.key && i === u.type)
170
- return c;
171
- c--;
180
+ if (_ > (c != null && !(131072 & c.__u) ? 1 : 0))
181
+ for (; u >= 0 || l < t.length; ) {
182
+ if (u >= 0) {
183
+ if ((c = t[u]) && !(131072 & c.__u) && o == c.key && i === c.type)
184
+ return u;
185
+ u--;
172
186
  }
173
187
  if (l < t.length) {
174
- if ((u = t[l]) && !(131072 & u.__u) && o == u.key && i === u.type)
188
+ if ((c = t[l]) && !(131072 & c.__u) && o == c.key && i === c.type)
175
189
  return l;
176
190
  l++;
177
191
  }
178
192
  }
179
193
  return -1;
180
194
  }
181
- function oe(e, t, n) {
195
+ function re(e, t, n) {
182
196
  t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ne.test(t) ? n : n + "px";
183
197
  }
184
- function j(e, t, n, _, o) {
198
+ function H(e, t, n, _, o) {
185
199
  var i;
186
200
  e:
187
201
  if (t === "style")
@@ -190,13 +204,13 @@ function j(e, t, n, _, o) {
190
204
  else {
191
205
  if (typeof _ == "string" && (e.style.cssText = _ = ""), _)
192
206
  for (t in _)
193
- n && t in n || oe(e.style, t, "");
207
+ n && t in n || re(e.style, t, "");
194
208
  if (n)
195
209
  for (t in n)
196
- _ && n[t] === _[t] || oe(e.style, t, n[t]);
210
+ _ && n[t] === _[t] || re(e.style, t, n[t]);
197
211
  }
198
212
  else if (t[0] === "o" && t[1] === "n")
199
- 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);
213
+ 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 ? se : ie, i)) : e.removeEventListener(t, i ? se : ie, i);
200
214
  else {
201
215
  if (o)
202
216
  t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
@@ -209,7 +223,7 @@ function j(e, t, n, _, o) {
209
223
  typeof n == "function" || (n == null || n === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, n));
210
224
  }
211
225
  }
212
- function re(e) {
226
+ function ie(e) {
213
227
  var t = this.l[e.type + !1];
214
228
  if (e.t) {
215
229
  if (e.t <= t.u)
@@ -218,14 +232,14 @@ function re(e) {
218
232
  e.t = Date.now();
219
233
  return t(f.event ? f.event(e) : e);
220
234
  }
221
- function ie(e) {
235
+ function se(e) {
222
236
  return this.l[e.type + !0](f.event ? f.event(e) : e);
223
237
  }
224
- function q(e, t, n, _, o, i, c, l, u, s) {
225
- var p, r, d, a, v, k, y, h, g, C, $, w, te, P, R, b = t.type;
238
+ function ee(e, t, n, _, o, i, u, l, c, s) {
239
+ var p, r, d, a, v, k, y, h, g, C, T, D, ne, j, W, b = t.type;
226
240
  if (t.constructor !== void 0)
227
241
  return null;
228
- 128 & n.__u && (u = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
242
+ 128 & n.__u && (c = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
229
243
  e:
230
244
  if (typeof b == "function")
231
245
  try {
@@ -233,37 +247,37 @@ function q(e, t, n, _, o, i, c, l, u, s) {
233
247
  b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
234
248
  else {
235
249
  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)) {
236
- 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(T) {
237
- T && (T.__ = t);
238
- }), $ = 0; $ < r._sb.length; $++)
239
- r.__h.push(r._sb[$]);
240
- r._sb = [], r.__h.length && c.push(r);
250
+ 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) {
251
+ P && (P.__ = t);
252
+ }), T = 0; T < r._sb.length; T++)
253
+ r.__h.push(r._sb[T]);
254
+ r._sb = [], r.__h.length && u.push(r);
241
255
  break e;
242
256
  }
243
257
  r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, C), r.componentDidUpdate != null && r.__h.push(function() {
244
258
  r.componentDidUpdate(a, v, k);
245
259
  });
246
260
  }
247
- if (r.context = C, r.props = h, r.__P = e, r.__e = !1, w = f.__r, te = 0, "prototype" in b && b.prototype.render) {
248
- for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), P = 0; P < r._sb.length; P++)
249
- r.__h.push(r._sb[P]);
261
+ if (r.context = C, r.props = h, r.__P = e, r.__e = !1, D = f.__r, ne = 0, "prototype" in b && b.prototype.render) {
262
+ for (r.state = r.__s, r.__d = !1, D && D(t), p = r.render(r.props, r.state, r.context), j = 0; j < r._sb.length; j++)
263
+ r.__h.push(r._sb[j]);
250
264
  r._sb = [];
251
265
  } else
252
266
  do
253
- r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
254
- while (r.__d && ++te < 25);
255
- r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, X(R = p != null && p.type === W && p.key == null ? p.props.children : p) ? R : [R], t, n, _, o, i, c, l, u, s), r.base = t.__e, t.__u &= -161, r.__h.length && c.push(r), y && (r.__E = r.__ = null);
256
- } catch (T) {
257
- 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(T, t, n);
267
+ r.__d = !1, D && D(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
268
+ while (r.__d && ++ne < 25);
269
+ r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, q(W = p != null && p.type === R && p.key == null ? p.props.children : p) ? W : [W], t, n, _, o, i, u, l, c, s), r.base = t.__e, t.__u &= -161, r.__h.length && u.push(r), y && (r.__E = r.__ = null);
270
+ } catch (P) {
271
+ 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(P, t, n);
258
272
  }
259
273
  else
260
- i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Oe(n.__e, t, n, _, o, i, c, u, s);
274
+ i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Ue(n.__e, t, n, _, o, i, u, c, s);
261
275
  (p = f.diffed) && p(t);
262
276
  }
263
277
  function xe(e, t, n) {
264
278
  t.__d = void 0;
265
279
  for (var _ = 0; _ < n.length; _++)
266
- ee(n[_], n[++_], n[++_]);
280
+ te(n[_], n[++_], n[++_]);
267
281
  f.__c && f.__c(t, e), e.some(function(o) {
268
282
  try {
269
283
  e = o.__h, o.__h = [], e.some(function(i) {
@@ -274,7 +288,7 @@ function xe(e, t, n) {
274
288
  }
275
289
  });
276
290
  }
277
- function Oe(e, t, n, _, o, i, c, l, u) {
291
+ function Ue(e, t, n, _, o, i, u, l, c) {
278
292
  var s, p, r, d, a, v, k, y = n.props, h = t.props, g = t.type;
279
293
  if (g === "svg" && (o = !0), i != null) {
280
294
  for (s = 0; s < i.length; s++)
@@ -291,23 +305,23 @@ function Oe(e, t, n, _, o, i, c, l, u) {
291
305
  if (g === null)
292
306
  y === h || l && e.data === h || (e.data = h);
293
307
  else {
294
- if (i = i && A.call(e.childNodes), y = n.props || D, !l && i != null)
308
+ if (i = i && A.call(e.childNodes), y = n.props || $, !l && i != null)
295
309
  for (y = {}, s = 0; s < e.attributes.length; s++)
296
310
  y[(a = e.attributes[s]).name] = a.value;
297
311
  for (s in y)
298
- a = y[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || j(e, s, null, a, o));
312
+ a = y[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || H(e, s, null, a, o));
299
313
  for (s in h)
300
- 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" || y[s] === a || j(e, s, a, y[s], o);
314
+ 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" || y[s] === a || H(e, s, a, y[s], o);
301
315
  if (p)
302
316
  l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
303
- else if (r && (e.innerHTML = ""), ke(e, X(d) ? d : [d], t, n, _, o && g !== "foreignObject", i, c, i ? i[0] : n.__k && E(n, 0), l, u), i != null)
317
+ else if (r && (e.innerHTML = ""), ke(e, q(d) ? d : [d], t, n, _, o && g !== "foreignObject", i, u, i ? i[0] : n.__k && w(n, 0), l, c), i != null)
304
318
  for (s = i.length; s--; )
305
319
  i[s] != null && ge(i[s]);
306
- l || (s = "value", v !== void 0 && (v !== e[s] || g === "progress" && !v || g === "option" && v !== y[s]) && j(e, s, v, y[s], !1), s = "checked", k !== void 0 && k !== e[s] && j(e, s, k, y[s], !1));
320
+ l || (s = "value", v !== void 0 && (v !== e[s] || g === "progress" && !v || g === "option" && v !== y[s]) && H(e, s, v, y[s], !1), s = "checked", k !== void 0 && k !== e[s] && H(e, s, k, y[s], !1));
307
321
  }
308
322
  return e;
309
323
  }
310
- function ee(e, t, n) {
324
+ function te(e, t, n) {
311
325
  try {
312
326
  typeof e == "function" ? e(t) : e.current = t;
313
327
  } catch (_) {
@@ -316,7 +330,7 @@ function ee(e, t, n) {
316
330
  }
317
331
  function J(e, t, n) {
318
332
  var _, o;
319
- if (f.unmount && f.unmount(e), (_ = e.ref) && (_.current && _.current !== e.__e || ee(_, null, t)), (_ = e.__c) != null) {
333
+ if (f.unmount && f.unmount(e), (_ = e.ref) && (_.current && _.current !== e.__e || te(_, null, t)), (_ = e.__c) != null) {
320
334
  if (_.componentWillUnmount)
321
335
  try {
322
336
  _.componentWillUnmount();
@@ -334,14 +348,14 @@ function Me(e, t, n) {
334
348
  return this.constructor(e, n);
335
349
  }
336
350
  function Ae(e, t, n) {
337
- var _, o, i, c;
338
- f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [], q(t, e = (!_ && n || t).__k = Le(W, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? A.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, c), xe(i, e, c);
351
+ var _, o, i, u;
352
+ f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], u = [], ee(t, e = (!_ && n || t).__k = Le(R, null, [e]), o || $, $, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? A.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, u), xe(i, e, u);
339
353
  }
340
354
  A = ye.slice, f = { __e: function(e, t, n, _) {
341
- for (var o, i, c; t = t.__; )
355
+ for (var o, i, u; t = t.__; )
342
356
  if ((o = t.__c) && !o.__)
343
357
  try {
344
- 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)
358
+ 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)
345
359
  return o.__E = o;
346
360
  } catch (l) {
347
361
  e = l;
@@ -349,28 +363,28 @@ A = ye.slice, f = { __e: function(e, t, n, _) {
349
363
  throw e;
350
364
  } }, me = 0, I.prototype.setState = function(e, t) {
351
365
  var n;
352
- 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));
366
+ 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), oe(this));
353
367
  }, I.prototype.forceUpdate = function(e) {
354
- this.__v && (this.__e = !0, e && this.__h.push(e), _e(this));
355
- }, I.prototype.render = W, S = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
368
+ this.__v && (this.__e = !0, e && this.__h.push(e), oe(this));
369
+ }, I.prototype.render = R, S = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
356
370
  return e.__v.__b - t.__v.__b;
357
- }, U.__r = 0;
358
- var O, m, G, se, Y = 0, Se = [], N = [], le = f.__b, ce = f.__r, ue = f.diffed, ae = f.__c, fe = f.unmount;
371
+ }, O.__r = 0;
372
+ var U, m, G, le, Y = 0, Se = [], N = [], ue = f.__b, ce = f.__r, ae = f.diffed, fe = f.__c, pe = f.unmount;
359
373
  function Ee(e, t) {
360
374
  f.__h && f.__h(m, e, Y || t), Y = 0;
361
375
  var n = m.__H || (m.__H = { __: [], __h: [] });
362
376
  return e >= n.__.length && n.__.push({ __V: N }), n.__[e];
363
377
  }
364
- function We(e) {
365
- return Y = 1, Re(we, e);
378
+ function Re(e) {
379
+ return Y = 1, We(we, e);
366
380
  }
367
- function Re(e, t, n) {
368
- var _ = Ee(O++, 2);
381
+ function We(e, t, n) {
382
+ var _ = Ee(U++, 2);
369
383
  if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(l) {
370
- var u = _.__N ? _.__N[0] : _.__[0], s = _.t(u, l);
371
- u !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
384
+ var c = _.__N ? _.__N[0] : _.__[0], s = _.t(c, l);
385
+ c !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
372
386
  }], _.__c = m, !m.u)) {
373
- var o = function(l, u, s) {
387
+ var o = function(l, c, s) {
374
388
  if (!_.__c.__H)
375
389
  return !0;
376
390
  var p = _.__c.__H.__.filter(function(d) {
@@ -379,29 +393,29 @@ function Re(e, t, n) {
379
393
  if (p.every(function(d) {
380
394
  return !d.__N;
381
395
  }))
382
- return !i || i.call(this, l, u, s);
396
+ return !i || i.call(this, l, c, s);
383
397
  var r = !1;
384
398
  return p.forEach(function(d) {
385
399
  if (d.__N) {
386
400
  var a = d.__[0];
387
401
  d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (r = !0);
388
402
  }
389
- }), !(!r && _.__c.props === l) && (!i || i.call(this, l, u, s));
403
+ }), !(!r && _.__c.props === l) && (!i || i.call(this, l, c, s));
390
404
  };
391
405
  m.u = !0;
392
- var i = m.shouldComponentUpdate, c = m.componentWillUpdate;
393
- m.componentWillUpdate = function(l, u, s) {
406
+ var i = m.shouldComponentUpdate, u = m.componentWillUpdate;
407
+ m.componentWillUpdate = function(l, c, s) {
394
408
  if (this.__e) {
395
409
  var p = i;
396
- i = void 0, o(l, u, s), i = p;
410
+ i = void 0, o(l, c, s), i = p;
397
411
  }
398
- c && c.call(this, l, u, s);
412
+ u && u.call(this, l, c, s);
399
413
  }, m.shouldComponentUpdate = o;
400
414
  }
401
415
  return _.__N || _.__;
402
416
  }
403
417
  function Be(e, t) {
404
- var n = Ee(O++, 3);
418
+ var n = Ee(U++, 3);
405
419
  !f.__s && Qe(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
406
420
  }
407
421
  function Ge() {
@@ -414,17 +428,17 @@ function Ge() {
414
428
  }
415
429
  }
416
430
  f.__b = function(e) {
417
- m = null, le && le(e);
431
+ m = null, ue && ue(e);
418
432
  }, f.__r = function(e) {
419
- ce && ce(e), O = 0;
433
+ ce && ce(e), U = 0;
420
434
  var t = (m = e.__c).__H;
421
435
  t && (G === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
422
436
  n.__N && (n.__ = n.__N), n.__V = N, n.__N = n.i = void 0;
423
- })) : (t.__h.forEach(L), t.__h.forEach(K), t.__h = [], O = 0)), G = m;
437
+ })) : (t.__h.forEach(L), t.__h.forEach(K), t.__h = [], U = 0)), G = m;
424
438
  }, f.diffed = function(e) {
425
- ue && ue(e);
439
+ ae && ae(e);
426
440
  var t = e.__c;
427
- t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && se === f.requestAnimationFrame || ((se = f.requestAnimationFrame) || Ze)(Ge)), t.__H.__.forEach(function(n) {
441
+ t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && le === f.requestAnimationFrame || ((le = f.requestAnimationFrame) || Ze)(Ge)), t.__H.__.forEach(function(n) {
428
442
  n.i && (n.__H = n.i), n.__V !== N && (n.__ = n.__V), n.i = void 0, n.__V = N;
429
443
  })), G = m = null;
430
444
  }, f.__c = function(e, t) {
@@ -438,9 +452,9 @@ f.__b = function(e) {
438
452
  o.__h && (o.__h = []);
439
453
  }), t = [], f.__e(_, n.__v);
440
454
  }
441
- }), ae && ae(e, t);
455
+ }), fe && fe(e, t);
442
456
  }, f.unmount = function(e) {
443
- fe && fe(e);
457
+ pe && pe(e);
444
458
  var t, n = e.__c;
445
459
  n && n.__H && (n.__H.__.forEach(function(_) {
446
460
  try {
@@ -450,12 +464,12 @@ f.__b = function(e) {
450
464
  }
451
465
  }), n.__H = void 0, t && f.__e(t, n.__v));
452
466
  };
453
- var pe = typeof requestAnimationFrame == "function";
467
+ var de = typeof requestAnimationFrame == "function";
454
468
  function Ze(e) {
455
469
  var t, n = function() {
456
- clearTimeout(_), pe && cancelAnimationFrame(t), setTimeout(e);
470
+ clearTimeout(_), de && cancelAnimationFrame(t), setTimeout(e);
457
471
  }, _ = setTimeout(n, 100);
458
- pe && (t = requestAnimationFrame(n));
472
+ de && (t = requestAnimationFrame(n));
459
473
  }
460
474
  function L(e) {
461
475
  var t = m, n = e.__c;
@@ -475,13 +489,13 @@ function we(e, t) {
475
489
  }
476
490
  var ze = 0;
477
491
  function De(e, t, n, _, o, i) {
478
- var c, l, u = {};
492
+ var u, l, c = {};
479
493
  for (l in t)
480
- l == "ref" ? c = t[l] : u[l] = t[l];
481
- 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: --ze, __i: -1, __u: 0, __source: o, __self: i };
482
- if (typeof e == "function" && (c = e.defaultProps))
483
- for (l in c)
484
- u[l] === void 0 && (u[l] = c[l]);
494
+ l == "ref" ? u = t[l] : c[l] = t[l];
495
+ 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: --ze, __i: -1, __u: 0, __source: o, __self: i };
496
+ if (typeof e == "function" && (u = e.defaultProps))
497
+ for (l in u)
498
+ c[l] === void 0 && (c[l] = u[l]);
485
499
  return f.vnode && f.vnode(s), s;
486
500
  }
487
501
  class Je {
@@ -517,7 +531,7 @@ let M;
517
531
  const Ye = ({
518
532
  context: e
519
533
  }) => {
520
- const [t, n] = We(null);
534
+ const [t, n] = Re(null);
521
535
  return Be(() => {
522
536
  if (t) {
523
537
  if (M === void 0)
@@ -532,14 +546,14 @@ const Ye = ({
532
546
  id: "spiffThemeWrapper"
533
547
  });
534
548
  };
535
- function yt(e, t) {
549
+ function gt(e, t) {
536
550
  M = new Je(), window.SpiffThemeLoader = M;
537
551
  let n;
538
552
  typeof e == "string" ? n = document.getElementById(e) : n = e, Ae(De(Ye, {
539
553
  context: t
540
554
  }), n);
541
555
  }
542
- function gt(e) {
556
+ function bt(e) {
543
557
  return {
544
558
  id: "example",
545
559
  themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
@@ -572,7 +586,7 @@ const Ke = (e) => {
572
586
  if (Object.keys(e).includes("defaultValue"))
573
587
  return e.defaultValue;
574
588
  };
575
- function bt(e, ...t) {
589
+ function kt(e, ...t) {
576
590
  return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
577
591
  key: n.key,
578
592
  fallbackToDefaultConfiguration: !1,
@@ -581,7 +595,7 @@ function bt(e, ...t) {
581
595
  asset: void 0
582
596
  }));
583
597
  }
584
- const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.0", et = "module", tt = {
598
+ const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.2", et = "module", tt = {
585
599
  build: "tsc && vite build",
586
600
  preview: "vite preview",
587
601
  dev: "ladle serve",
@@ -611,9 +625,9 @@ const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.0", et = "module", tt = {
611
625
  vite: "^5.0.8",
612
626
  "vite-plugin-css-injected-by-js": "^3.4.0",
613
627
  "vite-plugin-externalize-deps": "^0.8.0"
614
- }, ct = {
615
- "@spiffcommerce/core": "^21.0.1"
616
628
  }, ut = {
629
+ "@spiffcommerce/core": "^21.0.1"
630
+ }, ct = {
617
631
  name: Xe,
618
632
  version: qe,
619
633
  type: et,
@@ -625,7 +639,7 @@ const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.0", et = "module", tt = {
625
639
  exports: it,
626
640
  dependencies: st,
627
641
  devDependencies: lt,
628
- peerDependencies: ct
642
+ peerDependencies: ut
629
643
  };
630
644
  function at(e, t, n) {
631
645
  if (t.type === "chunk") {
@@ -646,7 +660,7 @@ function at(e, t, n) {
646
660
  };
647
661
  return null;
648
662
  }
649
- function kt(e) {
663
+ function Ct(e) {
650
664
  const {
651
665
  autoGenerateTargetFiles: t = !0,
652
666
  configurationSchema: n,
@@ -655,34 +669,35 @@ function kt(e) {
655
669
  } = e ?? {};
656
670
  return {
657
671
  name: "spiff-theme-plugin",
658
- version: ut.version,
659
- config(i, c) {
672
+ version: ct.version,
673
+ config(i, u) {
660
674
  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 = "";
661
675
  },
662
- writeBundle(i, c) {
663
- const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null : at(s, c[s], _)).filter((s) => s !== null) : [];
676
+ writeBundle(i, u) {
677
+ const l = t ? Object.keys(u).map((s) => o != null && o.some((p) => p.filename === s) ? null : at(s, u[s], _)).filter((s) => s !== null) : [];
664
678
  o && l.push(...o);
665
- const u = {
679
+ const c = {
666
680
  launchData: {
667
681
  targetFiles: l
668
682
  },
669
683
  configurationSchema: n
670
684
  };
671
- Te.writeFileSync(je.join(i.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
685
+ je.writeFileSync(Pe.join(i.dir, "spiffTheme.json"), JSON.stringify(c, void 0, 4));
672
686
  }
673
687
  };
674
688
  }
675
689
  export {
676
690
  He as AssetType,
677
691
  Ve as CustomSchemaType,
678
- H as FieldType,
692
+ E as FieldType,
679
693
  Z as ThemeFileType,
680
- gt as exampleThemeInstallConfig,
681
- bt as getDefaultsForSchema,
682
- yt as setSpiffDevOptions,
683
- kt as spiffThemePlugin,
694
+ bt as exampleThemeInstallConfig,
695
+ kt as getDefaultsForSchema,
696
+ gt as setSpiffDevOptions,
697
+ Ct as spiffThemePlugin,
684
698
  ht as themeInstallConfigurationFieldsToRecordObject,
685
- vt as themeInstallConfigurationGraphQlToResource,
699
+ yt as themeInstallConfigurationGraphQlToResource,
700
+ mt as themeInstallConfigurationToRecordObject,
686
701
  Ie as themeVersionConfigurationGraphQlToResource,
687
- mt as themeVersionGraphQlToResource
702
+ vt as themeVersionGraphQlToResource
688
703
  };
@@ -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 it=Object.defineProperty;var st=(h,k,T)=>k in h?it(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var _e=(h,k,T)=>(st(h,typeof k!="symbol"?k+"":k,T),T);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),$=(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||{}),re=(e=>(e.Object="Object",e.Union="Union",e))(re||{});function ie(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t),schema:t.schema??void 0}}))}function se(e){if(e.type===$.Asset)return e.asset;if(e.type!==$.List&&e.type!==$.Object)return e.value;if(e.listValues)return e.listValues.map(se);if(e.objectValues)return ie(e.objectValues)}function Ie(e){return ie(e.fields)}function H(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=H(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>H(t[_],t))),n}function le(e){var _;const t={...e,fields:[],customSchemas:(_=e.customSchemas)==null?void 0:_.map(o=>{var i;return{...o,fields:(i=o.fields)==null?void 0:i.map(u=>H(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(o=>{o.root&&n.push(H(o,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 Ne(e){return{...e,configurationSchema:le(e.configurationSchema)}}function Z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Z(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Z(t[_],t))),n}function Fe(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 I,f,ue,w,ce,ae,z,j={},fe=[],Le=/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 pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Oe(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?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,_,o,null)}function N(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ue,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function L(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 de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!O.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(O)}function O(){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(_),Y(u,_,o,n.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),c),_.__.__k[_.__i]=_,ke(l,_,c),_.__e!=i&&de(_)),w.length>t&&w.sort(z));O.__r=0}function me(e,t,n,_,o,i,u,l,c,s,p){var r,d,a,y,S,g=_&&_.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?j:g[a.__i]||j,a.__i=r,Y(e,a,d,o,i,u,l,c,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&K(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=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var _,o,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=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?N(null,o,null,null,o):J(o)?N(F,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?N(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)),X(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)),X(i,i))}function ve(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=ve(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function 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 ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function U(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||ye(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,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 ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function Y(e,t,n,_,o,i,u,l,c,s){var p,r,d,a,y,S,g,m,b,E,G,P,He,B,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 L(m,E),r.constructor=C,r.render=Ae),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(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,He=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++He<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,J(ne=p!=null&&p.type===F&&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(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Me(n.__e,t,n,_,o,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)K(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&&I.call(e.childNodes),g=n.props||j,!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||U(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||U(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=""),me(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&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&U(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&U(e,s,S,g[s],!1))}return e}function K(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function X(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||K(_,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]&&X(_[o],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function Ae(e,t,n){return this.constructor(e,n)}function We(e,t,n){var _,o,i,u;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],Y(t,e=(!_&&n||t).__k=Oe(F,null,[e]),o||j,j,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?I.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,u),ke(i,e,u)}I=fe.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}},ue=0,L.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),he(this))},L.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},L.prototype.render=F,w=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0;var R,v,q,Ce,ee=0,Se=[],M=[],xe=f.__b,Ee=f.__r,Te=f.diffed,we=f.__c,De=f.unmount;function $e(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 Ge(e){return ee=1,Be(Pe,e)}function Be(e,t,n){var _=$e(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 Qe(e,t){var n=$e(R++,3);!f.__s&&Je(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(te),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,xe&&xe(e)},f.__r=function(e){Ee&&Ee(e),R=0;var t=(v=e.__c).__H;t&&(q===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(te),t.__h=[],R=0)),q=v},f.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||ze)(Ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),q=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(_){return!_.__||te(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{A(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var je=typeof requestAnimationFrame=="function";function ze(e){var t,n=function(){clearTimeout(_),je&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);je&&(t=requestAnimationFrame(n))}function A(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 Je(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 Ye=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:--Ye,__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 Ke{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const Xe=({context:e})=>{const[t,n]=Ge(null);return Qe(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function qe(e,t){W=new Ke,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,We(Ve(Xe,{context:t}),n)}function et(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 tt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function nt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:tt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.17.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 ot(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 rt(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>o!=null&&o.some(p=>p.filename===s)?null:ot(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.CustomSchemaType=re,h.FieldType=$,h.ThemeFileType=V,h.exampleThemeInstallConfig=et,h.getDefaultsForSchema=nt,h.setSpiffDevOptions=qe,h.spiffThemePlugin=rt,h.themeInstallConfigurationFieldsToRecordObject=Ie,h.themeInstallConfigurationGraphQlToResource=Fe,h.themeVersionConfigurationGraphQlToResource=le,h.themeVersionGraphQlToResource=Ne,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
2
+ (function(d,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(d=typeof globalThis<"u"?globalThis:d||self,k(d.theme={},d.fs,d.path))})(this,function(d,k,x){"use strict";var st=Object.defineProperty;var lt=(d,k,x)=>k in d?st(d,k,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[k]=x;var _e=(d,k,x)=>(lt(d,typeof k!="symbol"?k+"":k,x),x);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),w=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(w||{}),re=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(re||{}),ie=(e=>(e.Object="Object",e.Union="Union",e))(ie||{});function Z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t),schema:t.schema??void 0}}))}function se(e){if(e.type===w.Asset)return e.asset;if(e.type!==w.List&&e.type!==w.Object){if(e.value===void 0)return;if(e.type===w.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===w.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(se);if(e.objectValues)return Z(e.objectValues)}function He(e){return Z(e)}function Ne(e){return Z(e.fields)}function I(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=I(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(o=>I(t[o],t))),n}function le(e){var o;const t={...e,fields:[],customSchemas:(o=e.customSchemas)==null?void 0:o.map(_=>{var i;return{..._,fields:(i=_.fields)==null?void 0:i.map(u=>I(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(I(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Fe(e){return{...e,configurationSchema:le(e.configurationSchema)}}function z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(o=>z(t[o],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(o=>z(t[o],t))),n}function Oe(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(o=>{o.root&&n.push(z(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,ue,D,ce,ae,J,$={},fe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Re(e,t,n){var o,_,i,u={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,o,_,null)}function N(e,t,n,o,_){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ue,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function j(e,t){if(t==null)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?j(e):null}function de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!L.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(L)}function L(){var e,t,n,o,_,i,u,l,c;for(D.sort(J);e=D.shift();)e.__d&&(t=D.length,o=void 0,i=(_=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((o=T({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),K(u,o,_,n.__n,u.ownerSVGElement!==void 0,32&_.__u?[i]:null,l,i??j(_),!!(32&_.__u),c),o.__.__k[o.__i]=o,ke(l,o,c),o.__e!=i&&de(o)),D.length>t&&D.sort(J));L.__r=0}function me(e,t,n,o,_,i,u,l,c,s,p){var r,h,a,y,S,g=o&&o.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(h=a.__i===-1?$:g[a.__i]||$,a.__i=r,K(e,a,h,_,i,u,l,c,s,p),y=a.__e,a.ref&&h.ref!=a.ref&&(h.ref&&X(h.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||h.__k===a.__k?c=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var o,_,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<c;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?N(null,_,null,null,_):Y(_)?N(F,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?N(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,l=Me(_,n,u=o+r,p),_.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i,!1),n[o]=null,p--);if(p)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i))}function ve(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ve(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Me(e,t,n,o){var _=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&_==c.key&&i===c.type)return n;if(o>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&_==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&_==c.key&&i===c.type)return l;l++}}return-1}function ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function R(e,t,n,o,_){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ye(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,i);else{if(_)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function K(e,t,n,o,_,i,u,l,c,s){var p,r,h,a,y,S,g,m,b,E,G,P,Ie,B,oe,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&o[p.__c],E=p?b?b.props.value:p.__:o,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new O(m,E),r.constructor=C,r.render=We),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=T({},r.__s)),T(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,h)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,Ie=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Ie<25);r.state=r.__s,r.getChildContext!=null&&(o=T(T({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,Y(oe=p!=null&&p.type===F&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ae(n.__e,t,n,o,_,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)X(n[o],n[++o],n[++o]);f.__c&&f.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(i){i.call(_)})}catch(i){f.__e(i,_.__v)}})}function Ae(e,t,n,o,_,i,u,l,c){var s,p,r,h,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=_?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),g=n.props||$,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||R(e,s,null,a,_));for(s in m)a=m[s],s=="children"?h=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||R(e,s,a,g[s],_);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),me(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,u,i?i[0]:n.__k&&j(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&R(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&R(e,s,S,g[s],!1))}return e}function X(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function q(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||X(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){f.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&q(o[_],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function We(e,t,n){return this.constructor(e,n)}function Ge(e,t,n){var o,_,i,u;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],K(t,e=(!o&&n||t).__k=Re(F,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?H.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,u),ke(i,e,u)}H=fe.slice,f={__e:function(e,t,n,o){for(var _,i,u;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),u=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),u=_.__d),u)return _.__E=_}catch(l){e=l}throw e}},ue=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),he(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},O.prototype.render=F,D=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var U,v,ee,Ce,te=0,Se=[],M=[],Te=f.__b,Ee=f.__r,xe=f.diffed,we=f.__c,De=f.unmount;function je(e,t){f.__h&&f.__h(v,e,te||t),te=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function Be(e){return te=1,Qe(Pe,e)}function Qe(e,t,n){var o=je(U++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Pe(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],s=o.t(c,l);c!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(l,c,s){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(h){return h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(h){if(h.__N){var a=h.__[0];h.__=h.__N,h.__N=void 0,a!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,_(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Ze(e,t){var n=je(U++,3);!f.__s&&Ye(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Te&&Te(e)},f.__r=function(e){Ee&&Ee(e),U=0;var t=(v=e.__c).__H;t&&(ee===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(ne),t.__h=[],U=0)),ee=v},f.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||Je)(ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{A(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Je(e){var t,n=function(){clearTimeout(o),$e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function A(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ne(e){var t=v;e.__c=e.__(),v=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Ke=0;function Ve(e,t,n,o,_,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ke,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class Xe{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const qe=({context:e})=>{const[t,n]=Be(null);return Ze(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function et(e,t){W=new Xe,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ge(Ve(qe,{context:t}),n)}function tt(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const nt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function ot(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:nt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.17.2",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function rt(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function it(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>_!=null&&_.some(p=>p.filename===s)?null:rt(s,u[s],o)).filter(s=>s!==null):[];_&&l.push(..._);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(x.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}d.AssetType=re,d.CustomSchemaType=ie,d.FieldType=w,d.ThemeFileType=V,d.exampleThemeInstallConfig=tt,d.getDefaultsForSchema=ot,d.setSpiffDevOptions=et,d.spiffThemePlugin=it,d.themeInstallConfigurationFieldsToRecordObject=He,d.themeInstallConfigurationGraphQlToResource=Oe,d.themeInstallConfigurationToRecordObject=Ne,d.themeVersionConfigurationGraphQlToResource=le,d.themeVersionGraphQlToResource=Fe,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",