@ecomiq/storefront 1.1.4 → 1.1.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.
Files changed (36) hide show
  1. package/dist/{chunk-6TMU4OXP.js → chunk-3QGB55R6.js} +3 -3
  2. package/dist/{chunk-6TMU4OXP.js.map → chunk-3QGB55R6.js.map} +1 -1
  3. package/dist/{chunk-EADDSNJS.js → chunk-64GLOWMJ.js} +14 -4
  4. package/dist/chunk-64GLOWMJ.js.map +1 -0
  5. package/dist/chunk-Q4U5OEUT.js +21 -0
  6. package/dist/chunk-Q4U5OEUT.js.map +1 -0
  7. package/dist/{chunk-3URTJY6X.js → chunk-QRR7EPCH.js} +14 -12
  8. package/dist/chunk-QRR7EPCH.js.map +1 -0
  9. package/dist/{chunk-YSD62KQM.js → chunk-ZG2XUYGZ.js} +23 -21
  10. package/dist/chunk-ZG2XUYGZ.js.map +1 -0
  11. package/dist/chunks/client.css +1 -1
  12. package/dist/chunks/client.css.map +1 -1
  13. package/dist/chunks/client.d.ts +535 -25
  14. package/dist/chunks/client.js +517 -193
  15. package/dist/chunks/client.js.map +1 -1
  16. package/dist/chunks/config.js +3 -2
  17. package/dist/chunks/core-public.d.ts +2 -2
  18. package/dist/chunks/core-public.js +4 -10
  19. package/dist/chunks/core-public.js.map +1 -1
  20. package/dist/chunks/server-nextjs.d.ts +3 -3
  21. package/dist/chunks/server-nextjs.js +27 -13
  22. package/dist/chunks/server-nextjs.js.map +1 -1
  23. package/dist/chunks/server-tanstack.d.ts +3 -3
  24. package/dist/chunks/server-tanstack.js +6 -5
  25. package/dist/chunks/server-tanstack.js.map +1 -1
  26. package/dist/{collection-BHD4hhQa.d.ts → collection-C6bWDLiw.d.ts} +318 -1
  27. package/dist/{ecomiq-oauth-password-plugin-gw2dPyYb.d.ts → ecomiq-oauth-password-plugin-J5wDFqzL.d.ts} +2 -2
  28. package/dist/nextjs/api.js +2 -1
  29. package/dist/nextjs/api.js.map +1 -1
  30. package/dist/react/client.css +1 -1
  31. package/dist/tanstack/api.js +3 -2
  32. package/dist/tanstack/api.js.map +1 -1
  33. package/package.json +2 -2
  34. package/dist/chunk-3URTJY6X.js.map +0 -1
  35. package/dist/chunk-EADDSNJS.js.map +0 -1
  36. package/dist/chunk-YSD62KQM.js.map +0 -1
@@ -1,4 +1,5 @@
1
- export { EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey } from '../chunk-6TMU4OXP.js';
2
- import '../chunk-EADDSNJS.js';
1
+ export { EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey } from '../chunk-3QGB55R6.js';
2
+ import '../chunk-64GLOWMJ.js';
3
+ import '../chunk-Q4U5OEUT.js';
3
4
  //# sourceMappingURL=config.js.map
4
5
  //# sourceMappingURL=config.js.map
@@ -1,5 +1,5 @@
1
- import { S as StorefrontSettings, a as StorefrontPageDetail } from '../collection-BHD4hhQa.js';
2
- export { d as StorefrontCmsPage, c as StorefrontCmsSettings, j as StorefrontCollection, k as StorefrontCollectionDetail, u as StorefrontCollectionDetailSchema, s as StorefrontCollectionSchema, t as StorefrontCollectionsResponseSchema, w as StorefrontPageDetailSchema, l as StorefrontPageListItem, v as StorefrontPageListItemSchema, e as StorefrontProduct, f as StorefrontProductDetail, r as StorefrontProductDetailSchema, o as StorefrontProductSchema, h as StorefrontProductsParamsInput, q as StorefrontProductsParamsSchema, g as StorefrontProductsResponse, p as StorefrontProductsResponseSchema, m as StorefrontSettingsSchema, b as StorefrontStore, n as StorefrontStoreSchema, i as StorefrontVariant } from '../collection-BHD4hhQa.js';
1
+ import { S as StorefrontSettings, a as StorefrontPageDetail } from '../collection-C6bWDLiw.js';
2
+ export { b as StorefrontCmsPage, c as StorefrontCmsSettings, d as StorefrontCollection, e as StorefrontCollectionDetail, f as StorefrontCollectionDetailSchema, g as StorefrontCollectionSchema, h as StorefrontCollectionsResponseSchema, i as StorefrontPageDetailSchema, j as StorefrontPageListItem, k as StorefrontPageListItemSchema, l as StorefrontProduct, m as StorefrontProductDetail, n as StorefrontProductDetailSchema, o as StorefrontProductSchema, p as StorefrontProductsParamsInput, q as StorefrontProductsParamsSchema, r as StorefrontProductsResponse, s as StorefrontProductsResponseSchema, t as StorefrontSettingsSchema, u as StorefrontStore, v as StorefrontStoreSchema, w as StorefrontVariant } from '../collection-C6bWDLiw.js';
3
3
  import 'zod';
