@agrada_digital/pbm 0.0.84 → 0.0.86
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +264 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +276 -178
- package/dist/index.mjs.map +1 -1
- package/dist-wc/pbm-wc.js +226 -135
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { createStore } from "zustand";
|
|
|
3
3
|
import { useStore } from "zustand/react";
|
|
4
4
|
var initialPBMState = {
|
|
5
5
|
securityNumber: "",
|
|
6
|
+
cardID: "",
|
|
6
7
|
state: "isEmpty",
|
|
7
8
|
availableDiscountSelected: {
|
|
8
9
|
quantity: 0,
|
|
@@ -27,7 +28,8 @@ var createPBMStore = (set) => ({
|
|
|
27
28
|
setUrlAcceptTerms: (urlAcceptTerms) => set({ urlAcceptTerms }),
|
|
28
29
|
setUrlRegisterIndustry: (urlRegisterIndustry) => set({ urlRegisterIndustry }),
|
|
29
30
|
setIsAuthenticatedShopper: (isAuthenticatedShopper) => set({ isAuthenticatedShopper }),
|
|
30
|
-
setCustomLoginUrl: (customLoginUrl) => set({ customLoginUrl })
|
|
31
|
+
setCustomLoginUrl: (customLoginUrl) => set({ customLoginUrl }),
|
|
32
|
+
setCardID: (cardID) => set({ cardID })
|
|
31
33
|
});
|
|
32
34
|
var pbmStore = createStore(createPBMStore);
|
|
33
35
|
function usePBMStore(selector) {
|
|
@@ -38,39 +40,26 @@ function usePBMStore(selector) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// src/components/Header/index.tsx
|
|
41
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
43
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
42
44
|
function Header({ originalProductPrice }) {
|
|
43
|
-
const { targetProduct } = usePBMStore();
|
|
45
|
+
const { targetProduct, state } = usePBMStore();
|
|
44
46
|
const Price = targetProduct?.listPrice || originalProductPrice;
|
|
45
47
|
const Discount = Price * ((targetProduct?.discountMax || 0) / 100);
|
|
46
|
-
return /* @__PURE__ */ jsxs(
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"% OFF"
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ jsxs("svg", { width: "36px", height: "36px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
64
|
-
/* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
|
|
65
|
-
/* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
66
|
-
/* @__PURE__ */ jsxs("g", { id: "SVGRepo_iconCarrier", children: [
|
|
67
|
-
/* @__PURE__ */ jsx("path", { d: "M10 8.99998C10.5523 8.99998 11 9.44769 11 9.99998C11 10.5523 10.5523 11 10 11C9.44775 11 9.00004 10.5523 9.00004 9.99998C9.00004 9.44769 9.44775 8.99998 10 8.99998Z", fill: "#fff" }),
|
|
68
|
-
/* @__PURE__ */ jsx("path", { d: "M13 14C13 14.5523 13.4478 15 14 15C14.5523 15 15 14.5523 15 14C15 13.4477 14.5523 13 14 13C13.4478 13 13 13.4477 13 14Z", fill: "#fff" }),
|
|
69
|
-
/* @__PURE__ */ jsx("path", { d: "M10.7071 14.7071L14.7071 10.7071C15.0977 10.3166 15.0977 9.6834 14.7071 9.29287C14.3166 8.90235 13.6835 8.90235 13.2929 9.29287L9.29293 13.2929C8.90241 13.6834 8.90241 14.3166 9.29293 14.7071C9.68346 15.0976 10.3166 15.0976 10.7071 14.7071Z", fill: "#fff" }),
|
|
70
|
-
/* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.3117 4.07145L15.1708 4.34503L14.5575 3.34485C13.3869 1.43575 10.6131 1.43575 9.44254 3.34485L8.82926 4.34503L7.68836 4.07145C5.51069 3.54925 3.54931 5.51063 4.07151 7.6883L4.34509 8.8292L3.34491 9.44248C1.43581 10.6131 1.43581 13.3869 3.34491 14.5575L4.34509 15.1708L4.07151 16.3117C3.54931 18.4893 5.51069 20.4507 7.68836 19.9285L8.82926 19.6549L9.44254 20.6551C10.6131 22.5642 13.3869 22.5642 14.5575 20.6551L15.1708 19.6549L16.3117 19.9285C18.4894 20.4507 20.4508 18.4893 19.9286 16.3117L19.655 15.1708L20.6552 14.5575C22.5643 13.3869 22.5643 10.6131 20.6552 9.44248L19.655 8.8292L19.9286 7.6883C20.4508 5.51063 18.4894 3.54925 16.3117 4.07145ZM11.1475 4.3903C11.5377 3.75393 12.4623 3.75393 12.8525 4.3903L13.8454 6.00951C14.0717 6.37867 14.51 6.56019 14.9311 6.45922L16.7781 6.01631C17.504 5.84225 18.1578 6.49604 17.9837 7.22193L17.5408 9.06894C17.4398 9.49003 17.6213 9.92827 17.9905 10.1546L19.6097 11.1475C20.2461 11.5377 20.2461 12.4623 19.6097 12.8525L17.9905 13.8453C17.6213 14.0717 17.4398 14.5099 17.5408 14.931L17.9837 16.778C18.1578 17.5039 17.504 18.1577 16.7781 17.9836L14.9311 17.5407C14.51 17.4398 14.0717 17.6213 13.8454 17.9904L12.8525 19.6097C12.4623 20.246 11.5377 20.246 11.1475 19.6097L10.1547 17.9904C9.92833 17.6213 9.49009 17.4398 9.069 17.5407L7.22199 17.9836C6.4961 18.1577 5.84231 17.5039 6.01637 16.778L6.45928 14.931C6.56026 14.5099 6.37873 14.0717 6.00957 13.8453L4.39036 12.8525C3.75399 12.4623 3.75399 11.5377 4.39036 11.1475L6.00957 10.1546C6.37873 9.92827 6.56026 9.49003 6.45928 9.06894L6.01637 7.22193C5.84231 6.49604 6.4961 5.84225 7.22199 6.01631L9.069 6.45922C9.49009 6.56019 9.92833 6.37867 10.1547 6.00951L11.1475 4.3903Z", fill: "#fff" })
|
|
71
|
-
] })
|
|
72
|
-
] }),
|
|
73
|
-
/* @__PURE__ */ jsxs("section", { className: "flex flex-col items-start justify-center-safe gap-0", children: [
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
targetProduct?.informativeMessage && /* @__PURE__ */ jsx("span", { className: "absolute w-11/12 -top-6 bg-emerald-500 px-4 py-1 rounded-lg text-sm text-center font-medium text-white", children: targetProduct?.informativeMessage }),
|
|
50
|
+
/* @__PURE__ */ jsxs(
|
|
51
|
+
"header",
|
|
52
|
+
{
|
|
53
|
+
className: "flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5",
|
|
54
|
+
id: "header_pbm",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: "py-1 px-6 rounded-xl bg-[#44c2c0] shrink-0 text-white text-xl font-bold flex items-center justify-start gap-2 relative",
|
|
60
|
+
"data-testid": "test_id_header_price",
|
|
61
|
+
id: "header_price",
|
|
62
|
+
children: /* @__PURE__ */ jsxs("section", { className: "flex items-center gap-2 justify-center-safe", children: [
|
|
74
63
|
/* @__PURE__ */ jsx("span", { className: "line-through text-sm font-light", children: Number(Price)?.toLocaleString("pt-BR", {
|
|
75
64
|
currency: "BRL",
|
|
76
65
|
currencyDisplay: "symbol",
|
|
@@ -84,13 +73,13 @@ function Header({ originalProductPrice }) {
|
|
|
84
73
|
style: "currency"
|
|
85
74
|
})
|
|
86
75
|
] })
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx("h1", { id: "header_title", className: "text-center w-full text-[#339c9b] font-bold text-xs px-4 md:text-sm", children: "Desconto de Laborat\xF3rio" })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
94
83
|
}
|
|
95
84
|
var Header_default = Header;
|
|
96
85
|
|
|
@@ -121,27 +110,24 @@ var Container_default = Container;
|
|
|
121
110
|
import classNames2 from "classnames";
|
|
122
111
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
123
112
|
function Footer() {
|
|
124
|
-
const { targetProduct,
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
] })
|
|
144
|
-
] });
|
|
113
|
+
const { targetProduct, state } = usePBMStore();
|
|
114
|
+
return /* @__PURE__ */ jsx3("footer", { className: "w-full h-auto relative", id: "footer_pbm", children: /* @__PURE__ */ jsxs2("section", { className: classNames2("flex items-center w-full h-auto gap-4", { "justify-center": targetProduct?.industryLogo, "justify-start": !targetProduct?.industryLogo }), children: [
|
|
115
|
+
/* @__PURE__ */ jsxs2("section", { className: "w-4/5 h-auto", children: [
|
|
116
|
+
/* @__PURE__ */ jsx3("h3", { className: "text-start font-semibold text-sm", children: "Economize com o benef\xEDcio do laborat\xF3rio." }),
|
|
117
|
+
/* @__PURE__ */ jsx3("p", { className: "text-start font-normal text-sm", children: "Este produto tem pre\xE7o exclusivo para clientes cadastrados no programa." })
|
|
118
|
+
] }),
|
|
119
|
+
targetProduct?.industryLogo && /* @__PURE__ */ jsx3(
|
|
120
|
+
"img",
|
|
121
|
+
{
|
|
122
|
+
src: targetProduct.industryLogo,
|
|
123
|
+
alt: "parceiro",
|
|
124
|
+
className: "w-1/5 min-w-20 h-auto aspect-auto rounded-xl",
|
|
125
|
+
loading: "eager",
|
|
126
|
+
id: "footer_industry_logo_pbm",
|
|
127
|
+
"data-testid": "footer_industry_logo_pbm"
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }) });
|
|
145
131
|
}
|
|
146
132
|
var Footer_default = Footer;
|
|
147
133
|
|
|
@@ -220,10 +206,10 @@ function Button(props) {
|
|
|
220
206
|
var Button_default = Button;
|
|
221
207
|
|
|
222
208
|
// src/components/Form/index.tsx
|
|
223
|
-
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
209
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
224
210
|
function Form({ setLoading }) {
|
|
225
|
-
const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();
|
|
226
|
-
const [
|
|
211
|
+
const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry, setCardID } = usePBMStore();
|
|
212
|
+
const [showCardIDField, setShowCardIDField] = useState(false);
|
|
227
213
|
const {
|
|
228
214
|
handleSubmit,
|
|
229
215
|
register,
|
|
@@ -240,9 +226,12 @@ function Form({ setLoading }) {
|
|
|
240
226
|
}
|
|
241
227
|
});
|
|
242
228
|
const onSubmitDefault = async (values) => {
|
|
243
|
-
if (!
|
|
229
|
+
if (!showCardIDField) {
|
|
244
230
|
setValue("coupon", void 0, { shouldValidate: false });
|
|
245
231
|
}
|
|
232
|
+
if (showCardIDField && values.coupon != void 0) {
|
|
233
|
+
setCardID(values.coupon);
|
|
234
|
+
}
|
|
246
235
|
setLoading(true);
|
|
247
236
|
try {
|
|
248
237
|
if (targetProduct === null) {
|
|
@@ -291,14 +280,14 @@ function Form({ setLoading }) {
|
|
|
291
280
|
}
|
|
292
281
|
;
|
|
293
282
|
};
|
|
294
|
-
return /* @__PURE__ */ jsxs3(
|
|
283
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
295
284
|
/* @__PURE__ */ jsxs3(
|
|
296
285
|
"form",
|
|
297
286
|
{
|
|
298
287
|
onSubmit: handleSubmit(onSubmitDefault),
|
|
299
288
|
className: classNames4(
|
|
300
289
|
"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",
|
|
301
|
-
{ "mb-4": errors.securityNumber || errors.coupon &&
|
|
290
|
+
{ "mb-4": errors.securityNumber || errors.coupon && showCardIDField, "gap-2": showCardIDField }
|
|
302
291
|
),
|
|
303
292
|
id: "form_security_number_pbm",
|
|
304
293
|
children: [
|
|
@@ -315,7 +304,7 @@ function Form({ setLoading }) {
|
|
|
315
304
|
type: "text",
|
|
316
305
|
className: classNames4(
|
|
317
306
|
"w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:outline-[#339c9b] focus:bg-white text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",
|
|
318
|
-
{ "outline outline-red-600": errors.securityNumber, "rounded-lg":
|
|
307
|
+
{ "outline outline-red-600": errors.securityNumber, "rounded-lg": showCardIDField }
|
|
319
308
|
),
|
|
320
309
|
placeholder: "Digite seu CPF aqui...",
|
|
321
310
|
required: true,
|
|
@@ -336,7 +325,7 @@ function Form({ setLoading }) {
|
|
|
336
325
|
]
|
|
337
326
|
}
|
|
338
327
|
),
|
|
339
|
-
|
|
328
|
+
showCardIDField && /* @__PURE__ */ jsxs3(
|
|
340
329
|
"label",
|
|
341
330
|
{
|
|
342
331
|
htmlFor: "coupon",
|
|
@@ -349,15 +338,15 @@ function Form({ setLoading }) {
|
|
|
349
338
|
type: "text",
|
|
350
339
|
className: classNames4(
|
|
351
340
|
"w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:outline-[#339c9b] focus:bg-white text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",
|
|
352
|
-
{ "outline outline-red-600": errors.coupon, "rounded-lg":
|
|
341
|
+
{ "outline outline-red-600": errors.coupon, "rounded-lg": showCardIDField }
|
|
353
342
|
),
|
|
354
343
|
placeholder: "Cupom / ID do Cart\xE3o",
|
|
355
344
|
...register("coupon", {
|
|
356
|
-
required:
|
|
357
|
-
shouldUnregister: !
|
|
345
|
+
required: showCardIDField ? "Cupom / ID do Cart\xE3o obrigat\xF3rio." : false,
|
|
346
|
+
shouldUnregister: !showCardIDField,
|
|
358
347
|
onChange: (e) => {
|
|
359
348
|
setValue("coupon", e.target.value, {
|
|
360
|
-
shouldValidate:
|
|
349
|
+
shouldValidate: showCardIDField
|
|
361
350
|
});
|
|
362
351
|
}
|
|
363
352
|
}),
|
|
@@ -374,7 +363,7 @@ function Form({ setLoading }) {
|
|
|
374
363
|
type: "submit",
|
|
375
364
|
className: classNames4(
|
|
376
365
|
"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",
|
|
377
|
-
{ "rounded-lg":
|
|
366
|
+
{ "rounded-lg": showCardIDField }
|
|
378
367
|
),
|
|
379
368
|
id: "button_submit_security_number_pbm",
|
|
380
369
|
children: /* @__PURE__ */ jsx5(ArrowRight, { size: 24, color: "white", strokeWidth: 2 })
|
|
@@ -383,25 +372,39 @@ function Form({ setLoading }) {
|
|
|
383
372
|
]
|
|
384
373
|
}
|
|
385
374
|
),
|
|
386
|
-
/* @__PURE__ */ jsxs3(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
375
|
+
/* @__PURE__ */ jsxs3("section", { className: "flex items-center-safe justify-between", children: [
|
|
376
|
+
/* @__PURE__ */ jsxs3(
|
|
377
|
+
Button_default,
|
|
378
|
+
{
|
|
379
|
+
className: "bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 underline cursor-pointer hover:text-zinc-900 hover:bg-transparent flex items-center justify-start gap-1",
|
|
380
|
+
onClick: () => {
|
|
381
|
+
const newValue = !showCardIDField;
|
|
382
|
+
setShowCardIDField(newValue);
|
|
383
|
+
if (!newValue) {
|
|
384
|
+
unregister("coupon");
|
|
385
|
+
clearErrors("coupon");
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
id: "check_benefits_button",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ jsx5("span", { children: !showCardIDField ? "Possui Cupom / ID do Cart\xE3o?" : "N\xE3o possui Cupom / ID do Cart\xE3o??" }),
|
|
391
|
+
/* @__PURE__ */ jsx5(ArrowRight, { size: 16, className: classNames4({ "rotate-0": !showCardIDField, "rotate-180": showCardIDField }) })
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ jsxs3(
|
|
396
|
+
Button_default,
|
|
397
|
+
{
|
|
398
|
+
className: "bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 underline cursor-pointer hover:text-zinc-900 hover:bg-transparent flex items-center justify-start gap-1",
|
|
399
|
+
onClick: () => setState("isPreview"),
|
|
400
|
+
id: "check_benefits_button",
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ jsx5("span", { children: "Consultar Benef\xEDcios sem CPF" }),
|
|
403
|
+
/* @__PURE__ */ jsx5(ArrowRight, { size: 16 })
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
)
|
|
407
|
+
] })
|
|
405
408
|
] });
|
|
406
409
|
}
|
|
407
410
|
var Form_default = Form;
|
|
@@ -432,7 +435,7 @@ function Loading({ textColor }) {
|
|
|
432
435
|
var Loading_default = Loading;
|
|
433
436
|
|
|
434
437
|
// src/components/BenefitsTable/index.tsx
|
|
435
|
-
import { useEffect as useEffect2, useState as
|
|
438
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
436
439
|
|
|
437
440
|
// src/components/UI/Title/index.tsx
|
|
438
441
|
import classNames5 from "classnames";
|
|
@@ -445,7 +448,7 @@ function Title(props) {
|
|
|
445
448
|
"text-start font-semibold text-sm text-zinc-900",
|
|
446
449
|
props.className
|
|
447
450
|
),
|
|
448
|
-
style: { color: props.textColor, fontSize: props.textSize },
|
|
451
|
+
style: { color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign },
|
|
449
452
|
"data-testid": "test_id_title",
|
|
450
453
|
id: "title_pbm",
|
|
451
454
|
children: props.children
|
|
@@ -454,13 +457,78 @@ function Title(props) {
|
|
|
454
457
|
}
|
|
455
458
|
var Title_default = Title;
|
|
456
459
|
|
|
460
|
+
// src/libs/zustand/useModal.tsx
|
|
461
|
+
import { create } from "zustand";
|
|
462
|
+
var initialModalState = {
|
|
463
|
+
modal: {
|
|
464
|
+
id: "",
|
|
465
|
+
open: false
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
var createModalStore = (set) => ({
|
|
469
|
+
...initialModalState,
|
|
470
|
+
setModal: (modal) => set({ modal })
|
|
471
|
+
});
|
|
472
|
+
var useModal = create(createModalStore);
|
|
473
|
+
|
|
457
474
|
// src/components/BenefitsTable/Item.tsx
|
|
458
|
-
import {
|
|
459
|
-
import { useCallback, useEffect } from "react";
|
|
475
|
+
import { useCallback, useEffect, useState as useState2 } from "react";
|
|
460
476
|
import classNames6 from "classnames";
|
|
477
|
+
|
|
478
|
+
// src/components/UI/Icons/index.tsx
|
|
461
479
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
480
|
+
function CheckON({ size }) {
|
|
481
|
+
return /* @__PURE__ */ jsx8(
|
|
482
|
+
"svg",
|
|
483
|
+
{
|
|
484
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
485
|
+
"data-name": "Camada 1",
|
|
486
|
+
viewBox: "0 0 500 500",
|
|
487
|
+
width: size,
|
|
488
|
+
height: size,
|
|
489
|
+
children: /* @__PURE__ */ jsx8(
|
|
490
|
+
"path",
|
|
491
|
+
{
|
|
492
|
+
d: "M421.44 78.56C375.64 32.77 314.76 7.55 250 7.55S124.36 32.77 78.56 78.56C32.77 124.36 7.55 185.24 7.55 250s25.22 125.64 71.01 171.44c45.8 45.79 106.68 71.01 171.44 71.01s125.64-25.22 171.44-71.01c45.79-45.8 71.01-106.68 71.01-171.44s-25.22-125.64-71.01-171.44zm-49.17 121.7L242.88 334.63c-8.98 9.29-23.57 10.17-33.59 2.02l-79.63-64.7c-10.69-8.67-12.33-24.38-3.66-35.07 8.67-10.69 24.38-12.33 35.07-3.65l61.9 50.39L336.5 165.74c4.4-4.75 10.48-7.59 16.95-7.93a24.88 24.88 0 0118.83 7.26c9.72 9.72 9.71 25.48 0 35.19z",
|
|
493
|
+
fill: "#229b00"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
function CheckOFF({ size }) {
|
|
500
|
+
return /* @__PURE__ */ jsxs5(
|
|
501
|
+
"svg",
|
|
502
|
+
{
|
|
503
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
504
|
+
"data-name": "Camada 1",
|
|
505
|
+
viewBox: "0 0 500 500",
|
|
506
|
+
width: size,
|
|
507
|
+
height: size,
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ jsx8("circle", { cx: 250, cy: 250, r: 237.45, fill: "#fff" }),
|
|
510
|
+
/* @__PURE__ */ jsx8(
|
|
511
|
+
"path",
|
|
512
|
+
{
|
|
513
|
+
d: "M250 492.45c-64.76 0-125.64-25.22-171.44-71.01C32.77 375.64 7.55 314.76 7.55 250S32.77 124.36 78.56 78.56C124.36 32.77 185.24 7.55 250 7.55s125.64 25.22 171.44 71.01c45.79 45.79 71.01 106.68 71.01 171.44s-25.22 125.64-71.01 171.44c-45.79 45.79-106.68 71.01-171.44 71.01zm0-474.9C121.83 17.55 17.55 121.83 17.55 250S121.83 482.45 250 482.45 482.45 378.17 482.45 250 378.17 17.55 250 17.55z",
|
|
514
|
+
fill: "#d8d8d8"
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
var Icons = {
|
|
522
|
+
CheckON,
|
|
523
|
+
CheckOFF
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
// src/components/BenefitsTable/Item.tsx
|
|
527
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
462
528
|
function Item({ data, onChange, checked }) {
|
|
463
529
|
const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();
|
|
530
|
+
const { setModal } = useModal();
|
|
531
|
+
const [openModalAlert, setOpenModalAlert] = useState2(false);
|
|
464
532
|
const ID_INPUT = "unity_quantity_" + data.authorizedQuantity;
|
|
465
533
|
const decimalDiscount = data.discountPercentual / 100;
|
|
466
534
|
const unitDiscountValue = data.grossPrice * decimalDiscount;
|
|
@@ -490,18 +558,25 @@ function Item({ data, onChange, checked }) {
|
|
|
490
558
|
useEffect(() => {
|
|
491
559
|
updateStorageData();
|
|
492
560
|
}, [updateStorageData]);
|
|
493
|
-
|
|
561
|
+
const CheckUserIsAuthenticated = () => {
|
|
562
|
+
if (isAuthenticatedShopper) return;
|
|
563
|
+
setModal({
|
|
564
|
+
id: "ShopperIsNotAuthenticated",
|
|
565
|
+
open: true
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
return /* @__PURE__ */ jsxs6(
|
|
494
569
|
"label",
|
|
495
570
|
{
|
|
496
571
|
htmlFor: ID_INPUT,
|
|
497
572
|
className: classNames6(
|
|
498
573
|
"label_benefits w-full flex items-center justify-start bg-zinc-300/60 border border-zinc-400/50 px-4 py-2 hover:bg-zinc-300 transition-colors rounded-lg gap-1",
|
|
499
|
-
{ "cursor-not-allowed": state === "isPreview"
|
|
574
|
+
{ "cursor-not-allowed": state === "isPreview", "cursor-pointer": state === "isActivated" }
|
|
500
575
|
),
|
|
501
576
|
id: "label_benefits_" + ID_INPUT,
|
|
502
|
-
|
|
577
|
+
onClick: CheckUserIsAuthenticated,
|
|
503
578
|
children: [
|
|
504
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ jsx9(
|
|
505
580
|
"input",
|
|
506
581
|
{
|
|
507
582
|
type: "radio",
|
|
@@ -510,16 +585,16 @@ function Item({ data, onChange, checked }) {
|
|
|
510
585
|
className: "hidden",
|
|
511
586
|
checked,
|
|
512
587
|
onChange,
|
|
513
|
-
disabled: state === "isPreview"
|
|
588
|
+
disabled: state === "isPreview"
|
|
514
589
|
}
|
|
515
590
|
),
|
|
516
|
-
!checked ? /* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
591
|
+
!checked ? /* @__PURE__ */ jsx9(Icons.CheckOFF, { size: 20 }) : /* @__PURE__ */ jsx9(Icons.CheckON, { size: 20 }),
|
|
592
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-zinc-900 font-semibold text-sm", children: [
|
|
518
593
|
data.authorizedQuantity,
|
|
519
594
|
"un"
|
|
520
595
|
] }),
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ jsxs6("section", { className: "ml-auto relative gap-2 flex items-center-safe justify-end-safe", children: [
|
|
597
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-white -top-4 py-0.5 font-semibold text-xs bg-[#32b316] px-2 w-auto text-nowrap rounded-2xl -right-3", children: [
|
|
523
598
|
discountValue.toLocaleString("pt-BR", {
|
|
524
599
|
currency: "BRL",
|
|
525
600
|
currencyDisplay: "symbol",
|
|
@@ -529,7 +604,7 @@ function Item({ data, onChange, checked }) {
|
|
|
529
604
|
" ",
|
|
530
605
|
"OFF"
|
|
531
606
|
] }),
|
|
532
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ jsx9("strong", { className: "text-zinc-900 font-semibold text-sm text-center", children: totalPriceProductWithDiscountBenefit.toLocaleString("pt-BR", {
|
|
533
608
|
currency: "BRL",
|
|
534
609
|
currencyDisplay: "symbol",
|
|
535
610
|
currencySign: "standard",
|
|
@@ -569,12 +644,12 @@ var CheckBenefistWithoutDocument = async ({ products }) => {
|
|
|
569
644
|
};
|
|
570
645
|
|
|
571
646
|
// src/components/BenefitsTable/index.tsx
|
|
572
|
-
import { Fragment as
|
|
647
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
573
648
|
function BenefitsTable() {
|
|
574
649
|
const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();
|
|
575
|
-
const [selectedDiscout, setSelectedDiscount] =
|
|
576
|
-
const [loading, setLoading] =
|
|
577
|
-
const [benefitsItems, setBenefitsItems] =
|
|
650
|
+
const [selectedDiscout, setSelectedDiscount] = useState3(null);
|
|
651
|
+
const [loading, setLoading] = useState3(true);
|
|
652
|
+
const [benefitsItems, setBenefitsItems] = useState3();
|
|
578
653
|
useEffect2(() => {
|
|
579
654
|
const fetchDicountsWithoutDocument = async () => {
|
|
580
655
|
if (!targetProduct?.productId) {
|
|
@@ -659,8 +734,8 @@ function BenefitsTable() {
|
|
|
659
734
|
state === "isActivated" ? fetchDiscountWithDocument() : fetchDicountsWithoutDocument();
|
|
660
735
|
}, []);
|
|
661
736
|
if (loading) {
|
|
662
|
-
return /* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
737
|
+
return /* @__PURE__ */ jsxs7("main", { className: "flex items-center justify-center gap-4", id: "loading_pbm", children: [
|
|
738
|
+
/* @__PURE__ */ jsx10(
|
|
664
739
|
"div",
|
|
665
740
|
{
|
|
666
741
|
"data-testid": "test_id_spin",
|
|
@@ -668,7 +743,7 @@ function BenefitsTable() {
|
|
|
668
743
|
id: "loading_spin"
|
|
669
744
|
}
|
|
670
745
|
),
|
|
671
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ jsx10(
|
|
672
747
|
"p",
|
|
673
748
|
{
|
|
674
749
|
className: "text-sm font-semibold text-start text-zinc-900",
|
|
@@ -678,23 +753,23 @@ function BenefitsTable() {
|
|
|
678
753
|
)
|
|
679
754
|
] });
|
|
680
755
|
}
|
|
681
|
-
return /* @__PURE__ */
|
|
756
|
+
return /* @__PURE__ */ jsxs7(
|
|
682
757
|
"section",
|
|
683
758
|
{
|
|
684
759
|
className: "flex items-start justify-center gap-4 w-full h-auto flex-col",
|
|
685
760
|
id: "benefits_table_pbm",
|
|
686
761
|
children: [
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ jsx10(Title_default, { children: "Descontos dispon\xEDveis:" }),
|
|
763
|
+
/* @__PURE__ */ jsxs7(
|
|
689
764
|
"form",
|
|
690
765
|
{
|
|
691
766
|
className: "flex flex-col items-center justify-start w-full gap-4.5",
|
|
692
767
|
id: "form_benefits_table_pbm",
|
|
693
768
|
children: [
|
|
694
|
-
!benefitsItems && /* @__PURE__ */
|
|
769
|
+
!benefitsItems && /* @__PURE__ */ jsx10("p", { className: "text-sm font-semibold text-start text-zinc-900", id: "benefits_empty_pbm", children: "N\xE3o foi poss\xEDvel encontrar benef\xEDcios para esse produto." }),
|
|
695
770
|
benefitsItems && benefitsItems.map((item, index) => {
|
|
696
771
|
const ID_INPUT = "unity_quantity_" + item.authorizedQuantity;
|
|
697
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ jsx10(
|
|
698
773
|
Item_default,
|
|
699
774
|
{
|
|
700
775
|
data: item,
|
|
@@ -703,12 +778,11 @@ function BenefitsTable() {
|
|
|
703
778
|
},
|
|
704
779
|
index
|
|
705
780
|
);
|
|
706
|
-
})
|
|
707
|
-
benefitsItems && /* @__PURE__ */ jsx9("p", { className: "w-full text-sm font-semibold text-center text-zinc-600", id: "benefits_empty_pbm", children: benefitsItems[0].informativeMessage })
|
|
781
|
+
})
|
|
708
782
|
]
|
|
709
783
|
}
|
|
710
784
|
),
|
|
711
|
-
state === "isPreview" && /* @__PURE__ */
|
|
785
|
+
state === "isPreview" && /* @__PURE__ */ jsxs7(
|
|
712
786
|
Button_default,
|
|
713
787
|
{
|
|
714
788
|
onClick: () => setState("isEmpty"),
|
|
@@ -717,27 +791,27 @@ function BenefitsTable() {
|
|
|
717
791
|
children: [
|
|
718
792
|
"Aten\xE7\xE3o: N\xE3o \xE9 poss\xEDvel utilizar os benef\xEDcos sem realizar a consulta do CPF e o Login, por favor",
|
|
719
793
|
" ",
|
|
720
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ jsx10("span", { className: "underline", children: "insira seu cpf para utilizar os benef\xEDcios" })
|
|
721
795
|
]
|
|
722
796
|
}
|
|
723
797
|
),
|
|
724
|
-
state === "isActivated" && /* @__PURE__ */
|
|
725
|
-
!isAuthenticatedShopper && /* @__PURE__ */
|
|
798
|
+
state === "isActivated" && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
799
|
+
!isAuthenticatedShopper && /* @__PURE__ */ jsx10(
|
|
726
800
|
Button_default,
|
|
727
801
|
{
|
|
728
802
|
onClick: () => window.location.href = customLoginUrl || "/login",
|
|
729
803
|
className: "bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",
|
|
730
804
|
id: "login",
|
|
731
|
-
children: /* @__PURE__ */
|
|
805
|
+
children: /* @__PURE__ */ jsx10("span", { className: "underline", children: "Por favor, fa\xE7a o Login para aproveitar os benef\xEDcios!" })
|
|
732
806
|
}
|
|
733
807
|
),
|
|
734
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ jsx10(
|
|
735
809
|
Button_default,
|
|
736
810
|
{
|
|
737
811
|
onClick: () => setState("isEmpty"),
|
|
738
812
|
className: "bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",
|
|
739
813
|
id: "change_security_number",
|
|
740
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ jsx10("span", { className: "underline", children: "Deseja editar o cpf digitado?" })
|
|
741
815
|
}
|
|
742
816
|
)
|
|
743
817
|
] })
|
|
@@ -749,9 +823,9 @@ var BenefitsTable_default = BenefitsTable;
|
|
|
749
823
|
|
|
750
824
|
// src/components/UI/Text/index.tsx
|
|
751
825
|
import classNames7 from "classnames";
|
|
752
|
-
import { jsx as
|
|
826
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
753
827
|
function Text(props) {
|
|
754
|
-
return /* @__PURE__ */
|
|
828
|
+
return /* @__PURE__ */ jsx11(
|
|
755
829
|
"p",
|
|
756
830
|
{
|
|
757
831
|
className: classNames7(
|
|
@@ -778,10 +852,10 @@ var getParams = (params) => {
|
|
|
778
852
|
};
|
|
779
853
|
|
|
780
854
|
// src/components/UI/Link/index.tsx
|
|
781
|
-
import { jsx as
|
|
855
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
782
856
|
function Link(props) {
|
|
783
857
|
const { setState } = usePBMStore();
|
|
784
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ jsx12(
|
|
785
859
|
"a",
|
|
786
860
|
{
|
|
787
861
|
...props,
|
|
@@ -801,23 +875,23 @@ function Link(props) {
|
|
|
801
875
|
var Link_default = Link;
|
|
802
876
|
|
|
803
877
|
// src/components/SecurityNumberInvalid/index.tsx
|
|
804
|
-
import { jsx as
|
|
878
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
805
879
|
function SecurityNumberInvalid({ textColor }) {
|
|
806
880
|
const { urlAcceptTerms } = usePBMStore();
|
|
807
|
-
return /* @__PURE__ */
|
|
881
|
+
return /* @__PURE__ */ jsxs8(
|
|
808
882
|
"section",
|
|
809
883
|
{
|
|
810
884
|
"data-testid": "test_id_invalid",
|
|
811
885
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
812
886
|
id: "security_number_invalid_container_pbm",
|
|
813
887
|
children: [
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ jsx13(Title_default, { className: "w-full", textColor, children: "CPF n\xE3o cadastrado." }),
|
|
889
|
+
/* @__PURE__ */ jsxs8(Text_default, { className: "w-full", textColor, children: [
|
|
816
890
|
"Conclua seu cadastro para habilitar o benef\xEDcio. ",
|
|
817
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ jsx13("br", {}),
|
|
818
892
|
"Ao clicar em \u201CAceitar os termos\u201D, voc\xEA ir\xE1 para uma p\xE1gina externa. Aceite os termos e volte para continuar."
|
|
819
893
|
] }),
|
|
820
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx13(
|
|
821
895
|
Link_default,
|
|
822
896
|
{
|
|
823
897
|
href: urlAcceptTerms || "",
|
|
@@ -831,22 +905,22 @@ function SecurityNumberInvalid({ textColor }) {
|
|
|
831
905
|
var SecurityNumberInvalid_default = SecurityNumberInvalid;
|
|
832
906
|
|
|
833
907
|
// src/PBM.tsx
|
|
834
|
-
import { useCallback as useCallback2, useEffect as useEffect3, useState as
|
|
908
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useState as useState4 } from "react";
|
|
835
909
|
|
|
836
910
|
// src/components/SecurityNumberRegitered/index.tsx
|
|
837
|
-
import { jsx as
|
|
911
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
838
912
|
function SecurityNumberRegitered({ textColor }) {
|
|
839
913
|
const { urlRegisterIndustry } = usePBMStore();
|
|
840
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ jsxs9(
|
|
841
915
|
"section",
|
|
842
916
|
{
|
|
843
917
|
"data-testid": "test_id_registered",
|
|
844
918
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
845
919
|
id: "security_number_registered_container_pbm",
|
|
846
920
|
children: [
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
921
|
+
/* @__PURE__ */ jsx14(Title_default, { className: "w-full", textColor, children: "Ops, seu CPF ainda n\xE3o est\xE1 habilitado para este produto." }),
|
|
922
|
+
/* @__PURE__ */ jsx14(Text_default, { className: "w-full", textColor, children: "Para ativar o benef\xEDcio, clique em \u201CAtivar CPF\u201D e conclua a etapa na p\xE1gina externa. Depois, \xE9 s\xF3 voltar para continuar \u2014 vamos aguardar voc\xEA aqui." }),
|
|
923
|
+
/* @__PURE__ */ jsx14(
|
|
850
924
|
Link_default,
|
|
851
925
|
{
|
|
852
926
|
href: urlRegisterIndustry || "",
|
|
@@ -891,7 +965,7 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
891
965
|
};
|
|
892
966
|
|
|
893
967
|
// src/PBM.tsx
|
|
894
|
-
import {
|
|
968
|
+
import { RefreshCw } from "lucide-react";
|
|
895
969
|
|
|
896
970
|
// src/services/get-product-by-ean.ts
|
|
897
971
|
import Cookies4 from "js-cookie";
|
|
@@ -916,7 +990,42 @@ var GetProductByEAN = async ({ PRODUCT_EAN }) => {
|
|
|
916
990
|
};
|
|
917
991
|
|
|
918
992
|
// src/PBM.tsx
|
|
919
|
-
import
|
|
993
|
+
import Skeleton from "@mui/material/Skeleton";
|
|
994
|
+
|
|
995
|
+
// src/components/Modal/index.tsx
|
|
996
|
+
import classNames9 from "classnames";
|
|
997
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
998
|
+
var Modal = ({ ID }) => {
|
|
999
|
+
const { customLoginUrl } = usePBMStore();
|
|
1000
|
+
const { modal, setModal } = useModal();
|
|
1001
|
+
return /* @__PURE__ */ jsxs10("main", { className: classNames9(
|
|
1002
|
+
"fixed inset-0 flex items-center justify-center z-50 flex-col transition-all shadow bg-black/40",
|
|
1003
|
+
{
|
|
1004
|
+
"opacity-100 pointer-events-auto": modal.id === ID && modal.open,
|
|
1005
|
+
"opacity-0 pointer-events-none": modal.id != ID || !modal.open
|
|
1006
|
+
}
|
|
1007
|
+
), children: [
|
|
1008
|
+
/* @__PURE__ */ jsx15("div", { className: "absolute inset-0", onClick: () => setModal({ id: "", open: false }) }),
|
|
1009
|
+
/* @__PURE__ */ jsxs10("section", { className: "z-10 bg-white gap-2 flex-col items-center-safe justify-center-safe p-8 rounded-xl", children: [
|
|
1010
|
+
/* @__PURE__ */ jsx15(Title_default, { textColor: "tomato", textSize: "18px", textAlign: "center", className: "mb-2", children: "Opa! Parece que voc\xEA n\xE3o est\xE1 Logado" }),
|
|
1011
|
+
/* @__PURE__ */ jsxs10(Text_default, { className: "mb-2", textAlign: "center", children: [
|
|
1012
|
+
"Para aproveitar os benef\xEDcios \xE9 necess\xE1rio realizar o ",
|
|
1013
|
+
/* @__PURE__ */ jsx15("strong", { children: "Login" }),
|
|
1014
|
+
" ou ",
|
|
1015
|
+
/* @__PURE__ */ jsx15("strong", { children: "Cadastro" }),
|
|
1016
|
+
" no site!"
|
|
1017
|
+
] }),
|
|
1018
|
+
/* @__PURE__ */ jsxs10("section", { className: "flex items-center-safe justify-center-safe gap-4", children: [
|
|
1019
|
+
/* @__PURE__ */ jsx15(Button_default, { className: "bg-gray-600 hover:bg-gray-500", onClick: () => setModal({ id: "", open: false }), children: "Seguir sem Benef\xEDcios" }),
|
|
1020
|
+
/* @__PURE__ */ jsx15(Link_default, { href: customLoginUrl || "/login", children: "Aproveitar Benef\xEDcios" })
|
|
1021
|
+
] })
|
|
1022
|
+
] })
|
|
1023
|
+
] });
|
|
1024
|
+
};
|
|
1025
|
+
var Modal_default = Modal;
|
|
1026
|
+
|
|
1027
|
+
// src/PBM.tsx
|
|
1028
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
920
1029
|
function PBM({
|
|
921
1030
|
originalProductPrice,
|
|
922
1031
|
clientID,
|
|
@@ -927,10 +1036,10 @@ function PBM({
|
|
|
927
1036
|
const formatedOriginalProductPrice = Number(
|
|
928
1037
|
String(originalProductPrice).replace(",", ".")
|
|
929
1038
|
);
|
|
930
|
-
const [isReady, setIsReady] =
|
|
931
|
-
const [loading, setLoading] =
|
|
1039
|
+
const [isReady, setIsReady] = useState4(false);
|
|
1040
|
+
const [loading, setLoading] = useState4(false);
|
|
932
1041
|
const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();
|
|
933
|
-
const [EanProductExist, setEanProductExist] =
|
|
1042
|
+
const [EanProductExist, setEanProductExist] = useState4(true);
|
|
934
1043
|
const fetchProductByEan = async () => {
|
|
935
1044
|
try {
|
|
936
1045
|
if (!eanProduct) {
|
|
@@ -976,55 +1085,44 @@ function PBM({
|
|
|
976
1085
|
handleAuthorizationRequest();
|
|
977
1086
|
}, [handleAuthorizationRequest]);
|
|
978
1087
|
if (!isReady) {
|
|
979
|
-
return /* @__PURE__ */
|
|
1088
|
+
return /* @__PURE__ */ jsx16(Skeleton, { variant: "rectangular", style: { borderRadius: "12px" }, width: 460, height: 358 });
|
|
980
1089
|
}
|
|
981
1090
|
if (!EanProductExist) {
|
|
982
|
-
return /* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx16("div", { id: "pbm-library-root", children: /* @__PURE__ */ jsxs11(Container_default, { variant: "main", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx16(Title_default, { children: "Erro ao Aplicar o Benef\xEDcio" }),
|
|
1093
|
+
/* @__PURE__ */ jsxs11(Text_default, { textAlign: "center", children: [
|
|
985
1094
|
"O produto n\xE3o foi encontrado no sistema. ",
|
|
986
|
-
/* @__PURE__ */
|
|
1095
|
+
/* @__PURE__ */ jsx16("br", {}),
|
|
987
1096
|
" Por favor, tente novamente mais tarde ou contate o suporte."
|
|
988
1097
|
] }),
|
|
989
|
-
/* @__PURE__ */
|
|
1098
|
+
/* @__PURE__ */ jsxs11(
|
|
990
1099
|
Button_default,
|
|
991
1100
|
{
|
|
992
1101
|
className: "bg-transparent p-0 pl-2 w-auto h-auto text-zinc-600 underline cursor-pointer hover:text-zinc-900 hover:bg-transparent flex items-center justify-start gap-1",
|
|
993
1102
|
onClick: () => window.location.reload(),
|
|
994
1103
|
id: "check_benefits_button",
|
|
995
1104
|
children: [
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
1105
|
+
/* @__PURE__ */ jsx16("span", { children: "Tentar novamente" }),
|
|
1106
|
+
/* @__PURE__ */ jsx16(RefreshCw, { size: 16 })
|
|
998
1107
|
]
|
|
999
1108
|
}
|
|
1000
1109
|
)
|
|
1001
1110
|
] }) });
|
|
1002
1111
|
}
|
|
1003
|
-
return /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
onClick: () => setState("isPreview"),
|
|
1013
|
-
id: "check_benefits_button",
|
|
1014
|
-
children: [
|
|
1015
|
-
/* @__PURE__ */ jsx14("span", { children: "Consultar benef\xEDcios" }),
|
|
1016
|
-
/* @__PURE__ */ jsx14(ArrowRight2, { size: 16 })
|
|
1017
|
-
]
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
1112
|
+
return /* @__PURE__ */ jsxs11("div", { id: "pbm-library-root", children: [
|
|
1113
|
+
/* @__PURE__ */ jsxs11(Container_default, { variant: "main", children: [
|
|
1114
|
+
/* @__PURE__ */ jsx16(Header_default, { originalProductPrice: formatedOriginalProductPrice || 0 }),
|
|
1115
|
+
/* @__PURE__ */ jsxs11(Container_default, { variant: "simple", children: [
|
|
1116
|
+
state === "isEmpty" && !loading && /* @__PURE__ */ jsx16(Form_default, { setLoading }),
|
|
1117
|
+
state === "isEmpty" && loading && /* @__PURE__ */ jsx16(Loading_default, {}),
|
|
1118
|
+
state === "isInvalid" && !loading && /* @__PURE__ */ jsx16(SecurityNumberInvalid_default, {}),
|
|
1119
|
+
state === "isRegistered" && !loading && /* @__PURE__ */ jsx16(SecurityNumberRegitered_default, {}),
|
|
1120
|
+
(state === "isActivated" || state === "isPreview") && !loading && /* @__PURE__ */ jsx16(BenefitsTable_default, {})
|
|
1020
1121
|
] }),
|
|
1021
|
-
|
|
1022
|
-
state === "isInvalid" && !loading && /* @__PURE__ */ jsx14(SecurityNumberInvalid_default, {}),
|
|
1023
|
-
state === "isRegistered" && !loading && /* @__PURE__ */ jsx14(SecurityNumberRegitered_default, {}),
|
|
1024
|
-
(state === "isActivated" || state === "isPreview") && !loading && /* @__PURE__ */ jsx14(BenefitsTable_default, {})
|
|
1122
|
+
/* @__PURE__ */ jsx16(Footer_default, {})
|
|
1025
1123
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
] })
|
|
1124
|
+
/* @__PURE__ */ jsx16(Modal_default, { ID: "ShopperIsNotAuthenticated" })
|
|
1125
|
+
] });
|
|
1028
1126
|
}
|
|
1029
1127
|
var PBM_default = PBM;
|
|
1030
1128
|
export {
|