@asstio-dev/storefront 0.17.0 → 0.19.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/README.md +46 -3
- package/dist/analytics/facts.d.ts +3 -2
- package/dist/analytics/facts.js +4 -2
- package/dist/analytics/ga4.d.ts +3 -2
- package/dist/analytics/ga4.js +6 -1
- package/dist/analytics/types.d.ts +4 -2
- package/dist/checkout/browser.d.ts +13 -1
- package/dist/checkout/browser.js +146 -3
- package/dist/checkout/controllers.d.ts +18 -2
- package/dist/checkout/controllers.js +133 -16
- package/dist/checkout/live-shipping.d.ts +30 -0
- package/dist/checkout/live-shipping.js +193 -0
- package/dist/checkout/server.d.ts +4 -1
- package/dist/checkout/server.js +9 -0
- package/dist/checkout/types.d.ts +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/schema.d.ts +129 -0
- package/package.json +2 -2
- package/src/schema.d.ts +129 -0
package/dist/schema.d.ts
CHANGED
|
@@ -183,6 +183,22 @@ export interface paths {
|
|
|
183
183
|
patch?: never;
|
|
184
184
|
trace?: never;
|
|
185
185
|
};
|
|
186
|
+
"/v1/checkout/{attemptId}/shipping": {
|
|
187
|
+
parameters: {
|
|
188
|
+
query?: never;
|
|
189
|
+
header?: never;
|
|
190
|
+
path?: never;
|
|
191
|
+
cookie?: never;
|
|
192
|
+
};
|
|
193
|
+
get: operations["GetCheckoutShipping"];
|
|
194
|
+
put?: never;
|
|
195
|
+
post?: never;
|
|
196
|
+
delete?: never;
|
|
197
|
+
options?: never;
|
|
198
|
+
head?: never;
|
|
199
|
+
patch?: never;
|
|
200
|
+
trace?: never;
|
|
201
|
+
};
|
|
186
202
|
"/v1/collections": {
|
|
187
203
|
parameters: {
|
|
188
204
|
query?: never;
|
|
@@ -541,11 +557,13 @@ export interface components {
|
|
|
541
557
|
options: {
|
|
542
558
|
[key: string]: string;
|
|
543
559
|
};
|
|
560
|
+
product: components["schemas"]["OrderLineProductDto"];
|
|
544
561
|
productId: string;
|
|
545
562
|
/** Format: int32 */
|
|
546
563
|
quantity: number | string;
|
|
547
564
|
sku: string;
|
|
548
565
|
unitPriceInc: string;
|
|
566
|
+
variant: components["schemas"]["OrderLineVariantDto"];
|
|
549
567
|
variantId: string;
|
|
550
568
|
vatRate: string;
|
|
551
569
|
};
|
|
@@ -591,6 +609,32 @@ export interface components {
|
|
|
591
609
|
kind: string;
|
|
592
610
|
url: null | string;
|
|
593
611
|
};
|
|
612
|
+
CheckoutShippingPointDto: {
|
|
613
|
+
city: null | string;
|
|
614
|
+
name: string;
|
|
615
|
+
postalCode: null | string;
|
|
616
|
+
street: null | string;
|
|
617
|
+
};
|
|
618
|
+
CheckoutShippingViewDto: {
|
|
619
|
+
/** Format: int32 */
|
|
620
|
+
cartVersion: number | null | string;
|
|
621
|
+
currency: null | string;
|
|
622
|
+
deliveryType: null | string;
|
|
623
|
+
goodsInc: null | string;
|
|
624
|
+
name: null | string;
|
|
625
|
+
option: null | string;
|
|
626
|
+
otherInc: null | string;
|
|
627
|
+
point: null | components["schemas"]["CheckoutShippingPointDto"];
|
|
628
|
+
/** Format: date-time */
|
|
629
|
+
readAt: null | string;
|
|
630
|
+
reason: null | string;
|
|
631
|
+
/** Format: int32 */
|
|
632
|
+
retryAfterSeconds: number | null | string;
|
|
633
|
+
shippingInc: null | string;
|
|
634
|
+
state: string;
|
|
635
|
+
totalInc: null | string;
|
|
636
|
+
totalSource: null | string;
|
|
637
|
+
};
|
|
594
638
|
CheckoutStatusDto: {
|
|
595
639
|
attemptId: string;
|
|
596
640
|
order: null | components["schemas"]["CheckoutOrderRefDto"];
|
|
@@ -2399,6 +2443,91 @@ export interface operations {
|
|
|
2399
2443
|
};
|
|
2400
2444
|
};
|
|
2401
2445
|
};
|
|
2446
|
+
GetCheckoutShipping: {
|
|
2447
|
+
parameters: {
|
|
2448
|
+
query?: never;
|
|
2449
|
+
header: {
|
|
2450
|
+
/** @description Publishable, preview or secret site key. Required on every request; secret keys are server-side only. */
|
|
2451
|
+
"X-Site-Key": string;
|
|
2452
|
+
/** @description Market code (e.g. "se"). Omit for the site's default market. */
|
|
2453
|
+
"X-Market"?: string;
|
|
2454
|
+
/** @description BCP-47 language tag. Omit to use the market's language. */
|
|
2455
|
+
"Accept-Language"?: string;
|
|
2456
|
+
/** @description The cart's bearer token. The checkout works on this cart. */
|
|
2457
|
+
"X-Cart-Token": string;
|
|
2458
|
+
};
|
|
2459
|
+
path: {
|
|
2460
|
+
attemptId: string;
|
|
2461
|
+
};
|
|
2462
|
+
cookie?: never;
|
|
2463
|
+
};
|
|
2464
|
+
requestBody?: never;
|
|
2465
|
+
responses: {
|
|
2466
|
+
/** @description OK */
|
|
2467
|
+
200: {
|
|
2468
|
+
headers: {
|
|
2469
|
+
[name: string]: unknown;
|
|
2470
|
+
};
|
|
2471
|
+
content: {
|
|
2472
|
+
"application/json": components["schemas"]["CheckoutShippingViewDto"];
|
|
2473
|
+
};
|
|
2474
|
+
};
|
|
2475
|
+
/** @description problem+json. NOT_FOUND (X-Cart-Token missing). */
|
|
2476
|
+
400: {
|
|
2477
|
+
headers: {
|
|
2478
|
+
[name: string]: unknown;
|
|
2479
|
+
};
|
|
2480
|
+
content: {
|
|
2481
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2482
|
+
};
|
|
2483
|
+
};
|
|
2484
|
+
/** @description problem+json. SITE_KEY_MISSING or SITE_KEY_INVALID. */
|
|
2485
|
+
401: {
|
|
2486
|
+
headers: {
|
|
2487
|
+
[name: string]: unknown;
|
|
2488
|
+
};
|
|
2489
|
+
content: {
|
|
2490
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2491
|
+
};
|
|
2492
|
+
};
|
|
2493
|
+
/** @description problem+json. SECRET_KEY_FROM_BROWSER: a secret key was sent from a browser. */
|
|
2494
|
+
403: {
|
|
2495
|
+
headers: {
|
|
2496
|
+
[name: string]: unknown;
|
|
2497
|
+
};
|
|
2498
|
+
content: {
|
|
2499
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2500
|
+
};
|
|
2501
|
+
};
|
|
2502
|
+
/** @description problem+json. CHECKOUT_NOT_FOUND: no such attempt for this site and cart; or SITE_INACTIVE. */
|
|
2503
|
+
404: {
|
|
2504
|
+
headers: {
|
|
2505
|
+
[name: string]: unknown;
|
|
2506
|
+
};
|
|
2507
|
+
content: {
|
|
2508
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2509
|
+
};
|
|
2510
|
+
};
|
|
2511
|
+
/** @description problem+json. RATE_LIMITED; retryAfterSeconds and the Retry-After header say how long to wait. */
|
|
2512
|
+
429: {
|
|
2513
|
+
headers: {
|
|
2514
|
+
[name: string]: unknown;
|
|
2515
|
+
};
|
|
2516
|
+
content: {
|
|
2517
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2518
|
+
};
|
|
2519
|
+
};
|
|
2520
|
+
/** @description problem+json. SITE_REGISTRY_WARMING or INDEX_UNAVAILABLE — retry, the request was not wrong. */
|
|
2521
|
+
503: {
|
|
2522
|
+
headers: {
|
|
2523
|
+
[name: string]: unknown;
|
|
2524
|
+
};
|
|
2525
|
+
content: {
|
|
2526
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
};
|
|
2530
|
+
};
|
|
2402
2531
|
GetCollections: {
|
|
2403
2532
|
parameters: {
|
|
2404
2533
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asstio-dev/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Typed client for the Asstio Storefront API (generated from OpenAPI).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run",
|
|
22
22
|
"test:browser": "playwright test -c browser/playwright.config.ts",
|
|
23
23
|
"check": "npm run generate && npm run typecheck-examples && npm test && git diff --exit-code -- src/schema.d.ts && test -z \"$(git status --porcelain -- src/schema.d.ts)\"",
|
|
24
|
-
"smoke": "node --input-type=module -e \"import(\\\"./dist/index.js\\\").then(m => { for (const f of [\\\"createStorefrontClient\\\", \\\"filterQuery\\\", \\\"encodeFilterValues\\\", \\\"decodeFilterValues\\\", \\\"pictureSources\\\", \\\"mediaUrl\\\", \\\"formatImage\\\", \\\"styleToCss\\\", \\\"startCheckout\\\", \\\"syncCheckout\\\", \\\"completeCheckout\\\", \\\"getCheckoutStatus\\\", \\\"getOrder\\\", \\\"awaitCompletion\\\", \\\"mountCheckout\\\", \\\"productJsonLd\\\", \\\"gtinJsonLd\\\", \\\"breadcrumbJsonLd\\\", \\\"productHead\\\", \\\"collectionHead\\\", \\\"brandHead\\\", \\\"toNextMetadata\\\", \\\"jsonLdScript\\\", \\\"SeoError\\\", \\\"productFacts\\\", \\\"toGa4Item\\\", \\\"toGa4Ecommerce\\\", \\\"AnalyticsError\\\"]) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f) })\""
|
|
24
|
+
"smoke": "node --input-type=module -e \"import(\\\"./dist/index.js\\\").then(m => { for (const f of [\\\"createStorefrontClient\\\", \\\"filterQuery\\\", \\\"encodeFilterValues\\\", \\\"decodeFilterValues\\\", \\\"pictureSources\\\", \\\"mediaUrl\\\", \\\"formatImage\\\", \\\"styleToCss\\\", \\\"startCheckout\\\", \\\"syncCheckout\\\", \\\"completeCheckout\\\", \\\"getCheckoutStatus\\\", \\\"liveShippingFor\\\", \\\"getOrder\\\", \\\"awaitCompletion\\\", \\\"mountCheckout\\\", \\\"productJsonLd\\\", \\\"gtinJsonLd\\\", \\\"breadcrumbJsonLd\\\", \\\"productHead\\\", \\\"collectionHead\\\", \\\"brandHead\\\", \\\"toNextMetadata\\\", \\\"jsonLdScript\\\", \\\"SeoError\\\", \\\"productFacts\\\", \\\"toGa4Item\\\", \\\"toGa4Ecommerce\\\", \\\"AnalyticsError\\\"]) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f) })\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"openapi-fetch": "0.17.0"
|
package/src/schema.d.ts
CHANGED
|
@@ -183,6 +183,22 @@ export interface paths {
|
|
|
183
183
|
patch?: never;
|
|
184
184
|
trace?: never;
|
|
185
185
|
};
|
|
186
|
+
"/v1/checkout/{attemptId}/shipping": {
|
|
187
|
+
parameters: {
|
|
188
|
+
query?: never;
|
|
189
|
+
header?: never;
|
|
190
|
+
path?: never;
|
|
191
|
+
cookie?: never;
|
|
192
|
+
};
|
|
193
|
+
get: operations["GetCheckoutShipping"];
|
|
194
|
+
put?: never;
|
|
195
|
+
post?: never;
|
|
196
|
+
delete?: never;
|
|
197
|
+
options?: never;
|
|
198
|
+
head?: never;
|
|
199
|
+
patch?: never;
|
|
200
|
+
trace?: never;
|
|
201
|
+
};
|
|
186
202
|
"/v1/collections": {
|
|
187
203
|
parameters: {
|
|
188
204
|
query?: never;
|
|
@@ -541,11 +557,13 @@ export interface components {
|
|
|
541
557
|
options: {
|
|
542
558
|
[key: string]: string;
|
|
543
559
|
};
|
|
560
|
+
product: components["schemas"]["OrderLineProductDto"];
|
|
544
561
|
productId: string;
|
|
545
562
|
/** Format: int32 */
|
|
546
563
|
quantity: number | string;
|
|
547
564
|
sku: string;
|
|
548
565
|
unitPriceInc: string;
|
|
566
|
+
variant: components["schemas"]["OrderLineVariantDto"];
|
|
549
567
|
variantId: string;
|
|
550
568
|
vatRate: string;
|
|
551
569
|
};
|
|
@@ -591,6 +609,32 @@ export interface components {
|
|
|
591
609
|
kind: string;
|
|
592
610
|
url: null | string;
|
|
593
611
|
};
|
|
612
|
+
CheckoutShippingPointDto: {
|
|
613
|
+
city: null | string;
|
|
614
|
+
name: string;
|
|
615
|
+
postalCode: null | string;
|
|
616
|
+
street: null | string;
|
|
617
|
+
};
|
|
618
|
+
CheckoutShippingViewDto: {
|
|
619
|
+
/** Format: int32 */
|
|
620
|
+
cartVersion: number | null | string;
|
|
621
|
+
currency: null | string;
|
|
622
|
+
deliveryType: null | string;
|
|
623
|
+
goodsInc: null | string;
|
|
624
|
+
name: null | string;
|
|
625
|
+
option: null | string;
|
|
626
|
+
otherInc: null | string;
|
|
627
|
+
point: null | components["schemas"]["CheckoutShippingPointDto"];
|
|
628
|
+
/** Format: date-time */
|
|
629
|
+
readAt: null | string;
|
|
630
|
+
reason: null | string;
|
|
631
|
+
/** Format: int32 */
|
|
632
|
+
retryAfterSeconds: number | null | string;
|
|
633
|
+
shippingInc: null | string;
|
|
634
|
+
state: string;
|
|
635
|
+
totalInc: null | string;
|
|
636
|
+
totalSource: null | string;
|
|
637
|
+
};
|
|
594
638
|
CheckoutStatusDto: {
|
|
595
639
|
attemptId: string;
|
|
596
640
|
order: null | components["schemas"]["CheckoutOrderRefDto"];
|
|
@@ -2399,6 +2443,91 @@ export interface operations {
|
|
|
2399
2443
|
};
|
|
2400
2444
|
};
|
|
2401
2445
|
};
|
|
2446
|
+
GetCheckoutShipping: {
|
|
2447
|
+
parameters: {
|
|
2448
|
+
query?: never;
|
|
2449
|
+
header: {
|
|
2450
|
+
/** @description Publishable, preview or secret site key. Required on every request; secret keys are server-side only. */
|
|
2451
|
+
"X-Site-Key": string;
|
|
2452
|
+
/** @description Market code (e.g. "se"). Omit for the site's default market. */
|
|
2453
|
+
"X-Market"?: string;
|
|
2454
|
+
/** @description BCP-47 language tag. Omit to use the market's language. */
|
|
2455
|
+
"Accept-Language"?: string;
|
|
2456
|
+
/** @description The cart's bearer token. The checkout works on this cart. */
|
|
2457
|
+
"X-Cart-Token": string;
|
|
2458
|
+
};
|
|
2459
|
+
path: {
|
|
2460
|
+
attemptId: string;
|
|
2461
|
+
};
|
|
2462
|
+
cookie?: never;
|
|
2463
|
+
};
|
|
2464
|
+
requestBody?: never;
|
|
2465
|
+
responses: {
|
|
2466
|
+
/** @description OK */
|
|
2467
|
+
200: {
|
|
2468
|
+
headers: {
|
|
2469
|
+
[name: string]: unknown;
|
|
2470
|
+
};
|
|
2471
|
+
content: {
|
|
2472
|
+
"application/json": components["schemas"]["CheckoutShippingViewDto"];
|
|
2473
|
+
};
|
|
2474
|
+
};
|
|
2475
|
+
/** @description problem+json. NOT_FOUND (X-Cart-Token missing). */
|
|
2476
|
+
400: {
|
|
2477
|
+
headers: {
|
|
2478
|
+
[name: string]: unknown;
|
|
2479
|
+
};
|
|
2480
|
+
content: {
|
|
2481
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2482
|
+
};
|
|
2483
|
+
};
|
|
2484
|
+
/** @description problem+json. SITE_KEY_MISSING or SITE_KEY_INVALID. */
|
|
2485
|
+
401: {
|
|
2486
|
+
headers: {
|
|
2487
|
+
[name: string]: unknown;
|
|
2488
|
+
};
|
|
2489
|
+
content: {
|
|
2490
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2491
|
+
};
|
|
2492
|
+
};
|
|
2493
|
+
/** @description problem+json. SECRET_KEY_FROM_BROWSER: a secret key was sent from a browser. */
|
|
2494
|
+
403: {
|
|
2495
|
+
headers: {
|
|
2496
|
+
[name: string]: unknown;
|
|
2497
|
+
};
|
|
2498
|
+
content: {
|
|
2499
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2500
|
+
};
|
|
2501
|
+
};
|
|
2502
|
+
/** @description problem+json. CHECKOUT_NOT_FOUND: no such attempt for this site and cart; or SITE_INACTIVE. */
|
|
2503
|
+
404: {
|
|
2504
|
+
headers: {
|
|
2505
|
+
[name: string]: unknown;
|
|
2506
|
+
};
|
|
2507
|
+
content: {
|
|
2508
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2509
|
+
};
|
|
2510
|
+
};
|
|
2511
|
+
/** @description problem+json. RATE_LIMITED; retryAfterSeconds and the Retry-After header say how long to wait. */
|
|
2512
|
+
429: {
|
|
2513
|
+
headers: {
|
|
2514
|
+
[name: string]: unknown;
|
|
2515
|
+
};
|
|
2516
|
+
content: {
|
|
2517
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2518
|
+
};
|
|
2519
|
+
};
|
|
2520
|
+
/** @description problem+json. SITE_REGISTRY_WARMING or INDEX_UNAVAILABLE — retry, the request was not wrong. */
|
|
2521
|
+
503: {
|
|
2522
|
+
headers: {
|
|
2523
|
+
[name: string]: unknown;
|
|
2524
|
+
};
|
|
2525
|
+
content: {
|
|
2526
|
+
"application/problem+json": components["schemas"]["StorefrontProblem"];
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
};
|
|
2530
|
+
};
|
|
2402
2531
|
GetCollections: {
|
|
2403
2532
|
parameters: {
|
|
2404
2533
|
query?: never;
|