@amboras-dev/storefront-core 2026.11.2 → 2026.11.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +34 -3
  3. package/bin/amboras-check.mjs +2 -1
  4. package/bin/checks/check-proxy-matcher.mjs +112 -0
  5. package/core-manifest.json +26 -1
  6. package/dist/config/index.d.ts +7 -3
  7. package/dist/config/index.d.ts.map +1 -1
  8. package/dist/config/index.js +33 -19
  9. package/dist/config/index.js.map +1 -1
  10. package/dist/entries/client.d.ts +2 -1
  11. package/dist/entries/client.d.ts.map +1 -1
  12. package/dist/entries/client.js +1 -1
  13. package/dist/entries/client.js.map +1 -1
  14. package/dist/entries/server.d.ts +1 -1
  15. package/dist/entries/server.d.ts.map +1 -1
  16. package/dist/entries/server.js +1 -1
  17. package/dist/entries/server.js.map +1 -1
  18. package/dist/hooks/use-auth.d.ts +12 -3
  19. package/dist/hooks/use-auth.d.ts.map +1 -1
  20. package/dist/hooks/use-auth.js +41 -36
  21. package/dist/hooks/use-auth.js.map +1 -1
  22. package/dist/hooks/use-brand.d.ts +8 -0
  23. package/dist/hooks/use-brand.d.ts.map +1 -1
  24. package/dist/hooks/use-brand.js +2 -26
  25. package/dist/hooks/use-brand.js.map +1 -1
  26. package/dist/hooks/use-cart.d.ts +4 -1
  27. package/dist/hooks/use-cart.d.ts.map +1 -1
  28. package/dist/hooks/use-cart.js +33 -38
  29. package/dist/hooks/use-cart.js.map +1 -1
  30. package/dist/hooks/use-email-language.d.ts +10 -0
  31. package/dist/hooks/use-email-language.d.ts.map +1 -0
  32. package/dist/hooks/use-email-language.js +60 -0
  33. package/dist/hooks/use-email-language.js.map +1 -0
  34. package/dist/hooks/use-express-checkout.d.ts +3 -1
  35. package/dist/hooks/use-express-checkout.d.ts.map +1 -1
  36. package/dist/hooks/use-express-checkout.js +4 -0
  37. package/dist/hooks/use-express-checkout.js.map +1 -1
  38. package/dist/hooks/use-listing-params.d.ts +3 -1
  39. package/dist/hooks/use-listing-params.d.ts.map +1 -1
  40. package/dist/hooks/use-listing-params.js +4 -0
  41. package/dist/hooks/use-listing-params.js.map +1 -1
  42. package/dist/hooks/use-marketing-opt-in.d.ts +2 -0
  43. package/dist/hooks/use-marketing-opt-in.d.ts.map +1 -1
  44. package/dist/hooks/use-marketing-opt-in.js +3 -4
  45. package/dist/hooks/use-marketing-opt-in.js.map +1 -1
  46. package/dist/hooks/use-payment-methods-config.d.ts +3 -1
  47. package/dist/hooks/use-payment-methods-config.d.ts.map +1 -1
  48. package/dist/hooks/use-payment-methods-config.js +4 -0
  49. package/dist/hooks/use-payment-methods-config.js.map +1 -1
  50. package/dist/hooks/use-payment-providers.d.ts +2 -1
  51. package/dist/hooks/use-payment-providers.d.ts.map +1 -1
  52. package/dist/hooks/use-payment-providers.js +4 -0
  53. package/dist/hooks/use-payment-providers.js.map +1 -1
  54. package/dist/hooks/use-region.d.ts +3 -1
  55. package/dist/hooks/use-region.d.ts.map +1 -1
  56. package/dist/hooks/use-region.js +4 -0
  57. package/dist/hooks/use-region.js.map +1 -1
  58. package/dist/hooks/use-stripe-error-copy.d.ts +3 -1
  59. package/dist/hooks/use-stripe-error-copy.d.ts.map +1 -1
  60. package/dist/hooks/use-stripe-error-copy.js +4 -0
  61. package/dist/hooks/use-stripe-error-copy.js.map +1 -1
  62. package/dist/hooks/use-subscription-cart.d.ts.map +1 -1
  63. package/dist/hooks/use-subscription-cart.js +2 -19
  64. package/dist/hooks/use-subscription-cart.js.map +1 -1
  65. package/dist/lib/auth/sign-in-code.d.ts +30 -0
  66. package/dist/lib/auth/sign-in-code.d.ts.map +1 -0
  67. package/dist/lib/auth/sign-in-code.js +70 -0
  68. package/dist/lib/auth/sign-in-code.js.map +1 -0
  69. package/dist/lib/brand.d.ts +90 -0
  70. package/dist/lib/brand.d.ts.map +1 -1
  71. package/dist/lib/brand.js +42 -0
  72. package/dist/lib/brand.js.map +1 -1
  73. package/dist/lib/cart/create-cart.d.ts +6 -0
  74. package/dist/lib/cart/create-cart.d.ts.map +1 -0
  75. package/dist/lib/cart/create-cart.js +49 -0
  76. package/dist/lib/cart/create-cart.js.map +1 -0
  77. package/dist/lib/locale.d.ts +10 -0
  78. package/dist/lib/locale.d.ts.map +1 -0
  79. package/dist/lib/locale.js +59 -0
  80. package/dist/lib/locale.js.map +1 -0
  81. package/dist/lib/utils/safe-redirect.d.ts +0 -21
  82. package/dist/lib/utils/safe-redirect.d.ts.map +1 -1
  83. package/dist/lib/utils/safe-redirect.js +12 -8
  84. package/dist/lib/utils/safe-redirect.js.map +1 -1
  85. package/dist/lib/utils/within.d.ts +3 -0
  86. package/dist/lib/utils/within.d.ts.map +1 -0
  87. package/dist/lib/utils/within.js +14 -0
  88. package/dist/lib/utils/within.js.map +1 -0
  89. package/dist/shell/core-provider.d.ts +4 -1
  90. package/dist/shell/core-provider.d.ts.map +1 -1
  91. package/dist/shell/core-provider.js +11 -8
  92. package/dist/shell/core-provider.js.map +1 -1
  93. package/dist/shell/overrides.d.ts +30 -0
  94. package/dist/shell/overrides.d.ts.map +1 -0
  95. package/dist/shell/overrides.js +11 -0
  96. package/dist/shell/overrides.js.map +1 -0
  97. package/package.json +2 -2
