@cimplify/sdk 0.53.0 → 0.55.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/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-EJUKGJTZ.js → chunk-6W3AH4QW.js} +2 -2
- package/dist/{chunk-NEK7CVE2.mjs → chunk-F4WS3OIF.mjs} +1 -1
- package/dist/{chunk-B3Y4C4A7.mjs → chunk-I4IXPQIX.mjs} +7 -4
- package/dist/{chunk-YJLOOC3L.js → chunk-JGBDWEPJ.js} +7 -4
- package/dist/chunk-JYPLT56O.js +272 -0
- package/dist/{chunk-IJ32BXKZ.js → chunk-MW7ICTVK.js} +35 -35
- package/dist/{chunk-6QZQQRBB.mjs → chunk-SQ7U3BWY.mjs} +1 -1
- package/dist/chunk-XYI4NXWG.mjs +259 -0
- package/dist/{client-D1Gknspz.d.mts → client-Bhvlelij.d.mts} +1 -1
- package/dist/{client-Bj2apl_y.d.mts → client-DKg-5OWu.d.mts} +16 -1
- package/dist/{client-306peWZ0.d.ts → client-Dfg_hmkP.d.ts} +16 -1
- package/dist/{client-C2bKMy5g.d.ts → client-DlGJqSDd.d.ts} +1 -1
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +160 -72
- package/dist/index.mjs +91 -3
- package/dist/react.d.mts +52 -5
- package/dist/react.d.ts +52 -5
- package/dist/react.js +592 -512
- package/dist/react.mjs +136 -58
- package/dist/server.d.mts +59 -35
- package/dist/server.d.ts +59 -35
- package/dist/server.js +160 -79
- package/dist/server.mjs +153 -78
- package/dist/{ads-C2c2Aald.d.mts → sign-in-TL01-awQ.d.mts} +17 -1
- package/dist/{ads-C2c2Aald.d.ts → sign-in-TL01-awQ.d.ts} +17 -1
- package/dist/styles.css +1 -1
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +22 -22
- package/dist/testing/suite.mjs +3 -3
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +78 -78
- package/dist/testing.mjs +4 -4
- package/package.json +2 -1
- package/registry/account.json +1 -1
- package/dist/chunk-MN4PNKJA.js +0 -129
- package/dist/chunk-NRDRVZ62.mjs +0 -119
package/dist/testing.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6W3AH4QW_js = require('./chunk-6W3AH4QW.js');
|
|
4
4
|
require('./chunk-HCZTBWU4.js');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-MW7ICTVK.js');
|
|
6
|
+
require('./chunk-JGBDWEPJ.js');
|
|
7
7
|
require('./chunk-7Y2O3E4D.js');
|
|
8
8
|
require('./chunk-XA3ZNR75.js');
|
|
9
9
|
require('./chunk-OWW5GUSB.js');
|
|
10
10
|
var zod = require('zod');
|
|
11
11
|
|
|
12
12
|
var PUBLIC_SCHEMAS = {
|
|
13
|
-
Brand:
|
|
14
|
-
AddItemPayload:
|
|
15
|
-
Cart:
|
|
16
|
-
CartItem:
|
|
17
|
-
CartPricing:
|
|
18
|
-
CheckoutBody:
|
|
19
|
-
CheckoutResponse:
|
|
20
|
-
VariantInfo:
|
|
13
|
+
Brand: chunk6W3AH4QW_js.BrandSchema,
|
|
14
|
+
AddItemPayload: chunk6W3AH4QW_js.AddItemPayloadSchema,
|
|
15
|
+
Cart: chunk6W3AH4QW_js.CartSchema,
|
|
16
|
+
CartItem: chunk6W3AH4QW_js.CartItemSchema,
|
|
17
|
+
CartPricing: chunk6W3AH4QW_js.CartPricingSchema,
|
|
18
|
+
CheckoutBody: chunk6W3AH4QW_js.CheckoutBodySchema,
|
|
19
|
+
CheckoutResponse: chunk6W3AH4QW_js.CheckoutResponseSchema,
|
|
20
|
+
VariantInfo: chunk6W3AH4QW_js.VariantInfoSchema
|
|
21
21
|
};
|
|
22
22
|
function exportJsonSchemas() {
|
|
23
23
|
const out = {};
|
|
24
24
|
for (const [name, schema] of Object.entries(PUBLIC_SCHEMAS)) {
|
|
25
|
-
const meta =
|
|
26
|
-
const json = zod.z.toJSONSchema(schema, { metadata:
|
|
25
|
+
const meta = chunk6W3AH4QW_js.cimplifyRegistry.get(schema);
|
|
26
|
+
const json = zod.z.toJSONSchema(schema, { metadata: chunk6W3AH4QW_js.cimplifyRegistry });
|
|
27
27
|
if (meta) {
|
|
28
28
|
json.$id = meta.id;
|
|
29
29
|
json["x-cimplify-version"] = meta.version;
|
|
@@ -35,16 +35,16 @@ function exportJsonSchemas() {
|
|
|
35
35
|
function listRegisteredSchemas() {
|
|
36
36
|
const entries = [];
|
|
37
37
|
for (const schema of [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
chunk6W3AH4QW_js.BrandSchema,
|
|
39
|
+
chunk6W3AH4QW_js.AddItemPayloadSchema,
|
|
40
|
+
chunk6W3AH4QW_js.CartSchema,
|
|
41
|
+
chunk6W3AH4QW_js.CartItemSchema,
|
|
42
|
+
chunk6W3AH4QW_js.CartPricingSchema,
|
|
43
|
+
chunk6W3AH4QW_js.CheckoutBodySchema,
|
|
44
|
+
chunk6W3AH4QW_js.CheckoutResponseSchema,
|
|
45
|
+
chunk6W3AH4QW_js.VariantInfoSchema
|
|
46
46
|
]) {
|
|
47
|
-
const meta =
|
|
47
|
+
const meta = chunk6W3AH4QW_js.cimplifyRegistry.get(schema);
|
|
48
48
|
if (meta) entries.push({ schema, meta });
|
|
49
49
|
}
|
|
50
50
|
return entries;
|
|
@@ -52,227 +52,227 @@ function listRegisteredSchemas() {
|
|
|
52
52
|
|
|
53
53
|
Object.defineProperty(exports, "AddItemPayloadSchema", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunk6W3AH4QW_js.AddItemPayloadSchema; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "AddOnDetailsSchema", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunk6W3AH4QW_js.AddOnDetailsSchema; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "AddOnGroupDetailsSchema", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunk6W3AH4QW_js.AddOnGroupDetailsSchema; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "AddOnInDetailsSchema", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunk6W3AH4QW_js.AddOnInDetailsSchema; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "AddOnOptionDetailsSchema", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunk6W3AH4QW_js.AddOnOptionDetailsSchema; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "AuthorizationTypeSchema", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk6W3AH4QW_js.AuthorizationTypeSchema; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "BrandContactSchema", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunk6W3AH4QW_js.BrandContactSchema; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "BrandFaqSchema", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunk6W3AH4QW_js.BrandFaqSchema; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "BrandHeroSchema", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunk6W3AH4QW_js.BrandHeroSchema; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "BrandNavLinkSchema", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunk6W3AH4QW_js.BrandNavLinkSchema; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "BrandPolicyPageSchema", {
|
|
94
94
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunk6W3AH4QW_js.BrandPolicyPageSchema; }
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "BrandPolicySectionSchema", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunk6W3AH4QW_js.BrandPolicySectionSchema; }
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "BrandSchema", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunk6W3AH4QW_js.BrandSchema; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "BrandSocialSchema", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunk6W3AH4QW_js.BrandSocialSchema; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "BundleResolvedSchema", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunk6W3AH4QW_js.BundleResolvedSchema; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "BundleSelectionInputSchema", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunk6W3AH4QW_js.BundleSelectionInputSchema; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "CartItemSchema", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunk6W3AH4QW_js.CartItemSchema; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "CartPricingSchema", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunk6W3AH4QW_js.CartPricingSchema; }
|
|
124
124
|
});
|
|
125
125
|
Object.defineProperty(exports, "CartSchema", {
|
|
126
126
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunk6W3AH4QW_js.CartSchema; }
|
|
128
128
|
});
|
|
129
129
|
Object.defineProperty(exports, "CheckoutBodySchema", {
|
|
130
130
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunk6W3AH4QW_js.CheckoutBodySchema; }
|
|
132
132
|
});
|
|
133
133
|
Object.defineProperty(exports, "CheckoutCustomerSchema", {
|
|
134
134
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunk6W3AH4QW_js.CheckoutCustomerSchema; }
|
|
136
136
|
});
|
|
137
137
|
Object.defineProperty(exports, "CheckoutResponseSchema", {
|
|
138
138
|
enumerable: true,
|
|
139
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunk6W3AH4QW_js.CheckoutResponseSchema; }
|
|
140
140
|
});
|
|
141
141
|
Object.defineProperty(exports, "ChosenPriceSchema", {
|
|
142
142
|
enumerable: true,
|
|
143
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunk6W3AH4QW_js.ChosenPriceSchema; }
|
|
144
144
|
});
|
|
145
145
|
Object.defineProperty(exports, "CompositeResolvedSchema", {
|
|
146
146
|
enumerable: true,
|
|
147
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunk6W3AH4QW_js.CompositeResolvedSchema; }
|
|
148
148
|
});
|
|
149
149
|
Object.defineProperty(exports, "CompositeSelectionInputSchema", {
|
|
150
150
|
enumerable: true,
|
|
151
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunk6W3AH4QW_js.CompositeSelectionInputSchema; }
|
|
152
152
|
});
|
|
153
153
|
Object.defineProperty(exports, "CountryCodeSchema", {
|
|
154
154
|
enumerable: true,
|
|
155
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunk6W3AH4QW_js.CountryCodeSchema; }
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(exports, "CurrencyCodeSchema", {
|
|
158
158
|
enumerable: true,
|
|
159
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunk6W3AH4QW_js.CurrencyCodeSchema; }
|
|
160
160
|
});
|
|
161
161
|
Object.defineProperty(exports, "CustomerInputValueSchema", {
|
|
162
162
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunk6W3AH4QW_js.CustomerInputValueSchema; }
|
|
164
164
|
});
|
|
165
165
|
Object.defineProperty(exports, "DiscountDetailsSchema", {
|
|
166
166
|
enumerable: true,
|
|
167
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunk6W3AH4QW_js.DiscountDetailsSchema; }
|
|
168
168
|
});
|
|
169
169
|
Object.defineProperty(exports, "IsoDateTimeSchema", {
|
|
170
170
|
enumerable: true,
|
|
171
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunk6W3AH4QW_js.IsoDateTimeSchema; }
|
|
172
172
|
});
|
|
173
173
|
Object.defineProperty(exports, "LineTypeSchema", {
|
|
174
174
|
enumerable: true,
|
|
175
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunk6W3AH4QW_js.LineTypeSchema; }
|
|
176
176
|
});
|
|
177
177
|
Object.defineProperty(exports, "LocaleSchema", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunk6W3AH4QW_js.LocaleSchema; }
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "MoneyLooseSchema", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunk6W3AH4QW_js.MoneyLooseSchema; }
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(exports, "MoneySchema", {
|
|
186
186
|
enumerable: true,
|
|
187
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunk6W3AH4QW_js.MoneySchema; }
|
|
188
188
|
});
|
|
189
189
|
Object.defineProperty(exports, "NextActionSchema", {
|
|
190
190
|
enumerable: true,
|
|
191
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunk6W3AH4QW_js.NextActionSchema; }
|
|
192
192
|
});
|
|
193
193
|
Object.defineProperty(exports, "PhoneE164Schema", {
|
|
194
194
|
enumerable: true,
|
|
195
|
-
get: function () { return
|
|
195
|
+
get: function () { return chunk6W3AH4QW_js.PhoneE164Schema; }
|
|
196
196
|
});
|
|
197
197
|
Object.defineProperty(exports, "ProductTypeSchema", {
|
|
198
198
|
enumerable: true,
|
|
199
|
-
get: function () { return
|
|
199
|
+
get: function () { return chunk6W3AH4QW_js.ProductTypeSchema; }
|
|
200
200
|
});
|
|
201
201
|
Object.defineProperty(exports, "SchemaViolationError", {
|
|
202
202
|
enumerable: true,
|
|
203
|
-
get: function () { return
|
|
203
|
+
get: function () { return chunk6W3AH4QW_js.SchemaViolationError; }
|
|
204
204
|
});
|
|
205
205
|
Object.defineProperty(exports, "SeedNameSchema", {
|
|
206
206
|
enumerable: true,
|
|
207
|
-
get: function () { return
|
|
207
|
+
get: function () { return chunk6W3AH4QW_js.SeedNameSchema; }
|
|
208
208
|
});
|
|
209
209
|
Object.defineProperty(exports, "SelectedAddOnOptionSchema", {
|
|
210
210
|
enumerable: true,
|
|
211
|
-
get: function () { return
|
|
211
|
+
get: function () { return chunk6W3AH4QW_js.SelectedAddOnOptionSchema; }
|
|
212
212
|
});
|
|
213
213
|
Object.defineProperty(exports, "ServiceStatusSchema", {
|
|
214
214
|
enumerable: true,
|
|
215
|
-
get: function () { return
|
|
215
|
+
get: function () { return chunk6W3AH4QW_js.ServiceStatusSchema; }
|
|
216
216
|
});
|
|
217
217
|
Object.defineProperty(exports, "TimestampSchema", {
|
|
218
218
|
enumerable: true,
|
|
219
|
-
get: function () { return
|
|
219
|
+
get: function () { return chunk6W3AH4QW_js.TimestampSchema; }
|
|
220
220
|
});
|
|
221
221
|
Object.defineProperty(exports, "VariantDetailsSchema", {
|
|
222
222
|
enumerable: true,
|
|
223
|
-
get: function () { return
|
|
223
|
+
get: function () { return chunk6W3AH4QW_js.VariantDetailsSchema; }
|
|
224
224
|
});
|
|
225
225
|
Object.defineProperty(exports, "VariantDisplayAttributeSchema", {
|
|
226
226
|
enumerable: true,
|
|
227
|
-
get: function () { return
|
|
227
|
+
get: function () { return chunk6W3AH4QW_js.VariantDisplayAttributeSchema; }
|
|
228
228
|
});
|
|
229
229
|
Object.defineProperty(exports, "VariantInfoSchema", {
|
|
230
230
|
enumerable: true,
|
|
231
|
-
get: function () { return
|
|
231
|
+
get: function () { return chunk6W3AH4QW_js.VariantInfoSchema; }
|
|
232
232
|
});
|
|
233
233
|
Object.defineProperty(exports, "assertAddItemPayload", {
|
|
234
234
|
enumerable: true,
|
|
235
|
-
get: function () { return
|
|
235
|
+
get: function () { return chunk6W3AH4QW_js.assertAddItemPayload; }
|
|
236
236
|
});
|
|
237
237
|
Object.defineProperty(exports, "assertBrand", {
|
|
238
238
|
enumerable: true,
|
|
239
|
-
get: function () { return
|
|
239
|
+
get: function () { return chunk6W3AH4QW_js.assertBrand; }
|
|
240
240
|
});
|
|
241
241
|
Object.defineProperty(exports, "assertCart", {
|
|
242
242
|
enumerable: true,
|
|
243
|
-
get: function () { return
|
|
243
|
+
get: function () { return chunk6W3AH4QW_js.assertCart; }
|
|
244
244
|
});
|
|
245
245
|
Object.defineProperty(exports, "assertCartItem", {
|
|
246
246
|
enumerable: true,
|
|
247
|
-
get: function () { return
|
|
247
|
+
get: function () { return chunk6W3AH4QW_js.assertCartItem; }
|
|
248
248
|
});
|
|
249
249
|
Object.defineProperty(exports, "assertCheckoutBody", {
|
|
250
250
|
enumerable: true,
|
|
251
|
-
get: function () { return
|
|
251
|
+
get: function () { return chunk6W3AH4QW_js.assertCheckoutBody; }
|
|
252
252
|
});
|
|
253
253
|
Object.defineProperty(exports, "assertCheckoutResponse", {
|
|
254
254
|
enumerable: true,
|
|
255
|
-
get: function () { return
|
|
255
|
+
get: function () { return chunk6W3AH4QW_js.assertCheckoutResponse; }
|
|
256
256
|
});
|
|
257
257
|
Object.defineProperty(exports, "cimplifyRegistry", {
|
|
258
258
|
enumerable: true,
|
|
259
|
-
get: function () { return
|
|
259
|
+
get: function () { return chunk6W3AH4QW_js.cimplifyRegistry; }
|
|
260
260
|
});
|
|
261
261
|
Object.defineProperty(exports, "createTestClient", {
|
|
262
262
|
enumerable: true,
|
|
263
|
-
get: function () { return
|
|
263
|
+
get: function () { return chunk6W3AH4QW_js.createTestClient; }
|
|
264
264
|
});
|
|
265
265
|
Object.defineProperty(exports, "fixtures", {
|
|
266
266
|
enumerable: true,
|
|
267
|
-
get: function () { return
|
|
267
|
+
get: function () { return chunk6W3AH4QW_js.fixtures; }
|
|
268
268
|
});
|
|
269
269
|
Object.defineProperty(exports, "makeAssertion", {
|
|
270
270
|
enumerable: true,
|
|
271
|
-
get: function () { return
|
|
271
|
+
get: function () { return chunk6W3AH4QW_js.makeAssertion; }
|
|
272
272
|
});
|
|
273
273
|
Object.defineProperty(exports, "registerSchema", {
|
|
274
274
|
enumerable: true,
|
|
275
|
-
get: function () { return
|
|
275
|
+
get: function () { return chunk6W3AH4QW_js.registerSchema; }
|
|
276
276
|
});
|
|
277
277
|
exports.exportJsonSchemas = exportJsonSchemas;
|
|
278
278
|
exports.listRegisteredSchemas = listRegisteredSchemas;
|
package/dist/testing.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-
|
|
2
|
-
export { AddItemPayloadSchema, AddOnDetailsSchema, AddOnGroupDetailsSchema, AddOnInDetailsSchema, AddOnOptionDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, SelectedAddOnOptionSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema } from './chunk-
|
|
1
|
+
import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-F4WS3OIF.mjs';
|
|
2
|
+
export { AddItemPayloadSchema, AddOnDetailsSchema, AddOnGroupDetailsSchema, AddOnInDetailsSchema, AddOnOptionDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, SelectedAddOnOptionSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema } from './chunk-F4WS3OIF.mjs';
|
|
3
3
|
import './chunk-3G4QCENX.mjs';
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
4
|
+
import './chunk-SQ7U3BWY.mjs';
|
|
5
|
+
import './chunk-I4IXPQIX.mjs';
|
|
6
6
|
import './chunk-TD3AY34U.mjs';
|
|
7
7
|
import './chunk-AMZXALF6.mjs';
|
|
8
8
|
import './chunk-3G6RQLXK.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cimplify/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "Cimplify Commerce SDK for storefronts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cimplify",
|
|
@@ -148,6 +148,7 @@
|
|
|
148
148
|
"@base-ui/react": "^1.4.1",
|
|
149
149
|
"clsx": "^2.1.1",
|
|
150
150
|
"date-fns": "^4.1.0",
|
|
151
|
+
"jose": "^6.2.3",
|
|
151
152
|
"libphonenumber-js": "1.12.41",
|
|
152
153
|
"react-day-picker": "^9.14.0",
|
|
153
154
|
"tailwind-merge": "^3.5.0",
|
package/registry/account.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
{
|
|
11
11
|
"path": "account.tsx",
|
|
12
|
-
"content": "\"use client\";\n\nimport React, { useEffect, useRef, useState, useMemo } from \"react\";\nimport type { CimplifyClient } from \"../client\";\nimport { useOptionalCimplify } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface CimplifyAccountProps {\n /** CimplifyClient instance. Falls back to provider context. */\n client?: CimplifyClient;\n /** Override the Link base URL. */\n linkUrl?: string;\n /** Initial section to show: \"dashboard\" | \"orders\" | \"addresses\" | \"payment-methods\" | \"sessions\" | \"settings\". */\n section?: string;\n /** Appearance variables — passed to Link for theming. */\n appearance?: {\n theme?: \"light\" | \"dark\";\n variables?: {\n primaryColor?: string;\n fontFamily?: string;\n borderRadius?: string;\n };\n };\n /** Called when the user logs out from the account portal. */\n onLogout?: () => void;\n /** Additional CSS class for the container. */\n className?: string;\n}\n\nconst DEFAULT_LINK_URL = \"https://link.cimplify.io\";\n\nexport function CimplifyAccount({\n client: clientProp,\n linkUrl,\n section,\n appearance,\n onLogout,\n className,\n}: CimplifyAccountProps): React.ReactElement {\n const context = useOptionalCimplify();\n const client = clientProp ?? context?.client;\n const resolvedLinkUrl = linkUrl || DEFAULT_LINK_URL;\n\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const [height, setHeight] = useState(400);\n const [isReady, setIsReady] = useState(false);\n\n const iframeSrc = useMemo(() => {\n const path = section ? `/elements/account/${section}` : \"/elements/account\";\n const url = new URL(path, resolvedLinkUrl);\n if (
|
|
12
|
+
"content": "\"use client\";\n\nimport React, { useEffect, useRef, useState, useMemo } from \"react\";\nimport type { CimplifyClient } from \"../client\";\nimport { useOptionalCimplify } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface CimplifyAccountProps {\n /** CimplifyClient instance. Falls back to provider context. */\n client?: CimplifyClient;\n /** Override the Link base URL. */\n linkUrl?: string;\n /** Initial section to show: \"dashboard\" | \"orders\" | \"addresses\" | \"payment-methods\" | \"sessions\" | \"settings\". */\n section?: string;\n /**\n * Per-merchant scope for the embedded account widget. When set, the\n * widget filters orders/subs/sessions to this business and hides\n * cross-merchant surfaces. Defaults to the client's configured\n * business ID so storefronts get scoping for free.\n */\n businessId?: string;\n /**\n * Display name of the embedding merchant — shown in the widget's\n * scoping footer (\"Showing your account with Acme Threads only.\").\n * Optional but recommended for trust signal.\n */\n merchantName?: string;\n /** Appearance variables — passed to Link for theming. */\n appearance?: {\n theme?: \"light\" | \"dark\";\n variables?: {\n primaryColor?: string;\n fontFamily?: string;\n borderRadius?: string;\n };\n };\n /** Called when the user logs out from the account portal. */\n onLogout?: () => void;\n /** Additional CSS class for the container. */\n className?: string;\n}\n\nconst DEFAULT_LINK_URL = \"https://link.cimplify.io\";\n\nexport function CimplifyAccount({\n client: clientProp,\n linkUrl,\n section,\n businessId: businessIdProp,\n merchantName,\n appearance,\n onLogout,\n className,\n}: CimplifyAccountProps): React.ReactElement {\n const context = useOptionalCimplify();\n const client = clientProp ?? context?.client;\n const resolvedLinkUrl = linkUrl || DEFAULT_LINK_URL;\n const resolvedBusinessId = businessIdProp || client?.getBusinessId?.() || \"\";\n\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const [height, setHeight] = useState(400);\n const [isReady, setIsReady] = useState(false);\n\n const iframeSrc = useMemo(() => {\n const path = section ? `/elements/account/${section}` : \"/elements/account\";\n const url = new URL(path, resolvedLinkUrl);\n if (resolvedBusinessId) url.searchParams.set(\"businessId\", resolvedBusinessId);\n return url.toString();\n }, [resolvedLinkUrl, section, resolvedBusinessId]);\n\n // Listen for messages from the iframe\n useEffect(() => {\n function handleMessage(event: MessageEvent) {\n if (!event.data || typeof event.data !== \"object\") return;\n\n // Only accept messages from our iframe\n if (iframeRef.current?.contentWindow && event.source !== iframeRef.current.contentWindow) {\n return;\n }\n\n switch (event.data.type) {\n case \"ready\":\n setIsReady(true);\n if (typeof event.data.height === \"number\") {\n setHeight(event.data.height);\n }\n // Send init with token + appearance\n sendInit();\n break;\n\n case \"height_change\":\n if (typeof event.data.height === \"number\") {\n setHeight(event.data.height);\n }\n break;\n\n case \"logout_complete\":\n onLogout?.();\n break;\n }\n }\n\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [appearance, client, onLogout]);\n\n function sendInit() {\n const contentWindow = iframeRef.current?.contentWindow;\n if (!contentWindow) return;\n\n const token = client?.getAccessToken?.();\n contentWindow.postMessage(\n {\n type: \"init\",\n token: token ?? undefined,\n appearance: appearance ?? undefined,\n businessId: resolvedBusinessId || undefined,\n merchantName: merchantName ?? undefined,\n },\n resolvedLinkUrl,\n );\n }\n\n return (\n <div\n data-cimplify-account\n className={cn(\"relative overflow-hidden\", className)}\n >\n {!isReady && (\n <div className=\"flex items-center justify-center py-16\">\n <div className=\"w-6 h-6 border-2 border-border border-t-foreground rounded-full animate-spin\" />\n </div>\n )}\n <iframe\n ref={iframeRef}\n src={iframeSrc}\n style={{\n border: \"none\",\n width: \"100%\",\n height: `${height}px`,\n display: isReady ? \"block\" : \"none\",\n overflow: \"hidden\",\n background: \"transparent\",\n }}\n allow=\"geolocation\"\n sandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox\"\n />\n </div>\n );\n}\n"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
}
|
package/dist/chunk-MN4PNKJA.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/utils/variant.ts
|
|
4
|
-
function stripProductPrefix(variantName, productName) {
|
|
5
|
-
if (!variantName || !productName) return variantName || productName;
|
|
6
|
-
const lower = variantName.toLowerCase().trim();
|
|
7
|
-
if (lower === "default" || lower === "standard") return productName;
|
|
8
|
-
if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
|
|
9
|
-
if (variantName.startsWith(productName)) {
|
|
10
|
-
const rest = variantName.slice(productName.length);
|
|
11
|
-
const match = rest.match(/^\s*[-–—]\s*(.*)/);
|
|
12
|
-
if (match && match[1].length > 0) return match[1];
|
|
13
|
-
}
|
|
14
|
-
const lowerProduct = productName.toLowerCase().trim();
|
|
15
|
-
if (lower.startsWith(lowerProduct)) {
|
|
16
|
-
const rest = variantName.slice(productName.length);
|
|
17
|
-
const match = rest.match(/^\s*[-–—]\s*(.*)/);
|
|
18
|
-
if (match && match[1].length > 0) return match[1];
|
|
19
|
-
}
|
|
20
|
-
const lastDash = variantName.lastIndexOf("-");
|
|
21
|
-
if (lastDash > 0 && lastDash < variantName.length - 1) {
|
|
22
|
-
const prefix = variantName.slice(0, lastDash).trim();
|
|
23
|
-
const suffix = variantName.slice(lastDash + 1).trim();
|
|
24
|
-
if (suffix.length > 0 && prefix.length > suffix.length * 2) {
|
|
25
|
-
return suffix;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return variantName;
|
|
29
|
-
}
|
|
30
|
-
function getVariantDisplayName(variant, productName) {
|
|
31
|
-
if (variant.display_attributes?.length) {
|
|
32
|
-
return variant.display_attributes.map((a) => a.value_name).join(" / ");
|
|
33
|
-
}
|
|
34
|
-
if (variant.name) {
|
|
35
|
-
return productName ? stripProductPrefix(variant.name, productName) : variant.name;
|
|
36
|
-
}
|
|
37
|
-
return productName || (variant.is_default ? "Default" : "Option");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// src/types/product.ts
|
|
41
|
-
var PRODUCT_TYPE = {
|
|
42
|
-
Product: "product",
|
|
43
|
-
Service: "service",
|
|
44
|
-
Digital: "digital",
|
|
45
|
-
Bundle: "bundle",
|
|
46
|
-
Composite: "composite"
|
|
47
|
-
};
|
|
48
|
-
var RENDER_HINT = {
|
|
49
|
-
Food: "food",
|
|
50
|
-
Physical: "physical",
|
|
51
|
-
General: "general"
|
|
52
|
-
};
|
|
53
|
-
var DURATION_UNIT = {
|
|
54
|
-
Minutes: "minutes",
|
|
55
|
-
Hours: "hours",
|
|
56
|
-
Days: "days",
|
|
57
|
-
Nights: "nights",
|
|
58
|
-
Weeks: "weeks",
|
|
59
|
-
Months: "months",
|
|
60
|
-
Years: "years"
|
|
61
|
-
};
|
|
62
|
-
var INPUT_FIELD_TYPE = {
|
|
63
|
-
Text: "text",
|
|
64
|
-
Textarea: "textarea",
|
|
65
|
-
Number: "number",
|
|
66
|
-
Select: "select",
|
|
67
|
-
Radio: "radio",
|
|
68
|
-
Checkbox: "checkbox",
|
|
69
|
-
Color: "color",
|
|
70
|
-
Date: "date",
|
|
71
|
-
File: "file",
|
|
72
|
-
Image: "image",
|
|
73
|
-
Url: "url",
|
|
74
|
-
Address: "address",
|
|
75
|
-
Phone: "phone",
|
|
76
|
-
Email: "email",
|
|
77
|
-
DateTime: "date_time",
|
|
78
|
-
Time: "time",
|
|
79
|
-
Signature: "signature",
|
|
80
|
-
MultiSelect: "multi_select",
|
|
81
|
-
DateRange: "date_range",
|
|
82
|
-
Location: "location"
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// src/assets/url.ts
|
|
86
|
-
var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
|
|
87
|
-
var CIMPLIFY_CDN_HOSTS = [
|
|
88
|
-
"storefrontassetscdn.cimplify.io",
|
|
89
|
-
"cdn.cimplify.io",
|
|
90
|
-
"static-tmp.cimplify.io"
|
|
91
|
-
];
|
|
92
|
-
var ABSOLUTE_URL_RE = /^https?:\/\//i;
|
|
93
|
-
var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
|
|
94
|
-
function assetUrl(path, opts = {}) {
|
|
95
|
-
if (!path) return path;
|
|
96
|
-
if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
|
|
97
|
-
if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
|
|
98
|
-
const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
99
|
-
const normalized = path.replace(/^\/+/, "");
|
|
100
|
-
return appendTransform(`${base}/${normalized}`, opts);
|
|
101
|
-
}
|
|
102
|
-
function isCimplifyAsset(src, base) {
|
|
103
|
-
if (!src) return false;
|
|
104
|
-
if (!ABSOLUTE_URL_RE.test(src)) return true;
|
|
105
|
-
if (MOCK_PASSTHROUGH_RE.test(src)) return true;
|
|
106
|
-
const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
107
|
-
if (resolvedBase && src.startsWith(resolvedBase)) return true;
|
|
108
|
-
return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
|
|
109
|
-
}
|
|
110
|
-
function appendTransform(url, t) {
|
|
111
|
-
const params = new URLSearchParams();
|
|
112
|
-
if (t.w != null) params.set("w", String(t.w));
|
|
113
|
-
if (t.h != null) params.set("h", String(t.h));
|
|
114
|
-
if (t.quality != null) params.set("quality", String(t.quality));
|
|
115
|
-
if (t.format != null) params.set("format", t.format);
|
|
116
|
-
const query = params.toString();
|
|
117
|
-
if (!query) return url;
|
|
118
|
-
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
exports.CIMPLIFY_CDN_HOSTS = CIMPLIFY_CDN_HOSTS;
|
|
122
|
-
exports.DEFAULT_CDN_BASE_URL = DEFAULT_CDN_BASE_URL;
|
|
123
|
-
exports.DURATION_UNIT = DURATION_UNIT;
|
|
124
|
-
exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
|
|
125
|
-
exports.PRODUCT_TYPE = PRODUCT_TYPE;
|
|
126
|
-
exports.RENDER_HINT = RENDER_HINT;
|
|
127
|
-
exports.assetUrl = assetUrl;
|
|
128
|
-
exports.getVariantDisplayName = getVariantDisplayName;
|
|
129
|
-
exports.isCimplifyAsset = isCimplifyAsset;
|
package/dist/chunk-NRDRVZ62.mjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// src/utils/variant.ts
|
|
2
|
-
function stripProductPrefix(variantName, productName) {
|
|
3
|
-
if (!variantName || !productName) return variantName || productName;
|
|
4
|
-
const lower = variantName.toLowerCase().trim();
|
|
5
|
-
if (lower === "default" || lower === "standard") return productName;
|
|
6
|
-
if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
|
|
7
|
-
if (variantName.startsWith(productName)) {
|
|
8
|
-
const rest = variantName.slice(productName.length);
|
|
9
|
-
const match = rest.match(/^\s*[-–—]\s*(.*)/);
|
|
10
|
-
if (match && match[1].length > 0) return match[1];
|
|
11
|
-
}
|
|
12
|
-
const lowerProduct = productName.toLowerCase().trim();
|
|
13
|
-
if (lower.startsWith(lowerProduct)) {
|
|
14
|
-
const rest = variantName.slice(productName.length);
|
|
15
|
-
const match = rest.match(/^\s*[-–—]\s*(.*)/);
|
|
16
|
-
if (match && match[1].length > 0) return match[1];
|
|
17
|
-
}
|
|
18
|
-
const lastDash = variantName.lastIndexOf("-");
|
|
19
|
-
if (lastDash > 0 && lastDash < variantName.length - 1) {
|
|
20
|
-
const prefix = variantName.slice(0, lastDash).trim();
|
|
21
|
-
const suffix = variantName.slice(lastDash + 1).trim();
|
|
22
|
-
if (suffix.length > 0 && prefix.length > suffix.length * 2) {
|
|
23
|
-
return suffix;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return variantName;
|
|
27
|
-
}
|
|
28
|
-
function getVariantDisplayName(variant, productName) {
|
|
29
|
-
if (variant.display_attributes?.length) {
|
|
30
|
-
return variant.display_attributes.map((a) => a.value_name).join(" / ");
|
|
31
|
-
}
|
|
32
|
-
if (variant.name) {
|
|
33
|
-
return productName ? stripProductPrefix(variant.name, productName) : variant.name;
|
|
34
|
-
}
|
|
35
|
-
return productName || (variant.is_default ? "Default" : "Option");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/types/product.ts
|
|
39
|
-
var PRODUCT_TYPE = {
|
|
40
|
-
Product: "product",
|
|
41
|
-
Service: "service",
|
|
42
|
-
Digital: "digital",
|
|
43
|
-
Bundle: "bundle",
|
|
44
|
-
Composite: "composite"
|
|
45
|
-
};
|
|
46
|
-
var RENDER_HINT = {
|
|
47
|
-
Food: "food",
|
|
48
|
-
Physical: "physical",
|
|
49
|
-
General: "general"
|
|
50
|
-
};
|
|
51
|
-
var DURATION_UNIT = {
|
|
52
|
-
Minutes: "minutes",
|
|
53
|
-
Hours: "hours",
|
|
54
|
-
Days: "days",
|
|
55
|
-
Nights: "nights",
|
|
56
|
-
Weeks: "weeks",
|
|
57
|
-
Months: "months",
|
|
58
|
-
Years: "years"
|
|
59
|
-
};
|
|
60
|
-
var INPUT_FIELD_TYPE = {
|
|
61
|
-
Text: "text",
|
|
62
|
-
Textarea: "textarea",
|
|
63
|
-
Number: "number",
|
|
64
|
-
Select: "select",
|
|
65
|
-
Radio: "radio",
|
|
66
|
-
Checkbox: "checkbox",
|
|
67
|
-
Color: "color",
|
|
68
|
-
Date: "date",
|
|
69
|
-
File: "file",
|
|
70
|
-
Image: "image",
|
|
71
|
-
Url: "url",
|
|
72
|
-
Address: "address",
|
|
73
|
-
Phone: "phone",
|
|
74
|
-
Email: "email",
|
|
75
|
-
DateTime: "date_time",
|
|
76
|
-
Time: "time",
|
|
77
|
-
Signature: "signature",
|
|
78
|
-
MultiSelect: "multi_select",
|
|
79
|
-
DateRange: "date_range",
|
|
80
|
-
Location: "location"
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/assets/url.ts
|
|
84
|
-
var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
|
|
85
|
-
var CIMPLIFY_CDN_HOSTS = [
|
|
86
|
-
"storefrontassetscdn.cimplify.io",
|
|
87
|
-
"cdn.cimplify.io",
|
|
88
|
-
"static-tmp.cimplify.io"
|
|
89
|
-
];
|
|
90
|
-
var ABSOLUTE_URL_RE = /^https?:\/\//i;
|
|
91
|
-
var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
|
|
92
|
-
function assetUrl(path, opts = {}) {
|
|
93
|
-
if (!path) return path;
|
|
94
|
-
if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
|
|
95
|
-
if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
|
|
96
|
-
const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
97
|
-
const normalized = path.replace(/^\/+/, "");
|
|
98
|
-
return appendTransform(`${base}/${normalized}`, opts);
|
|
99
|
-
}
|
|
100
|
-
function isCimplifyAsset(src, base) {
|
|
101
|
-
if (!src) return false;
|
|
102
|
-
if (!ABSOLUTE_URL_RE.test(src)) return true;
|
|
103
|
-
if (MOCK_PASSTHROUGH_RE.test(src)) return true;
|
|
104
|
-
const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
105
|
-
if (resolvedBase && src.startsWith(resolvedBase)) return true;
|
|
106
|
-
return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
|
|
107
|
-
}
|
|
108
|
-
function appendTransform(url, t) {
|
|
109
|
-
const params = new URLSearchParams();
|
|
110
|
-
if (t.w != null) params.set("w", String(t.w));
|
|
111
|
-
if (t.h != null) params.set("h", String(t.h));
|
|
112
|
-
if (t.quality != null) params.set("quality", String(t.quality));
|
|
113
|
-
if (t.format != null) params.set("format", t.format);
|
|
114
|
-
const query = params.toString();
|
|
115
|
-
if (!query) return url;
|
|
116
|
-
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, assetUrl, getVariantDisplayName, isCimplifyAsset };
|