@ecomiq/storefront 2.1.4 → 3.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.
- package/LICENSE +21 -0
- package/README.md +150 -103
- package/dist/account-Dx4e3syi.js +258 -0
- package/dist/account-forms-AVk71ko7.js +39 -0
- package/dist/account-forms.d.ts +13 -0
- package/dist/account.d.ts +240 -0
- package/dist/address-defaults-BqjRhS82.js +14 -0
- package/dist/address-defaults.d.ts +11 -0
- package/dist/analytics/analytics-CG1Qagwl.js +148 -0
- package/dist/analytics/analytics.d.ts +1 -0
- package/dist/analytics/config-DJr-GRhs.js +62 -0
- package/dist/analytics/config.d.ts +22 -0
- package/dist/analytics/consent-B13rBpBs.js +57 -0
- package/dist/analytics/consent-banner-9QvRRy8v.js +239 -0
- package/dist/analytics/consent-banner.d.ts +20 -0
- package/dist/analytics/cookies-pLozllyB.js +100 -0
- package/dist/analytics/cookies.d.ts +6 -0
- package/dist/analytics/destinations-iECrlLIr.js +144 -0
- package/dist/analytics/events-Dt81tIp1.js +102 -0
- package/dist/analytics/events.d.ts +51 -0
- package/dist/analytics/tracker-p4yaoOyk.js +51 -0
- package/dist/api-cache-DsuIn5hX.js +159 -0
- package/dist/bank-accounts-DlEczQQ5.js +81 -0
- package/dist/bank-accounts.d.ts +4 -0
- package/dist/captcha-DAqaIx8m.js +117 -0
- package/dist/captcha.d.ts +34 -0
- package/dist/cart-D7DxZ2lD.js +30 -0
- package/dist/cart-actions-Bsub_FFG.js +116 -0
- package/dist/cart-actions.d.ts +15 -0
- package/dist/cart-drawer-B7PPsR69.js +22 -0
- package/dist/cart-drawer.d.ts +9 -0
- package/dist/cart-form-y9P1r_EX.js +81 -0
- package/dist/cart-form.d.ts +24 -0
- package/dist/cart-summary-ur2VWKr-.js +89 -0
- package/dist/cart-summary.d.ts +31 -0
- package/dist/cart.d.ts +4 -0
- package/dist/catalog-7gJ-l5hW.js +67 -0
- package/dist/catalog-hooks-B7ZP4wYY.js +312 -0
- package/dist/catalog-hooks.d.ts +111 -0
- package/dist/catalog.d.ts +5 -0
- package/dist/checkout-DVWSXANi.js +474 -0
- package/dist/checkout-form-CbOIdENC.js +131 -0
- package/dist/checkout-form.d.ts +20 -0
- package/dist/checkout.d.ts +86 -0
- package/dist/complaint-book-BvwLvfx0.js +117 -0
- package/dist/complaint-book.d.ts +62 -0
- package/dist/culqi-authentication-BGr20vAJ.js +204 -0
- package/dist/culqi-authentication.d.ts +15 -0
- package/dist/culqi-checkout-CTXpKgp_.js +55 -0
- package/dist/culqi-three-ds-HP3mfrvV.js +33 -0
- package/dist/culqi-three-ds.d.ts +29 -0
- package/dist/customer-avatar-CJXSDroK.js +12 -0
- package/dist/customer-avatar.d.ts +5 -0
- package/dist/customer-cookies-DHOgFAMV.js +45 -0
- package/dist/customer-csrf-C1oDX-Py.js +17 -0
- package/dist/customer-csrf.d.ts +3 -0
- package/dist/customer-document-fields-C1K-_DAD.js +70 -0
- package/dist/customer-document-fields.d.ts +9 -0
- package/dist/customer-login-form-C7AC6vXd.js +144 -0
- package/dist/customer-login-form.d.ts +17 -0
- package/dist/customer-registration-form-BEm_NEfP.js +93 -0
- package/dist/customer-registration-form.d.ts +8 -0
- package/dist/document-url-CGsAl5Tf.js +9 -0
- package/dist/documents-T1mzc_j8.js +38 -0
- package/dist/documents.d.ts +16 -0
- package/dist/entries/account.d.ts +11 -0
- package/dist/entries/account.js +10 -0
- package/dist/entries/analytics.d.ts +6 -0
- package/dist/entries/analytics.js +5 -0
- package/dist/entries/cart.d.ts +8 -0
- package/dist/entries/cart.js +7 -0
- package/dist/entries/checkout.d.ts +12 -0
- package/dist/entries/checkout.js +11 -0
- package/dist/entries/order.d.ts +11 -0
- package/dist/entries/order.js +11 -0
- package/dist/favicon-YpyhVJ9H.js +28 -0
- package/dist/favicon.d.ts +4 -0
- package/dist/form-BtQcbXlJ.js +18 -0
- package/dist/form-contracts-BNpHaTGJ.js +166 -0
- package/dist/form-contracts.d.ts +42 -0
- package/dist/form.d.ts +3 -0
- package/dist/hidden-CCWtOWKR.js +3 -0
- package/dist/hidden.d.ts +4 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +50 -0
- package/dist/invoice-fields-BG0HjL6T.js +103 -0
- package/dist/invoice-fields.d.ts +39 -0
- package/dist/links-kFxBZfdb.js +96 -0
- package/dist/links.d.ts +21 -0
- package/dist/mercadopago-checkout-DC7RXa8k.js +27 -0
- package/dist/mercadopago-dialog-UTQev0MG.js +180 -0
- package/dist/mercadopago-dialog.d.ts +21 -0
- package/dist/money-DtGOtDri.js +32 -0
- package/dist/money.d.ts +1 -0
- package/dist/optimistic-cart-BveVOHuh.js +53 -0
- package/dist/optimistic-cart.d.ts +16 -0
- package/dist/order-display-DTt5WBbc.js +112 -0
- package/dist/order-display.d.ts +20 -0
- package/dist/order-draft-DxV1Uhm3.js +38 -0
- package/dist/order-draft.d.ts +16 -0
- package/dist/order-pages-Dm6l5m0m.js +38 -0
- package/dist/order-pages.d.ts +12 -0
- package/dist/order-payment-continuation-D_d5PGA4.js +212 -0
- package/dist/order-payment-continuation.d.ts +10 -0
- package/dist/order-payment-in-review-x4gdLFHZ.js +65 -0
- package/dist/order-payment-in-review.d.ts +5 -0
- package/dist/order-status-BJXLJwxq.js +162 -0
- package/dist/order-status.d.ts +89 -0
- package/dist/order-view-9IlBg5AF.js +62 -0
- package/dist/order-view.d.ts +12 -0
- package/dist/page-action-Ctkf4xC6.js +7 -0
- package/dist/page-seo-a5FJl8x5.js +262 -0
- package/dist/page-seo.d.ts +34 -0
- package/dist/pages-Ca_Gt6mq.js +150 -0
- package/dist/pages.d.ts +45 -0
- package/dist/payment-dialog-frame-B-Q_xQ94.js +57 -0
- package/dist/payment-logo-BoPaGJc_.js +46 -0
- package/dist/payment-logo-svgs-By9lDTLK.js +20 -0
- package/dist/payment-logo.d.ts +11 -0
- package/dist/payment-logos-BYvdwYyJ.js +23 -0
- package/dist/payment-methods-B8ocTgFZ.js +73 -0
- package/dist/payment-methods.d.ts +58 -0
- package/dist/payment-return-5cjypwIw.js +7 -0
- package/dist/place-CmW4hBWY.js +13 -0
- package/dist/place.d.ts +4 -0
- package/dist/preview-BiIBif3C.js +427 -0
- package/dist/preview-address-Cf0sJ-9p.js +21 -0
- package/dist/preview-cart-Dg2CVktS.js +376 -0
- package/dist/product-preview-BspMAecJ.js +51 -0
- package/dist/product-preview.d.ts +5 -0
- package/dist/product-variants-BNDHvs1y.js +46 -0
- package/dist/product-variants.d.ts +12 -0
- package/dist/public-pages-XtwlaLwt.js +194 -0
- package/dist/public-pages.d.ts +67 -0
- package/dist/registration-CpDcv8ql.js +91 -0
- package/dist/registration.d.ts +12 -0
- package/dist/request-security-CRsRMgwj.js +76 -0
- package/dist/rich-text-M-Ju8RL4.js +9 -0
- package/dist/rich-text.d.ts +5 -0
- package/dist/route-text-DcJw2SsK.js +9 -0
- package/dist/route-text.d.ts +4 -0
- package/dist/section-preview-CmsMl3yu.js +83 -0
- package/dist/section-preview.d.ts +12 -0
- package/dist/sections/account-addresses.d.ts +18 -0
- package/dist/sections/account-addresses.js +375 -0
- package/dist/sections/account-order.d.ts +12 -0
- package/dist/sections/account-order.js +592 -0
- package/dist/sections/account-orders.d.ts +8 -0
- package/dist/sections/account-orders.js +359 -0
- package/dist/sections/account-profile.d.ts +16 -0
- package/dist/sections/account-profile.js +123 -0
- package/dist/sections/checkout.d.ts +24 -0
- package/dist/sections/checkout.js +963 -0
- package/dist/sections/complaint-book.d.ts +8 -0
- package/dist/sections/complaint-book.js +538 -0
- package/dist/sections/design-system.d.ts +1 -0
- package/dist/sections/design-system.js +310 -0
- package/dist/sections/draft-invoice.d.ts +20 -0
- package/dist/sections/draft-invoice.js +158 -0
- package/dist/sections/order-tracking.d.ts +19 -0
- package/dist/sections/order-tracking.js +141 -0
- package/dist/sections-CNUMWTF_.js +77 -0
- package/dist/sections.d.ts +19 -0
- package/dist/seo-GpDRhAAA.js +78 -0
- package/dist/session-CKvmFJyg.js +379 -0
- package/dist/session.d.ts +24 -0
- package/dist/settings-B0NO2A6Y.js +78 -0
- package/dist/settings.d.ts +51 -0
- package/dist/source-marker-DhqSkW7n.js +4 -0
- package/dist/sources-B-3JFJfb.js +46 -0
- package/dist/sources.d.ts +7 -0
- package/dist/store-8Q-_LFrQ.js +152 -0
- package/dist/store-contact--hY6CoFb.js +19 -0
- package/dist/store-contact.d.ts +6 -0
- package/dist/store.d.ts +17 -0
- package/dist/storefront-language-DrMjVbmk.js +29 -0
- package/dist/storefront-language.d.ts +14 -0
- package/dist/storefront-text-D25ae1qf.js +11 -0
- package/dist/storefront-text-en-ljjjSS4q.js +1030 -0
- package/dist/storefront-text-pt-BtHaJLcp.js +1030 -0
- package/dist/storefront-text.d.ts +4 -0
- package/dist/stripe-dialog-Ev9s3Z62.js +396 -0
- package/dist/stripe-dialog.d.ts +30 -0
- package/dist/telemetry-HuZXWBPi.js +114 -0
- package/dist/telemetry.d.ts +10 -0
- package/dist/templates-CAqoNyTW.js +40 -0
- package/dist/templates.d.ts +15 -0
- package/dist/urls-CpGQPxvf.js +71 -0
- package/dist/urls.d.ts +18 -0
- package/dist/use-checkout-CZcxXJXi.js +42 -0
- package/dist/use-checkout-payment-9R-zacrJ.js +80 -0
- package/dist/use-checkout-payment.d.ts +18 -0
- package/dist/use-checkout.d.ts +36 -0
- package/dist/use-culqi-checkout-CrjLAipU.js +109 -0
- package/dist/use-order-payment-BKIz_IO0.js +45 -0
- package/dist/use-order-payment.d.ts +18 -0
- package/dist/use-payment-token-CErx-tN-.js +105 -0
- package/dist/vite-payment-logos-kziu7wKb.js +27 -0
- package/dist/vite-payment-logos.d.ts +24 -0
- package/dist/vite-public-assets-DW2fgtVb.js +209 -0
- package/dist/vite-public-assets.d.ts +29 -0
- package/dist/vite-sections-DTBr0-Kg.js +464 -0
- package/dist/vite-sections.d.ts +21 -0
- package/dist/vite-theme-ui-BMO-CDi3.js +41 -0
- package/dist/vite-theme-ui.d.ts +10 -0
- package/dist/vite.d.ts +36 -0
- package/dist/vite.js +127 -0
- package/dist/voucher-payment-CVFDZ1L8.js +66 -0
- package/dist/worker-CNi-gzCu.js +86 -0
- package/dist/worker.d.ts +27 -0
- package/package.json +100 -76
- package/src/sections/account-addresses.tsx +215 -0
- package/src/sections/account-order.tsx +424 -0
- package/src/sections/account-orders.tsx +259 -0
- package/src/sections/account-profile.tsx +70 -0
- package/src/sections/checkout.tsx +586 -0
- package/src/sections/complaint-book.tsx +325 -0
- package/src/sections/design-system.tsx +146 -0
- package/src/sections/draft-invoice.tsx +105 -0
- package/src/sections/order-tracking.tsx +81 -0
- package/src/vite-client.d.ts +4 -0
- package/bin/ecomiq.mjs +0 -179
- package/public/design-bridge.js +0 -318
- package/src/api-proxy.ts +0 -194
- package/src/auth/create-storefront-auth.ts +0 -94
- package/src/auth/ecomiq-oauth-password-client.ts +0 -26
- package/src/auth/ecomiq-oauth-password-constants.ts +0 -24
- package/src/auth/ecomiq-oauth-password-plugin.ts +0 -294
- package/src/auth/ecomiq-oauth-password-types.ts +0 -24
- package/src/auth/ecomiq-storefront-sign-in.ts +0 -44
- package/src/auth/env.ts +0 -7
- package/src/auth/secure-cookies.ts +0 -23
- package/src/auth/storefront-auth-base-url.ts +0 -117
- package/src/auth/storefront-auth.ts +0 -7
- package/src/cart-session.ts +0 -239
- package/src/client.ts +0 -48
- package/src/codegen.mjs +0 -801
- package/src/components/account/customer-addresses-panel.tsx +0 -678
- package/src/components/account/customer-order-detail-panel.tsx +0 -285
- package/src/components/account/customer-orders-panel.tsx +0 -192
- package/src/components/account/customer-profile-panel.tsx +0 -379
- package/src/components/checkout/cart-sync.ts +0 -143
- package/src/components/checkout/checkout-contact-section.tsx +0 -76
- package/src/components/checkout/checkout-external-update-banner.tsx +0 -15
- package/src/components/checkout/checkout-form-controls.tsx +0 -139
- package/src/components/checkout/checkout-line-items.tsx +0 -43
- package/src/components/checkout/checkout-order-summary.tsx +0 -165
- package/src/components/checkout/checkout-payment-section.tsx +0 -212
- package/src/components/checkout/checkout-session-view.tsx +0 -564
- package/src/components/checkout/checkout-shipping-address-section.tsx +0 -400
- package/src/components/checkout/checkout-shipping-section.tsx +0 -98
- package/src/components/checkout/checkout-states.tsx +0 -73
- package/src/components/checkout/checkout-step-card.tsx +0 -101
- package/src/components/checkout/checkout-steps.ts +0 -111
- package/src/components/checkout/form-schema.ts +0 -281
- package/src/components/checkout/format.ts +0 -15
- package/src/components/checkout/index.ts +0 -5
- package/src/components/checkout/map-customer-to-checkout.ts +0 -188
- package/src/components/checkout/types.ts +0 -41
- package/src/components/checkout/use-checkout-customer-prefill.ts +0 -409
- package/src/components/checkout/use-checkout-geo.ts +0 -50
- package/src/components/checkout/use-checkout-session.ts +0 -640
- package/src/components/hero.tsx +0 -291
- package/src/config.d.ts +0 -94
- package/src/config.mjs +0 -146
- package/src/format-money.ts +0 -31
- package/src/health.ts +0 -90
- package/src/hooks/index.ts +0 -9
- package/src/hooks/recently-viewed.ts +0 -125
- package/src/index.ts +0 -349
- package/src/link.tsx +0 -2
- package/src/pages/account/account-page-skeleton.tsx +0 -69
- package/src/pages/account/account-page-view.tsx +0 -270
- package/src/pages/account/account-shell.tsx +0 -101
- package/src/pages/account/parse-account-route.ts +0 -36
- package/src/pages/account.tsx +0 -16
- package/src/pages/api.$.ts +0 -20
- package/src/pages/api.auth.$.ts +0 -16
- package/src/pages/checkout.$checkoutId.tsx +0 -60
- package/src/pages/checkout.tsx +0 -31
- package/src/pages/pages.$pageSlug.tsx +0 -74
- package/src/pages/thank-you.tsx +0 -53
- package/src/providers/auth.tsx +0 -96
- package/src/providers/cart.tsx +0 -275
- package/src/providers/ecomiq.ts +0 -137
- package/src/providers/index.ts +0 -26
- package/src/proxy-api.ts +0 -20
- package/src/public-config.ts +0 -24
- package/src/review-submission.ts +0 -89
- package/src/runtime/context.ts +0 -2
- package/src/runtime/default-layout.tsx +0 -64
- package/src/runtime/head.ts +0 -149
- package/src/runtime/page.tsx +0 -143
- package/src/runtime/postcss-browser-stub.mjs +0 -5
- package/src/server-config-store.ts +0 -35
- package/src/server.ts +0 -286
- package/src/styles.css +0 -76
- package/src/ui/badge.tsx +0 -32
- package/src/ui/button.tsx +0 -31
- package/src/ui/card.tsx +0 -31
- package/src/ui/carousel.tsx +0 -218
- package/src/ui/cn.ts +0 -6
- package/src/ui/index.ts +0 -8
- package/src/ui/separator.tsx +0 -6
- package/src/ui/skeleton.tsx +0 -6
- package/src/ui/storefront-error.tsx +0 -49
- package/src/utils.ts +0 -36
- package/src/vite-inline.mjs +0 -263
- package/templates/__root.tsx +0 -83
- package/templates/router.tsx +0 -19
package/dist/vite.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { SectionPropsError, sectionLoaders } from "./vite-sections-DTBr0-Kg.js";
|
|
2
|
+
import { paymentLogos } from "./vite-payment-logos-kziu7wKb.js";
|
|
3
|
+
import { themeUi } from "./vite-theme-ui-BMO-CDi3.js";
|
|
4
|
+
import { publicAssets } from "./vite-public-assets-DW2fgtVb.js";
|
|
5
|
+
import { CATALOG_LINK_ID } from "@ecomiq/core";
|
|
6
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
7
|
+
import { join, resolve, sep } from "node:path";
|
|
8
|
+
import { parse } from "@babel/parser";
|
|
9
|
+
import { traverseFast } from "@babel/types";
|
|
10
|
+
// src/vite.ts
|
|
11
|
+
const MODULE = "virtual:ecomiq-links";
|
|
12
|
+
const RESOLVED_MODULE = `\0${MODULE}`;
|
|
13
|
+
const LINK_TAGS = /* @__PURE__ */ new Set([
|
|
14
|
+
"a",
|
|
15
|
+
"Link",
|
|
16
|
+
"StorefrontLink",
|
|
17
|
+
"StorefrontAnchor"
|
|
18
|
+
]);
|
|
19
|
+
const LINK_ATTRIBUTES = /* @__PURE__ */ new Set(["href", "to"]);
|
|
20
|
+
function unwrap(node) {
|
|
21
|
+
if (node?.type === "TSAsExpression" || node?.type === "TSSatisfiesExpression") return unwrap(node.expression);
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
24
|
+
function text(input) {
|
|
25
|
+
const node = unwrap(input);
|
|
26
|
+
if (node?.type === "StringLiteral") return node.value;
|
|
27
|
+
if (node?.type === "TemplateLiteral" && node.expressions.length === 0) return node.quasis[0]?.value.cooked ?? void 0;
|
|
28
|
+
}
|
|
29
|
+
function reference(input) {
|
|
30
|
+
const node = unwrap(input);
|
|
31
|
+
if (node?.type !== "ObjectExpression") return void 0;
|
|
32
|
+
let type;
|
|
33
|
+
let id;
|
|
34
|
+
for (const property of node.properties) {
|
|
35
|
+
if (property.type !== "ObjectProperty" || property.computed) continue;
|
|
36
|
+
let key = text(property.key);
|
|
37
|
+
if (property.key.type === "Identifier") key = property.key.name;
|
|
38
|
+
if (key === "type") type = text(property.value);
|
|
39
|
+
if (key === "id") id = text(property.value);
|
|
40
|
+
}
|
|
41
|
+
if (id === void 0 || !CATALOG_LINK_ID.test(id)) return void 0;
|
|
42
|
+
if (type === "product" || type === "category") return {
|
|
43
|
+
type,
|
|
44
|
+
id
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function catalogLinksFromSource(source) {
|
|
48
|
+
const file = parse(source, {
|
|
49
|
+
sourceType: "module",
|
|
50
|
+
plugins: ["typescript", "jsx"]
|
|
51
|
+
});
|
|
52
|
+
const links = [];
|
|
53
|
+
const add = (url, target) => {
|
|
54
|
+
if (!url || !url.startsWith("/") && !/^https?:\/\//i.test(url)) return;
|
|
55
|
+
if (url.startsWith("//")) return;
|
|
56
|
+
links.push({
|
|
57
|
+
url,
|
|
58
|
+
reference: target ?? null
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
traverseFast(file, (node) => {
|
|
62
|
+
if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && !node.callee.computed) {
|
|
63
|
+
const owner = node.callee.object;
|
|
64
|
+
if (owner.type === "Identifier" && owner.name === "setting" && node.callee.property.type === "Identifier" && node.callee.property.name === "link") add(text(node.arguments[0]), reference(node.arguments[2]));
|
|
65
|
+
}
|
|
66
|
+
if (node.type === "JSXOpeningElement" && node.name.type === "JSXIdentifier" && LINK_TAGS.has(node.name.name)) for (const attribute of node.attributes) {
|
|
67
|
+
if (attribute.type !== "JSXAttribute" || attribute.name.type !== "JSXIdentifier" || !LINK_ATTRIBUTES.has(attribute.name.name)) continue;
|
|
68
|
+
const value = attribute.value;
|
|
69
|
+
if (value?.type === "JSXExpressionContainer") add(text(value.expression));
|
|
70
|
+
else add(text(value));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return links;
|
|
74
|
+
}
|
|
75
|
+
function readManifest(app, watch) {
|
|
76
|
+
const links = /* @__PURE__ */ new Map();
|
|
77
|
+
const visit = (directory) => {
|
|
78
|
+
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
79
|
+
const path = join(directory, entry.name);
|
|
80
|
+
if (entry.isDirectory()) visit(path);
|
|
81
|
+
if (!entry.isFile() || !entry.name.endsWith(".tsx")) continue;
|
|
82
|
+
watch(path);
|
|
83
|
+
let found;
|
|
84
|
+
try {
|
|
85
|
+
found = catalogLinksFromSource(readFileSync(path, "utf8"));
|
|
86
|
+
} catch {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
for (const link of found) links.set(JSON.stringify([
|
|
90
|
+
link.url,
|
|
91
|
+
link.reference?.type ?? null,
|
|
92
|
+
link.reference?.id ?? null
|
|
93
|
+
]), link);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
visit(app);
|
|
97
|
+
return JSON.stringify([...links.values()]);
|
|
98
|
+
}
|
|
99
|
+
function catalogLinks() {
|
|
100
|
+
let app = "";
|
|
101
|
+
let manifest = "";
|
|
102
|
+
return {
|
|
103
|
+
name: "ecomiq:catalog-links",
|
|
104
|
+
configResolved(config) {
|
|
105
|
+
app = resolve(config.root, "app");
|
|
106
|
+
},
|
|
107
|
+
resolveId(id) {
|
|
108
|
+
if (id === MODULE) return RESOLVED_MODULE;
|
|
109
|
+
},
|
|
110
|
+
load(id) {
|
|
111
|
+
if (id !== RESOLVED_MODULE) return void 0;
|
|
112
|
+
manifest = readManifest(app, (path) => this.addWatchFile(path));
|
|
113
|
+
return `export default ${manifest};`;
|
|
114
|
+
},
|
|
115
|
+
handleHotUpdate(context) {
|
|
116
|
+
if (!context.file.startsWith(`${app}${sep}`) || !context.file.endsWith(".tsx")) return;
|
|
117
|
+
const module = context.server.moduleGraph.getModuleById(RESOLVED_MODULE);
|
|
118
|
+
if (!module) return;
|
|
119
|
+
const next = readManifest(app, () => void 0);
|
|
120
|
+
if (next === manifest) return;
|
|
121
|
+
manifest = next;
|
|
122
|
+
context.server.moduleGraph.invalidateModule(module);
|
|
123
|
+
context.server.ws.send({ type: "full-reload" });
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export { SectionPropsError, catalogLinks, catalogLinksFromSource, paymentLogos, publicAssets, sectionLoaders, themeUi };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useStorefrontLocale, useStorefrontText } from "./storefront-language-DrMjVbmk.js";
|
|
2
|
+
import { money } from "./money-DtGOtDri.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/voucher-payment.tsx
|
|
5
|
+
function VoucherPayment({ payment }) {
|
|
6
|
+
const storefrontTranslate = useStorefrontText();
|
|
7
|
+
const { amount, currencyCode: currency } = payment;
|
|
8
|
+
const { locale, timeZone } = useStorefrontLocale();
|
|
9
|
+
const expiry = new Intl.DateTimeFormat(locale, {
|
|
10
|
+
dateStyle: "medium",
|
|
11
|
+
timeStyle: "short",
|
|
12
|
+
timeZone
|
|
13
|
+
});
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: "flex flex-col items-center gap-4 rounded-lg border p-6 text-center",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("p", {
|
|
18
|
+
className: "font-medium",
|
|
19
|
+
children: storefrontTranslate("Completa tu pago")
|
|
20
|
+
}),
|
|
21
|
+
payment.voucherCode ? /* @__PURE__ */ jsxs("p", {
|
|
22
|
+
className: "flex flex-col gap-1",
|
|
23
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "text-sm text-muted-foreground",
|
|
25
|
+
children: storefrontTranslate("Código de pago (CIP)")
|
|
26
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "font-mono text-2xl font-semibold tracking-wider",
|
|
28
|
+
children: payment.voucherCode
|
|
29
|
+
})]
|
|
30
|
+
}) : null,
|
|
31
|
+
payment.qrImageUrl ? /* @__PURE__ */ jsx("img", {
|
|
32
|
+
src: payment.qrImageUrl,
|
|
33
|
+
alt: storefrontTranslate("Código QR de pago"),
|
|
34
|
+
width: 240,
|
|
35
|
+
height: 240,
|
|
36
|
+
className: "size-60"
|
|
37
|
+
}) : null,
|
|
38
|
+
amount !== null && currency !== null ? /* @__PURE__ */ jsxs("p", { children: [
|
|
39
|
+
storefrontTranslate("Monto:"),
|
|
40
|
+
" ",
|
|
41
|
+
money(amount, currency, locale)
|
|
42
|
+
] }) : null,
|
|
43
|
+
payment.expiresAt ? /* @__PURE__ */ jsxs("p", {
|
|
44
|
+
className: "text-sm",
|
|
45
|
+
children: [
|
|
46
|
+
storefrontTranslate("Vence el"),
|
|
47
|
+
" ",
|
|
48
|
+
expiry.format(new Date(payment.expiresAt))
|
|
49
|
+
]
|
|
50
|
+
}) : null,
|
|
51
|
+
payment.actionUrl ? /* @__PURE__ */ jsx("a", {
|
|
52
|
+
href: payment.actionUrl,
|
|
53
|
+
target: "_blank",
|
|
54
|
+
rel: "noopener noreferrer",
|
|
55
|
+
className: "underline",
|
|
56
|
+
children: storefrontTranslate("Ver instrucciones de pago")
|
|
57
|
+
}) : null,
|
|
58
|
+
/* @__PURE__ */ jsx("p", {
|
|
59
|
+
className: "text-sm text-muted-foreground",
|
|
60
|
+
role: "status",
|
|
61
|
+
children: storefrontTranslate("Confirmaremos tu pago al recibirlo.")
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { VoucherPayment };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { cartCookie } from "./cart-D7DxZ2lD.js";
|
|
2
|
+
import "./preview-cart-Dg2CVktS.js";
|
|
3
|
+
import { productPreviewFrom, productPreviewResponse } from "./product-preview-BspMAecJ.js";
|
|
4
|
+
import { StorefrontSdkTiming, durationMetric } from "./telemetry-HuZXWBPi.js";
|
|
5
|
+
import { privateCustomerResponse, rejectCrossOriginAction, rejectCustomerCsrf } from "./request-security-CRsRMgwj.js";
|
|
6
|
+
import { seoResponse } from "./seo-GpDRhAAA.js";
|
|
7
|
+
import { confirmingPaymentUrl } from "./payment-return-5cjypwIw.js";
|
|
8
|
+
import { RouterContextProvider, createContext, createRequestHandler } from "react-router";
|
|
9
|
+
import { STOREFRONT_CACHE_REVISION_HEADER, StorefrontCacheTokenSchema } from "@ecomiq/core/storefront-cache-revision";
|
|
10
|
+
// src/worker.ts
|
|
11
|
+
const worker = createContext();
|
|
12
|
+
async function withPreviewCart(request) {
|
|
13
|
+
const pair = (await cartCookie.serialize("ecomiq-editor-preview-cart")).split(";")[0] ?? "";
|
|
14
|
+
const others = (request.headers.get("Cookie") ?? "").split(";").map((part) => part.trim()).filter((part) => part !== "" && !part.startsWith(`${cartCookie.name}=`));
|
|
15
|
+
const headers = new Headers(request.headers);
|
|
16
|
+
headers.set("Cookie", [...others, pair].join("; "));
|
|
17
|
+
return new Request(request, { headers });
|
|
18
|
+
}
|
|
19
|
+
function createRequestHandler$1(build, mode) {
|
|
20
|
+
const handle = createRequestHandler(build, mode);
|
|
21
|
+
return { async fetch(request, env, ctx) {
|
|
22
|
+
if (request.method === "GET" || request.method === "POST") {
|
|
23
|
+
const orderToken = /^\/orders\/([A-Za-z0-9_-]+)\/payment-return$/.exec(new URL(request.url).pathname)?.[1];
|
|
24
|
+
if (orderToken !== void 0) return new Response(null, {
|
|
25
|
+
status: 303,
|
|
26
|
+
headers: {
|
|
27
|
+
Location: confirmingPaymentUrl(`/orders/${orderToken}`),
|
|
28
|
+
"Cache-Control": "private, no-store"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const rejected = rejectCrossOriginAction(request);
|
|
33
|
+
if (rejected) return rejected;
|
|
34
|
+
const rejectedCsrf = await rejectCustomerCsrf(request, env);
|
|
35
|
+
if (rejectedCsrf) return rejectedCsrf;
|
|
36
|
+
const context = new RouterContextProvider();
|
|
37
|
+
const sdkTiming = new StorefrontSdkTiming();
|
|
38
|
+
const productPreview = productPreviewFrom(request);
|
|
39
|
+
const parsedRevision = StorefrontCacheTokenSchema.safeParse(request.headers.get(STOREFRONT_CACHE_REVISION_HEADER));
|
|
40
|
+
const cacheRevision = parsedRevision.success && !productPreview && env.ECOMIQ_PREVIEW !== "1" ? parsedRevision.data : void 0;
|
|
41
|
+
context.set(worker, {
|
|
42
|
+
env,
|
|
43
|
+
ctx,
|
|
44
|
+
sdkTiming,
|
|
45
|
+
productPreview,
|
|
46
|
+
requestUrl: request.url,
|
|
47
|
+
cacheRevision
|
|
48
|
+
});
|
|
49
|
+
const seo = await seoResponse(request, context);
|
|
50
|
+
if (seo) {
|
|
51
|
+
const headers = new Headers(seo.headers);
|
|
52
|
+
if (cacheRevision !== void 0) headers.set(STOREFRONT_CACHE_REVISION_HEADER, cacheRevision);
|
|
53
|
+
else headers.set("Cache-Control", "no-store");
|
|
54
|
+
return new Response(seo.body, {
|
|
55
|
+
status: seo.status,
|
|
56
|
+
statusText: seo.statusText,
|
|
57
|
+
headers
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const started = performance.now();
|
|
61
|
+
let response = env.ECOMIQ_PREVIEW === "1" ? await handle(await withPreviewCart(request), context) : await handle(request, context);
|
|
62
|
+
if (response.status === 101) return response;
|
|
63
|
+
if (productPreview?.shown) response = await productPreviewResponse(response);
|
|
64
|
+
const headers = new Headers(response.headers);
|
|
65
|
+
headers.delete(STOREFRONT_CACHE_REVISION_HEADER);
|
|
66
|
+
if (cacheRevision !== void 0) headers.set(STOREFRONT_CACHE_REVISION_HEADER, cacheRevision);
|
|
67
|
+
else if (!/\bno-store\b/i.test(headers.get("Cache-Control") ?? "")) headers.set("Cache-Control", "no-store");
|
|
68
|
+
if (privateCustomerResponse(request) || headers.has("Set-Cookie")) headers.set("Cache-Control", "private, no-store");
|
|
69
|
+
const metrics = [durationMetric("ecomiq_ssr", performance.now() - started)];
|
|
70
|
+
if (sdkTiming.count > 0) {
|
|
71
|
+
metrics.push(durationMetric("ecomiq_sdk_max", sdkTiming.slowestMs));
|
|
72
|
+
metrics.push(durationMetric("ecomiq_sdk_sum", sdkTiming.sumMs));
|
|
73
|
+
metrics.push(`ecomiq_sdk_calls;desc="${sdkTiming.count}"`);
|
|
74
|
+
metrics.push(`ecomiq_sdk_slowest;desc="${sdkTiming.slowestMethod}"`);
|
|
75
|
+
}
|
|
76
|
+
if (sdkTiming.subrequests > 0) metrics.push(`ecomiq_subrequests;desc="${sdkTiming.subrequests}"`);
|
|
77
|
+
const existing = headers.get("server-timing");
|
|
78
|
+
headers.set("server-timing", [...existing ? [existing] : [], ...metrics].join(", "));
|
|
79
|
+
return new Response(response.body, {
|
|
80
|
+
status: response.status,
|
|
81
|
+
statusText: response.statusText,
|
|
82
|
+
headers
|
|
83
|
+
});
|
|
84
|
+
} };
|
|
85
|
+
}
|
|
86
|
+
export { createRequestHandler$1 as createRequestHandler, worker };
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProductPreview } from "./product-preview.js";
|
|
2
|
+
import { StorefrontSdkTiming } from "./telemetry.js";
|
|
3
|
+
import { ServerBuild } from "react-router";
|
|
4
|
+
export type StorefrontEnv = {
|
|
5
|
+
ECOMIQ_STORE: string;
|
|
6
|
+
ECOMIQ_STORE_ID?: string;
|
|
7
|
+
ECOMIQ_API_URL: string;
|
|
8
|
+
ECOMIQ_AUTH_URL?: string;
|
|
9
|
+
ECOMIQ_PREVIEW?: string;
|
|
10
|
+
SESSION_SECRET?: string;
|
|
11
|
+
CUSTOMER_IP_KEY?: string;
|
|
12
|
+
};
|
|
13
|
+
export type WorkerContext = {
|
|
14
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
15
|
+
};
|
|
16
|
+
export declare const worker: import("react-router").RouterContext<{
|
|
17
|
+
env: StorefrontEnv;
|
|
18
|
+
ctx: WorkerContext;
|
|
19
|
+
sdkTiming?: StorefrontSdkTiming;
|
|
20
|
+
productPreview?: ProductPreview;
|
|
21
|
+
requestUrl?: string;
|
|
22
|
+
cacheRevision?: string;
|
|
23
|
+
}>;
|
|
24
|
+
declare function createRequestHandler$1(build: () => Promise<ServerBuild>, mode?: string): {
|
|
25
|
+
fetch(request: Request, env: StorefrontEnv, ctx: WorkerContext): Promise<Response>;
|
|
26
|
+
};
|
|
27
|
+
export { createRequestHandler$1 as createRequestHandler };
|
package/package.json
CHANGED
|
@@ -1,96 +1,120 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomiq/storefront",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Ecomiq para React Router: tienda, carrito, sesión de cliente y catálogo en un Worker",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Ecomiq",
|
|
8
|
+
"homepage": "https://docs.ecomiq.pe/es/docs/guides/storefront/themes",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "git+https://github.com/ecomiq/ecomiq-storefront.git",
|
|
11
|
-
"directory": "packages/
|
|
12
|
-
},
|
|
13
|
-
"homepage": "https://github.com/ecomiq/ecomiq-storefront/tree/main/packages/ecomiq-storefront",
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/ecomiq/ecomiq-storefront/issues"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"ecomiq",
|
|
19
|
-
"storefront",
|
|
20
|
-
"ecommerce",
|
|
21
|
-
"ssr",
|
|
22
|
-
"tanstack",
|
|
23
|
-
"cloudflare"
|
|
24
|
-
],
|
|
25
|
-
"bin": {
|
|
26
|
-
"ecomiq": "./bin/ecomiq.mjs"
|
|
12
|
+
"directory": "packages/storefront"
|
|
27
13
|
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
28
16
|
"exports": {
|
|
29
|
-
".":
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"./
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"./
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"./
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"./
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./vite": {
|
|
22
|
+
"types": "./dist/vite.d.ts",
|
|
23
|
+
"import": "./dist/vite.js"
|
|
24
|
+
},
|
|
25
|
+
"./cart": {
|
|
26
|
+
"types": "./dist/entries/cart.d.ts",
|
|
27
|
+
"import": "./dist/entries/cart.js"
|
|
28
|
+
},
|
|
29
|
+
"./checkout": {
|
|
30
|
+
"types": "./dist/entries/checkout.d.ts",
|
|
31
|
+
"import": "./dist/entries/checkout.js"
|
|
32
|
+
},
|
|
33
|
+
"./account": {
|
|
34
|
+
"types": "./dist/entries/account.d.ts",
|
|
35
|
+
"import": "./dist/entries/account.js"
|
|
36
|
+
},
|
|
37
|
+
"./order": {
|
|
38
|
+
"types": "./dist/entries/order.d.ts",
|
|
39
|
+
"import": "./dist/entries/order.js"
|
|
40
|
+
},
|
|
41
|
+
"./analytics": {
|
|
42
|
+
"types": "./dist/entries/analytics.d.ts",
|
|
43
|
+
"import": "./dist/entries/analytics.js"
|
|
44
|
+
},
|
|
45
|
+
"./sections/order-tracking": {
|
|
46
|
+
"types": "./dist/sections/order-tracking.d.ts",
|
|
47
|
+
"import": "./dist/sections/order-tracking.js"
|
|
48
|
+
},
|
|
49
|
+
"./sections/account-orders": {
|
|
50
|
+
"types": "./dist/sections/account-orders.d.ts",
|
|
51
|
+
"import": "./dist/sections/account-orders.js"
|
|
52
|
+
},
|
|
53
|
+
"./sections/account-order": {
|
|
54
|
+
"types": "./dist/sections/account-order.d.ts",
|
|
55
|
+
"import": "./dist/sections/account-order.js"
|
|
56
|
+
},
|
|
57
|
+
"./sections/account-addresses": {
|
|
58
|
+
"types": "./dist/sections/account-addresses.d.ts",
|
|
59
|
+
"import": "./dist/sections/account-addresses.js"
|
|
60
|
+
},
|
|
61
|
+
"./sections/account-profile": {
|
|
62
|
+
"types": "./dist/sections/account-profile.d.ts",
|
|
63
|
+
"import": "./dist/sections/account-profile.js"
|
|
64
|
+
},
|
|
65
|
+
"./sections/checkout": {
|
|
66
|
+
"types": "./dist/sections/checkout.d.ts",
|
|
67
|
+
"import": "./dist/sections/checkout.js"
|
|
68
|
+
},
|
|
69
|
+
"./sections/draft-invoice": {
|
|
70
|
+
"types": "./dist/sections/draft-invoice.d.ts",
|
|
71
|
+
"import": "./dist/sections/draft-invoice.js"
|
|
72
|
+
},
|
|
73
|
+
"./sections/complaint-book": {
|
|
74
|
+
"types": "./dist/sections/complaint-book.d.ts",
|
|
75
|
+
"import": "./dist/sections/complaint-book.js"
|
|
76
|
+
},
|
|
77
|
+
"./sections/design-system": {
|
|
78
|
+
"types": "./dist/sections/design-system.d.ts",
|
|
79
|
+
"import": "./dist/sections/design-system.js"
|
|
80
|
+
},
|
|
81
|
+
"./vite-client": {
|
|
82
|
+
"types": "./src/vite-client.d.ts"
|
|
83
|
+
}
|
|
50
84
|
},
|
|
51
85
|
"files": [
|
|
52
|
-
"
|
|
53
|
-
"src",
|
|
54
|
-
"
|
|
55
|
-
"public",
|
|
56
|
-
"README.md"
|
|
57
|
-
],
|
|
58
|
-
"sideEffects": [
|
|
59
|
-
"**/*.css"
|
|
86
|
+
"dist",
|
|
87
|
+
"src/vite-client.d.ts",
|
|
88
|
+
"src/sections"
|
|
60
89
|
],
|
|
61
|
-
"publishConfig": {
|
|
62
|
-
"access": "public",
|
|
63
|
-
"registry": "https://registry.npmjs.org/"
|
|
64
|
-
},
|
|
65
90
|
"dependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"@
|
|
73
|
-
"better-auth": "^1.6.23",
|
|
74
|
-
"class-variance-authority": "^0.7.1",
|
|
75
|
-
"clsx": "^2.1.1",
|
|
76
|
-
"embla-carousel-autoplay": "^8.6.0",
|
|
77
|
-
"embla-carousel-fade": "^8.6.0",
|
|
78
|
-
"embla-carousel-react": "^8.6.0",
|
|
79
|
-
"lucide-react": "^0.510.0",
|
|
80
|
-
"tailwind-merge": "^3.2.0",
|
|
81
|
-
"tailwindcss": "^4.3.0",
|
|
82
|
-
"vite": "^8.1.0",
|
|
83
|
-
"wrangler": "^4.100.0",
|
|
84
|
-
"zod": "^3.25.0",
|
|
85
|
-
"@ecomiq/core": "^0.1.9"
|
|
91
|
+
"@babel/parser": "^7.29.7",
|
|
92
|
+
"@babel/types": "^7.29.7",
|
|
93
|
+
"@stripe/stripe-js": "^9.17.0",
|
|
94
|
+
"qrcode-generator": "^2.0.4",
|
|
95
|
+
"sharp": "^0.35.5",
|
|
96
|
+
"zod": "^4.6.6",
|
|
97
|
+
"@ecomiq/core": "^1.0.0"
|
|
86
98
|
},
|
|
87
99
|
"peerDependencies": {
|
|
88
|
-
"react": "^19.
|
|
89
|
-
"react-
|
|
100
|
+
"react": "^19.2.0",
|
|
101
|
+
"react-router": "^8.3.0"
|
|
90
102
|
},
|
|
91
103
|
"devDependencies": {
|
|
92
|
-
"@types/
|
|
93
|
-
"@types/react
|
|
104
|
+
"@types/node": "^26.1.1",
|
|
105
|
+
"@types/react": "^19.2.17",
|
|
106
|
+
"react": "^19.2.7",
|
|
107
|
+
"react-router": "^8.3.0",
|
|
108
|
+
"tsdown": "^0.23.0",
|
|
109
|
+
"typescript": "^7.0.2"
|
|
110
|
+
},
|
|
111
|
+
"publishConfig": {
|
|
112
|
+
"access": "public",
|
|
113
|
+
"registry": "https://registry.npmjs.org"
|
|
94
114
|
},
|
|
95
|
-
"scripts": {
|
|
115
|
+
"scripts": {
|
|
116
|
+
"build": "tsdown",
|
|
117
|
+
"dev": "tsdown --watch",
|
|
118
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
119
|
+
}
|
|
96
120
|
}
|