@spiffcommerce/theme-bridge 1.11.2 → 1.11.4

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
@@ -289,6 +289,7 @@ type SpiffThemeLoader = {
289
289
  type SpiffDevOptions = Omit<ThemeContextTransaction, "container"> | Omit<ThemeContextBundle, "container">;
290
290
  declare function setSpiffDevOptions(container: HTMLElement | string, context: SpiffDevOptions): void;
291
291
  declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurationResource>): ThemeInstallConfigurationResource;
292
+ declare function getDefaultsForSchema(schema: ThemeConfigurationSchema, ...excludeKeys: string[]): ThemeInstallConfigurationField[];
292
293
 
293
294
  interface PluginOptions {
294
295
  /**
@@ -319,4 +320,4 @@ interface PluginOptions {
319
320
  */
320
321
  declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
321
322
 
322
- export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionResource, exampleThemeInstallConfig, setSpiffDevOptions, spiffThemePlugin };
323
+ export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin };
package/dist/index.js CHANGED
@@ -1,167 +1,167 @@
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 Ce = Object.defineProperty;
3
- var Ee = (e, _, t) => _ in e ? Ce(e, _, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[_] = t;
4
- var B = (e, _, t) => (Ee(e, typeof _ != "symbol" ? _ + "" : _, t), t);
5
- import Se from "fs";
3
+ var Se = (e, t, _) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : e[t] = _;
4
+ var B = (e, t, _) => (Se(e, typeof t != "symbol" ? t + "" : t, _), _);
5
+ import Ee from "fs";
6
6
  import we from "path";
7
- var O = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(O || {}), $e = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))($e || {}), De = /* @__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))(De || {}), A, f, ue, E, X, fe, Z, $ = {}, pe = [], He = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
8
- function C(e, _) {
9
- for (var t in _)
10
- e[t] = _[t];
7
+ var q = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(q || {}), De = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))(De || {}), $e = /* @__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))($e || {}), V, f, ue, S, X, fe, Z, D = {}, pe = [], He = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
8
+ function C(e, t) {
9
+ for (var _ in t)
10
+ e[_] = t[_];
11
11
  return e;
12
12
  }
13
13
  function de(e) {
14
- var _ = e.parentNode;
15
- _ && _.removeChild(e);
14
+ var t = e.parentNode;
15
+ t && t.removeChild(e);
16
16
  }
17
- function Pe(e, _, t) {
17
+ function Pe(e, t, _) {
18
18
  var n, o, i, c = {};
19
- for (i in _)
20
- i == "key" ? n = _[i] : i == "ref" ? o = _[i] : c[i] = _[i];
21
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? A.call(arguments, 2) : t), typeof e == "function" && e.defaultProps != null)
19
+ for (i in t)
20
+ i == "key" ? n = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
21
+ if (arguments.length > 2 && (c.children = arguments.length > 3 ? V.call(arguments, 2) : _), typeof e == "function" && e.defaultProps != null)
22
22
  for (i in e.defaultProps)
23
23
  c[i] === void 0 && (c[i] = e.defaultProps[i]);
24
24
  return T(e, c, n, o, null);
25
25
  }
26
- function T(e, _, t, n, o) {
27
- var i = { type: e, props: _, key: t, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++ue, __i: -1, __u: 0 };
26
+ function T(e, t, _, n, o) {
27
+ var i = { type: e, props: t, key: _, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++ue, __i: -1, __u: 0 };
28
28
  return o == null && f.vnode != null && f.vnode(i), i;
29
29
  }
30
- function F(e) {
30
+ function W(e) {
31
31
  return e.children;
32
32
  }
33
- function I(e, _) {
34
- this.props = e, this.context = _;
33
+ function I(e, t) {
34
+ this.props = e, this.context = t;
35
35
  }
36
- function S(e, _) {
37
- if (_ == null)
38
- return e.__ ? S(e.__, e.__i + 1) : null;
39
- for (var t; _ < e.__k.length; _++)
40
- if ((t = e.__k[_]) != null && t.__e != null)
41
- return t.__e;
42
- return typeof e.type == "function" ? S(e) : null;
36
+ function E(e, t) {
37
+ if (t == null)
38
+ return e.__ ? E(e.__, e.__i + 1) : null;
39
+ for (var _; t < e.__k.length; t++)
40
+ if ((_ = e.__k[t]) != null && _.__e != null)
41
+ return _.__e;
42
+ return typeof e.type == "function" ? E(e) : null;
43
43
  }
44
44
  function he(e) {
45
- var _, t;
45
+ var t, _;
46
46
  if ((e = e.__) != null && e.__c != null) {
47
- for (e.__e = e.__c.base = null, _ = 0; _ < e.__k.length; _++)
48
- if ((t = e.__k[_]) != null && t.__e != null) {
49
- e.__e = e.__c.base = t.__e;
47
+ for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++)
48
+ if ((_ = e.__k[t]) != null && _.__e != null) {
49
+ e.__e = e.__c.base = _.__e;
50
50
  break;
51
51
  }
52
52
  return he(e);
53
53
  }
54
54
  }
55
55
  function ee(e) {
56
- (!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ || X !== f.debounceRendering) && ((X = f.debounceRendering) || fe)(L);
57
- }
58
- function L() {
59
- var e, _, t, n, o, i, c, s, a;
60
- for (E.sort(Z); e = E.shift(); )
61
- e.__d && (_ = E.length, n = void 0, i = (o = (t = e).__v).__e, s = [], a = [], (c = t.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), Y(c, n, o, t.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, s, i ?? S(o), !!(32 & o.__u), a), n.__.__k[n.__i] = n, ge(s, n, a), n.__e != i && he(n)), E.length > _ && E.sort(Z));
62
- L.__r = 0;
63
- }
64
- function ve(e, _, t, n, o, i, c, s, a, l, p) {
65
- var r, d, u, m, k, g = n && n.__k || pe, h = _.length;
66
- for (t.__d = a, Ne(t, _, g), a = t.__d, r = 0; r < h; r++)
67
- (u = t.__k[r]) != null && typeof u != "boolean" && typeof u != "function" && (d = u.__i === -1 ? $ : g[u.__i] || $, u.__i = r, Y(e, u, d, o, i, c, s, a, l, p), m = u.__e, u.ref && d.ref != u.ref && (d.ref && K(d.ref, null, u), p.push(u.ref, u.__c || m, u)), k == null && m != null && (k = m), 65536 & u.__u || d.__k === u.__k ? a = me(u, a, e) : typeof u.type == "function" && u.__d !== void 0 ? a = u.__d : m && (a = m.nextSibling), u.__d = void 0, u.__u &= -196609);
68
- t.__d = a, t.__e = k;
69
- }
70
- function Ne(e, _, t) {
71
- var n, o, i, c, s, a = _.length, l = t.length, p = l, r = 0;
56
+ (!e.__d && (e.__d = !0) && S.push(e) && !F.__r++ || X !== f.debounceRendering) && ((X = f.debounceRendering) || fe)(F);
57
+ }
58
+ function F() {
59
+ var e, t, _, n, o, i, c, s, a;
60
+ for (S.sort(Z); e = S.shift(); )
61
+ e.__d && (t = S.length, n = void 0, i = (o = (_ = e).__v).__e, s = [], a = [], (c = _.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), Y(c, n, o, _.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, s, i ?? E(o), !!(32 & o.__u), a), n.__.__k[n.__i] = n, ye(s, n, a), n.__e != i && he(n)), S.length > t && S.sort(Z));
62
+ F.__r = 0;
63
+ }
64
+ function ve(e, t, _, n, o, i, c, s, a, l, p) {
65
+ var r, d, u, m, k, y = n && n.__k || pe, h = t.length;
66
+ for (_.__d = a, Ne(_, t, y), a = _.__d, r = 0; r < h; r++)
67
+ (u = _.__k[r]) != null && typeof u != "boolean" && typeof u != "function" && (d = u.__i === -1 ? D : y[u.__i] || D, u.__i = r, Y(e, u, d, o, i, c, s, a, l, p), m = u.__e, u.ref && d.ref != u.ref && (d.ref && K(d.ref, null, u), p.push(u.ref, u.__c || m, u)), k == null && m != null && (k = m), 65536 & u.__u || d.__k === u.__k ? a = me(u, a, e) : typeof u.type == "function" && u.__d !== void 0 ? a = u.__d : m && (a = m.nextSibling), u.__d = void 0, u.__u &= -196609);
68
+ _.__d = a, _.__e = k;
69
+ }
70
+ function Ne(e, t, _) {
71
+ var n, o, i, c, s, a = t.length, l = _.length, p = l, r = 0;
72
72
  for (e.__k = [], n = 0; n < a; n++)
73
- (o = e.__k[n] = (o = _[n]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? T(null, o, null, null, o) : G(o) ? T(F, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, s = Te(o, t, c = n + r, p), o.__i = s, i = null, s !== -1 && (p--, (i = t[s]) && (i.__u |= 131072)), i == null || i.__v === null ? (s == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : s !== c && (s === c + 1 ? r++ : s > c ? p > a - c ? r += s - c : r-- : r = s < c && s == c - 1 ? s - c : 0, s !== n + r && (o.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = S(i)), z(i, i, !1), t[n] = null, p--);
73
+ (o = e.__k[n] = (o = t[n]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? T(null, o, null, null, o) : G(o) ? T(W, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, s = Te(o, _, c = n + r, p), o.__i = s, i = null, s !== -1 && (p--, (i = _[s]) && (i.__u |= 131072)), i == null || i.__v === null ? (s == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : s !== c && (s === c + 1 ? r++ : s > c ? p > a - c ? r += s - c : r-- : r = s < c && s == c - 1 ? s - c : 0, s !== n + r && (o.__u |= 65536))) : (i = _[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = E(i)), z(i, i, !1), _[n] = null, p--);
74
74
  if (p)
75
75
  for (n = 0; n < l; n++)
76
- (i = t[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)), z(i, i));
76
+ (i = _[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = E(i)), z(i, i));
77
77
  }
78
- function me(e, _, t) {
78
+ function me(e, t, _) {
79
79
  var n, o;
80
80
  if (typeof e.type == "function") {
81
81
  for (n = e.__k, o = 0; n && o < n.length; o++)
82
- n[o] && (n[o].__ = e, _ = me(n[o], _, t));
83
- return _;
82
+ n[o] && (n[o].__ = e, t = me(n[o], t, _));
83
+ return t;
84
84
  }
85
- return e.__e != _ && (t.insertBefore(e.__e, _ || null), _ = e.__e), _ && _.nextSibling;
85
+ return e.__e != t && (_.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
86
86
  }
87
- function Te(e, _, t, n) {
88
- var o = e.key, i = e.type, c = t - 1, s = t + 1, a = _[t];
87
+ function Te(e, t, _, n) {
88
+ var o = e.key, i = e.type, c = _ - 1, s = _ + 1, a = t[_];
89
89
  if (a === null || a && o == a.key && i === a.type)
90
- return t;
90
+ return _;
91
91
  if (n > (a != null && !(131072 & a.__u) ? 1 : 0))
92
- for (; c >= 0 || s < _.length; ) {
92
+ for (; c >= 0 || s < t.length; ) {
93
93
  if (c >= 0) {
94
- if ((a = _[c]) && !(131072 & a.__u) && o == a.key && i === a.type)
94
+ if ((a = t[c]) && !(131072 & a.__u) && o == a.key && i === a.type)
95
95
  return c;
96
96
  c--;
97
97
  }
98
- if (s < _.length) {
99
- if ((a = _[s]) && !(131072 & a.__u) && o == a.key && i === a.type)
98
+ if (s < t.length) {
99
+ if ((a = t[s]) && !(131072 & a.__u) && o == a.key && i === a.type)
100
100
  return s;
101
101
  s++;
102
102
  }
103
103
  }
104
104
  return -1;
105
105
  }
106
- function _e(e, _, t) {
107
- _[0] === "-" ? e.setProperty(_, t ?? "") : e[_] = t == null ? "" : typeof t != "number" || He.test(_) ? t : t + "px";
106
+ function te(e, t, _) {
107
+ t[0] === "-" ? e.setProperty(t, _ ?? "") : e[t] = _ == null ? "" : typeof _ != "number" || He.test(t) ? _ : _ + "px";
108
108
  }
109
- function N(e, _, t, n, o) {
109
+ function N(e, t, _, n, o) {
110
110
  var i;
111
111
  e:
112
- if (_ === "style")
113
- if (typeof t == "string")
114
- e.style.cssText = t;
112
+ if (t === "style")
113
+ if (typeof _ == "string")
114
+ e.style.cssText = _;
115
115
  else {
116
116
  if (typeof n == "string" && (e.style.cssText = n = ""), n)
117
- for (_ in n)
118
- t && _ in t || _e(e.style, _, "");
119
- if (t)
120
- for (_ in t)
121
- n && t[_] === n[_] || _e(e.style, _, t[_]);
117
+ for (t in n)
118
+ _ && t in _ || te(e.style, t, "");
119
+ if (_)
120
+ for (t in _)
121
+ n && _[t] === n[t] || te(e.style, t, _[t]);
122
122
  }
123
- else if (_[0] === "o" && _[1] === "n")
124
- i = _ !== (_ = _.replace(/(PointerCapture)$|Capture$/, "$1")), _ = _.toLowerCase() in e ? _.toLowerCase().slice(2) : _.slice(2), e.l || (e.l = {}), e.l[_ + i] = t, t ? n ? t.u = n.u : (t.u = Date.now(), e.addEventListener(_, i ? ne : te, i)) : e.removeEventListener(_, i ? ne : te, i);
123
+ else if (t[0] === "o" && t[1] === "n")
124
+ 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 ? _.u = n.u : (_.u = Date.now(), e.addEventListener(t, i ? ne : _e, i)) : e.removeEventListener(t, i ? ne : _e, i);
125
125
  else {
126
126
  if (o)
127
- _ = _.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
128
- else if (_ !== "width" && _ !== "height" && _ !== "href" && _ !== "list" && _ !== "form" && _ !== "tabIndex" && _ !== "download" && _ !== "rowSpan" && _ !== "colSpan" && _ !== "role" && _ in e)
127
+ t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
128
+ 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)
129
129
  try {
130
- e[_] = t ?? "";
130
+ e[t] = _ ?? "";
131
131
  break e;
132
132
  } catch {
133
133
  }
134
- typeof t == "function" || (t == null || t === !1 && _[4] !== "-" ? e.removeAttribute(_) : e.setAttribute(_, t));
134
+ typeof _ == "function" || (_ == null || _ === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, _));
135
135
  }
136
136
  }
137
- function te(e) {
138
- var _ = this.l[e.type + !1];
137
+ function _e(e) {
138
+ var t = this.l[e.type + !1];
139
139
  if (e.t) {
140
- if (e.t <= _.u)
140
+ if (e.t <= t.u)
141
141
  return;
142
142
  } else
143
143
  e.t = Date.now();
144
- return _(f.event ? f.event(e) : e);
144
+ return t(f.event ? f.event(e) : e);
145
145
  }
146
146
  function ne(e) {
147
147
  return this.l[e.type + !0](f.event ? f.event(e) : e);
148
148
  }
149
- function Y(e, _, t, n, o, i, c, s, a, l) {
150
- var p, r, d, u, m, k, g, h, y, x, D, w, Q, H, V, b = _.type;
151
- if (_.constructor !== void 0)
149
+ function Y(e, t, _, n, o, i, c, s, a, l) {
150
+ var p, r, d, u, m, k, y, h, g, x, $, w, Q, H, A, b = t.type;
151
+ if (t.constructor !== void 0)
152
152
  return null;
153
- 128 & t.__u && (a = !!(32 & t.__u), i = [s = _.__e = t.__e]), (p = f.__b) && p(_);
153
+ 128 & _.__u && (a = !!(32 & _.__u), i = [s = t.__e = _.__e]), (p = f.__b) && p(t);
154
154
  e:
155
155
  if (typeof b == "function")
156
156
  try {
157
- if (h = _.props, y = (p = b.contextType) && n[p.__c], x = p ? y ? y.props.value : p.__ : n, t.__c ? g = (r = _.__c = t.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? _.__c = r = new b(h, x) : (_.__c = r = new I(h, x), r.constructor = b, r.render = Ue), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = x, r.__n = 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 = C({}, r.__s)), C(r.__s, b.getDerivedStateFromProps(h, r.__s))), u = r.props, m = r.state, r.__v = _, d)
157
+ if (h = t.props, g = (p = b.contextType) && n[p.__c], x = p ? g ? g.props.value : p.__ : n, _.__c ? y = (r = t.__c = _.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, x) : (t.__c = r = new I(h, x), r.constructor = b, r.render = je), g && g.sub(r), r.props = h, r.state || (r.state = {}), r.context = x, r.__n = 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 = C({}, r.__s)), C(r.__s, b.getDerivedStateFromProps(h, r.__s))), u = r.props, m = r.state, r.__v = t, d)
158
158
  b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
159
159
  else {
160
- if (b.getDerivedStateFromProps == null && h !== u && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, x), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, x) === !1 || _.__v === t.__v)) {
161
- for (_.__v !== t.__v && (r.props = h, r.state = r.__s, r.__d = !1), _.__e = t.__e, _.__k = t.__k, _.__k.forEach(function(P) {
162
- P && (P.__ = _);
163
- }), D = 0; D < r._sb.length; D++)
164
- r.__h.push(r._sb[D]);
160
+ if (b.getDerivedStateFromProps == null && h !== u && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, x), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, x) === !1 || t.__v === _.__v)) {
161
+ for (t.__v !== _.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = _.__e, t.__k = _.__k, t.__k.forEach(function(P) {
162
+ P && (P.__ = t);
163
+ }), $ = 0; $ < r._sb.length; $++)
164
+ r.__h.push(r._sb[$]);
165
165
  r._sb = [], r.__h.length && c.push(r);
166
166
  break e;
167
167
  }
@@ -170,26 +170,26 @@ function Y(e, _, t, n, o, i, c, s, a, l) {
170
170
  });
171
171
  }
172
172
  if (r.context = x, r.props = h, r.__P = e, r.__e = !1, w = f.__r, Q = 0, "prototype" in b && b.prototype.render) {
173
- for (r.state = r.__s, r.__d = !1, w && w(_), p = r.render(r.props, r.state, r.context), H = 0; H < r._sb.length; H++)
173
+ for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), H = 0; H < r._sb.length; H++)
174
174
  r.__h.push(r._sb[H]);
175
175
  r._sb = [];
176
176
  } else
177
177
  do
178
- r.__d = !1, w && w(_), p = r.render(r.props, r.state, r.context), r.state = r.__s;
178
+ r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
179
179
  while (r.__d && ++Q < 25);
180
- r.state = r.__s, r.getChildContext != null && (n = C(C({}, n), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(u, m)), ve(e, G(V = p != null && p.type === F && p.key == null ? p.props.children : p) ? V : [V], _, t, n, o, i, c, s, a, l), r.base = _.__e, _.__u &= -161, r.__h.length && c.push(r), g && (r.__E = r.__ = null);
180
+ r.state = r.__s, r.getChildContext != null && (n = C(C({}, n), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(u, m)), ve(e, G(A = p != null && p.type === W && p.key == null ? p.props.children : p) ? A : [A], t, _, n, o, i, c, s, a, l), r.base = t.__e, t.__u &= -161, r.__h.length && c.push(r), y && (r.__E = r.__ = null);
181
181
  } catch (P) {
182
- _.__v = null, a || i != null ? (_.__e = s, _.__u |= a ? 160 : 32, i[i.indexOf(s)] = null) : (_.__e = t.__e, _.__k = t.__k), f.__e(P, _, t);
182
+ t.__v = null, a || i != null ? (t.__e = s, t.__u |= a ? 160 : 32, i[i.indexOf(s)] = null) : (t.__e = _.__e, t.__k = _.__k), f.__e(P, t, _);
183
183
  }
184
184
  else
185
- i == null && _.__v === t.__v ? (_.__k = t.__k, _.__e = t.__e) : _.__e = Ie(t.__e, _, t, n, o, i, c, a, l);
186
- (p = f.diffed) && p(_);
187
- }
188
- function ge(e, _, t) {
189
- _.__d = void 0;
190
- for (var n = 0; n < t.length; n++)
191
- K(t[n], t[++n], t[++n]);
192
- f.__c && f.__c(_, e), e.some(function(o) {
185
+ i == null && t.__v === _.__v ? (t.__k = _.__k, t.__e = _.__e) : t.__e = Ie(_.__e, t, _, n, o, i, c, a, l);
186
+ (p = f.diffed) && p(t);
187
+ }
188
+ function ye(e, t, _) {
189
+ t.__d = void 0;
190
+ for (var n = 0; n < _.length; n++)
191
+ K(_[n], _[++n], _[++n]);
192
+ f.__c && f.__c(t, e), e.some(function(o) {
193
193
  try {
194
194
  e = o.__h, o.__h = [], e.some(function(i) {
195
195
  i.call(o);
@@ -199,72 +199,72 @@ function ge(e, _, t) {
199
199
  }
200
200
  });
201
201
  }
202
- function Ie(e, _, t, n, o, i, c, s, a) {
203
- var l, p, r, d, u, m, k, g = t.props, h = _.props, y = _.type;
204
- if (y === "svg" && (o = !0), i != null) {
202
+ function Ie(e, t, _, n, o, i, c, s, a) {
203
+ var l, p, r, d, u, m, k, y = _.props, h = t.props, g = t.type;
204
+ if (g === "svg" && (o = !0), i != null) {
205
205
  for (l = 0; l < i.length; l++)
206
- if ((u = i[l]) && "setAttribute" in u == !!y && (y ? u.localName === y : u.nodeType === 3)) {
206
+ if ((u = i[l]) && "setAttribute" in u == !!g && (g ? u.localName === g : u.nodeType === 3)) {
207
207
  e = u, i[l] = null;
208
208
  break;
209
209
  }
210
210
  }
211
211
  if (e == null) {
212
- if (y === null)
212
+ if (g === null)
213
213
  return document.createTextNode(h);
214
- e = o ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, h.is && h), i = null, s = !1;
214
+ e = o ? document.createElementNS("http://www.w3.org/2000/svg", g) : document.createElement(g, h.is && h), i = null, s = !1;
215
215
  }
216
- if (y === null)
217
- g === h || s && e.data === h || (e.data = h);
216
+ if (g === null)
217
+ y === h || s && e.data === h || (e.data = h);
218
218
  else {
219
- if (i = i && A.call(e.childNodes), g = t.props || $, !s && i != null)
220
- for (g = {}, l = 0; l < e.attributes.length; l++)
221
- g[(u = e.attributes[l]).name] = u.value;
222
- for (l in g)
223
- u = g[l], l == "children" || (l == "dangerouslySetInnerHTML" ? r = u : l === "key" || l in h || N(e, l, null, u, o));
219
+ if (i = i && V.call(e.childNodes), y = _.props || D, !s && i != null)
220
+ for (y = {}, l = 0; l < e.attributes.length; l++)
221
+ y[(u = e.attributes[l]).name] = u.value;
222
+ for (l in y)
223
+ u = y[l], l == "children" || (l == "dangerouslySetInnerHTML" ? r = u : l === "key" || l in h || N(e, l, null, u, o));
224
224
  for (l in h)
225
- u = h[l], l == "children" ? d = u : l == "dangerouslySetInnerHTML" ? p = u : l == "value" ? m = u : l == "checked" ? k = u : l === "key" || s && typeof u != "function" || g[l] === u || N(e, l, u, g[l], o);
225
+ u = h[l], l == "children" ? d = u : l == "dangerouslySetInnerHTML" ? p = u : l == "value" ? m = u : l == "checked" ? k = u : l === "key" || s && typeof u != "function" || y[l] === u || N(e, l, u, y[l], o);
226
226
  if (p)
227
- s || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), _.__k = [];
228
- else if (r && (e.innerHTML = ""), ve(e, G(d) ? d : [d], _, t, n, o && y !== "foreignObject", i, c, i ? i[0] : t.__k && S(t, 0), s, a), i != null)
227
+ s || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
228
+ else if (r && (e.innerHTML = ""), ve(e, G(d) ? d : [d], t, _, n, o && g !== "foreignObject", i, c, i ? i[0] : _.__k && E(_, 0), s, a), i != null)
229
229
  for (l = i.length; l--; )
230
230
  i[l] != null && de(i[l]);
231
- s || (l = "value", m !== void 0 && (m !== e[l] || y === "progress" && !m || y === "option" && m !== g[l]) && N(e, l, m, g[l], !1), l = "checked", k !== void 0 && k !== e[l] && N(e, l, k, g[l], !1));
231
+ s || (l = "value", m !== void 0 && (m !== e[l] || g === "progress" && !m || g === "option" && m !== y[l]) && N(e, l, m, y[l], !1), l = "checked", k !== void 0 && k !== e[l] && N(e, l, k, y[l], !1));
232
232
  }
233
233
  return e;
234
234
  }
235
- function K(e, _, t) {
235
+ function K(e, t, _) {
236
236
  try {
237
- typeof e == "function" ? e(_) : e.current = _;
237
+ typeof e == "function" ? e(t) : e.current = t;
238
238
  } catch (n) {
239
- f.__e(n, t);
239
+ f.__e(n, _);
240
240
  }
241
241
  }
242
- function z(e, _, t) {
242
+ function z(e, t, _) {
243
243
  var n, o;
244
- if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e || K(n, null, _)), (n = e.__c) != null) {
244
+ if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e || K(n, null, t)), (n = e.__c) != null) {
245
245
  if (n.componentWillUnmount)
246
246
  try {
247
247
  n.componentWillUnmount();
248
248
  } catch (i) {
249
- f.__e(i, _);
249
+ f.__e(i, t);
250
250
  }
251
251
  n.base = n.__P = null, e.__c = void 0;
252
252
  }
253
253
  if (n = e.__k)
254
254
  for (o = 0; o < n.length; o++)
255
- n[o] && z(n[o], _, t || typeof e.type != "function");
256
- t || e.__e == null || de(e.__e), e.__ = e.__e = e.__d = void 0;
255
+ n[o] && z(n[o], t, _ || typeof e.type != "function");
256
+ _ || e.__e == null || de(e.__e), e.__ = e.__e = e.__d = void 0;
257
257
  }
258
- function Ue(e, _, t) {
259
- return this.constructor(e, t);
258
+ function je(e, t, _) {
259
+ return this.constructor(e, _);
260
260
  }
261
- function je(e, _, t) {
261
+ function Ue(e, t, _) {
262
262
  var n, o, i, c;
263
- f.__ && f.__(e, _), o = (n = typeof t == "function") ? null : t && t.__k || _.__k, i = [], c = [], Y(_, e = (!n && t || _).__k = Pe(F, null, [e]), o || $, $, _.ownerSVGElement !== void 0, !n && t ? [t] : o ? null : _.firstChild ? A.call(_.childNodes) : null, i, !n && t ? t : o ? o.__e : _.firstChild, n, c), ge(i, e, c);
263
+ f.__ && f.__(e, t), o = (n = typeof _ == "function") ? null : _ && _.__k || t.__k, i = [], c = [], Y(t, e = (!n && _ || t).__k = Pe(W, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !n && _ ? [_] : o ? null : t.firstChild ? V.call(t.childNodes) : null, i, !n && _ ? _ : o ? o.__e : t.firstChild, n, c), ye(i, e, c);
264
264
  }
265
- A = pe.slice, f = { __e: function(e, _, t, n) {
266
- for (var o, i, c; _ = _.__; )
267
- if ((o = _.__c) && !o.__)
265
+ V = pe.slice, f = { __e: function(e, t, _, n) {
266
+ for (var o, i, c; t = t.__; )
267
+ if ((o = t.__c) && !o.__)
268
268
  try {
269
269
  if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), c = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, n || {}), c = o.__d), c)
270
270
  return o.__E = o;
@@ -272,26 +272,26 @@ A = pe.slice, f = { __e: function(e, _, t, n) {
272
272
  e = s;
273
273
  }
274
274
  throw e;
275
- } }, ue = 0, I.prototype.setState = function(e, _) {
276
- var t;
277
- t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = C({}, this.state), typeof e == "function" && (e = e(C({}, t), this.props)), e && C(t, e), e != null && this.__v && (_ && this._sb.push(_), ee(this));
275
+ } }, ue = 0, I.prototype.setState = function(e, t) {
276
+ var _;
277
+ _ = this.__s != null && this.__s !== this.state ? this.__s : this.__s = C({}, this.state), typeof e == "function" && (e = e(C({}, _), this.props)), e && C(_, e), e != null && this.__v && (t && this._sb.push(t), ee(this));
278
278
  }, I.prototype.forceUpdate = function(e) {
279
279
  this.__v && (this.__e = !0, e && this.__h.push(e), ee(this));
280
- }, I.prototype.render = F, E = [], fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, _) {
281
- return e.__v.__b - _.__v.__b;
282
- }, L.__r = 0;
283
- var M, v, q, oe, J = 0, ye = [], U = [], re = f.__b, ie = f.__r, le = f.diffed, se = f.__c, ce = f.unmount;
284
- function be(e, _) {
285
- f.__h && f.__h(v, e, J || _), J = 0;
286
- var t = v.__H || (v.__H = { __: [], __h: [] });
287
- return e >= t.__.length && t.__.push({ __V: U }), t.__[e];
288
- }
289
- function Le(e) {
290
- return J = 1, Me(ke, e);
291
- }
292
- function Me(e, _, t) {
293
- var n = be(M++, 2);
294
- if (n.t = e, !n.__c && (n.__ = [t ? t(_) : ke(void 0, _), function(s) {
280
+ }, I.prototype.render = W, S = [], fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, t) {
281
+ return e.__v.__b - t.__v.__b;
282
+ }, F.__r = 0;
283
+ var L, v, O, oe, J = 0, ge = [], j = [], re = f.__b, ie = f.__r, le = f.diffed, se = f.__c, ce = f.unmount;
284
+ function be(e, t) {
285
+ f.__h && f.__h(v, e, J || t), J = 0;
286
+ var _ = v.__H || (v.__H = { __: [], __h: [] });
287
+ return e >= _.__.length && _.__.push({ __V: j }), _.__[e];
288
+ }
289
+ function Fe(e) {
290
+ return J = 1, Le(ke, e);
291
+ }
292
+ function Le(e, t, _) {
293
+ var n = be(L++, 2);
294
+ if (n.t = e, !n.__c && (n.__ = [_ ? _(t) : ke(void 0, t), function(s) {
295
295
  var a = n.__N ? n.__N[0] : n.__[0], l = n.t(a, s);
296
296
  a !== l && (n.__N = [l, n.__[1]], n.__c.setState({}));
297
297
  }], n.__c = v, !v.u)) {
@@ -325,104 +325,104 @@ function Me(e, _, t) {
325
325
  }
326
326
  return n.__N || n.__;
327
327
  }
328
- function We(e, _) {
329
- var t = be(M++, 3);
330
- !f.__s && Ve(t.__H, _) && (t.__ = e, t.i = _, v.__H.__h.push(t));
328
+ function Me(e, t) {
329
+ var _ = be(L++, 3);
330
+ !f.__s && Ae(_.__H, t) && (_.__ = e, _.i = t, v.__H.__h.push(_));
331
331
  }
332
- function Ae() {
333
- for (var e; e = ye.shift(); )
332
+ function Ve() {
333
+ for (var e; e = ge.shift(); )
334
334
  if (e.__P && e.__H)
335
335
  try {
336
- e.__H.__h.forEach(j), e.__H.__h.forEach(R), e.__H.__h = [];
337
- } catch (_) {
338
- e.__H.__h = [], f.__e(_, e.__v);
336
+ e.__H.__h.forEach(U), e.__H.__h.forEach(R), e.__H.__h = [];
337
+ } catch (t) {
338
+ e.__H.__h = [], f.__e(t, e.__v);
339
339
  }
340
340
  }
341
341
  f.__b = function(e) {
342
342
  v = null, re && re(e);
343
343
  }, f.__r = function(e) {
344
- ie && ie(e), M = 0;
345
- var _ = (v = e.__c).__H;
346
- _ && (q === v ? (_.__h = [], v.__h = [], _.__.forEach(function(t) {
347
- t.__N && (t.__ = t.__N), t.__V = U, t.__N = t.i = void 0;
348
- })) : (_.__h.forEach(j), _.__h.forEach(R), _.__h = [], M = 0)), q = v;
344
+ ie && ie(e), L = 0;
345
+ var t = (v = e.__c).__H;
346
+ t && (O === v ? (t.__h = [], v.__h = [], t.__.forEach(function(_) {
347
+ _.__N && (_.__ = _.__N), _.__V = j, _.__N = _.i = void 0;
348
+ })) : (t.__h.forEach(U), t.__h.forEach(R), t.__h = [], L = 0)), O = v;
349
349
  }, f.diffed = function(e) {
350
350
  le && le(e);
351
- var _ = e.__c;
352
- _ && _.__H && (_.__H.__h.length && (ye.push(_) !== 1 && oe === f.requestAnimationFrame || ((oe = f.requestAnimationFrame) || Fe)(Ae)), _.__H.__.forEach(function(t) {
353
- t.i && (t.__H = t.i), t.__V !== U && (t.__ = t.__V), t.i = void 0, t.__V = U;
354
- })), q = v = null;
355
- }, f.__c = function(e, _) {
356
- _.some(function(t) {
351
+ var t = e.__c;
352
+ t && t.__H && (t.__H.__h.length && (ge.push(t) !== 1 && oe === f.requestAnimationFrame || ((oe = f.requestAnimationFrame) || We)(Ve)), t.__H.__.forEach(function(_) {
353
+ _.i && (_.__H = _.i), _.__V !== j && (_.__ = _.__V), _.i = void 0, _.__V = j;
354
+ })), O = v = null;
355
+ }, f.__c = function(e, t) {
356
+ t.some(function(_) {
357
357
  try {
358
- t.__h.forEach(j), t.__h = t.__h.filter(function(n) {
358
+ _.__h.forEach(U), _.__h = _.__h.filter(function(n) {
359
359
  return !n.__ || R(n);
360
360
  });
361
361
  } catch (n) {
362
- _.some(function(o) {
362
+ t.some(function(o) {
363
363
  o.__h && (o.__h = []);
364
- }), _ = [], f.__e(n, t.__v);
364
+ }), t = [], f.__e(n, _.__v);
365
365
  }
366
- }), se && se(e, _);
366
+ }), se && se(e, t);
367
367
  }, f.unmount = function(e) {
368
368
  ce && ce(e);
369
- var _, t = e.__c;
370
- t && t.__H && (t.__H.__.forEach(function(n) {
369
+ var t, _ = e.__c;
370
+ _ && _.__H && (_.__H.__.forEach(function(n) {
371
371
  try {
372
- j(n);
372
+ U(n);
373
373
  } catch (o) {
374
- _ = o;
374
+ t = o;
375
375
  }
376
- }), t.__H = void 0, _ && f.__e(_, t.__v));
376
+ }), _.__H = void 0, t && f.__e(t, _.__v));
377
377
  };
378
378
  var ae = typeof requestAnimationFrame == "function";
379
- function Fe(e) {
380
- var _, t = function() {
381
- clearTimeout(n), ae && cancelAnimationFrame(_), setTimeout(e);
382
- }, n = setTimeout(t, 100);
383
- ae && (_ = requestAnimationFrame(t));
379
+ function We(e) {
380
+ var t, _ = function() {
381
+ clearTimeout(n), ae && cancelAnimationFrame(t), setTimeout(e);
382
+ }, n = setTimeout(_, 100);
383
+ ae && (t = requestAnimationFrame(_));
384
384
  }
385
- function j(e) {
386
- var _ = v, t = e.__c;
387
- typeof t == "function" && (e.__c = void 0, t()), v = _;
385
+ function U(e) {
386
+ var t = v, _ = e.__c;
387
+ typeof _ == "function" && (e.__c = void 0, _()), v = t;
388
388
  }
389
389
  function R(e) {
390
- var _ = v;
391
- e.__c = e.__(), v = _;
390
+ var t = v;
391
+ e.__c = e.__(), v = t;
392
392
  }
393
- function Ve(e, _) {
394
- return !e || e.length !== _.length || _.some(function(t, n) {
395
- return t !== e[n];
393
+ function Ae(e, t) {
394
+ return !e || e.length !== t.length || t.some(function(_, n) {
395
+ return _ !== e[n];
396
396
  });
397
397
  }
398
- function ke(e, _) {
399
- return typeof _ == "function" ? _(e) : _;
398
+ function ke(e, t) {
399
+ return typeof t == "function" ? t(e) : t;
400
400
  }
401
401
  var Be = 0;
402
- function xe(e, _, t, n, o, i) {
402
+ function xe(e, t, _, n, o, i) {
403
403
  var c, s, a = {};
404
- for (s in _)
405
- s == "ref" ? c = _[s] : a[s] = _[s];
406
- var l = { type: e, props: a, key: t, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Be, __i: -1, __u: 0, __source: o, __self: i };
404
+ for (s in t)
405
+ s == "ref" ? c = t[s] : a[s] = t[s];
406
+ var l = { type: e, props: a, key: _, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Be, __i: -1, __u: 0, __source: o, __self: i };
407
407
  if (typeof e == "function" && (c = e.defaultProps))
408
408
  for (s in c)
409
409
  a[s] === void 0 && (a[s] = c[s]);
410
410
  return f.vnode && f.vnode(l), l;
411
411
  }
412
- class qe {
412
+ class Oe {
413
413
  constructor() {
414
414
  B(this, "_context");
415
415
  B(this, "_getContextCallbacks", []);
416
416
  }
417
417
  async getContext() {
418
- return this._context ? this._context : new Promise((_) => {
419
- this._getContextCallbacks.push(_);
418
+ return this._context ? this._context : new Promise((t) => {
419
+ this._getContextCallbacks.push(t);
420
420
  });
421
421
  }
422
- setContext(_) {
423
- this._context = _, this._getContextCallbacks.forEach((t) => t(_)), this._getContextCallbacks = [];
422
+ setContext(t) {
423
+ this._context = t, this._getContextCallbacks.forEach((_) => _(t)), this._getContextCallbacks = [];
424
424
  }
425
- configureClient(_) {
425
+ configureClient(t) {
426
426
  console.log("Client configured");
427
427
  }
428
428
  themeLoaded() {
@@ -431,37 +431,37 @@ class qe {
431
431
  close() {
432
432
  console.log("Theme closed");
433
433
  }
434
- addToEcommerceCart(_) {
435
- console.log("Add to cart", _);
434
+ addToEcommerceCart(t) {
435
+ console.log("Add to cart", t);
436
436
  }
437
437
  }
438
- let W;
439
- const Oe = ({
438
+ let M;
439
+ const qe = ({
440
440
  context: e
441
441
  }) => {
442
- const [_, t] = Le(null);
443
- return We(() => {
444
- if (_) {
445
- if (W === void 0)
442
+ const [t, _] = Fe(null);
443
+ return Me(() => {
444
+ if (t) {
445
+ if (M === void 0)
446
446
  throw new Error("Please call setSpiffDevOptions before requesting the context.");
447
- W.setContext({
447
+ M.setContext({
448
448
  ...e,
449
- container: _
449
+ container: t
450
450
  });
451
451
  }
452
- }, [_, e]), xe("div", {
453
- ref: t,
452
+ }, [t, e]), xe("div", {
453
+ ref: _,
454
454
  id: "spiffThemeWrapper"
455
455
  });
456
456
  };
457
- function s_(e, _) {
458
- W = new qe(), window.SpiffThemeLoader = W;
459
- let t;
460
- typeof e == "string" ? t = document.getElementById(e) : t = e, je(xe(Oe, {
461
- context: _
462
- }), t);
463
- }
464
- function c_(e) {
457
+ function ct(e, t) {
458
+ M = new Oe(), window.SpiffThemeLoader = M;
459
+ let _;
460
+ typeof e == "string" ? _ = document.getElementById(e) : _ = e, Ue(xe(qe, {
461
+ context: t
462
+ }), _);
463
+ }
464
+ function at(e) {
465
465
  return {
466
466
  id: "example",
467
467
  themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
@@ -490,17 +490,30 @@ function c_(e) {
490
490
  ...e
491
491
  };
492
492
  }
493
- const Ze = "@spiffcommerce/theme-bridge", ze = "1.11.1", Je = "module", Re = {
493
+ const Ze = (e) => {
494
+ if (Object.keys(e).includes("defaultValue"))
495
+ return e.defaultValue;
496
+ };
497
+ function ut(e, ...t) {
498
+ return e.fields.filter((_) => !_.key || !t.includes(_.key)).map((_) => ({
499
+ key: _.key,
500
+ fallbackToDefaultConfiguration: !1,
501
+ value: Ze(_),
502
+ type: _.type,
503
+ asset: void 0
504
+ }));
505
+ }
506
+ const ze = "@spiffcommerce/theme-bridge", Je = "1.11.3", Re = "module", Ge = {
494
507
  build: "tsc && vite build",
495
508
  preview: "vite preview",
496
509
  dev: "ladle serve",
497
510
  schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
498
- }, Ge = "./dist/index.umd.cjs", Ye = "./dist/index.js", Ke = "./dist/index.d.ts", Qe = [
511
+ }, Ye = "./dist/index.umd.cjs", Ke = "./dist/index.js", Qe = "./dist/index.d.ts", Xe = [
499
512
  "./dist"
500
- ], Xe = {
513
+ ], et = {
501
514
  import: "./dist/index.js",
502
515
  require: "./dist/index.umd.cjs"
503
- }, e_ = {}, __ = {
516
+ }, tt = {}, _t = {
504
517
  "@ladle/react": "^4.0.2",
505
518
  "@preact/preset-vite": "^2.7.0",
506
519
  "@spiffcommerce/core": "^21.0.1",
@@ -520,72 +533,73 @@ const Ze = "@spiffcommerce/theme-bridge", ze = "1.11.1", Je = "module", Re = {
520
533
  vite: "^5.0.8",
521
534
  "vite-plugin-css-injected-by-js": "^3.4.0",
522
535
  "vite-plugin-externalize-deps": "^0.8.0"
523
- }, t_ = {
536
+ }, nt = {
524
537
  "@spiffcommerce/core": "^21.0.1"
525
- }, n_ = {
526
- name: Ze,
527
- version: ze,
528
- type: Je,
529
- scripts: Re,
530
- main: Ge,
531
- module: Ye,
532
- types: Ke,
533
- files: Qe,
534
- exports: Xe,
535
- dependencies: e_,
536
- devDependencies: __,
537
- peerDependencies: t_
538
+ }, ot = {
539
+ name: ze,
540
+ version: Je,
541
+ type: Re,
542
+ scripts: Ge,
543
+ main: Ye,
544
+ module: Ke,
545
+ types: Qe,
546
+ files: Xe,
547
+ exports: et,
548
+ dependencies: tt,
549
+ devDependencies: _t,
550
+ peerDependencies: nt
538
551
  };
539
- function o_(e, _, t) {
540
- if (_.type === "chunk") {
541
- if (console.log(`chunk ${e} isEntry: ${_.isEntry}, isDynamicEntry: ${_.isDynamicEntry}, isImplicitEntry: ${_.isImplicitEntry}`), !_.isEntry && !t)
552
+ function rt(e, t, _) {
553
+ if (t.type === "chunk") {
554
+ if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !_)
542
555
  return null;
543
- if (!_.isDynamicEntry)
556
+ if (!t.isDynamicEntry)
544
557
  return {
545
- type: O.Javascript,
558
+ type: q.Javascript,
546
559
  mimeType: "text/javascript",
547
- preload: !_.isEntry,
560
+ preload: !t.isEntry,
548
561
  filename: e
549
562
  };
550
563
  } else if (e.endsWith(".css"))
551
564
  return {
552
- type: O.CSS,
565
+ type: q.CSS,
553
566
  mimeType: "text/css",
554
567
  filename: e
555
568
  };
556
569
  return null;
557
570
  }
558
- function a_(e) {
571
+ function ft(e) {
559
572
  const {
560
- autoGenerateTargetFiles: _ = !0,
561
- configurationSchema: t,
573
+ autoGenerateTargetFiles: t = !0,
574
+ configurationSchema: _,
562
575
  includePreloadChunks: n = !1,
563
576
  targetFiles: o
564
577
  } = e ?? {};
565
578
  return {
566
579
  name: "spiff-theme-plugin",
567
- version: n_.version,
580
+ version: ot.version,
568
581
  config(i, c) {
569
582
  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 = "";
570
583
  },
571
584
  writeBundle(i, c) {
572
- const s = _ ? Object.keys(c).map((l) => o != null && o.some((p) => p.filename === l) ? null : o_(l, c[l], n)).filter((l) => l !== null) : [];
585
+ const s = t ? Object.keys(c).map((l) => o != null && o.some((p) => p.filename === l) ? null : rt(l, c[l], n)).filter((l) => l !== null) : [];
573
586
  o && s.push(...o);
574
587
  const a = {
575
588
  launchData: {
576
589
  targetFiles: s
577
590
  },
578
- configurationSchema: t
591
+ configurationSchema: _
579
592
  };
580
- Se.writeFileSync(we.join(i.dir, "spiffTheme.json"), JSON.stringify(a, void 0, 4));
593
+ Ee.writeFileSync(we.join(i.dir, "spiffTheme.json"), JSON.stringify(a, void 0, 4));
581
594
  }
582
595
  };
583
596
  }
584
597
  export {
585
- De as AssetType,
586
- $e as FieldType,
587
- O as ThemeFileType,
588
- c_ as exampleThemeInstallConfig,
589
- s_ as setSpiffDevOptions,
590
- a_ as spiffThemePlugin
598
+ $e as AssetType,
599
+ De as FieldType,
600
+ q as ThemeFileType,
601
+ at as exampleThemeInstallConfig,
602
+ ut as getDefaultsForSchema,
603
+ ct as setSpiffDevOptions,
604
+ ft as spiffThemePlugin
591
605
  };
@@ -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(v,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(v=typeof globalThis<"u"?globalThis:v||self,k(v.theme={},v.fs,v.path))})(this,function(v,k,w){"use strict";var Ge=Object.defineProperty;var Ye=(v,k,w)=>k in v?Ge(v,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[k]=w;var ee=(v,k,w)=>(Ye(v,typeof k!="symbol"?k+"":k,w),w);var P=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(P||{}),te=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.Number="Number",e.Select="Select",e.Text="Text",e))(te||{}),_e=(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))(_e||{}),N,f,ne,$,oe,re,Z,T={},ie=[],De=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function S(e,t){for(var _ in t)e[_]=t[_];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function Te(e,t,_){var n,o,i,c={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?N.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,n,o,null)}function I(e,t,_,n,o){var i={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ne,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function M(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 _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?D(e):null}function se(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return se(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&$.push(e)&&!U.__r++||oe!==f.debounceRendering)&&((oe=f.debounceRendering)||re)(U)}function U(){var e,t,_,n,o,i,c,s,u;for($.sort(Z);e=$.shift();)e.__d&&(t=$.length,n=void 0,i=(o=(_=e).__v).__e,s=[],u=[],(c=_.__P)&&((n=S({},o)).__v=o.__v+1,f.vnode&&f.vnode(n),J(c,n,o,_.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,s,i??D(o),!!(32&o.__u),u),n.__.__k[n.__i]=n,he(s,n,u),n.__e!=i&&se(n)),$.length>t&&$.sort(Z));U.__r=0}function ue(e,t,_,n,o,i,c,s,u,l,p){var r,d,a,y,C,g=n&&n.__k||ie,h=t.length;for(_.__d=u,He(_,t,g),u=_.__d,r=0;r<h;r++)(a=_.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?T:g[a.__i]||T,a.__i=r,J(e,a,d,o,i,c,s,u,l,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&R(d.ref,null,a),p.push(a.ref,a.__c||y,a)),C==null&&y!=null&&(C=y),65536&a.__u||d.__k===a.__k?u=ae(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);_.__d=u,_.__e=C}function He(e,t,_){var n,o,i,c,s,u=t.length,l=_.length,p=l,r=0;for(e.__k=[],n=0;n<u;n++)(o=e.__k[n]=(o=t[n])==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,s=Pe(o,_,c=n+r,p),o.__i=s,i=null,s!==-1&&(p--,(i=_[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):s!==c&&(s===c+1?r++:s>c?p>u-c?r+=s-c:r--:r=s<c&&s==c-1?s-c:0,s!==n+r&&(o.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),G(i,i,!1),_[n]=null,p--);if(p)for(n=0;n<l;n++)(i=_[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),G(i,i))}function ae(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=ae(n[o],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Pe(e,t,_,n){var o=e.key,i=e.type,c=_-1,s=_+1,u=t[_];if(u===null||u&&o==u.key&&i===u.type)return _;if(n>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||s<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&i===u.type)return s;s++}}return-1}function fe(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||De.test(t)?_:_+"px"}function F(e,t,_,n,o){var i;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||fe(e.style,t,"");if(_)for(t in _)n&&_[t]===n[t]||fe(e.style,t,_[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?_.u=n.u:(_.u=Date.now(),e.addEventListener(t,i?de:pe,i)):e.removeEventListener(t,i?de:pe,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]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,_))}}function pe(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 de(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,_,n,o,i,c,s,u,l){var p,r,d,a,y,C,g,h,b,E,q,H,$e,O,X,x=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(u=!!(32&_.__u),i=[s=t.__e=_.__e]),(p=f.__b)&&p(t);e:if(typeof x=="function")try{if(h=t.props,b=(p=x.contextType)&&n[p.__c],E=p?b?b.props.value:p.__:n,_.__c?g=(r=t.__c=_.__c).__=r.__E:("prototype"in x&&x.prototype.render?t.__c=r=new x(h,E):(t.__c=r=new M(h,E),r.constructor=x,r.render=Ie),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=E,r.__n=n,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=S({},r.__s)),S(r.__s,x.getDerivedStateFromProps(h,r.__s))),a=r.props,y=r.state,r.__v=t,d)x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,E)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(r.props=h,r.state=r.__s,r.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(B){B&&(B.__=t)}),q=0;q<r._sb.length;q++)r.__h.push(r._sb[q]);r._sb=[],r.__h.length&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,C)})}if(r.context=E,r.props=h,r.__P=e,r.__e=!1,H=f.__r,$e=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,H&&H(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,H&&H(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++$e<25);r.state=r.__s,r.getChildContext!=null&&(n=S(S({},n),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(C=r.getSnapshotBeforeUpdate(a,y)),ue(e,z(X=p!=null&&p.type===j&&p.key==null?p.props.children:p)?X:[X],t,_,n,o,i,c,s,u,l),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(B){t.__v=null,u||i!=null?(t.__e=s,t.__u|=u?160:32,i[i.indexOf(s)]=null):(t.__e=_.__e,t.__k=_.__k),f.__e(B,t,_)}else i==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ne(_.__e,t,_,n,o,i,c,u,l);(p=f.diffed)&&p(t)}function he(e,t,_){t.__d=void 0;for(var n=0;n<_.length;n++)R(_[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 Ne(e,t,_,n,o,i,c,s,u){var l,p,r,d,a,y,C,g=_.props,h=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(l=0;l<i.length;l++)if((a=i[l])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[l]=null;break}}if(e==null){if(b===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,h.is&&h),i=null,s=!1}if(b===null)g===h||s&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),g=_.props||T,!s&&i!=null)for(g={},l=0;l<e.attributes.length;l++)g[(a=e.attributes[l]).name]=a.value;for(l in g)a=g[l],l=="children"||(l=="dangerouslySetInnerHTML"?r=a:l==="key"||l in h||F(e,l,null,a,o));for(l in h)a=h[l],l=="children"?d=a:l=="dangerouslySetInnerHTML"?p=a:l=="value"?y=a:l=="checked"?C=a:l==="key"||s&&typeof a!="function"||g[l]===a||F(e,l,a,g[l],o);if(p)s||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ue(e,z(d)?d:[d],t,_,n,o&&b!=="foreignObject",i,c,i?i[0]:_.__k&&D(_,0),s,u),i!=null)for(l=i.length;l--;)i[l]!=null&&le(i[l]);s||(l="value",y!==void 0&&(y!==e[l]||b==="progress"&&!y||b==="option"&&y!==g[l])&&F(e,l,y,g[l],!1),l="checked",C!==void 0&&C!==e[l]&&F(e,l,C,g[l],!1))}return e}function R(e,t,_){try{typeof e=="function"?e(t):e.current=t}catch(n){f.__e(n,_)}}function G(e,t,_){var n,o;if(f.unmount&&f.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||R(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){f.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&G(n[o],t,_||typeof e.type!="function");_||e.__e==null||le(e.__e),e.__=e.__e=e.__d=void 0}function Ie(e,t,_){return this.constructor(e,_)}function je(e,t,_){var n,o,i,c;f.__&&f.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],c=[],J(t,e=(!n&&_||t).__k=Te(j,null,[e]),o||T,T,t.ownerSVGElement!==void 0,!n&&_?[_]:o?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:o?o.__e:t.firstChild,n,c),he(i,e,c)}N=ie.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,n||{}),c=o.__d),c)return o.__E=o}catch(s){e=s}throw e}},ne=0,M.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof e=="function"&&(e=e(S({},_),this.props)),e&&S(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ce(this))},M.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},M.prototype.render=j,$=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},U.__r=0;var L,m,Y,me,K=0,ve=[],A=[],ye=f.__b,ge=f.__r,be=f.diffed,ke=f.__c,xe=f.unmount;function Ce(e,t){f.__h&&f.__h(m,e,K||t),K=0;var _=m.__H||(m.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Me(e){return K=1,Ue(Ee,e)}function Ue(e,t,_){var n=Ce(L++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):Ee(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=m,!m.u)){var o=function(s,u,l){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,s,u,l);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&&n.__c.props===s)&&(!i||i.call(this,s,u,l))};m.u=!0;var i=m.shouldComponentUpdate,c=m.componentWillUpdate;m.componentWillUpdate=function(s,u,l){if(this.__e){var p=i;i=void 0,o(s,u,l),i=p}c&&c.call(this,s,u,l)},m.shouldComponentUpdate=o}return n.__N||n.__}function Fe(e,t){var _=Ce(L++,3);!f.__s&&We(_.__H,t)&&(_.__=e,_.i=t,m.__H.__h.push(_))}function Le(){for(var e;e=ve.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(Q),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){m=null,ye&&ye(e)},f.__r=function(e){ge&&ge(e),L=0;var t=(m=e.__c).__H;t&&(Y===m?(t.__h=[],m.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=A,_.__N=_.i=void 0})):(t.__h.forEach(W),t.__h.forEach(Q),t.__h=[],L=0)),Y=m},f.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ve.push(t)!==1&&me===f.requestAnimationFrame||((me=f.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),Y=m=null},f.__c=function(e,t){t.some(function(_){try{_.__h.forEach(W),_.__h=_.__h.filter(function(n){return!n.__||Q(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(n,_.__v)}}),ke&&ke(e,t)},f.unmount=function(e){xe&&xe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{W(n)}catch(o){t=o}}),_.__H=void 0,t&&f.__e(t,_.__v))};var Se=typeof requestAnimationFrame=="function";function Ae(e){var t,_=function(){clearTimeout(n),Se&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,100);Se&&(t=requestAnimationFrame(_))}function W(e){var t=m,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),m=t}function Q(e){var t=m;e.__c=e.__(),m=t}function We(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function Ee(e,t){return typeof t=="function"?t(e):t}var Ve=0;function we(e,t,_,n,o,i){var c,s,u={};for(s in t)s=="ref"?c=t[s]:u[s]=t[s];var l={type:e,props:u,key:_,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ve,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(s in c)u[s]===void 0&&(u[s]=c[s]);return f.vnode&&f.vnode(l),l}class qe{constructor(){ee(this,"_context");ee(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(_=>_(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)}}let V;const Oe=({context:e})=>{const[t,_]=Me(null);return Fe(()=>{if(t){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({...e,container:t})}},[t,e]),we("div",{ref:_,id:"spiffThemeWrapper"})};function Be(e,t){V=new qe,window.SpiffThemeLoader=V;let _;typeof e=="string"?_=document.getElementById(e):_=e,je(we(Oe,{context:t}),_)}function Ze(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 ze={name:"@spiffcommerce/theme-bridge",version:"1.11.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 Je(e,t,_){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!_)return null;if(!t.isDynamicEntry)return{type:P.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:P.CSS,mimeType:"text/css",filename:e};return null}function Re(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:_,includePreloadChunks:n=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:ze.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 s=t?Object.keys(c).map(l=>o!=null&&o.some(p=>p.filename===l)?null:Je(l,c[l],n)).filter(l=>l!==null):[];o&&s.push(...o);const u={launchData:{targetFiles:s},configurationSchema:_};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}v.AssetType=_e,v.FieldType=te,v.ThemeFileType=P,v.exampleThemeInstallConfig=Ze,v.setSpiffDevOptions=Be,v.spiffThemePlugin=Re,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
2
+ (function(v,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(v=typeof globalThis<"u"?globalThis:v||self,k(v.theme={},v.fs,v.path))})(this,function(v,k,w){"use strict";var Ke=Object.defineProperty;var Qe=(v,k,w)=>k in v?Ke(v,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[k]=w;var ee=(v,k,w)=>(Qe(v,typeof k!="symbol"?k+"":k,w),w);var P=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(P||{}),te=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.Number="Number",e.Select="Select",e.Text="Text",e))(te||{}),_e=(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))(_e||{}),N,f,ne,D,oe,re,Z,T={},ie=[],$e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function S(e,t){for(var _ in t)e[_]=t[_];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function Te(e,t,_){var n,o,i,c={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?N.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,n,o,null)}function I(e,t,_,n,o){var i={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ne,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function F(e,t){this.props=e,this.context=t}function $(e,t){if(t==null)return e.__?$(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?$(e):null}function se(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return se(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!M.__r++||oe!==f.debounceRendering)&&((oe=f.debounceRendering)||re)(M)}function M(){var e,t,_,n,o,i,c,s,u;for(D.sort(Z);e=D.shift();)e.__d&&(t=D.length,n=void 0,i=(o=(_=e).__v).__e,s=[],u=[],(c=_.__P)&&((n=S({},o)).__v=o.__v+1,f.vnode&&f.vnode(n),J(c,n,o,_.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,s,i??$(o),!!(32&o.__u),u),n.__.__k[n.__i]=n,he(s,n,u),n.__e!=i&&se(n)),D.length>t&&D.sort(Z));M.__r=0}function ue(e,t,_,n,o,i,c,s,u,l,p){var r,d,a,y,C,g=n&&n.__k||ie,h=t.length;for(_.__d=u,He(_,t,g),u=_.__d,r=0;r<h;r++)(a=_.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?T:g[a.__i]||T,a.__i=r,J(e,a,d,o,i,c,s,u,l,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&R(d.ref,null,a),p.push(a.ref,a.__c||y,a)),C==null&&y!=null&&(C=y),65536&a.__u||d.__k===a.__k?u=ae(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);_.__d=u,_.__e=C}function He(e,t,_){var n,o,i,c,s,u=t.length,l=_.length,p=l,r=0;for(e.__k=[],n=0;n<u;n++)(o=e.__k[n]=(o=t[n])==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,s=Pe(o,_,c=n+r,p),o.__i=s,i=null,s!==-1&&(p--,(i=_[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):s!==c&&(s===c+1?r++:s>c?p>u-c?r+=s-c:r--:r=s<c&&s==c-1?s-c:0,s!==n+r&&(o.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i,!1),_[n]=null,p--);if(p)for(n=0;n<l;n++)(i=_[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i))}function ae(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=ae(n[o],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Pe(e,t,_,n){var o=e.key,i=e.type,c=_-1,s=_+1,u=t[_];if(u===null||u&&o==u.key&&i===u.type)return _;if(n>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||s<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&i===u.type)return s;s++}}return-1}function fe(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||$e.test(t)?_:_+"px"}function U(e,t,_,n,o){var i;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||fe(e.style,t,"");if(_)for(t in _)n&&_[t]===n[t]||fe(e.style,t,_[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?_.u=n.u:(_.u=Date.now(),e.addEventListener(t,i?de:pe,i)):e.removeEventListener(t,i?de:pe,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]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,_))}}function pe(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 de(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,_,n,o,i,c,s,u,l){var p,r,d,a,y,C,g,h,b,E,O,H,De,q,X,x=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(u=!!(32&_.__u),i=[s=t.__e=_.__e]),(p=f.__b)&&p(t);e:if(typeof x=="function")try{if(h=t.props,b=(p=x.contextType)&&n[p.__c],E=p?b?b.props.value:p.__:n,_.__c?g=(r=t.__c=_.__c).__=r.__E:("prototype"in x&&x.prototype.render?t.__c=r=new x(h,E):(t.__c=r=new F(h,E),r.constructor=x,r.render=Ie),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=E,r.__n=n,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=S({},r.__s)),S(r.__s,x.getDerivedStateFromProps(h,r.__s))),a=r.props,y=r.state,r.__v=t,d)x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,E)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(r.props=h,r.state=r.__s,r.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(B){B&&(B.__=t)}),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);r._sb=[],r.__h.length&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,C)})}if(r.context=E,r.props=h,r.__P=e,r.__e=!1,H=f.__r,De=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,H&&H(t),p=r.render(r.props,r.state,r.context),q=0;q<r._sb.length;q++)r.__h.push(r._sb[q]);r._sb=[]}else do r.__d=!1,H&&H(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++De<25);r.state=r.__s,r.getChildContext!=null&&(n=S(S({},n),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(C=r.getSnapshotBeforeUpdate(a,y)),ue(e,z(X=p!=null&&p.type===j&&p.key==null?p.props.children:p)?X:[X],t,_,n,o,i,c,s,u,l),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(B){t.__v=null,u||i!=null?(t.__e=s,t.__u|=u?160:32,i[i.indexOf(s)]=null):(t.__e=_.__e,t.__k=_.__k),f.__e(B,t,_)}else i==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ne(_.__e,t,_,n,o,i,c,u,l);(p=f.diffed)&&p(t)}function he(e,t,_){t.__d=void 0;for(var n=0;n<_.length;n++)R(_[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 Ne(e,t,_,n,o,i,c,s,u){var l,p,r,d,a,y,C,g=_.props,h=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(l=0;l<i.length;l++)if((a=i[l])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[l]=null;break}}if(e==null){if(b===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,h.is&&h),i=null,s=!1}if(b===null)g===h||s&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),g=_.props||T,!s&&i!=null)for(g={},l=0;l<e.attributes.length;l++)g[(a=e.attributes[l]).name]=a.value;for(l in g)a=g[l],l=="children"||(l=="dangerouslySetInnerHTML"?r=a:l==="key"||l in h||U(e,l,null,a,o));for(l in h)a=h[l],l=="children"?d=a:l=="dangerouslySetInnerHTML"?p=a:l=="value"?y=a:l=="checked"?C=a:l==="key"||s&&typeof a!="function"||g[l]===a||U(e,l,a,g[l],o);if(p)s||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ue(e,z(d)?d:[d],t,_,n,o&&b!=="foreignObject",i,c,i?i[0]:_.__k&&$(_,0),s,u),i!=null)for(l=i.length;l--;)i[l]!=null&&le(i[l]);s||(l="value",y!==void 0&&(y!==e[l]||b==="progress"&&!y||b==="option"&&y!==g[l])&&U(e,l,y,g[l],!1),l="checked",C!==void 0&&C!==e[l]&&U(e,l,C,g[l],!1))}return e}function R(e,t,_){try{typeof e=="function"?e(t):e.current=t}catch(n){f.__e(n,_)}}function G(e,t,_){var n,o;if(f.unmount&&f.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||R(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){f.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&G(n[o],t,_||typeof e.type!="function");_||e.__e==null||le(e.__e),e.__=e.__e=e.__d=void 0}function Ie(e,t,_){return this.constructor(e,_)}function je(e,t,_){var n,o,i,c;f.__&&f.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],c=[],J(t,e=(!n&&_||t).__k=Te(j,null,[e]),o||T,T,t.ownerSVGElement!==void 0,!n&&_?[_]:o?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:o?o.__e:t.firstChild,n,c),he(i,e,c)}N=ie.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,n||{}),c=o.__d),c)return o.__E=o}catch(s){e=s}throw e}},ne=0,F.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof e=="function"&&(e=e(S({},_),this.props)),e&&S(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ce(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},F.prototype.render=j,D=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0;var L,m,Y,me,K=0,ve=[],A=[],ye=f.__b,ge=f.__r,be=f.diffed,ke=f.__c,xe=f.unmount;function Ce(e,t){f.__h&&f.__h(m,e,K||t),K=0;var _=m.__H||(m.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Fe(e){return K=1,Me(Ee,e)}function Me(e,t,_){var n=Ce(L++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):Ee(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=m,!m.u)){var o=function(s,u,l){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,s,u,l);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&&n.__c.props===s)&&(!i||i.call(this,s,u,l))};m.u=!0;var i=m.shouldComponentUpdate,c=m.componentWillUpdate;m.componentWillUpdate=function(s,u,l){if(this.__e){var p=i;i=void 0,o(s,u,l),i=p}c&&c.call(this,s,u,l)},m.shouldComponentUpdate=o}return n.__N||n.__}function Ue(e,t){var _=Ce(L++,3);!f.__s&&Ve(_.__H,t)&&(_.__=e,_.i=t,m.__H.__h.push(_))}function Le(){for(var e;e=ve.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(V),e.__H.__h.forEach(Q),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){m=null,ye&&ye(e)},f.__r=function(e){ge&&ge(e),L=0;var t=(m=e.__c).__H;t&&(Y===m?(t.__h=[],m.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=A,_.__N=_.i=void 0})):(t.__h.forEach(V),t.__h.forEach(Q),t.__h=[],L=0)),Y=m},f.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ve.push(t)!==1&&me===f.requestAnimationFrame||((me=f.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),Y=m=null},f.__c=function(e,t){t.some(function(_){try{_.__h.forEach(V),_.__h=_.__h.filter(function(n){return!n.__||Q(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(n,_.__v)}}),ke&&ke(e,t)},f.unmount=function(e){xe&&xe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{V(n)}catch(o){t=o}}),_.__H=void 0,t&&f.__e(t,_.__v))};var Se=typeof requestAnimationFrame=="function";function Ae(e){var t,_=function(){clearTimeout(n),Se&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,100);Se&&(t=requestAnimationFrame(_))}function V(e){var t=m,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),m=t}function Q(e){var t=m;e.__c=e.__(),m=t}function Ve(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function Ee(e,t){return typeof t=="function"?t(e):t}var We=0;function we(e,t,_,n,o,i){var c,s,u={};for(s in t)s=="ref"?c=t[s]:u[s]=t[s];var l={type:e,props:u,key:_,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--We,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(s in c)u[s]===void 0&&(u[s]=c[s]);return f.vnode&&f.vnode(l),l}class Oe{constructor(){ee(this,"_context");ee(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(_=>_(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)}}let W;const qe=({context:e})=>{const[t,_]=Fe(null);return Ue(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),we("div",{ref:_,id:"spiffThemeWrapper"})};function Be(e,t){W=new Oe,window.SpiffThemeLoader=W;let _;typeof e=="string"?_=document.getElementById(e):_=e,je(we(qe,{context:t}),_)}function Ze(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 ze=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function Je(e,...t){return e.fields.filter(_=>!_.key||!t.includes(_.key)).map(_=>({key:_.key,fallbackToDefaultConfiguration:!1,value:ze(_),type:_.type,asset:void 0}))}const Re={name:"@spiffcommerce/theme-bridge",version:"1.11.3",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function Ge(e,t,_){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!_)return null;if(!t.isDynamicEntry)return{type:P.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:P.CSS,mimeType:"text/css",filename:e};return null}function Ye(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:_,includePreloadChunks:n=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:Re.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 s=t?Object.keys(c).map(l=>o!=null&&o.some(p=>p.filename===l)?null:Ge(l,c[l],n)).filter(l=>l!==null):[];o&&s.push(...o);const u={launchData:{targetFiles:s},configurationSchema:_};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}v.AssetType=_e,v.FieldType=te,v.ThemeFileType=P,v.exampleThemeInstallConfig=Ze,v.getDefaultsForSchema=Je,v.setSpiffDevOptions=Be,v.spiffThemePlugin=Ye,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",