diff --git a/package-lock.json b/package-lock.json index bac7e9b6..8005fbf3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "eslint-config-next": "13.2.4", "form-data": "^4.0.0", "jwt-decode": "^3.1.2", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.132", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.134", "next": "13.2.4", "prettier": "^2.8.7", "react": "18.2.0", @@ -1401,20 +1401,20 @@ "optional": true }, "node_modules/bare-fs": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.2.3.tgz", - "integrity": "sha512-amG72llr9pstfXOBOHve1WjiuKKAMnebcmMbPWDZ7BCevAoJLpugjuAPRsDINEyjT0a6tbaVx3DctkXIRbLuJw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.3.0.tgz", + "integrity": "sha512-TNFqa1B4N99pds2a5NYHR15o0ZpdNKbAeKTE/+G6ED/UeOavv8RY3dr/Fu99HW3zU3pXpo2kDNO8Sjsm2esfOw==", "optional": true, "dependencies": { "bare-events": "^2.0.0", "bare-path": "^2.0.0", - "streamx": "^2.13.0" + "bare-stream": "^1.0.0" } }, "node_modules/bare-os": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.2.1.tgz", - "integrity": "sha512-OwPyHgBBMkhC29Hl3O4/YfxW9n7mdTr2+SsO29XBWKKJsbgj3mnorDB80r5TiCQgQstgE5ga1qNYrpes6NvX2w==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.3.0.tgz", + "integrity": "sha512-oPb8oMM1xZbhRQBngTgpcQ5gXw6kjOaRsSWsIeNyRxGed2w/ARyP7ScBYpWR1qfX2E5rS3gBw6OWcSQo+s+kUg==", "optional": true }, "node_modules/bare-path": { @@ -1426,6 +1426,15 @@ "bare-os": "^2.1.0" } }, + "node_modules/bare-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-1.0.0.tgz", + "integrity": "sha512-KhNUoDL40iP4gFaLSsoGE479t0jHijfYdIcxRn/XtezA2BaUD0NRf/JGRpsMq6dMNM+SrCrB0YSSo/5wBY4rOQ==", + "optional": true, + "dependencies": { + "streamx": "^2.16.1" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1536,9 +1545,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001611", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001611.tgz", - "integrity": "sha512-19NuN1/3PjA3QI8Eki55N8my4LzfkMCRLgCVfrl/slbSAchQfV0+GwjPrK3rq37As4UCLlM/DHajbKkAqbv92Q==", + "version": "1.0.30001612", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001612.tgz", + "integrity": "sha512-lFgnZ07UhaCcsSZgWW0K5j4e69dK1u/ltrL9lTUiFOwNHs12S3UMIEYgBV0Z6C6hRDev7iRnMzzYmKabYdXF9g==", "funding": [ { "type": "opencollective", @@ -1634,9 +1643,9 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, "node_modules/clsx": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", - "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", "engines": { "node": ">=6" } @@ -3514,7 +3523,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#888194736ec642c64a7f6e878f5ded4fc480d4a0", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#fb09b1ebbdfbc80d43f8ae2e4b64e15575d0b69d", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -3535,9 +3544,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.60", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.60.tgz", - "integrity": "sha512-Ctgq2lXUpEJo5j1762NOzl2xo7z7pqmVWYai0p07LvAkQ32tbPv3wb+tcUeHEiXhKU5buM4H9MXsXo6OlM6C2g==" + "version": "1.10.61", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.61.tgz", + "integrity": "sha512-TsQsyzDttDvvzWNkbp/i0fVbzTGJIG0mUu/uNalIaRQEYeJxVQ/FPg+EJgSqfSXezREjM0V3RZ8cLVsKYhhw0Q==" }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -3752,9 +3761,9 @@ } }, "node_modules/node-abi": { - "version": "3.59.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.59.0.tgz", - "integrity": "sha512-HyyfzvTLCE8b1SX2nWimlra8cibEsypcSu/Az4SXMhWhtuctkwAX7qsEYNjUOIoYtPV884oN3wtYTN+iZKBtvw==", + "version": "3.62.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.62.0.tgz", + "integrity": "sha512-CPMcGa+y33xuL1E0TcNIu4YyaZCxnnvkVaEXrsosR3FxN+fV8xvb7Mzpb7IgKler10qeMkE6+Dp8qJhpzdq35g==", "dependencies": { "semver": "^7.3.5" }, diff --git a/package.json b/package.json index f8735b20..e5d9682d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "eslint-config-next": "13.2.4", "form-data": "^4.0.0", "jwt-decode": "^3.1.2", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.132", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.134", "next": "13.2.4", "prettier": "^2.8.7", "react": "18.2.0", diff --git a/src/front/Components/LayoutTemplates/DefaultLayout.tsx b/src/front/Components/LayoutTemplates/DefaultLayout.tsx index 45452b20..322f5bd3 100644 --- a/src/front/Components/LayoutTemplates/DefaultLayout.tsx +++ b/src/front/Components/LayoutTemplates/DefaultLayout.tsx @@ -7,7 +7,7 @@ export const DefaultLayout = ({ children }: DefaultLayoutProps) => { return ( <> - LECoffre + LEcoffre {/* */}
diff --git a/src/front/Components/Layouts/Login/index.tsx b/src/front/Components/Layouts/Login/index.tsx index d5a2fc02..e5951e77 100644 --- a/src/front/Components/Layouts/Login/index.tsx +++ b/src/front/Components/Layouts/Login/index.tsx @@ -63,7 +63,7 @@ export default function Login() {
Vous n'arrivez pas à vous connecter ?
- + diff --git a/src/front/Components/Layouts/LoginCallback/index.tsx b/src/front/Components/Layouts/LoginCallback/index.tsx index f418c028..ee9ffdc5 100644 --- a/src/front/Components/Layouts/LoginCallback/index.tsx +++ b/src/front/Components/Layouts/LoginCallback/index.tsx @@ -72,7 +72,7 @@ export default function LoginCallBack() {
Vous n'arrivez pas à vous connecter ?
- + diff --git a/src/front/Components/Layouts/LoginCallbackCustomer/index.tsx b/src/front/Components/Layouts/LoginCallbackCustomer/index.tsx index be49e601..3574f7af 100644 --- a/src/front/Components/Layouts/LoginCallbackCustomer/index.tsx +++ b/src/front/Components/Layouts/LoginCallbackCustomer/index.tsx @@ -58,7 +58,7 @@ export default function LoginCallBackCustomer() {
Vous n'arrivez pas à vous connecter ?
- + diff --git a/src/front/Components/Layouts/LoginCustomer/StepEmail/index.tsx b/src/front/Components/Layouts/LoginCustomer/StepEmail/index.tsx index a9348265..abe17e3d 100644 --- a/src/front/Components/Layouts/LoginCustomer/StepEmail/index.tsx +++ b/src/front/Components/Layouts/LoginCustomer/StepEmail/index.tsx @@ -54,7 +54,7 @@ export default function StepEmail(props: IProps) { {/*
Vous n'arrivez pas à vous connecter ?
- + */} diff --git a/src/front/Components/Layouts/LoginHome/index.tsx b/src/front/Components/Layouts/LoginHome/index.tsx index 1c3cb2cd..38238259 100644 --- a/src/front/Components/Layouts/LoginHome/index.tsx +++ b/src/front/Components/Layouts/LoginHome/index.tsx @@ -37,7 +37,7 @@ export default function LoginHome() {
Vous n'arrivez pas à vous connecter ?
- + diff --git a/src/front/Components/Layouts/Subscription/Components/SubscribeCheckoutTicket/index.tsx b/src/front/Components/Layouts/Subscription/Components/SubscribeCheckoutTicket/index.tsx index 76339377..3c24a43b 100644 --- a/src/front/Components/Layouts/Subscription/Components/SubscribeCheckoutTicket/index.tsx +++ b/src/front/Components/Layouts/Subscription/Components/SubscribeCheckoutTicket/index.tsx @@ -5,7 +5,7 @@ import { useEffect, useState } from "react"; import RadioBox from "@Front/Components/DesignSystem/RadioBox"; import Button from "@Front/Components/DesignSystem/Button"; import classnames from "classnames"; -import { EType } from "le-coffre-resources/dist/Admin/Subscription"; +import { EPaymentFrequency, EType } from "le-coffre-resources/dist/Admin/Subscription"; import Stripe from "@Front/Api/LeCoffreApi/Admin/Stripe/Stripe"; import { useRouter } from "next/router"; @@ -13,11 +13,11 @@ type IProps = { forfeitType: EForfeitType; numberOfCollaborators: number; hasNavTab?: boolean; - defaultFrequency?: EPaymentFrequency; + defaultFrequency?: EPaymentFrequencyFront; disableInputs?: boolean; }; -export enum EPaymentFrequency { +export enum EPaymentFrequencyFront { monthly, yearly, } @@ -25,17 +25,19 @@ export enum EPaymentFrequency { export default function SubscribeCheckoutTicket(props: IProps) { const router = useRouter(); const { forfeitType, numberOfCollaborators, hasNavTab = true } = props; - const [paymentFrequency, setPaymentFrequency] = useState(props.defaultFrequency ?? EPaymentFrequency.monthly); + const [paymentFrequency, setPaymentFrequency] = useState( + props.defaultFrequency ?? EPaymentFrequencyFront.monthly, + ); const [multiplier, setMultiplier] = useState(1); const [totalPlan, setTotalPlan] = useState(0); const [totalCollaborator, setTotalCollaborator] = useState(0); useEffect(() => { - setMultiplier(paymentFrequency === EPaymentFrequency.monthly ? 1 : 12); + setMultiplier(paymentFrequency === EPaymentFrequencyFront.monthly ? 1 : 12); }, [paymentFrequency]); useEffect(() => { - let multiplierToUse = paymentFrequency === EPaymentFrequency.yearly ? multiplier - 1 : multiplier; + let multiplierToUse = paymentFrequency === EPaymentFrequencyFront.yearly ? multiplier - 1 : multiplier; if (forfeitType === EForfeitType.unlimited) { setTotalPlan(forfeitsPrices[EForfeitType.unlimited] * multiplierToUse); setTotalCollaborator(0); @@ -46,7 +48,7 @@ export default function SubscribeCheckoutTicket(props: IProps) { }, [multiplier, forfeitType, numberOfCollaborators, paymentFrequency]); const handleFrequencyChange = (e: React.ChangeEvent) => { - setPaymentFrequency(parseInt(e.target.value) as EPaymentFrequency); + setPaymentFrequency(parseInt(e.target.value) as EPaymentFrequencyFront); }; const formatFloat = (value: number) => { @@ -57,6 +59,7 @@ export default function SubscribeCheckoutTicket(props: IProps) { const stripeCheckout = { type: forfeitType === EForfeitType.standard ? EType.Standard : EType.Unlimited, nb_seats: forfeitType === EForfeitType.standard ? numberOfCollaborators : 0, + frequency: paymentFrequency === EPaymentFrequencyFront.monthly ? EPaymentFrequency.Monthly : EPaymentFrequency.Yearly, }; try { @@ -77,17 +80,17 @@ export default function SubscribeCheckoutTicket(props: IProps) {
Annuel Mensuel @@ -99,7 +102,7 @@ export default function SubscribeCheckoutTicket(props: IProps) { {forfeitType === EForfeitType.standard ? "Plan individuel" : "Plan illimité"} - {paymentFrequency === EPaymentFrequency.yearly && ( + {paymentFrequency === EPaymentFrequencyFront.yearly && ( {formatFloat( forfeitType === EForfeitType.standard @@ -115,7 +118,7 @@ export default function SubscribeCheckoutTicket(props: IProps) { {totalPlan} € - {paymentFrequency === EPaymentFrequency.yearly && ( + {paymentFrequency === EPaymentFrequencyFront.yearly && ( {formatFloat( forfeitType === EForfeitType.standard @@ -135,7 +138,7 @@ export default function SubscribeCheckoutTicket(props: IProps) { {formatFloat(collaboratorPrice)} € x {numberOfCollaborators}{" "} - {paymentFrequency === EPaymentFrequency.yearly && "x 12"} + {paymentFrequency === EPaymentFrequencyFront.yearly && "x 12"}
diff --git a/src/front/Components/Layouts/Subscription/Components/SubscribeIllimityComponent/index.tsx b/src/front/Components/Layouts/Subscription/Components/SubscribeIllimityComponent/index.tsx index 3b51400c..82367009 100644 --- a/src/front/Components/Layouts/Subscription/Components/SubscribeIllimityComponent/index.tsx +++ b/src/front/Components/Layouts/Subscription/Components/SubscribeIllimityComponent/index.tsx @@ -2,7 +2,7 @@ import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Ty import classes from "./classes.module.scss"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; import NavTab from "@Front/Components/Elements/NavTab"; -import SubscribeCheckoutTicket, { EPaymentFrequency } from "../SubscribeCheckoutTicket"; +import SubscribeCheckoutTicket, { EPaymentFrequencyFront as EPaymentFrequency } from "../SubscribeCheckoutTicket"; import { EForfeitType, forfeitsPrices } from "../../SubscriptionFacturation"; import { useEffect, useState } from "react"; import Check from "@Front/Components/Elements/Icons/Check"; diff --git a/src/front/Components/Layouts/Subscription/Components/SubscribeStandardComponent/index.tsx b/src/front/Components/Layouts/Subscription/Components/SubscribeStandardComponent/index.tsx index 581524cf..f684cf32 100644 --- a/src/front/Components/Layouts/Subscription/Components/SubscribeStandardComponent/index.tsx +++ b/src/front/Components/Layouts/Subscription/Components/SubscribeStandardComponent/index.tsx @@ -3,7 +3,7 @@ import classes from "./classes.module.scss"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; import NavTab from "@Front/Components/Elements/NavTab"; import NumberPicker from "@Front/Components/Elements/NumberPicker"; -import SubscribeCheckoutTicket, { EPaymentFrequency } from "../SubscribeCheckoutTicket"; +import SubscribeCheckoutTicket, { EPaymentFrequencyFront as EPaymentFrequency } from "../SubscribeCheckoutTicket"; import { EForfeitType, collaboratorPrice, forfeitsPrices } from "../../SubscriptionFacturation"; import { useEffect, useState } from "react"; import Check from "@Front/Components/Elements/Icons/Check"; diff --git a/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx b/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx index c0f06dbb..4c9bea8d 100644 --- a/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx +++ b/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx @@ -10,6 +10,7 @@ import JwtService from "@Front/Services/JwtService/JwtService"; import Subscriptions from "@Front/Api/LeCoffreApi/Admin/Subscriptions/Subscriptions"; import Users from "@Front/Api/LeCoffreApi/Admin/Users/Users"; import { useRouter } from "next/router"; +import CookieService from "@Front/Services/CookieService/CookieService"; export default function SubscriptionManageCollaborators() { const router = useRouter(); @@ -62,7 +63,11 @@ export default function SubscriptionManageCollaborators() { const subcriptionToUpdate = { seats: selectedCollaborators.map((collaborator) => ({ user: { uid: collaborator } })), }; + await Subscriptions.getInstance().put(subscription?.uid!, subcriptionToUpdate); + const refreshToken = CookieService.getInstance().getCookie("leCoffreRefreshToken"); + if (!refreshToken) return; + await JwtService.getInstance().forceRefreshToken(refreshToken); router.push("/subscription/manage"); if (!e) return; e.preventDefault(); @@ -71,7 +76,7 @@ export default function SubscriptionManageCollaborators() { useEffect(() => { loadSubscription(); loadCollaborators(); - }, [loadSubscription]); + }, [loadCollaborators, loadSubscription]); return ( diff --git a/src/front/Components/Layouts/Subscription/SubscriptionError/index.tsx b/src/front/Components/Layouts/Subscription/SubscriptionError/index.tsx index 5fa92bec..b92943c8 100644 --- a/src/front/Components/Layouts/Subscription/SubscriptionError/index.tsx +++ b/src/front/Components/Layouts/Subscription/SubscriptionError/index.tsx @@ -8,7 +8,7 @@ import { useCallback, useEffect, useState } from "react"; import { Subscription } from "le-coffre-resources/dist/Admin"; import JwtService from "@Front/Services/JwtService/JwtService"; import Subscriptions from "@Front/Api/LeCoffreApi/Admin/Subscriptions/Subscriptions"; -import SubscribeCheckoutTicket, { EPaymentFrequency } from "../Components/SubscribeCheckoutTicket"; +import SubscribeCheckoutTicket, { EPaymentFrequencyFront as EPaymentFrequency } from "../Components/SubscribeCheckoutTicket"; import { EForfeitType } from "../SubscriptionFacturation"; import Stripe from "@Front/Api/LeCoffreApi/Admin/Stripe/Stripe"; diff --git a/src/front/Components/Layouts/Subscription/SubscriptionSuccess/index.tsx b/src/front/Components/Layouts/Subscription/SubscriptionSuccess/index.tsx index ad4c8bd7..679b91af 100644 --- a/src/front/Components/Layouts/Subscription/SubscriptionSuccess/index.tsx +++ b/src/front/Components/Layouts/Subscription/SubscriptionSuccess/index.tsx @@ -7,7 +7,7 @@ import Button from "@Front/Components/DesignSystem/Button"; import Link from "next/link"; import Module from "@Front/Config/Module"; import { EForfeitType } from "../SubscriptionFacturation"; -import SubscribeCheckoutTicket, { EPaymentFrequency } from "../Components/SubscribeCheckoutTicket"; +import SubscribeCheckoutTicket, { EPaymentFrequencyFront as EPaymentFrequency } from "../Components/SubscribeCheckoutTicket"; import { useCallback, useEffect, useState } from "react"; import Subscriptions from "@Front/Api/LeCoffreApi/Admin/Subscriptions/Subscriptions"; import JwtService from "@Front/Services/JwtService/JwtService";