@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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2026.11.4
6
+
7
+ ### Changed
8
+
9
+ - The `next` peer range is now `>=16.3.0` (was `>=16.3.6`), so stores on Next 16.3.0 through 16.3.5 can adopt core without upgrading Next.
10
+
11
+ ## 2026.11.3
12
+
13
+ ### Breaking
14
+
15
+ - In production, a missing Medusa URL now throws `MissingMedusaUrlError` on the first config read
16
+ instead of falling back to `http://localhost:9000`. Development and tests keep the fallback.
17
+ - `configureCore` returns `void`; in 2026.11.1 and 2026.11.2 it returned the `CoreConfig`. A store
18
+ that uses the return value fails type-check on upgrade: call `getCoreConfig()` instead.
19
+
20
+ ### Fixes
21
+
22
+ - Lazy cart: concurrent adds, from one or several `useCart` instances or `useSubscriptionCart`, now
23
+ share one cart instead of each creating one. `lib/cart/create-cart` is the one creator.
24
+ - `safeRedirect` resolves the value as a browser would and refuses every form that leaves the site
25
+ (`/\evil.com`, `/<tab>/evil.com`, `/..//evil.com`, `/%5Cevil.com`), returning the resolved path.
26
+ - `<CoreProvider overrides>` is read once in a ref; the README says it must be stable.
27
+
28
+ ### Added
29
+
30
+ - `<CoreProvider overrides>`: override the hooks core calls itself (`useCart`, `useRegion`,
31
+ `useAuth`, `useListingParams`, `usePaymentProviders`, `usePaymentMethodsConfig`,
32
+ `useStripeErrorCopy`, `useExpressCheckout`). See the README.
33
+ - `amboras-check proxy-matcher`: fails when `proxy.ts`'s matcher differs from core's `proxyConfig`.
34
+ - Shopper email language (template #207): every new cart (`useCart`, `useSubscriptionCart`) sends
35
+ `locale`, the shopper's pick or the store default from `/store/brand` (one try, 1 s at most, else
36
+ none). `useCart().updateLocale` saves it (keepalive, never cached). New `useEmailLanguage()`
37
+ (`client/use-email-language`) drives the checkout select and its `flush`, and `lib/locale`
38
+ holds the helpers. `useBrand().brand` adds `languages`, `giftCardSendOn`, `emailLanguages` and
39
+ `signInCode`; `lib/brand` adds `brandQuery`, which both share, and `storeLanguages`.
40
+ - Sign in with an email code (template #207): `useAuth()` adds `requestSignInCode`,
41
+ `loginWithCode` and their pending flags; neither is retried. `lib/auth/sign-in-code` maps each
42
+ refusal to its copy and reads a 429's wait.
43
+ - `api/shim-exports.json`: the export names of every `client/*` and `lib/*` module.
44
+ `check:manifest` fails when one is removed or renamed.
45
+ - `lib/utils/within`: the one bounded wait. `FLUSH_BOUND_MS` is exported from
46
+ `client/use-marketing-opt-in`.
47
+
5
48
  ## 2026.11.2
6
49
 
7
50
  ### Release order
package/README.md CHANGED
@@ -34,6 +34,9 @@ configureCore({
34
34
 
35
35
  Core reads the config lazily, at call time, so module order does not matter.
36
36
 
37
+ In production, a missing Medusa URL throws `MissingMedusaUrlError` on the first config read.
38
+ Only development and tests fall back to `http://localhost:9000`.
39
+
37
40
  ### 2. Shims keep every import path
38
41
 
39
42
  Each file core owns stays in the store as a one-line re-export, so existing design files (AI-restyled
@@ -86,6 +89,31 @@ import { StripePaymentForm } from '@/components/checkout/stripe-payment-form'
86
89
  Payment plugins add an adapter with `registerPaymentProvider(config)` from
87
90
  `@amboras-dev/storefront-core/lib/payment-providers/registry`.
88
91
 
92
+ ### Overriding a hook
93
+
94
+ A local export next to a shim's `export *` only changes the store's own imports. Core's hooks
95
+ import each other directly, so to change a hook core itself calls, pass it to `CoreProvider`:
96
+
97
+ ```tsx
98
+ // app/providers.tsx. Module scope: overrides are read once.
99
+ const overrides: CoreHookOverrides = {
100
+ useCart: (base) => {
101
+ const cart = base()
102
+ return { ...cart /* … */ }
103
+ },
104
+ }
105
+
106
+ ;<CoreProvider registry={PLUGIN_REGISTRY} overrides={overrides}>
107
+ {children}
108
+ </CoreProvider>
109
+ ```
110
+
111
+ Overridable: `useCart`, `useRegion`, `useAuth`, `useListingParams`, `usePaymentProviders`,
112
+ `usePaymentMethodsConfig`, `useStripeErrorCopy`, `useExpressCheckout`. Every other hook is called
113
+ only by store code, so its shim is already the override. `/lib` functions are not overridable. An
114
+ override is a hook: call `base` on every render or on none. `overrides` is read once, on the first
115
+ render: keep it stable (module scope), since adding or removing one later would change hook order.
116
+
89
117
  ### 4. Next config and Tailwind
90
118
 
91
119
  ```js
@@ -154,6 +182,8 @@ export const config = {
154
182
  }
155
183
  ```
156
184
 
185
+ `amboras-check proxy-matcher` fails when the copy differs from the installed core's matcher.
186
+
157
187
  ### 6. Feature switches: unknown is not off
158
188
 
159
189
  `useStoreConfig()` (client) and `getStoreConfig()` (server) read Medusa's `GET /store/config`. Each
@@ -167,7 +197,7 @@ then falls back to `/store/checkout-settings`.
167
197
  ### 7. Build gates
168
198
 
169
199
  ```bash
170
- npx amboras-check # plugin slots, store quirks, redirect boundaries, consent scroll
200
+ npx amboras-check # plugin slots, store quirks, redirect boundaries, consent scroll, proxy matcher
171
201
  npx amboras-check slots # one gate
172
202
  ```
173
203
 
@@ -175,7 +205,7 @@ npx amboras-check slots # one gate
175
205
 
176
206
  | Entry | What | `"use client"` |
177
207
  | -------------------------- | --------------------------------------------------------------------------------------------- | -------------- |
178
- | `/client` | `CoreProvider`, `ClientPluginSlot`, payment UI injection, config | yes |
208
+ | `/client` | `CoreProvider` (registry, payment UI, hook overrides), `ClientPluginSlot`, config | yes |
179
209
  | `/client/<hook>` | one hook file, same exports as the template's | per file |
180
210
  | `/server` | `createPluginSlot`, `PluginSlot`, `getPluginConfigs`, `medusaFetch`, `getStoreConfig`, config | no |
181
211
  | `/lib/<path>` | logic modules (checkout, cart, payment providers, analytics, consent…) | per file |
@@ -191,6 +221,7 @@ npx amboras-check slots # one gate
191
221
  CalVer `YYYY.M.N` (`npm run version:next`). Plugins declare
192
222
  `peerDependencies['@amboras-dev/storefront-core']: '>=2026.11.0'`. Deprecated names stay exported
193
223
  for at least two minors. `api/*.api.md` is the public surface of `/client`, `/server` and
194
- `/next-config`; CI fails when it changes without the report being updated.
224
+ `/next-config`; CI fails when it changes without the report being updated. `api/shim-exports.json`
225
+ lists the export names behind `/client/*` and `/lib/*`; CI fails when one is removed or renamed.
195
226
 
196
227
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for development and release.
@@ -3,7 +3,7 @@
3
3
  //
4
4
  // amboras-check [gate…] [--root <dir>]
5
5
  //
6
- // Gates: slots, quirks, redirect-boundaries, consent-scroll (default: all).
6
+ // Gates: slots, quirks, redirect-boundaries, consent-scroll, proxy-matcher (default: all).
7
7
  // The store root defaults to the current directory. Each gate is a separate
8
8
  // node process, so a failing gate's exit code and output are its own.
9
9
  import { spawnSync } from 'node:child_process'
@@ -16,6 +16,7 @@ const GATES = {
16
16
  quirks: 'check-store-quirks.mjs',
17
17
  'redirect-boundaries': 'check-redirect-boundaries.mjs',
18
18
  'consent-scroll': 'check-consent-scroll.mjs',
19
+ 'proxy-matcher': 'check-proxy-matcher.mjs',
19
20
  }
20
21
 
21
22
  const args = process.argv.slice(2)
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ // Fails when the store's proxy.ts config.matcher differs from the installed core's proxyConfig.matcher.
3
+ import { existsSync, readFileSync, realpathSync } from 'node:fs'
4
+ import { fileURLToPath } from 'node:url'
5
+ import path from 'node:path'
6
+
7
+ const ROOT = process.env.AMBORAS_STORE_ROOT ? path.resolve(process.env.AMBORAS_STORE_ROOT) : process.cwd()
8
+ const STORE_FILES = ['proxy.ts', 'proxy.js', 'src/proxy.ts']
9
+
10
+ /** String literals of the `matcher: [ … ]` array after `anchor`, or null. */
11
+ export function extractMatcher(src, anchor = /\bmatcher\s*:\s*\[/) {
12
+ const m = anchor.exec(src)
13
+ if (!m) return null
14
+ const out = []
15
+ let i = m.index + m[0].length
16
+ let depth = 1
17
+ while (i < src.length) {
18
+ const c = src[i]
19
+ const next = src[i + 1]
20
+ if (c === '/' && next === '/') {
21
+ i = src.indexOf('\n', i)
22
+ if (i === -1) return null
23
+ continue
24
+ }
25
+ if (c === '/' && next === '*') {
26
+ i = src.indexOf('*/', i + 2)
27
+ if (i === -1) return null
28
+ i += 2
29
+ continue
30
+ }
31
+ if (c === "'" || c === '"' || c === '`') {
32
+ let j = i + 1
33
+ let value = ''
34
+ while (j < src.length && src[j] !== c) {
35
+ if (src[j] === '\\') {
36
+ value += src[j + 1]
37
+ j += 2
38
+ continue
39
+ }
40
+ if (c === '`' && src[j] === '$' && src[j + 1] === '{') return null
41
+ value += src[j]
42
+ j++
43
+ }
44
+ out.push(value)
45
+ i = j + 1
46
+ continue
47
+ }
48
+ if (c === '[') depth++
49
+ if (c === ']' && --depth === 0) return out
50
+ i++
51
+ }
52
+ return null
53
+ }
54
+
55
+ export function coreMatcher(src) {
56
+ return extractMatcher(src, /\bproxyConfig\s*=\s*\{\s*matcher\s*:\s*\[/)
57
+ }
58
+
59
+ export function storeMatcher(src) {
60
+ return extractMatcher(src, /\bexport\s+const\s+config\s*(?::[^=]+)?=\s*\{\s*matcher\s*:\s*\[/)
61
+ }
62
+
63
+ export function compare(store, core) {
64
+ const lines = []
65
+ const n = Math.max(store.length, core.length)
66
+ for (let k = 0; k < n; k++) {
67
+ if (store[k] === core[k]) continue
68
+ lines.push(` [${k}] store: ${JSON.stringify(store[k] ?? null)} core: ${JSON.stringify(core[k] ?? null)}`)
69
+ }
70
+ return lines
71
+ }
72
+
73
+ function main() {
74
+ const storeFile = STORE_FILES.find((f) => existsSync(path.join(ROOT, f)))
75
+ if (!storeFile) {
76
+ console.error(`[check-proxy-matcher] FAIL: no proxy file (${STORE_FILES.join(', ')}) in ${ROOT}.`)
77
+ process.exit(1)
78
+ }
79
+ const store = storeMatcher(readFileSync(path.join(ROOT, storeFile), 'utf8'))
80
+ if (!store) {
81
+ console.error(
82
+ `[check-proxy-matcher] FAIL: ${storeFile} has no static \`export const config = { matcher: [ … ] }\`.`,
83
+ )
84
+ process.exit(1)
85
+ }
86
+ const CORE_FILE = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'dist', 'edge', 'proxy.js')
87
+ const core = coreMatcher(readFileSync(CORE_FILE, 'utf8'))
88
+ if (!core) {
89
+ console.error(`[check-proxy-matcher] FAIL: could not read proxyConfig.matcher from ${CORE_FILE}.`)
90
+ process.exit(1)
91
+ }
92
+ const diff = compare(store, core)
93
+ if (diff.length) {
94
+ console.error(
95
+ `[check-proxy-matcher] FAIL: ${storeFile}'s matcher differs from core's proxyConfig.matcher.\n` +
96
+ diff.join('\n') +
97
+ "\n Copy core's proxyConfig.matcher (@amboras-dev/storefront-core/edge) into config.matcher verbatim.",
98
+ )
99
+ process.exit(1)
100
+ }
101
+ console.log(`[check-proxy-matcher] OK: ${storeFile} matches core's proxyConfig (${core.length} patterns).`)
102
+ console.log('[check-proxy-matcher] EXIT_OK')
103
+ }
104
+
105
+ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
106
+ try {
107
+ main()
108
+ } catch (err) {
109
+ console.error(`[check-proxy-matcher] FAIL: check crashed — ${err?.message ?? err}`)
110
+ process.exit(1)
111
+ }
112
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by scripts/build-manifest.mjs. Paths are relative to the storefront app root.",
3
3
  "package": "@amboras-dev/storefront-core",
4
- "version": "2026.11.2",
4
+ "version": "2026.11.4",
5
5
  "shims": [
6
6
  {
7
7
  "path": "hooks/use-auth.ts",
@@ -53,6 +53,11 @@
53
53
  "import": "@amboras-dev/storefront-core/client/use-digital-downloads",
54
54
  "kind": "reexport"
55
55
  },
56
+ {
57
+ "path": "hooks/use-email-language.ts",
58
+ "import": "@amboras-dev/storefront-core/client/use-email-language",
59
+ "kind": "reexport"
60
+ },
56
61
  {
57
62
  "path": "hooks/use-express-checkout-flow.ts",
58
63
  "import": "@amboras-dev/storefront-core/client/use-express-checkout-flow",
@@ -223,6 +228,11 @@
223
228
  "import": "@amboras-dev/storefront-core/lib/analytics",
224
229
  "kind": "reexport"
225
230
  },
231
+ {
232
+ "path": "lib/auth/sign-in-code.ts",
233
+ "import": "@amboras-dev/storefront-core/lib/auth/sign-in-code",
234
+ "kind": "reexport"
235
+ },
226
236
  {
227
237
  "path": "lib/brand.ts",
228
238
  "import": "@amboras-dev/storefront-core/lib/brand",
@@ -253,6 +263,11 @@
253
263
  "import": "@amboras-dev/storefront-core/lib/cart/cart-country",
254
264
  "kind": "reexport"
255
265
  },
266
+ {
267
+ "path": "lib/cart/create-cart.ts",
268
+ "import": "@amboras-dev/storefront-core/lib/cart/create-cart",
269
+ "kind": "reexport"
270
+ },
256
271
  {
257
272
  "path": "lib/cart/discount-total.ts",
258
273
  "import": "@amboras-dev/storefront-core/lib/cart/discount-total",
@@ -348,6 +363,11 @@
348
363
  "import": "@amboras-dev/storefront-core/lib/get-policies",
349
364
  "kind": "reexport"
350
365
  },
366
+ {
367
+ "path": "lib/locale.ts",
368
+ "import": "@amboras-dev/storefront-core/lib/locale",
369
+ "kind": "reexport"
370
+ },
351
371
  {
352
372
  "path": "lib/logger.ts",
353
373
  "import": "@amboras-dev/storefront-core/lib/logger",
@@ -518,6 +538,11 @@
518
538
  "import": "@amboras-dev/storefront-core/lib/utils/safe-redirect",
519
539
  "kind": "reexport"
520
540
  },
541
+ {
542
+ "path": "lib/utils/within.ts",
543
+ "import": "@amboras-dev/storefront-core/lib/utils/within",
544
+ "kind": "reexport"
545
+ },
521
546
  {
522
547
  "path": "lib/variant-extensions.ts",
523
548
  "import": "@amboras-dev/storefront-core/lib/variant-extensions",
@@ -16,13 +16,17 @@ export interface CoreConfig {
16
16
  debug?: boolean;
17
17
  }
18
18
  export type CoreConfigInput = Partial<CoreConfig>;
19
+ /** Thrown by config reads in production when no Medusa URL is configured. */
20
+ export declare class MissingMedusaUrlError extends Error {
21
+ constructor();
22
+ }
19
23
  /**
20
24
  * Sets the store configuration. Call it at module scope of the store's
21
25
  * lib/amboras.ts. Calling it again merges: unset values keep what an earlier
22
- * call (or the env fallback) gave.
26
+ * call (or the env fallback) gave. Never throws; a missing URL throws on first read.
23
27
  */
24
- export declare function configureCore(input: CoreConfigInput): CoreConfig;
25
- /** The active configuration: what configureCore set, else the env fallback. */
28
+ export declare function configureCore(input: CoreConfigInput): void;
29
+ /** The active configuration; throws {@link MissingMedusaUrlError} in production without a Medusa URL. */
26
30
  export declare function getCoreConfig(): CoreConfig;
27
31
  /** True once the store called configureCore (the version-floor check reads this in dev). */
28
32
  export declare function isCoreConfigured(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yFAAyF;IACzF,iBAAiB,C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AAyG;AACzG,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
@@ -10,7 +10,16 @@
10
10
  // so the order in which modules evaluate does not matter. The env fallback
11
11
  // keeps an unconfigured server render and the tests working; it is not the
12
12
  // contract.
13
- const DEFAULT_MEDUSA_URL = 'http://localhost:9000';
13
+ const DEV_MEDUSA_URL = 'http://localhost:9000';
14
+ /** Thrown by config reads in production when no Medusa URL is configured. */
15
+ export class MissingMedusaUrlError extends Error {
16
+ constructor() {
17
+ super('[storefront-core] No Medusa backend URL is configured. Set NEXT_PUBLIC_MEDUSA_BACKEND_URL ' +
18
+ 'for this build and pass it to configureCore({ medusaUrl }) in lib/amboras.ts. ' +
19
+ 'Only development falls back to http://localhost:9000.');
20
+ this.name = 'MissingMedusaUrlError';
21
+ }
22
+ }
14
23
  let configured = null;
15
24
  function clean(input) {
16
25
  const out = {};
@@ -36,33 +45,38 @@ function fromEnv() {
36
45
  googleMapsApiKey: env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY,
37
46
  });
38
47
  }
48
+ // Literal `process.env.NODE_ENV` so bundlers inline it; `process.env?.NODE_ENV` is not inlined.
49
+ function nodeEnv() {
50
+ try {
51
+ return process.env.NODE_ENV;
52
+ }
53
+ catch {
54
+ return undefined;
55
+ }
56
+ }
39
57
  function nodeEnvIsDevelopment() {
40
- return typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';
58
+ return nodeEnv() === 'development';
59
+ }
60
+ function resolve(input) {
61
+ if (!input.medusaUrl && nodeEnv() === 'production')
62
+ throw new MissingMedusaUrlError();
63
+ return {
64
+ ...input,
65
+ medusaUrl: stripSlash(input.medusaUrl ?? DEV_MEDUSA_URL),
66
+ debug: input.debug ?? nodeEnvIsDevelopment(),
67
+ };
41
68
  }
42
69
  /**
43
70
  * Sets the store configuration. Call it at module scope of the store's
44
71
  * lib/amboras.ts. Calling it again merges: unset values keep what an earlier
45
- * call (or the env fallback) gave.
72
+ * call (or the env fallback) gave. Never throws; a missing URL throws on first read.
46
73
  */
47
74
  export function configureCore(input) {
48
- const merged = { ...fromEnv(), ...(configured ?? {}), ...clean(input) };
49
- configured = {
50
- ...merged,
51
- medusaUrl: stripSlash(merged.medusaUrl ?? DEFAULT_MEDUSA_URL),
52
- debug: merged.debug ?? nodeEnvIsDevelopment(),
53
- };
54
- return configured;
75
+ configured = { ...fromEnv(), ...(configured ?? {}), ...clean(input) };
55
76
  }
56
- /** The active configuration: what configureCore set, else the env fallback. */
77
+ /** The active configuration; throws {@link MissingMedusaUrlError} in production without a Medusa URL. */
57
78
  export function getCoreConfig() {
58
- if (configured)
59
- return configured;
60
- const env = fromEnv();
61
- return {
62
- ...env,
63
- medusaUrl: stripSlash(env.medusaUrl ?? DEFAULT_MEDUSA_URL),
64
- debug: nodeEnvIsDevelopment(),
65
- };
79
+ return resolve(configured ?? fromEnv());
66
80
  }
67
81
  /** True once the store called configureCore (the version-floor check reads this in dev). */
68
82
  export function isCoreConfigured() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,uEAAuE;AACvE,2EAA2E;AAC3E,wDAAwD;AACxD,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,YAAY;AAsBZ,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAElD,IAAI,UAAU,GAAsB,IAAI,CAAA;AAExC,SAAS,KAAK,CAAC,KAAsB;IACnC,MAAM,GAAG,GAAoB,EAAE,CAAA;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS,IA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;QAAE,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACrF,OAAO;QACL,GAAG,KAAK;QACR,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,IAAI,cAAc,CAAC;QACxD,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,oBAAoB,EAAE;KAC7C,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAsB;IAClD,UAAU,GAAG,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAA;AACvE,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,UAAU,IAAI,OAAO,EAAE,CAAC,CAAA;AACzC,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,KAAK,IAAI,CAAA;AAC5B,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,eAAe;IAC7B,UAAU,GAAG,IAAI,CAAA;AACnB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export { CoreProvider, type CoreProviderProps } from '../shell/core-provider.js';
2
2
  export { ClientPluginSlot, type ClientPluginSlotProps } from '../shell/client-plugin-slot.js';
3
3
  export { usePluginRegistry } from '../shell/registry-context.js';
4
+ export { type CoreHookOverrides, type HookOverride, type OverridableHook } from '../shell/overrides.js';
4
5
  export { ErrorBoundary } from '../shell/error-boundary.js';
5
6
  export { PaymentUiProvider, usePaymentUi, type PaymentUiComponents, type StripePaymentFormProps, type SavedMethodSelectorProps, type SaveMethodConsentProps, type PayPalSmartButtonsProps, } from '../lib/payment-providers/ui.js';
6
- export { configureCore, getCoreConfig, type CoreConfig, type CoreConfigInput } from '../config/index.js';
7
+ export { configureCore, getCoreConfig, MissingMedusaUrlError, type CoreConfig, type CoreConfigInput, } from '../config/index.js';
7
8
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/entries/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/entries/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAA"}
@@ -6,5 +6,5 @@ export { ClientPluginSlot } from '../shell/client-plugin-slot.js';
6
6
  export { usePluginRegistry } from '../shell/registry-context.js';
7
7
  export { ErrorBoundary } from '../shell/error-boundary.js';
8
8
  export { PaymentUiProvider, usePaymentUi, } from '../lib/payment-providers/ui.js';
9
- export { configureCore, getCoreConfig } from '../config/index.js';
9
+ export { configureCore, getCoreConfig, MissingMedusaUrlError, } from '../config/index.js';
10
10
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/entries/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,+EAA+E;AAC/E,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EACL,iBAAiB,EACjB,YAAY,GAMb,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAyC,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/entries/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,+EAA+E;AAC/E,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EACL,iBAAiB,EACjB,YAAY,GAMb,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,GAGtB,MAAM,oBAAoB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  export { createPluginSlot, PluginSlot, type PluginSlotProps } from '../shell/plugin-slot.js';
2
2
  export { getPluginConfigs } from '../lib/plugin-config.js';
3
- export { configureCore, getCoreConfig, type CoreConfig, type CoreConfigInput } from '../config/index.js';
3
+ export { configureCore, getCoreConfig, MissingMedusaUrlError, type CoreConfig, type CoreConfigInput, } from '../config/index.js';
4
4
  export { medusaFetch, medusaBackendUrl, storeHeaders, storeGetJson, storePostJson } from '../lib/store-api.js';
5
5
  export { getStoreConfig, isFeatureOff, isFeatureOn, DEFAULT_STORE_CONFIG, type StoreConfig, type StoreConfigFeatures, type StoreFeature, } from '../lib/store-config.js';
6
6
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/entries/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACxG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9G,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/entries/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9G,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAA"}
@@ -2,7 +2,7 @@
2
2
  // config. No "use client": everything here may run in a Server Component.
3
3
  export { createPluginSlot, PluginSlot } from '../shell/plugin-slot.js';
4
4
  export { getPluginConfigs } from '../lib/plugin-config.js';
5
- export { configureCore, getCoreConfig } from '../config/index.js';
5
+ export { configureCore, getCoreConfig, MissingMedusaUrlError, } from '../config/index.js';
6
6
  export { medusaFetch, medusaBackendUrl, storeHeaders, storeGetJson, storePostJson } from '../lib/store-api.js';
7
7
  export { getStoreConfig, isFeatureOff, isFeatureOn, DEFAULT_STORE_CONFIG, } from '../lib/store-config.js';
8
8
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/entries/server.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAwB,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAyC,MAAM,oBAAoB,CAAA;AACxG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9G,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,GAIrB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/entries/server.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAwB,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,GAGtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9G,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,GAIrB,MAAM,wBAAwB,CAAA"}
@@ -1,14 +1,22 @@
1
- export declare function useAuth(): {
1
+ export declare function useAuth(): ReturnType<typeof useAuthBase>;
2
+ declare function useAuthBase(): {
2
3
  customer: any;
3
4
  isLoggedIn: boolean;
4
5
  isLoading: boolean;
5
- login: import("@tanstack/react-query").UseMutateAsyncFunction<HttpTypes.StoreCustomerResponse, Error, {
6
+ login: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
6
7
  email: string;
7
8
  password: string;
8
9
  }, unknown>;
9
10
  isLoggingIn: boolean;
10
11
  loginError: Error | null;
11
- register: import("@tanstack/react-query").UseMutateAsyncFunction<HttpTypes.StoreCustomerResponse, Error, {
12
+ requestSignInCode: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, string, unknown>;
13
+ isRequestingSignInCode: boolean;
14
+ loginWithCode: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
15
+ email: string;
16
+ code: string;
17
+ }, unknown>;
18
+ isLoggingInWithCode: boolean;
19
+ register: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
12
20
  email: string;
13
21
  password: string;
14
22
  first_name: string;
@@ -19,4 +27,5 @@ export declare function useAuth(): {
19
27
  logout: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
20
28
  isLoggingOut: boolean;
21
29
  };
30
+ export {};
22
31
  //# sourceMappingURL=use-auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../../src/hooks/use-auth.ts"],"names":[],"mappings":"AAmCA,wBAAgB,OAAO;;;;;eAgE8B,MAAM;kBAAY,MAAM;;;;;eAkChE,MAAM;kBACH,MAAM;oBACJ,MAAM;mBACP,MAAM;;;;;;EA8FtB"}
1
+ {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../../src/hooks/use-auth.ts"],"names":[],"mappings":"AAiDA,wBAAgB,OAAO,IAAI,UAAU,CAAC,OAAO,WAAW,CAAC,CAExD;AAED,iBAAS,WAAW;;;;;eAyE2B,MAAM;kBAAY,MAAM;;;;;;;eAY5B,MAAM;cAAQ,MAAM;;;;eAalD,MAAM;kBACH,MAAM;oBACJ,MAAM;mBACP,MAAM;;;;;;EAuFtB"}