@nok-integration/storefront-react 0.29.3 → 0.29.4
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 +11 -6
- package/dist/index.mjs +43 -18
- package/dist/standalone/storefront.mjs +43 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,15 +23,15 @@ declare type AddCartItemRequest = z.infer<typeof AddCartItemRequest>;
|
|
|
23
23
|
|
|
24
24
|
/** The `error` member — a machine `code`, a human `message`, and optional `details`. */
|
|
25
25
|
declare const ApiErrorBody: z.ZodObject<{
|
|
26
|
-
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
26
|
+
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
27
27
|
message: z.ZodString;
|
|
28
28
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
29
|
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
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" | "vip_invite_not_found" | "vip_cart_conflict" | "vip_invite_mismatch" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
30
|
+
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" | "vip_invite_not_found" | "vip_cart_conflict" | "vip_invite_mismatch" | "vip_hero_missing" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
31
31
|
message: string;
|
|
32
32
|
details?: Record<string, unknown> | undefined;
|
|
33
33
|
}, {
|
|
34
|
-
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" | "vip_invite_not_found" | "vip_cart_conflict" | "vip_invite_mismatch" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
34
|
+
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" | "vip_invite_not_found" | "vip_cart_conflict" | "vip_invite_mismatch" | "vip_hero_missing" | "size_chart_not_found" | "forbidden" | "invalid_transition" | "rate_limited" | "server_error";
|
|
35
35
|
message: string;
|
|
36
36
|
details?: Record<string, unknown> | undefined;
|
|
37
37
|
}>;
|
|
@@ -3760,7 +3760,7 @@ export declare interface EmptyStateProps {
|
|
|
3760
3760
|
* | rate_limited | 429 | too many requests |
|
|
3761
3761
|
* | server_error | 500 | unexpected error (safe to retry idempotent) |
|
|
3762
3762
|
*/
|
|
3763
|
-
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3763
|
+
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3764
3764
|
|
|
3765
3765
|
declare type ErrorCode = z.infer<typeof ErrorCode>;
|
|
3766
3766
|
|
|
@@ -3783,7 +3783,7 @@ declare type ErrorCode = z.infer<typeof ErrorCode>;
|
|
|
3783
3783
|
* | rate_limited | 429 | too many requests |
|
|
3784
3784
|
* | server_error | 500 | unexpected error (safe to retry idempotent) |
|
|
3785
3785
|
*/
|
|
3786
|
-
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3786
|
+
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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]>;
|
|
3787
3787
|
|
|
3788
3788
|
declare type ErrorCode_2 = z.infer<typeof ErrorCode_2>;
|
|
3789
3789
|
|
|
@@ -7225,7 +7225,7 @@ declare const VipInviteView: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
|
7225
7225
|
|
|
7226
7226
|
declare type VipInviteView = z.infer<typeof VipInviteView>;
|
|
7227
7227
|
|
|
7228
|
-
export declare function VipLandingView({ token, onUnavailable }: VipLandingViewProps): JSX.Element;
|
|
7228
|
+
export declare function VipLandingView({ token, onUnavailable, screen }: VipLandingViewProps): JSX.Element;
|
|
7229
7229
|
|
|
7230
7230
|
export declare interface VipLandingViewProps {
|
|
7231
7231
|
/**
|
|
@@ -7235,6 +7235,11 @@ export declare interface VipLandingViewProps {
|
|
|
7235
7235
|
token: string;
|
|
7236
7236
|
/** Replaces the built-in screen for an invite that cannot be claimed. */
|
|
7237
7237
|
onUnavailable?: (state: VipInviteUnavailableState) => ReactNode;
|
|
7238
|
+
/**
|
|
7239
|
+
* Which screen of the invite this URL is. `hero` is `/vip/<token>`, `product` is
|
|
7240
|
+
* `/vip/<token>/product`. Defaults to `hero`.
|
|
7241
|
+
*/
|
|
7242
|
+
screen?: 'hero' | 'product';
|
|
7238
7243
|
}
|
|
7239
7244
|
|
|
7240
7245
|
/** "Why shop with us" reassurance tiles. */
|
package/dist/index.mjs
CHANGED
|
@@ -4993,7 +4993,7 @@ function requireErrors$1() {
|
|
|
4993
4993
|
});
|
|
4994
4994
|
exports.ErrorResponse = exports.ApiErrorBody = exports.ERROR_CODE_STATUS = exports.ErrorCode = void 0;
|
|
4995
4995
|
const zod_1 = requireZod();
|
|
4996
|
-
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
4996
|
+
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
4997
4997
|
exports.ERROR_CODE_STATUS = {
|
|
4998
4998
|
invalid_request: 400,
|
|
4999
4999
|
unauthorized: 401,
|
|
@@ -5010,6 +5010,7 @@ function requireErrors$1() {
|
|
|
5010
5010
|
vip_invite_not_found: 404,
|
|
5011
5011
|
vip_cart_conflict: 409,
|
|
5012
5012
|
vip_invite_mismatch: 409,
|
|
5013
|
+
vip_hero_missing: 422,
|
|
5013
5014
|
size_chart_not_found: 404,
|
|
5014
5015
|
forbidden: 403,
|
|
5015
5016
|
invalid_transition: 409,
|
|
@@ -14142,7 +14143,7 @@ function requireErrors() {
|
|
|
14142
14143
|
});
|
|
14143
14144
|
exports.ErrorResponse = exports.ApiErrorBody = exports.ERROR_CODE_STATUS = exports.ErrorCode = void 0;
|
|
14144
14145
|
const zod_1 = requireZod();
|
|
14145
|
-
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
14146
|
+
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
14146
14147
|
exports.ERROR_CODE_STATUS = {
|
|
14147
14148
|
invalid_request: 400,
|
|
14148
14149
|
unauthorized: 401,
|
|
@@ -14159,6 +14160,7 @@ function requireErrors() {
|
|
|
14159
14160
|
vip_invite_not_found: 404,
|
|
14160
14161
|
vip_cart_conflict: 409,
|
|
14161
14162
|
vip_invite_mismatch: 409,
|
|
14163
|
+
vip_hero_missing: 422,
|
|
14162
14164
|
size_chart_not_found: 404,
|
|
14163
14165
|
forbidden: 403,
|
|
14164
14166
|
invalid_transition: 409,
|
|
@@ -14902,7 +14904,7 @@ function locatorOf(segment) {
|
|
|
14902
14904
|
return null;
|
|
14903
14905
|
}
|
|
14904
14906
|
const INVALID_LINK = /* @__PURE__ */ new Set(["invalid_request", "vip_invite_not_found", "vip_invite_mismatch"]);
|
|
14905
|
-
function VipLandingView({ token, onUnavailable }) {
|
|
14907
|
+
function VipLandingView({ token, onUnavailable, screen: screen2 = "hero" }) {
|
|
14906
14908
|
const t = useT();
|
|
14907
14909
|
const { api, emit } = useShop();
|
|
14908
14910
|
const locator = locatorOf(token);
|
|
@@ -14982,18 +14984,43 @@ function VipLandingView({ token, onUnavailable }) {
|
|
|
14982
14984
|
}
|
|
14983
14985
|
return jsx(ActiveLanding, {
|
|
14984
14986
|
token,
|
|
14985
|
-
invite
|
|
14987
|
+
invite,
|
|
14988
|
+
screen: screen2
|
|
14986
14989
|
});
|
|
14987
14990
|
}
|
|
14988
|
-
function
|
|
14991
|
+
function plainFirstLine(description2) {
|
|
14992
|
+
if (!description2) return null;
|
|
14993
|
+
const line2 = description2.replace(/<[^>]*>/g, " ").split(/\n+/).map((l) => l.replace(/\s+/g, " ").trim()).find((l) => l.length > 0);
|
|
14994
|
+
if (!line2) return null;
|
|
14995
|
+
const sentence = /^.*?[.!?](?=\s|$)/.exec(line2);
|
|
14996
|
+
return sentence ? sentence[0] : line2;
|
|
14997
|
+
}
|
|
14998
|
+
function heroFromProduct(product, ctaLabel) {
|
|
14999
|
+
const image2 = product.media[0] ?? null;
|
|
15000
|
+
return {
|
|
15001
|
+
image: image2,
|
|
15002
|
+
desktop_image: image2,
|
|
15003
|
+
headline: product.title,
|
|
15004
|
+
body: plainFirstLine(product.description),
|
|
15005
|
+
cta_label: ctaLabel
|
|
15006
|
+
};
|
|
15007
|
+
}
|
|
15008
|
+
function ActiveLanding({ token, invite, screen: screen2 }) {
|
|
14989
15009
|
const t = useT();
|
|
14990
15010
|
const toast2 = useToast();
|
|
14991
15011
|
const { api, emit } = useShop();
|
|
14992
|
-
const
|
|
15012
|
+
const navigate = useNavigate();
|
|
14993
15013
|
const sku = invite.items[0]?.product_sku ?? "";
|
|
14994
15014
|
const loaded = useProduct(sku, {
|
|
14995
15015
|
showRecommendations: false
|
|
14996
15016
|
});
|
|
15017
|
+
const productPath = `/vip/${token}/product`;
|
|
15018
|
+
const heroPath = `/vip/${token}`;
|
|
15019
|
+
const go = useCallback((to) => {
|
|
15020
|
+
if (navigate) navigate(to);
|
|
15021
|
+
else window.location.assign(to);
|
|
15022
|
+
}, [navigate]);
|
|
15023
|
+
const fallback = useMemo(() => loaded.product ? heroFromProduct(loaded.product, t("See more")) : null, [loaded.product, t]);
|
|
14997
15024
|
const claim = useCallback(async (variantSku) => {
|
|
14998
15025
|
try {
|
|
14999
15026
|
const current2 = await api.cart.get().catch(() => null);
|
|
@@ -15036,23 +15063,21 @@ function ActiveLanding({ token, invite }) {
|
|
|
15036
15063
|
toast2.show(t(treatmentFor(code).body), "critical");
|
|
15037
15064
|
}
|
|
15038
15065
|
}, [api, emit, invite.invite_ref, t, toast2, token]);
|
|
15039
|
-
if (
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15066
|
+
if (screen2 === "hero") {
|
|
15067
|
+
const hero2 = invite.hero ?? fallback;
|
|
15068
|
+
if (hero2) return jsx(VipHero, {
|
|
15069
|
+
hero: hero2,
|
|
15070
|
+
onContinue: () => go(productPath)
|
|
15043
15071
|
});
|
|
15044
|
-
}
|
|
15045
|
-
if (loaded.product) {
|
|
15072
|
+
} else if (loaded.product) {
|
|
15046
15073
|
return jsx(ProductDetail, {
|
|
15047
15074
|
product: loaded.product,
|
|
15048
15075
|
inventory: loaded.inventory,
|
|
15049
15076
|
claim,
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
})
|
|
15055
|
-
} : {}
|
|
15077
|
+
breadcrumb: jsx(VipBreadcrumb, {
|
|
15078
|
+
title: loaded.product.title,
|
|
15079
|
+
onHome: () => go(heroPath)
|
|
15080
|
+
})
|
|
15056
15081
|
}, loaded.product.sku);
|
|
15057
15082
|
}
|
|
15058
15083
|
if (loaded.loading) return jsx(ScreenSkeleton, {
|
|
@@ -4993,7 +4993,7 @@ function requireErrors$1() {
|
|
|
4993
4993
|
});
|
|
4994
4994
|
exports.ErrorResponse = exports.ApiErrorBody = exports.ERROR_CODE_STATUS = exports.ErrorCode = void 0;
|
|
4995
4995
|
const zod_1 = requireZod();
|
|
4996
|
-
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
4996
|
+
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
4997
4997
|
exports.ERROR_CODE_STATUS = {
|
|
4998
4998
|
invalid_request: 400,
|
|
4999
4999
|
unauthorized: 401,
|
|
@@ -5010,6 +5010,7 @@ function requireErrors$1() {
|
|
|
5010
5010
|
vip_invite_not_found: 404,
|
|
5011
5011
|
vip_cart_conflict: 409,
|
|
5012
5012
|
vip_invite_mismatch: 409,
|
|
5013
|
+
vip_hero_missing: 422,
|
|
5013
5014
|
size_chart_not_found: 404,
|
|
5014
5015
|
forbidden: 403,
|
|
5015
5016
|
invalid_transition: 409,
|
|
@@ -14142,7 +14143,7 @@ function requireErrors() {
|
|
|
14142
14143
|
});
|
|
14143
14144
|
exports.ErrorResponse = exports.ApiErrorBody = exports.ERROR_CODE_STATUS = exports.ErrorCode = void 0;
|
|
14144
14145
|
const zod_1 = requireZod();
|
|
14145
|
-
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
14146
|
+
exports.ErrorCode = zod_1.z.enum(["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", "vip_invite_not_found", "vip_cart_conflict", "vip_invite_mismatch", "vip_hero_missing", "size_chart_not_found", "forbidden", "invalid_transition", "rate_limited", "server_error"]);
|
|
14146
14147
|
exports.ERROR_CODE_STATUS = {
|
|
14147
14148
|
invalid_request: 400,
|
|
14148
14149
|
unauthorized: 401,
|
|
@@ -14159,6 +14160,7 @@ function requireErrors() {
|
|
|
14159
14160
|
vip_invite_not_found: 404,
|
|
14160
14161
|
vip_cart_conflict: 409,
|
|
14161
14162
|
vip_invite_mismatch: 409,
|
|
14163
|
+
vip_hero_missing: 422,
|
|
14162
14164
|
size_chart_not_found: 404,
|
|
14163
14165
|
forbidden: 403,
|
|
14164
14166
|
invalid_transition: 409,
|
|
@@ -14902,7 +14904,7 @@ function locatorOf(segment) {
|
|
|
14902
14904
|
return null;
|
|
14903
14905
|
}
|
|
14904
14906
|
const INVALID_LINK = /* @__PURE__ */ new Set(["invalid_request", "vip_invite_not_found", "vip_invite_mismatch"]);
|
|
14905
|
-
function VipLandingView({ token, onUnavailable }) {
|
|
14907
|
+
function VipLandingView({ token, onUnavailable, screen: screen2 = "hero" }) {
|
|
14906
14908
|
const t = useT();
|
|
14907
14909
|
const { api, emit } = useShop();
|
|
14908
14910
|
const locator = locatorOf(token);
|
|
@@ -14982,18 +14984,43 @@ function VipLandingView({ token, onUnavailable }) {
|
|
|
14982
14984
|
}
|
|
14983
14985
|
return jsx(ActiveLanding, {
|
|
14984
14986
|
token,
|
|
14985
|
-
invite
|
|
14987
|
+
invite,
|
|
14988
|
+
screen: screen2
|
|
14986
14989
|
});
|
|
14987
14990
|
}
|
|
14988
|
-
function
|
|
14991
|
+
function plainFirstLine(description2) {
|
|
14992
|
+
if (!description2) return null;
|
|
14993
|
+
const line2 = description2.replace(/<[^>]*>/g, " ").split(/\n+/).map((l) => l.replace(/\s+/g, " ").trim()).find((l) => l.length > 0);
|
|
14994
|
+
if (!line2) return null;
|
|
14995
|
+
const sentence = /^.*?[.!?](?=\s|$)/.exec(line2);
|
|
14996
|
+
return sentence ? sentence[0] : line2;
|
|
14997
|
+
}
|
|
14998
|
+
function heroFromProduct(product, ctaLabel) {
|
|
14999
|
+
const image2 = product.media[0] ?? null;
|
|
15000
|
+
return {
|
|
15001
|
+
image: image2,
|
|
15002
|
+
desktop_image: image2,
|
|
15003
|
+
headline: product.title,
|
|
15004
|
+
body: plainFirstLine(product.description),
|
|
15005
|
+
cta_label: ctaLabel
|
|
15006
|
+
};
|
|
15007
|
+
}
|
|
15008
|
+
function ActiveLanding({ token, invite, screen: screen2 }) {
|
|
14989
15009
|
const t = useT();
|
|
14990
15010
|
const toast2 = useToast();
|
|
14991
15011
|
const { api, emit } = useShop();
|
|
14992
|
-
const
|
|
15012
|
+
const navigate = useNavigate();
|
|
14993
15013
|
const sku = invite.items[0]?.product_sku ?? "";
|
|
14994
15014
|
const loaded = useProduct(sku, {
|
|
14995
15015
|
showRecommendations: false
|
|
14996
15016
|
});
|
|
15017
|
+
const productPath = `/vip/${token}/product`;
|
|
15018
|
+
const heroPath = `/vip/${token}`;
|
|
15019
|
+
const go = useCallback((to) => {
|
|
15020
|
+
if (navigate) navigate(to);
|
|
15021
|
+
else window.location.assign(to);
|
|
15022
|
+
}, [navigate]);
|
|
15023
|
+
const fallback = useMemo(() => loaded.product ? heroFromProduct(loaded.product, t("See more")) : null, [loaded.product, t]);
|
|
14997
15024
|
const claim = useCallback(async (variantSku) => {
|
|
14998
15025
|
try {
|
|
14999
15026
|
const current2 = await api.cart.get().catch(() => null);
|
|
@@ -15036,23 +15063,21 @@ function ActiveLanding({ token, invite }) {
|
|
|
15036
15063
|
toast2.show(t(treatmentFor(code).body), "critical");
|
|
15037
15064
|
}
|
|
15038
15065
|
}, [api, emit, invite.invite_ref, t, toast2, token]);
|
|
15039
|
-
if (
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15066
|
+
if (screen2 === "hero") {
|
|
15067
|
+
const hero2 = invite.hero ?? fallback;
|
|
15068
|
+
if (hero2) return jsx(VipHero, {
|
|
15069
|
+
hero: hero2,
|
|
15070
|
+
onContinue: () => go(productPath)
|
|
15043
15071
|
});
|
|
15044
|
-
}
|
|
15045
|
-
if (loaded.product) {
|
|
15072
|
+
} else if (loaded.product) {
|
|
15046
15073
|
return jsx(ProductDetail, {
|
|
15047
15074
|
product: loaded.product,
|
|
15048
15075
|
inventory: loaded.inventory,
|
|
15049
15076
|
claim,
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
})
|
|
15055
|
-
} : {}
|
|
15077
|
+
breadcrumb: jsx(VipBreadcrumb, {
|
|
15078
|
+
title: loaded.product.title,
|
|
15079
|
+
onHome: () => go(heroPath)
|
|
15080
|
+
})
|
|
15056
15081
|
}, loaded.product.sku);
|
|
15057
15082
|
}
|
|
15058
15083
|
if (loaded.loading) return jsx(ScreenSkeleton, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nok-integration/storefront-react",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.4",
|
|
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",
|