@decocms/apps-vtex 7.64.2 → 7.65.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/apps-vtex",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.65.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco commerce app: VTEX integration",
|
|
6
6
|
"repository": {
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"lint:unused": "knip"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@decocms/blocks": "7.
|
|
55
|
-
"@decocms/apps-commerce": "7.
|
|
56
|
-
"@decocms/apps-website": "7.
|
|
57
|
-
"@decocms/tanstack": "7.
|
|
54
|
+
"@decocms/blocks": "7.65.0",
|
|
55
|
+
"@decocms/apps-commerce": "7.65.0",
|
|
56
|
+
"@decocms/apps-website": "7.65.0",
|
|
57
|
+
"@decocms/tanstack": "7.65.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@tanstack/react-query": ">=5.0.0",
|
|
@@ -129,11 +129,11 @@ describe("vtexFetchWithCookies — inbound Set-Cookie capture", () => {
|
|
|
129
129
|
await vtexFetchWithCookies("/api/checkout/pub/orderForm");
|
|
130
130
|
return responseHeaders.getSetCookie();
|
|
131
131
|
},
|
|
132
|
-
"https://www.
|
|
132
|
+
"https://www.acme.com.br/api/checkout/pub/orderForm",
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
// domain-scoped to the storefront host, NOT the original VTEX domain
|
|
136
|
-
expect(captured[0]).toMatch(/Domain=www\.
|
|
136
|
+
expect(captured[0]).toMatch(/Domain=www\.acme\.com\.br/);
|
|
137
137
|
expect(captured[0]).not.toMatch(/vtexcommercestable/i);
|
|
138
138
|
expect(captured[0]).toContain("checkout.vtex.com=__ofid=abc");
|
|
139
139
|
});
|
|
@@ -155,12 +155,12 @@ describe("vtexFetchWithCookies — inbound Set-Cookie capture", () => {
|
|
|
155
155
|
await vtexFetchWithCookies("/api/checkout/pub/orderForm");
|
|
156
156
|
return responseHeaders.getSetCookie();
|
|
157
157
|
},
|
|
158
|
-
"https://www.
|
|
158
|
+
"https://www.acme.com.br/api/checkout/pub/orderForm",
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
// the value's `domain=keep` is untouched; the attribute is rewritten
|
|
162
162
|
expect(captured[0]).toContain("__ofid=domain=keep");
|
|
163
|
-
expect(captured[0]).toMatch(/;\s*Domain=www\.
|
|
163
|
+
expect(captured[0]).toMatch(/;\s*Domain=www\.acme\.com\.br/);
|
|
164
164
|
expect(captured[0]).not.toMatch(/vtexcommercestable/i);
|
|
165
165
|
});
|
|
166
166
|
|
package/src/client.ts
CHANGED
|
@@ -48,7 +48,7 @@ function getRequestHost(): string | null {
|
|
|
48
48
|
* host AND so it lands at the SAME cookie scope as the checkout proxy.
|
|
49
49
|
*
|
|
50
50
|
* VTEX sets `checkout.vtex.com` / `CheckoutOrderFormOwnership` with
|
|
51
|
-
* `domain=<vtex-host>` (e.g. `
|
|
51
|
+
* `domain=<vtex-host>` (e.g. `acme.vtexcommercestable.com.br`),
|
|
52
52
|
* which the browser would reject on the storefront host. There are two ways
|
|
53
53
|
* to make it acceptable:
|
|
54
54
|
*
|
|
@@ -19,7 +19,7 @@ describe("sanitizeOutboundCookieHeader", () => {
|
|
|
19
19
|
expect(cookies).toBe("checkout.vtex.com=__ofid=abc; vtex_segment=eyJ0b2tlbiI6IjEyMyJ9");
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it("drops a cookie whose value contains non-ASCII bytes —
|
|
22
|
+
it("drops a cookie whose value contains non-ASCII bytes — a production VTEX storefront repro", () => {
|
|
23
23
|
// `á` is the UTF-8 encoding of `á` interpreted as Latin-1 — bytes 0xC3 0xA1.
|
|
24
24
|
// VTEX's janus gateway returns 503 deterministically when this reaches it.
|
|
25
25
|
const raw = "checkout.vtex.com=__ofid=abc; category_click=Eletroportáteis; vtex_segment=ok";
|
|
@@ -726,7 +726,7 @@ describe("toProductShelf", () => {
|
|
|
726
726
|
}) as any;
|
|
727
727
|
|
|
728
728
|
// Campanha is a PRODUCT specification (in specificationGroups), NOT a sku.variation.
|
|
729
|
-
// It is the marker
|
|
729
|
+
// It is the marker one storefront uses to tag launches ("Lançamentos").
|
|
730
730
|
const makeProduct = (overrides: Record<string, unknown> = {}) =>
|
|
731
731
|
({
|
|
732
732
|
origin: "intelligent-search",
|
package/src/utils/minicart.ts
CHANGED
|
@@ -71,7 +71,7 @@ function vtexItemToMinicartItem(item: OrderFormItem, index: number, coupon?: str
|
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
73
|
// AnalyticsItem identifier — VTEX uses productId; sites map to numeric SKU
|
|
74
|
-
// when needed via `Number(item.item_id)` (see
|
|
74
|
+
// when needed via `Number(item.item_id)` (see a production Minicart).
|
|
75
75
|
item_id: item.id,
|
|
76
76
|
item_group_id: item.productId,
|
|
77
77
|
item_name: item.name ?? item.skuName ?? "",
|
package/src/utils/proxy.ts
CHANGED
|
@@ -259,11 +259,11 @@ export async function proxyToVtex(request: Request, options?: VtexProxyOptions):
|
|
|
259
259
|
// ---------------------------------------------------------------------------
|
|
260
260
|
|
|
261
261
|
export interface VtexCheckoutProxyConfig {
|
|
262
|
-
/** VTEX account name (e.g. "
|
|
262
|
+
/** VTEX account name (e.g. "acme"). */
|
|
263
263
|
account: string;
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* Store's public checkout domain (e.g. "secure.
|
|
266
|
+
* Store's public checkout domain (e.g. "secure.acme.com.br").
|
|
267
267
|
* Checkout UI, /files/, and /_v/private/graphql are routed here.
|
|
268
268
|
*/
|
|
269
269
|
checkoutOrigin: string;
|
|
@@ -372,8 +372,8 @@ function rewriteSetCookieDomain(from: Headers, to: Headers, toHostname: string)
|
|
|
372
372
|
* @example
|
|
373
373
|
* ```ts
|
|
374
374
|
* const vtexProxy = createVtexCheckoutProxy({
|
|
375
|
-
* account: "
|
|
376
|
-
* checkoutOrigin: "secure.
|
|
375
|
+
* account: "acme",
|
|
376
|
+
* checkoutOrigin: "secure.acme.com.br",
|
|
377
377
|
* expireCookiesOnPaths: [
|
|
378
378
|
* { pathPrefix: "/api/vtexid/pub/logout", cookies: ["checkout.vtex.com"] },
|
|
379
379
|
* ],
|