Skip to content

Commit

Permalink
feat: update version
Browse files Browse the repository at this point in the history
- Update version of deno 1 to 2
- Update dependencies
- Fix issue while using item itemToAnalyticsItem of deco vtex app
  • Loading branch information
gsbenevides2 committed Nov 7, 2024
1 parent b22a6f8 commit d610032
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 66 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deco-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Deploy
on:
push:
Expand Down
96 changes: 48 additions & 48 deletions components/footer/CopyrightRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@ import Image from "apps/website/components/Image.tsx";
import { CardFlag, TecnologiesLogo } from "site/components/footer/types.ts";

interface Props {
copyright: string;
cardFlags: CardFlag[];
tecnologiesLogo: TecnologiesLogo;
copyright: string;
cardFlags: CardFlag[];
tecnologiesLogo: TecnologiesLogo;
}
export default function CopyrightRow(props: Props) {
const copyText = props.copyright.replace(
"{{year}}",
new Date().getFullYear().toString(),
);
return (
<div class="bg-[#F6F6F6] desk:bg-[#F5F4F1] ">
<div class="container flex justify-between desktop:gap-7 items-center mobile:flex-col-reverse py-[14px] desk:py-4">
<p class="text-[#676767] text-[12px] leading-[18px] mobile:text-center">
{copyText}
</p>
<div class="flex gap-3 desk:hidden pt-[46px] pb-4">
<a
href={props.tecnologiesLogo.econverse.url}
target="_blank"
>
<Image
src={props.tecnologiesLogo.econverse.image}
width={46.86}
height={14.01}
alt="Logo da Econverse"
/>
</a>
<a href={props.tecnologiesLogo.vtex.url} target="_blank">
<Image
src={props.tecnologiesLogo.vtex.image}
width={34.73}
height={12.46}
alt="Logo da VTEX"
/>
</a>
</div>
<ul class="flex gap-1">
{props.cardFlags.map((flag) => (
<li key={flag.title}>
<Image
src={flag.image}
width={34}
height={29}
alt={`Logo da bandeira ou meio de pagamento: ${flag.title}`}
/>
</li>
))}
</ul>
</div>
const copyText = props.copyright.replace(
"{{year}}",
new Date().getFullYear().toString(),
);
return (
<div class="bg-[#F6F6F6] desk:bg-[#F5F4F1] ">
<div class="container flex justify-between desktop:gap-7 items-center mobile:flex-col-reverse py-[14px] desk:py-4">
<p class="text-[#676767] text-[12px] leading-[18px] mobile:text-center">
{copyText}
</p>
<div class="flex gap-3 desk:hidden pt-[46px] pb-4">
<a
href={props.tecnologiesLogo.econverse.url}
target="_blank"
>
<Image
src={props.tecnologiesLogo.econverse.image}
width={46.86}
height={14.01}
alt="Logo da Econverse"
/>
</a>
<a href={props.tecnologiesLogo.vtex.url} target="_blank">
<Image
src={props.tecnologiesLogo.vtex.image}
width={34.73}
height={12.46}
alt="Logo da VTEX"
/>
</a>
</div>
);
<ul class="flex gap-1">
{props.cardFlags.map((flag) => (
<li key={flag.title}>
<Image
src={flag.image}
width={34}
height={29}
alt={`Logo da bandeira ou meio de pagamento: ${flag.title}`}
/>
</li>
))}
</ul>
</div>
</div>
);
}
28 changes: 19 additions & 9 deletions deno.json
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",
Expand Down Expand Up @@ -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": {
Expand All @@ -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/",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as $_app from "./routes/_app.tsx";
import * as $MinicartFooter from "./islands/MinicartFooter.tsx";
import * as $Notify from "./islands/Notify.tsx";
import { type Manifest } from "$fresh/server.ts";
import type { Manifest } from "$fresh/server.ts";

const manifest = {
routes: {
Expand Down
4 changes: 2 additions & 2 deletions sdk/cart/vtex/utils/cartFrom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { itemToAnalyticsItem } from "apps/vtex/hooks/useCart.ts";
import { itemToAnalyticsItem } from "site/sdk/cart/vtex/utils/useCartCustom.ts";
import { Minicart } from "../../../../components/minicart/Minicart.tsx";
import { Cart } from "../types.ts";
import { SkuInformationData } from "./loadSizes.ts";
Expand Down Expand Up @@ -28,7 +28,7 @@ export const cartFrom = (
const detailUrl = new URL(item.detailUrl, url).href;
const skuInfo = skuInformation[item.id];
return {
...itemToAnalyticsItem({ ...item, detailUrl, coupon }, index),
...itemToAnalyticsItem({ ...item, detailUrl, coupon }, index, url),
image: item.imageUrl,
...skuInfo,
listPrice: item.listPrice / 100,
Expand Down
29 changes: 29 additions & 0 deletions sdk/cart/vtex/utils/useCartCustom.ts
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)),
});
4 changes: 2 additions & 2 deletions sections/Component.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// deno-lint-ignore-file no-explicit-any
import { type SectionProps } from "@deco/deco";
import { useSection } from "@deco/deco/hooks";
import { Component, type ComponentType } from "preact";
import { toFileUrl } from "std/path/mod.ts";
import type { AppContext } from "../apps/site.ts";
import { useSection } from "@deco/deco/hooks";
import { type SectionProps } from "@deco/deco";
interface Props {
component: string;
props?: Record<string, unknown>;
Expand Down
3 changes: 0 additions & 3 deletions static/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -5256,9 +5256,6 @@ details.collapse summary::-webkit-details-marker {
.uppercase {
text-transform: uppercase;
}
.lowercase {
text-transform: lowercase;
}
.capitalize {
text-transform: capitalize;
}
Expand Down

0 comments on commit d610032

Please sign in to comment.