@plurix/ecom-components 0.0.2-beta.1 → 0.0.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/svgs/ArrowIcon.d.ts +9 -0
- package/dist/assets/svgs/ArrowIcon.js +37 -0
- package/dist/assets/svgs/CartEmptyCoupon.d.ts +1 -0
- package/dist/assets/svgs/CartEmptyCoupon.js +937 -0
- package/dist/assets/svgs/CloseIcon.d.ts +7 -0
- package/dist/assets/svgs/CloseIcon.js +41 -0
- package/dist/assets/svgs/CouponIcon.d.ts +4 -0
- package/dist/assets/svgs/CouponIcon.js +22 -0
- package/dist/assets/svgs/DeliveryExpressIcon.d.ts +1 -0
- package/dist/assets/svgs/DeliveryExpressIcon.js +21 -0
- package/dist/assets/svgs/DeliveryIcon.d.ts +1 -0
- package/dist/assets/svgs/DeliveryIcon.js +21 -0
- package/dist/assets/svgs/ErrorIcon.d.ts +5 -0
- package/dist/assets/svgs/ErrorIcon.js +29 -0
- package/dist/assets/svgs/FacebookIcon.d.ts +1 -0
- package/dist/assets/svgs/FacebookIcon.js +22 -0
- package/dist/assets/svgs/GlassIcon.d.ts +1 -0
- package/dist/assets/svgs/GlassIcon.js +23 -0
- package/dist/assets/svgs/InfoIcon.d.ts +6 -0
- package/dist/assets/svgs/InfoIcon.js +47 -0
- package/dist/assets/svgs/InstagramIcon.d.ts +1 -0
- package/dist/assets/svgs/InstagramIcon.js +49 -0
- package/dist/assets/svgs/NoCouponIcon.d.ts +1 -0
- package/dist/assets/svgs/NoCouponIcon.js +107 -0
- package/dist/assets/svgs/ShoppingBagsIcon.d.ts +1 -0
- package/dist/assets/svgs/ShoppingBagsIcon.js +30 -0
- package/dist/assets/svgs/ShoppingIcon.d.ts +1 -0
- package/dist/assets/svgs/ShoppingIcon.js +21 -0
- package/dist/assets/svgs/SuccessIcon.d.ts +6 -0
- package/dist/assets/svgs/SuccessIcon.js +38 -0
- package/dist/assets/svgs/WarningIcon.d.ts +1 -0
- package/dist/assets/svgs/WarningIcon.js +25 -0
- package/dist/main.d.ts +6 -0
- package/dist/main.js +11 -1
- package/dist/packages/Carousel/Carousel.d.ts +24 -0
- package/dist/packages/Carousel/Carousel.js +128 -0
- package/dist/packages/Carousel/components/Arrows.d.ts +8 -0
- package/dist/packages/Carousel/components/Arrows.js +43 -0
- package/dist/packages/Carousel/components/Bullets.d.ts +7 -0
- package/dist/packages/Carousel/components/Bullets.js +5 -0
- package/dist/packages/Carousel/test/Carrousel.test.js +80 -0
- package/dist/packages/Carousel/utils/defaultProps.d.ts +19 -0
- package/dist/packages/Carousel/utils/defaultProps.js +22 -0
- package/dist/packages/CartClubAlert/CartClubAlert.js +1 -1
- package/dist/packages/Coupons/Coupons.d.ts +14 -0
- package/dist/packages/Coupons/Coupons.js +100 -0
- package/dist/packages/Coupons/api/addCoupon.d.ts +3 -0
- package/dist/packages/Coupons/api/addCoupon.js +14 -0
- package/dist/packages/Coupons/api/getCoupons.d.ts +3 -0
- package/dist/packages/Coupons/api/getCoupons.js +15 -0
- package/dist/packages/Coupons/api/removeCoupon.d.ts +3 -0
- package/dist/packages/Coupons/api/removeCoupon.js +13 -0
- package/dist/packages/Coupons/components/Alert.d.ts +6 -0
- package/dist/packages/Coupons/components/Alert.js +13 -0
- package/dist/packages/Coupons/components/Breadcrumb.d.ts +6 -0
- package/dist/packages/Coupons/components/Breadcrumb.js +33 -0
- package/dist/packages/Coupons/components/CouponCard.d.ts +25 -0
- package/dist/packages/Coupons/components/CouponCard.js +132 -0
- package/dist/packages/Coupons/components/Modal.d.ts +8 -0
- package/dist/packages/Coupons/components/Modal.js +34 -0
- package/dist/packages/Coupons/components/ModalFooter.d.ts +8 -0
- package/dist/packages/Coupons/components/ModalFooter.js +14 -0
- package/dist/packages/Coupons/components/ModalHeader.d.ts +6 -0
- package/dist/packages/Coupons/components/ModalHeader.js +25 -0
- package/dist/packages/Coupons/components/NoCoupons.d.ts +1 -0
- package/dist/packages/Coupons/components/NoCoupons.js +10 -0
- package/dist/packages/Coupons/test/Alert.test.js +18 -0
- package/dist/packages/Coupons/test/Breadcrumb.test.js +41 -0
- package/dist/packages/Coupons/test/ModalFooter.test.js +32 -0
- package/dist/packages/Coupons/test/ModalHeader.test.js +23 -0
- package/dist/packages/Coupons/test/NoCoupons.test.js +17 -0
- package/dist/packages/Coupons/types/CouponType.d.ts +8 -0
- package/dist/packages/Coupons/types/CouponType.js +1 -0
- package/dist/packages/Coupons/types/SetOrderFormCouponResponse.d.ts +10 -0
- package/dist/packages/Coupons/types/SetOrderFormCouponResponse.js +1 -0
- package/dist/packages/Coupons/types/Views.d.ts +1 -0
- package/dist/packages/Coupons/types/Views.js +1 -0
- package/dist/packages/Coupons/views/CouponsView.d.ts +13 -0
- package/dist/packages/Coupons/views/CouponsView.js +122 -0
- package/dist/packages/Coupons/views/EmptyCartView.d.ts +6 -0
- package/dist/packages/Coupons/views/EmptyCartView.js +37 -0
- package/dist/packages/Coupons/views/LoadingView.d.ts +7 -0
- package/dist/packages/Coupons/views/LoadingView.js +39 -0
- package/dist/packages/Coupons/views/OverwriteView.d.ts +14 -0
- package/dist/packages/Coupons/views/OverwriteView.js +58 -0
- package/dist/packages/Coupons/views/RulesView.d.ts +13 -0
- package/dist/packages/Coupons/views/RulesView.js +49 -0
- package/dist/packages/Coupons/views/index.d.ts +5 -0
- package/dist/packages/Coupons/views/index.js +12 -0
- package/dist/packages/Onboarding/Onboarding.d.ts +10 -0
- package/dist/packages/Onboarding/Onboarding.js +47 -0
- package/dist/packages/Onboarding/components/Bullets.d.ts +5 -0
- package/dist/packages/Onboarding/components/Bullets.js +10 -0
- package/dist/packages/Onboarding/components/Content.d.ts +9 -0
- package/dist/packages/Onboarding/components/Content.js +30 -0
- package/dist/packages/Onboarding/components/Footer.d.ts +9 -0
- package/dist/packages/Onboarding/components/Footer.js +15 -0
- package/dist/packages/Onboarding/components/Header.d.ts +6 -0
- package/dist/packages/Onboarding/components/Header.js +11 -0
- package/dist/packages/Onboarding/components/SocialMedia.d.ts +10 -0
- package/dist/packages/Onboarding/components/SocialMedia.js +36 -0
- package/dist/packages/Onboarding/constants/tips.d.ts +11 -0
- package/dist/packages/Onboarding/constants/tips.js +36 -0
- package/dist/packages/Onboarding/test/Bullets.test.js +20 -0
- package/dist/packages/Onboarding/test/Content.test.js +52 -0
- package/dist/packages/Onboarding/test/Footer.test.js +60 -0
- package/dist/packages/Onboarding/test/Header.test.js +30 -0
- package/dist/packages/Onboarding/test/Onboarding.test.js +22 -0
- package/dist/packages/Onboarding/test/SocialMedia.test.js +39 -0
- package/dist/packages/Onboarding/tips/Tip1.d.ts +1 -0
- package/dist/packages/Onboarding/tips/Tip1.js +2130 -0
- package/dist/packages/Onboarding/tips/Tip2.d.ts +1 -0
- package/dist/packages/Onboarding/tips/Tip2.js +361 -0
- package/dist/packages/Onboarding/tips/Tip3.d.ts +1 -0
- package/dist/packages/Onboarding/tips/Tip3.js +350 -0
- package/dist/packages/Onboarding/tips/Tip4.d.ts +1 -0
- package/dist/packages/Onboarding/tips/Tip4.js +593 -0
- package/dist/packages/Onboarding/tips/Tip5.d.ts +1 -0
- package/dist/packages/Onboarding/tips/Tip5.js +1571 -0
- package/dist/packages/Regionalization/Regionalization.d.ts +3 -0
- package/dist/packages/Regionalization/Regionalization.js +93 -0
- package/dist/packages/Regionalization/components/Delivery.d.ts +24 -0
- package/dist/packages/Regionalization/components/Delivery.js +48 -0
- package/dist/packages/Regionalization/components/DeliveryExpress.d.ts +9 -0
- package/dist/packages/Regionalization/components/DeliveryExpress.js +25 -0
- package/dist/packages/Regionalization/components/InfoPrices.d.ts +9 -0
- package/dist/packages/Regionalization/components/InfoPrices.js +15 -0
- package/dist/packages/Regionalization/components/Navigation.d.ts +6 -0
- package/dist/packages/Regionalization/components/Navigation.js +59 -0
- package/dist/packages/Regionalization/components/NormalDelivery.d.ts +7 -0
- package/dist/packages/Regionalization/components/NormalDelivery.js +23 -0
- package/dist/packages/Regionalization/components/PickupPoint.d.ts +7 -0
- package/dist/packages/Regionalization/components/PickupPoint.js +32 -0
- package/dist/packages/Regionalization/components/Price.d.ts +7 -0
- package/dist/packages/Regionalization/components/Price.js +10 -0
- package/dist/packages/Regionalization/components/SetViewButton.d.ts +11 -0
- package/dist/packages/Regionalization/components/SetViewButton.js +24 -0
- package/dist/packages/Regionalization/components/Title.d.ts +8 -0
- package/dist/packages/Regionalization/components/Title.js +21 -0
- package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +4 -0
- package/dist/packages/Regionalization/context/RegionalizationContext.js +113 -0
- package/dist/packages/Regionalization/types/Address.d.ts +13 -0
- package/dist/packages/Regionalization/types/Address.js +1 -0
- package/dist/packages/Regionalization/types/ContextProps.d.ts +29 -0
- package/dist/packages/Regionalization/types/ContextProps.js +1 -0
- package/dist/packages/Regionalization/types/PikcupPointType.d.ts +22 -0
- package/dist/packages/Regionalization/types/PikcupPointType.js +1 -0
- package/dist/packages/Regionalization/types/PricesAndHours.d.ts +13 -0
- package/dist/packages/Regionalization/types/PricesAndHours.js +1 -0
- package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +87 -0
- package/dist/packages/Regionalization/types/RegionalizationProps.js +1 -0
- package/dist/packages/Regionalization/types/index.d.ts +5 -0
- package/dist/packages/Regionalization/types/index.js +1 -0
- package/dist/packages/Regionalization/utils/constants.d.ts +1 -0
- package/dist/packages/Regionalization/utils/constants.js +4 -0
- package/dist/packages/Regionalization/utils/deliverySetData.d.ts +3 -0
- package/dist/packages/Regionalization/utils/deliverySetData.js +13 -0
- package/dist/packages/Regionalization/utils/formatPrice.d.ts +1 -0
- package/dist/packages/Regionalization/utils/formatPrice.js +8 -0
- package/dist/packages/Regionalization/utils/localStorage.d.ts +9 -0
- package/dist/packages/Regionalization/utils/localStorage.js +23 -0
- package/dist/packages/Regionalization/utils/pickupSetData.d.ts +3 -0
- package/dist/packages/Regionalization/utils/pickupSetData.js +11 -0
- package/dist/packages/Regionalization/utils/postalCode.d.ts +3 -0
- package/dist/packages/Regionalization/utils/postalCode.js +9 -0
- package/dist/packages/Regionalization/views/AllStoresScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/AllStoresScreen.js +73 -0
- package/dist/packages/Regionalization/views/ConfirmScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/ConfirmScreen.js +60 -0
- package/dist/packages/Regionalization/views/InitialView.d.ts +1 -0
- package/dist/packages/Regionalization/views/InitialView.js +49 -0
- package/dist/packages/Regionalization/views/MoreInfosScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/MoreInfosScreen.js +42 -0
- package/dist/packages/Regionalization/views/PickupPointInfoScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/PickupPointInfoScreen.js +42 -0
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.js +87 -0
- package/dist/packages/Regionalization/views/ViewsContainer.d.ts +1 -0
- package/dist/packages/Regionalization/views/ViewsContainer.js +22 -0
- package/dist/packages/Tour/Tour.d.ts +10 -0
- package/dist/packages/Tour/Tour.js +68 -0
- package/dist/packages/Tour/components/TooltipFooter.d.ts +11 -0
- package/dist/packages/Tour/components/TooltipFooter.js +14 -0
- package/dist/packages/Tour/components/TooltipHeader.d.ts +8 -0
- package/dist/packages/Tour/components/TooltipHeader.js +13 -0
- package/dist/packages/Tour/components/TourOverlay.d.ts +7 -0
- package/dist/packages/Tour/components/TourOverlay.js +12 -0
- package/dist/packages/Tour/components/TourTooltip.d.ts +17 -0
- package/dist/packages/Tour/components/TourTooltip.js +42 -0
- package/dist/packages/Tour/test/TooltipFooter.test.js +68 -0
- package/dist/packages/Tour/test/TooltipHeader.test.js +18 -0
- package/dist/packages/Tour/test/Tour.test.js +45 -0
- package/dist/packages/Tour/test/TourOverlay.test.js +18 -0
- package/dist/packages/Tour/test/TourTooltip.test.js +40 -0
- package/dist/packages/Tour/types/TourStep.d.ts +4 -0
- package/dist/packages/Tour/types/TourStep.js +1 -0
- package/dist/styles/carousel.global.css +1 -0
- package/dist/styles/coupons.global.css +1 -0
- package/dist/styles/onboarding.global.css +1 -0
- package/dist/styles/regionalization.global.css +1 -0
- package/dist/styles/tour.global.css +1 -0
- package/dist/types/FixedLengthArray.d.ts +7 -0
- package/dist/types/FixedLengthArray.js +1 -0
- package/package.json +58 -51
- /package/dist/assets/{svg → svgs}/DiscountIcon.d.ts +0 -0
- /package/dist/assets/{svg → svgs}/DiscountIcon.js +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { View } from '../types/Views';
|
|
2
|
+
|
|
3
|
+
interface OverwriteViewProps {
|
|
4
|
+
firstCouponName: string;
|
|
5
|
+
secondCouponName: string;
|
|
6
|
+
setView: (view: View) => void;
|
|
7
|
+
setReplaceCoupon: (replaceCoupon: boolean) => void;
|
|
8
|
+
setSecondCouponName: (secondCouponName: string) => void;
|
|
9
|
+
isIO?: boolean;
|
|
10
|
+
closeIOModal?: () => void;
|
|
11
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const OverwriteView: ({ firstCouponName, secondCouponName, setView, setReplaceCoupon, setSecondCouponName, isIO, closeIOModal, genericTaggingEvent }: OverwriteViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as n } from "react";
|
|
3
|
+
import { Modal as C } from "../components/Modal.js";
|
|
4
|
+
import { InfoIcon as M } from "../../../assets/svgs/InfoIcon.js";
|
|
5
|
+
const S = ({
|
|
6
|
+
firstCouponName: d,
|
|
7
|
+
secondCouponName: s,
|
|
8
|
+
setView: u,
|
|
9
|
+
setReplaceCoupon: i,
|
|
10
|
+
setSecondCouponName: c,
|
|
11
|
+
isIO: r,
|
|
12
|
+
closeIOModal: l,
|
|
13
|
+
genericTaggingEvent: o
|
|
14
|
+
}) => {
|
|
15
|
+
const [p, a] = h(!0), f = () => {
|
|
16
|
+
a(!1), u("coupons-view");
|
|
17
|
+
}, b = () => {
|
|
18
|
+
o == null || o("discount_coupon", {
|
|
19
|
+
name: "Modal de troca de cupom - botão de substituir cupom",
|
|
20
|
+
cupomName: s
|
|
21
|
+
}), i(!0), u("coupons-view");
|
|
22
|
+
}, e = () => {
|
|
23
|
+
o == null || o("discount_coupon", {
|
|
24
|
+
name: "Modal de troca de cupom - botão de sair"
|
|
25
|
+
}), c(""), u("coupons-view");
|
|
26
|
+
};
|
|
27
|
+
return n(() => {
|
|
28
|
+
p || c("");
|
|
29
|
+
}, [p]), /* @__PURE__ */ t(
|
|
30
|
+
C,
|
|
31
|
+
{
|
|
32
|
+
isIO: r,
|
|
33
|
+
closeModal: r && l ? l : f,
|
|
34
|
+
genericTaggingEvent: o,
|
|
35
|
+
title: "Substituir Cupom",
|
|
36
|
+
confirmButtonAction: b,
|
|
37
|
+
confirmButtonText: "Substituir Cupom",
|
|
38
|
+
cancelButtonAction: e,
|
|
39
|
+
cancelButtonText: "Voltar para Meus Cupons",
|
|
40
|
+
children: /* @__PURE__ */ m("p", { children: [
|
|
41
|
+
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(M, {}) }),
|
|
42
|
+
/* @__PURE__ */ m("span", { children: [
|
|
43
|
+
/* @__PURE__ */ t("b", { children: "Não é possível adicionar 2 cupons ao mesmo tempo." }),
|
|
44
|
+
/* @__PURE__ */ t("br", {}),
|
|
45
|
+
'Ao clicar em "Substituir Cupom" você irá substituir o cupom',
|
|
46
|
+
" ",
|
|
47
|
+
/* @__PURE__ */ t("b", { children: d }),
|
|
48
|
+
" pelo cupom ",
|
|
49
|
+
/* @__PURE__ */ t("b", { children: s }),
|
|
50
|
+
"."
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
S as OverwriteView
|
|
58
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CouponType } from '../types/CouponType';
|
|
2
|
+
import { View } from '../types/Views';
|
|
3
|
+
|
|
4
|
+
interface RulesViewProps {
|
|
5
|
+
dataItem: CouponType | undefined;
|
|
6
|
+
setActiveRule: (activeRule: boolean) => void;
|
|
7
|
+
setView: (view: View) => void;
|
|
8
|
+
isIO?: boolean;
|
|
9
|
+
closeIOModal?: () => void;
|
|
10
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const RulesView: ({ dataItem, setActiveRule, setView, isIO, closeIOModal, genericTaggingEvent }: RulesViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as u, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as h } from "../components/Modal.js";
|
|
3
|
+
import { InfoIcon as f } from "../../../assets/svgs/InfoIcon.js";
|
|
4
|
+
const m = ({
|
|
5
|
+
dataItem: l,
|
|
6
|
+
setActiveRule: d,
|
|
7
|
+
setView: i,
|
|
8
|
+
isIO: r,
|
|
9
|
+
closeIOModal: s,
|
|
10
|
+
genericTaggingEvent: o
|
|
11
|
+
}) => {
|
|
12
|
+
const c = () => {
|
|
13
|
+
d(!1), i("coupons-view");
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ u(
|
|
16
|
+
h,
|
|
17
|
+
{
|
|
18
|
+
isIO: r,
|
|
19
|
+
closeModal: r && s ? s : c,
|
|
20
|
+
genericTaggingEvent: o,
|
|
21
|
+
title: "Regra de Utilização",
|
|
22
|
+
confirmButtonAction: () => {
|
|
23
|
+
o == null || o("discount_coupon", {
|
|
24
|
+
name: "Modal regra de utilização - botão Ok, entendi"
|
|
25
|
+
}), c();
|
|
26
|
+
},
|
|
27
|
+
confirmButtonText: "Ok, Entendi",
|
|
28
|
+
cancelButtonAction: () => {
|
|
29
|
+
o == null || o("discount_coupon", {
|
|
30
|
+
name: "Modal regra de utilização - botão sair"
|
|
31
|
+
}), c();
|
|
32
|
+
},
|
|
33
|
+
cancelButtonText: "Voltar para Meus Cupons",
|
|
34
|
+
children: /* @__PURE__ */ n("p", { children: [
|
|
35
|
+
/* @__PURE__ */ u("span", { children: /* @__PURE__ */ u(f, {}) }),
|
|
36
|
+
/* @__PURE__ */ n("ul", { children: [
|
|
37
|
+
l == null ? void 0 : l.couponRules.map((p) => /* @__PURE__ */ u("li", { children: p }, p)),
|
|
38
|
+
/* @__PURE__ */ n("li", { children: [
|
|
39
|
+
"Válido até ",
|
|
40
|
+
l == null ? void 0 : l.couponExpirationDate
|
|
41
|
+
] })
|
|
42
|
+
] })
|
|
43
|
+
] })
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
m as RulesView
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoadingView as r } from "./LoadingView.js";
|
|
2
|
+
import { CouponsView as i } from "./CouponsView.js";
|
|
3
|
+
import { RulesView as m } from "./RulesView.js";
|
|
4
|
+
import { OverwriteView as f } from "./OverwriteView.js";
|
|
5
|
+
import { EmptyCartView as V } from "./EmptyCartView.js";
|
|
6
|
+
export {
|
|
7
|
+
i as CouponsView,
|
|
8
|
+
V as EmptyCartView,
|
|
9
|
+
r as LoadingView,
|
|
10
|
+
f as OverwriteView,
|
|
11
|
+
m as RulesView
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SocialMediaLinks } from './components/SocialMedia';
|
|
2
|
+
|
|
3
|
+
interface OnboardingProps {
|
|
4
|
+
socialMediaLinks?: SocialMediaLinks;
|
|
5
|
+
handleCloseAction: () => void;
|
|
6
|
+
handleFinishAction?: () => void;
|
|
7
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Onboarding: ({ socialMediaLinks, handleCloseAction, handleFinishAction, genericTaggingEvent }: OnboardingProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as i, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import { Header as x } from "./components/Header.js";
|
|
4
|
+
import { Content as S } from "./components/Content.js";
|
|
5
|
+
import { Footer as c } from "./components/Footer.js";
|
|
6
|
+
import { TIPS_LENGTH as h } from "./constants/tips.js";
|
|
7
|
+
/* empty css */const w = ({
|
|
8
|
+
socialMediaLinks: a,
|
|
9
|
+
handleCloseAction: r,
|
|
10
|
+
handleFinishAction: n,
|
|
11
|
+
genericTaggingEvent: s
|
|
12
|
+
}) => {
|
|
13
|
+
const [t, m] = d(1), e = (o) => {
|
|
14
|
+
s == null || s("ofertas_pelo_whatsapp", {
|
|
15
|
+
clickText: o,
|
|
16
|
+
name: t
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ i("div", { className: "onboarding-container", children: [
|
|
20
|
+
/* @__PURE__ */ p(x, { sendEvent: e, handleCloseAction: r }),
|
|
21
|
+
/* @__PURE__ */ p(
|
|
22
|
+
S,
|
|
23
|
+
{
|
|
24
|
+
step: t,
|
|
25
|
+
sendEvent: e,
|
|
26
|
+
socialMediaLinks: a
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ p(
|
|
30
|
+
c,
|
|
31
|
+
{
|
|
32
|
+
step: t,
|
|
33
|
+
handleBackStep: (o) => {
|
|
34
|
+
e(o.target.innerText), t > 1 ? m(t - 1) : r();
|
|
35
|
+
},
|
|
36
|
+
handleNextStep: (o) => {
|
|
37
|
+
e(o.target.innerText);
|
|
38
|
+
const f = n || r;
|
|
39
|
+
t < h ? m(t + 1) : f();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
w as Onboarding
|
|
47
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { TIPS_LENGTH as l } from "../constants/tips.js";
|
|
3
|
+
const o = ({ step: i }) => /* @__PURE__ */ r("div", { className: "bullets-container", children: [
|
|
4
|
+
/* @__PURE__ */ t(e, { isActive: i === 1 }),
|
|
5
|
+
/* @__PURE__ */ t(e, { isActive: i > 1 && i < l }),
|
|
6
|
+
/* @__PURE__ */ t(e, { isActive: i === l })
|
|
7
|
+
] }), e = ({ isActive: i }) => /* @__PURE__ */ t("div", { className: `bullet ${i ? "active" : ""}` });
|
|
8
|
+
export {
|
|
9
|
+
o as Bullets
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SocialMediaLinks } from './SocialMedia';
|
|
2
|
+
|
|
3
|
+
interface ContentProps {
|
|
4
|
+
step: number;
|
|
5
|
+
socialMediaLinks?: SocialMediaLinks;
|
|
6
|
+
sendEvent: (clickText: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const Content: ({ step, socialMediaLinks, sendEvent }: ContentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { SocialMedia as o } from "./SocialMedia.js";
|
|
3
|
+
import { TIPS as c, TIPS_LENGTH as r } from "../constants/tips.js";
|
|
4
|
+
const p = ({
|
|
5
|
+
step: i,
|
|
6
|
+
socialMediaLinks: t,
|
|
7
|
+
sendEvent: a
|
|
8
|
+
}) => {
|
|
9
|
+
const s = c[i - 1];
|
|
10
|
+
return s ? /* @__PURE__ */ n("div", { className: "onboarding-content-container", children: [
|
|
11
|
+
/* @__PURE__ */ e("div", { className: "svg-container", children: s.svg() }),
|
|
12
|
+
s.isIllustration && /* @__PURE__ */ e("p", { className: "illustration-message", children: "Imagem Ilustrativa" }),
|
|
13
|
+
/* @__PURE__ */ n("p", { className: "steps-count", children: [
|
|
14
|
+
i,
|
|
15
|
+
" de ",
|
|
16
|
+
r
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ e("p", { className: "tip-message", children: s.tip }),
|
|
19
|
+
i === r && /* @__PURE__ */ e(
|
|
20
|
+
o,
|
|
21
|
+
{
|
|
22
|
+
socialMediaLinks: t,
|
|
23
|
+
sendEvent: a
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
] }) : null;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
p as Content
|
|
30
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
interface FooterProps {
|
|
4
|
+
step: number;
|
|
5
|
+
handleBackStep: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
handleNextStep: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const Footer: ({ step, handleBackStep, handleNextStep }: FooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Bullets as i } from "./Bullets.js";
|
|
3
|
+
import { TIPS_LENGTH as l } from "../constants/tips.js";
|
|
4
|
+
const a = ({
|
|
5
|
+
step: t,
|
|
6
|
+
handleBackStep: r,
|
|
7
|
+
handleNextStep: n
|
|
8
|
+
}) => /* @__PURE__ */ e("footer", { children: [
|
|
9
|
+
/* @__PURE__ */ o("button", { onClick: r, className: "back-button", children: "Voltar" }),
|
|
10
|
+
/* @__PURE__ */ o(i, { step: t }),
|
|
11
|
+
/* @__PURE__ */ o("button", { onClick: n, className: "confirm-button", children: t === l ? "Legal, Entendi" : "Próximo" })
|
|
12
|
+
] });
|
|
13
|
+
export {
|
|
14
|
+
a as Footer
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs as r, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { CloseIcon as l } from "../../../assets/svgs/CloseIcon.js";
|
|
3
|
+
const i = ({ sendEvent: e, handleCloseAction: n }) => /* @__PURE__ */ r("header", { children: [
|
|
4
|
+
/* @__PURE__ */ o("h2", { children: "Experiência Personalizada" }),
|
|
5
|
+
/* @__PURE__ */ o("button", { onClick: () => {
|
|
6
|
+
e("Fechou o modal no X"), n();
|
|
7
|
+
}, children: /* @__PURE__ */ o(l, {}) })
|
|
8
|
+
] });
|
|
9
|
+
export {
|
|
10
|
+
i as Header
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface SocialMediaProps {
|
|
2
|
+
socialMediaLinks?: SocialMediaLinks;
|
|
3
|
+
sendEvent: (clickText: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface SocialMediaLinks {
|
|
6
|
+
facebook?: string;
|
|
7
|
+
instagram?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SocialMedia: ({ socialMediaLinks, sendEvent }: SocialMediaProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { FacebookIcon as t } from "../../../assets/svgs/FacebookIcon.js";
|
|
3
|
+
import { InstagramIcon as i } from "../../../assets/svgs/InstagramIcon.js";
|
|
4
|
+
const s = ({
|
|
5
|
+
socialMediaLinks: o,
|
|
6
|
+
sendEvent: e
|
|
7
|
+
}) => {
|
|
8
|
+
if (!o)
|
|
9
|
+
return null;
|
|
10
|
+
const { facebook: n, instagram: a } = o;
|
|
11
|
+
return /* @__PURE__ */ c("div", { className: "social-media-container", children: [
|
|
12
|
+
n && /* @__PURE__ */ r(
|
|
13
|
+
"a",
|
|
14
|
+
{
|
|
15
|
+
href: n,
|
|
16
|
+
target: "_blank",
|
|
17
|
+
rel: "noopener noreferrer",
|
|
18
|
+
onClick: () => e("facebook"),
|
|
19
|
+
children: /* @__PURE__ */ r(t, {})
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
a && /* @__PURE__ */ r(
|
|
23
|
+
"a",
|
|
24
|
+
{
|
|
25
|
+
href: a,
|
|
26
|
+
target: "_blank",
|
|
27
|
+
rel: "noopener noreferrer",
|
|
28
|
+
onClick: () => e("instagram"),
|
|
29
|
+
children: /* @__PURE__ */ r(i, {})
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
s as SocialMedia
|
|
36
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FixedLengthArray } from '../../../types/FixedLengthArray';
|
|
2
|
+
|
|
3
|
+
type Tips = FixedLengthArray<Tip, typeof TIPS_LENGTH>;
|
|
4
|
+
interface Tip {
|
|
5
|
+
svg: () => React.ReactNode;
|
|
6
|
+
isIllustration: boolean;
|
|
7
|
+
tip: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TIPS_LENGTH = 5;
|
|
10
|
+
export declare const TIPS: Tips;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Tip1 as o } from "../tips/Tip1.js";
|
|
2
|
+
import { Tip2 as e } from "../tips/Tip2.js";
|
|
3
|
+
import { Tip3 as i } from "../tips/Tip3.js";
|
|
4
|
+
import { Tip4 as a } from "../tips/Tip4.js";
|
|
5
|
+
import { Tip5 as s } from "../tips/Tip5.js";
|
|
6
|
+
const p = 5, u = [
|
|
7
|
+
{
|
|
8
|
+
svg: o,
|
|
9
|
+
isIllustration: !1,
|
|
10
|
+
tip: "O site e aplicativo vai ficando com a sua cara conforme você vai comprando, assim você tem uma experiência de acordo com seu padrão de compra"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
svg: e,
|
|
14
|
+
isIllustration: !0,
|
|
15
|
+
tip: "Veja produtos que você comprou anteriormente e adicione eles ao seu carrinho, fazendo suas compras com mais rapidez"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
svg: i,
|
|
19
|
+
isIllustration: !0,
|
|
20
|
+
tip: "Você também consegue consegue repetir um pedido adicionando ele inteiro ao seu carrinho, onde você pode aumentar ou diminuir a quantidade dos produtos"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
svg: a,
|
|
24
|
+
isIllustration: !0,
|
|
25
|
+
tip: "Você terá acesso aos corredores que você mais compra logo na tela inicial, assim você consegue conferir melhor a variedade dos produtos que você mais leva"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
svg: s,
|
|
29
|
+
isIllustration: !1,
|
|
30
|
+
tip: "Siga nossas redes sociais! Estamos sempre melhorando sua experiencia em nossas Lojas, Site e Aplicativo!"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
export {
|
|
34
|
+
u as TIPS,
|
|
35
|
+
p as TIPS_LENGTH
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { render as s } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Bullets as o } from "../components/Bullets.js";
|
|
5
|
+
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
+
describe("Bullets component tests", () => {
|
|
7
|
+
it("renders correctly amount of bullets", () => {
|
|
8
|
+
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelectorAll(".bullet");
|
|
9
|
+
expect(e.length).toBe(3);
|
|
10
|
+
}), it("should first bullet active if step is 1", () => {
|
|
11
|
+
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelector(".bullet");
|
|
12
|
+
expect(e).toHaveClass("active");
|
|
13
|
+
}), it("should middle bullet active if step is greater than 1 and less than TIPS_LENGTH", () => {
|
|
14
|
+
const { container: t } = s(/* @__PURE__ */ l(o, { step: 2 })), e = t.querySelector(".bullet:nth-child(2)");
|
|
15
|
+
expect(e).toHaveClass("active");
|
|
16
|
+
}), it("should last bullet active if step is equal than TIPS_LENGTH", () => {
|
|
17
|
+
const { container: t } = s(/* @__PURE__ */ l(o, { step: 3 })), e = t.querySelector(".bullet:last-child");
|
|
18
|
+
expect(e).toHaveClass("active");
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { render as s } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Content as o } from "../components/Content.js";
|
|
5
|
+
jest.mock("../components/SocialMedia", () => ({
|
|
6
|
+
SocialMedia: () => /* @__PURE__ */ e("div", { "data-testid": "social media" })
|
|
7
|
+
}));
|
|
8
|
+
jest.mock("../constants/tips", () => ({
|
|
9
|
+
TIPS_LENGTH: 2,
|
|
10
|
+
TIPS: [
|
|
11
|
+
{
|
|
12
|
+
tip: "tip 1",
|
|
13
|
+
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 1" }),
|
|
14
|
+
isIllustration: !1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
tip: "tip 2",
|
|
18
|
+
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 2" }),
|
|
19
|
+
isIllustration: !0
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}));
|
|
23
|
+
const n = jest.fn();
|
|
24
|
+
describe("Content component tests", () => {
|
|
25
|
+
it("should render nothing if step is invalid", () => {
|
|
26
|
+
const { container: t } = s(/* @__PURE__ */ e(o, { step: 0, sendEvent: n }));
|
|
27
|
+
expect(t.firstChild).toBeNull();
|
|
28
|
+
}), it("should render correctly texts", () => {
|
|
29
|
+
const { getByTestId: t, getByText: i } = s(
|
|
30
|
+
/* @__PURE__ */ e(o, { step: 1, sendEvent: n })
|
|
31
|
+
);
|
|
32
|
+
expect(t("svg 1")).toBeInTheDocument(), expect(i("1 de 2")).toBeInTheDocument(), expect(i("tip 1")).toBeInTheDocument();
|
|
33
|
+
}), it("should render correctly illustration message", () => {
|
|
34
|
+
const { getByText: t } = s(/* @__PURE__ */ e(o, { step: 2, sendEvent: n }));
|
|
35
|
+
expect(t("Imagem Ilustrativa")).toBeInTheDocument();
|
|
36
|
+
}), it("should render correctly social media section", () => {
|
|
37
|
+
const { getByTestId: t } = s(
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
|
+
o,
|
|
40
|
+
{
|
|
41
|
+
step: 2,
|
|
42
|
+
socialMediaLinks: {
|
|
43
|
+
facebook: "facebook_link",
|
|
44
|
+
instagram: "instagram_link"
|
|
45
|
+
},
|
|
46
|
+
sendEvent: n
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
expect(t("social media")).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { render as c, fireEvent as a } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Footer as l } from "../components/Footer.js";
|
|
5
|
+
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
+
jest.mock("../components/Bullets", () => ({
|
|
7
|
+
Bullets: () => /* @__PURE__ */ n("div", { "data-testid": "bullets" })
|
|
8
|
+
}));
|
|
9
|
+
const t = jest.fn(), o = jest.fn();
|
|
10
|
+
describe("Footer component tests", () => {
|
|
11
|
+
it("renders default UI", () => {
|
|
12
|
+
const { getByText: e } = c(
|
|
13
|
+
/* @__PURE__ */ n(
|
|
14
|
+
l,
|
|
15
|
+
{
|
|
16
|
+
step: 1,
|
|
17
|
+
handleBackStep: t,
|
|
18
|
+
handleNextStep: o
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
expect(e("Voltar")).toBeInTheDocument(), expect(e("Próximo")).toBeInTheDocument();
|
|
23
|
+
}), it("renders correctly button text if step is equal than TIPS_LENGTH", () => {
|
|
24
|
+
const { queryByText: e, getByText: s } = c(
|
|
25
|
+
/* @__PURE__ */ n(
|
|
26
|
+
l,
|
|
27
|
+
{
|
|
28
|
+
step: 3,
|
|
29
|
+
handleBackStep: t,
|
|
30
|
+
handleNextStep: o
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
expect(e("Próximo")).not.toBeInTheDocument(), expect(s("Legal, Entendi")).toBeInTheDocument();
|
|
35
|
+
}), it("should call handleBackStep on click back button", () => {
|
|
36
|
+
const { getByText: e } = c(
|
|
37
|
+
/* @__PURE__ */ n(
|
|
38
|
+
l,
|
|
39
|
+
{
|
|
40
|
+
step: 1,
|
|
41
|
+
handleBackStep: t,
|
|
42
|
+
handleNextStep: o
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
a.click(e("Voltar")), expect(t).toHaveBeenCalled();
|
|
47
|
+
}), it("should call handleNextStep on click confirm button", () => {
|
|
48
|
+
const { getByText: e } = c(
|
|
49
|
+
/* @__PURE__ */ n(
|
|
50
|
+
l,
|
|
51
|
+
{
|
|
52
|
+
step: 1,
|
|
53
|
+
handleBackStep: t,
|
|
54
|
+
handleNextStep: o
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
a.click(e("Próximo")), expect(o).toHaveBeenCalled();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { render as c, fireEvent as d } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Header as s } from "../components/Header.js";
|
|
5
|
+
const t = jest.fn(), n = jest.fn();
|
|
6
|
+
describe("Header component tests", () => {
|
|
7
|
+
it("renders correctly UI", () => {
|
|
8
|
+
const { getByText: e, getByTestId: l } = c(
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
s,
|
|
11
|
+
{
|
|
12
|
+
sendEvent: t,
|
|
13
|
+
handleCloseAction: n
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
expect(e("Experiência Personalizada")).toBeInTheDocument(), expect(l("close-icon")).toBeInTheDocument();
|
|
18
|
+
}), it("should call sendEvent and handleCloseAction on click close button", () => {
|
|
19
|
+
const { getByTestId: e } = c(
|
|
20
|
+
/* @__PURE__ */ o(
|
|
21
|
+
s,
|
|
22
|
+
{
|
|
23
|
+
sendEvent: t,
|
|
24
|
+
handleCloseAction: n
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
d.click(e("close-icon")), expect(t).toHaveBeenCalled(), expect(n).toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { render as o } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Onboarding as n } from "../Onboarding.js";
|
|
5
|
+
jest.mock("../components/Header", () => ({
|
|
6
|
+
Header: () => /* @__PURE__ */ e("div", { "data-testid": "header" })
|
|
7
|
+
}));
|
|
8
|
+
jest.mock("../components/Content", () => ({
|
|
9
|
+
Content: () => /* @__PURE__ */ e("div", { "data-testid": "content" })
|
|
10
|
+
}));
|
|
11
|
+
jest.mock("../components/Footer", () => ({
|
|
12
|
+
Footer: () => /* @__PURE__ */ e("div", { "data-testid": "footer" })
|
|
13
|
+
}));
|
|
14
|
+
const c = jest.fn();
|
|
15
|
+
describe("Onboarding package tests", () => {
|
|
16
|
+
it("should render sections correctly", () => {
|
|
17
|
+
const { getByTestId: t } = o(
|
|
18
|
+
/* @__PURE__ */ e(n, { handleCloseAction: c })
|
|
19
|
+
);
|
|
20
|
+
expect(t("header")).toBeInTheDocument(), expect(t("content")).toBeInTheDocument(), expect(t("footer")).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { render as n, fireEvent as c } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { SocialMedia as t } from "../components/SocialMedia.js";
|
|
5
|
+
const o = jest.fn();
|
|
6
|
+
describe("SocialMedia component tests", () => {
|
|
7
|
+
it("should render nothing if socialMediaLinks does not exist", () => {
|
|
8
|
+
const { container: e } = n(/* @__PURE__ */ i(t, { sendEvent: o }));
|
|
9
|
+
expect(e.firstChild).toBeNull();
|
|
10
|
+
}), it("should render media section if link exist", () => {
|
|
11
|
+
const { getByTestId: e } = n(
|
|
12
|
+
/* @__PURE__ */ i(
|
|
13
|
+
t,
|
|
14
|
+
{
|
|
15
|
+
socialMediaLinks: {
|
|
16
|
+
facebook: "facebook_link",
|
|
17
|
+
instagram: "instagram_link"
|
|
18
|
+
},
|
|
19
|
+
sendEvent: o
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
expect(e("facebook-icon")).toBeInTheDocument(), expect(e("instagram-icon")).toBeInTheDocument();
|
|
24
|
+
}), it("should call sendEvent on click social media link", () => {
|
|
25
|
+
const { getByTestId: e } = n(
|
|
26
|
+
/* @__PURE__ */ i(
|
|
27
|
+
t,
|
|
28
|
+
{
|
|
29
|
+
socialMediaLinks: {
|
|
30
|
+
facebook: "facebook_link",
|
|
31
|
+
instagram: "instagram_link"
|
|
32
|
+
},
|
|
33
|
+
sendEvent: o
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
c.click(e("facebook-icon")), expect(o).toHaveBeenCalledWith("facebook");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Tip1: () => import("react/jsx-runtime").JSX.Element;
|