@spiffcommerce/theme-bridge 1.21.1 → 1.21.3-beta.79b2126b-e448-51fd-9db0-82be6c587e53
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 +15 -6
- package/dist/index.js +121 -107
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -109,6 +109,10 @@ interface AssetField extends ConfigurableField, RequiredOption {
|
|
|
109
109
|
assetType: AssetType;
|
|
110
110
|
type: FieldType.Asset;
|
|
111
111
|
}
|
|
112
|
+
interface DateRangeField extends ConfigurableField {
|
|
113
|
+
maxDateSpan: number;
|
|
114
|
+
type: FieldType.DateRange;
|
|
115
|
+
}
|
|
112
116
|
interface ConversionConfigurationField extends ConfigurableField {
|
|
113
117
|
type: FieldType.ConversionConfiguration;
|
|
114
118
|
}
|
|
@@ -175,7 +179,7 @@ type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : nev
|
|
|
175
179
|
/**
|
|
176
180
|
* All fields that are configurable by a user in Hub.
|
|
177
181
|
*/
|
|
178
|
-
type ThemeConfigurationConfigurableFields = GenericField | AssetField | ConversionConfigurationField | SelectField | TextField | ListField | ObjectField | CustomObjectField;
|
|
182
|
+
type ThemeConfigurationConfigurableFields = GenericField | AssetField | DateRangeField | ConversionConfigurationField | SelectField | TextField | ListField | ObjectField | CustomObjectField;
|
|
179
183
|
/**
|
|
180
184
|
* All fields.
|
|
181
185
|
*/
|
|
@@ -340,14 +344,13 @@ declare enum ConversionDataType {
|
|
|
340
344
|
PostCode = "PostCode",
|
|
341
345
|
State = "State",
|
|
342
346
|
StreetAddress = "StreetAddress",
|
|
343
|
-
|
|
344
|
-
PurchaseOrder = "PurchaseOrder",
|
|
345
|
-
DispatchDate = "DispatchDate",
|
|
346
|
-
Stakeholders = "Stakeholders"
|
|
347
|
+
Custom = "Custom"
|
|
347
348
|
}
|
|
348
349
|
interface ConversionData {
|
|
349
350
|
type: ConversionDataType;
|
|
350
351
|
mandatory: boolean;
|
|
352
|
+
title?: string;
|
|
353
|
+
uniqueIdentifier?: string;
|
|
351
354
|
}
|
|
352
355
|
/**
|
|
353
356
|
* The configuration for conversion, exposed on products currently.
|
|
@@ -355,6 +358,7 @@ interface ConversionData {
|
|
|
355
358
|
interface ConversionConfiguration {
|
|
356
359
|
id: string;
|
|
357
360
|
name?: string;
|
|
361
|
+
partnerId: string;
|
|
358
362
|
locations: ConversionLocation[];
|
|
359
363
|
/**
|
|
360
364
|
* @deprecated Use `requestedDataItems` instead.
|
|
@@ -369,6 +373,7 @@ interface ThemeInstallConfigurationFieldResource {
|
|
|
369
373
|
value?: string;
|
|
370
374
|
type: FieldType;
|
|
371
375
|
asset?: AssetResource;
|
|
376
|
+
dateRange?: DateRange;
|
|
372
377
|
conversionConfiguration?: ConversionConfiguration;
|
|
373
378
|
/** When the type is `List`, this will be the configured values */
|
|
374
379
|
listValues?: ThemeInstallConfigurationFieldResource[];
|
|
@@ -387,6 +392,10 @@ interface AssetResource {
|
|
|
387
392
|
fileLink: string;
|
|
388
393
|
type: AssetType;
|
|
389
394
|
}
|
|
395
|
+
interface DateRange {
|
|
396
|
+
start: Date;
|
|
397
|
+
end: Date;
|
|
398
|
+
}
|
|
390
399
|
/**
|
|
391
400
|
* Maps a `ThemeInstallConfigurationResource`'s fields (which is essentially `{ key: string; value: string; }[]`), to the form `{ [key: string]: any }`.
|
|
392
401
|
* 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.
|
|
@@ -576,4 +585,4 @@ interface PluginOptions {
|
|
|
576
585
|
*/
|
|
577
586
|
declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
|
|
578
587
|
|
|
579
|
-
export { type AssetResource, AssetType, type CompleteQuoteMessage, type ConversionConfiguration, type ConversionData, ConversionDataType, ConversionLocation, 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 };
|
|
588
|
+
export { type AssetResource, AssetType, type CompleteQuoteMessage, type ConversionConfiguration, type ConversionData, ConversionDataType, ConversionLocation, CustomSchemaType, type DateRange, 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,10 +1,10 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var B = (e, t, n) => (
|
|
5
|
-
import
|
|
2
|
+
var $e = Object.defineProperty;
|
|
3
|
+
var je = (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) => (je(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
|
+
import Ne from "fs";
|
|
6
6
|
import Ve from "path";
|
|
7
|
-
var Q = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Q || {}), x = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.ConversionConfiguration = "ConversionConfiguration", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e.DateRange = "DateRange", e))(x || {}), 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 || {}),
|
|
7
|
+
var Q = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Q || {}), x = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.ConversionConfiguration = "ConversionConfiguration", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e.DateRange = "DateRange", e))(x || {}), 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 || {}), De = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(De || {}), Ie = /* @__PURE__ */ ((e) => (e.Manual = "Manual", e.OnStart = "OnStart", e.OnQuit = "OnQuit", e.OnEnd = "OnEnd", e))(Ie || {}), Oe = /* @__PURE__ */ ((e) => (e.Email = "Email", e.FirstName = "FirstName", e.LastName = "LastName", e.Phone = "Phone", e.Apartment = "Apartment", e.City = "City", e.Country = "Country", e.OrganizationName = "OrganizationName", e.PostCode = "PostCode", e.State = "State", e.StreetAddress = "StreetAddress", e.Custom = "Custom", e))(Oe || {});
|
|
8
8
|
function X(e) {
|
|
9
9
|
return Object.assign({}, ...e.map((t) => {
|
|
10
10
|
if (t.key)
|
|
@@ -14,8 +14,22 @@ function X(e) {
|
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
16
|
function he(e) {
|
|
17
|
+
var t;
|
|
17
18
|
if (e.type === x.Asset)
|
|
18
19
|
return e.asset;
|
|
20
|
+
if (e.type === x.DateRange) {
|
|
21
|
+
const n = (t = e.value) == null ? void 0 : t.split(",");
|
|
22
|
+
if (!n || n.length !== 2 || !n[0] || !n[1])
|
|
23
|
+
return;
|
|
24
|
+
try {
|
|
25
|
+
return {
|
|
26
|
+
start: new Date(n[0]),
|
|
27
|
+
end: new Date(n[1])
|
|
28
|
+
};
|
|
29
|
+
} catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
19
33
|
if (e.type === x.ConversionConfiguration)
|
|
20
34
|
return e.conversionConfiguration;
|
|
21
35
|
if (e.type !== x.List && e.type !== x.Object) {
|
|
@@ -62,7 +76,7 @@ function Fe(e) {
|
|
|
62
76
|
var i;
|
|
63
77
|
return {
|
|
64
78
|
...o,
|
|
65
|
-
fields: (i = o.fields) == null ? void 0 : i.map((
|
|
79
|
+
fields: (i = o.fields) == null ? void 0 : i.map((a) => L(e.fields[a], e.fields))
|
|
66
80
|
};
|
|
67
81
|
})
|
|
68
82
|
}, n = [];
|
|
@@ -97,7 +111,7 @@ function kt(e) {
|
|
|
97
111
|
throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
|
|
98
112
|
return t.fields = n, t;
|
|
99
113
|
}
|
|
100
|
-
var
|
|
114
|
+
var U, f, me, E, _e, ve, Z, $ = {}, ge = [], Le = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
|
|
101
115
|
function S(e, t) {
|
|
102
116
|
for (var n in t)
|
|
103
117
|
e[n] = t[n];
|
|
@@ -108,22 +122,22 @@ function ye(e) {
|
|
|
108
122
|
t && t.removeChild(e);
|
|
109
123
|
}
|
|
110
124
|
function Me(e, t, n) {
|
|
111
|
-
var _, o, i,
|
|
125
|
+
var _, o, i, a = {};
|
|
112
126
|
for (i in t)
|
|
113
|
-
i == "key" ? _ = t[i] : i == "ref" ? o = t[i] :
|
|
114
|
-
if (arguments.length > 2 && (
|
|
127
|
+
i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : a[i] = t[i];
|
|
128
|
+
if (arguments.length > 2 && (a.children = arguments.length > 3 ? U.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
|
|
115
129
|
for (i in e.defaultProps)
|
|
116
|
-
|
|
117
|
-
return
|
|
130
|
+
a[i] === void 0 && (a[i] = e.defaultProps[i]);
|
|
131
|
+
return D(e, a, _, o, null);
|
|
118
132
|
}
|
|
119
|
-
function
|
|
133
|
+
function D(e, t, n, _, o) {
|
|
120
134
|
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 };
|
|
121
135
|
return o == null && f.vnode != null && f.vnode(i), i;
|
|
122
136
|
}
|
|
123
|
-
function
|
|
137
|
+
function R(e) {
|
|
124
138
|
return e.children;
|
|
125
139
|
}
|
|
126
|
-
function
|
|
140
|
+
function I(e, t) {
|
|
127
141
|
this.props = e, this.context = t;
|
|
128
142
|
}
|
|
129
143
|
function w(e, t) {
|
|
@@ -149,21 +163,21 @@ function oe(e) {
|
|
|
149
163
|
(!e.__d && (e.__d = !0) && E.push(e) && !M.__r++ || _e !== f.debounceRendering) && ((_e = f.debounceRendering) || ve)(M);
|
|
150
164
|
}
|
|
151
165
|
function M() {
|
|
152
|
-
var e, t, n, _, o, i,
|
|
166
|
+
var e, t, n, _, o, i, a, u, l;
|
|
153
167
|
for (E.sort(Z); e = E.shift(); )
|
|
154
|
-
e.__d && (t = E.length, _ = void 0, i = (o = (n = e).__v).__e, u = [],
|
|
168
|
+
e.__d && (t = E.length, _ = void 0, i = (o = (n = e).__v).__e, u = [], l = [], (a = n.__P) && ((_ = S({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), ee(a, _, o, n.__n, a.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, u, i ?? w(o), !!(32 & o.__u), l), _.__.__k[_.__i] = _, xe(u, _, l), _.__e != i && be(_)), E.length > t && E.sort(Z));
|
|
155
169
|
M.__r = 0;
|
|
156
170
|
}
|
|
157
|
-
function ke(e, t, n, _, o, i,
|
|
171
|
+
function ke(e, t, n, _, o, i, a, u, l, s, p) {
|
|
158
172
|
var r, d, c, v, k, g = _ && _.__k || ge, h = t.length;
|
|
159
|
-
for (n.__d =
|
|
160
|
-
(c = n.__k[r]) != null && typeof c != "boolean" && typeof c != "function" && (d = c.__i === -1 ?
|
|
161
|
-
n.__d =
|
|
162
|
-
}
|
|
163
|
-
function
|
|
164
|
-
var _, o, i,
|
|
165
|
-
for (e.__k = [], _ = 0; _ <
|
|
166
|
-
(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 ?
|
|
173
|
+
for (n.__d = l, Te(n, t, g), l = n.__d, r = 0; r < h; r++)
|
|
174
|
+
(c = n.__k[r]) != null && typeof c != "boolean" && typeof c != "function" && (d = c.__i === -1 ? $ : g[c.__i] || $, c.__i = r, ee(e, c, d, o, i, a, u, l, s, p), v = c.__e, c.ref && d.ref != c.ref && (d.ref && te(d.ref, null, c), p.push(c.ref, c.__c || v, c)), k == null && v != null && (k = v), 65536 & c.__u || d.__k === c.__k ? l = Ce(c, l, e) : typeof c.type == "function" && c.__d !== void 0 ? l = c.__d : v && (l = v.nextSibling), c.__d = void 0, c.__u &= -196609);
|
|
175
|
+
n.__d = l, n.__e = k;
|
|
176
|
+
}
|
|
177
|
+
function Te(e, t, n) {
|
|
178
|
+
var _, o, i, a, u, l = t.length, s = n.length, p = s, r = 0;
|
|
179
|
+
for (e.__k = [], _ = 0; _ < l; _++)
|
|
180
|
+
(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 ? D(null, o, null, null, o) : q(o) ? D(R, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? D(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, u = Ae(o, n, a = _ + r, p), o.__i = u, i = null, u !== -1 && (p--, (i = n[u]) && (i.__u |= 131072)), i == null || i.__v === null ? (u == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : u !== a && (u === a + 1 ? r++ : u > a ? p > l - a ? r += u - a : r-- : r = u < a && u == a - 1 ? u - a : 0, u !== _ + 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--);
|
|
167
181
|
if (p)
|
|
168
182
|
for (_ = 0; _ < s; _++)
|
|
169
183
|
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = w(i)), J(i, i));
|
|
@@ -177,19 +191,19 @@ function Ce(e, t, n) {
|
|
|
177
191
|
}
|
|
178
192
|
return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
|
|
179
193
|
}
|
|
180
|
-
function
|
|
181
|
-
var o = e.key, i = e.type,
|
|
182
|
-
if (
|
|
194
|
+
function Ae(e, t, n, _) {
|
|
195
|
+
var o = e.key, i = e.type, a = n - 1, u = n + 1, l = t[n];
|
|
196
|
+
if (l === null || l && o == l.key && i === l.type)
|
|
183
197
|
return n;
|
|
184
|
-
if (_ > (
|
|
185
|
-
for (;
|
|
186
|
-
if (
|
|
187
|
-
if ((
|
|
188
|
-
return
|
|
189
|
-
|
|
198
|
+
if (_ > (l != null && !(131072 & l.__u) ? 1 : 0))
|
|
199
|
+
for (; a >= 0 || u < t.length; ) {
|
|
200
|
+
if (a >= 0) {
|
|
201
|
+
if ((l = t[a]) && !(131072 & l.__u) && o == l.key && i === l.type)
|
|
202
|
+
return a;
|
|
203
|
+
a--;
|
|
190
204
|
}
|
|
191
205
|
if (u < t.length) {
|
|
192
|
-
if ((
|
|
206
|
+
if ((l = t[u]) && !(131072 & l.__u) && o == l.key && i === l.type)
|
|
193
207
|
return u;
|
|
194
208
|
u++;
|
|
195
209
|
}
|
|
@@ -239,23 +253,23 @@ function ie(e) {
|
|
|
239
253
|
function se(e) {
|
|
240
254
|
return this.l[e.type + !0](f.event ? f.event(e) : e);
|
|
241
255
|
}
|
|
242
|
-
function ee(e, t, n, _, o, i,
|
|
243
|
-
var p, r, d, c, v, k, g, h, y, C,
|
|
256
|
+
function ee(e, t, n, _, o, i, a, u, l, s) {
|
|
257
|
+
var p, r, d, c, v, k, g, h, y, C, j, P, ne, N, W, b = t.type;
|
|
244
258
|
if (t.constructor !== void 0)
|
|
245
259
|
return null;
|
|
246
|
-
128 & n.__u && (
|
|
260
|
+
128 & n.__u && (l = !!(32 & n.__u), i = [u = t.__e = n.__e]), (p = f.__b) && p(t);
|
|
247
261
|
e:
|
|
248
262
|
if (typeof b == "function")
|
|
249
263
|
try {
|
|
250
|
-
if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new
|
|
264
|
+
if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new I(h, C), r.constructor = b, r.render = Re), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = S({}, r.__s)), S(r.__s, b.getDerivedStateFromProps(h, r.__s))), c = r.props, v = r.state, r.__v = t, d)
|
|
251
265
|
b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
252
266
|
else {
|
|
253
267
|
if (b.getDerivedStateFromProps == null && h !== c && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, C), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, C) === !1 || t.__v === n.__v)) {
|
|
254
268
|
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(V) {
|
|
255
269
|
V && (V.__ = t);
|
|
256
|
-
}),
|
|
257
|
-
r.__h.push(r._sb[
|
|
258
|
-
r._sb = [], r.__h.length &&
|
|
270
|
+
}), j = 0; j < r._sb.length; j++)
|
|
271
|
+
r.__h.push(r._sb[j]);
|
|
272
|
+
r._sb = [], r.__h.length && a.push(r);
|
|
259
273
|
break e;
|
|
260
274
|
}
|
|
261
275
|
r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, C), r.componentDidUpdate != null && r.__h.push(function() {
|
|
@@ -263,22 +277,22 @@ function ee(e, t, n, _, o, i, l, u, a, s) {
|
|
|
263
277
|
});
|
|
264
278
|
}
|
|
265
279
|
if (r.context = C, r.props = h, r.__P = e, r.__e = !1, P = f.__r, ne = 0, "prototype" in b && b.prototype.render) {
|
|
266
|
-
for (r.state = r.__s, r.__d = !1, P && P(t), p = r.render(r.props, r.state, r.context),
|
|
267
|
-
r.__h.push(r._sb[
|
|
280
|
+
for (r.state = r.__s, r.__d = !1, P && P(t), p = r.render(r.props, r.state, r.context), N = 0; N < r._sb.length; N++)
|
|
281
|
+
r.__h.push(r._sb[N]);
|
|
268
282
|
r._sb = [];
|
|
269
283
|
} else
|
|
270
284
|
do
|
|
271
285
|
r.__d = !1, P && P(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
272
286
|
while (r.__d && ++ne < 25);
|
|
273
|
-
r.state = r.__s, r.getChildContext != null && (_ = S(S({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(c, v)), ke(e, q(W = p != null && p.type ===
|
|
287
|
+
r.state = r.__s, r.getChildContext != null && (_ = S(S({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(c, v)), ke(e, q(W = p != null && p.type === R && p.key == null ? p.props.children : p) ? W : [W], t, n, _, o, i, a, u, l, s), r.base = t.__e, t.__u &= -161, r.__h.length && a.push(r), g && (r.__E = r.__ = null);
|
|
274
288
|
} catch (V) {
|
|
275
|
-
t.__v = null,
|
|
289
|
+
t.__v = null, l || i != null ? (t.__e = u, t.__u |= l ? 160 : 32, i[i.indexOf(u)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(V, t, n);
|
|
276
290
|
}
|
|
277
291
|
else
|
|
278
|
-
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e =
|
|
292
|
+
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Ue(n.__e, t, n, _, o, i, a, l, s);
|
|
279
293
|
(p = f.diffed) && p(t);
|
|
280
294
|
}
|
|
281
|
-
function
|
|
295
|
+
function xe(e, t, n) {
|
|
282
296
|
t.__d = void 0;
|
|
283
297
|
for (var _ = 0; _ < n.length; _++)
|
|
284
298
|
te(n[_], n[++_], n[++_]);
|
|
@@ -292,7 +306,7 @@ function Se(e, t, n) {
|
|
|
292
306
|
}
|
|
293
307
|
});
|
|
294
308
|
}
|
|
295
|
-
function
|
|
309
|
+
function Ue(e, t, n, _, o, i, a, u, l) {
|
|
296
310
|
var s, p, r, d, c, v, k, g = n.props, h = t.props, y = t.type;
|
|
297
311
|
if (y === "svg" && (o = !0), i != null) {
|
|
298
312
|
for (s = 0; s < i.length; s++)
|
|
@@ -309,7 +323,7 @@ function Re(e, t, n, _, o, i, l, u, a) {
|
|
|
309
323
|
if (y === null)
|
|
310
324
|
g === h || u && e.data === h || (e.data = h);
|
|
311
325
|
else {
|
|
312
|
-
if (i = i &&
|
|
326
|
+
if (i = i && U.call(e.childNodes), g = n.props || $, !u && i != null)
|
|
313
327
|
for (g = {}, s = 0; s < e.attributes.length; s++)
|
|
314
328
|
g[(c = e.attributes[s]).name] = c.value;
|
|
315
329
|
for (s in g)
|
|
@@ -318,7 +332,7 @@ function Re(e, t, n, _, o, i, l, u, a) {
|
|
|
318
332
|
c = h[s], s == "children" ? d = c : s == "dangerouslySetInnerHTML" ? p = c : s == "value" ? v = c : s == "checked" ? k = c : s === "key" || u && typeof c != "function" || g[s] === c || H(e, s, c, g[s], o);
|
|
319
333
|
if (p)
|
|
320
334
|
u || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
|
|
321
|
-
else if (r && (e.innerHTML = ""), ke(e, q(d) ? d : [d], t, n, _, o && y !== "foreignObject", i,
|
|
335
|
+
else if (r && (e.innerHTML = ""), ke(e, q(d) ? d : [d], t, n, _, o && y !== "foreignObject", i, a, i ? i[0] : n.__k && w(n, 0), u, l), i != null)
|
|
322
336
|
for (s = i.length; s--; )
|
|
323
337
|
i[s] != null && ye(i[s]);
|
|
324
338
|
u || (s = "value", v !== void 0 && (v !== e[s] || y === "progress" && !v || y === "option" && v !== g[s]) && H(e, s, v, g[s], !1), s = "checked", k !== void 0 && k !== e[s] && H(e, s, k, g[s], !1));
|
|
@@ -348,47 +362,47 @@ function J(e, t, n) {
|
|
|
348
362
|
_[o] && J(_[o], t, n || typeof e.type != "function");
|
|
349
363
|
n || e.__e == null || ye(e.__e), e.__ = e.__e = e.__d = void 0;
|
|
350
364
|
}
|
|
351
|
-
function
|
|
365
|
+
function Re(e, t, n) {
|
|
352
366
|
return this.constructor(e, n);
|
|
353
367
|
}
|
|
354
368
|
function We(e, t, n) {
|
|
355
|
-
var _, o, i,
|
|
356
|
-
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [],
|
|
369
|
+
var _, o, i, a;
|
|
370
|
+
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], a = [], ee(t, e = (!_ && n || t).__k = Me(R, null, [e]), o || $, $, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? U.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, a), xe(i, e, a);
|
|
357
371
|
}
|
|
358
|
-
|
|
359
|
-
for (var o, i,
|
|
372
|
+
U = ge.slice, f = { __e: function(e, t, n, _) {
|
|
373
|
+
for (var o, i, a; t = t.__; )
|
|
360
374
|
if ((o = t.__c) && !o.__)
|
|
361
375
|
try {
|
|
362
|
-
if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)),
|
|
376
|
+
if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, _ || {}), a = o.__d), a)
|
|
363
377
|
return o.__E = o;
|
|
364
378
|
} catch (u) {
|
|
365
379
|
e = u;
|
|
366
380
|
}
|
|
367
381
|
throw e;
|
|
368
|
-
} }, me = 0,
|
|
382
|
+
} }, me = 0, I.prototype.setState = function(e, t) {
|
|
369
383
|
var n;
|
|
370
384
|
n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = S({}, this.state), typeof e == "function" && (e = e(S({}, n), this.props)), e && S(n, e), e != null && this.__v && (t && this._sb.push(t), oe(this));
|
|
371
|
-
},
|
|
385
|
+
}, I.prototype.forceUpdate = function(e) {
|
|
372
386
|
this.__v && (this.__e = !0, e && this.__h.push(e), oe(this));
|
|
373
|
-
},
|
|
387
|
+
}, I.prototype.render = R, E = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, t) {
|
|
374
388
|
return e.__v.__b - t.__v.__b;
|
|
375
389
|
}, M.__r = 0;
|
|
376
|
-
var
|
|
390
|
+
var T, m, G, ue, Y = 0, Se = [], O = [], ae = f.__b, le = f.__r, ce = f.diffed, fe = f.__c, pe = f.unmount;
|
|
377
391
|
function Ee(e, t) {
|
|
378
392
|
f.__h && f.__h(m, e, Y || t), Y = 0;
|
|
379
393
|
var n = m.__H || (m.__H = { __: [], __h: [] });
|
|
380
|
-
return e >= n.__.length && n.__.push({ __V:
|
|
394
|
+
return e >= n.__.length && n.__.push({ __V: O }), n.__[e];
|
|
381
395
|
}
|
|
382
396
|
function Be(e) {
|
|
383
397
|
return Y = 1, Ge(we, e);
|
|
384
398
|
}
|
|
385
399
|
function Ge(e, t, n) {
|
|
386
|
-
var _ = Ee(
|
|
400
|
+
var _ = Ee(T++, 2);
|
|
387
401
|
if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(u) {
|
|
388
|
-
var
|
|
389
|
-
|
|
402
|
+
var l = _.__N ? _.__N[0] : _.__[0], s = _.t(l, u);
|
|
403
|
+
l !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
|
|
390
404
|
}], _.__c = m, !m.u)) {
|
|
391
|
-
var o = function(u,
|
|
405
|
+
var o = function(u, l, s) {
|
|
392
406
|
if (!_.__c.__H)
|
|
393
407
|
return !0;
|
|
394
408
|
var p = _.__c.__H.__.filter(function(d) {
|
|
@@ -397,33 +411,33 @@ function Ge(e, t, n) {
|
|
|
397
411
|
if (p.every(function(d) {
|
|
398
412
|
return !d.__N;
|
|
399
413
|
}))
|
|
400
|
-
return !i || i.call(this, u,
|
|
414
|
+
return !i || i.call(this, u, l, s);
|
|
401
415
|
var r = !1;
|
|
402
416
|
return p.forEach(function(d) {
|
|
403
417
|
if (d.__N) {
|
|
404
418
|
var c = d.__[0];
|
|
405
419
|
d.__ = d.__N, d.__N = void 0, c !== d.__[0] && (r = !0);
|
|
406
420
|
}
|
|
407
|
-
}), !(!r && _.__c.props === u) && (!i || i.call(this, u,
|
|
421
|
+
}), !(!r && _.__c.props === u) && (!i || i.call(this, u, l, s));
|
|
408
422
|
};
|
|
409
423
|
m.u = !0;
|
|
410
|
-
var i = m.shouldComponentUpdate,
|
|
411
|
-
m.componentWillUpdate = function(u,
|
|
424
|
+
var i = m.shouldComponentUpdate, a = m.componentWillUpdate;
|
|
425
|
+
m.componentWillUpdate = function(u, l, s) {
|
|
412
426
|
if (this.__e) {
|
|
413
427
|
var p = i;
|
|
414
|
-
i = void 0, o(u,
|
|
428
|
+
i = void 0, o(u, l, s), i = p;
|
|
415
429
|
}
|
|
416
|
-
|
|
430
|
+
a && a.call(this, u, l, s);
|
|
417
431
|
}, m.shouldComponentUpdate = o;
|
|
418
432
|
}
|
|
419
433
|
return _.__N || _.__;
|
|
420
434
|
}
|
|
421
435
|
function Qe(e, t) {
|
|
422
|
-
var n = Ee(
|
|
436
|
+
var n = Ee(T++, 3);
|
|
423
437
|
!f.__s && Je(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
|
|
424
438
|
}
|
|
425
439
|
function ze() {
|
|
426
|
-
for (var e; e =
|
|
440
|
+
for (var e; e = Se.shift(); )
|
|
427
441
|
if (e.__P && e.__H)
|
|
428
442
|
try {
|
|
429
443
|
e.__H.__h.forEach(F), e.__H.__h.forEach(K), e.__H.__h = [];
|
|
@@ -432,18 +446,18 @@ function ze() {
|
|
|
432
446
|
}
|
|
433
447
|
}
|
|
434
448
|
f.__b = function(e) {
|
|
435
|
-
m = null,
|
|
449
|
+
m = null, ae && ae(e);
|
|
436
450
|
}, f.__r = function(e) {
|
|
437
|
-
|
|
451
|
+
le && le(e), T = 0;
|
|
438
452
|
var t = (m = e.__c).__H;
|
|
439
453
|
t && (G === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
|
|
440
|
-
n.__N && (n.__ = n.__N), n.__V =
|
|
441
|
-
})) : (t.__h.forEach(F), t.__h.forEach(K), t.__h = [],
|
|
454
|
+
n.__N && (n.__ = n.__N), n.__V = O, n.__N = n.i = void 0;
|
|
455
|
+
})) : (t.__h.forEach(F), t.__h.forEach(K), t.__h = [], T = 0)), G = m;
|
|
442
456
|
}, f.diffed = function(e) {
|
|
443
457
|
ce && ce(e);
|
|
444
458
|
var t = e.__c;
|
|
445
|
-
t && t.__H && (t.__H.__h.length && (
|
|
446
|
-
n.i && (n.__H = n.i), n.__V !==
|
|
459
|
+
t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && ue === f.requestAnimationFrame || ((ue = f.requestAnimationFrame) || Ze)(ze)), t.__H.__.forEach(function(n) {
|
|
460
|
+
n.i && (n.__H = n.i), n.__V !== O && (n.__ = n.__V), n.i = void 0, n.__V = O;
|
|
447
461
|
})), G = m = null;
|
|
448
462
|
}, f.__c = function(e, t) {
|
|
449
463
|
t.some(function(n) {
|
|
@@ -493,13 +507,13 @@ function we(e, t) {
|
|
|
493
507
|
}
|
|
494
508
|
var Ye = 0;
|
|
495
509
|
function Pe(e, t, n, _, o, i) {
|
|
496
|
-
var
|
|
510
|
+
var a, u, l = {};
|
|
497
511
|
for (u in t)
|
|
498
|
-
u == "ref" ?
|
|
499
|
-
var s = { type: e, props:
|
|
500
|
-
if (typeof e == "function" && (
|
|
501
|
-
for (u in
|
|
502
|
-
|
|
512
|
+
u == "ref" ? a = t[u] : l[u] = t[u];
|
|
513
|
+
var s = { type: e, props: l, key: n, ref: a, __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 };
|
|
514
|
+
if (typeof e == "function" && (a = e.defaultProps))
|
|
515
|
+
for (u in a)
|
|
516
|
+
l[u] === void 0 && (l[u] = a[u]);
|
|
503
517
|
return f.vnode && f.vnode(s), s;
|
|
504
518
|
}
|
|
505
519
|
class Ke {
|
|
@@ -534,16 +548,16 @@ class Ke {
|
|
|
534
548
|
console.log("Navigating to customer portal");
|
|
535
549
|
}
|
|
536
550
|
}
|
|
537
|
-
let
|
|
551
|
+
let A;
|
|
538
552
|
const Xe = ({
|
|
539
553
|
context: e
|
|
540
554
|
}) => {
|
|
541
555
|
const [t, n] = Be(null);
|
|
542
556
|
return Qe(() => {
|
|
543
557
|
if (t) {
|
|
544
|
-
if (
|
|
558
|
+
if (A === void 0)
|
|
545
559
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
546
|
-
|
|
560
|
+
A.setContext({
|
|
547
561
|
...e,
|
|
548
562
|
container: t
|
|
549
563
|
});
|
|
@@ -554,13 +568,13 @@ const Xe = ({
|
|
|
554
568
|
});
|
|
555
569
|
};
|
|
556
570
|
function Ct(e, t) {
|
|
557
|
-
|
|
571
|
+
A = new Ke(), window.SpiffThemeLoader = A;
|
|
558
572
|
let n;
|
|
559
573
|
typeof e == "string" ? n = document.getElementById(e) : n = e, We(Pe(Xe, {
|
|
560
574
|
context: t
|
|
561
575
|
}), n);
|
|
562
576
|
}
|
|
563
|
-
function
|
|
577
|
+
function xt(e) {
|
|
564
578
|
return {
|
|
565
579
|
id: "example",
|
|
566
580
|
themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
|
|
@@ -593,7 +607,7 @@ const qe = (e) => {
|
|
|
593
607
|
if (Object.keys(e).includes("defaultValue"))
|
|
594
608
|
return e.defaultValue;
|
|
595
609
|
};
|
|
596
|
-
function
|
|
610
|
+
function St(e, ...t) {
|
|
597
611
|
return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
|
|
598
612
|
key: n.key,
|
|
599
613
|
fallbackToDefaultConfiguration: !1,
|
|
@@ -602,7 +616,7 @@ function xt(e, ...t) {
|
|
|
602
616
|
asset: void 0
|
|
603
617
|
}));
|
|
604
618
|
}
|
|
605
|
-
const et = "@spiffcommerce/theme-bridge", tt = "1.21.
|
|
619
|
+
const et = "@spiffcommerce/theme-bridge", tt = "1.21.3-beta.79b2126b-e448-51fd-9db0-82be6c587e53", nt = "module", _t = {
|
|
606
620
|
build: "tsc && vite build",
|
|
607
621
|
preview: "vite preview",
|
|
608
622
|
dev: "ladle serve",
|
|
@@ -612,7 +626,7 @@ const et = "@spiffcommerce/theme-bridge", tt = "1.21.1", nt = "module", _t = {
|
|
|
612
626
|
], ut = {
|
|
613
627
|
import: "./dist/index.js",
|
|
614
628
|
require: "./dist/index.umd.cjs"
|
|
615
|
-
},
|
|
629
|
+
}, at = {}, lt = {
|
|
616
630
|
"@ladle/react": "^4.0.2",
|
|
617
631
|
"@preact/preset-vite": "^2.7.0",
|
|
618
632
|
"@spiffcommerce/core": "^21.0.1",
|
|
@@ -644,8 +658,8 @@ const et = "@spiffcommerce/theme-bridge", tt = "1.21.1", nt = "module", _t = {
|
|
|
644
658
|
types: it,
|
|
645
659
|
files: st,
|
|
646
660
|
exports: ut,
|
|
647
|
-
dependencies:
|
|
648
|
-
devDependencies:
|
|
661
|
+
dependencies: at,
|
|
662
|
+
devDependencies: lt,
|
|
649
663
|
peerDependencies: ct,
|
|
650
664
|
packageManager: ft
|
|
651
665
|
};
|
|
@@ -678,31 +692,31 @@ function Et(e) {
|
|
|
678
692
|
return {
|
|
679
693
|
name: "spiff-theme-plugin",
|
|
680
694
|
version: pt.version,
|
|
681
|
-
config(i,
|
|
695
|
+
config(i, a) {
|
|
682
696
|
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 = "";
|
|
683
697
|
},
|
|
684
|
-
writeBundle(i,
|
|
685
|
-
const u = t ? Object.keys(
|
|
698
|
+
writeBundle(i, a) {
|
|
699
|
+
const u = t ? Object.keys(a).map((s) => o != null && o.some((p) => p.filename === s) ? null : dt(s, a[s], _)).filter((s) => s !== null) : [];
|
|
686
700
|
o && u.push(...o);
|
|
687
|
-
const
|
|
701
|
+
const l = {
|
|
688
702
|
launchData: {
|
|
689
703
|
targetFiles: u
|
|
690
704
|
},
|
|
691
705
|
configurationSchema: n
|
|
692
706
|
};
|
|
693
|
-
|
|
707
|
+
Ne.writeFileSync(Ve.join(i.dir, "spiffTheme.json"), JSON.stringify(l, void 0, 4));
|
|
694
708
|
}
|
|
695
709
|
};
|
|
696
710
|
}
|
|
697
711
|
export {
|
|
698
712
|
He as AssetType,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
713
|
+
Oe as ConversionDataType,
|
|
714
|
+
Ie as ConversionLocation,
|
|
715
|
+
De as CustomSchemaType,
|
|
702
716
|
x as FieldType,
|
|
703
717
|
Q as ThemeFileType,
|
|
704
|
-
|
|
705
|
-
|
|
718
|
+
xt as exampleThemeInstallConfig,
|
|
719
|
+
St as getDefaultsForSchema,
|
|
706
720
|
Ct as setSpiffDevOptions,
|
|
707
721
|
Et as spiffThemePlugin,
|
|
708
722
|
gt as themeInstallConfigurationFieldsToRecordObject,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(p,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(p=typeof globalThis<"u"?globalThis:p||self,k(p.theme={},p.fs,p.path))})(this,function(p,k,P){"use strict";var at=Object.defineProperty;var lt=(p,k,P)=>k in p?at(p,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):p[k]=P;var _e=(p,k,P)=>(lt(p,typeof k!="symbol"?k+"":k,P),P);var D=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(D||{}),E=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.ConversionConfiguration="ConversionConfiguration",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e.DateRange="DateRange",e))(E||{}),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||{}),se=(e=>(e.Manual="Manual",e.OnStart="OnStart",e.OnQuit="OnQuit",e.OnEnd="OnEnd",e))(se||{}),ue=(e=>(e.Email="Email",e.FirstName="FirstName",e.LastName="LastName",e.Phone="Phone",e.Apartment="Apartment",e.City="City",e.Country="Country",e.OrganizationName="OrganizationName",e.PostCode="PostCode",e.State="State",e.StreetAddress="StreetAddress",e.DesignName="DesignName",e.PurchaseOrder="PurchaseOrder",e.DispatchDate="DispatchDate",e.Stakeholders="Stakeholders",e))(ue||{});function z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:ae(t)}}))}function ae(e){if(e.type===E.Asset)return e.asset;if(e.type===E.ConversionConfiguration)return e.conversionConfiguration;if(e.type!==E.List&&e.type!==E.Object){if(e.value===void 0)return;if(e.type===E.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===E.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(ae);if(e.objectValues)return{...z(e.objectValues),schema:e.schema??void 0}}function He(e){return z(e)}function Fe(e){return z(e.fields)}function O(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&e.items!==null&&(n.items=O(t[e.items],t)),e.fields!==void 0&&e.fields!==null&&(n.fields=e.fields.map(o=>O(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(a=>O(e.fields[a],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(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 Me(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&&e.listValues!==null&&(n.listValues=e.listValues.map(o=>Z(t[o],t))),e.objectValues!==void 0&&e.objectValues!==null&&(n.objectValues=e.objectValues.map(o=>Z(t[o],t))),n}function Re(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 T,f,ce,j,fe,de,J,N={},pe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function he(e){var t=e.parentNode;t&&t.removeChild(e)}function Ae(e,t,n){var o,_,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?T.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return I(e,a,o,_,null)}function I(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:_??++ce,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function H(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 n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?$(e):null}function me(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 me(e)}}function ve(e){(!e.__d&&(e.__d=!0)&&j.push(e)&&!M.__r++||fe!==f.debounceRendering)&&((fe=f.debounceRendering)||de)(M)}function M(){var e,t,n,o,_,i,a,u,l;for(j.sort(J);e=j.shift();)e.__d&&(t=j.length,o=void 0,i=(_=(n=e).__v).__e,u=[],l=[],(a=n.__P)&&((o=w({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),q(a,o,_,n.__n,a.ownerSVGElement!==void 0,32&_.__u?[i]:null,u,i??$(_),!!(32&_.__u),l),o.__.__k[o.__i]=o,Se(u,o,l),o.__e!=i&&me(o)),j.length>t&&j.sort(J));M.__r=0}function ge(e,t,n,o,_,i,a,u,l,s,d){var r,h,c,g,S,y=o&&o.__k||pe,m=t.length;for(n.__d=l,Ue(n,t,y),l=n.__d,r=0;r<m;r++)(c=n.__k[r])!=null&&typeof c!="boolean"&&typeof c!="function"&&(h=c.__i===-1?N:y[c.__i]||N,c.__i=r,q(e,c,h,_,i,a,u,l,s,d),g=c.__e,c.ref&&h.ref!=c.ref&&(h.ref&&K(h.ref,null,c),d.push(c.ref,c.__c||g,c)),S==null&&g!=null&&(S=g),65536&c.__u||h.__k===c.__k?l=ye(c,l,e):typeof c.type=="function"&&c.__d!==void 0?l=c.__d:g&&(l=g.nextSibling),c.__d=void 0,c.__u&=-196609);n.__d=l,n.__e=S}function Ue(e,t,n){var o,_,i,a,u,l=t.length,s=n.length,d=s,r=0;for(e.__k=[],o=0;o<l;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?I(null,_,null,null,_):Y(_)?I(H,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?I(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,u=We(_,n,a=o+r,d),_.__i=u,i=null,u!==-1&&(d--,(i=n[u])&&(i.__u|=131072)),i==null||i.__v===null?(u==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):u!==a&&(u===a+1?r++:u>a?d>l-a?r+=u-a:r--:r=u<a&&u==a-1?u-a:0,u!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=$(i)),X(i,i,!1),n[o]=null,d--);if(d)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=$(i)),X(i,i))}function ye(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ye(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function We(e,t,n,o){var _=e.key,i=e.type,a=n-1,u=n+1,l=t[n];if(l===null||l&&_==l.key&&i===l.type)return n;if(o>(l!=null&&!(131072&l.__u)?1:0))for(;a>=0||u<t.length;){if(a>=0){if((l=t[a])&&!(131072&l.__u)&&_==l.key&&i===l.type)return a;a--}if(u<t.length){if((l=t[u])&&!(131072&l.__u)&&_==l.key&&i===l.type)return u;u++}}return-1}function be(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||be(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||be(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?Ce:ke,i)):e.removeEventListener(t,i?Ce:ke,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 ke(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 Ce(e){return this.l[e.type+!0](f.event?f.event(e):e)}function q(e,t,n,o,_,i,a,u,l,s){var d,r,h,c,g,S,y,m,b,x,G,V,Ie,Q,oe,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[u=t.__e=n.__e]),(d=f.__b)&&d(t);e:if(typeof C=="function")try{if(m=t.props,b=(d=C.contextType)&&o[d.__c],x=d?b?b.props.value:d.__:o,n.__c?y=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,x):(t.__c=r=new F(m,x),r.constructor=C,r.render=Qe),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=x,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=w({},r.__s)),w(r.__s,C.getDerivedStateFromProps(m,r.__s))),c=r.props,g=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!==c&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,x),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,x)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(B){B&&(B.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&a.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,x),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(c,g,S)})}if(r.context=x,r.props=m,r.__P=e,r.__e=!1,V=f.__r,Ie=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,V&&V(t),d=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,V&&V(t),d=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=w(w({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(c,g)),ge(e,Y(oe=d!=null&&d.type===H&&d.key==null?d.props.children:d)?oe:[oe],t,n,o,_,i,a,u,l,s),r.base=t.__e,t.__u&=-161,r.__h.length&&a.push(r),y&&(r.__E=r.__=null)}catch(B){t.__v=null,l||i!=null?(t.__e=u,t.__u|=l?160:32,i[i.indexOf(u)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ge(n.__e,t,n,o,_,i,a,l,s);(d=f.diffed)&&d(t)}function Se(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)K(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 Ge(e,t,n,o,_,i,a,u,l){var s,d,r,h,c,g,S,y=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((c=i[s])&&"setAttribute"in c==!!b&&(b?c.localName===b:c.nodeType===3)){e=c,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,u=!1}if(b===null)y===m||u&&e.data===m||(e.data=m);else{if(i=i&&T.call(e.childNodes),y=n.props||N,!u&&i!=null)for(y={},s=0;s<e.attributes.length;s++)y[(c=e.attributes[s]).name]=c.value;for(s in y)c=y[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=c:s==="key"||s in m||R(e,s,null,c,_));for(s in m)c=m[s],s=="children"?h=c:s=="dangerouslySetInnerHTML"?d=c:s=="value"?g=c:s=="checked"?S=c:s==="key"||u&&typeof c!="function"||y[s]===c||R(e,s,c,y[s],_);if(d)u||r&&(d.__html===r.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(r&&(e.innerHTML=""),ge(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,a,i?i[0]:n.__k&&$(n,0),u,l),i!=null)for(s=i.length;s--;)i[s]!=null&&he(i[s]);u||(s="value",g!==void 0&&(g!==e[s]||b==="progress"&&!g||b==="option"&&g!==y[s])&&R(e,s,g,y[s],!1),s="checked",S!==void 0&&S!==e[s]&&R(e,s,S,y[s],!1))}return e}function K(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function X(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||K(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[_]&&X(o[_],t,n||typeof e.type!="function");n||e.__e==null||he(e.__e),e.__=e.__e=e.__d=void 0}function Qe(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var o,_,i,a;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],q(t,e=(!o&&n||t).__k=Ae(H,null,[e]),_||N,N,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?T.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,a),Se(i,e,a)}T=pe.slice,f={__e:function(e,t,n,o){for(var _,i,a;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),a=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),a=_.__d),a)return _.__E=_}catch(u){e=u}throw e}},ce=0,F.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=w({},this.state),typeof e=="function"&&(e=e(w({},n),this.props)),e&&w(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ve(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ve(this))},F.prototype.render=H,j=[],de=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0;var L,v,ee,Ee,te=0,we=[],A=[],xe=f.__b,Pe=f.__r,je=f.diffed,$e=f.__c,Ne=f.unmount;function Ve(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:A}),n.__[e]}function ze(e){return te=1,Ze(Oe,e)}function Ze(e,t,n){var o=Ve(L++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Oe(void 0,t),function(u){var l=o.__N?o.__N[0]:o.__[0],s=o.t(l,u);l!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(u,l,s){if(!o.__c.__H)return!0;var d=o.__c.__H.__.filter(function(h){return h.__c});if(d.every(function(h){return!h.__N}))return!i||i.call(this,u,l,s);var r=!1;return d.forEach(function(h){if(h.__N){var c=h.__[0];h.__=h.__N,h.__N=void 0,c!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===u)&&(!i||i.call(this,u,l,s))};v.u=!0;var i=v.shouldComponentUpdate,a=v.componentWillUpdate;v.componentWillUpdate=function(u,l,s){if(this.__e){var d=i;i=void 0,_(u,l,s),i=d}a&&a.call(this,u,l,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Je(e,t){var n=Ve(L++,3);!f.__s&&Ke(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ye(){for(var e;e=we.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(ne),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){Pe&&Pe(e),L=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=A,n.__N=n.i=void 0})):(t.__h.forEach(U),t.__h.forEach(ne),t.__h=[],L=0)),ee=v},f.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(we.push(t)!==1&&Ee===f.requestAnimationFrame||((Ee=f.requestAnimationFrame)||qe)(Ye)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==A&&(n.__=n.__V),n.i=void 0,n.__V=A})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),$e&&$e(e,t)},f.unmount=function(e){Ne&&Ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{U(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var De=typeof requestAnimationFrame=="function";function qe(e){var t,n=function(){clearTimeout(o),De&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);De&&(t=requestAnimationFrame(n))}function U(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 Ke(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Oe(e,t){return typeof t=="function"?t(e):t}var Xe=0;function Te(e,t,n,o,_,i){var a,u,l={};for(u in t)u=="ref"?a=t[u]:l[u]=t[u];var s={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Xe,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(u in a)l[u]===void 0&&(l[u]=a[u]);return f.vnode&&f.vnode(s),s}class et{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)}completeQuote(){console.log("Complete quote")}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const tt=({context:e})=>{const[t,n]=ze(null);return Je(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Te("div",{ref:n,id:"spiffThemeWrapper"})};function nt(e,t){W=new et,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Be(Te(tt,{context:t}),n)}function ot(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 _t=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function rt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:_t(n),type:n.type,asset:void 0}))}const it={name:"@spiffcommerce/theme-bridge",version:"1.21.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"},packageManager:"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"};function st(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:D.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:D.CSS,mimeType:"text/css",filename:e};return null}function ut(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:it.version,config(i,a){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,a){const u=t?Object.keys(a).map(s=>_!=null&&_.some(d=>d.filename===s)?null:st(s,a[s],o)).filter(s=>s!==null):[];_&&u.push(..._);const l={launchData:{targetFiles:u},configurationSchema:n};k.writeFileSync(P.join(i.dir,"spiffTheme.json"),JSON.stringify(l,void 0,4))}}}p.AssetType=re,p.ConversionDataType=ue,p.ConversionLocation=se,p.CustomSchemaType=ie,p.FieldType=E,p.ThemeFileType=D,p.exampleThemeInstallConfig=ot,p.getDefaultsForSchema=rt,p.setSpiffDevOptions=nt,p.spiffThemePlugin=ut,p.themeInstallConfigurationFieldsToRecordObject=He,p.themeInstallConfigurationGraphQlToResource=Re,p.themeInstallConfigurationToRecordObject=Fe,p.themeVersionConfigurationGraphQlToResource=le,p.themeVersionGraphQlToResource=Me,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(d,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],C):(d=typeof globalThis<"u"?globalThis:d||self,C(d.theme={},d.fs,d.path))})(this,function(d,C,P){"use strict";var at=Object.defineProperty;var lt=(d,C,P)=>C in d?at(d,C,{enumerable:!0,configurable:!0,writable:!0,value:P}):d[C]=P;var _e=(d,C,P)=>(lt(d,typeof C!="symbol"?C+"":C,P),P);var D=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(D||{}),E=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.ConversionConfiguration="ConversionConfiguration",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e.DateRange="DateRange",e))(E||{}),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||{}),se=(e=>(e.Manual="Manual",e.OnStart="OnStart",e.OnQuit="OnQuit",e.OnEnd="OnEnd",e))(se||{}),ue=(e=>(e.Email="Email",e.FirstName="FirstName",e.LastName="LastName",e.Phone="Phone",e.Apartment="Apartment",e.City="City",e.Country="Country",e.OrganizationName="OrganizationName",e.PostCode="PostCode",e.State="State",e.StreetAddress="StreetAddress",e.Custom="Custom",e))(ue||{});function z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:ae(t)}}))}function ae(e){var t;if(e.type===E.Asset)return e.asset;if(e.type===E.DateRange){const n=(t=e.value)==null?void 0:t.split(",");if(!n||n.length!==2||!n[0]||!n[1])return;try{return{start:new Date(n[0]),end:new Date(n[1])}}catch{return}}if(e.type===E.ConversionConfiguration)return e.conversionConfiguration;if(e.type!==E.List&&e.type!==E.Object){if(e.value===void 0)return;if(e.type===E.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===E.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(ae);if(e.objectValues)return{...z(e.objectValues),schema:e.schema??void 0}}function Oe(e){return z(e)}function Fe(e){return z(e.fields)}function N(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&e.items!==null&&(n.items=N(t[e.items],t)),e.fields!==void 0&&e.fields!==null&&(n.fields=e.fields.map(o=>N(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(a=>N(e.fields[a],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(N(_,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 Re(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&&e.listValues!==null&&(n.listValues=e.listValues.map(o=>Z(t[o],t))),e.objectValues!==void 0&&e.objectValues!==null&&(n.objectValues=e.objectValues.map(o=>Z(t[o],t))),n}function Me(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 I,f,ce,j,fe,pe,J,$={},de=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function he(e){var t=e.parentNode;t&&t.removeChild(e)}function Ae(e,t,n){var o,_,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return H(e,a,o,_,null)}function H(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:_??++ce,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function O(e){return e.children}function F(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(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"?T(e):null}function me(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 me(e)}}function ve(e){(!e.__d&&(e.__d=!0)&&j.push(e)&&!R.__r++||fe!==f.debounceRendering)&&((fe=f.debounceRendering)||pe)(R)}function R(){var e,t,n,o,_,i,a,u,l;for(j.sort(J);e=j.shift();)e.__d&&(t=j.length,o=void 0,i=(_=(n=e).__v).__e,u=[],l=[],(a=n.__P)&&((o=w({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),q(a,o,_,n.__n,a.ownerSVGElement!==void 0,32&_.__u?[i]:null,u,i??T(_),!!(32&_.__u),l),o.__.__k[o.__i]=o,Se(u,o,l),o.__e!=i&&me(o)),j.length>t&&j.sort(J));R.__r=0}function ge(e,t,n,o,_,i,a,u,l,s,p){var r,h,c,g,S,y=o&&o.__k||de,m=t.length;for(n.__d=l,Ue(n,t,y),l=n.__d,r=0;r<m;r++)(c=n.__k[r])!=null&&typeof c!="boolean"&&typeof c!="function"&&(h=c.__i===-1?$:y[c.__i]||$,c.__i=r,q(e,c,h,_,i,a,u,l,s,p),g=c.__e,c.ref&&h.ref!=c.ref&&(h.ref&&K(h.ref,null,c),p.push(c.ref,c.__c||g,c)),S==null&&g!=null&&(S=g),65536&c.__u||h.__k===c.__k?l=ye(c,l,e):typeof c.type=="function"&&c.__d!==void 0?l=c.__d:g&&(l=g.nextSibling),c.__d=void 0,c.__u&=-196609);n.__d=l,n.__e=S}function Ue(e,t,n){var o,_,i,a,u,l=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<l;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?H(null,_,null,null,_):Y(_)?H(O,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?H(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,u=We(_,n,a=o+r,p),_.__i=u,i=null,u!==-1&&(p--,(i=n[u])&&(i.__u|=131072)),i==null||i.__v===null?(u==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):u!==a&&(u===a+1?r++:u>a?p>l-a?r+=u-a:r--:r=u<a&&u==a-1?u-a:0,u!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=T(i)),X(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=T(i)),X(i,i))}function ye(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ye(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function We(e,t,n,o){var _=e.key,i=e.type,a=n-1,u=n+1,l=t[n];if(l===null||l&&_==l.key&&i===l.type)return n;if(o>(l!=null&&!(131072&l.__u)?1:0))for(;a>=0||u<t.length;){if(a>=0){if((l=t[a])&&!(131072&l.__u)&&_==l.key&&i===l.type)return a;a--}if(u<t.length){if((l=t[u])&&!(131072&l.__u)&&_==l.key&&i===l.type)return u;u++}}return-1}function be(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function M(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||be(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||be(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?ke:Ce,i)):e.removeEventListener(t,i?ke:Ce,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 Ce(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 ke(e){return this.l[e.type+!0](f.event?f.event(e):e)}function q(e,t,n,o,_,i,a,u,l,s){var p,r,h,c,g,S,y,m,b,x,G,V,He,Q,oe,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[u=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof k=="function")try{if(m=t.props,b=(p=k.contextType)&&o[p.__c],x=p?b?b.props.value:p.__:o,n.__c?y=(r=t.__c=n.__c).__=r.__E:("prototype"in k&&k.prototype.render?t.__c=r=new k(m,x):(t.__c=r=new F(m,x),r.constructor=k,r.render=Qe),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=x,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),k.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=w({},r.__s)),w(r.__s,k.getDerivedStateFromProps(m,r.__s))),c=r.props,g=r.state,r.__v=t,h)k.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(k.getDerivedStateFromProps==null&&m!==c&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,x),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,x)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(B){B&&(B.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&a.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,x),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(c,g,S)})}if(r.context=x,r.props=m,r.__P=e,r.__e=!1,V=f.__r,He=0,"prototype"in k&&k.prototype.render){for(r.state=r.__s,r.__d=!1,V&&V(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,V&&V(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&&(o=w(w({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(c,g)),ge(e,Y(oe=p!=null&&p.type===O&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,a,u,l,s),r.base=t.__e,t.__u&=-161,r.__h.length&&a.push(r),y&&(r.__E=r.__=null)}catch(B){t.__v=null,l||i!=null?(t.__e=u,t.__u|=l?160:32,i[i.indexOf(u)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ge(n.__e,t,n,o,_,i,a,l,s);(p=f.diffed)&&p(t)}function Se(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)K(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 Ge(e,t,n,o,_,i,a,u,l){var s,p,r,h,c,g,S,y=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((c=i[s])&&"setAttribute"in c==!!b&&(b?c.localName===b:c.nodeType===3)){e=c,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,u=!1}if(b===null)y===m||u&&e.data===m||(e.data=m);else{if(i=i&&I.call(e.childNodes),y=n.props||$,!u&&i!=null)for(y={},s=0;s<e.attributes.length;s++)y[(c=e.attributes[s]).name]=c.value;for(s in y)c=y[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=c:s==="key"||s in m||M(e,s,null,c,_));for(s in m)c=m[s],s=="children"?h=c:s=="dangerouslySetInnerHTML"?p=c:s=="value"?g=c:s=="checked"?S=c:s==="key"||u&&typeof c!="function"||y[s]===c||M(e,s,c,y[s],_);if(p)u||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ge(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,a,i?i[0]:n.__k&&T(n,0),u,l),i!=null)for(s=i.length;s--;)i[s]!=null&&he(i[s]);u||(s="value",g!==void 0&&(g!==e[s]||b==="progress"&&!g||b==="option"&&g!==y[s])&&M(e,s,g,y[s],!1),s="checked",S!==void 0&&S!==e[s]&&M(e,s,S,y[s],!1))}return e}function K(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function X(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||K(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[_]&&X(o[_],t,n||typeof e.type!="function");n||e.__e==null||he(e.__e),e.__=e.__e=e.__d=void 0}function Qe(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var o,_,i,a;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],q(t,e=(!o&&n||t).__k=Ae(O,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?I.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,a),Se(i,e,a)}I=de.slice,f={__e:function(e,t,n,o){for(var _,i,a;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),a=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),a=_.__d),a)return _.__E=_}catch(u){e=u}throw e}},ce=0,F.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=w({},this.state),typeof e=="function"&&(e=e(w({},n),this.props)),e&&w(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ve(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ve(this))},F.prototype.render=O,j=[],pe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0;var L,v,ee,Ee,te=0,we=[],A=[],xe=f.__b,Pe=f.__r,je=f.diffed,Te=f.__c,$e=f.unmount;function Ve(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:A}),n.__[e]}function ze(e){return te=1,Ze(Ne,e)}function Ze(e,t,n){var o=Ve(L++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ne(void 0,t),function(u){var l=o.__N?o.__N[0]:o.__[0],s=o.t(l,u);l!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(u,l,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,u,l,s);var r=!1;return p.forEach(function(h){if(h.__N){var c=h.__[0];h.__=h.__N,h.__N=void 0,c!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===u)&&(!i||i.call(this,u,l,s))};v.u=!0;var i=v.shouldComponentUpdate,a=v.componentWillUpdate;v.componentWillUpdate=function(u,l,s){if(this.__e){var p=i;i=void 0,_(u,l,s),i=p}a&&a.call(this,u,l,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Je(e,t){var n=Ve(L++,3);!f.__s&&Ke(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ye(){for(var e;e=we.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(ne),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){Pe&&Pe(e),L=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=A,n.__N=n.i=void 0})):(t.__h.forEach(U),t.__h.forEach(ne),t.__h=[],L=0)),ee=v},f.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(we.push(t)!==1&&Ee===f.requestAnimationFrame||((Ee=f.requestAnimationFrame)||qe)(Ye)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==A&&(n.__=n.__V),n.i=void 0,n.__V=A})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),Te&&Te(e,t)},f.unmount=function(e){$e&&$e(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{U(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var De=typeof requestAnimationFrame=="function";function qe(e){var t,n=function(){clearTimeout(o),De&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);De&&(t=requestAnimationFrame(n))}function U(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 Ke(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ne(e,t){return typeof t=="function"?t(e):t}var Xe=0;function Ie(e,t,n,o,_,i){var a,u,l={};for(u in t)u=="ref"?a=t[u]:l[u]=t[u];var s={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Xe,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(u in a)l[u]===void 0&&(l[u]=a[u]);return f.vnode&&f.vnode(s),s}class et{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)}completeQuote(){console.log("Complete quote")}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const tt=({context:e})=>{const[t,n]=ze(null);return Je(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ie("div",{ref:n,id:"spiffThemeWrapper"})};function nt(e,t){W=new et,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Be(Ie(tt,{context:t}),n)}function ot(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 _t=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function rt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:_t(n),type:n.type,asset:void 0}))}const it={name:"@spiffcommerce/theme-bridge",version:"1.21.3-beta.79b2126b-e448-51fd-9db0-82be6c587e53",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"},packageManager:"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"};function st(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:D.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:D.CSS,mimeType:"text/css",filename:e};return null}function ut(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:it.version,config(i,a){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,a){const u=t?Object.keys(a).map(s=>_!=null&&_.some(p=>p.filename===s)?null:st(s,a[s],o)).filter(s=>s!==null):[];_&&u.push(..._);const l={launchData:{targetFiles:u},configurationSchema:n};C.writeFileSync(P.join(i.dir,"spiffTheme.json"),JSON.stringify(l,void 0,4))}}}d.AssetType=re,d.ConversionDataType=ue,d.ConversionLocation=se,d.CustomSchemaType=ie,d.FieldType=E,d.ThemeFileType=D,d.exampleThemeInstallConfig=ot,d.getDefaultsForSchema=rt,d.setSpiffDevOptions=nt,d.spiffThemePlugin=ut,d.themeInstallConfigurationFieldsToRecordObject=Oe,d.themeInstallConfigurationGraphQlToResource=Me,d.themeInstallConfigurationToRecordObject=Fe,d.themeVersionConfigurationGraphQlToResource=le,d.themeVersionGraphQlToResource=Re,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|