@ecomiq/storefront 1.1.5 → 2.0.0

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 (134) hide show
  1. package/README.md +26 -417
  2. package/bin/ecomiq.mjs +154 -0
  3. package/package.json +72 -84
  4. package/src/api-proxy.ts +194 -0
  5. package/src/auth/create-storefront-auth.ts +35 -0
  6. package/src/auth/ecomiq-oauth-password-client.ts +26 -0
  7. package/src/auth/ecomiq-oauth-password-constants.ts +26 -0
  8. package/src/auth/ecomiq-oauth-password-plugin.ts +299 -0
  9. package/src/auth/ecomiq-oauth-password-types.ts +25 -0
  10. package/src/auth/ecomiq-storefront-sign-in.ts +47 -0
  11. package/src/auth/env.ts +7 -0
  12. package/src/cart-session.ts +241 -0
  13. package/src/client.ts +48 -0
  14. package/src/codegen.mjs +603 -0
  15. package/src/components/checkout/cart-sync.ts +143 -0
  16. package/src/components/checkout/checkout-external-update-banner.tsx +15 -0
  17. package/src/components/checkout/checkout-form-controls.tsx +139 -0
  18. package/src/components/checkout/checkout-line-items.tsx +43 -0
  19. package/src/components/checkout/checkout-order-summary.tsx +156 -0
  20. package/src/components/checkout/checkout-payment-section.tsx +215 -0
  21. package/src/components/checkout/checkout-session-view.tsx +240 -0
  22. package/src/components/checkout/checkout-shipping-address-section.tsx +266 -0
  23. package/src/components/checkout/checkout-shipping-section.tsx +90 -0
  24. package/src/components/checkout/checkout-states.tsx +73 -0
  25. package/src/components/checkout/form-schema.ts +229 -0
  26. package/src/components/checkout/format.ts +27 -0
  27. package/src/components/checkout/index.ts +51 -0
  28. package/src/components/checkout/types.ts +43 -0
  29. package/src/components/checkout/use-checkout-geo.ts +50 -0
  30. package/src/components/checkout/use-checkout-session.ts +583 -0
  31. package/src/components/hero.tsx +291 -0
  32. package/src/config.d.ts +69 -0
  33. package/src/config.mjs +165 -0
  34. package/src/index.ts +274 -0
  35. package/src/link.tsx +2 -0
  36. package/src/pages/checkout.$checkoutId.tsx +60 -0
  37. package/src/pages/checkout.tsx +31 -0
  38. package/src/pages/thank-you.tsx +53 -0
  39. package/src/providers/auth.tsx +69 -0
  40. package/src/providers/cart.tsx +275 -0
  41. package/src/providers/ecomiq.ts +137 -0
  42. package/src/providers/index.ts +26 -0
  43. package/src/public-config.ts +44 -0
  44. package/src/review-submission.ts +89 -0
  45. package/src/runtime/context.ts +1 -0
  46. package/src/runtime/default-layout.tsx +80 -0
  47. package/src/runtime/head.ts +126 -0
  48. package/src/runtime/page.tsx +82 -0
  49. package/src/runtime/postcss-browser-stub.mjs +5 -0
  50. package/src/server-config-store.ts +26 -0
  51. package/src/server.ts +279 -0
  52. package/src/styles.css +76 -0
  53. package/src/ui/badge.tsx +32 -0
  54. package/src/ui/button.tsx +31 -0
  55. package/src/ui/card.tsx +31 -0
  56. package/src/ui/carousel.tsx +218 -0
  57. package/src/ui/cn.ts +6 -0
  58. package/src/ui/index.ts +8 -0
  59. package/src/ui/separator.tsx +6 -0
  60. package/src/ui/skeleton.tsx +6 -0
  61. package/src/ui/storefront-error.tsx +49 -0
  62. package/src/utils.ts +36 -0
  63. package/src/vite-inline.mjs +95 -0
  64. package/templates/__root.tsx +77 -0
  65. package/templates/router.tsx +19 -0
  66. package/dist/chunk-3QGB55R6.js +0 -157
  67. package/dist/chunk-3QGB55R6.js.map +0 -1
  68. package/dist/chunk-64GLOWMJ.js +0 -216
  69. package/dist/chunk-64GLOWMJ.js.map +0 -1
  70. package/dist/chunk-ASFU32ZM.js +0 -236
  71. package/dist/chunk-ASFU32ZM.js.map +0 -1
  72. package/dist/chunk-Q4U5OEUT.js +0 -21
  73. package/dist/chunk-Q4U5OEUT.js.map +0 -1
  74. package/dist/chunk-QRR7EPCH.js +0 -176
  75. package/dist/chunk-QRR7EPCH.js.map +0 -1
  76. package/dist/chunk-S7CPZ4UE.js +0 -6
  77. package/dist/chunk-S7CPZ4UE.js.map +0 -1
  78. package/dist/chunk-ZG2XUYGZ.js +0 -1281
  79. package/dist/chunk-ZG2XUYGZ.js.map +0 -1
  80. package/dist/chunks/client.css +0 -984
  81. package/dist/chunks/client.css.map +0 -1
  82. package/dist/chunks/client.d.ts +0 -10041
  83. package/dist/chunks/client.js +0 -5363
  84. package/dist/chunks/client.js.map +0 -1
  85. package/dist/chunks/config.d.ts +0 -31
  86. package/dist/chunks/config.js +0 -5
  87. package/dist/chunks/config.js.map +0 -1
  88. package/dist/chunks/core-public.d.ts +0 -130
  89. package/dist/chunks/core-public.js +0 -92
  90. package/dist/chunks/core-public.js.map +0 -1
  91. package/dist/chunks/server-nextjs.d.ts +0 -33
  92. package/dist/chunks/server-nextjs.js +0 -47
  93. package/dist/chunks/server-nextjs.js.map +0 -1
  94. package/dist/chunks/server-tanstack.d.ts +0 -22
  95. package/dist/chunks/server-tanstack.js +0 -34
  96. package/dist/chunks/server-tanstack.js.map +0 -1
  97. package/dist/collection-C6bWDLiw.d.ts +0 -3926
  98. package/dist/ecomiq-oauth-password-plugin-J5wDFqzL.d.ts +0 -3629
  99. package/dist/ecomiq-shell-ui-SWIFLQVM.js +0 -8
  100. package/dist/ecomiq-shell-ui-SWIFLQVM.js.map +0 -1
  101. package/dist/index.d.ts +0 -9
  102. package/dist/index.js +0 -1
  103. package/dist/index.js.map +0 -1
  104. package/dist/index.server.d.ts +0 -9
  105. package/dist/index.server.js +0 -8
  106. package/dist/index.server.js.map +0 -1
  107. package/dist/nextjs/api.d.ts +0 -45
  108. package/dist/nextjs/api.js +0 -32
  109. package/dist/nextjs/api.js.map +0 -1
  110. package/dist/nextjs/globals.css +0 -13
  111. package/dist/nextjs.d.ts +0 -2
  112. package/dist/nextjs.js +0 -2
  113. package/dist/nextjs.js.map +0 -1
  114. package/dist/nextjs.server.d.ts +0 -1
  115. package/dist/nextjs.server.js +0 -1
  116. package/dist/nextjs.server.js.map +0 -1
  117. package/dist/postcss.config.mjs +0 -6
  118. package/dist/react/checkout-page.css +0 -855
  119. package/dist/react/client.css +0 -984
  120. package/dist/react/payment-provider.css +0 -91
  121. package/dist/react/thank-you-page.css +0 -105
  122. package/dist/react.d.ts +0 -1
  123. package/dist/react.js +0 -2
  124. package/dist/react.js.map +0 -1
  125. package/dist/store-proxy-handler-CNzKlTFA.d.ts +0 -10
  126. package/dist/tanstack/api.d.ts +0 -41
  127. package/dist/tanstack/api.js +0 -30
  128. package/dist/tanstack/api.js.map +0 -1
  129. package/dist/tanstack.d.ts +0 -2
  130. package/dist/tanstack.js +0 -2
  131. package/dist/tanstack.js.map +0 -1
  132. package/dist/tanstack.server.d.ts +0 -1
  133. package/dist/tanstack.server.js +0 -1
  134. package/dist/tanstack.server.js.map +0 -1