4
4
 
5
5
  /** Prefijo base de la API storefront (ej. v1/storefront). */
@@ -1,15 +1,9 @@
1
1
  import { StorefrontPageDetailSchema } from '../chunk-ASFU32ZM.js';
2
2
  export { StorefrontCollectionDetailSchema, StorefrontCollectionSchema, StorefrontCollectionsResponseSchema, StorefrontPageDetailSchema, StorefrontPageListItemSchema, StorefrontProductDetailSchema, StorefrontProductSchema, StorefrontProductsParamsSchema, StorefrontProductsResponseSchema } from '../chunk-ASFU32ZM.js';
3
- export { StorefrontSettingsSchema, StorefrontStoreSchema } from '../chunk-EADDSNJS.js';
3
+ export { StorefrontSettingsSchema, StorefrontStoreSchema } from '../chunk-64GLOWMJ.js';
4
4
  export { STOREFRONT_API_PATH_PREFIX } from '../chunk-S7CPZ4UE.js';
5
-
6
- // src/core/constants/currency.ts
7
- var countryCurrency = {
8
- "PEN": "es-PE",
9
- "USD": "en-US",
10
- "COP": "es-CO",
11
- "MXN": "es-MX"
12
- };
5
+ import { countryCurrency } from '../chunk-Q4U5OEUT.js';
6
+ export { countryCurrency } from '../chunk-Q4U5OEUT.js';
13
7
 
14
8
  // src/core/utils/format-currency.ts
15
9
  function formatCurrency(amount, currency = "USD") {
@@ -93,6 +87,6 @@ function findStorefrontCmsPageBySlug(settings, slug) {
93
87
  return parsed.success ? parsed.data : null;
94
88
  }
95
89
 
96
- export { countryCurrency, customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
90
+ export { customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
97
91
  //# sourceMappingURL=core-public.js.map
98
92
  //# sourceMappingURL=core-public.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/constants/currency.ts","../../src/core/utils/format-currency.ts","../../src/core/utils/cms-html.ts","../../src/core/lib/customer-order-labels.ts","../../src/react/shell/lib/find-storefront-cms-page.ts"],"names":[],"mappings":";;;;;;AAAO,IAAM,eAAA,GAAkB;AAAA,EAC7B,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO;AACT;;;ACCO,SAAS,cAAA,CACd,MAAA,EACA,QAAA,GAAmB,KAAA,EACX;AACR,EAAA,MAAM,MAAA,GACJ,eAAA,CAAgB,QAAwC,CAAA,IAAK,OAAA;AAC/D,EAAA,OAAO,IAAI,IAAA,CAAK,YAAA,CAAa,MAAA,EAAQ;AAAA,IACnC,KAAA,EAAO,UAAA;AAAA,IACP;AAAA,GACD,CAAA,CAAE,MAAA,CAAO,MAAM,CAAA;AAClB;;;ACfO,SAAS,aAAa,IAAA,EAAc;AACzC,EAAA,OAAO,KACJ,OAAA,CAAQ,sCAAA,EAAwC,EAAE,CAAA,CAClD,OAAA,CAAQ,sCAAsC,EAAE,CAAA,CAChD,QAAQ,6CAAA,EAA+C,EAAE,EACzD,OAAA,CAAQ,6BAAA,EAA+B,EAAE,CAAA,CACzC,OAAA,CAAQ,uDAAuD,EAAE,CAAA;AACtE;AAGO,SAAS,UAAU,IAAA,EAAc;AACtC,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,cAAA,EAAgB,GAAG,CAAA,CAC3B,OAAA,CAAQ,UAAA,EAAY,GAAG,CAAA,CACvB,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;;;A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M,KAAA,CAAM,IAAA;AAAA,IAChB,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,KAAS,IAAA,IAAQ,oBAAoB,CAAwB;AAAA,GACxE;AACA,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,MAAM,MAAA,GAAS,0BAAA,CAA2B,SAAA,CAAU,GAAG,CAAA;AACvD,EAAA,OAAO,MAAA,CAAO,OAAA,GAAU,MAAA,CAAO,IAAA,GAAO,IAAA;AACxC","file":"core-public.js","sourcesContent":["export const countryCurrency = {\n \"PEN\": \"es-PE\",\n \"USD\": \"en-US\",\n \"COP\": \"es-CO\",\n \"MXN\": \"es-MX\",\n}\n","import { countryCurrency } from \"../constants/currency\";\n\n/**\n * Formats a number as currency using the store's locale for the given currency code.\n * Uses countryCurrency to pick the right locale (e.g. PEN → es-PE, USD → en-US).\n */\nexport function formatCurrency(\n amount: number,\n currency: string = \"USD\"\n): string {\n const locale =\n countryCurrency[currency as keyof typeof countryCurrency] ?? \"en-US\";\n return new Intl.NumberFormat(locale, {\n style: \"currency\",\n currency,\n }).format(amount);\n}\n","/** Sanitización mínima de HTML (script, event handlers, javascript:…). */\nexport function sanitizeHtml(html: string) {\n return html\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, \"\")\n .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, \"\")\n .replace(/<(iframe|object|embed|link|meta)[\\s\\S]*?>/gi, \"\")\n .replace(/\\son\\w+\\s*=\\s*(['\"]).*?\\1/gi, \"\")\n .replace(/\\s(href|src)\\s*=\\s*(['\"])\\s*javascript:[\\s\\S]*?\\2/gi, \"\");\n}\n\n/** Convierte HTML en texto plano (metadata, JSON-LD). */\nexport function stripHtml(html: string) {\n return html\n .replace(/<br\\s*\\/?>/gi, \" \")\n .replace(/<[^>]+>/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n","/** Etiquetas en español para estados de pedido (upstream suele enviar PascalCase). */\nconst ORDER_STATUS_LABELS: Record<string, string> = {\n New: \"Pedido realizado\",\n Confirmed: \"Confirmado\",\n Processing: \"En preparación\",\n InTransit: \"En camino\",\n Delivered: \"Entregado\",\n Cancelled: \"Cancelado\",\n Canceled: \"Cancelado\",\n Refunded: \"Reembolsado\",\n Pending: \"Pendiente\",\n Paid: \"Pagado\",\n Captured: \"Pago confirmado\",\n};\n\nexport function formatCustomerOrderStatus(status: string): string {\n const trimmed = status.trim();\n if (!trimmed) return \"Desconocido\";\n return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, \" $1\").trim();\n}\n\nexport function customerOrderStatusTone(\n status: string\n): \"default\" | \"success\" | \"warning\" | \"danger\" | \"info\" {\n const s = status.toLowerCase();\n if (s.includes(\"cancel\") || s.includes(\"refund\")) return \"danger\";\n if (s.includes(\"deliver\")) return \"success\";\n if (s.includes(\"transit\") || s.includes(\"ship\")) return \"info\";\n if (s.includes(\"confirm\") || s.includes(\"paid\") || s.includes(\"capture\")) return \"success\";\n if (s.includes(\"pending\") || s.includes(\"new\") || s.includes(\"process\")) return \"warning\";\n return \"default\";\n}\n\nexport function formatOrderDate(iso: string, locale = \"es-PE\"): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(d);\n}\n\nexport function formatOrderDateTime(iso: string, locale = \"es-PE\"): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(d);\n}\n","import type { StorefrontSettings } from \"../../../core/models/store\";\nimport type { StorefrontPageDetail } from \"../../../core/models/page\";\nimport { StorefrontPageDetailSchema } from \"../../../core/models/page\";\n\nfunction isRenderableCmsPage(p: { status?: string }): boolean {\n if (!p.status) return true;\n return p.status === \"published\";\n}\n\n/**\n * Busca una página CMS en `settings.cms.pages` (payload de `getPublicStore` / settings)\n * y la valida como `StorefrontPageDetail` para `DynamicPage`.\n */\nexport function findStorefrontCmsPageBySlug(\n settings: StorefrontSettings | null | undefined,\n slug: string\n): StorefrontPageDetail | null {\n const pages = settings?.cms?.pages;\n if (!pages?.length) return null;\n const raw = pages.find(\n (p) => p.slug === slug && isRenderableCmsPage(p as { status?: string })\n );\n if (!raw) return null;\n const parsed = StorefrontPageDetailSchema.safeParse(raw);\n return parsed.success ? parsed.data : null;\n}\n"]}
1
+ {"version":3,"sources":["../../src/core/utils/format-currency.ts","../../src/core/utils/cms-html.ts","../../src/core/lib/customer-order-labels.ts","../../src/react/shell/lib/find-storefront-cms-page.ts"],"names":[],"mappings":";;;;;;;;AAMO,SAAS,cAAA,CACd,MAAA,EACA,QAAA,GAAmB,KAAA,EACX;AACR,EAAA,MAAM,MAAA,GACJ,eAAA,CAAgB,QAAwC,CAAA,IAAK,OAAA;AAC/D,EAAA,OAAO,IAAI,IAAA,CAAK,YAAA,CAAa,MAAA,EAAQ;AAAA,IACnC,KAAA,EAAO,UAAA;AAAA,IACP;AAAA,GACD,CAAA,CAAE,MAAA,CAAO,MAAM,CAAA;AAClB;;;ACfO,SAAS,aAAa,IAAA,EAAc;AACzC,EAAA,OAAO,KACJ,OAAA,CAAQ,sCAAA,EAAwC,EAAE,CAAA,CAClD,OAAA,CAAQ,sCAAsC,EAAE,CAAA,CAChD,QAAQ,6CAAA,EAA+C,EAAE,EACzD,OAAA,CAAQ,6BAAA,EAA+B,EAAE,CAAA,CACzC,OAAA,CAAQ,uDAAuD,EAAE,CAAA;AACtE;AAGO,SAAS,UAAU,IAAA,EAAc;AACtC,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,cAAA,EAAgB,GAAG,CAAA,CAC3B,OAAA,CAAQ,UAAA,EAAY,GAAG,CAAA,CACvB,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;;;AChBA,IAAM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AAM,IAAA;AAAA,IAChB,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,KAAS,IAAA,IAAQ,oBAAoB,CAAwB;AAAA,GACxE;AACA,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,MAAM,MAAA,GAAS,0BAAA,CAA2B,SAAA,CAAU,GAAG,CAAA;AACvD,EAAA,OAAO,MAAA,CAAO,OAAA,GAAU,MAAA,CAAO,IAAA,GAAO,IAAA;AACxC","file":"core-public.js","sourcesContent":["import { countryCurrency } from \"../constants/currency\";\n\n/**\n * Formats a number as currency using the store's locale for the given currency code.\n * Uses countryCurrency to pick the right locale (e.g. PEN → es-PE, USD → en-US).\n */\nexport function formatCurrency(\n amount: number,\n currency: string = \"USD\"\n): string {\n const locale =\n countryCurrency[currency as keyof typeof countryCurrency] ?? \"en-US\";\n return new Intl.NumberFormat(locale, {\n style: \"currency\",\n currency,\n }).format(amount);\n}\n","/** Sanitización mínima de HTML (script, event handlers, javascript:…). */\nexport function sanitizeHtml(html: string) {\n return html\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, \"\")\n .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, \"\")\n .replace(/<(iframe|object|embed|link|meta)[\\s\\S]*?>/gi, \"\")\n .replace(/\\son\\w+\\s*=\\s*(['\"]).*?\\1/gi, \"\")\n .replace(/\\s(href|src)\\s*=\\s*(['\"])\\s*javascript:[\\s\\S]*?\\2/gi, \"\");\n}\n\n/** Convierte HTML en texto plano (metadata, JSON-LD). */\nexport function stripHtml(html: string) {\n return html\n .replace(/<br\\s*\\/?>/gi, \" \")\n .replace(/<[^>]+>/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n","/** Etiquetas en español para estados de pedido (upstream suele enviar PascalCase). */\nconst ORDER_STATUS_LABELS: Record<string, string> = {\n New: \"Pedido realizado\",\n Confirmed: \"Confirmado\",\n Processing: \"En preparación\",\n InTransit: \"En camino\",\n Delivered: \"Entregado\",\n Cancelled: \"Cancelado\",\n Canceled: \"Cancelado\",\n Refunded: \"Reembolsado\",\n Pending: \"Pendiente\",\n Paid: \"Pagado\",\n Captured: \"Pago confirmado\",\n};\n\nexport function formatCustomerOrderStatus(status: string): string {\n const trimmed = status.trim();\n if (!trimmed) return \"Desconocido\";\n return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, \" $1\").trim();\n}\n\nexport function customerOrderStatusTone(\n status: string\n): \"default\" | \"success\" | \"warning\" | \"danger\" | \"info\" {\n const s = status.toLowerCase();\n if (s.includes(\"cancel\") || s.includes(\"refund\")) return \"danger\";\n if (s.includes(\"deliver\")) return \"success\";\n if (s.includes(\"transit\") || s.includes(\"ship\")) return \"info\";\n if (s.includes(\"confirm\") || s.includes(\"paid\") || s.includes(\"capture\")) return \"success\";\n if (s.includes(\"pending\") || s.includes(\"new\") || s.includes(\"process\")) return \"warning\";\n return \"default\";\n}\n\nexport function formatOrderDate(iso: string, locale = \"es-PE\"): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(d);\n}\n\nexport function formatOrderDateTime(iso: string, locale = \"es-PE\"): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(d);\n}\n","import type { StorefrontSettings } from \"../../../core/models/store\";\nimport type { StorefrontPageDetail } from \"../../../core/models/page\";\nimport { StorefrontPageDetailSchema } from \"../../../core/models/page\";\n\nfunction isRenderableCmsPage(p: { status?: string }): boolean {\n if (!p.status) return true;\n return p.status === \"published\";\n}\n\n/**\n * Busca una página CMS en `settings.cms.pages` (payload de `getPublicStore` / settings)\n * y la valida como `StorefrontPageDetail` para `DynamicPage`.\n */\nexport function findStorefrontCmsPageBySlug(\n settings: StorefrontSettings | null | undefined,\n slug: string\n): StorefrontPageDetail | null {\n const pages = settings?.cms?.pages;\n if (!pages?.length) return null;\n const raw = pages.find(\n (p) => p.slug === slug && isRenderableCmsPage(p as { status?: string })\n );\n if (!raw) return null;\n const parsed = StorefrontPageDetailSchema.safeParse(raw);\n return parsed.success ? parsed.data : null;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-gw2dPyYb.js';
2
- export { a4 as CustomerAddress, _ as CustomerAddressSchema, a5 as CustomerAddressUpsert, $ as CustomerAddressUpsertSchema, a6 as CustomerMe, a0 as CustomerMeSchema, ad as CustomerOrderDetail, ad as CustomerOrderDetailDto, ab as CustomerOrderDetailSchema, ac as CustomerOrderListItem, ac as CustomerOrderListItemDto, aa as CustomerOrderListItemSchema, a7 as CustomerProfilePatch, a1 as CustomerProfilePatchSchema, a3 as CustomerRegisterRequest, T as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, l as StoreApiGetOptions, K as addCartCoupon, b as applyServerRequestOriginFromHeaders, p as buildStorefrontKvSnapshotKey, q as buildStorefrontKvSnapshotKeyFromStoreKey, N as checkoutCart, M as createCart, V as createCustomerAddress, k as createStoreApiClient, a2 as customerMeToProfilePatch, X as deleteCustomerAddress, e as ecomiqOAuthPassword, f as fetchPublicStoreSettings, G as getCart, H as getCartCheckout, Q as getCartPaymentMethods, U as getCustomerAddresses, Y as getCustomerMe, a9 as getCustomerOrder, a8 as getCustomerOrders, ae as getSharedOrderDraft, I as getShippingOptions, h as getStoreApiBaseUrl, j as getStoreApiClient, y as getStorefrontCollectionBySlug, x as getStorefrontCollections, A as getStorefrontPageBySlug, B as getStorefrontPagePreview, z as getStorefrontPages, w as getStorefrontProductBySlug, v as getStorefrontProducts, m as getStorefrontSettings, n as getStorefrontSettingsFromKv, o as getStorefrontSettingsFromKvByStoreKey, i as isCartNotActiveApiError, t as normalizeStoreHost, D as patchCartAddresses, C as patchCartBuyer, Z as patchCustomer, J as putCartShippingMethod, R as registerCustomer, L as removeCartCoupon, r as resolvePublicStoreSettingsSource, u as resolveStorefrontSettingsHost, g as setClientStoreId, c as setServerRequestOrigin, d as setServerStoreId, s as storeApiClient, W as updateCustomerAddress, O as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-gw2dPyYb.js';
1
+ import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-J5wDFqzL.js';
2
+ export { C as CustomerAddress, b as CustomerAddressSchema, c as CustomerAddressUpsert, d as CustomerAddressUpsertSchema, e as CustomerMe, f as CustomerMeSchema, g as CustomerOrderDetail, g as CustomerOrderDetailDto, h as CustomerOrderDetailSchema, i as CustomerOrderListItem, i as CustomerOrderListItemDto, j as CustomerOrderListItemSchema, k as CustomerProfilePatch, l as CustomerProfilePatchSchema, m as CustomerRegisterRequest, n as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, o as StoreApiGetOptions, p as addCartCoupon, q as applyServerRequestOriginFromHeaders, r as buildStorefrontKvSnapshotKey, s as buildStorefrontKvSnapshotKeyFromStoreKey, t as checkoutCart, u as createCart, v as createCustomerAddress, w as createStoreApiClient, x as customerMeToProfilePatch, y as deleteCustomerAddress, z as ecomiqOAuthPassword, A as fetchPublicStoreSettings, B as getCart, D as getCartCheckout, G as getCartPaymentMethods, H as getCustomerAddresses, I as getCustomerMe, J as getCustomerOrder, K as getCustomerOrders, L as getSharedOrderDraft, M as getShippingOptions, N as getStoreApiBaseUrl, O as getStoreApiClient, Q as getStorefrontCollectionBySlug, R as getStorefrontCollections, T as getStorefrontPageBySlug, U as getStorefrontPagePreview, V as getStorefrontPages, W as getStorefrontProductBySlug, X as getStorefrontProducts, Y as getStorefrontSettings, Z as getStorefrontSettingsFromKv, _ as getStorefrontSettingsFromKvByStoreKey, $ as isCartNotActiveApiError, a0 as normalizeStoreHost, a1 as patchCartAddresses, a2 as patchCartBuyer, a3 as patchCustomer, a4 as putCartShippingMethod, a5 as registerCustomer, a6 as removeCartCoupon, a7 as resolvePublicStoreSettingsSource, a8 as resolveStorefrontSettingsHost, a9 as setClientStoreId, aa as setServerRequestOrigin, ab as setServerStoreId, ac as storeApiClient, ad as updateCustomerAddress, ae as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-J5wDFqzL.js';
3
3
  export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
4
- import '../collection-BHD4hhQa.js';
4
+ import '../collection-C6bWDLiw.js';
5
5
  import 'zod';
6
6
  import 'better-auth';
7
7
 
@@ -1,31 +1,45 @@
1
- import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-YSD62KQM.js';
2
- export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-YSD62KQM.js';
3
- export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-6TMU4OXP.js';
1
+ import { fetchPublicStoreSettings, applyServerRequestOriginFromHeaders, normalizeRequestHostname, setServerStoreId } from '../chunk-ZG2XUYGZ.js';
2
+ export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-ZG2XUYGZ.js';
3
+ export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-3QGB55R6.js';
4
4
  import '../chunk-ASFU32ZM.js';
5
- import '../chunk-EADDSNJS.js';
6
- export { handleStoreProxyRequest } from '../chunk-3URTJY6X.js';
5
+ import '../chunk-64GLOWMJ.js';
6
+ export { handleStoreProxyRequest } from '../chunk-QRR7EPCH.js';
7
7
  import '../chunk-S7CPZ4UE.js';
8
+ import '../chunk-Q4U5OEUT.js';
8
9
  import { headers } from 'next/headers';
10
+ import { cache } from 'react';
9
11
 
10
12
  async function getHostname() {
11
13
  const headerList = await headers();
12
14
  applyServerRequestOriginFromHeaders(headerList);
13
15
  return normalizeRequestHostname(headerList);
14
16
  }
17
+ var fetchPublicStoreSettingsForRequest = cache(
18
+ (host, source) => fetchPublicStoreSettings({
19
+ host,
20
+ source: source ?? void 0
21
+ })
22
+ );
23
+ function applyPublicStoreRuntime(result) {
24
+ setServerStoreId(result.data?.store.id ?? null);
25
+ return result;
26
+ }
15
27
  async function getPublicStore(options) {
16
28
  const headerList = await headers();
17
29
  applyServerRequestOriginFromHeaders(headerList);
18
- return fetchPublicStoreSettings({
19
- host: headerList.get("host"),
20
- source: options?.source
21
- });
30
+ const result = await fetchPublicStoreSettingsForRequest(
31
+ headerList.get("host"),
32
+ options?.source ?? null
33
+ );
34
+ return applyPublicStoreRuntime(result);
22
35
  }
23
36
  async function getPublicStoreFromHeaders(headerList, options) {
24
37
  applyServerRequestOriginFromHeaders(headerList);
25
- return fetchPublicStoreSettings({
26
- host: headerList.get("host"),
27
- ...options
28
- });
38
+ const result = await fetchPublicStoreSettingsForRequest(
39
+ headerList.get("host"),
40
+ options?.source ?? null
41
+ );
42
+ return applyPublicStoreRuntime(result);
29
43
  }
30
44
 
31
45
  export { getHostname, getPublicStore, getPublicStoreFromHeaders };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/frameworks/nextjs/actions/getHostName.ts","../../src/react/frameworks/nextjs/actions/getPublicStore.ts"],"names":["headers"],"mappings":";;;;;;;;;AASA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,UAAA,GAAa,MAAM,OAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACWA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,UAAA,GAAa,MAAMA,OAAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,QAAQ,OAAA,EAAS;AAAA,GAClB,CAAA;AACH;AAKA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,GAAG;AAAA,GACJ,CAAA;AACH","file":"server-nextjs.js","sourcesContent":["import { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\n/**\n * Devuelve el host completo de la request (ej. \"plata950.ecomiq.pe\", \"localhost:3000\").\n */\nexport async function getHostname(): Promise<string | null> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","import { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n /** Si se omite, se usa `resolvePublicStoreSettingsSource()` (variable de entorno). */\n source?: PublicStoreSettingsSource;\n};\n\n/**\n * Obtiene la tienda pública (Next.js App Router).\n * Usa `headers()` para resolver host y origen del proxy.\n *\n * Identificador de tienda:\n * 1. `slugStore` en `ecomiq.config.js` si existe (opcional, útil en localhost).\n * 2. Si no hay config, deriva del header `Host`.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n source: options?.source,\n });\n}\n\n/**\n * Igual que `getPublicStore` pero con headers explícitos (tests, middleware custom).\n */\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n ...options,\n });\n}\n"]}
1
+ {"version":3,"sources":["../../src/react/frameworks/nextjs/actions/getHostName.ts","../../src/react/frameworks/nextjs/actions/getPublicStore.ts"],"names":["headers"],"mappings":";;;;;;;;;;;AASA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,UAAA,GAAa,MAAM,OAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACKA,IAAM,kCAAA,GAAqC,KAAA;AAAA,EACzC,CACE,IAAA,EACA,MAAA,KAEA,wBAAA,CAAyB;AAAA,IACvB,IAAA;AAAA,IACA,QAAQ,MAAA,IAAU;AAAA,GACnB;AACL,CAAA;AAEA,SAAS,wBAAwB,MAAA,EAA8C;AAC7E,EAAA,gBAAA,CAAiB,MAAA,CAAO,IAAA,EAAM,KAAA,CAAM,EAAA,IAAM,IAAI,CAAA;AAC9C,EAAA,OAAO,MAAA;AACT;AAUA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,UAAA,GAAa,MAAMA,OAAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,MAAM,SAAS,MAAM,kCAAA;AAAA,IACnB,UAAA,CAAW,IAAI,MAAM,CAAA;AAAA,IACrB,SAAS,MAAA,IAAU;AAAA,GACrB;AACA,EAAA,OAAO,wBAAwB,MAAM,CAAA;AACvC;AAKA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,MAAM,SAAS,MAAM,kCAAA;AAAA,IACnB,UAAA,CAAW,IAAI,MAAM,CAAA;AAAA,IACrB,SAAS,MAAA,IAAU;AAAA,GACrB;AACA,EAAA,OAAO,wBAAwB,MAAM,CAAA;AACvC","file":"server-nextjs.js","sourcesContent":["import { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\n/**\n * Devuelve el host completo de la request (ej. \"plata950.ecomiq.pe\", \"localhost:3000\").\n */\nexport async function getHostname(): Promise<string | null> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","import { cache } from \"react\";\nimport { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport { setServerStoreId } from \"../../../../core/client/store-api-client\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n /** Si se omite, se usa `resolvePublicStoreSettingsSource()` (variable de entorno). */\n source?: PublicStoreSettingsSource;\n};\n\nconst fetchPublicStoreSettingsForRequest = cache(\n (\n host: string | null,\n source: PublicStoreSettingsSource | null,\n ): Promise<PublicStoreResult> =>\n fetchPublicStoreSettings({\n host,\n source: source ?? undefined,\n }),\n);\n\nfunction applyPublicStoreRuntime(result: PublicStoreResult): PublicStoreResult {\n setServerStoreId(result.data?.store.id ?? null);\n return result;\n}\n\n/**\n * Obtiene la tienda pública (Next.js App Router).\n * Usa `headers()` para resolver host y origen del proxy.\n *\n * Identificador de tienda:\n * 1. `slugStore` en `ecomiq.config.js` si existe (opcional, útil en localhost).\n * 2. Si no hay config, deriva del header `Host`.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n const result = await fetchPublicStoreSettingsForRequest(\n headerList.get(\"host\"),\n options?.source ?? null,\n );\n return applyPublicStoreRuntime(result);\n}\n\n/**\n * Igual que `getPublicStore` pero con headers explícitos (tests, middleware custom).\n */\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n const result = await fetchPublicStoreSettingsForRequest(\n headerList.get(\"host\"),\n options?.source ?? null,\n );\n return applyPublicStoreRuntime(result);\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-gw2dPyYb.js';
2
- export { a4 as CustomerAddress, _ as CustomerAddressSchema, a5 as CustomerAddressUpsert, $ as CustomerAddressUpsertSchema, a6 as CustomerMe, a0 as CustomerMeSchema, ad as CustomerOrderDetail, ad as CustomerOrderDetailDto, ab as CustomerOrderDetailSchema, ac as CustomerOrderListItem, ac as CustomerOrderListItemDto, aa as CustomerOrderListItemSchema, a7 as CustomerProfilePatch, a1 as CustomerProfilePatchSchema, a3 as CustomerRegisterRequest, T as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, l as StoreApiGetOptions, K as addCartCoupon, b as applyServerRequestOriginFromHeaders, p as buildStorefrontKvSnapshotKey, q as buildStorefrontKvSnapshotKeyFromStoreKey, N as checkoutCart, M as createCart, V as createCustomerAddress, k as createStoreApiClient, a2 as customerMeToProfilePatch, X as deleteCustomerAddress, e as ecomiqOAuthPassword, f as fetchPublicStoreSettings, G as getCart, H as getCartCheckout, Q as getCartPaymentMethods, U as getCustomerAddresses, Y as getCustomerMe, a9 as getCustomerOrder, a8 as getCustomerOrders, ae as getSharedOrderDraft, I as getShippingOptions, h as getStoreApiBaseUrl, j as getStoreApiClient, y as getStorefrontCollectionBySlug, x as getStorefrontCollections, A as getStorefrontPageBySlug, B as getStorefrontPagePreview, z as getStorefrontPages, w as getStorefrontProductBySlug, v as getStorefrontProducts, m as getStorefrontSettings, n as getStorefrontSettingsFromKv, o as getStorefrontSettingsFromKvByStoreKey, i as isCartNotActiveApiError, t as normalizeStoreHost, D as patchCartAddresses, C as patchCartBuyer, Z as patchCustomer, J as putCartShippingMethod, R as registerCustomer, L as removeCartCoupon, r as resolvePublicStoreSettingsSource, u as resolveStorefrontSettingsHost, g as setClientStoreId, c as setServerRequestOrigin, d as setServerStoreId, s as storeApiClient, W as updateCustomerAddress, O as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-gw2dPyYb.js';
1
+ import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-J5wDFqzL.js';
2
+ export { C as CustomerAddress, b as CustomerAddressSchema, c as CustomerAddressUpsert, d as CustomerAddressUpsertSchema, e as CustomerMe, f as CustomerMeSchema, g as CustomerOrderDetail, g as CustomerOrderDetailDto, h as CustomerOrderDetailSchema, i as CustomerOrderListItem, i as CustomerOrderListItemDto, j as CustomerOrderListItemSchema, k as CustomerProfilePatch, l as CustomerProfilePatchSchema, m as CustomerRegisterRequest, n as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, o as StoreApiGetOptions, p as addCartCoupon, q as applyServerRequestOriginFromHeaders, r as buildStorefrontKvSnapshotKey, s as buildStorefrontKvSnapshotKeyFromStoreKey, t as checkoutCart, u as createCart, v as createCustomerAddress, w as createStoreApiClient, x as customerMeToProfilePatch, y as deleteCustomerAddress, z as ecomiqOAuthPassword, A as fetchPublicStoreSettings, B as getCart, D as getCartCheckout, G as getCartPaymentMethods, H as getCustomerAddresses, I as getCustomerMe, J as getCustomerOrder, K as getCustomerOrders, L as getSharedOrderDraft, M as getShippingOptions, N as getStoreApiBaseUrl, O as getStoreApiClient, Q as getStorefrontCollectionBySlug, R as getStorefrontCollections, T as getStorefrontPageBySlug, U as getStorefrontPagePreview, V as getStorefrontPages, W as getStorefrontProductBySlug, X as getStorefrontProducts, Y as getStorefrontSettings, Z as getStorefrontSettingsFromKv, _ as getStorefrontSettingsFromKvByStoreKey, $ as isCartNotActiveApiError, a0 as normalizeStoreHost, a1 as patchCartAddresses, a2 as patchCartBuyer, a3 as patchCustomer, a4 as putCartShippingMethod, a5 as registerCustomer, a6 as removeCartCoupon, a7 as resolvePublicStoreSettingsSource, a8 as resolveStorefrontSettingsHost, a9 as setClientStoreId, aa as setServerRequestOrigin, ab as setServerStoreId, ac as storeApiClient, ad as updateCustomerAddress, ae as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-J5wDFqzL.js';
3
3
  export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
4
- import '../collection-BHD4hhQa.js';
4
+ import '../collection-C6bWDLiw.js';
5
5
  import 'zod';
6
6
  import 'better-auth';
7
7
 
@@ -1,10 +1,11 @@
1
- import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-YSD62KQM.js';
2
- export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-YSD62KQM.js';
3
- export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-6TMU4OXP.js';
1
+ import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-ZG2XUYGZ.js';
2
+ export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-ZG2XUYGZ.js';
3
+ export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-3QGB55R6.js';
4
4
  import '../chunk-ASFU32ZM.js';
5
- import '../chunk-EADDSNJS.js';
6
- export { handleStoreProxyRequest } from '../chunk-3URTJY6X.js';
5
+ import '../chunk-64GLOWMJ.js';
6
+ export { handleStoreProxyRequest } from '../chunk-QRR7EPCH.js';
7
7
  import '../chunk-S7CPZ4UE.js';
8
+ import '../chunk-Q4U5OEUT.js';
8
9
  import { getRequestHeaders } from '@tanstack/react-start/server';
9
10
 
10
11
  async function getHostname() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/frameworks/tanstack/actions/getHostname.ts","../../src/react/frameworks/tanstack/actions/getPublicStore.ts"],"names":["getRequestHeaders"],"mappings":";;;;;;;;;AAMA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACSA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,aAAaA,iBAAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,QAAQ,OAAA,EAAS;AAAA,GAClB,CAAA;AACH;AAEA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,GAAG;AAAA,GACJ,CAAA;AACH","file":"server-tanstack.js","sourcesContent":["import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\nexport async function getHostname(): Promise<string | null> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n source?: PublicStoreSettingsSource;\n};\n\n/**\n * Obtiene la tienda pública en TanStack Start (server function, loader o server route).\n * Usa `getRequestHeaders()` del contexto de request activo.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n source: options?.source,\n });\n}\n\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n ...options,\n });\n}\n"]}
1
+ {"version":3,"sources":["../../src/react/frameworks/tanstack/actions/getHostname.ts","../../src/react/frameworks/tanstack/actions/getPublicStore.ts"],"names":["getRequestHeaders"],"mappings":";;;;;;;;;;AAMA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACSA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,aAAaA,iBAAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,QAAQ,OAAA,EAAS;AAAA,GAClB,CAAA;AACH;AAEA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,GAAG;AAAA,GACJ,CAAA;AACH","file":"server-tanstack.js","sourcesContent":["import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\nexport async function getHostname(): Promise<string | null> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n source?: PublicStoreSettingsSource;\n};\n\n/**\n * Obtiene la tienda pública en TanStack Start (server function, loader o server route).\n * Usa `getRequestHeaders()` del contexto de request activo.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n source: options?.source,\n });\n}\n\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n ...options,\n });\n}\n"]}