Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vtex/actions/address/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function action(
ctx: AppContext,
): Promise<PostalAddress> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/address/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface Props {
*/
async function action({ addressId }: Props, req: Request, ctx: AppContext) {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/address/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function action(
ctx: AppContext,
): Promise<PostalAddress> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/authentication/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default async function action(
ctx: AppContext,
) {
const cookies = getCookies(req.headers);
const { payload } = parseCookie(req.headers, ctx.account);
const { payload } = parseCookie(req.headers);

for (const cookieName in cookies) {
if (cookieName.startsWith("VtexIdclientAutCookie")) {
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/addItems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";
import type { OrderForm } from "../../utils/types.ts";
import { forceHttpsOnAssets } from "../../utils/transform.ts";
Expand Down Expand Up @@ -33,8 +33,7 @@ const action = async (
orderItems,
allowedOutdatedData = ["paymentData"],
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

try {
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/addOfferings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import { forceHttpsOnAssets } from "../../utils/transform.ts";
import { OrderForm } from "../../utils/types.ts";
import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts";
Expand All @@ -24,8 +24,7 @@ const action = async (
props;
const { vcsDeprecated } = ctx;

const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);

try {
const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/clearOrderformMessages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";

/**
Expand All @@ -13,8 +13,7 @@ const action = async (
ctx: AppContext,
): Promise<OrderForm> => {
const { vcsDeprecated } = ctx;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);

const response = await vcsDeprecated[
"POST /api/checkout/pub/orderForm/:orderFormId/messages/clear"
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/getInstallment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { InstallmentOption } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -20,8 +20,7 @@ const action = async (
): Promise<InstallmentOption> => {
const { vcsDeprecated } = ctx;
const { paymentSystem } = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/removeItemAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand Down Expand Up @@ -49,8 +49,7 @@ const action = async (
noSplitItem = true,
expectedOrderFormSections = DEFAULT_EXPECTED_SECTIONS,
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/removeItems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -15,8 +15,7 @@ const action = async (
ctx: AppContext,
): Promise<OrderForm> => {
const { vcsDeprecated } = ctx;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/removeOffering.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import { forceHttpsOnAssets } from "../../utils/transform.ts";
import { OrderForm } from "../../utils/types.ts";
import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts";
Expand All @@ -24,8 +24,7 @@ const action = async (
props;
const { vcsDeprecated } = ctx;

const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);

try {
const response = await vcsDeprecated
Expand Down
3 changes: 2 additions & 1 deletion vtex/actions/cart/simulation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AppContext } from "../../mod.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { SimulationOrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -25,7 +26,7 @@ const action = async (
req: Request,
ctx: AppContext,
): Promise<SimulationOrderForm> => {
const cookie = req.headers.get("cookie") ?? "";
const { cookie } = parseCookieWithoutAuth(req.headers);
const { vcsDeprecated } = ctx;
const { items, postalCode, country, RnbBehavior = 1 } = props;
const segment = getSegmentFromBag(ctx);
Expand Down
6 changes: 2 additions & 4 deletions vtex/actions/cart/updateAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";
Expand All @@ -27,13 +27,11 @@ const action = async (
body,
expectedOrderFormSections = DEFAULT_EXPECTED_SECTIONS,
} = props;
const { orderFormId } = parseCookie(req.headers);
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);

if (!orderFormId || orderFormId === "") {
throw new Error("Order form ID is required");
}

const cookie = req.headers.get("cookie") ?? "";
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateCoupons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -20,8 +20,7 @@ const action = async (
): Promise<OrderForm> => {
const { vcsDeprecated } = ctx;
const { text } = props;
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId } = parseCookie(req.headers);
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateGifts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm, SelectableGifts } from "../../utils/types.ts";
import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts";

Expand All @@ -23,8 +23,7 @@ const action = async (
id,
selectedGifts,
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);

const response = await vcsDeprecated[
"POST /api/checkout/pub/orderForm/:orderFormId/selectable-gifts/:giftId"
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateItemAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand Down Expand Up @@ -49,8 +49,7 @@ const action = async (
noSplitItem = true,
expectedOrderFormSections = DEFAULT_EXPECTED_SECTIONS,
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateItemPrice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -24,8 +24,7 @@ const action = async (
itemIndex,
price,
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateItems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";
import type { OrderForm } from "../../utils/types.ts";

Expand Down Expand Up @@ -31,8 +31,7 @@ const action = async (
allowedOutdatedData = ["paymentData"],
noSplitItem,
} = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateProfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -20,8 +20,7 @@ const action = async (
): Promise<OrderForm> => {
const { vcsDeprecated } = ctx;
const { ignoreProfileData } = props;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
5 changes: 2 additions & 3 deletions vtex/actions/cart/updateUser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../mod.ts";
import { proxySetCookie } from "../../utils/cookies.ts";
import { parseCookie } from "../../utils/orderForm.ts";
import { parseCookieWithoutAuth } from "../../utils/orderForm.ts";
import type { OrderForm } from "../../utils/types.ts";
import { getSegmentFromBag } from "../../utils/segment.ts";

Expand All @@ -15,8 +15,7 @@ const action = async (
ctx: AppContext,
): Promise<OrderForm> => {
const { vcsDeprecated } = ctx;
const { orderFormId } = parseCookie(req.headers);
const cookie = req.headers.get("cookie") ?? "";
const { orderFormId, cookie } = parseCookieWithoutAuth(req.headers);
const segment = getSegmentFromBag(ctx);

const response = await vcsDeprecated
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/masterdata/createDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const action = async (
): Promise<CreateNewDocument> => {
const { vcs, vcsDeprecated } = ctx;
const { data, acronym, isPrivateEntity, schema } = props;
const { cookie } = parseCookie(req.headers, ctx.account);
const { cookie } = parseCookie(req.headers);

const requestOptions = {
body: data,
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/masterdata/updateDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const action = async (
): Promise<unknown | IdHrefDocumentID> => {
const { vcs } = ctx;
const { id, data, acronym, createIfNotExists, schema } = props;
const { cookie } = parseCookie(req.headers, ctx.account);
const { cookie } = parseCookie(req.headers);

const requestOptions = {
body: createIfNotExists ? { ...data, id } : data,
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/newsletter/updateNewsletterOptIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function loader(
ctx: AppContext,
): Promise<{ subscribed: boolean }> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/orders/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function action(
): Promise<unknown> {
const { orderId, reason } = props;
const { vcsDeprecated } = ctx;
const { cookie } = parseCookie(req.headers, ctx.account);
const { cookie } = parseCookie(req.headers);

const response = await vcsDeprecated
["POST /api/checkout/pub/orders/:orderId/user-cancel-request"](
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/payment/deletePaymentToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function loader(
ctx: AppContext,
): Promise<DeleteCard> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/profile/updateProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function action(
ctx: AppContext,
): Promise<Profile> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/session/deleteSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function action(
ctx: AppContext,
): Promise<DeleteSession> {
const { io } = ctx;
const { cookie, payload } = parseCookie(req.headers, ctx.account);
const { cookie, payload } = parseCookie(req.headers);

if (!payload?.sub || !payload?.userId) {
throw new Error("User cookie is invalid");
Expand Down
2 changes: 1 addition & 1 deletion vtex/actions/session/editSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function action(
ctx: AppContext,
): Promise<CreateEditSessionResponse> {
const { vcs } = ctx;
const { cookie } = parseCookie(req.headers, ctx.account);
const { cookie } = parseCookie(req.headers);

const response = await vcs["PATCH /api/sessions"]({}, {
body: {
Expand Down
Loading
Loading