@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.js
CHANGED
|
@@ -40,6 +40,7 @@ var import_zustand = require("zustand");
|
|
|
40
40
|
var import_react = require("zustand/react");
|
|
41
41
|
var initialPBMState = {
|
|
42
42
|
securityNumber: "",
|
|
43
|
+
cardID: "",
|
|
43
44
|
state: "isEmpty",
|
|
44
45
|
availableDiscountSelected: {
|
|
45
46
|
quantity: 0,
|
|
@@ -64,7 +65,8 @@ var createPBMStore = (set) => ({
|
|
|
64
65
|
setUrlAcceptTerms: (urlAcceptTerms) => set({ urlAcceptTerms }),
|
|
65
66
|
setUrlRegisterIndustry: (urlRegisterIndustry) => set({ urlRegisterIndustry }),
|
|
66
67
|
setIsAuthenticatedShopper: (isAuthenticatedShopper) => set({ isAuthenticatedShopper }),
|
|
67
|
-
setCustomLoginUrl: (customLoginUrl) => set({ customLoginUrl })
|
|
68
|
+
setCustomLoginUrl: (customLoginUrl) => set({ customLoginUrl }),
|
|
69
|
+
setCardID: (cardID) => set({ cardID })
|
|
68
70
|
});
|
|
69
71
|
var pbmStore = (0, import_zustand.createStore)(createPBMStore);
|
|
70
72
|
function usePBMStore(selector) {
|
|
@@ -77,37 +79,24 @@ function usePBMStore(selector) {
|
|
|
77
79
|
// src/components/Header/index.tsx
|
|
78
80
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
79
81
|
function Header({ originalProductPrice }) {
|
|
80
|
-
const { targetProduct } = usePBMStore();
|
|
82
|
+
const { targetProduct, state } = usePBMStore();
|
|
81
83
|
const Price = targetProduct?.listPrice || originalProductPrice;
|
|
82
84
|
const Discount = Price * ((targetProduct?.discountMax || 0) / 100);
|
|
83
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"% OFF"
|
|
99
|
-
] }),
|
|
100
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "36px", height: "36px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
|
|
102
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
103
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { id: "SVGRepo_iconCarrier", children: [
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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" }),
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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" }),
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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" }),
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
108
|
-
] })
|
|
109
|
-
] }),
|
|
110
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "flex flex-col items-start justify-center-safe gap-0", children: [
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
86
|
+
targetProduct?.informativeMessage && /* @__PURE__ */ (0, import_jsx_runtime.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 }),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
88
|
+
"header",
|
|
89
|
+
{
|
|
90
|
+
className: "flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5",
|
|
91
|
+
id: "header_pbm",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
"span",
|
|
95
|
+
{
|
|
96
|
+
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",
|
|
97
|
+
"data-testid": "test_id_header_price",
|
|
98
|
+
id: "header_price",
|
|
99
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "flex items-center gap-2 justify-center-safe", children: [
|
|
111
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "line-through text-sm font-light", children: Number(Price)?.toLocaleString("pt-BR", {
|
|
112
101
|
currency: "BRL",
|
|
113
102
|
currencyDisplay: "symbol",
|
|
@@ -121,13 +110,13 @@ function Header({ originalProductPrice }) {
|
|
|
121
110
|
style: "currency"
|
|
122
111
|
})
|
|
123
112
|
] })
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.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" })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] });
|
|
131
120
|
}
|
|
132
121
|
var Header_default = Header;
|
|
133
122
|
|
|
@@ -158,27 +147,24 @@ var Container_default = Container;
|
|
|
158
147
|
var import_classnames2 = __toESM(require("classnames"));
|
|
159
148
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
160
149
|
function Footer() {
|
|
161
|
-
const { targetProduct,
|
|
162
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)
|
|
180
|
-
] })
|
|
181
|
-
] });
|
|
150
|
+
const { targetProduct, state } = usePBMStore();
|
|
151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("footer", { className: "w-full h-auto relative", id: "footer_pbm", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: (0, import_classnames2.default)("flex items-center w-full h-auto gap-4", { "justify-center": targetProduct?.industryLogo, "justify-start": !targetProduct?.industryLogo }), children: [
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "w-4/5 h-auto", children: [
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "text-start font-semibold text-sm", children: "Economize com o benef\xEDcio do laborat\xF3rio." }),
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-start font-normal text-sm", children: "Este produto tem pre\xE7o exclusivo para clientes cadastrados no programa." })
|
|
155
|
+
] }),
|
|
156
|
+
targetProduct?.industryLogo && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
157
|
+
"img",
|
|
158
|
+
{
|
|
159
|
+
src: targetProduct.industryLogo,
|
|
160
|
+
alt: "parceiro",
|
|
161
|
+
className: "w-1/5 min-w-20 h-auto aspect-auto rounded-xl",
|
|
162
|
+
loading: "eager",
|
|
163
|
+
id: "footer_industry_logo_pbm",
|
|
164
|
+
"data-testid": "footer_industry_logo_pbm"
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
] }) });
|
|
182
168
|
}
|
|
183
169
|
var Footer_default = Footer;
|
|
184
170
|
|
|
@@ -260,8 +246,8 @@ var Button_default = Button;
|
|
|
260
246
|
// src/components/Form/index.tsx
|
|
261
247
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
262
248
|
function Form({ setLoading }) {
|
|
263
|
-
const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();
|
|
264
|
-
const [
|
|
249
|
+
const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry, setCardID } = usePBMStore();
|
|
250
|
+
const [showCardIDField, setShowCardIDField] = (0, import_react2.useState)(false);
|
|
265
251
|
const {
|
|
266
252
|
handleSubmit,
|
|
267
253
|
register,
|
|
@@ -278,9 +264,12 @@ function Form({ setLoading }) {
|
|
|
278
264
|
}
|
|
279
265
|
});
|
|
280
266
|
const onSubmitDefault = async (values) => {
|
|
281
|
-
if (!
|
|
267
|
+
if (!showCardIDField) {
|
|
282
268
|
setValue("coupon", void 0, { shouldValidate: false });
|
|
283
269
|
}
|
|
270
|
+
if (showCardIDField && values.coupon != void 0) {
|
|
271
|
+
setCardID(values.coupon);
|
|
272
|
+
}
|
|
284
273
|
setLoading(true);
|
|
285
274
|
try {
|
|
286
275
|
if (targetProduct === null) {
|
|
@@ -336,7 +325,7 @@ function Form({ setLoading }) {
|
|
|
336
325
|
onSubmit: handleSubmit(onSubmitDefault),
|
|
337
326
|
className: (0, import_classnames4.default)(
|
|
338
327
|
"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",
|
|
339
|
-
{ "mb-4": errors.securityNumber || errors.coupon &&
|
|
328
|
+
{ "mb-4": errors.securityNumber || errors.coupon && showCardIDField, "gap-2": showCardIDField }
|
|
340
329
|
),
|
|
341
330
|
id: "form_security_number_pbm",
|
|
342
331
|
children: [
|
|
@@ -353,7 +342,7 @@ function Form({ setLoading }) {
|
|
|
353
342
|
type: "text",
|
|
354
343
|
className: (0, import_classnames4.default)(
|
|
355
344
|
"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",
|
|
356
|
-
{ "outline outline-red-600": errors.securityNumber, "rounded-lg":
|
|
345
|
+
{ "outline outline-red-600": errors.securityNumber, "rounded-lg": showCardIDField }
|
|
357
346
|
),
|
|
358
347
|
placeholder: "Digite seu CPF aqui...",
|
|
359
348
|
required: true,
|
|
@@ -374,7 +363,7 @@ function Form({ setLoading }) {
|
|
|
374
363
|
]
|
|
375
364
|
}
|
|
376
365
|
),
|
|
377
|
-
|
|
366
|
+
showCardIDField && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
378
367
|
"label",
|
|
379
368
|
{
|
|
380
369
|
htmlFor: "coupon",
|
|
@@ -387,15 +376,15 @@ function Form({ setLoading }) {
|
|
|
387
376
|
type: "text",
|
|
388
377
|
className: (0, import_classnames4.default)(
|
|
389
378
|
"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",
|
|
390
|
-
{ "outline outline-red-600": errors.coupon, "rounded-lg":
|
|
379
|
+
{ "outline outline-red-600": errors.coupon, "rounded-lg": showCardIDField }
|
|
391
380
|
),
|
|
392
381
|
placeholder: "Cupom / ID do Cart\xE3o",
|
|
393
382
|
...register("coupon", {
|
|
394
|
-
required:
|
|
395
|
-
shouldUnregister: !
|
|
383
|
+
required: showCardIDField ? "Cupom / ID do Cart\xE3o obrigat\xF3rio." : false,
|
|
384
|
+
shouldUnregister: !showCardIDField,
|
|
396
385
|
onChange: (e) => {
|
|
397
386
|
setValue("coupon", e.target.value, {
|
|
398
|
-
shouldValidate:
|
|
387
|
+
shouldValidate: showCardIDField
|
|
399
388
|
});
|
|
400
389
|
}
|
|
401
390
|
}),
|
|
@@ -412,7 +401,7 @@ function Form({ setLoading }) {
|
|
|
412
401
|
type: "submit",
|
|
413
402
|
className: (0, import_classnames4.default)(
|
|
414
403
|
"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",
|
|
415
|
-
{ "rounded-lg":
|
|
404
|
+
{ "rounded-lg": showCardIDField }
|
|
416
405
|
),
|
|
417
406
|
id: "button_submit_security_number_pbm",
|
|
418
407
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.ArrowRight, { size: 24, color: "white", strokeWidth: 2 })
|
|
@@ -421,25 +410,39 @@ function Form({ setLoading }) {
|
|
|
421
410
|
]
|
|
422
411
|
}
|
|
423
412
|
),
|
|
424
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "flex items-center-safe justify-between", children: [
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
415
|
+
Button_default,
|
|
416
|
+
{
|
|
417
|
+
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",
|
|
418
|
+
onClick: () => {
|
|
419
|
+
const newValue = !showCardIDField;
|
|
420
|
+
setShowCardIDField(newValue);
|
|
421
|
+
if (!newValue) {
|
|
422
|
+
unregister("coupon");
|
|
423
|
+
clearErrors("coupon");
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
id: "check_benefits_button",
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: !showCardIDField ? "Possui Cupom / ID do Cart\xE3o?" : "N\xE3o possui Cupom / ID do Cart\xE3o??" }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.ArrowRight, { size: 16, className: (0, import_classnames4.default)({ "rotate-0": !showCardIDField, "rotate-180": showCardIDField }) })
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
434
|
+
Button_default,
|
|
435
|
+
{
|
|
436
|
+
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",
|
|
437
|
+
onClick: () => setState("isPreview"),
|
|
438
|
+
id: "check_benefits_button",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Consultar Benef\xEDcios sem CPF" }),
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.ArrowRight, { size: 16 })
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] })
|
|
443
446
|
] });
|
|
444
447
|
}
|
|
445
448
|
var Form_default = Form;
|
|
@@ -483,7 +486,7 @@ function Title(props) {
|
|
|
483
486
|
"text-start font-semibold text-sm text-zinc-900",
|
|
484
487
|
props.className
|
|
485
488
|
),
|
|
486
|
-
style: { color: props.textColor, fontSize: props.textSize },
|
|
489
|
+
style: { color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign },
|
|
487
490
|
"data-testid": "test_id_title",
|
|
488
491
|
id: "title_pbm",
|
|
489
492
|
children: props.children
|
|
@@ -492,13 +495,78 @@ function Title(props) {
|
|
|
492
495
|
}
|
|
493
496
|
var Title_default = Title;
|
|
494
497
|
|
|
498
|
+
// src/libs/zustand/useModal.tsx
|
|
499
|
+
var import_zustand2 = require("zustand");
|
|
500
|
+
var initialModalState = {
|
|
501
|
+
modal: {
|
|
502
|
+
id: "",
|
|
503
|
+
open: false
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
var createModalStore = (set) => ({
|
|
507
|
+
...initialModalState,
|
|
508
|
+
setModal: (modal) => set({ modal })
|
|
509
|
+
});
|
|
510
|
+
var useModal = (0, import_zustand2.create)(createModalStore);
|
|
511
|
+
|
|
495
512
|
// src/components/BenefitsTable/Item.tsx
|
|
496
|
-
var import_lucide_react2 = require("lucide-react");
|
|
497
513
|
var import_react3 = require("react");
|
|
498
514
|
var import_classnames6 = __toESM(require("classnames"));
|
|
515
|
+
|
|
516
|
+
// src/components/UI/Icons/index.tsx
|
|
499
517
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
518
|
+
function CheckON({ size }) {
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
520
|
+
"svg",
|
|
521
|
+
{
|
|
522
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
523
|
+
"data-name": "Camada 1",
|
|
524
|
+
viewBox: "0 0 500 500",
|
|
525
|
+
width: size,
|
|
526
|
+
height: size,
|
|
527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
528
|
+
"path",
|
|
529
|
+
{
|
|
530
|
+
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",
|
|
531
|
+
fill: "#229b00"
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
function CheckOFF({ size }) {
|
|
538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
539
|
+
"svg",
|
|
540
|
+
{
|
|
541
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
542
|
+
"data-name": "Camada 1",
|
|
543
|
+
viewBox: "0 0 500 500",
|
|
544
|
+
width: size,
|
|
545
|
+
height: size,
|
|
546
|
+
children: [
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: 250, cy: 250, r: 237.45, fill: "#fff" }),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
549
|
+
"path",
|
|
550
|
+
{
|
|
551
|
+
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",
|
|
552
|
+
fill: "#d8d8d8"
|
|
553
|
+
}
|
|
554
|
+
)
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
var Icons = {
|
|
560
|
+
CheckON,
|
|
561
|
+
CheckOFF
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
// src/components/BenefitsTable/Item.tsx
|
|
565
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
500
566
|
function Item({ data, onChange, checked }) {
|
|
501
567
|
const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();
|
|
568
|
+
const { setModal } = useModal();
|
|
569
|
+
const [openModalAlert, setOpenModalAlert] = (0, import_react3.useState)(false);
|
|
502
570
|
const ID_INPUT = "unity_quantity_" + data.authorizedQuantity;
|
|
503
571
|
const decimalDiscount = data.discountPercentual / 100;
|
|
504
572
|
const unitDiscountValue = data.grossPrice * decimalDiscount;
|
|
@@ -528,18 +596,25 @@ function Item({ data, onChange, checked }) {
|
|
|
528
596
|
(0, import_react3.useEffect)(() => {
|
|
529
597
|
updateStorageData();
|
|
530
598
|
}, [updateStorageData]);
|
|
531
|
-
|
|
599
|
+
const CheckUserIsAuthenticated = () => {
|
|
600
|
+
if (isAuthenticatedShopper) return;
|
|
601
|
+
setModal({
|
|
602
|
+
id: "ShopperIsNotAuthenticated",
|
|
603
|
+
open: true
|
|
604
|
+
});
|
|
605
|
+
};
|
|
606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
532
607
|
"label",
|
|
533
608
|
{
|
|
534
609
|
htmlFor: ID_INPUT,
|
|
535
610
|
className: (0, import_classnames6.default)(
|
|
536
611
|
"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",
|
|
537
|
-
{ "cursor-not-allowed": state === "isPreview"
|
|
612
|
+
{ "cursor-not-allowed": state === "isPreview", "cursor-pointer": state === "isActivated" }
|
|
538
613
|
),
|
|
539
614
|
id: "label_benefits_" + ID_INPUT,
|
|
540
|
-
|
|
615
|
+
onClick: CheckUserIsAuthenticated,
|
|
541
616
|
children: [
|
|
542
|
-
/* @__PURE__ */ (0,
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
543
618
|
"input",
|
|
544
619
|
{
|
|
545
620
|
type: "radio",
|
|
@@ -548,16 +623,16 @@ function Item({ data, onChange, checked }) {
|
|
|
548
623
|
className: "hidden",
|
|
549
624
|
checked,
|
|
550
625
|
onChange,
|
|
551
|
-
disabled: state === "isPreview"
|
|
626
|
+
disabled: state === "isPreview"
|
|
552
627
|
}
|
|
553
628
|
),
|
|
554
|
-
!checked ? /* @__PURE__ */ (0,
|
|
555
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
!checked ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icons.CheckOFF, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icons.CheckON, { size: 20 }),
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-zinc-900 font-semibold text-sm", children: [
|
|
556
631
|
data.authorizedQuantity,
|
|
557
632
|
"un"
|
|
558
633
|
] }),
|
|
559
|
-
/* @__PURE__ */ (0,
|
|
560
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "ml-auto relative gap-2 flex items-center-safe justify-end-safe", children: [
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("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: [
|
|
561
636
|
discountValue.toLocaleString("pt-BR", {
|
|
562
637
|
currency: "BRL",
|
|
563
638
|
currencyDisplay: "symbol",
|
|
@@ -567,7 +642,7 @@ function Item({ data, onChange, checked }) {
|
|
|
567
642
|
" ",
|
|
568
643
|
"OFF"
|
|
569
644
|
] }),
|
|
570
|
-
/* @__PURE__ */ (0,
|
|
645
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { className: "text-zinc-900 font-semibold text-sm text-center", children: totalPriceProductWithDiscountBenefit.toLocaleString("pt-BR", {
|
|
571
646
|
currency: "BRL",
|
|
572
647
|
currencyDisplay: "symbol",
|
|
573
648
|
currencySign: "standard",
|
|
@@ -608,7 +683,7 @@ var CheckBenefistWithoutDocument = async ({ products }) => {
|
|
|
608
683
|
};
|
|
609
684
|
|
|
610
685
|
// src/components/BenefitsTable/index.tsx
|
|
611
|
-
var
|
|
686
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
612
687
|
function BenefitsTable() {
|
|
613
688
|
const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();
|
|
614
689
|
const [selectedDiscout, setSelectedDiscount] = (0, import_react4.useState)(null);
|
|
@@ -698,8 +773,8 @@ function BenefitsTable() {
|
|
|
698
773
|
state === "isActivated" ? fetchDiscountWithDocument() : fetchDicountsWithoutDocument();
|
|
699
774
|
}, []);
|
|
700
775
|
if (loading) {
|
|
701
|
-
return /* @__PURE__ */ (0,
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("main", { className: "flex items-center justify-center gap-4", id: "loading_pbm", children: [
|
|
777
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
703
778
|
"div",
|
|
704
779
|
{
|
|
705
780
|
"data-testid": "test_id_spin",
|
|
@@ -707,7 +782,7 @@ function BenefitsTable() {
|
|
|
707
782
|
id: "loading_spin"
|
|
708
783
|
}
|
|
709
784
|
),
|
|
710
|
-
/* @__PURE__ */ (0,
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
711
786
|
"p",
|
|
712
787
|
{
|
|
713
788
|
className: "text-sm font-semibold text-start text-zinc-900",
|
|
@@ -717,23 +792,23 @@ function BenefitsTable() {
|
|
|
717
792
|
)
|
|
718
793
|
] });
|
|
719
794
|
}
|
|
720
|
-
return /* @__PURE__ */ (0,
|
|
795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
721
796
|
"section",
|
|
722
797
|
{
|
|
723
798
|
className: "flex items-start justify-center gap-4 w-full h-auto flex-col",
|
|
724
799
|
id: "benefits_table_pbm",
|
|
725
800
|
children: [
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Title_default, { children: "Descontos dispon\xEDveis:" }),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
728
803
|
"form",
|
|
729
804
|
{
|
|
730
805
|
className: "flex flex-col items-center justify-start w-full gap-4.5",
|
|
731
806
|
id: "form_benefits_table_pbm",
|
|
732
807
|
children: [
|
|
733
|
-
!benefitsItems && /* @__PURE__ */ (0,
|
|
808
|
+
!benefitsItems && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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." }),
|
|
734
809
|
benefitsItems && benefitsItems.map((item, index) => {
|
|
735
810
|
const ID_INPUT = "unity_quantity_" + item.authorizedQuantity;
|
|
736
|
-
return /* @__PURE__ */ (0,
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
737
812
|
Item_default,
|
|
738
813
|
{
|
|
739
814
|
data: item,
|
|
@@ -742,12 +817,11 @@ function BenefitsTable() {
|
|
|
742
817
|
},
|
|
743
818
|
index
|
|
744
819
|
);
|
|
745
|
-
})
|
|
746
|
-
benefitsItems && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w-full text-sm font-semibold text-center text-zinc-600", id: "benefits_empty_pbm", children: benefitsItems[0].informativeMessage })
|
|
820
|
+
})
|
|
747
821
|
]
|
|
748
822
|
}
|
|
749
823
|
),
|
|
750
|
-
state === "isPreview" && /* @__PURE__ */ (0,
|
|
824
|
+
state === "isPreview" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
751
825
|
Button_default,
|
|
752
826
|
{
|
|
753
827
|
onClick: () => setState("isEmpty"),
|
|
@@ -756,27 +830,27 @@ function BenefitsTable() {
|
|
|
756
830
|
children: [
|
|
757
831
|
"Aten\xE7\xE3o: N\xE3o \xE9 poss\xEDvel utilizar os benef\xEDcos sem realizar a consulta do CPF e o Login, por favor",
|
|
758
832
|
" ",
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "underline", children: "insira seu cpf para utilizar os benef\xEDcios" })
|
|
760
834
|
]
|
|
761
835
|
}
|
|
762
836
|
),
|
|
763
|
-
state === "isActivated" && /* @__PURE__ */ (0,
|
|
764
|
-
!isAuthenticatedShopper && /* @__PURE__ */ (0,
|
|
837
|
+
state === "isActivated" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
838
|
+
!isAuthenticatedShopper && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
765
839
|
Button_default,
|
|
766
840
|
{
|
|
767
841
|
onClick: () => window.location.href = customLoginUrl || "/login",
|
|
768
842
|
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",
|
|
769
843
|
id: "login",
|
|
770
|
-
children: /* @__PURE__ */ (0,
|
|
844
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "underline", children: "Por favor, fa\xE7a o Login para aproveitar os benef\xEDcios!" })
|
|
771
845
|
}
|
|
772
846
|
),
|
|
773
|
-
/* @__PURE__ */ (0,
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
774
848
|
Button_default,
|
|
775
849
|
{
|
|
776
850
|
onClick: () => setState("isEmpty"),
|
|
777
851
|
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",
|
|
778
852
|
id: "change_security_number",
|
|
779
|
-
children: /* @__PURE__ */ (0,
|
|
853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "underline", children: "Deseja editar o cpf digitado?" })
|
|
780
854
|
}
|
|
781
855
|
)
|
|
782
856
|
] })
|
|
@@ -788,9 +862,9 @@ var BenefitsTable_default = BenefitsTable;
|
|
|
788
862
|
|
|
789
863
|
// src/components/UI/Text/index.tsx
|
|
790
864
|
var import_classnames7 = __toESM(require("classnames"));
|
|
791
|
-
var
|
|
865
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
792
866
|
function Text(props) {
|
|
793
|
-
return /* @__PURE__ */ (0,
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
794
868
|
"p",
|
|
795
869
|
{
|
|
796
870
|
className: (0, import_classnames7.default)(
|
|
@@ -817,10 +891,10 @@ var getParams = (params) => {
|
|
|
817
891
|
};
|
|
818
892
|
|
|
819
893
|
// src/components/UI/Link/index.tsx
|
|
820
|
-
var
|
|
894
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
821
895
|
function Link(props) {
|
|
822
896
|
const { setState } = usePBMStore();
|
|
823
|
-
return /* @__PURE__ */ (0,
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
824
898
|
"a",
|
|
825
899
|
{
|
|
826
900
|
...props,
|
|
@@ -840,23 +914,23 @@ function Link(props) {
|
|
|
840
914
|
var Link_default = Link;
|
|
841
915
|
|
|
842
916
|
// src/components/SecurityNumberInvalid/index.tsx
|
|
843
|
-
var
|
|
917
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
844
918
|
function SecurityNumberInvalid({ textColor }) {
|
|
845
919
|
const { urlAcceptTerms } = usePBMStore();
|
|
846
|
-
return /* @__PURE__ */ (0,
|
|
920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
847
921
|
"section",
|
|
848
922
|
{
|
|
849
923
|
"data-testid": "test_id_invalid",
|
|
850
924
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
851
925
|
id: "security_number_invalid_container_pbm",
|
|
852
926
|
children: [
|
|
853
|
-
/* @__PURE__ */ (0,
|
|
854
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Title_default, { className: "w-full", textColor, children: "CPF n\xE3o cadastrado." }),
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text_default, { className: "w-full", textColor, children: [
|
|
855
929
|
"Conclua seu cadastro para habilitar o benef\xEDcio. ",
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("br", {}),
|
|
857
931
|
"Ao clicar em \u201CAceitar os termos\u201D, voc\xEA ir\xE1 para uma p\xE1gina externa. Aceite os termos e volte para continuar."
|
|
858
932
|
] }),
|
|
859
|
-
/* @__PURE__ */ (0,
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
860
934
|
Link_default,
|
|
861
935
|
{
|
|
862
936
|
href: urlAcceptTerms || "",
|
|
@@ -873,19 +947,19 @@ var SecurityNumberInvalid_default = SecurityNumberInvalid;
|
|
|
873
947
|
var import_react5 = require("react");
|
|
874
948
|
|
|
875
949
|
// src/components/SecurityNumberRegitered/index.tsx
|
|
876
|
-
var
|
|
950
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
877
951
|
function SecurityNumberRegitered({ textColor }) {
|
|
878
952
|
const { urlRegisterIndustry } = usePBMStore();
|
|
879
|
-
return /* @__PURE__ */ (0,
|
|
953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
880
954
|
"section",
|
|
881
955
|
{
|
|
882
956
|
"data-testid": "test_id_registered",
|
|
883
957
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
884
958
|
id: "security_number_registered_container_pbm",
|
|
885
959
|
children: [
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Title_default, { className: "w-full", textColor, children: "Ops, seu CPF ainda n\xE3o est\xE1 habilitado para este produto." }),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(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." }),
|
|
962
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
889
963
|
Link_default,
|
|
890
964
|
{
|
|
891
965
|
href: urlRegisterIndustry || "",
|
|
@@ -930,7 +1004,7 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
930
1004
|
};
|
|
931
1005
|
|
|
932
1006
|
// src/PBM.tsx
|
|
933
|
-
var
|
|
1007
|
+
var import_lucide_react2 = require("lucide-react");
|
|
934
1008
|
|
|
935
1009
|
// src/services/get-product-by-ean.ts
|
|
936
1010
|
var import_js_cookie4 = __toESM(require("js-cookie"));
|
|
@@ -956,7 +1030,42 @@ var GetProductByEAN = async ({ PRODUCT_EAN }) => {
|
|
|
956
1030
|
};
|
|
957
1031
|
|
|
958
1032
|
// src/PBM.tsx
|
|
959
|
-
var
|
|
1033
|
+
var import_Skeleton = __toESM(require("@mui/material/Skeleton"));
|
|
1034
|
+
|
|
1035
|
+
// src/components/Modal/index.tsx
|
|
1036
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
1037
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1038
|
+
var Modal = ({ ID }) => {
|
|
1039
|
+
const { customLoginUrl } = usePBMStore();
|
|
1040
|
+
const { modal, setModal } = useModal();
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("main", { className: (0, import_classnames9.default)(
|
|
1042
|
+
"fixed inset-0 flex items-center justify-center z-50 flex-col transition-all shadow bg-black/40",
|
|
1043
|
+
{
|
|
1044
|
+
"opacity-100 pointer-events-auto": modal.id === ID && modal.open,
|
|
1045
|
+
"opacity-0 pointer-events-none": modal.id != ID || !modal.open
|
|
1046
|
+
}
|
|
1047
|
+
), children: [
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute inset-0", onClick: () => setModal({ id: "", open: false }) }),
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: "z-10 bg-white gap-2 flex-col items-center-safe justify-center-safe p-8 rounded-xl", children: [
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Title_default, { textColor: "tomato", textSize: "18px", textAlign: "center", className: "mb-2", children: "Opa! Parece que voc\xEA n\xE3o est\xE1 Logado" }),
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { className: "mb-2", textAlign: "center", children: [
|
|
1052
|
+
"Para aproveitar os benef\xEDcios \xE9 necess\xE1rio realizar o ",
|
|
1053
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: "Login" }),
|
|
1054
|
+
" ou ",
|
|
1055
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: "Cadastro" }),
|
|
1056
|
+
" no site!"
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: "flex items-center-safe justify-center-safe gap-4", children: [
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button_default, { className: "bg-gray-600 hover:bg-gray-500", onClick: () => setModal({ id: "", open: false }), children: "Seguir sem Benef\xEDcios" }),
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link_default, { href: customLoginUrl || "/login", children: "Aproveitar Benef\xEDcios" })
|
|
1061
|
+
] })
|
|
1062
|
+
] })
|
|
1063
|
+
] });
|
|
1064
|
+
};
|
|
1065
|
+
var Modal_default = Modal;
|
|
1066
|
+
|
|
1067
|
+
// src/PBM.tsx
|
|
1068
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
960
1069
|
function PBM({
|
|
961
1070
|
originalProductPrice,
|
|
962
1071
|
clientID,
|
|
@@ -1016,55 +1125,44 @@ function PBM({
|
|
|
1016
1125
|
handleAuthorizationRequest();
|
|
1017
1126
|
}, [handleAuthorizationRequest]);
|
|
1018
1127
|
if (!isReady) {
|
|
1019
|
-
return /* @__PURE__ */ (0,
|
|
1128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Skeleton.default, { variant: "rectangular", style: { borderRadius: "12px" }, width: 460, height: 358 });
|
|
1020
1129
|
}
|
|
1021
1130
|
if (!EanProductExist) {
|
|
1022
|
-
return /* @__PURE__ */ (0,
|
|
1023
|
-
/* @__PURE__ */ (0,
|
|
1024
|
-
/* @__PURE__ */ (0,
|
|
1131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: "pbm-library-root", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Container_default, { variant: "main", children: [
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Title_default, { children: "Erro ao Aplicar o Benef\xEDcio" }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text_default, { textAlign: "center", children: [
|
|
1025
1134
|
"O produto n\xE3o foi encontrado no sistema. ",
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("br", {}),
|
|
1027
1136
|
" Por favor, tente novamente mais tarde ou contate o suporte."
|
|
1028
1137
|
] }),
|
|
1029
|
-
/* @__PURE__ */ (0,
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1030
1139
|
Button_default,
|
|
1031
1140
|
{
|
|
1032
1141
|
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",
|
|
1033
1142
|
onClick: () => window.location.reload(),
|
|
1034
1143
|
id: "check_benefits_button",
|
|
1035
1144
|
children: [
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Tentar novamente" }),
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react2.RefreshCw, { size: 16 })
|
|
1038
1147
|
]
|
|
1039
1148
|
}
|
|
1040
1149
|
)
|
|
1041
1150
|
] }) });
|
|
1042
1151
|
}
|
|
1043
|
-
return /* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
/* @__PURE__ */ (0,
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
onClick: () => setState("isPreview"),
|
|
1053
|
-
id: "check_benefits_button",
|
|
1054
|
-
children: [
|
|
1055
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Consultar benef\xEDcios" }),
|
|
1056
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.ArrowRight, { size: 16 })
|
|
1057
|
-
]
|
|
1058
|
-
}
|
|
1059
|
-
)
|
|
1152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id: "pbm-library-root", children: [
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Container_default, { variant: "main", children: [
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Header_default, { originalProductPrice: formatedOriginalProductPrice || 0 }),
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Container_default, { variant: "simple", children: [
|
|
1156
|
+
state === "isEmpty" && !loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Form_default, { setLoading }),
|
|
1157
|
+
state === "isEmpty" && loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Loading_default, {}),
|
|
1158
|
+
state === "isInvalid" && !loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SecurityNumberInvalid_default, {}),
|
|
1159
|
+
state === "isRegistered" && !loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SecurityNumberRegitered_default, {}),
|
|
1160
|
+
(state === "isActivated" || state === "isPreview") && !loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BenefitsTable_default, {})
|
|
1060
1161
|
] }),
|
|
1061
|
-
|
|
1062
|
-
state === "isInvalid" && !loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SecurityNumberInvalid_default, {}),
|
|
1063
|
-
state === "isRegistered" && !loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SecurityNumberRegitered_default, {}),
|
|
1064
|
-
(state === "isActivated" || state === "isPreview") && !loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BenefitsTable_default, {})
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Footer_default, {})
|
|
1065
1163
|
] }),
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
] })
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Modal_default, { ID: "ShopperIsNotAuthenticated" })
|
|
1165
|
+
] });
|
|
1068
1166
|
}
|
|
1069
1167
|
var PBM_default = PBM;
|
|
1070
1168
|
// Annotate the CommonJS export names for ESM import in node:
|