Skip to content

Commit

Permalink
Merge branch 'main' into feat/obiz-used-and-feedback-form
Browse files Browse the repository at this point in the history
  • Loading branch information
HoreKk authored Dec 5, 2024
2 parents 1edc19e + aa3f4a6 commit 12087ff
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 135 deletions.
45 changes: 45 additions & 0 deletions webapp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
## [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

- 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))

## [0.73.17](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.16...v0.73.17) (2024-12-04)

### Bug Fixes

- catch errors obizSync article ([b28c271](https://github.com/SocialGouv/carte-jeune-engage/commit/b28c2719fbb32ea713b017e9e2a0dbc646b28cdd))

## [0.73.16](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.15...v0.73.16) (2024-12-04)

### Bug Fixes

- hide modal content on crisp component open for input text purpose ([abab82d](https://github.com/SocialGouv/carte-jeune-engage/commit/abab82d903ef2da9195becfb2381a12211a12ac2))

## [0.73.15](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.14...v0.73.15) (2024-12-04)

### Bug Fixes

- reminder order users by createdAt ASC ([befae16](https://github.com/SocialGouv/carte-jeune-engage/commit/befae16aa100e84e2b8746c1e33c1c195e1a9979))
- saved coupon button issue ([08140fd](https://github.com/SocialGouv/carte-jeune-engage/commit/08140fd161b0478fac934390afccf0bbf7c97824))

## [0.73.14](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.13...v0.73.14) (2024-12-04)

### Bug Fixes

- add crisp on offer obiz journey ([e655a50](https://github.com/SocialGouv/carte-jeune-engage/commit/e655a501c03568e4cd8aacefee90b557a30cd248))

## [0.73.13](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.12...v0.73.13) (2024-12-03)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webapp",
"version": "0.73.13",
"version": "0.73.20",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
106 changes: 56 additions & 50 deletions webapp/src/components/modals/IssueModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ type IssueModalProps = IssueModalOrder | IssueModalCoupon;

const IssueModal = (props: IssueModalProps) => {
const { isOpen, onClose, kind } = props;
const { setShowCrispModal } = useAuth();
const { showCrispModal, setShowCrispModal } = useAuth();

const id = kind === "order" ? props.order_id : props.coupon_id;

Expand All @@ -200,57 +200,63 @@ const IssueModal = (props: IssueModalProps) => {
];

return (
<Modal isOpen={isOpen} onClose={onClose} isCentered={kind === "coupon"}>
<ModalOverlay />
<ModalContent
mx={2.5}
mt={kind == "order" ? 5 : "auto"}
borderRadius="2.5xl"
>
<ModalCloseButton size="lg" top={4} right={4} />
<ModalBody display="flex" flexDir="column" px={9} pb={16} pt={4}>
<OrderIssueContent kind={kind} id={id} issues={issues} />
<Divider my={6} />
<Flex direction="column" gap={4}>
<ItemLink
onClick={() => setShowCrispModal(true)}
icon={HiMiniChatBubbleOvalLeftEllipsis}
text="Discutez avec nous en direct"
/>
{kind === "order" && (
<>
<Text
my={2}
fontSize={14}
fontWeight={500}
textAlign="center"
color="disabled"
>
ou
</Text>
<ItemLink
href="telto:0472402828"
icon={HiPhone}
text="04 72 40 28 28"
/>
<Modal isOpen={isOpen} onClose={onClose} isCentered={kind === "coupon"}>
<ModalOverlay />
{!showCrispModal && (
<ModalContent
mx={2.5}
mt={kind == "order" ? 5 : "auto"}
borderRadius="2.5xl"
>
<ModalCloseButton size="lg" top={4} right={4} />
<ModalBody display="flex" flexDir="column" px={9} pb={16} pt={4}>
<OrderIssueContent kind={kind} id={id} issues={issues} />
<Divider my={6} />
<Flex direction="column" gap={4}>
<ItemLink
href="mailto:[email protected]"
icon={HiEnvelope}
text="[email protected]"
onClick={() => setIsOpenCrisp(true)}
icon={HiMiniChatBubbleOvalLeftEllipsis}
text="Discutez avec nous en direct"
/>
<Flex direction="column" gap={4} fontSize={"sm"}>
<Text fontWeight={500} textAlign="center" color="disabled">
Disponible du lundi au vendredi de
<br />
09h à 12h30 puis de 14h à 17h30
</Text>
</Flex>
</>
)}
</Flex>
</ModalBody>
</ModalContent>
</Modal>
{kind === "order" && (
<>
<Text
my={2}
fontSize={14}
fontWeight={500}
textAlign="center"
color="disabled"
>
ou
</Text>
<ItemLink
href="telto:0472402828"
icon={HiPhone}
text="04 72 40 28 28"
/>
<ItemLink
href="mailto:[email protected]"
icon={HiEnvelope}
text="[email protected]"
/>
<Flex direction="column" gap={4} fontSize={"sm"}>
<Text
fontWeight={500}
textAlign="center"
color="disabled"
>
Disponible du lundi au vendredi de
<br />
09h à 12h30 puis de 14h à 17h30
</Text>
</Flex>
</>
)}
</Flex>
</ModalBody>
</ModalContent>
)}
</Modal>
);
};

Expand Down
159 changes: 94 additions & 65 deletions webapp/src/components/modals/ObizOrderProcessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import { HiMiniShieldCheck, HiQuestionMarkCircle } 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,
Expand Down Expand Up @@ -219,7 +223,11 @@ 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<Steps>("amount");
const [selectedArticles, setSelectedArticles] = useState<
Expand Down Expand Up @@ -254,72 +262,93 @@ export default function ObizOrderProcessModal(
const discount = availableArticles[0].reductionPercentage;

return (
<Modal isOpen={isOpen} onClose={onClose} size="full">
<ModalOverlay />
<ModalContent minH="full">
<ModalBody display="flex" flexDir="column" px={8} minH="full">
{step !== "payment" && (
<Flex mt={8} alignItems="center">
<Box mr={4}>
<BackButton
onClick={() =>
step == "amount" ? onClose() : setStep("amount")
<>
<Modal isOpen={isOpen} onClose={onClose} size="full">
<ModalOverlay />
{!isOpenCrisp && (
<ModalContent>
<ModalBody display="flex" flexDir="column" px={8}>
{step !== "payment" && (
<Flex mt={8} alignItems="center">
<Box mr={4}>
<BackButton
onClick={() =>
step == "amount" ? onClose() : setStep("amount")
}
/>
</Box>
<PartnerImage
partner={offer.partner}
width={42}
height={42}
/>
<Flex flexDir="column" gap={0.5} ml={2}>
<Text fontSize={14} fontWeight={500}>
{offer.partner.name}
</Text>
<Text fontSize={12} fontWeight={800}>
{offer.title} {offer.subtitle ?? ""}
</Text>
</Flex>
<Icon
as={HiQuestionMarkCircle}
w={6}
h={6}
ml="auto"
color="disabled"
onClick={() => setIsOpenCrisp(true)}
/>
</Flex>
)}
<ObizOfferVariableContent
step={step}
setStep={setStep}
amount={amount}
setAmount={setAmount}
offer={offer}
articles={availableArticles}
createOrder={() => {
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,
})),
});
}
/>
</Box>
<PartnerImage partner={offer.partner} width={42} height={42} />
<Flex flexDir="column" gap={0.5} ml={2}>
<Text fontSize={14} fontWeight={500}>
{offer.partner.name}
</Text>
<Text fontSize={12} fontWeight={800}>
{offer.title} {offer.subtitle ?? ""}
</Text>
</Flex>
<Icon
as={HiQuestionMarkCircle}
w={6}
h={6}
ml="auto"
color="disabled"
}}
selectedArticles={selectedArticles}
setSelectedArticles={setSelectedArticles}
/>
</Flex>
)}
<ObizOfferVariableContent
step={step}
setStep={setStep}
amount={amount}
setAmount={setAmount}
offer={offer}
articles={availableArticles}
createOrder={() => {
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}
/>
</ModalBody>
</ModalContent>
</Modal>
</ModalBody>
</ModalContent>
)}
</Modal>
{isOpenCrisp && user && (
<CrispWithNoSSR
crispToken={CRISP_TOKEN}
user={user}
onClose={() => {
setIsOpenCrisp(false);
}}
/>
)}
</>
);
}
Loading

0 comments on commit 12087ff

Please sign in to comment.