@@ -0,0 +1,6 @@
1
+ import type { QueryClient } from '@tanstack/react-query';
2
+ import { getMedusaClient } from '../medusa-client.js';
3
+ export type StoreCart = Awaited<ReturnType<ReturnType<typeof getMedusaClient>['store']['cart']['create']>>['cart'];
4
+ export declare function getCartId(): string | null;
5
+ export declare function createCartOnce(queryClient: QueryClient): Promise<StoreCart>;
6
+ //# sourceMappingURL=create-cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-cart.d.ts","sourceRoot":"","sources":["../../../src/lib/cart/create-cart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAIrD,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAElH,wBAAgB,SAAS,IAAI,MAAM,GAAG,IAAI,CAGzC;AAoCD,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAO3E"}
@@ -0,0 +1,49 @@
1
+ import { getMedusaClient } from '../medusa-client.js';
2
+ import { newCartLocale } from '../locale.js';
3
+ import { MAIN_CART_KEY } from './main-cart.js';
4
+ export function getCartId() {
5
+ if (typeof window === 'undefined')
6
+ return null;
7
+ return localStorage.getItem(MAIN_CART_KEY);
8
+ }
9
+ /** Creates the shopper's cart in the store's first region and remembers it. */
10
+ async function createCart(queryClient) {
11
+ const [regionsResponse, locale] = await Promise.all([
12
+ getMedusaClient().store.region.list(),
13
+ newCartLocale(queryClient),
14
+ ]);
15
+ const regionId = regionsResponse.regions[0]?.id;
16
+ if (!regionId) {
17
+ throw new Error('No region found');
18
+ }
19
+ try {
20
+ const response = await getMedusaClient().store.cart.create({
21
+ region_id: regionId,
22
+ locale,
23
+ });
24
+ const newCart = response.cart;
25
+ if (typeof window !== 'undefined')
26
+ localStorage.setItem(MAIN_CART_KEY, newCart.id);
27
+ return newCart;
28
+ }
29
+ catch (error) {
30
+ if (error instanceof Error && error.message.includes('sales channel')) {
31
+ console.error('Cart creation failed: Multiple sales channels associated with API key');
32
+ console.error('Please configure NEXT_PUBLIC_SALES_CHANNEL_ID in .env.local');
33
+ throw new Error('Cart creation requires sales channel configuration. See console for details.');
34
+ }
35
+ throw error;
36
+ }
37
+ }
38
+ // Shared by every cart path: one cart id key per origin, so one promise.
39
+ // Client-only: on the server it would be shared across requests.
40
+ let cartCreation = null;
41
+ export function createCartOnce(queryClient) {
42
+ if (!cartCreation) {
43
+ cartCreation = createCart(queryClient).finally(() => {
44
+ cartCreation = null;
45
+ });
46
+ }
47
+ return cartCreation;
48
+ }
49
+ //# sourceMappingURL=create-cart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-cart.js","sourceRoot":"","sources":["../../../src/lib/cart/create-cart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C,MAAM,UAAU,SAAS;IACvB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAC9C,OAAO,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AAC5C,CAAC;AAED,+EAA+E;AAC/E,KAAK,UAAU,UAAU,CAAC,WAAwB;IAChD,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClD,eAAe,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;QACrC,aAAa,CAAC,WAAW,CAAC;KAC3B,CAAC,CAAA;IACF,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAE/C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;IACpC,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YACzD,SAAS,EAAE,QAAQ;YACnB,MAAM;SACP,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAA;QAC7B,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;QAClF,OAAO,OAAO,CAAA;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YACtE,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAA;YACtF,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAC5E,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;QACjG,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,iEAAiE;AACjE,IAAI,YAAY,GAA8B,IAAI,CAAA;AAElD,MAAM,UAAU,cAAc,CAAC,WAAwB;IACrD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YAClD,YAAY,GAAG,IAAI,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { QueryClient } from '@tanstack/react-query';
2
+ import { type StoreLanguages } from './brand.js';
3
+ /** Only the checkout select may pass `acceptLanguages`: never pick a language the shopper was not shown. */
4
+ export declare function activeLocale(languages: StoreLanguages, cookie: string | null, acceptLanguages?: readonly string[]): string;
5
+ export declare function readLocaleCookie(): string | null;
6
+ export declare function writeLocaleCookie(locale: string): void;
7
+ export declare function languageName(tag: string): string;
8
+ /** Undefined if the languages are not read in time: Medusa then uses the store default. */
9
+ export declare function newCartLocale(queryClient: QueryClient): Promise<string | undefined>;
10
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/lib/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAS5D,4GAA4G;AAC5G,wBAAgB,YAAY,CAC1B,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,eAAe,GAAE,SAAS,MAAM,EAAO,GACtC,MAAM,CASR;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAYhD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAItD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED,2FAA2F;AAC3F,wBAAsB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAOzF"}
@@ -0,0 +1,59 @@
1
+ import { brandQuery } from './brand.js';
2
+ import { within } from './utils/within.js';
3
+ const LOCALE_COOKIE = 'amb_locale';
4
+ const LOCALE_COOKIE_MAX_AGE = 31536000; // 1 year in seconds
5
+ const BRAND_WAIT_MS = 1000;
6
+ const primary = (tag) => tag.split('-')[0].toLowerCase();
7
+ /** Only the checkout select may pass `acceptLanguages`: never pick a language the shopper was not shown. */
8
+ export function activeLocale(languages, cookie, acceptLanguages = []) {
9
+ if (cookie && languages.enabled.includes(cookie))
10
+ return cookie;
11
+ for (const tag of acceptLanguages) {
12
+ const match = languages.enabled.find((enabled) => enabled.toLowerCase() === tag.toLowerCase()) ??
13
+ languages.enabled.find((enabled) => primary(enabled) === primary(tag));
14
+ if (match)
15
+ return match;
16
+ }
17
+ return languages.default;
18
+ }
19
+ export function readLocaleCookie() {
20
+ if (typeof document === 'undefined')
21
+ return null;
22
+ const value = document.cookie
23
+ .split('; ')
24
+ .find((cookie) => cookie.startsWith(`${LOCALE_COOKIE}=`))
25
+ ?.slice(LOCALE_COOKIE.length + 1);
26
+ if (!value)
27
+ return null;
28
+ try {
29
+ return decodeURIComponent(value);
30
+ }
31
+ catch {
32
+ return null;
33
+ }
34
+ }
35
+ export function writeLocaleCookie(locale) {
36
+ if (typeof document === 'undefined')
37
+ return;
38
+ const secure = window.location.protocol === 'https:' ? '; Secure' : '';
39
+ document.cookie = `${LOCALE_COOKIE}=${encodeURIComponent(locale)}; path=/; SameSite=Lax; max-age=${LOCALE_COOKIE_MAX_AGE}${secure}`;
40
+ }
41
+ export function languageName(tag) {
42
+ try {
43
+ return new Intl.DisplayNames([tag], { type: 'language' }).of(tag) ?? tag;
44
+ }
45
+ catch {
46
+ return tag;
47
+ }
48
+ }
49
+ /** Undefined if the languages are not read in time: Medusa then uses the store default. */
50
+ export async function newCartLocale(queryClient) {
51
+ try {
52
+ const brand = await within(queryClient.fetchQuery({ ...brandQuery, retry: false }), BRAND_WAIT_MS);
53
+ return brand && activeLocale(brand.languages, readLocaleCookie());
54
+ }
55
+ catch {
56
+ return undefined;
57
+ }
58
+ }
59
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/lib/locale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,aAAa,GAAG,YAAY,CAAA;AAClC,MAAM,qBAAqB,GAAG,QAAQ,CAAA,CAAC,oBAAoB;AAC3D,MAAM,aAAa,GAAG,IAAI,CAAA;AAE1B,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AAEhE,4GAA4G;AAC5G,MAAM,UAAU,YAAY,CAC1B,SAAyB,EACzB,MAAqB,EACrB,kBAAqC,EAAE;IAEvC,IAAI,MAAM,IAAI,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAA;IAC/D,K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,mCAAmC,qBAAqB,GAAG,MAAM,EAAE,CAAA;AACrI,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,CAAA;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;AACH,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAwB;IAC1D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,CAAC,CAAA;QAClG,OAAO,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAA;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -1,23 +1,2 @@
1
- /**
2
- * Sanitises a `?redirect=` query param before handing it to `router.push()`.
3
- *
4
- * Without validation, a phishing link of the form
5
- * /auth/login?email=victim@x.com&redirect=https://evil.tld/reset
6
- * would bounce the buyer to `evil.tld` the moment they successfully log in.
7
- * Protocol-relative URLs (`//evil.tld/…`) do the same thing because the
8
- * browser fills in the current scheme and follows.
9
- *
10
- * Only same-origin relative paths are safe. This helper returns the input if
11
- * it's a plain path (`/foo/bar`) and falls back to `/account` otherwise.
12
- *
13
- * Rejections (all fall back to `/account`):
14
- * - Absolute URLs: `https://evil.tld/…`, `http://evil.tld/…`
15
- * - Protocol-relative: `//evil.tld/…`
16
- * - Any non-string / empty value
17
- * - Paths that don't start with `/`
18
- *
19
- * If we ever add a whitelist of external redirect targets (e.g. our own
20
- * marketing site), extend this helper — never bypass it inline.
21
- */
22
1
  export declare function safeRedirect(raw: unknown, fallback?: string): string;
23
2
  //# sourceMappingURL=safe-redirect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe-redirect.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/safe-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,SAAa,GAAG,MAAM,CAKxE"}
1
+ {"version":3,"file":"safe-redirect.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/safe-redirect.ts"],"names":[],"mappings":"AAsBA,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,SAAa,GAAG,MAAM,CAUxE"}
@@ -7,25 +7,29 @@
7
7
  * Protocol-relative URLs (`//evil.tld/…`) do the same thing because the
8
8
  * browser fills in the current scheme and follows.
9
9
  *
10
- * Only same-origin relative paths are safe. This helper returns the input if
11
- * it's a plain path (`/foo/bar`) and falls back to `/account` otherwise.
10
+ * Only same-origin relative paths are safe; the value is resolved as a browser would.
12
11
  *
13
12
  * Rejections (all fall back to `/account`):
14
13
  * - Absolute URLs: `https://evil.tld/…`, `http://evil.tld/…`
15
- * - Protocol-relative: `//evil.tld/…`
14
+ * - Protocol-relative, even after normalising or decoding: `/\evil.tld`, `/%2F/evil.tld`
16
15
  * - Any non-string / empty value
17
16
  * - Paths that don't start with `/`
18
17
  *
19
18
  * If we ever add a whitelist of external redirect targets (e.g. our own
20
19
  * marketing site), extend this helper — never bypass it inline.
