@sixtyninecommerce/client 0.13.0 → 0.15.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/admin/forms.d.ts +4 -0
- package/dist/admin/forms.d.ts.map +1 -0
- package/dist/admin/forms.js +102 -0
- package/dist/admin/forms.js.map +1 -0
- package/dist/admin/http.d.ts +12 -0
- package/dist/admin/http.d.ts.map +1 -0
- package/dist/admin/http.js +79 -0
- package/dist/admin/http.js.map +1 -0
- package/dist/admin/index.d.ts +4 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +21 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/types.d.ts +117 -0
- package/dist/admin/types.d.ts.map +1 -0
- package/dist/admin/types.js +2 -0
- package/dist/admin/types.js.map +1 -0
- package/dist/commerce/checkout.d.ts +4 -2
- package/dist/commerce/checkout.d.ts.map +1 -1
- package/dist/commerce/checkout.js +10 -2
- package/dist/commerce/checkout.js.map +1 -1
- package/dist/commerce/customer.d.ts +2 -2
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +9 -2
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/index.js +1 -1
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/products.d.ts.map +1 -1
- package/dist/commerce/products.js +33 -20
- package/dist/commerce/products.js.map +1 -1
- package/dist/commerce/queries.d.ts +28 -26
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +66 -33
- package/dist/commerce/queries.js.map +1 -1
- package/dist/content/form-field-types.d.ts +3 -0
- package/dist/content/form-field-types.d.ts.map +1 -0
- package/dist/content/form-field-types.js +101 -0
- package/dist/content/form-field-types.js.map +1 -0
- package/dist/content/forms.d.ts +3 -1
- package/dist/content/forms.d.ts.map +1 -1
- package/dist/content/forms.js +18 -0
- package/dist/content/forms.js.map +1 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +1 -0
- package/dist/core/context.js.map +1 -1
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +52 -13
- package/dist/core/http.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/media/urls.d.ts.map +1 -1
- package/dist/media/urls.js +6 -4
- package/dist/media/urls.js.map +1 -1
- package/dist/pricing/format.d.ts.map +1 -1
- package/dist/pricing/format.js +4 -2
- package/dist/pricing/format.js.map +1 -1
- package/dist/types.d.ts +156 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -1
package/dist/commerce/queries.js
CHANGED
|
@@ -30,7 +30,7 @@ export const GET_PRODUCT = `
|
|
|
30
30
|
product(slug: $slug) {
|
|
31
31
|
id name slug description
|
|
32
32
|
featuredAsset {
|
|
33
|
-
source name
|
|
33
|
+
source name width height
|
|
34
34
|
customFields { altText }
|
|
35
35
|
presets {
|
|
36
36
|
xxs { url webpUrl } xs { url webpUrl }
|
|
@@ -39,7 +39,7 @@ export const GET_PRODUCT = `
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
assets {
|
|
42
|
-
source name
|
|
42
|
+
source name width height
|
|
43
43
|
customFields { altText }
|
|
44
44
|
presets {
|
|
45
45
|
xs { url webpUrl } m { url webpUrl }
|
|
@@ -56,12 +56,12 @@ export const GET_PRODUCT = `
|
|
|
56
56
|
options { id code name group { id name code } }
|
|
57
57
|
customFields { minOrderQuantity salesUnit position }
|
|
58
58
|
featuredAsset {
|
|
59
|
-
source name
|
|
59
|
+
source name width height
|
|
60
60
|
customFields { altText }
|
|
61
61
|
presets { xs { url webpUrl } m { url webpUrl } }
|
|
62
62
|
}
|
|
63
63
|
assets {
|
|
64
|
-
source name
|
|
64
|
+
source name width height
|
|
65
65
|
customFields { altText }
|
|
66
66
|
presets { m { url webpUrl } l { url webpUrl } }
|
|
67
67
|
}
|
|
@@ -87,7 +87,7 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
87
87
|
product(id: $id) {
|
|
88
88
|
id name slug description
|
|
89
89
|
featuredAsset {
|
|
90
|
-
source name
|
|
90
|
+
source name width height
|
|
91
91
|
customFields { altText }
|
|
92
92
|
presets {
|
|
93
93
|
xxs { url webpUrl } xs { url webpUrl }
|
|
@@ -96,7 +96,7 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
assets {
|
|
99
|
-
source name
|
|
99
|
+
source name width height
|
|
100
100
|
customFields { altText }
|
|
101
101
|
presets {
|
|
102
102
|
xs { url webpUrl } m { url webpUrl }
|
|
@@ -113,12 +113,12 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
113
113
|
options { id code name group { id name code } }
|
|
114
114
|
customFields { minOrderQuantity salesUnit position }
|
|
115
115
|
featuredAsset {
|
|
116
|
-
source name
|
|
116
|
+
source name width height
|
|
117
117
|
customFields { altText }
|
|
118
118
|
presets { xs { url webpUrl } m { url webpUrl } }
|
|
119
119
|
}
|
|
120
120
|
assets {
|
|
121
|
-
source name
|
|
121
|
+
source name width height
|
|
122
122
|
customFields { altText }
|
|
123
123
|
presets { m { url webpUrl } l { url webpUrl } }
|
|
124
124
|
}
|
|
@@ -143,9 +143,9 @@ export const LIST_PRODUCTS = `
|
|
|
143
143
|
query ListProducts($options: ProductListOptions) {
|
|
144
144
|
products(options: $options) {
|
|
145
145
|
items {
|
|
146
|
-
id name slug description
|
|
146
|
+
id name slug description enabled
|
|
147
147
|
featuredAsset {
|
|
148
|
-
source name
|
|
148
|
+
source name width height
|
|
149
149
|
customFields { altText }
|
|
150
150
|
presets { xs { url webpUrl } m { url webpUrl } l { url webpUrl } }
|
|
151
151
|
}
|
|
@@ -189,7 +189,7 @@ export const LIST_COLLECTIONS = `
|
|
|
189
189
|
id name slug description
|
|
190
190
|
breadcrumbs { id name slug }
|
|
191
191
|
featuredAsset {
|
|
192
|
-
source
|
|
192
|
+
source width height
|
|
193
193
|
presets { xs { url webpUrl } m { url webpUrl } }
|
|
194
194
|
}
|
|
195
195
|
parent { id name slug }
|
|
@@ -204,7 +204,7 @@ export const GET_COLLECTION = `
|
|
|
204
204
|
collection(slug: $slug) {
|
|
205
205
|
id name slug description position
|
|
206
206
|
featuredAsset {
|
|
207
|
-
source
|
|
207
|
+
source width height
|
|
208
208
|
presets { l { url webpUrl } xl { url webpUrl } }
|
|
209
209
|
}
|
|
210
210
|
breadcrumbs { id name slug }
|
|
@@ -238,7 +238,7 @@ export const GET_COLLECTION = `
|
|
|
238
238
|
id
|
|
239
239
|
product {
|
|
240
240
|
id name slug
|
|
241
|
-
featuredAsset { source presets { m { url webpUrl } } }
|
|
241
|
+
featuredAsset { source width height presets { m { url webpUrl } } }
|
|
242
242
|
}
|
|
243
243
|
price priceWithTax currencyCode stockLevel
|
|
244
244
|
stockOnHand stockAllocated saleable
|
|
@@ -271,6 +271,7 @@ export const SEARCH_PRODUCTS = `
|
|
|
271
271
|
`;
|
|
272
272
|
const ORDER_FIELDS = `
|
|
273
273
|
id code state active
|
|
274
|
+
createdAt orderPlacedAt
|
|
274
275
|
totalQuantity
|
|
275
276
|
subTotal subTotalWithTax
|
|
276
277
|
shipping shippingWithTax
|
|
@@ -294,7 +295,8 @@ const ORDER_FIELDS = `
|
|
|
294
295
|
promotions { id name couponCode description }
|
|
295
296
|
shippingLines { shippingMethod { id name code } priceWithTax }
|
|
296
297
|
payments { id method amount state transactionId }
|
|
297
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
298
|
+
shippingAddress { fullName company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }
|
|
299
|
+
billingAddress { fullName company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }
|
|
298
300
|
customer { id firstName lastName emailAddress }
|
|
299
301
|
couponCodes
|
|
300
302
|
`;
|
|
@@ -314,8 +316,22 @@ const ORDER_PAYMENT_TERMS_FRAGMENT = `
|
|
|
314
316
|
resolvedAt remoteConditionCode remoteConfirmedAt remoteMismatch
|
|
315
317
|
}
|
|
316
318
|
`;
|
|
319
|
+
const ORDER_DELIVERY_TERMS_FRAGMENT = `
|
|
320
|
+
deliveryTerms {
|
|
321
|
+
source managedExternally status shippingMethodStatus policyStatus summary selectionSource
|
|
322
|
+
selectedShippingMethodId selectedShippingMethodCode selectedShippingMethodName
|
|
323
|
+
platformShippingMethodCode platformShippingMethodName platformShippingMethodDescription
|
|
324
|
+
platformShippingPrice platformShippingPriceWithTax
|
|
325
|
+
preferredShippingMethodId
|
|
326
|
+
incotermStatus incotermCode incotermVersion incotermAddress incotermDescription
|
|
327
|
+
shippingLeadDays deliveryAdvice stale syncedAt warning resolvedAt
|
|
328
|
+
remoteShippingMethodCode remoteShippingMethodName
|
|
329
|
+
remoteIncotermCode remoteIncotermVersion remoteIncotermAddress remoteDeliveryDate
|
|
330
|
+
remoteConfirmedAt remoteMismatch
|
|
331
|
+
}
|
|
332
|
+
`;
|
|
317
333
|
const ORDER_SUMMARY_FIELDS = `
|
|
318
|
-
id code state total totalWithTax createdAt
|
|
334
|
+
id code state total totalWithTax currencyCode createdAt
|
|
319
335
|
lines {
|
|
320
336
|
id quantity linePriceWithTax
|
|
321
337
|
productVariant {
|
|
@@ -325,6 +341,7 @@ const ORDER_SUMMARY_FIELDS = `
|
|
|
325
341
|
}
|
|
326
342
|
${ORDER_FULFILLMENTS_FRAGMENT}
|
|
327
343
|
${ORDER_PAYMENT_TERMS_FRAGMENT}
|
|
344
|
+
${ORDER_DELIVERY_TERMS_FRAGMENT}
|
|
328
345
|
`;
|
|
329
346
|
export const ACTIVE_ORDER = `
|
|
330
347
|
query ActiveOrder {
|
|
@@ -401,9 +418,7 @@ export const ADD_ITEMS_TO_CART = `
|
|
|
401
418
|
export const SET_CUSTOMER = `
|
|
402
419
|
mutation SetCustomer($input: CreateCustomerInput!) {
|
|
403
420
|
setCustomerForOrder(input: $input) {
|
|
404
|
-
... on Order {
|
|
405
|
-
id customer { id firstName lastName emailAddress }
|
|
406
|
-
}
|
|
421
|
+
... on Order { ${ORDER_FIELDS} }
|
|
407
422
|
... on AlreadyLoggedInError { errorCode message }
|
|
408
423
|
... on EmailAddressConflictError { errorCode message }
|
|
409
424
|
... on GuestCheckoutError { errorCode message }
|
|
@@ -414,9 +429,7 @@ export const SET_CUSTOMER = `
|
|
|
414
429
|
export const SET_SHIPPING_ADDRESS = `
|
|
415
430
|
mutation SetShippingAddress($input: CreateAddressInput!) {
|
|
416
431
|
setOrderShippingAddress(input: $input) {
|
|
417
|
-
... on Order {
|
|
418
|
-
id shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
419
|
-
}
|
|
432
|
+
... on Order { ${ORDER_FIELDS} }
|
|
420
433
|
... on NoActiveOrderError { errorCode message }
|
|
421
434
|
}
|
|
422
435
|
}
|
|
@@ -424,9 +437,7 @@ export const SET_SHIPPING_ADDRESS = `
|
|
|
424
437
|
export const SET_BILLING_ADDRESS = `
|
|
425
438
|
mutation SetBillingAddress($input: CreateAddressInput!) {
|
|
426
439
|
setOrderBillingAddress(input: $input) {
|
|
427
|
-
... on Order {
|
|
428
|
-
id
|
|
429
|
-
}
|
|
440
|
+
... on Order { ${ORDER_FIELDS} }
|
|
430
441
|
... on NoActiveOrderError { errorCode message }
|
|
431
442
|
}
|
|
432
443
|
}
|
|
@@ -434,16 +445,36 @@ export const SET_BILLING_ADDRESS = `
|
|
|
434
445
|
export const ELIGIBLE_SHIPPING_METHODS = `
|
|
435
446
|
query ShippingMethods {
|
|
436
447
|
eligibleShippingMethods {
|
|
437
|
-
id name description price priceWithTax metadata
|
|
448
|
+
id name description price priceWithTax metadata isPreferred isDeliveryTermsEligible
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
`;
|
|
452
|
+
export const MY_DELIVERY_TERMS = `
|
|
453
|
+
query MyDeliveryTerms {
|
|
454
|
+
myDeliveryTerms {
|
|
455
|
+
customerId source managedExternally status shippingMethodStatus policyStatus summary
|
|
456
|
+
preferredShippingMethodId preferredShippingMethodCode preferredShippingMethodName
|
|
457
|
+
preferredShippingMethodAvailable
|
|
458
|
+
eligibleShippingMethodIds
|
|
459
|
+
incotermStatus incotermCode incotermVersion incotermAddress incotermDescription
|
|
460
|
+
shippingLeadDays deliveryAdvice stale syncedAt warning
|
|
438
461
|
}
|
|
439
462
|
}
|
|
440
463
|
`;
|
|
441
464
|
export const SET_SHIPPING_METHOD = `
|
|
442
465
|
mutation SetShippingMethod($ids: [ID!]!) {
|
|
443
|
-
|
|
444
|
-
... on Order {
|
|
445
|
-
|
|
446
|
-
}
|
|
466
|
+
selectOrderDeliveryMethod(shippingMethodIds: $ids) {
|
|
467
|
+
... on Order { ${ORDER_FIELDS} }
|
|
468
|
+
... on OrderModificationError { errorCode message }
|
|
469
|
+
... on IneligibleShippingMethodError { errorCode message }
|
|
470
|
+
... on NoActiveOrderError { errorCode message }
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
`;
|
|
474
|
+
export const APPLY_PREFERRED_SHIPPING_METHOD = `
|
|
475
|
+
mutation ApplyPreferredShippingMethod {
|
|
476
|
+
applyPreferredDeliveryMethod {
|
|
477
|
+
... on Order { ${ORDER_FIELDS} }
|
|
447
478
|
... on OrderModificationError { errorCode message }
|
|
448
479
|
... on IneligibleShippingMethodError { errorCode message }
|
|
449
480
|
... on NoActiveOrderError { errorCode message }
|
|
@@ -460,7 +491,7 @@ export const ELIGIBLE_PAYMENT_METHODS = `
|
|
|
460
491
|
export const TRANSITION_TO_ARRANGING_PAYMENT = `
|
|
461
492
|
mutation TransitionToArrangingPayment {
|
|
462
493
|
transitionOrderToState(state: "ArrangingPayment") {
|
|
463
|
-
... on Order {
|
|
494
|
+
... on Order { ${ORDER_FIELDS} }
|
|
464
495
|
... on OrderStateTransitionError { errorCode message transitionError }
|
|
465
496
|
}
|
|
466
497
|
}
|
|
@@ -469,8 +500,9 @@ export const ADD_PAYMENT = `
|
|
|
469
500
|
mutation AddPayment($input: PaymentInput!) {
|
|
470
501
|
addPaymentToOrder(input: $input) {
|
|
471
502
|
... on Order {
|
|
472
|
-
|
|
503
|
+
${ORDER_FIELDS}
|
|
473
504
|
${ORDER_PAYMENT_TERMS_FRAGMENT}
|
|
505
|
+
${ORDER_DELIVERY_TERMS_FRAGMENT}
|
|
474
506
|
}
|
|
475
507
|
... on OrderPaymentStateError { errorCode message }
|
|
476
508
|
... on IneligiblePaymentMethodError { errorCode message }
|
|
@@ -784,6 +816,7 @@ export const ORDER_BY_CODE = `
|
|
|
784
816
|
${ORDER_FIELDS}
|
|
785
817
|
${ORDER_FULFILLMENTS_FRAGMENT}
|
|
786
818
|
${ORDER_PAYMENT_TERMS_FRAGMENT}
|
|
819
|
+
${ORDER_DELIVERY_TERMS_FRAGMENT}
|
|
787
820
|
}
|
|
788
821
|
}
|
|
789
822
|
`;
|
|
@@ -809,7 +842,7 @@ export const MY_FAVORITES = `
|
|
|
809
842
|
product {
|
|
810
843
|
id name slug
|
|
811
844
|
featuredAsset {
|
|
812
|
-
source
|
|
845
|
+
source width height
|
|
813
846
|
customFields { altText }
|
|
814
847
|
presets { xs { url webpUrl } m { url webpUrl } l { url webpUrl } }
|
|
815
848
|
}
|
|
@@ -902,7 +935,7 @@ export const GET_PRODUCT_RECOMMENDATIONS = `
|
|
|
902
935
|
products {
|
|
903
936
|
id name slug description
|
|
904
937
|
featuredAsset {
|
|
905
|
-
source name
|
|
938
|
+
source name width height
|
|
906
939
|
customFields { altText }
|
|
907
940
|
presets { xs { url webpUrl } m { url webpUrl } l { url webpUrl } }
|
|
908
941
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAQA,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BjC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA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YAAY;;CAEpC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;0CAEM,YAAY;;CAErD,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;6BAEC,YAAY;;CAExC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;;gDAEiB,YAAY;;CAE3D,CAAC;AAOF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B3B,CAAC;AAIF,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;CAU/C,CAAC;AAIF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;CAMhC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;CAM7B,CAAC;AASF,MAAM,aAAa,GAAG;;;;;;;;;;;;;CAarB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;;;gBAGV,aAAa;;;;CAI5B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;0BAEC,aAAa;;CAEtC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;UAcpB,aAAa;;CAEtB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;gCAEA,aAAa;;CAE5C,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;CAWzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field-types.d.ts","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,uBAAuB,EAAE,MAAM,aAAa,CAAC;AA4BpF,eAAO,MAAM,gBAAgB,EAAE,uBAAuB,EAoFrD,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const STRING_CONSTRAINTS = [
|
|
2
|
+
{ key: 'min_length', valueType: 'integer', description: 'Minimum number of characters.' },
|
|
3
|
+
{ key: 'max_length', valueType: 'integer', description: 'Maximum number of characters.' },
|
|
4
|
+
{
|
|
5
|
+
key: 'pattern',
|
|
6
|
+
valueType: 'string',
|
|
7
|
+
description: 'Regular expression the value must match (kept short and ReDoS-safe).',
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
const OPTIONS_CONSTRAINT = [
|
|
11
|
+
{
|
|
12
|
+
key: 'options',
|
|
13
|
+
valueType: 'string[]',
|
|
14
|
+
description: 'Allowed values. Accepts a plain string array or an array of { value, label } objects; membership is checked against the values.',
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
export const FORM_FIELD_TYPES = [
|
|
18
|
+
{
|
|
19
|
+
type: 'text',
|
|
20
|
+
label: 'Single-line text',
|
|
21
|
+
description: 'A single-line text input.',
|
|
22
|
+
valueType: 'string',
|
|
23
|
+
constraints: STRING_CONSTRAINTS,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'textarea',
|
|
27
|
+
label: 'Multi-line text',
|
|
28
|
+
description: 'A multi-line text area.',
|
|
29
|
+
valueType: 'string',
|
|
30
|
+
constraints: STRING_CONSTRAINTS,
|
|
31
|
+
notes: 'Allows up to 10,000 characters (higher hard cap than single-line text).',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'email',
|
|
35
|
+
label: 'Email address',
|
|
36
|
+
description: 'An email address, validated for basic shape.',
|
|
37
|
+
valueType: 'string',
|
|
38
|
+
constraints: [],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'phone',
|
|
42
|
+
label: 'Phone number',
|
|
43
|
+
description: 'A free-form phone number string.',
|
|
44
|
+
valueType: 'string',
|
|
45
|
+
constraints: STRING_CONSTRAINTS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'number',
|
|
49
|
+
label: 'Number',
|
|
50
|
+
description: 'A numeric value. Accepts a JSON number or a plain decimal string.',
|
|
51
|
+
valueType: 'number',
|
|
52
|
+
constraints: [
|
|
53
|
+
{ key: 'min', valueType: 'number', description: 'Minimum allowed value (inclusive).' },
|
|
54
|
+
{ key: 'max', valueType: 'number', description: 'Maximum allowed value (inclusive).' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'select',
|
|
59
|
+
label: 'Dropdown (single choice)',
|
|
60
|
+
description: 'A single value chosen from a fixed option set.',
|
|
61
|
+
valueType: 'string',
|
|
62
|
+
constraints: OPTIONS_CONSTRAINT,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'checkbox',
|
|
66
|
+
label: 'Checkbox / checkbox group',
|
|
67
|
+
description: 'A boolean checkbox, or a multi-select checkbox group (array of chosen option values).',
|
|
68
|
+
valueType: 'boolean | string[]',
|
|
69
|
+
constraints: OPTIONS_CONSTRAINT,
|
|
70
|
+
notes: 'Send a boolean for a single checkbox, or a string array for a checkbox group.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'radio',
|
|
74
|
+
label: 'Radio (single choice)',
|
|
75
|
+
description: 'A single value chosen from a fixed option set.',
|
|
76
|
+
valueType: 'string',
|
|
77
|
+
constraints: OPTIONS_CONSTRAINT,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'date',
|
|
81
|
+
label: 'Date',
|
|
82
|
+
description: 'An ISO-8601 date (date-only or full instant).',
|
|
83
|
+
valueType: 'string (ISO-8601)',
|
|
84
|
+
constraints: [],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'file',
|
|
88
|
+
label: 'File reference',
|
|
89
|
+
description: 'A string reference (e.g. an uploaded file URL or key).',
|
|
90
|
+
valueType: 'string',
|
|
91
|
+
constraints: STRING_CONSTRAINTS,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'hidden',
|
|
95
|
+
label: 'Hidden field',
|
|
96
|
+
description: 'A hidden string value (e.g. UTM tags) not shown to the visitor.',
|
|
97
|
+
valueType: 'string',
|
|
98
|
+
constraints: STRING_CONSTRAINTS,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
//# sourceMappingURL=form-field-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field-types.js","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"AASA,MAAM,kBAAkB,GAA8B;IACpD,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,+BAA+B,EAAE;IACzF,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,+BAA+B,EAAE;IACzF;QACE,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,sEAAsE;KACpF;CACF,CAAC;AAEF,MAAM,kBAAkB,GAA8B;IACpD;QACE,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,UAAU;QACrB,WAAW,EACT,iIAAiI;KACpI;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,2BAA2B;QACxC,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,yEAAyE;KACjF;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,8CAA8C;QAC3D,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,EAAE;KAChB;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;IACD;Q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
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { FormDefinition, FormSubmissionResult, RequestOptions, StoreContext } from '../types.js';
|
|
2
|
+
import type { FormDefinition, FormFieldTypeDescriptor, FormListOptions, FormListResult, FormSubmissionResult, RequestOptions, StoreContext } from '../types.js';
|
|
3
3
|
export declare function createFormMethods(http: HttpClient, ctx: StoreContext): {
|
|
4
|
+
listForms(options?: FormListOptions & RequestOptions): Promise<FormListResult>;
|
|
4
5
|
getForm(id: string, options?: RequestOptions): Promise<FormDefinition>;
|
|
5
6
|
getFormBySlug(slug: string, options?: RequestOptions): Promise<FormDefinition>;
|
|
7
|
+
getFormFieldTypes(options?: RequestOptions): Promise<FormFieldTypeDescriptor[]>;
|
|
6
8
|
submitForm(id: string, values: Record<string, unknown>, options?: RequestOptions): Promise<FormSubmissionResult>;
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;wBAmBvC,eAAe,GAAG,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;gBAUlE,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;wBAMlD,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;gCAalD,cAAc,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;mBAU/E,MAAM,UACF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACrB,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;EAiBnC"}
|
package/dist/content/forms.js
CHANGED
|
@@ -11,6 +11,20 @@ export function createFormMethods(http, ctx) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
|
+
async listForms(options) {
|
|
15
|
+
const params = {};
|
|
16
|
+
if (options?.limit !== undefined)
|
|
17
|
+
params.limit = String(options.limit);
|
|
18
|
+
if (options?.offset !== undefined)
|
|
19
|
+
params.offset = String(options.offset);
|
|
20
|
+
if (options?.search)
|
|
21
|
+
params.search = options.search;
|
|
22
|
+
if (options?.sort)
|
|
23
|
+
params.sort = options.sort;
|
|
24
|
+
if (options?.locale)
|
|
25
|
+
params.locale = options.locale;
|
|
26
|
+
return http.cmsGet('/forms', params, options);
|
|
27
|
+
},
|
|
14
28
|
async getForm(id, options) {
|
|
15
29
|
const data = await http.cmsGet(`/forms/${id}`, undefined, options);
|
|
16
30
|
return withSubmitTarget(data.data);
|
|
@@ -19,6 +33,10 @@ export function createFormMethods(http, ctx) {
|
|
|
19
33
|
const data = await http.cmsGet(`/forms/by-slug/${encodeURIComponent(slug)}`, undefined, options);
|
|
20
34
|
return withSubmitTarget(data.data);
|
|
21
35
|
},
|
|
36
|
+
async getFormFieldTypes(options) {
|
|
37
|
+
const data = await http.cmsGet('/forms/field-types', undefined, options);
|
|
38
|
+
return data.data;
|
|
39
|
+
},
|
|
22
40
|
async submitForm(id, values, options) {
|
|
23
41
|
const body = { data: values };
|
|
24
42
|
if (ctx.languageCode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,iBAAiB,CAAC,IAAgB,EAAE,GAAiB;IACnE,SAAS,gBAAgB,CAAC,IAAoB;QAC5C,OAAO;YACL,GAAG,IAAI;YACP,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS;YAClD,YAAY,EAAE,MAAM;YACpB,aAAa,EAAE;gBACb,cAAc,EAAE,kBAAkB;gBAClC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;aAC/B;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QAML,KAAK,CAAC,SAAS,CAAC,OAA0C;YACxD,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,OAAO,EAAE,MAAM,KAAK,SAAS;gBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1E,IAAI,OAAO,EAAE,MAAM;gBAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YACpD,IAAI,OAAO,EAAE,IAAI;gBAAE,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC9C,IAAI,OAAO,EAAE,MAAM;gBAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YACpD,OAAO,IAAI,CAAC,MAAM,CAAiB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChE,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,OAAwB;YAChD,MAAM,IAAI,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Ae,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAe,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0C9F"}
|
package/dist/core/context.js
CHANGED
|
@@ -29,6 +29,7 @@ export async function createStoreContext(config) {
|
|
|
29
29
|
fetch: fetchFn,
|
|
30
30
|
onAuthToken: config.onAuthToken,
|
|
31
31
|
onAuthExpired: config.onAuthExpired,
|
|
32
|
+
onAuthCleared: config.onAuthCleared,
|
|
32
33
|
retry: {
|
|
33
34
|
attempts: config.retry?.attempts ?? 2,
|
|
34
35
|
baseDelayMs: config.retry?.baseDelayMs ?? 200,
|
package/dist/core/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAA8B;IACrE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,eAAe,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,eAAe,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,OAAO,GAAG,MA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MAAM,CAAC,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC,CAAC;IACd,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxF,UAAU,CAAC,CAAC,GAAG,OAAO,EACpB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC,CAAC;CACf;AAwID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU,CAwW9D"}
|
package/dist/core/http.js
CHANGED
|
@@ -25,13 +25,28 @@ const RETRYABLE_STATUS_CODES = new Set([502, 503, 504]);
|
|
|
25
25
|
function isMutation(query) {
|
|
26
26
|
return /^\s*mutation\b/i.test(query);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const GRAPHQL_ERROR_STATUS = {
|
|
29
|
+
UNAUTHORIZED: 401,
|
|
30
|
+
FORBIDDEN: 403,
|
|
31
|
+
};
|
|
32
|
+
function isSessionExpiredError(json) {
|
|
29
33
|
if (!json.errors?.length)
|
|
30
34
|
return false;
|
|
31
|
-
return json.errors.some((e) =>
|
|
35
|
+
return json.errors.some((e) => e.extensions?.code === 'UNAUTHORIZED');
|
|
36
|
+
}
|
|
37
|
+
function isForbiddenError(json) {
|
|
38
|
+
if (!json.errors?.length)
|
|
39
|
+
return false;
|
|
40
|
+
return json.errors.some((e) => e.extensions?.code === 'FORBIDDEN');
|
|
41
|
+
}
|
|
42
|
+
const ACTIVE_CUSTOMER_PROBE_QUERY = 'query { activeCustomer { id } }';
|
|
43
|
+
function firstErrorCode(json) {
|
|
44
|
+
for (const e of json.errors ?? []) {
|
|
32
45
|
const code = e.extensions?.code;
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
if (typeof code === 'string' && code.length > 0)
|
|
47
|
+
return code;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
35
50
|
}
|
|
36
51
|
function createLinkedController(externalSignal, timeoutMs) {
|
|
37
52
|
const controller = new AbortController();
|
|
@@ -87,7 +102,30 @@ function isRetryable(error) {
|
|
|
87
102
|
return error instanceof TypeError;
|
|
88
103
|
}
|
|
89
104
|
export function createHttpClient(ctx) {
|
|
90
|
-
async function
|
|
105
|
+
async function maybeSignalAuthExpired(json, isProbe) {
|
|
106
|
+
if (isProbe || !ctx.authToken)
|
|
107
|
+
return;
|
|
108
|
+
if (isSessionExpiredError(json)) {
|
|
109
|
+
ctx.onAuthExpired?.();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!isForbiddenError(json))
|
|
113
|
+
return;
|
|
114
|
+
const sessionAlive = await probeSessionAlive();
|
|
115
|
+
if (sessionAlive === false) {
|
|
116
|
+
ctx.onAuthExpired?.();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function probeSessionAlive() {
|
|
120
|
+
try {
|
|
121
|
+
const data = await graphqlRequest(ACTIVE_CUSTOMER_PROBE_QUERY, undefined, undefined, true);
|
|
122
|
+
return data.activeCustomer != null;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function graphqlRequest(query, variables, options, isProbe) {
|
|
91
129
|
const isQuery = !isMutation(query);
|
|
92
130
|
return withRetry(ctx, options?.signal, isQuery, async () => {
|
|
93
131
|
const headers = buildVendureHeaders(ctx);
|
|
@@ -109,11 +147,10 @@ export function createHttpClient(ctx) {
|
|
|
109
147
|
}
|
|
110
148
|
const json = (await response.json());
|
|
111
149
|
if (json.errors?.length) {
|
|
112
|
-
|
|
113
|
-
ctx.onAuthExpired?.();
|
|
114
|
-
}
|
|
150
|
+
await maybeSignalAuthExpired(json, isProbe);
|
|
115
151
|
const messages = json.errors.map((e) => e.message).join('; ');
|
|
116
|
-
|
|
152
|
+
const errorCode = firstErrorCode(json);
|
|
153
|
+
throw new StorefrontError(`GraphQL error: ${messages}`, 'vendure', errorCode ? GRAPHQL_ERROR_STATUS[errorCode] : undefined, errorCode);
|
|
117
154
|
}
|
|
118
155
|
return json.data;
|
|
119
156
|
}
|
|
@@ -133,6 +170,9 @@ export function createHttpClient(ctx) {
|
|
|
133
170
|
}
|
|
134
171
|
});
|
|
135
172
|
}
|
|
173
|
+
function graphql(query, variables, options) {
|
|
174
|
+
return graphqlRequest(query, variables, options, false);
|
|
175
|
+
}
|
|
136
176
|
async function cmsGet(path, params, options) {
|
|
137
177
|
return withRetry(ctx, options?.signal, true, async () => {
|
|
138
178
|
const url = new URL(`${ctx.cmsUrl}${path}`);
|
|
@@ -287,11 +327,10 @@ export function createHttpClient(ctx) {
|
|
|
287
327
|
}
|
|
288
328
|
const json = (await response.json());
|
|
289
329
|
if (json.errors?.length) {
|
|
290
|
-
|
|
291
|
-
ctx.onAuthExpired?.();
|
|
292
|
-
}
|
|
330
|
+
await maybeSignalAuthExpired(json, false);
|
|
293
331
|
const messages = json.errors.map((e) => e.message).join('; ');
|
|
294
|
-
|
|
332
|
+
const errorCode = firstErrorCode(json);
|
|
333
|
+
throw new StorefrontError(`GraphQL upload error: ${messages}`, 'vendure', errorCode ? GRAPHQL_ERROR_STATUS[errorCode] : undefined, errorCode);
|
|
295
334
|
}
|
|
296
335
|
return json.data;
|
|
297
336
|
}
|