@nok-integration/storefront-react 0.18.3 → 0.18.5
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 +5 -5
- package/dist/index.mjs +22 -1
- package/dist/standalone/storefront.mjs +22 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,15 +24,15 @@ declare type AddCartItemRequest = z.infer<typeof AddCartItemRequest>;
|
|
|
24
24
|
|
|
25
25
|
/** The `error` member — a machine `code`, a human `message`, and optional `details`. */
|
|
26
26
|
declare const ApiErrorBody: z.ZodObject<{
|
|
27
|
-
code: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
27
|
+
code: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
28
28
|
message: z.ZodString;
|
|
29
29
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
code: "invalid_request" | "unauthorized" | "out_of_stock" | "cart_locked" | "sku_not_found" | "category_not_found" | "amount_mismatch" | "duplicate_order" | "order_not_found" | "order_not_cancellable" | "cart_not_found" | "support_ticket_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
31
|
+
code: "invalid_request" | "unauthorized" | "out_of_stock" | "cart_locked" | "sku_not_found" | "category_not_found" | "amount_mismatch" | "duplicate_order" | "order_not_found" | "order_not_cancellable" | "cart_not_found" | "support_ticket_not_found" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
32
32
|
message: string;
|
|
33
33
|
details?: Record<string, unknown> | undefined;
|
|
34
34
|
}, {
|
|
35
|
-
code: "invalid_request" | "unauthorized" | "out_of_stock" | "cart_locked" | "sku_not_found" | "category_not_found" | "amount_mismatch" | "duplicate_order" | "order_not_found" | "order_not_cancellable" | "cart_not_found" | "support_ticket_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
35
|
+
code: "invalid_request" | "unauthorized" | "out_of_stock" | "cart_locked" | "sku_not_found" | "category_not_found" | "amount_mismatch" | "duplicate_order" | "order_not_found" | "order_not_cancellable" | "cart_not_found" | "support_ticket_not_found" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
36
36
|
message: string;
|
|
37
37
|
details?: Record<string, unknown> | undefined;
|
|
38
38
|
}>;
|
|
@@ -3302,7 +3302,7 @@ export declare interface EmptyStateProps {
|
|
|
3302
3302
|
* | rate_limited | 429 | too many requests |
|
|
3303
3303
|
* | server_error | 500 | unexpected error (safe to retry idempotent) |
|
|
3304
3304
|
*/
|
|
3305
|
-
declare const ErrorCode: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3305
|
+
declare const ErrorCode: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3306
3306
|
|
|
3307
3307
|
declare type ErrorCode = z.infer<typeof ErrorCode>;
|
|
3308
3308
|
|
|
@@ -3325,7 +3325,7 @@ declare type ErrorCode = z.infer<typeof ErrorCode>;
|
|
|
3325
3325
|
* | rate_limited | 429 | too many requests |
|
|
3326
3326
|
* | server_error | 500 | unexpected error (safe to retry idempotent) |
|
|
3327
3327
|
*/
|
|
3328
|
-
declare const ErrorCode_2: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3328
|
+
declare const ErrorCode_2: z.ZodEnum<["invalid_request", "unauthorized", "out_of_stock", "cart_locked", "sku_not_found", "category_not_found", "amount_mismatch", "duplicate_order", "order_not_found", "order_not_cancellable", "cart_not_found", "support_ticket_not_found", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3329
3329
|
|
|
3330
3330
|
declare type ErrorCode_2 = z.infer<typeof ErrorCode_2>;
|
|
3331
3331
|
|
package/dist/index.mjs
CHANGED
|
@@ -5191,6 +5191,9 @@ function requireErrors() {
|
|
|
5191
5191
|
// `order_not_found` because saying "unknown order" about a support ticket sends whoever
|
|
5192
5192
|
// reads it looking in the wrong table.
|
|
5193
5193
|
"support_ticket_not_found",
|
|
5194
|
+
// Only ever raised on `/admin/v1`, where a chart can be picked and then deleted by
|
|
5195
|
+
// somebody else before the form is saved.
|
|
5196
|
+
"size_chart_not_found",
|
|
5194
5197
|
// Admin/CMS (`/admin/v1`). The error OBJECT is shared infrastructure — one shape, one
|
|
5195
5198
|
// `code` vocabulary, one filter — so admin failures name themselves here rather than in
|
|
5196
5199
|
// a second enum. `forbidden` is authenticated-but-not-permitted, which `unauthorized`
|
|
@@ -5215,6 +5218,7 @@ function requireErrors() {
|
|
|
5215
5218
|
order_not_cancellable: 409,
|
|
5216
5219
|
cart_not_found: 404,
|
|
5217
5220
|
support_ticket_not_found: 404,
|
|
5221
|
+
size_chart_not_found: 404,
|
|
5218
5222
|
forbidden: 403,
|
|
5219
5223
|
invalid_transition: 409,
|
|
5220
5224
|
rate_limited: 429,
|
|
@@ -5988,6 +5992,22 @@ const TREATMENTS = {
|
|
|
5988
5992
|
body: "This category is no longer available.",
|
|
5989
5993
|
retriable: false
|
|
5990
5994
|
},
|
|
5995
|
+
/*
|
|
5996
|
+
* Contracts 2.40.0, and the fan never asked for a size chart directly: they opened a
|
|
5997
|
+
* PDP whose product points at one that has since been deleted in the console. So the
|
|
5998
|
+
* copy is about the chart rather than about the page, and it is not retriable — asking
|
|
5999
|
+
* again returns the same 404 until somebody attaches a different chart.
|
|
6000
|
+
*
|
|
6001
|
+
* `Record<ErrorCode, …>` is what caught this: adding a code to the contracts package
|
|
6002
|
+
* breaks this build until the SDK has a treatment for it, which is the point. The gap
|
|
6003
|
+
* only showed up on a machine whose contracts had moved to 2.40.0, because ours had
|
|
6004
|
+
* not.
|
|
6005
|
+
*/
|
|
6006
|
+
size_chart_not_found: {
|
|
6007
|
+
title: "Size guide unavailable",
|
|
6008
|
+
body: "We could not load the size guide for this item.",
|
|
6009
|
+
retriable: false
|
|
6010
|
+
},
|
|
5991
6011
|
amount_mismatch: {
|
|
5992
6012
|
title: "Price updated",
|
|
5993
6013
|
body: "The total changed since you started. Review the updated amount and try again.",
|
|
@@ -6180,6 +6200,7 @@ function Caret() {
|
|
|
6180
6200
|
) });
|
|
6181
6201
|
}
|
|
6182
6202
|
let nextId = 0;
|
|
6203
|
+
const DISMISS_AFTER_MS = 2e3;
|
|
6183
6204
|
function ToastProvider({ children }) {
|
|
6184
6205
|
const [toasts, setToasts] = useState([]);
|
|
6185
6206
|
const viewportRef = useRef(null);
|
|
@@ -6206,7 +6227,7 @@ function ToastProvider({ children }) {
|
|
|
6206
6227
|
}
|
|
6207
6228
|
const id = nextId++;
|
|
6208
6229
|
setToasts((prev) => [...prev, { ...opts, id, message: message2, tone, action: action2 }]);
|
|
6209
|
-
setTimeout(() => dismiss(id),
|
|
6230
|
+
setTimeout(() => dismiss(id), DISMISS_AFTER_MS);
|
|
6210
6231
|
},
|
|
6211
6232
|
[dismiss, hostOwnsNotifications, emit]
|
|
6212
6233
|
);
|
|
@@ -5191,6 +5191,9 @@ function requireErrors() {
|
|
|
5191
5191
|
// `order_not_found` because saying "unknown order" about a support ticket sends whoever
|
|
5192
5192
|
// reads it looking in the wrong table.
|
|
5193
5193
|
"support_ticket_not_found",
|
|
5194
|
+
// Only ever raised on `/admin/v1`, where a chart can be picked and then deleted by
|
|
5195
|
+
// somebody else before the form is saved.
|
|
5196
|
+
"size_chart_not_found",
|
|
5194
5197
|
// Admin/CMS (`/admin/v1`). The error OBJECT is shared infrastructure — one shape, one
|
|
5195
5198
|
// `code` vocabulary, one filter — so admin failures name themselves here rather than in
|
|
5196
5199
|
// a second enum. `forbidden` is authenticated-but-not-permitted, which `unauthorized`
|
|
@@ -5215,6 +5218,7 @@ function requireErrors() {
|
|
|
5215
5218
|
order_not_cancellable: 409,
|
|
5216
5219
|
cart_not_found: 404,
|
|
5217
5220
|
support_ticket_not_found: 404,
|
|
5221
|
+
size_chart_not_found: 404,
|
|
5218
5222
|
forbidden: 403,
|
|
5219
5223
|
invalid_transition: 409,
|
|
5220
5224
|
rate_limited: 429,
|
|
@@ -5988,6 +5992,22 @@ const TREATMENTS = {
|
|
|
5988
5992
|
body: "This category is no longer available.",
|
|
5989
5993
|
retriable: false
|
|
5990
5994
|
},
|
|
5995
|
+
/*
|
|
5996
|
+
* Contracts 2.40.0, and the fan never asked for a size chart directly: they opened a
|
|
5997
|
+
* PDP whose product points at one that has since been deleted in the console. So the
|
|
5998
|
+
* copy is about the chart rather than about the page, and it is not retriable — asking
|
|
5999
|
+
* again returns the same 404 until somebody attaches a different chart.
|
|
6000
|
+
*
|
|
6001
|
+
* `Record<ErrorCode, …>` is what caught this: adding a code to the contracts package
|
|
6002
|
+
* breaks this build until the SDK has a treatment for it, which is the point. The gap
|
|
6003
|
+
* only showed up on a machine whose contracts had moved to 2.40.0, because ours had
|
|
6004
|
+
* not.
|
|
6005
|
+
*/
|
|
6006
|
+
size_chart_not_found: {
|
|
6007
|
+
title: "Size guide unavailable",
|
|
6008
|
+
body: "We could not load the size guide for this item.",
|
|
6009
|
+
retriable: false
|
|
6010
|
+
},
|
|
5991
6011
|
amount_mismatch: {
|
|
5992
6012
|
title: "Price updated",
|
|
5993
6013
|
body: "The total changed since you started. Review the updated amount and try again.",
|
|
@@ -6180,6 +6200,7 @@ function Caret() {
|
|
|
6180
6200
|
) });
|
|
6181
6201
|
}
|
|
6182
6202
|
let nextId = 0;
|
|
6203
|
+
const DISMISS_AFTER_MS = 2e3;
|
|
6183
6204
|
function ToastProvider({ children }) {
|
|
6184
6205
|
const [toasts, setToasts] = useState([]);
|
|
6185
6206
|
const viewportRef = useRef(null);
|
|
@@ -6206,7 +6227,7 @@ function ToastProvider({ children }) {
|
|
|
6206
6227
|
}
|
|
6207
6228
|
const id = nextId++;
|
|
6208
6229
|
setToasts((prev) => [...prev, { ...opts, id, message: message2, tone, action: action2 }]);
|
|
6209
|
-
setTimeout(() => dismiss(id),
|
|
6230
|
+
setTimeout(() => dismiss(id), DISMISS_AFTER_MS);
|
|
6210
6231
|
},
|
|
6211
6232
|
[dismiss, hostOwnsNotifications, emit]
|
|
6212
6233
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "Mountable React storefront components: catalogue, product detail and cart, mounted directly into a host DOM tree. No iframe.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|