21
20
  */
21
+ const SAME_ORIGIN = 'https://same-origin.invalid';
22
22
  export function safeRedirect(raw, fallback = '/account') {
23
- if (typeof raw !== 'string' || raw.length === 0)
23
+ if (typeof raw !== 'string' || !raw.startsWith('/'))
24
24
  return fallback;
25
- if (!raw.startsWith('/'))
25
+ let url;
26
+ try {
27
+ url = new URL(raw, SAME_ORIGIN);
28
+ }
29
+ catch {
26
30
  return fallback;
27
- if (raw.startsWith('//'))
28
- return fallback;
29
- return raw;
31
+ }
32
+ const path = `${url.pathname}${url.search}${url.hash}`;
33
+ return url.origin === SAME_ORIGIN && !/^\/(?:\/|%2f|%5c)/i.test(path) ? path : fallback;
30
34
  }
31
35
  //# sourceMappingURL=safe-redirect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe-redirect.js","sourceRoot":"","sources":["../../../src/lib/utils/safe-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,QAAQ,GAAG,UAAU;IAC9D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAA;IAChE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAA;IACzC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAA;IACzC,OAAO,GAAG,CAAA;AACZ,CAAC"}
1
+ {"version":3,"file":"safe-redirect.js","sourceRoot":"","sources":["../../../src/lib/utils/safe-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,GAAG,6BAA6B,CAAA;AAEjD,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,QAAQ,GAAG,UAAU;IAC9D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAA;IACpE,IAAI,GAAQ,CAAA;IACZ,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IACtD,OAAO,GAAG,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;AACzF,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** `promise`'s value, or `undefined` if `ms` passes first. */
2
+ export declare function within<T>(promise: Promise<T>, ms: number): Promise<T | undefined>;
3
+ //# sourceMappingURL=within.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"within.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/within.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wBAAsB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAUvF"}
@@ -0,0 +1,14 @@
1
+ /** `promise`'s value, or `undefined` if `ms` passes first. */
2
+ export async function within(promise, ms) {
3
+ let timer;
4
+ try {
5
+ return await Promise.race([
6
+ promise,
7
+ new Promise((resolve) => (timer = setTimeout(() => resolve(undefined), ms))),
8
+ ]);
9
+ }
10
+ finally {
11
+ clearTimeout(timer);
12
+ }
13
+ }
14
+ //# sourceMappingURL=within.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"within.js","sourceRoot":"","sources":["../../../src/lib/utils/within.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,MAAM,CAAI,OAAmB,EAAE,EAAU;IAC7D,IAAI,KAAgD,CAAA;IACpD,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC;YACxB,OAAO;YACP,IAAI,OAAO,CAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SACxF,CAAC,CAAA;IACJ,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;AACH,CAAC"}
@@ -2,6 +2,7 @@ import { QueryClient } from '@tanstack/react-query';
2
2
  import { type ReactNode } from 'react';
3
3
  import { type PaymentUiComponents } from '../lib/payment-providers/ui.js';
4
4
  import type { PluginConfigs, PluginRegistry } from '../types/plugins.js';
5
+ import { type CoreHookOverrides } from './overrides.js';
5
6
  export interface CoreProviderProps {
6
7
  children: ReactNode;
7
8
  /** The store's generated registry (app/_generated/plugin-registry). Injected, never imported by core. */
@@ -12,6 +13,8 @@ export interface CoreProviderProps {
12
13
  paymentUi?: Partial<PaymentUiComponents>;
13
14
  /** Bring your own QueryClient (tests, or a store that already owns one). */
14
15
  queryClient?: QueryClient;
16
+ /** Overrides of the hooks core calls itself; read once, on the first render. */
17
+ overrides?: CoreHookOverrides;
15
18
  }
16
19
  /**
17
20
  * Everything core's client hooks need: the TanStack Query client, the plugin
@@ -19,5 +22,5 @@ export interface CoreProviderProps {
19
22
  * providers (theme, motion) wrap or sit inside it in the store's
20
23
  * app/providers.tsx.
21
24
  */
22
- export declare function CoreProvider({ children, registry, pluginConfigs, paymentUi, queryClient }: CoreProviderProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function CoreProvider({ children, registry, pluginConfigs, paymentUi, queryClient, overrides, }: CoreProviderProps): import("react/jsx-runtime").JSX.Element;
23
26
  //# sourceMappingURL=core-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-provider.d.ts","sourceRoot":"","sources":["../../src/shell/core-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM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;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,aAAkB,EAClB,SAAS,EACT,WAAW,EACX,SAAS,GACV,EAAE,iBAAiB,2CAyBnB"}
@@ -1,9 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
- import { useState } from 'react';
4
+ import { useRef, useState } from 'react';
5
5
  import { PaymentUiProvider } from '../lib/payment-providers/ui.js';
6
6
  import { PluginRegistryContext } from './registry-context.js';
7
+ import { CoreOverridesContext } from './overrides.js';
7
8
  function makeQueryClient() {
8
9
  return new QueryClient({
9
10
  defaultOptions: {
@@ -26,13 +27,15 @@ function makeQueryClient() {
26
27
  * providers (theme, motion) wrap or sit inside it in the store's
27
28
  * app/providers.tsx.
28
29
  */
29
- export function CoreProvider({ children, registry, pluginConfigs = {}, paymentUi, queryClient }) {
30
+ export function CoreProvider({ children, registry, pluginConfigs = {}, paymentUi, queryClient, overrides, }) {
30
31
  const [client] = useState(() => queryClient ?? makeQueryClient());
31
- return (_jsx(QueryClientProvider, { client: client, children: _jsx(PluginRegistryContext.Provider, { value: registry, children: _jsxs(PaymentUiProvider, { components: paymentUi, children: [registry.rootProviders.map(({ id, Component, propsFromConfig = {} }) => {
32
- if (pluginConfigs[id]?.enabled === false)
33
- return null;
34
- const props = Object.fromEntries(Object.entries(propsFromConfig).map(([k, cfgKey]) => [k, pluginConfigs[id]?.[cfgKey]]));
35
- return _jsx(Component, { ...props }, id);
36
- }), children] }) }) }));
32
+ // Frozen: a changed override would change which hooks run.
33
+ const hookOverrides = useRef(overrides ?? null).current;
34
+ return (_jsx(QueryClientProvider, { client: client, children: _jsx(CoreOverridesContext.Provider, { value: hookOverrides, children: _jsx(PluginRegistryContext.Provider, { value: registry, children: _jsxs(PaymentUiProvider, { components: paymentUi, children: [registry.rootProviders.map(({ id, Component, propsFromConfig = {} }) => {
35
+ if (pluginConfigs[id]?.enabled === false)
36
+ return null;
37
+ const props = Object.fromEntries(Object.entries(propsFromConfig).map(([k, cfgKey]) => [k, pluginConfigs[id]?.[cfgKey]]));
38
+ return _jsx(Component, { ...props }, id);
39
+ }), children] }) }) }) }));
37
40
  }
38
41
  //# sourceMappingURL=core-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-provider.js","sourceRoot":"","sources":["../../src/shell/core-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,gCAAgC,CAAA;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAc7D,SAAS,eAAe;IACtB,OAAO,IAAI,WAAW,CAAC;QACrB,cAAc,EAAE;YACd,OAAO,EAAE;gBACP,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;gBACxB,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;gBACtB,oBAAoB,EAAE,KAAK;gBAC3B,kBAAkB,EAAE,KAAK;gBACzB,KAAK,EAAE,CAAC;aACT;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,CAAC;aACT;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,EAAqB;IAChH,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,WAAW,IAAI,eAAe,EAAE,CAAC,CAAA;IAEjE,OAAO,CACL,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,YACjC,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAA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ACS,GACW,GACH,GACZ,CACvB,CAAA;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { useAuth } from '../hooks/use-auth.js';
2
+ import type { useCart } from '../hooks/use-cart.js';
3
+ import type { useExpressCheckout } from '../hooks/use-express-checkout.js';
4
+ import type { useListingParams } from '../hooks/use-listing-params.js';
5
+ import type { usePaymentMethodsConfig } from '../hooks/use-payment-methods-config.js';
6
+ import type { usePaymentProviders } from '../hooks/use-payment-providers.js';
7
+ import type { useRegion } from '../hooks/use-region.js';
8
+ import type { useStripeErrorCopy } from '../hooks/use-stripe-error-copy.js';
9
+ /** An override of hook `H`: itself a hook, given core's implementation as `base`. */
10
+ export type HookOverride<H extends (...args: any[]) => any> = (base: H, ...args: Parameters<H>) => ReturnType<H>;
11
+ /** The hooks core calls itself, and so the only ones that need an override here. */
12
+ export interface CoreHookOverrides {
13
+ useAuth?: HookOverride<typeof useAuth>;
14
+ useCart?: HookOverride<typeof useCart>;
15
+ useExpressCheckout?: HookOverride<typeof useExpressCheckout>;
16
+ useListingParams?: HookOverride<typeof useListingParams>;
17
+ usePaymentMethodsConfig?: HookOverride<typeof usePaymentMethodsConfig>;
18
+ usePaymentProviders?: HookOverride<typeof usePaymentProviders>;
19
+ useRegion?: HookOverride<typeof useRegion>;
20
+ useStripeErrorCopy?: HookOverride<typeof useStripeErrorCopy>;
21
+ }
22
+ /** Names of the overridable hooks. */
23
+ export type OverridableHook = keyof CoreHookOverrides;
24
+ /** Set by `<CoreProvider overrides>`. */
25
+ export declare const CoreOverridesContext: import("react").Context<CoreHookOverrides | null>;
26
+ type BaseOf<K extends OverridableHook> = NonNullable<CoreHookOverrides[K]> extends HookOverride<infer H> ? H : never;
27
+ /** Runs the store's override of `name` if there is one, else `base`. */
28
+ export declare function useOverridable<K extends OverridableHook>(name: K, base: BaseOf<K>, ...args: Parameters<BaseOf<K>>): ReturnType<BaseOf<K>>;
29
+ export {};
30
+ //# sourceMappingURL=overrides.d.ts.map
@@ -0,0 +1 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SAAS,CAAC,CAAA;IAC1C,kBAAkB,CAAC,EAAE,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAA;CAC7D;AAED,sCAAsC;AACtC,MAAM,MAAM,eAAe,GAAG,MAAM,iBAAiB,CAAA;AAErD,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,mDAAgD,CAAA;AAEjF,KAAK,MAAM,CAAC,CAAC,SAAS,eAAe,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEpH,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,CAAC,SAAS,eAAe,EACtD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EACf,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAC7B,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAGvB"}
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ // Core's hooks import each other directly, so a shim-level export can't reach them; this can.
3
+ import { createContext, useContext } from 'react';
4
+ /** Set by `<CoreProvider overrides>`. */
5
+ export const CoreOverridesContext = createContext(null);
6
+ /** Runs the store's override of `name` if there is one, else `base`. */
7
+ export function useOverridable(name, base, ...args) {
8
+ const override = useContext(CoreOverridesContext)?.[name];
9
+ return override ? override(base, ...args) : base(...args);
10
+ }
11
+ //# sourceMappingURL=overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/shell/overrides.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,8FAA8F;AAC9F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AA4BjD,yCAAyC;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAA;AAIjF,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAC5B,IAAO,EACP,IAAe,EACf,GAAG,IAA2B;IAE9B,MAAM,QAAQ,GAAG,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC,IAAI,CAAwC,CAAA;IAChG,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amboras-dev/storefront-core",
3
- "version": "2026.11.2",
3
+ "version": "2026.11.4",
4
4
  "description": "The platform half of every Amboras storefront: cart, checkout, payments, auth, orders, subscriptions, catalogue data, analytics, consent, plugin slots, edge proxy and the Next config. Stores keep only design; they import this. ESM, React 19, Next 16.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -102,7 +102,7 @@
102
102
  "@stripe/stripe-js": ">=8.11.0",
103
103
  "@tanstack/react-query": ">=5.17.19",
104
104
  "lucide-react": ">=1.0.1",
105
- "next": ">=16.3.6",
105
+ "next": ">=16.3.0",
106
106
  "posthog-js": ">=1.200.0",
107
107
  "react": ">=19.0.0",
108
108
  "react-dom": ">=19.0.0",