-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update version of deno 1 to 2 - Update dependencies - Fix issue while using item itemToAnalyticsItem of deco vtex app
- Loading branch information
1 parent
b22a6f8
commit d610032
Showing
8 changed files
with
101 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
name: Deploy | ||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"imports": { | ||
"$fresh/": "https://deno.land/x/fresh@1.6.8/", | ||
"$fresh/": "https://deno.land/x/fresh@1.7.3/", | ||
"preact": "npm:[email protected]", | ||
"preact-render-to-string": "npm:[email protected]", | ||
"@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.5", | ||
|
@@ -29,15 +29,15 @@ | |
"@zaubrik/djwt": "jsr:@zaubrik/djwt@^3.0.2", | ||
"fast-json-patch": "npm:fast-json-patch@^3.1.1", | ||
"https://esm.sh/*[email protected]": "npm:[email protected]", | ||
"@deco/deco": "jsr:@deco/deco@1.102.3", | ||
"@deco/deco": "jsr:@deco/deco@1.107.0", | ||
"simple-git": "npm:simple-git@^3.25.0", | ||
"std/": "https://deno.land/[email protected]/", | ||
"deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@1.102.3/", | ||
"apps/": "https://cdn.jsdelivr.net/gh/deco-cx/apps@0.59.16/", | ||
"deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@1.107.0/", | ||
"apps/": "https://cdn.jsdelivr.net/gh/deco-cx/apps@0.63.0/", | ||
"@preact/signals": "https://esm.sh/*@preact/[email protected]", | ||
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]", | ||
"daisyui": "npm:[email protected]", | ||
"@deco/dev": "jsr:@deco/dev@1.102.0", | ||
"@deco/dev": "jsr:@deco/dev@1.107.0", | ||
"site/": "./" | ||
}, | ||
"tasks": { | ||
|
@@ -55,10 +55,12 @@ | |
"build": "deno run -A dev.ts build", | ||
"preview": "deno run -A main.ts", | ||
"generate-icons": "deno run -A --unstable static/generate-icons.ts", | ||
"dev": "deno run -A --env --unstable --unstable-hmr dev.ts", | ||
"dev": "deno run -A --env --unstable-kv --unstable-hmr dev.ts", | ||
"reload": "deno cache -r https://deco.cx/run" | ||
}, | ||
"githooks": { "pre-commit": "check" }, | ||
"githooks": { | ||
"pre-commit": "check" | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"static/", | ||
|
@@ -68,9 +70,17 @@ | |
".deco" | ||
], | ||
"lint": { | ||
"rules": { "exclude": ["no-window"], "tags": ["fresh", "recommended"] } | ||
"rules": { | ||
"exclude": [ | ||
"no-window" | ||
], | ||
"tags": [ | ||
"fresh", | ||
"recommended" | ||
] | ||
} | ||
}, | ||
"nodeModulesDir": true, | ||
"nodeModulesDir": "auto", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "preact", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mapCategoriesToAnalyticsCategories } from "apps/commerce/utils/productToAnalyticsItem.ts"; | ||
import { OrderForm, OrderFormItem } from "apps/vtex/utils/types.ts"; | ||
|
||
const mapItemCategoriesToAnalyticsCategories = ( | ||
item: OrderFormItem, | ||
): Record<`item_category${number | ""}`, string> => { | ||
return mapCategoriesToAnalyticsCategories( | ||
Object.values(item.productCategories), | ||
); | ||
}; | ||
export const itemToAnalyticsItem = ( | ||
item: OrderForm["items"][number] & { coupon?: string }, | ||
index: number, | ||
url: string, | ||
) => ({ | ||
affiliation: item.seller, | ||
item_id: item.id, | ||
item_group_id: item.productId, | ||
quantity: item.quantity, | ||
coupon: item.coupon ?? "", | ||
price: item.sellingPrice / 100, | ||
index, | ||
discount: Number(((item.listPrice - item.sellingPrice) / 100).toFixed(2)), | ||
item_name: item.name ?? item.skuName ?? "", | ||
item_variant: item.skuName, | ||
item_brand: item.additionalInfo.brandName ?? "", | ||
item_url: new URL(item.detailUrl, url).href, | ||
...(mapItemCategoriesToAnalyticsCategories(item)), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters