@spiffcommerce/theme-bridge 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +70 -4
- package/dist/index.js +154 -145
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ interface ThemeConfigurationSchema {
|
|
|
59
59
|
* An array of fields that a Partner can configure when they install the theme.
|
|
60
60
|
*/
|
|
61
61
|
fields: ThemeConfigurationSchemaField[];
|
|
62
|
+
/**
|
|
63
|
+
* An array of custom schemas that can be reused anywhere on any field.
|
|
64
|
+
*/
|
|
65
|
+
customSchemas?: ThemeConfigurationSchemaCustomSchema[];
|
|
62
66
|
}
|
|
63
67
|
interface FieldBase {
|
|
64
68
|
/**
|
|
@@ -153,13 +157,20 @@ interface ObjectField extends ConfigurableField, RequiredOption {
|
|
|
153
157
|
* Defines the configuration schema for the fields in this object.
|
|
154
158
|
*/
|
|
155
159
|
fields: ThemeConfigurationSchemaField[];
|
|
160
|
+
/**
|
|
161
|
+
* The schema to use from the `customSchemas` field. Leave this null when not using a pre-defined schema.
|
|
162
|
+
*/
|
|
163
|
+
schema?: null;
|
|
164
|
+
}
|
|
165
|
+
interface CustomObjectField extends Omit<ObjectField, "fields" | "schema"> {
|
|
166
|
+
schema: string;
|
|
156
167
|
}
|
|
157
168
|
/** https://stackoverflow.com/a/57103940/23523714 */
|
|
158
169
|
type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
159
170
|
/**
|
|
160
171
|
* All fields that are configurable by a user in Hub.
|
|
161
172
|
*/
|
|
162
|
-
type ThemeConfigurationConfigurableFields = GenericField | AssetField | SelectField | TextField | ListField | ObjectField;
|
|
173
|
+
type ThemeConfigurationConfigurableFields = GenericField | AssetField | SelectField | TextField | ListField | ObjectField | CustomObjectField;
|
|
163
174
|
/**
|
|
164
175
|
* All fields.
|
|
165
176
|
*/
|
|
@@ -177,6 +188,42 @@ declare enum AssetType {
|
|
|
177
188
|
Model = "Model",
|
|
178
189
|
Video = "Video"
|
|
179
190
|
}
|
|
191
|
+
declare enum CustomSchemaType {
|
|
192
|
+
Object = "Object",
|
|
193
|
+
Union = "Union"
|
|
194
|
+
}
|
|
195
|
+
interface CustomSchemaBase {
|
|
196
|
+
/**
|
|
197
|
+
* A unique name for the schema.
|
|
198
|
+
*/
|
|
199
|
+
name: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A schema for a reusable custom object. This is effectively the same as an ObjectField.
|
|
203
|
+
*/
|
|
204
|
+
interface ObjectCustomSchema extends CustomSchemaBase {
|
|
205
|
+
type: CustomSchemaType.Object;
|
|
206
|
+
/**
|
|
207
|
+
* Defines the configuration schema for the fields in this object.
|
|
208
|
+
*/
|
|
209
|
+
fields: ThemeConfigurationSchemaField[];
|
|
210
|
+
/**
|
|
211
|
+
* Optional: Allows your schema to extend from other object schemas.
|
|
212
|
+
* Useful when you have a base type and want to create variants.
|
|
213
|
+
*/
|
|
214
|
+
extends?: string[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A schema for a reusable union of multiple custom object schemas.
|
|
218
|
+
*/
|
|
219
|
+
interface UnionCustomSchema extends CustomSchemaBase {
|
|
220
|
+
type: CustomSchemaType.Union;
|
|
221
|
+
/**
|
|
222
|
+
* All schemas that can be selected for this union.
|
|
223
|
+
*/
|
|
224
|
+
schemas: string[];
|
|
225
|
+
}
|
|
226
|
+
type ThemeConfigurationSchemaCustomSchema = ObjectCustomSchema | UnionCustomSchema;
|
|
180
227
|
|
|
181
228
|
interface ThemeResource {
|
|
182
229
|
id: string;
|
|
@@ -195,6 +242,17 @@ interface ThemeVersionResource {
|
|
|
195
242
|
}
|
|
196
243
|
interface ThemeConfigurationSchemaResource {
|
|
197
244
|
fields: ThemeConfigurationSchemaFieldResource[];
|
|
245
|
+
customSchemas?: ThemeConfigurationSchemaCustomSchemaResource[];
|
|
246
|
+
}
|
|
247
|
+
interface ThemeConfigurationSchemaCustomSchemaResource {
|
|
248
|
+
name: string;
|
|
249
|
+
type: CustomSchemaType;
|
|
250
|
+
/** When this schema is type `Object`, this array contains the schemas for the sub-fields. */
|
|
251
|
+
fields?: ThemeConfigurationSchemaFieldResource[];
|
|
252
|
+
/** When this schema is type `Object`, this array contains the names of the schemas this schema extends */
|
|
253
|
+
extends?: string[];
|
|
254
|
+
/** When this schema is type `Union`, this array contains the names of the schemas the user can choose from */
|
|
255
|
+
schemas?: string[];
|
|
198
256
|
}
|
|
199
257
|
interface ThemeConfigurationSchemaFieldResource {
|
|
200
258
|
key?: string;
|
|
@@ -211,8 +269,10 @@ interface ThemeConfigurationSchemaFieldResource {
|
|
|
211
269
|
multiLine?: boolean;
|
|
212
270
|
/** When this field is type `List`, this is the schema for the entries. */
|
|
213
271
|
items?: ThemeConfigurationSchemaFieldResource;
|
|
214
|
-
/** When this field is type `Object
|
|
272
|
+
/** When this field is type `Object` and no schema has been specified, this array contains the schemas for the sub-fields. */
|
|
215
273
|
fields?: ThemeConfigurationSchemaFieldResource[];
|
|
274
|
+
/** When this field is type `Object` this will point to a pre-defined schema to use, if any. */
|
|
275
|
+
schema?: string;
|
|
216
276
|
}
|
|
217
277
|
interface ThemeLaunchDataResource {
|
|
218
278
|
targetFiles: ThemeLaunchDataTargetFileResource[];
|
|
@@ -243,6 +303,8 @@ interface ThemeInstallConfigurationFieldResource {
|
|
|
243
303
|
listValues?: ThemeInstallConfigurationFieldResource[];
|
|
244
304
|
/** When the type is `Object`, this will be the configured field values */
|
|
245
305
|
objectValues?: ThemeInstallConfigurationFieldResource[];
|
|
306
|
+
/** The name of the pre-defined schema that was used, if any. */
|
|
307
|
+
schema?: string;
|
|
246
308
|
}
|
|
247
309
|
/**
|
|
248
310
|
* @deprecated This has been renamed to `ThemeInstallConfigurationFieldResource` for consistency.
|
|
@@ -361,8 +423,12 @@ type SpiffThemeLoader = {
|
|
|
361
423
|
type ThemeVersionGraphQl = Omit<ThemeVersionResource, "configurationSchema"> & {
|
|
362
424
|
configurationSchema: ThemeConfigurationSchemaGraphQl;
|
|
363
425
|
};
|
|
364
|
-
type ThemeConfigurationSchemaGraphQl = Omit<ThemeConfigurationSchemaResource, "fields"> & {
|
|
426
|
+
type ThemeConfigurationSchemaGraphQl = Omit<ThemeConfigurationSchemaResource, "fields" | "customSchemas"> & {
|
|
365
427
|
fields: ThemeConfigurationSchemaFieldGraphQl[];
|
|
428
|
+
customSchemas?: ThemeConfigurationSchemaCustomSchemaGraphQl[];
|
|
429
|
+
};
|
|
430
|
+
type ThemeConfigurationSchemaCustomSchemaGraphQl = Omit<ThemeConfigurationSchemaCustomSchemaResource, "fields"> & {
|
|
431
|
+
fields?: number[];
|
|
366
432
|
};
|
|
367
433
|
type ThemeConfigurationSchemaFieldGraphQl = Omit<ThemeConfigurationSchemaFieldResource, "items" | "fields"> & {
|
|
368
434
|
/** When this field is type `List`, this is the index of the schema for the entries. */
|
|
@@ -421,4 +487,4 @@ interface PluginOptions {
|
|
|
421
487
|
*/
|
|
422
488
|
declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
|
|
423
489
|
|
|
424
|
-
export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
|
490
|
+
export { type AssetResource, AssetType, CustomSchemaType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
2
|
var $e = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
var
|
|
3
|
+
var Pe = (e, t, n) => t in e ? $e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
|
+
var B = (e, t, n) => (Pe(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
|
+
import Te from "fs";
|
|
6
|
+
import je from "path";
|
|
7
|
+
var Z = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Z || {}), H = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e))(H || {}), He = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))(He || {}), Ve = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(Ve || {});
|
|
8
8
|
function de(e) {
|
|
9
9
|
return Object.assign({}, ...e.map((t) => {
|
|
10
10
|
if (t.key)
|
|
@@ -14,41 +14,49 @@ function de(e) {
|
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
16
|
function he(e) {
|
|
17
|
-
if (e.type ===
|
|
17
|
+
if (e.type === H.Asset)
|
|
18
18
|
return e.asset;
|
|
19
|
-
if (e.type !==
|
|
19
|
+
if (e.type !== H.List && e.type !== H.Object)
|
|
20
20
|
return e.value;
|
|
21
21
|
if (e.listValues)
|
|
22
22
|
return e.listValues.map(he);
|
|
23
23
|
if (e.objectValues)
|
|
24
24
|
return de(e.objectValues);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ht(e) {
|
|
27
27
|
return de(e.fields);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function F(e, t) {
|
|
30
30
|
const n = {
|
|
31
31
|
...e,
|
|
32
32
|
items: void 0,
|
|
33
33
|
fields: void 0
|
|
34
34
|
};
|
|
35
|
-
return e.items !== void 0 && (n.items =
|
|
35
|
+
return e.items !== void 0 && (n.items = F(t[e.items], t)), e.fields !== void 0 && (n.fields = e.fields.map((_) => F(t[_], t))), n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Ie(e) {
|
|
38
|
+
var _;
|
|
38
39
|
const t = {
|
|
39
40
|
...e,
|
|
40
|
-
fields: []
|
|
41
|
+
fields: [],
|
|
42
|
+
customSchemas: (_ = e.customSchemas) == null ? void 0 : _.map((o) => {
|
|
43
|
+
var i;
|
|
44
|
+
return {
|
|
45
|
+
...o,
|
|
46
|
+
fields: (i = o.fields) == null ? void 0 : i.map((c) => F(e.fields[c], e.fields))
|
|
47
|
+
};
|
|
48
|
+
})
|
|
41
49
|
}, n = [];
|
|
42
|
-
if (e.fields.forEach((
|
|
43
|
-
|
|
50
|
+
if (e.fields.forEach((o) => {
|
|
51
|
+
o.root && n.push(F(o, e.fields));
|
|
44
52
|
}), e.fields.length > 0 && n.length === 0)
|
|
45
53
|
throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");
|
|
46
54
|
return t.fields = n, t;
|
|
47
55
|
}
|
|
48
|
-
function
|
|
56
|
+
function mt(e) {
|
|
49
57
|
return {
|
|
50
58
|
...e,
|
|
51
|
-
configurationSchema:
|
|
59
|
+
configurationSchema: Ie(e.configurationSchema)
|
|
52
60
|
};
|
|
53
61
|
}
|
|
54
62
|
function Q(e, t) {
|
|
@@ -59,7 +67,7 @@ function Q(e, t) {
|
|
|
59
67
|
};
|
|
60
68
|
return e.listValues !== void 0 && (n.listValues = e.listValues.map((_) => Q(t[_], t))), e.objectValues !== void 0 && (n.objectValues = e.objectValues.map((_) => Q(t[_], t))), n;
|
|
61
69
|
}
|
|
62
|
-
function
|
|
70
|
+
function vt(e) {
|
|
63
71
|
const t = {
|
|
64
72
|
...e,
|
|
65
73
|
fields: []
|
|
@@ -70,42 +78,42 @@ function mt(e) {
|
|
|
70
78
|
throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
|
|
71
79
|
return t.fields = n, t;
|
|
72
80
|
}
|
|
73
|
-
var
|
|
81
|
+
var A, f, me, S, ne, ve, z, D = {}, ye = [], Ne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, X = Array.isArray;
|
|
74
82
|
function x(e, t) {
|
|
75
83
|
for (var n in t)
|
|
76
84
|
e[n] = t[n];
|
|
77
85
|
return e;
|
|
78
86
|
}
|
|
79
|
-
function
|
|
87
|
+
function ge(e) {
|
|
80
88
|
var t = e.parentNode;
|
|
81
89
|
t && t.removeChild(e);
|
|
82
90
|
}
|
|
83
|
-
function
|
|
91
|
+
function Le(e, t, n) {
|
|
84
92
|
var _, o, i, c = {};
|
|
85
93
|
for (i in t)
|
|
86
94
|
i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
|
|
87
|
-
if (arguments.length > 2 && (c.children = arguments.length > 3 ?
|
|
95
|
+
if (arguments.length > 2 && (c.children = arguments.length > 3 ? A.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
|
|
88
96
|
for (i in e.defaultProps)
|
|
89
97
|
c[i] === void 0 && (c[i] = e.defaultProps[i]);
|
|
90
|
-
return
|
|
98
|
+
return V(e, c, _, o, null);
|
|
91
99
|
}
|
|
92
|
-
function
|
|
100
|
+
function V(e, t, n, _, o) {
|
|
93
101
|
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 };
|
|
94
102
|
return o == null && f.vnode != null && f.vnode(i), i;
|
|
95
103
|
}
|
|
96
|
-
function
|
|
104
|
+
function W(e) {
|
|
97
105
|
return e.children;
|
|
98
106
|
}
|
|
99
107
|
function I(e, t) {
|
|
100
108
|
this.props = e, this.context = t;
|
|
101
109
|
}
|
|
102
|
-
function
|
|
110
|
+
function E(e, t) {
|
|
103
111
|
if (t == null)
|
|
104
|
-
return e.__ ?
|
|
112
|
+
return e.__ ? E(e.__, e.__i + 1) : null;
|
|
105
113
|
for (var n; t < e.__k.length; t++)
|
|
106
114
|
if ((n = e.__k[t]) != null && n.__e != null)
|
|
107
115
|
return n.__e;
|
|
108
|
-
return typeof e.type == "function" ?
|
|
116
|
+
return typeof e.type == "function" ? E(e) : null;
|
|
109
117
|
}
|
|
110
118
|
function be(e) {
|
|
111
119
|
var t, n;
|
|
@@ -119,27 +127,27 @@ function be(e) {
|
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
function _e(e) {
|
|
122
|
-
(!e.__d && (e.__d = !0) &&
|
|
130
|
+
(!e.__d && (e.__d = !0) && S.push(e) && !U.__r++ || ne !== f.debounceRendering) && ((ne = f.debounceRendering) || ve)(U);
|
|
123
131
|
}
|
|
124
|
-
function
|
|
132
|
+
function U() {
|
|
125
133
|
var e, t, n, _, o, i, c, l, u;
|
|
126
|
-
for (
|
|
127
|
-
e.__d && (t =
|
|
128
|
-
|
|
134
|
+
for (S.sort(z); e = S.shift(); )
|
|
135
|
+
e.__d && (t = S.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], u = [], (c = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), q(c, _, o, n.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? E(o), !!(32 & o.__u), u), _.__.__k[_.__i] = _, xe(l, _, u), _.__e != i && be(_)), S.length > t && S.sort(z));
|
|
136
|
+
U.__r = 0;
|
|
129
137
|
}
|
|
130
138
|
function ke(e, t, n, _, o, i, c, l, u, s, p) {
|
|
131
|
-
var r, d, a, v, k,
|
|
132
|
-
for (n.__d = u,
|
|
133
|
-
(a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D :
|
|
139
|
+
var r, d, a, v, k, y = _ && _.__k || ye, h = t.length;
|
|
140
|
+
for (n.__d = u, Fe(n, t, y), u = n.__d, r = 0; r < h; r++)
|
|
141
|
+
(a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D : y[a.__i] || D, a.__i = r, q(e, a, d, o, i, c, l, u, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && ee(d.ref, null, a), p.push(a.ref, a.__c || v, a)), k == null && v != null && (k = v), 65536 & a.__u || d.__k === a.__k ? u = Ce(a, u, e) : typeof a.type == "function" && a.__d !== void 0 ? u = a.__d : v && (u = v.nextSibling), a.__d = void 0, a.__u &= -196609);
|
|
134
142
|
n.__d = u, n.__e = k;
|
|
135
143
|
}
|
|
136
|
-
function
|
|
144
|
+
function Fe(e, t, n) {
|
|
137
145
|
var _, o, i, c, l, u = t.length, s = n.length, p = s, r = 0;
|
|
138
146
|
for (e.__k = [], _ = 0; _ < u; _++)
|
|
139
|
-
(o = e.__k[_] = (o = t[_]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ?
|
|
147
|
+
(o = e.__k[_] = (o = t[_]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? V(null, o, null, null, o) : X(o) ? V(W, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? V(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = Ue(o, n, c = _ + r, p), o.__i = l, i = null, l !== -1 && (p--, (i = n[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : l !== c && (l === c + 1 ? r++ : l > c ? p > u - c ? r += l - c : r-- : r = l < c && l == c - 1 ? l - c : 0, l !== _ + r && (o.__u |= 65536))) : (i = n[_]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = E(i)), J(i, i, !1), n[_] = null, p--);
|
|
140
148
|
if (p)
|
|
141
149
|
for (_ = 0; _ < s; _++)
|
|
142
|
-
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d =
|
|
150
|
+
(i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = E(i)), J(i, i));
|
|
143
151
|
}
|
|
144
152
|
function Ce(e, t, n) {
|
|
145
153
|
var _, o;
|
|
@@ -150,7 +158,7 @@ function Ce(e, t, n) {
|
|
|
150
158
|
}
|
|
151
159
|
return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
|
|
152
160
|
}
|
|
153
|
-
function
|
|
161
|
+
function Ue(e, t, n, _) {
|
|
154
162
|
var o = e.key, i = e.type, c = n - 1, l = n + 1, u = t[n];
|
|
155
163
|
if (u === null || u && o == u.key && i === u.type)
|
|
156
164
|
return n;
|
|
@@ -170,9 +178,9 @@ function Fe(e, t, n, _) {
|
|
|
170
178
|
return -1;
|
|
171
179
|
}
|
|
172
180
|
function oe(e, t, n) {
|
|
173
|
-
t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" ||
|
|
181
|
+
t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ne.test(t) ? n : n + "px";
|
|
174
182
|
}
|
|
175
|
-
function
|
|
183
|
+
function j(e, t, n, _, o) {
|
|
176
184
|
var i;
|
|
177
185
|
e:
|
|
178
186
|
if (t === "style")
|
|
@@ -212,20 +220,20 @@ function re(e) {
|
|
|
212
220
|
function ie(e) {
|
|
213
221
|
return this.l[e.type + !0](f.event ? f.event(e) : e);
|
|
214
222
|
}
|
|
215
|
-
function
|
|
216
|
-
var p, r, d, a, v, k,
|
|
223
|
+
function q(e, t, n, _, o, i, c, l, u, s) {
|
|
224
|
+
var p, r, d, a, v, k, y, h, g, C, $, w, te, P, R, b = t.type;
|
|
217
225
|
if (t.constructor !== void 0)
|
|
218
226
|
return null;
|
|
219
227
|
128 & n.__u && (u = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
|
|
220
228
|
e:
|
|
221
229
|
if (typeof b == "function")
|
|
222
230
|
try {
|
|
223
|
-
if (h = t.props,
|
|
231
|
+
if (h = t.props, g = (p = b.contextType) && _[p.__c], C = p ? g ? g.props.value : p.__ : _, n.__c ? y = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new I(h, C), r.constructor = b, r.render = Me), g && g.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = x({}, r.__s)), x(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, v = r.state, r.__v = t, d)
|
|
224
232
|
b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
225
233
|
else {
|
|
226
234
|
if (b.getDerivedStateFromProps == null && h !== a && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, C), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, C) === !1 || t.__v === n.__v)) {
|
|
227
|
-
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(
|
|
228
|
-
|
|
235
|
+
for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(T) {
|
|
236
|
+
T && (T.__ = t);
|
|
229
237
|
}), $ = 0; $ < r._sb.length; $++)
|
|
230
238
|
r.__h.push(r._sb[$]);
|
|
231
239
|
r._sb = [], r.__h.length && c.push(r);
|
|
@@ -236,19 +244,19 @@ function X(e, t, n, _, o, i, c, l, u, s) {
|
|
|
236
244
|
});
|
|
237
245
|
}
|
|
238
246
|
if (r.context = C, r.props = h, r.__P = e, r.__e = !1, w = f.__r, te = 0, "prototype" in b && b.prototype.render) {
|
|
239
|
-
for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context),
|
|
240
|
-
r.__h.push(r._sb[
|
|
247
|
+
for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), P = 0; P < r._sb.length; P++)
|
|
248
|
+
r.__h.push(r._sb[P]);
|
|
241
249
|
r._sb = [];
|
|
242
250
|
} else
|
|
243
251
|
do
|
|
244
252
|
r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
245
253
|
while (r.__d && ++te < 25);
|
|
246
|
-
r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e,
|
|
247
|
-
} catch (
|
|
248
|
-
t.__v = null, u || i != null ? (t.__e = l, t.__u |= u ? 160 : 32, i[i.indexOf(l)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(
|
|
254
|
+
r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, X(R = p != null && p.type === W && p.key == null ? p.props.children : p) ? R : [R], t, n, _, o, i, c, l, u, s), r.base = t.__e, t.__u &= -161, r.__h.length && c.push(r), y && (r.__E = r.__ = null);
|
|
255
|
+
} catch (T) {
|
|
256
|
+
t.__v = null, u || i != null ? (t.__e = l, t.__u |= u ? 160 : 32, i[i.indexOf(l)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(T, t, n);
|
|
249
257
|
}
|
|
250
258
|
else
|
|
251
|
-
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e =
|
|
259
|
+
i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Oe(n.__e, t, n, _, o, i, c, u, s);
|
|
252
260
|
(p = f.diffed) && p(t);
|
|
253
261
|
}
|
|
254
262
|
function xe(e, t, n) {
|
|
@@ -265,36 +273,36 @@ function xe(e, t, n) {
|
|
|
265
273
|
}
|
|
266
274
|
});
|
|
267
275
|
}
|
|
268
|
-
function
|
|
269
|
-
var s, p, r, d, a, v, k,
|
|
270
|
-
if (
|
|
276
|
+
function Oe(e, t, n, _, o, i, c, l, u) {
|
|
277
|
+
var s, p, r, d, a, v, k, y = n.props, h = t.props, g = t.type;
|
|
278
|
+
if (g === "svg" && (o = !0), i != null) {
|
|
271
279
|
for (s = 0; s < i.length; s++)
|
|
272
|
-
if ((a = i[s]) && "setAttribute" in a == !!
|
|
280
|
+
if ((a = i[s]) && "setAttribute" in a == !!g && (g ? a.localName === g : a.nodeType === 3)) {
|
|
273
281
|
e = a, i[s] = null;
|
|
274
282
|
break;
|
|
275
283
|
}
|
|
276
284
|
}
|
|
277
285
|
if (e == null) {
|
|
278
|
-
if (
|
|
286
|
+
if (g === null)
|
|
279
287
|
return document.createTextNode(h);
|
|
280
|
-
e = o ? document.createElementNS("http://www.w3.org/2000/svg",
|
|
288
|
+
e = o ? document.createElementNS("http://www.w3.org/2000/svg", g) : document.createElement(g, h.is && h), i = null, l = !1;
|
|
281
289
|
}
|
|
282
|
-
if (
|
|
283
|
-
|
|
290
|
+
if (g === null)
|
|
291
|
+
y === h || l && e.data === h || (e.data = h);
|
|
284
292
|
else {
|
|
285
|
-
if (i = i &&
|
|
286
|
-
for (
|
|
287
|
-
|
|
288
|
-
for (s in
|
|
289
|
-
a =
|
|
293
|
+
if (i = i && A.call(e.childNodes), y = n.props || D, !l && i != null)
|
|
294
|
+
for (y = {}, s = 0; s < e.attributes.length; s++)
|
|
295
|
+
y[(a = e.attributes[s]).name] = a.value;
|
|
296
|
+
for (s in y)
|
|
297
|
+
a = y[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || j(e, s, null, a, o));
|
|
290
298
|
for (s in h)
|
|
291
|
-
a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" ||
|
|
299
|
+
a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" || y[s] === a || j(e, s, a, y[s], o);
|
|
292
300
|
if (p)
|
|
293
301
|
l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
|
|
294
|
-
else if (r && (e.innerHTML = ""), ke(e,
|
|
302
|
+
else if (r && (e.innerHTML = ""), ke(e, X(d) ? d : [d], t, n, _, o && g !== "foreignObject", i, c, i ? i[0] : n.__k && E(n, 0), l, u), i != null)
|
|
295
303
|
for (s = i.length; s--; )
|
|
296
|
-
i[s] != null &&
|
|
297
|
-
l || (s = "value", v !== void 0 && (v !== e[s] ||
|
|
304
|
+
i[s] != null && ge(i[s]);
|
|
305
|
+
l || (s = "value", v !== void 0 && (v !== e[s] || g === "progress" && !v || g === "option" && v !== y[s]) && j(e, s, v, y[s], !1), s = "checked", k !== void 0 && k !== e[s] && j(e, s, k, y[s], !1));
|
|
298
306
|
}
|
|
299
307
|
return e;
|
|
300
308
|
}
|
|
@@ -319,16 +327,16 @@ function J(e, t, n) {
|
|
|
319
327
|
if (_ = e.__k)
|
|
320
328
|
for (o = 0; o < _.length; o++)
|
|
321
329
|
_[o] && J(_[o], t, n || typeof e.type != "function");
|
|
322
|
-
n || e.__e == null ||
|
|
330
|
+
n || e.__e == null || ge(e.__e), e.__ = e.__e = e.__d = void 0;
|
|
323
331
|
}
|
|
324
332
|
function Me(e, t, n) {
|
|
325
333
|
return this.constructor(e, n);
|
|
326
334
|
}
|
|
327
|
-
function
|
|
335
|
+
function Ae(e, t, n) {
|
|
328
336
|
var _, o, i, c;
|
|
329
|
-
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [],
|
|
337
|
+
f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [], q(t, e = (!_ && n || t).__k = Le(W, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? A.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, c), xe(i, e, c);
|
|
330
338
|
}
|
|
331
|
-
|
|
339
|
+
A = ye.slice, f = { __e: function(e, t, n, _) {
|
|
332
340
|
for (var o, i, c; t = t.__; )
|
|
333
341
|
if ((o = t.__c) && !o.__)
|
|
334
342
|
try {
|
|
@@ -343,20 +351,20 @@ O = ge.slice, f = { __e: function(e, t, n, _) {
|
|
|
343
351
|
n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = x({}, this.state), typeof e == "function" && (e = e(x({}, n), this.props)), e && x(n, e), e != null && this.__v && (t && this._sb.push(t), _e(this));
|
|
344
352
|
}, I.prototype.forceUpdate = function(e) {
|
|
345
353
|
this.__v && (this.__e = !0, e && this.__h.push(e), _e(this));
|
|
346
|
-
}, I.prototype.render =
|
|
354
|
+
}, I.prototype.render = W, S = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
|
|
347
355
|
return e.__v.__b - t.__v.__b;
|
|
348
|
-
},
|
|
349
|
-
var
|
|
350
|
-
function
|
|
356
|
+
}, U.__r = 0;
|
|
357
|
+
var O, m, G, se, Y = 0, Se = [], N = [], le = f.__b, ce = f.__r, ue = f.diffed, ae = f.__c, fe = f.unmount;
|
|
358
|
+
function Ee(e, t) {
|
|
351
359
|
f.__h && f.__h(m, e, Y || t), Y = 0;
|
|
352
360
|
var n = m.__H || (m.__H = { __: [], __h: [] });
|
|
353
361
|
return e >= n.__.length && n.__.push({ __V: N }), n.__[e];
|
|
354
362
|
}
|
|
355
|
-
function
|
|
356
|
-
return Y = 1,
|
|
363
|
+
function We(e) {
|
|
364
|
+
return Y = 1, Re(we, e);
|
|
357
365
|
}
|
|
358
|
-
function
|
|
359
|
-
var _ =
|
|
366
|
+
function Re(e, t, n) {
|
|
367
|
+
var _ = Ee(O++, 2);
|
|
360
368
|
if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(l) {
|
|
361
369
|
var u = _.__N ? _.__N[0] : _.__[0], s = _.t(u, l);
|
|
362
370
|
u !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
|
|
@@ -391,15 +399,15 @@ function We(e, t, n) {
|
|
|
391
399
|
}
|
|
392
400
|
return _.__N || _.__;
|
|
393
401
|
}
|
|
394
|
-
function
|
|
395
|
-
var n =
|
|
396
|
-
!f.__s &&
|
|
402
|
+
function Be(e, t) {
|
|
403
|
+
var n = Ee(O++, 3);
|
|
404
|
+
!f.__s && Qe(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
|
|
397
405
|
}
|
|
398
|
-
function
|
|
399
|
-
for (var e; e =
|
|
406
|
+
function Ge() {
|
|
407
|
+
for (var e; e = Se.shift(); )
|
|
400
408
|
if (e.__P && e.__H)
|
|
401
409
|
try {
|
|
402
|
-
e.__H.__h.forEach(L), e.__H.__h.forEach(
|
|
410
|
+
e.__H.__h.forEach(L), e.__H.__h.forEach(K), e.__H.__h = [];
|
|
403
411
|
} catch (t) {
|
|
404
412
|
e.__H.__h = [], f.__e(t, e.__v);
|
|
405
413
|
}
|
|
@@ -407,22 +415,22 @@ function Be() {
|
|
|
407
415
|
f.__b = function(e) {
|
|
408
416
|
m = null, le && le(e);
|
|
409
417
|
}, f.__r = function(e) {
|
|
410
|
-
ce && ce(e),
|
|
418
|
+
ce && ce(e), O = 0;
|
|
411
419
|
var t = (m = e.__c).__H;
|
|
412
|
-
t && (
|
|
420
|
+
t && (G === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
|
|
413
421
|
n.__N && (n.__ = n.__N), n.__V = N, n.__N = n.i = void 0;
|
|
414
|
-
})) : (t.__h.forEach(L), t.__h.forEach(
|
|
422
|
+
})) : (t.__h.forEach(L), t.__h.forEach(K), t.__h = [], O = 0)), G = m;
|
|
415
423
|
}, f.diffed = function(e) {
|
|
416
424
|
ue && ue(e);
|
|
417
425
|
var t = e.__c;
|
|
418
|
-
t && t.__H && (t.__H.__h.length && (
|
|
426
|
+
t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && se === f.requestAnimationFrame || ((se = f.requestAnimationFrame) || Ze)(Ge)), t.__H.__.forEach(function(n) {
|
|
419
427
|
n.i && (n.__H = n.i), n.__V !== N && (n.__ = n.__V), n.i = void 0, n.__V = N;
|
|
420
|
-
})),
|
|
428
|
+
})), G = m = null;
|
|
421
429
|
}, f.__c = function(e, t) {
|
|
422
430
|
t.some(function(n) {
|
|
423
431
|
try {
|
|
424
432
|
n.__h.forEach(L), n.__h = n.__h.filter(function(_) {
|
|
425
|
-
return !_.__ ||
|
|
433
|
+
return !_.__ || K(_);
|
|
426
434
|
});
|
|
427
435
|
} catch (_) {
|
|
428
436
|
t.some(function(o) {
|
|
@@ -442,7 +450,7 @@ f.__b = function(e) {
|
|
|
442
450
|
}), n.__H = void 0, t && f.__e(t, n.__v));
|
|
443
451
|
};
|
|
444
452
|
var pe = typeof requestAnimationFrame == "function";
|
|
445
|
-
function
|
|
453
|
+
function Ze(e) {
|
|
446
454
|
var t, n = function() {
|
|
447
455
|
clearTimeout(_), pe && cancelAnimationFrame(t), setTimeout(e);
|
|
448
456
|
}, _ = setTimeout(n, 100);
|
|
@@ -452,11 +460,11 @@ function L(e) {
|
|
|
452
460
|
var t = m, n = e.__c;
|
|
453
461
|
typeof n == "function" && (e.__c = void 0, n()), m = t;
|
|
454
462
|
}
|
|
455
|
-
function
|
|
463
|
+
function K(e) {
|
|
456
464
|
var t = m;
|
|
457
465
|
e.__c = e.__(), m = t;
|
|
458
466
|
}
|
|
459
|
-
function
|
|
467
|
+
function Qe(e, t) {
|
|
460
468
|
return !e || e.length !== t.length || t.some(function(n, _) {
|
|
461
469
|
return n !== e[_];
|
|
462
470
|
});
|
|
@@ -464,21 +472,21 @@ function Ze(e, t) {
|
|
|
464
472
|
function we(e, t) {
|
|
465
473
|
return typeof t == "function" ? t(e) : t;
|
|
466
474
|
}
|
|
467
|
-
var
|
|
475
|
+
var ze = 0;
|
|
468
476
|
function De(e, t, n, _, o, i) {
|
|
469
477
|
var c, l, u = {};
|
|
470
478
|
for (l in t)
|
|
471
479
|
l == "ref" ? c = t[l] : u[l] = t[l];
|
|
472
|
-
var s = { type: e, props: u, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --
|
|
480
|
+
var s = { type: e, props: u, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --ze, __i: -1, __u: 0, __source: o, __self: i };
|
|
473
481
|
if (typeof e == "function" && (c = e.defaultProps))
|
|
474
482
|
for (l in c)
|
|
475
483
|
u[l] === void 0 && (u[l] = c[l]);
|
|
476
484
|
return f.vnode && f.vnode(s), s;
|
|
477
485
|
}
|
|
478
|
-
class
|
|
486
|
+
class Je {
|
|
479
487
|
constructor() {
|
|
480
|
-
|
|
481
|
-
|
|
488
|
+
B(this, "_context");
|
|
489
|
+
B(this, "_getContextCallbacks", []);
|
|
482
490
|
}
|
|
483
491
|
async getContext() {
|
|
484
492
|
return this._context ? this._context : new Promise((t) => {
|
|
@@ -505,11 +513,11 @@ class ze {
|
|
|
505
513
|
}
|
|
506
514
|
}
|
|
507
515
|
let M;
|
|
508
|
-
const
|
|
516
|
+
const Ye = ({
|
|
509
517
|
context: e
|
|
510
518
|
}) => {
|
|
511
|
-
const [t, n] =
|
|
512
|
-
return
|
|
519
|
+
const [t, n] = We(null);
|
|
520
|
+
return Be(() => {
|
|
513
521
|
if (t) {
|
|
514
522
|
if (M === void 0)
|
|
515
523
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
@@ -523,10 +531,10 @@ const Je = ({
|
|
|
523
531
|
id: "spiffThemeWrapper"
|
|
524
532
|
});
|
|
525
533
|
};
|
|
526
|
-
function
|
|
527
|
-
M = new
|
|
534
|
+
function yt(e, t) {
|
|
535
|
+
M = new Je(), window.SpiffThemeLoader = M;
|
|
528
536
|
let n;
|
|
529
|
-
typeof e == "string" ? n = document.getElementById(e) : n = e,
|
|
537
|
+
typeof e == "string" ? n = document.getElementById(e) : n = e, Ae(De(Ye, {
|
|
530
538
|
context: t
|
|
531
539
|
}), n);
|
|
532
540
|
}
|
|
@@ -559,30 +567,30 @@ function gt(e) {
|
|
|
559
567
|
...e
|
|
560
568
|
};
|
|
561
569
|
}
|
|
562
|
-
const
|
|
570
|
+
const Ke = (e) => {
|
|
563
571
|
if (Object.keys(e).includes("defaultValue"))
|
|
564
572
|
return e.defaultValue;
|
|
565
573
|
};
|
|
566
|
-
function
|
|
574
|
+
function bt(e, ...t) {
|
|
567
575
|
return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
|
|
568
576
|
key: n.key,
|
|
569
577
|
fallbackToDefaultConfiguration: !1,
|
|
570
|
-
value:
|
|
578
|
+
value: Ke(n),
|
|
571
579
|
type: n.type,
|
|
572
580
|
asset: void 0
|
|
573
581
|
}));
|
|
574
582
|
}
|
|
575
|
-
const
|
|
583
|
+
const Xe = "@spiffcommerce/theme-bridge", qe = "1.16.0", et = "module", tt = {
|
|
576
584
|
build: "tsc && vite build",
|
|
577
585
|
preview: "vite preview",
|
|
578
586
|
dev: "ladle serve",
|
|
579
587
|
schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
|
|
580
|
-
},
|
|
588
|
+
}, nt = "./dist/index.umd.cjs", _t = "./dist/index.js", ot = "./dist/index.d.ts", rt = [
|
|
581
589
|
"./dist"
|
|
582
|
-
],
|
|
590
|
+
], it = {
|
|
583
591
|
import: "./dist/index.js",
|
|
584
592
|
require: "./dist/index.umd.cjs"
|
|
585
|
-
},
|
|
593
|
+
}, st = {}, lt = {
|
|
586
594
|
"@ladle/react": "^4.0.2",
|
|
587
595
|
"@preact/preset-vite": "^2.7.0",
|
|
588
596
|
"@spiffcommerce/core": "^21.0.1",
|
|
@@ -602,42 +610,42 @@ const qe = "@spiffcommerce/theme-bridge", Ke = "1.15.1", Xe = "module", et = {
|
|
|
602
610
|
vite: "^5.0.8",
|
|
603
611
|
"vite-plugin-css-injected-by-js": "^3.4.0",
|
|
604
612
|
"vite-plugin-externalize-deps": "^0.8.0"
|
|
605
|
-
}, lt = {
|
|
606
|
-
"@spiffcommerce/core": "^21.0.1"
|
|
607
613
|
}, ct = {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
614
|
+
"@spiffcommerce/core": "^21.0.1"
|
|
615
|
+
}, ut = {
|
|
616
|
+
name: Xe,
|
|
617
|
+
version: qe,
|
|
618
|
+
type: et,
|
|
619
|
+
scripts: tt,
|
|
620
|
+
main: nt,
|
|
621
|
+
module: _t,
|
|
622
|
+
types: ot,
|
|
623
|
+
files: rt,
|
|
624
|
+
exports: it,
|
|
625
|
+
dependencies: st,
|
|
626
|
+
devDependencies: lt,
|
|
627
|
+
peerDependencies: ct
|
|
620
628
|
};
|
|
621
|
-
function
|
|
629
|
+
function at(e, t, n) {
|
|
622
630
|
if (t.type === "chunk") {
|
|
623
631
|
if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !n)
|
|
624
632
|
return null;
|
|
625
633
|
if (!t.isDynamicEntry)
|
|
626
634
|
return {
|
|
627
|
-
type:
|
|
635
|
+
type: Z.Javascript,
|
|
628
636
|
mimeType: "text/javascript",
|
|
629
637
|
preload: !t.isEntry,
|
|
630
638
|
filename: e
|
|
631
639
|
};
|
|
632
640
|
} else if (e.endsWith(".css"))
|
|
633
641
|
return {
|
|
634
|
-
type:
|
|
642
|
+
type: Z.CSS,
|
|
635
643
|
mimeType: "text/css",
|
|
636
644
|
filename: e
|
|
637
645
|
};
|
|
638
646
|
return null;
|
|
639
647
|
}
|
|
640
|
-
function
|
|
648
|
+
function kt(e) {
|
|
641
649
|
const {
|
|
642
650
|
autoGenerateTargetFiles: t = !0,
|
|
643
651
|
configurationSchema: n,
|
|
@@ -646,12 +654,12 @@ function bt(e) {
|
|
|
646
654
|
} = e ?? {};
|
|
647
655
|
return {
|
|
648
656
|
name: "spiff-theme-plugin",
|
|
649
|
-
version:
|
|
657
|
+
version: ut.version,
|
|
650
658
|
config(i, c) {
|
|
651
659
|
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 = "";
|
|
652
660
|
},
|
|
653
661
|
writeBundle(i, c) {
|
|
654
|
-
const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null :
|
|
662
|
+
const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null : at(s, c[s], _)).filter((s) => s !== null) : [];
|
|
655
663
|
o && l.push(...o);
|
|
656
664
|
const u = {
|
|
657
665
|
launchData: {
|
|
@@ -659,20 +667,21 @@ function bt(e) {
|
|
|
659
667
|
},
|
|
660
668
|
configurationSchema: n
|
|
661
669
|
};
|
|
662
|
-
|
|
670
|
+
Te.writeFileSync(je.join(i.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
|
|
663
671
|
}
|
|
664
672
|
};
|
|
665
673
|
}
|
|
666
674
|
export {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
675
|
+
He as AssetType,
|
|
676
|
+
Ve as CustomSchemaType,
|
|
677
|
+
H as FieldType,
|
|
678
|
+
Z as ThemeFileType,
|
|
670
679
|
gt as exampleThemeInstallConfig,
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
680
|
+
bt as getDefaultsForSchema,
|
|
681
|
+
yt as setSpiffDevOptions,
|
|
682
|
+
kt as spiffThemePlugin,
|
|
683
|
+
ht as themeInstallConfigurationFieldsToRecordObject,
|
|
684
|
+
vt as themeInstallConfigurationGraphQlToResource,
|
|
685
|
+
Ie as themeVersionConfigurationGraphQlToResource,
|
|
686
|
+
mt as themeVersionGraphQlToResource
|
|
678
687
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.theme={},h.fs,h.path))})(this,function(h,k,T){"use strict";var rt=Object.defineProperty;var it=(h,k,T)=>k in h?rt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var _e=(h,k,T)=>(it(h,typeof k!="symbol"?k+"":k,T),T);var j=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(j||{}),$=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))($||{}),oe=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(oe||{});function re(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:ie(t)}}))}function ie(e){if(e.type===$.Asset)return e.asset;if(e.type!==$.List&&e.type!==$.Object)return e.value;if(e.listValues)return e.listValues.map(ie);if(e.objectValues)return re(e.objectValues)}function He(e){return re(e.fields)}function Q(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=Q(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>Q(t[_],t))),n}function se(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Q(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Ie(e){return{...e,configurationSchema:se(e.configurationSchema)}}function Z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Z(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Z(t[_],t))),n}function Ne(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Z(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,le,w,ue,ce,z,P={},ae=[],Fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function fe(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,n){var _,o,i,u={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return I(e,u,_,o,null)}function I(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++le,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function N(e){return e.children}function F(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?D(e):null}function pe(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return pe(e)}}function de(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!L.__r++||ue!==f.debounceRendering)&&((ue=f.debounceRendering)||ce)(L)}function L(){var e,t,n,_,o,i,u,l,c;for(w.sort(z);e=w.shift();)e.__d&&(t=w.length,_=void 0,i=(o=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),q(u,_,o,n.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),c),_.__.__k[_.__i]=_,be(l,_,c),_.__e!=i&&pe(_)),w.length>t&&w.sort(z));L.__r=0}function he(e,t,n,_,o,i,u,l,c,s,p){var r,d,a,y,S,g=_&&_.__k||ae,m=t.length;for(n.__d=c,Oe(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?P:g[a.__i]||P,a.__i=r,q(e,a,d,o,i,u,l,c,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&Y(d.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||d.__k===a.__k?c=me(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Oe(e,t,n){var _,o,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<c;_++)(o=e.__k[_]=(o=t[_])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):J(o)?I(N,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Re(o,n,u=_+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),K(i,i,!1),n[_]=null,p--);if(p)for(_=0;_<s;_++)(i=n[_])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),K(i,i))}function me(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=me(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Re(e,t,n,_){var o=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&o==c.key&&i===c.type)return n;if(_>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&o==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&o==c.key&&i===c.type)return l;l++}}return-1}function ve(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Fe.test(t)?n:n+"px"}function O(e,t,n,_,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof _=="string"&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||ve(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||ve(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?ge:ye,i)):e.removeEventListener(t,i?ge:ye,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ye(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function ge(e){return this.l[e.type+!0](f.event?f.event(e):e)}function q(e,t,n,_,o,i,u,l,c,s){var p,r,d,a,y,S,g,m,b,E,W,V,je,G,ne,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&_[p.__c],E=p?b?b.props.value:p.__:_,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new F(m,E),r.constructor=C,r.render=Ue),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=_,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=x({},r.__s)),x(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,d)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(B){B&&(B.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,V=f.__r,je=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,V&&V(t),p=r.render(r.props,r.state,r.context),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[]}else do r.__d=!1,V&&V(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++je<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),he(e,J(ne=p!=null&&p.type===N&&p.key==null?p.props.children:p)?ne:[ne],t,n,_,o,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(B){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Me(n.__e,t,n,_,o,i,u,c,s);(p=f.diffed)&&p(t)}function be(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)Y(n[_],n[++_],n[++_]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Me(e,t,n,_,o,i,u,l,c){var s,p,r,d,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),g=n.props||P,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||O(e,s,null,a,o));for(s in m)a=m[s],s=="children"?d=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||O(e,s,a,g[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),he(e,J(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,u,i?i[0]:n.__k&&D(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&fe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&O(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&O(e,s,S,g[s],!1))}return e}function Y(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function K(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||Y(_,null,t)),(_=e.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(i){f.__e(i,t)}_.base=_.__P=null,e.__c=void 0}if(_=e.__k)for(o=0;o<_.length;o++)_[o]&&K(_[o],t,n||typeof e.type!="function");n||e.__e==null||fe(e.__e),e.__=e.__e=e.__d=void 0}function Ue(e,t,n){return this.constructor(e,n)}function Ae(e,t,n){var _,o,i,u;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],q(t,e=(!_&&n||t).__k=Le(N,null,[e]),o||P,P,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?H.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,u),be(i,e,u)}H=ae.slice,f={__e:function(e,t,n,_){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),u=o.__d),u)return o.__E=o}catch(l){e=l}throw e}},le=0,F.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=x({},this.state),typeof e=="function"&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),de(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),de(this))},F.prototype.render=N,w=[],ce=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var R,v,X,ke,ee=0,Ce=[],M=[],Se=f.__b,xe=f.__r,Ee=f.diffed,Te=f.__c,we=f.unmount;function De(e,t){f.__h&&f.__h(v,e,ee||t),ee=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function We(e){return ee=1,Ge(Pe,e)}function Ge(e,t,n){var _=De(R++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):Pe(void 0,t),function(l){var c=_.__N?_.__N[0]:_.__[0],s=_.t(c,l);c!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,c,s){if(!_.__c.__H)return!0;var p=_.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&_.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,o(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function Be(e,t){var n=De(R++,3);!f.__s&&ze(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Qe(){for(var e;e=Ce.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(te),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Se&&Se(e)},f.__r=function(e){xe&&xe(e),R=0;var t=(v=e.__c).__H;t&&(X===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(U),t.__h.forEach(te),t.__h=[],R=0)),X=v},f.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ce.push(t)!==1&&ke===f.requestAnimationFrame||((ke=f.requestAnimationFrame)||Ze)(Qe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),X=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(_){return!_.__||te(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),Te&&Te(e,t)},f.unmount=function(e){we&&we(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{U(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Ze(e){var t,n=function(){clearTimeout(_),$e&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function U(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function te(e){var t=v;e.__c=e.__(),v=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Je=0;function Ve(e,t,n,_,o,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Je,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class qe{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let A;const Ye=({context:e})=>{const[t,n]=We(null);return Be(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function Ke(e,t){A=new qe,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ae(Ve(Ye,{context:t}),n)}function Xe(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const et=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function tt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:et(n),type:n.type,asset:void 0}))}const nt={name:"@spiffcommerce/theme-bridge",version:"1.15.1",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function _t(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:j.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:j.CSS,mimeType:"text/css",filename:e};return null}function ot(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:nt.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>o!=null&&o.some(p=>p.filename===s)?null:_t(s,u[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(T.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}h.AssetType=oe,h.FieldType=$,h.ThemeFileType=j,h.exampleThemeInstallConfig=Xe,h.getDefaultsForSchema=tt,h.setSpiffDevOptions=Ke,h.spiffThemePlugin=ot,h.themeInstallConfigurationFieldsToRecordObject=He,h.themeInstallConfigurationGraphQlToResource=Ne,h.themeVersionConfigurationGraphQlToResource=se,h.themeVersionGraphQlToResource=Ie,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.theme={},h.fs,h.path))})(this,function(h,k,T){"use strict";var it=Object.defineProperty;var st=(h,k,T)=>k in h?it(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var _e=(h,k,T)=>(st(h,typeof k!="symbol"?k+"":k,T),T);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),$=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))($||{}),oe=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(oe||{}),re=(e=>(e.Object="Object",e.Union="Union",e))(re||{});function ie(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t)}}))}function se(e){if(e.type===$.Asset)return e.asset;if(e.type!==$.List&&e.type!==$.Object)return e.value;if(e.listValues)return e.listValues.map(se);if(e.objectValues)return ie(e.objectValues)}function Ie(e){return ie(e.fields)}function H(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=H(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>H(t[_],t))),n}function le(e){var _;const t={...e,fields:[],customSchemas:(_=e.customSchemas)==null?void 0:_.map(o=>{var i;return{...o,fields:(i=o.fields)==null?void 0:i.map(u=>H(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(o=>{o.root&&n.push(H(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Ne(e){return{...e,configurationSchema:le(e.configurationSchema)}}function Z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Z(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Z(t[_],t))),n}function Fe(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Z(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var I,f,ue,w,ce,ae,z,j={},fe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Oe(e,t,n){var _,o,i,u={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,_,o,null)}function N(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ue,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function L(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?D(e):null}function de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!O.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(O)}function O(){var e,t,n,_,o,i,u,l,c;for(w.sort(z);e=w.shift();)e.__d&&(t=w.length,_=void 0,i=(o=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),Y(u,_,o,n.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),c),_.__.__k[_.__i]=_,ke(l,_,c),_.__e!=i&&de(_)),w.length>t&&w.sort(z));O.__r=0}function me(e,t,n,_,o,i,u,l,c,s,p){var r,d,a,y,S,g=_&&_.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?j:g[a.__i]||j,a.__i=r,Y(e,a,d,o,i,u,l,c,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&K(d.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||d.__k===a.__k?c=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var _,o,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<c;_++)(o=e.__k[_]=(o=t[_])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?N(null,o,null,null,o):J(o)?N(F,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?N(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Re(o,n,u=_+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),X(i,i,!1),n[_]=null,p--);if(p)for(_=0;_<s;_++)(i=n[_])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),X(i,i))}function ve(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=ve(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Re(e,t,n,_){var o=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&o==c.key&&i===c.type)return n;if(_>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&o==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&o==c.key&&i===c.type)return l;l++}}return-1}function ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function U(e,t,n,_,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof _=="string"&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||ye(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function Y(e,t,n,_,o,i,u,l,c,s){var p,r,d,a,y,S,g,m,b,E,G,P,He,B,ne,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&_[p.__c],E=p?b?b.props.value:p.__:_,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new L(m,E),r.constructor=C,r.render=Ae),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=_,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=x({},r.__s)),x(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,d)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,He=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++He<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,J(ne=p!=null&&p.type===F&&p.key==null?p.props.children:p)?ne:[ne],t,n,_,o,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Me(n.__e,t,n,_,o,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)K(n[_],n[++_],n[++_]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Me(e,t,n,_,o,i,u,l,c){var s,p,r,d,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&I.call(e.childNodes),g=n.props||j,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||U(e,s,null,a,o));for(s in m)a=m[s],s=="children"?d=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||U(e,s,a,g[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),me(e,J(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,u,i?i[0]:n.__k&&D(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&U(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&U(e,s,S,g[s],!1))}return e}function K(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function X(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||K(_,null,t)),(_=e.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(i){f.__e(i,t)}_.base=_.__P=null,e.__c=void 0}if(_=e.__k)for(o=0;o<_.length;o++)_[o]&&X(_[o],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function Ae(e,t,n){return this.constructor(e,n)}function We(e,t,n){var _,o,i,u;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],Y(t,e=(!_&&n||t).__k=Oe(F,null,[e]),o||j,j,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?I.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,u),ke(i,e,u)}I=fe.slice,f={__e:function(e,t,n,_){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),u=o.__d),u)return o.__E=o}catch(l){e=l}throw e}},ue=0,L.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=x({},this.state),typeof e=="function"&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),he(this))},L.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},L.prototype.render=F,w=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0;var R,v,q,Ce,ee=0,Se=[],M=[],xe=f.__b,Ee=f.__r,Te=f.diffed,we=f.__c,De=f.unmount;function $e(e,t){f.__h&&f.__h(v,e,ee||t),ee=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function Ge(e){return ee=1,Be(Pe,e)}function Be(e,t,n){var _=$e(R++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):Pe(void 0,t),function(l){var c=_.__N?_.__N[0]:_.__[0],s=_.t(c,l);c!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,c,s){if(!_.__c.__H)return!0;var p=_.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&_.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,o(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function Qe(e,t){var n=$e(R++,3);!f.__s&&Je(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(te),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,xe&&xe(e)},f.__r=function(e){Ee&&Ee(e),R=0;var t=(v=e.__c).__H;t&&(q===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(te),t.__h=[],R=0)),q=v},f.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||ze)(Ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),q=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(_){return!_.__||te(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{A(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var je=typeof requestAnimationFrame=="function";function ze(e){var t,n=function(){clearTimeout(_),je&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);je&&(t=requestAnimationFrame(n))}function A(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function te(e){var t=v;e.__c=e.__(),v=t}function Je(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Ye=0;function Ve(e,t,n,_,o,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ye,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class Ke{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const Xe=({context:e})=>{const[t,n]=Ge(null);return Qe(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function qe(e,t){W=new Ke,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,We(Ve(Xe,{context:t}),n)}function et(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const tt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function nt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:tt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.16.0",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function ot(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function rt(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>o!=null&&o.some(p=>p.filename===s)?null:ot(s,u[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(T.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}h.AssetType=oe,h.CustomSchemaType=re,h.FieldType=$,h.ThemeFileType=V,h.exampleThemeInstallConfig=et,h.getDefaultsForSchema=nt,h.setSpiffDevOptions=qe,h.spiffThemePlugin=rt,h.themeInstallConfigurationFieldsToRecordObject=Ie,h.themeInstallConfigurationGraphQlToResource=Fe,h.themeVersionConfigurationGraphQlToResource=le,h.themeVersionGraphQlToResource=Ne,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|