From a21a23396e00283d3dbb0749a3ae3ddc8c673a88 Mon Sep 17 00:00:00 2001 From: Social Groovy Bot <45039513+SocialGroovyBot@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:43:41 +0000 Subject: [PATCH 1/6] chore(release): 0.73.19 --- webapp/CHANGELOG.md | 7 +++++++ webapp/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index 91d5b1c0..adb6122d 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04) + + +### Bug Fixes + +* return back button offer from url ([f969374](https://github.com/SocialGouv/carte-jeune-engage/commit/f969374c2aab4ead6e125c43aa6ccfda8e48289c)) + ## [0.73.18](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.17...v0.73.18) (2024-12-04) diff --git a/webapp/package.json b/webapp/package.json index 20da3a4b..418c234c 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "0.73.18", + "version": "0.73.19", "private": true, "scripts": { "dev": "next dev", From d52879d1f07bcbbd4711457fac499ba02691e44e Mon Sep 17 00:00:00 2001 From: Antoine Lelong Date: Thu, 5 Dec 2024 11:22:58 +0100 Subject: [PATCH 2/6] fix: desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer --- webapp/CHANGELOG.md | 6 ++-- webapp/src/cronjobs/notifications/index.ts | 4 +-- .../notifications/reminderOfferActivated.ts | 32 +++++++++++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index adb6122d..d99bb105 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,16 +1,14 @@ ## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04) - ### Bug Fixes -* return back button offer from url ([f969374](https://github.com/SocialGouv/carte-jeune-engage/commit/f969374c2aab4ead6e125c43aa6ccfda8e48289c)) +- return back button offer from url ([f969374](https://github.com/SocialGouv/carte-jeune-engage/commit/f969374c2aab4ead6e125c43aa6ccfda8e48289c)) ## [0.73.18](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.17...v0.73.18) (2024-12-04) - ### Bug Fixes -* wording download button widget ([d9e67f8](https://github.com/SocialGouv/carte-jeune-engage/commit/d9e67f8eed3b093ef7b6e82851188b032326ae53)) +- wording download button widget ([d9e67f8](https://github.com/SocialGouv/carte-jeune-engage/commit/d9e67f8eed3b093ef7b6e82851188b032326ae53)) ## [0.73.17](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.16...v0.73.17) (2024-12-04) diff --git a/webapp/src/cronjobs/notifications/index.ts b/webapp/src/cronjobs/notifications/index.ts index ef3bf6ae..88c8339c 100644 --- a/webapp/src/cronjobs/notifications/index.ts +++ b/webapp/src/cronjobs/notifications/index.ts @@ -13,8 +13,8 @@ export const initNotifications = async () => { new Date().toLocaleString("fr-FR") ); await sendNewOfferAvailable(); - await sendReminderAuchan(); - await sendReminderOfferUserPreferences(); + // await sendReminderAuchan(); + // await sendReminderOfferUserPreferences(); await sendReminderOfferActivated(); console.log( "[INIT] - End sending notifications", diff --git a/webapp/src/cronjobs/notifications/reminderOfferActivated.ts b/webapp/src/cronjobs/notifications/reminderOfferActivated.ts index 501a6fa6..05be7a65 100644 --- a/webapp/src/cronjobs/notifications/reminderOfferActivated.ts +++ b/webapp/src/cronjobs/notifications/reminderOfferActivated.ts @@ -47,17 +47,37 @@ export async function sendReminderOfferActivated() { return; } + const users = new Map(); + for (const offerActivated of offersActivated.docs as CouponIncluded[]) { + if (!users.has(offerActivated.user.id)) + users.set(offerActivated.user.id, []); + + users.get(offerActivated.user.id)?.push(offerActivated); + } + + for (const [user_id, offersActivated] of users.entries()) { + const user = offersActivated[0].user; + + const title = + offersActivated.length > 1 + ? "Vos offres vous attendent !" + : "Votre offre vous attend !"; + + const message = + offersActivated.length > 1 + ? `👉 ${offersActivated.length} offres vous attendent, utilisez-les quand vous voulez. Ne l’oubliez pas 😶` + : `👉 L’offre ${offersActivated[0].offer.partner.name} vous attend, utilisez-la quand vous voulez. Ne l’oubliez pas 😶`; + const { notificationSent, notificationInDb } = await sendPushNotification( { - sub: offerActivated.user.notification_subscription, + sub: user.notification_subscription, payload, - userId: offerActivated.user.id, - offerId: offerActivated.offer.id, + userId: user_id, payloadNotification: { - title: "Votre offre vous attend !", - message: `👉 L’offre ${offerActivated.offer.title} vous attend, utilisez-la quand vous voulez. Ne l’oubliez pas 😶`, - url: `${getBaseUrl()}/dashboard/offer/${offerActivated.offer.source}/${offerActivated.offer.id}`, + title, + message, + url: `${getBaseUrl()}/dashboard/wallet`, slug, }, } From fe1bb94cc13ee929b93fd8270523e6cbd0403518 Mon Sep 17 00:00:00 2001 From: Antoine Lelong Date: Thu, 5 Dec 2024 11:23:45 +0100 Subject: [PATCH 3/6] fix: remove unused import --- webapp/src/cronjobs/notifications/reminderOfferActivated.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/cronjobs/notifications/reminderOfferActivated.ts b/webapp/src/cronjobs/notifications/reminderOfferActivated.ts index 05be7a65..8ab453a1 100644 --- a/webapp/src/cronjobs/notifications/reminderOfferActivated.ts +++ b/webapp/src/cronjobs/notifications/reminderOfferActivated.ts @@ -1,7 +1,7 @@ import { CouponIncluded } from "../../server/api/routers/coupon"; import { getPayloadClient } from "../../payload/payloadClient"; import { sendPushNotification } from "../../utils/sendPushNotification"; -import { getBaseUrl, dateDiffInDays } from "../../utils/tools"; +import { getBaseUrl } from "../../utils/tools"; const slug = "reminder-offer-activated"; From aa3f4a6f18b6c407808fa7085e8bb46b3b34b009 Mon Sep 17 00:00:00 2001 From: Social Groovy Bot <45039513+SocialGroovyBot@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:24:32 +0000 Subject: [PATCH 4/6] chore(release): 0.73.20 --- webapp/CHANGELOG.md | 8 ++++++++ webapp/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index d99bb105..f3a3d05a 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.73.20](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.19...v0.73.20) (2024-12-05) + + +### Bug Fixes + +* desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e)) +* remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518)) + ## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04) ### Bug Fixes diff --git a/webapp/package.json b/webapp/package.json index 418c234c..b6b3833c 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "0.73.19", + "version": "0.73.20", "private": true, "scripts": { "dev": "next dev", From 156b1e183fa00a12e1273390e3289aae35b658e3 Mon Sep 17 00:00:00 2001 From: Antoine Lelong Date: Fri, 13 Dec 2024 15:58:05 +0100 Subject: [PATCH 5/6] fix: remove crisp component from all pages --- webapp/CHANGELOG.md | 5 +- webapp/src/components/modals/IssueModal.tsx | 124 ++++++-------- .../modals/ObizOrderProcessModal.tsx | 157 ++++++++---------- .../src/components/wrappers/WalletWrapper.tsx | 27 +-- webapp/src/pages/dashboard/account/index.tsx | 35 +--- webapp/src/pages/dashboard/index.tsx | 17 +- 6 files changed, 125 insertions(+), 240 deletions(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index f3a3d05a..fd5ad4b2 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,10 +1,9 @@ ## [0.73.20](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.19...v0.73.20) (2024-12-05) - ### Bug Fixes -* desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e)) -* remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518)) +- desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e)) +- remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518)) ## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04) diff --git a/webapp/src/components/modals/IssueModal.tsx b/webapp/src/components/modals/IssueModal.tsx index ed4e5ea7..4e5d27d2 100644 --- a/webapp/src/components/modals/IssueModal.tsx +++ b/webapp/src/components/modals/IssueModal.tsx @@ -13,10 +13,8 @@ import { Button, Center, } from "@chakra-ui/react"; -import dynamic from "next/dynamic"; import { useState } from "react"; import { - HiMiniChatBubbleOvalLeftEllipsis, HiEnvelope, HiPhone, HiChevronRight, @@ -24,12 +22,9 @@ import { HiCheckCircle, } from "react-icons/hi2"; import { IconType } from "react-icons/lib"; -import { useAuth } from "~/providers/Auth"; import { api } from "~/utils/api"; import ConditionalLink from "../ConditionalLink"; -const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string; - const defaultIssueCases = [ "Le prix avec la réduction ne correspond pas", "Autre chose", @@ -178,10 +173,6 @@ type IssueModalProps = IssueModalOrder | IssueModalCoupon; const IssueModal = (props: IssueModalProps) => { const { isOpen, onClose, kind } = props; - const { user } = useAuth(); - const CrispWithNoSSR = dynamic(() => import("../support/Crisp")); - - const [isOpenCrisp, setIsOpenCrisp] = useState(false); const id = kind === "order" ? props.order_id : props.coupon_id; @@ -203,74 +194,53 @@ const IssueModal = (props: IssueModalProps) => { ]; return ( - <> - - - {!isOpenCrisp && ( - - - - - - - setIsOpenCrisp(true)} - icon={HiMiniChatBubbleOvalLeftEllipsis} - text="Discutez avec nous en direct" - /> - {kind === "order" && ( - <> - - ou - - - - - - Disponible du lundi au vendredi de -
- 09h à 12h30 puis de 14h à 17h30 -
-
- - )} -
-
-
- )} -
- {isOpenCrisp && user && ( - { - setIsOpenCrisp(false); - }} - /> - )} - + + + + + + + + + {/* setIsOpenCrisp(true)} + icon={HiMiniChatBubbleOvalLeftEllipsis} + text="Discutez avec nous en direct" + /> + + ou + */} + + + + + Disponible du lundi au vendredi de +
+ 09h à 12h30 puis de 14h à 17h30 +
+
+
+
+
+
); }; diff --git a/webapp/src/components/modals/ObizOrderProcessModal.tsx b/webapp/src/components/modals/ObizOrderProcessModal.tsx index d9799da6..68ed4756 100644 --- a/webapp/src/components/modals/ObizOrderProcessModal.tsx +++ b/webapp/src/components/modals/ObizOrderProcessModal.tsx @@ -17,14 +17,10 @@ import { OfferIncluded } from "~/server/api/routers/offer"; import { OfferArticle } from "~/server/types"; import { api } from "~/utils/api"; import LayoutOrderStatus from "../obiz/LayoutOrderStatus"; -import { HiMiniShieldCheck, HiQuestionMarkCircle } from "react-icons/hi2"; +import { HiMiniShieldCheck } from "react-icons/hi2"; import { formatter2Digits } from "~/utils/tools"; import { useRouter } from "next/router"; import PartnerImage from "../ui/PartnerImage"; -import dynamic from "next/dynamic"; -import { useAuth } from "~/providers/Auth"; - -const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string; const ObizOfferVariableContent = ({ step, @@ -223,11 +219,7 @@ export default function ObizOrderProcessModal( ) { const { isOpen, onClose, onRedirectPayment, offerId } = props; const router = useRouter(); - const { user } = useAuth(); - - const CrispWithNoSSR = dynamic(() => import("../support/Crisp")); - const [isOpenCrisp, setIsOpenCrisp] = useState(false); const [amount, setAmount] = useState(0); const [step, setStep] = useState("amount"); const [selectedArticles, setSelectedArticles] = useState< @@ -265,90 +257,75 @@ export default function ObizOrderProcessModal( <> - {!isOpenCrisp && ( - - - {step !== "payment" && ( - - - - step == "amount" ? onClose() : setStep("amount") - } - /> - - - - - {offer.partner.name} - - - {offer.title} {offer.subtitle ?? ""} - - - setIsOpenCrisp(true)} + + + {step !== "payment" && ( + + + + step == "amount" ? onClose() : setStep("amount") + } /> + + + + + {offer.partner.name} + + + {offer.title} {offer.subtitle ?? ""} + - )} - { - if ( - availableArticles.length === 1 && - availableArticles[0].kind === "variable_price" - ) { - createTestOrder({ - offer_id: offer.id, - article_references: [ - { - reference: availableArticles[0].reference, - quantity: 1, - }, - ], - input_value: amount - (amount * discount) / 100, - input_value_public: amount, - }); - } else { - createTestOrder({ - offer_id: offer.id, - article_references: selectedArticles.map((article) => ({ - reference: article.article.reference, - quantity: article.quantity, - })), - }); - } - }} - selectedArticles={selectedArticles} - setSelectedArticles={setSelectedArticles} - /> - - - )} + {/* setIsOpenCrisp(true)} + /> */} + + )} + { + if ( + availableArticles.length === 1 && + availableArticles[0].kind === "variable_price" + ) { + createTestOrder({ + offer_id: offer.id, + article_references: [ + { + reference: availableArticles[0].reference, + quantity: 1, + }, + ], + input_value: amount - (amount * discount) / 100, + input_value_public: amount, + }); + } else { + createTestOrder({ + offer_id: offer.id, + article_references: selectedArticles.map((article) => ({ + reference: article.article.reference, + quantity: article.quantity, + })), + }); + } + }} + selectedArticles={selectedArticles} + setSelectedArticles={setSelectedArticles} + /> + + - {isOpenCrisp && user && ( - { - setIsOpenCrisp(false); - }} - /> - )} ); } diff --git a/webapp/src/components/wrappers/WalletWrapper.tsx b/webapp/src/components/wrappers/WalletWrapper.tsx index e0ee336c..83aec68d 100644 --- a/webapp/src/components/wrappers/WalletWrapper.tsx +++ b/webapp/src/components/wrappers/WalletWrapper.tsx @@ -1,23 +1,13 @@ import { Box, Button, Flex, Heading, Icon, Link } from "@chakra-ui/react"; -import { ReactNode, useState } from "react"; -import { HiCog6Tooth, HiQuestionMarkCircle, HiUser } from "react-icons/hi2"; +import { ReactNode } from "react"; +import { HiCog6Tooth, HiUser } from "react-icons/hi2"; import NextLink from "next/link"; -import dynamic from "next/dynamic"; -import { useAuth } from "~/providers/Auth"; - -const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string; type WalletWrapperProps = { children: ReactNode; }; const WalletWrapper = ({ children }: WalletWrapperProps) => { - const { user } = useAuth(); - - const [isOpenCrisp, setIsOpenCrisp] = useState(false); - - const CrispWithNoSSR = dynamic(() => import("../support/Crisp")); - return ( @@ -47,13 +37,13 @@ const WalletWrapper = ({ children }: WalletWrapperProps) => { size="xs" /> - setIsOpenCrisp(true)} - /> + /> */} { {children} - {isOpenCrisp && user && ( - { - setIsOpenCrisp(false); - }} - /> - )} ); }; diff --git a/webapp/src/pages/dashboard/account/index.tsx b/webapp/src/pages/dashboard/account/index.tsx index 321f6ddd..e5f159d9 100644 --- a/webapp/src/pages/dashboard/account/index.tsx +++ b/webapp/src/pages/dashboard/account/index.tsx @@ -1,18 +1,8 @@ import { Box, Flex, Icon, IconButton, Link, Text } from "@chakra-ui/react"; import { useRouter } from "next/router"; import PassCard from "~/components/account/PassCard"; -import { - HiCog6Tooth, - HiQuestionMarkCircle, - HiUser, - HiXMark, -} from "react-icons/hi2"; +import { HiCog6Tooth, HiUser, HiXMark } from "react-icons/hi2"; import NextLink from "next/link"; -import dynamic from "next/dynamic"; -import { useState } from "react"; -import { useAuth } from "~/providers/Auth"; - -const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string; const HeaderButton = ({ icon, @@ -53,13 +43,6 @@ const HeaderButton = ({ export default function AccountCard() { const router = useRouter(); - const { user } = useAuth(); - - const [isOpenCrisp, setIsOpenCrisp] = useState(false); - - const CrispWithNoSSR = dynamic( - () => import("../../../components/support/Crisp") - ); return ( @@ -84,18 +67,13 @@ export default function AccountCard() { link="/dashboard/account/settings" /> {/* */} - { setIsOpenCrisp(true); }} - /> + /> */} @@ -119,15 +97,6 @@ export default function AccountCard() { Retour à mes réductions - {isOpenCrisp && user && ( - { - setIsOpenCrisp(false); - }} - /> - )} ); } diff --git a/webapp/src/pages/dashboard/index.tsx b/webapp/src/pages/dashboard/index.tsx index a411a50f..1430ba9f 100644 --- a/webapp/src/pages/dashboard/index.tsx +++ b/webapp/src/pages/dashboard/index.tsx @@ -10,7 +10,7 @@ import { import dynamic from "next/dynamic"; import NextLink from "next/link"; import { useState } from "react"; -import { HiMiniTag, HiQuestionMarkCircle } from "react-icons/hi2"; +import { HiMiniTag } from "react-icons/hi2"; import InstallationBanner from "~/components/InstallationBanner"; import LoadingLoader from "~/components/LoadingLoader"; import SearchBar from "~/components/SearchBar"; @@ -21,8 +21,6 @@ import TagsList from "~/components/lists/TagsList"; import { useAuth } from "~/providers/Auth"; import { api } from "~/utils/api"; -const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string; - export default function Dashboard() { const { user } = useAuth(); @@ -76,7 +74,7 @@ export default function Dashboard() { Explorer - - + */} - {isOpenCrisp && user && ( - { - setIsOpenCrisp(false); - }} - /> - )} ); } From 746ef0ef309070da252bef24846b6cd7cdebb333 Mon Sep 17 00:00:00 2001 From: Social Groovy Bot <45039513+SocialGroovyBot@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:33:52 +0000 Subject: [PATCH 6/6] chore(release): 0.73.21 --- webapp/CHANGELOG.md | 7 +++++++ webapp/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index fd5ad4b2..428ccc4d 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.73.21](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.20...v0.73.21) (2024-12-13) + + +### Bug Fixes + +* remove crisp component from all pages ([156b1e1](https://github.com/SocialGouv/carte-jeune-engage/commit/156b1e183fa00a12e1273390e3289aae35b658e3)) + ## [0.73.20](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.19...v0.73.20) (2024-12-05) ### Bug Fixes diff --git a/webapp/package.json b/webapp/package.json index b6b3833c..4e51a3a3 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "webapp", - "version": "0.73.20", + "version": "0.73.21", "private": true, "scripts": { "dev": "next dev",