@@ -1,31 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- declare const EcomiqConfigSchema: z.ZodObject<{
4
- /**
5
- * Slug de tienda en Ecomiq (p. ej. `mi-tienda` para `mi-tienda.ecomiq.app`).
6
- * Opcional: si se omite, la tienda se resuelve por el header `Host`.
7
- */
8
- slugStore: z.ZodOptional<z.ZodString>;
9
- }, "strip", z.ZodTypeAny, {
10
- slugStore?: string | undefined;
11
- }, {
12
- slugStore?: string | undefined;
13
- }>;
14
- type EcomiqConfig = z.infer<typeof EcomiqConfigSchema>;
15
-
16
- /**
17
- * Carga `ecomiq.config.js` (o `.cjs` / `.mjs`) desde `cwd` si existe.
18
- * Si no hay archivo, devuelve `null` (resolución por `Host` en `resolvePublicStoreKey`).
19
- */
20
- declare function loadEcomiqConfig(cwd?: string): EcomiqConfig | null;
21
- /** Limpia la caché (tests o recarga en dev). */
22
- declare function clearEcomiqConfigCache(): void;
23
- /**
24
- * Identificador de tienda para settings (API / KV).
25
- * 1. `slugStore` en `ecomiq.config.*` si el archivo existe.
26
- * 2. Si no, deriva del header `Host`.
27
- */
28
- declare function resolvePublicStoreKey(hostHeader: string | null | undefined, cwd?: string): string;
29
- declare function hasEcomiqSlugStoreConfig(cwd?: string): boolean;
30
-
31
- export { type EcomiqConfig, EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey };
@@ -1,5 +0,0 @@
1
- export { EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey } from '../chunk-3QGB55R6.js';
2
- import '../chunk-64GLOWMJ.js';
3
- import '../chunk-Q4U5OEUT.js';
4
- //# sourceMappingURL=config.js.map
5
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"config.js"}
@@ -1,130 +0,0 @@
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
- import 'zod';
4
-
5
- /** Prefijo base de la API storefront (ej. v1/storefront). */
6
- declare const STOREFRONT_API_PATH_PREFIX = "v1";
7
-
8
- declare const countryCurrency: {
9
- PEN: string;
10
- USD: string;
11
- COP: string;
12
- MXN: string;
13
- };
14
-
15
- /**
16
- * Formats a number as currency using the store's locale for the given currency code.
17
- * Uses countryCurrency to pick the right locale (e.g. PEN → es-PE, USD → en-US).
18
- */
19
- declare function formatCurrency(amount: number, currency?: string): string;
20
-
21
- /** Sanitización mínima de HTML (script, event handlers, javascript:…). */
22
- declare function sanitizeHtml(html: string): string;
23
- /** Convierte HTML en texto plano (metadata, JSON-LD). */
24
- declare function stripHtml(html: string): string;
25
-
26
- declare function formatCustomerOrderStatus(status: string): string;
27
- declare function customerOrderStatusTone(status: string): "default" | "success" | "warning" | "danger" | "info";
28
- declare function formatOrderDate(iso: string, locale?: string): string;
29
- declare function formatOrderDateTime(iso: string, locale?: string): string;
30
-
31
- /**
32
- * Busca una página CMS en `settings.cms.pages` (payload de `getPublicStore` / settings)
33
- * y la valida como `StorefrontPageDetail` para `DynamicPage`.
34
- */
35
- declare function findStorefrontCmsPageBySlug(settings: StorefrontSettings | null | undefined, slug: string): StorefrontPageDetail | null;
36
-
37
- /** Dirección de envío en pedidos del cliente (listado y detalle). */
38
- type CustomerOrderShippingAddress = {
39
- name?: string | null;
40
- company?: string | null;
41
- address1: string;
42
- address2?: string | null;
43
- city?: string | null;
44
- countryCode: string;
45
- province?: string | null;
46
- postalCode?: string | null;
47
- district?: string | null;
48
- phone?: string | null;
49
- latitude?: number | null;
50
- longitude?: number | null;
51
- metadata?: Record<string, unknown> | null;
52
- };
53
- type CustomerOrderListItem = {
54
- orderId: string;
55
- orderNumber: string;
56
- orderGroup: string;
57
- orderIds: string[];
58
- status: string;
59
- total: number;
60
- totalPaid: number;
61
- currencyCode: string;
62
- orderDate: string;
63
- createdOn: string;
64
- updatedOn?: string | null;
65
- paymentAt?: string | null;
66
- shippingAddress?: CustomerOrderShippingAddress | null;
67
- shippingAddressSummary?: string | null;
68
- items: CustomerOrderLineItem[];
69
- };
70
- type CustomerOrderLineItem = {
71
- id: string;
72
- orderId: string;
73
- productId: string | null;
74
- variantId: string | null;
75
- title: string;
76
- subtitle?: string | null;
77
- thumbnail?: string | null;
78
- variantTitle?: string | null;
79
- productHandle?: string | null;
80
- quantity: number;
81
- unitPrice: number;
82
- total: number;
83
- status: string;
84
- };
85
- type CustomerOrderPayment = {
86
- id: string;
87
- paymentMethod: string;
88
- paymentCode: string;
89
- amount: number;
90
- paymentStatus: string;
91
- receiptUrl?: string | null;
92
- createdOn: string;
93
- };
94
- type CustomerOrderStatusTimelineEntry = {
95
- key: string;
96
- label: string;
97
- occurredAt: string;
98
- description?: string | null;
99
- status: string;
100
- source: string;
101
- };
102
- type CustomerOrderDetail = {
103
- id: string;
104
- orderNumber: string;
105
- orderGroup: string;
106
- status: string;
107
- total: number;
108
- totalPaid: number;
109
- currencyCode: string;
110
- orderDate: string;
111
- createdOn: string;
112
- updatedOn?: string | null;
113
- paymentAt?: string | null;
114
- subTotal: number;
115
- discount: number;
116
- shipping: number;
117
- tax: number;
118
- email: string;
119
- phone: string;
120
- firstName: string;
121
- lastName: string;
122
- shippingAddress?: CustomerOrderShippingAddress | null;
123
- shippingAddressSummary?: string | null;
124
- billingAddress?: CustomerOrderShippingAddress | null;
125
- items: CustomerOrderLineItem[];
126
- payments: CustomerOrderPayment[];
127
- statusTimeline: CustomerOrderStatusTimelineEntry[];
128
- };
129
-
130
- export { type CustomerOrderDetail, type CustomerOrderListItem, STOREFRONT_API_PATH_PREFIX, StorefrontPageDetail, StorefrontSettings, countryCurrency, customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
@@ -1,92 +0,0 @@
1
- import { StorefrontPageDetailSchema } from '../chunk-ASFU32ZM.js';
2
- export { StorefrontCollectionDetailSchema, StorefrontCollectionSchema, StorefrontCollectionsResponseSchema, StorefrontPageDetailSchema, StorefrontPageListItemSchema, StorefrontProductDetailSchema, StorefrontProductSchema, StorefrontProductsParamsSchema, StorefrontProductsResponseSchema } from '../chunk-ASFU32ZM.js';
3
- export { StorefrontSettingsSchema, StorefrontStoreSchema } from '../chunk-64GLOWMJ.js';
4
- export { STOREFRONT_API_PATH_PREFIX } from '../chunk-S7CPZ4UE.js';
5
- import { countryCurrency } from '../chunk-Q4U5OEUT.js';
6
- export { countryCurrency } from '../chunk-Q4U5OEUT.js';
7
-
8
- // src/core/utils/format-currency.ts
9
- function formatCurrency(amount, currency = "USD") {
10
- const locale = countryCurrency[currency] ?? "en-US";
11
- return new Intl.NumberFormat(locale, {
12
- style: "currency",
13
- currency
14
- }).format(amount);
15
- }
16
-
17
- // src/core/utils/cms-html.ts
18
- function sanitizeHtml(html) {
19
- return html.replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?>[\s\S]*?<\/style>/gi, "").replace(/<(iframe|object|embed|link|meta)[\s\S]*?>/gi, "").replace(/\son\w+\s*=\s*(['"]).*?\1/gi, "").replace(/\s(href|src)\s*=\s*(['"])\s*javascript:[\s\S]*?\2/gi, "");
20
- }
21
- function stripHtml(html) {
22
- return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
23
- }
24
-
25
- // src/core/lib/customer-order-labels.ts
26
- var ORDER_STATUS_LABELS = {
27
- New: "Pedido realizado",
28
- Confirmed: "Confirmado",
29
- Processing: "En preparaci\xF3n",
30
- InTransit: "En camino",
31
- Delivered: "Entregado",
32
- Cancelled: "Cancelado",
33
- Canceled: "Cancelado",
34
- Refunded: "Reembolsado",
35
- Pending: "Pendiente",
36
- Paid: "Pagado",
37
- Captured: "Pago confirmado"
38
- };
39
- function formatCustomerOrderStatus(status) {
40
- const trimmed = status.trim();
41
- if (!trimmed) return "Desconocido";
42
- return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
43
- }
44
- function customerOrderStatusTone(status) {
45
- const s = status.toLowerCase();
46
- if (s.includes("cancel") || s.includes("refund")) return "danger";
47
- if (s.includes("deliver")) return "success";
48
- if (s.includes("transit") || s.includes("ship")) return "info";
49
- if (s.includes("confirm") || s.includes("paid") || s.includes("capture")) return "success";
50
- if (s.includes("pending") || s.includes("new") || s.includes("process")) return "warning";
51
- return "default";
52
- }
53
- function formatOrderDate(iso, locale = "es-PE") {
54
- const d = new Date(iso);
55
- if (Number.isNaN(d.getTime())) return iso;
56
- return new Intl.DateTimeFormat(locale, {
57
- day: "numeric",
58
- month: "long",
59
- year: "numeric"
60
- }).format(d);
61
- }
62
- function formatOrderDateTime(iso, locale = "es-PE") {
63
- const d = new Date(iso);
64
- if (Number.isNaN(d.getTime())) return iso;
65
- return new Intl.DateTimeFormat(locale, {
66
- day: "numeric",
67
- month: "short",
68
- year: "numeric",
69
- hour: "2-digit",
70
- minute: "2-digit"
71
- }).format(d);
72
- }
73
-
74
- // src/react/shell/lib/find-storefront-cms-page.ts
75
- function isRenderableCmsPage(p) {
76
- if (!p.status) return true;
77
- return p.status === "published";
78
- }
79
- function findStorefrontCmsPageBySlug(settings, slug) {
80
- const pages = settings?.cms?.pages;
81
- if (!pages?.length) return null;
82
- const raw = pages.find(
83
- (p) => p.slug === slug && isRenderableCmsPage(p)
84
- );
85
- if (!raw) return null;
86
- const parsed = StorefrontPageDetailSchema.safeParse(raw);
87
- return parsed.success ? parsed.data : null;
88
- }
89
-
90
- export { customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
91
- //# sourceMappingURL=core-public.js.map
92
- //# sourceMappingURL=core-public.js.map
@@ -1 +0,0 @@
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":"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","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,33 +0,0 @@
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
- export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
4
- import '../collection-C6bWDLiw.js';
5
- import 'zod';
6
- import 'better-auth';
7
-
8
- /**
9
- * Devuelve el host completo de la request (ej. "plata950.ecomiq.pe", "localhost:3000").
10
- */
11
- declare function getHostname(): Promise<string | null>;
12
-
13
- type GetPublicStoreOptions = {
14
- /** Si se omite, se usa `resolvePublicStoreSettingsSource()` (variable de entorno). */
15
- source?: PublicStoreSettingsSource;
16
- };
17
- /**
18
- * Obtiene la tienda pública (Next.js App Router).
19
- * Usa `headers()` para resolver host y origen del proxy.
20
- *
21
- * Identificador de tienda:
22
- * 1. `slugStore` en `ecomiq.config.js` si existe (opcional, útil en localhost).
23
- * 2. Si no hay config, deriva del header `Host`.
24
- */
25
- declare function getPublicStore(options?: GetPublicStoreOptions): Promise<PublicStoreResult>;
26
- /**
27
- * Igual que `getPublicStore` pero con headers explícitos (tests, middleware custom).
28
- */
29
- declare function getPublicStoreFromHeaders(headerList: {
30
- get(name: string): string | null;
31
- }, options?: Omit<FetchPublicStoreSettingsOptions, "host">): Promise<PublicStoreResult>;
32
-
33
- export { FetchPublicStoreSettingsOptions, PublicStoreResult, PublicStoreSettingsSource, getHostname, getPublicStore, getPublicStoreFromHeaders };
@@ -1,47 +0,0 @@
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
- import '../chunk-ASFU32ZM.js';
5
- import '../chunk-64GLOWMJ.js';
6
- export { handleStoreProxyRequest } from '../chunk-QRR7EPCH.js';
7
- import '../chunk-S7CPZ4UE.js';
8
- import '../chunk-Q4U5OEUT.js';
9
- import { headers } from 'next/headers';
10
- import { cache } from 'react';
11
-
12
- async function getHostname() {
13
- const headerList = await headers();
14
- applyServerRequestOriginFromHeaders(headerList);
15
- return normalizeRequestHostname(headerList);
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
- }
27
- async function getPublicStore(options) {
28
- const headerList = await headers();
29
- applyServerRequestOriginFromHeaders(headerList);
30
- const result = await fetchPublicStoreSettingsForRequest(
31
- headerList.get("host"),
32
- options?.source ?? null
33
- );
34
- return applyPublicStoreRuntime(result);
35
- }
36
- async function getPublicStoreFromHeaders(headerList, options) {
37
- applyServerRequestOriginFromHeaders(headerList);
38
- const result = await fetchPublicStoreSettingsForRequest(
39
- headerList.get("host"),
40
- options?.source ?? null
41
- );
42
- return applyPublicStoreRuntime(result);
43
- }
44
-
45
- export { getHostname, getPublicStore, getPublicStoreFromHeaders };
46
- //# sourceMappingURL=server-nextjs.js.map
47
- //# sourceMappingURL=server-nextjs.js.map
@@ -1 +0,0 @@
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,22 +0,0 @@
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
- export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
4
- import '../collection-C6bWDLiw.js';
5
- import 'zod';
6
- import 'better-auth';
7
-
8
- declare function getHostname(): Promise<string | null>;
9
-
10
- type GetPublicStoreOptions = {
11
- source?: PublicStoreSettingsSource;
12
- };
13
- /**
14
- * Obtiene la tienda pública en TanStack Start (server function, loader o server route).
15
- * Usa `getRequestHeaders()` del contexto de request activo.
16
- */
17
- declare function getPublicStore(options?: GetPublicStoreOptions): Promise<PublicStoreResult>;
18
- declare function getPublicStoreFromHeaders(headerList: {
19
- get(name: string): string | null;
20
- }, options?: Omit<FetchPublicStoreSettingsOptions, "host">): Promise<PublicStoreResult>;
21
-
22
- export { FetchPublicStoreSettingsOptions, PublicStoreResult, PublicStoreSettingsSource, getHostname, getPublicStore, getPublicStoreFromHeaders };
@@ -1,34 +0,0 @@
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
- import '../chunk-ASFU32ZM.js';
5
- import '../chunk-64GLOWMJ.js';
6
- export { handleStoreProxyRequest } from '../chunk-QRR7EPCH.js';
7
- import '../chunk-S7CPZ4UE.js';
8
- import '../chunk-Q4U5OEUT.js';
9
- import { getRequestHeaders } from '@tanstack/react-start/server';
10
-
11
- async function getHostname() {
12
- const headerList = getRequestHeaders();
13
- applyServerRequestOriginFromHeaders(headerList);
14
- return normalizeRequestHostname(headerList);
15
- }
16
- async function getPublicStore(options) {
17
- const headerList = getRequestHeaders();
18
- applyServerRequestOriginFromHeaders(headerList);
19
- return fetchPublicStoreSettings({
20
- host: headerList.get("host"),
21
- source: options?.source
22
- });
23
- }
24
- async function getPublicStoreFromHeaders(headerList, options) {
25
- applyServerRequestOriginFromHeaders(headerList);
26
- return fetchPublicStoreSettings({
27
- host: headerList.get("host"),
28
- ...options
29
- });
30
- }
31
-
32
- export { getHostname, getPublicStore, getPublicStoreFromHeaders };
33
- //# sourceMappingURL=server-tanstack.js.map
34
- //# sourceMappingURL=server-tanstack.js.map
@@ -1 +0,0 @@
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"]}