@agrada_digital/pbm 0.0.85 → 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.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) {
@@ -153,7 +155,7 @@ var toFormat = (value) => {
153
155
  };
154
156
 
155
157
  // src/components/Form/index.tsx
156
- import classNames3 from "classnames";
158
+ import classNames4 from "classnames";
157
159
  import { zodResolver } from "@hookform/resolvers/zod";
158
160
  import { useForm } from "react-hook-form";
159
161
  import { ArrowRight } from "lucide-react";
@@ -185,11 +187,29 @@ var BenefitsWithDocument = async ({ document, products }) => {
185
187
  return dataResponse;
186
188
  };
187
189
 
190
+ // src/components/UI/Button/index.tsx
191
+ import classNames3 from "classnames";
192
+ import { jsx as jsx4 } from "react/jsx-runtime";
193
+ function Button(props) {
194
+ return /* @__PURE__ */ jsx4(
195
+ "button",
196
+ {
197
+ ...props,
198
+ className: classNames3(
199
+ "w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors",
200
+ props.className
201
+ ),
202
+ children: props.children
203
+ }
204
+ );
205
+ }
206
+ var Button_default = Button;
207
+
188
208
  // src/components/Form/index.tsx
189
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
209
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
190
210
  function Form({ setLoading }) {
191
- const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();
192
- const [showCoupoField, setShowCoupoField] = useState(false);
211
+ const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry, setCardID } = usePBMStore();
212
+ const [showCardIDField, setShowCardIDField] = useState(false);
193
213
  const {
194
214
  handleSubmit,
195
215
  register,
@@ -206,9 +226,12 @@ function Form({ setLoading }) {
206
226
  }
207
227
  });
208
228
  const onSubmitDefault = async (values) => {
209
- if (!showCoupoField) {
229
+ if (!showCardIDField) {
210
230
  setValue("coupon", void 0, { shouldValidate: false });
211
231
  }
232
+ if (showCardIDField && values.coupon != void 0) {
233
+ setCardID(values.coupon);
234
+ }
212
235
  setLoading(true);
213
236
  try {
214
237
  if (targetProduct === null) {
@@ -257,105 +280,140 @@ function Form({ setLoading }) {
257
280
  }
258
281
  ;
259
282
  };
260
- return /* @__PURE__ */ jsx4(Fragment2, { children: /* @__PURE__ */ jsxs3(
261
- "form",
262
- {
263
- onSubmit: handleSubmit(onSubmitDefault),
264
- className: classNames3(
265
- "w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",
266
- { "mb-4": errors.securityNumber || errors.coupon && showCoupoField, "gap-2": showCoupoField }
267
- ),
268
- id: "form_security_number_pbm",
269
- children: [
270
- /* @__PURE__ */ jsxs3(
271
- "label",
272
- {
273
- htmlFor: "cpf",
274
- className: "w-4/5 h-auto flex items-start flex-col justify-center relative py-2",
275
- id: "label_security_number_pbm",
276
- children: [
277
- /* @__PURE__ */ jsx4(
278
- "input",
279
- {
280
- type: "text",
281
- className: classNames3(
282
- "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",
283
- { "outline outline-red-600": errors.securityNumber, "rounded-lg": showCoupoField }
284
- ),
285
- placeholder: "Digite seu CPF aqui...",
286
- required: true,
287
- maxLength: 14,
288
- ...register("securityNumber", {
289
- onChange: (e) => {
290
- const formatted = toFormat(e.target.value);
291
- setValue("securityNumber", formatted, {
292
- shouldValidate: true
293
- });
294
- }
295
- }),
296
- defaultValue: securityNumber || "",
297
- id: "input_security_number_pbm"
298
- }
299
- ),
300
- errors.securityNumber && /* @__PURE__ */ jsx4("span", { className: "text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap", id: "security_number_form_error", children: errors.securityNumber.message })
301
- ]
302
- }
283
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
284
+ /* @__PURE__ */ jsxs3(
285
+ "form",
286
+ {
287
+ onSubmit: handleSubmit(onSubmitDefault),
288
+ className: classNames4(
289
+ "w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",
290
+ { "mb-4": errors.securityNumber || errors.coupon && showCardIDField, "gap-2": showCardIDField }
303
291
  ),
304
- showCoupoField && /* @__PURE__ */ jsxs3(
305
- "label",
306
- {
307
- htmlFor: "coupon",
308
- className: "w-4/5 h-auto flex items-start flex-col justify-center relative py-2",
309
- id: "label_coupon_pbm",
310
- children: [
311
- /* @__PURE__ */ jsx4(
312
- "input",
313
- {
314
- type: "text",
315
- className: classNames3(
316
- "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",
317
- { "outline outline-red-600": errors.coupon, "rounded-lg": showCoupoField }
318
- ),
319
- placeholder: "Cupom / ID do Cart\xE3o",
320
- ...register("coupon", {
321
- required: showCoupoField ? "Cupom / ID do Cart\xE3o obrigat\xF3rio." : false,
322
- shouldUnregister: !showCoupoField,
323
- onChange: (e) => {
324
- setValue("coupon", e.target.value, {
325
- shouldValidate: showCoupoField
326
- });
327
- }
328
- }),
329
- id: "input_coupon_pbm"
330
- }
292
+ id: "form_security_number_pbm",
293
+ children: [
294
+ /* @__PURE__ */ jsxs3(
295
+ "label",
296
+ {
297
+ htmlFor: "cpf",
298
+ className: "w-4/5 h-auto flex items-start flex-col justify-center relative py-2",
299
+ id: "label_security_number_pbm",
300
+ children: [
301
+ /* @__PURE__ */ jsx5(
302
+ "input",
303
+ {
304
+ type: "text",
305
+ className: classNames4(
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",
307
+ { "outline outline-red-600": errors.securityNumber, "rounded-lg": showCardIDField }
308
+ ),
309
+ placeholder: "Digite seu CPF aqui...",
310
+ required: true,
311
+ maxLength: 14,
312
+ ...register("securityNumber", {
313
+ onChange: (e) => {
314
+ const formatted = toFormat(e.target.value);
315
+ setValue("securityNumber", formatted, {
316
+ shouldValidate: true
317
+ });
318
+ }
319
+ }),
320
+ defaultValue: securityNumber || "",
321
+ id: "input_security_number_pbm"
322
+ }
323
+ ),
324
+ errors.securityNumber && /* @__PURE__ */ jsx5("span", { className: "text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap", id: "security_number_form_error", children: errors.securityNumber.message })
325
+ ]
326
+ }
327
+ ),
328
+ showCardIDField && /* @__PURE__ */ jsxs3(
329
+ "label",
330
+ {
331
+ htmlFor: "coupon",
332
+ className: "w-4/5 h-auto flex items-start flex-col justify-center relative py-2",
333
+ id: "label_coupon_pbm",
334
+ children: [
335
+ /* @__PURE__ */ jsx5(
336
+ "input",
337
+ {
338
+ type: "text",
339
+ className: classNames4(
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",
341
+ { "outline outline-red-600": errors.coupon, "rounded-lg": showCardIDField }
342
+ ),
343
+ placeholder: "Cupom / ID do Cart\xE3o",
344
+ ...register("coupon", {
345
+ required: showCardIDField ? "Cupom / ID do Cart\xE3o obrigat\xF3rio." : false,
346
+ shouldUnregister: !showCardIDField,
347
+ onChange: (e) => {
348
+ setValue("coupon", e.target.value, {
349
+ shouldValidate: showCardIDField
350
+ });
351
+ }
352
+ }),
353
+ id: "input_coupon_pbm"
354
+ }
355
+ ),
356
+ errors.coupon && /* @__PURE__ */ jsx5("span", { className: "text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap", id: "coupon_form_error", children: errors.coupon.message })
357
+ ]
358
+ }
359
+ ),
360
+ /* @__PURE__ */ jsx5(
361
+ "button",
362
+ {
363
+ type: "submit",
364
+ className: classNames4(
365
+ "bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",
366
+ { "rounded-lg": showCardIDField }
331
367
  ),
332
- errors.coupon && /* @__PURE__ */ jsx4("span", { className: "text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap", id: "coupon_form_error", children: errors.coupon.message })
333
- ]
334
- }
335
- ),
336
- /* @__PURE__ */ jsx4(
337
- "button",
338
- {
339
- type: "submit",
340
- className: classNames3(
341
- "bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",
342
- { "rounded-lg": showCoupoField }
343
- ),
344
- id: "button_submit_security_number_pbm",
345
- children: /* @__PURE__ */ jsx4(ArrowRight, { size: 24, color: "white", strokeWidth: 2 })
346
- }
347
- )
348
- ]
349
- }
350
- ) });
368
+ id: "button_submit_security_number_pbm",
369
+ children: /* @__PURE__ */ jsx5(ArrowRight, { size: 24, color: "white", strokeWidth: 2 })
370
+ }
371
+ )
372
+ ]
373
+ }
374
+ ),
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
+ ] })
408
+ ] });
351
409
  }
352
410
  var Form_default = Form;
353
411
 
354
412
  // src/components/UI/Loading/index.tsx
355
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
413
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
356
414
  function Loading({ textColor }) {
357
415
  return /* @__PURE__ */ jsxs4("main", { className: "flex items-center justify-center gap-4", id: "loading_pbm", children: [
358
- /* @__PURE__ */ jsx5(
416
+ /* @__PURE__ */ jsx6(
359
417
  "div",
360
418
  {
361
419
  "data-testid": "test_id_spin",
@@ -363,7 +421,7 @@ function Loading({ textColor }) {
363
421
  id: "loading_spin"
364
422
  }
365
423
  ),
366
- /* @__PURE__ */ jsx5(
424
+ /* @__PURE__ */ jsx6(
367
425
  "p",
368
426
  {
369
427
  className: "text-sm font-semibold text-start text-zinc-900",
@@ -376,26 +434,8 @@ function Loading({ textColor }) {
376
434
  }
377
435
  var Loading_default = Loading;
378
436
 
379
- // src/components/UI/Button/index.tsx
380
- import classNames4 from "classnames";
381
- import { jsx as jsx6 } from "react/jsx-runtime";
382
- function Button(props) {
383
- return /* @__PURE__ */ jsx6(
384
- "button",
385
- {
386
- ...props,
387
- className: classNames4(
388
- "w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors",
389
- props.className
390
- ),
391
- children: props.children
392
- }
393
- );
394
- }
395
- var Button_default = Button;
396
-
397
437
  // src/components/BenefitsTable/index.tsx
398
- import { useEffect as useEffect2, useState as useState2 } from "react";
438
+ import { useEffect as useEffect2, useState as useState3 } from "react";
399
439
 
400
440
  // src/components/UI/Title/index.tsx
401
441
  import classNames5 from "classnames";
@@ -408,7 +448,7 @@ function Title(props) {
408
448
  "text-start font-semibold text-sm text-zinc-900",
409
449
  props.className
410
450
  ),
411
- style: { color: props.textColor, fontSize: props.textSize },
451
+ style: { color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign },
412
452
  "data-testid": "test_id_title",
413
453
  id: "title_pbm",
414
454
  children: props.children
@@ -417,8 +457,22 @@ function Title(props) {
417
457
  }
418
458
  var Title_default = Title;
419
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
+
420
474
  // src/components/BenefitsTable/Item.tsx
421
- import { useCallback, useEffect } from "react";
475
+ import { useCallback, useEffect, useState as useState2 } from "react";
422
476
  import classNames6 from "classnames";
423
477
 
424
478
  // src/components/UI/Icons/index.tsx
@@ -473,6 +527,8 @@ var Icons = {
473
527
  import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
474
528
  function Item({ data, onChange, checked }) {
475
529
  const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();
530
+ const { setModal } = useModal();
531
+ const [openModalAlert, setOpenModalAlert] = useState2(false);
476
532
  const ID_INPUT = "unity_quantity_" + data.authorizedQuantity;
477
533
  const decimalDiscount = data.discountPercentual / 100;
478
534
  const unitDiscountValue = data.grossPrice * decimalDiscount;
@@ -502,16 +558,23 @@ function Item({ data, onChange, checked }) {
502
558
  useEffect(() => {
503
559
  updateStorageData();
504
560
  }, [updateStorageData]);
561
+ const CheckUserIsAuthenticated = () => {
562
+ if (isAuthenticatedShopper) return;
563
+ setModal({
564
+ id: "ShopperIsNotAuthenticated",
565
+ open: true
566
+ });
567
+ };
505
568
  return /* @__PURE__ */ jsxs6(
506
569
  "label",
507
570
  {
508
571
  htmlFor: ID_INPUT,
509
572
  className: classNames6(
510
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",
511
- { "cursor-not-allowed": state === "isPreview" || !isAuthenticatedShopper, "cursor-pointer": state === "isActivated" && isAuthenticatedShopper }
574
+ { "cursor-not-allowed": state === "isPreview", "cursor-pointer": state === "isActivated" }
512
575
  ),
513
576
  id: "label_benefits_" + ID_INPUT,
514
- title: !isAuthenticatedShopper ? "Necess\xE1rio fazer login!" : "",
577
+ onClick: CheckUserIsAuthenticated,
515
578
  children: [
516
579
  /* @__PURE__ */ jsx9(
517
580
  "input",
@@ -522,7 +585,7 @@ function Item({ data, onChange, checked }) {
522
585
  className: "hidden",
523
586
  checked,
524
587
  onChange,
525
- disabled: state === "isPreview" || !isAuthenticatedShopper
588
+ disabled: state === "isPreview"
526
589
  }
527
590
  ),
528
591
  !checked ? /* @__PURE__ */ jsx9(Icons.CheckOFF, { size: 20 }) : /* @__PURE__ */ jsx9(Icons.CheckON, { size: 20 }),
@@ -584,9 +647,9 @@ var CheckBenefistWithoutDocument = async ({ products }) => {
584
647
  import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
585
648
  function BenefitsTable() {
586
649
  const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();
587
- const [selectedDiscout, setSelectedDiscount] = useState2(null);
588
- const [loading, setLoading] = useState2(true);
589
- const [benefitsItems, setBenefitsItems] = useState2();
650
+ const [selectedDiscout, setSelectedDiscount] = useState3(null);
651
+ const [loading, setLoading] = useState3(true);
652
+ const [benefitsItems, setBenefitsItems] = useState3();
590
653
  useEffect2(() => {
591
654
  const fetchDicountsWithoutDocument = async () => {
592
655
  if (!targetProduct?.productId) {
@@ -842,7 +905,7 @@ function SecurityNumberInvalid({ textColor }) {
842
905
  var SecurityNumberInvalid_default = SecurityNumberInvalid;
843
906
 
844
907
  // src/PBM.tsx
845
- import { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
908
+ import { useCallback as useCallback2, useEffect as useEffect3, useState as useState4 } from "react";
846
909
 
847
910
  // src/components/SecurityNumberRegitered/index.tsx
848
911
  import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
@@ -902,7 +965,7 @@ var GetAuthorization = async ({ clientID }) => {
902
965
  };
903
966
 
904
967
  // src/PBM.tsx
905
- import { ArrowRight as ArrowRight2, RefreshCw } from "lucide-react";
968
+ import { RefreshCw } from "lucide-react";
906
969
 
907
970
  // src/services/get-product-by-ean.ts
908
971
  import Cookies4 from "js-cookie";
@@ -928,7 +991,41 @@ var GetProductByEAN = async ({ PRODUCT_EAN }) => {
928
991
 
929
992
  // src/PBM.tsx
930
993
  import Skeleton from "@mui/material/Skeleton";
931
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
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";
932
1029
  function PBM({
933
1030
  originalProductPrice,
934
1031
  clientID,
@@ -939,10 +1036,10 @@ function PBM({
939
1036
  const formatedOriginalProductPrice = Number(
940
1037
  String(originalProductPrice).replace(",", ".")
941
1038
  );
942
- const [isReady, setIsReady] = useState3(false);
943
- const [loading, setLoading] = useState3(false);
1039
+ const [isReady, setIsReady] = useState4(false);
1040
+ const [loading, setLoading] = useState4(false);
944
1041
  const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();
945
- const [EanProductExist, setEanProductExist] = useState3(true);
1042
+ const [EanProductExist, setEanProductExist] = useState4(true);
946
1043
  const fetchProductByEan = async () => {
947
1044
  try {
948
1045
  if (!eanProduct) {
@@ -988,55 +1085,44 @@ function PBM({
988
1085
  handleAuthorizationRequest();
989
1086
  }, [handleAuthorizationRequest]);
990
1087
  if (!isReady) {
991
- return /* @__PURE__ */ jsx15(Skeleton, { variant: "rectangular", style: { borderRadius: "12px" }, width: 460, height: 358 });
1088
+ return /* @__PURE__ */ jsx16(Skeleton, { variant: "rectangular", style: { borderRadius: "12px" }, width: 460, height: 358 });
992
1089
  }
993
1090
  if (!EanProductExist) {
994
- return /* @__PURE__ */ jsx15("div", { id: "pbm-library-root", children: /* @__PURE__ */ jsxs10(Container_default, { variant: "main", children: [
995
- /* @__PURE__ */ jsx15(Title_default, { children: "Erro ao Aplicar o Benef\xEDcio" }),
996
- /* @__PURE__ */ jsxs10(Text_default, { textAlign: "center", children: [
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: [
997
1094
  "O produto n\xE3o foi encontrado no sistema. ",
998
- /* @__PURE__ */ jsx15("br", {}),
1095
+ /* @__PURE__ */ jsx16("br", {}),
999
1096
  " Por favor, tente novamente mais tarde ou contate o suporte."
1000
1097
  ] }),
1001
- /* @__PURE__ */ jsxs10(
1098
+ /* @__PURE__ */ jsxs11(
1002
1099
  Button_default,
1003
1100
  {
1004
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",
1005
1102
  onClick: () => window.location.reload(),
1006
1103
  id: "check_benefits_button",
1007
1104
  children: [
1008
- /* @__PURE__ */ jsx15("span", { children: "Tentar novamente" }),
1009
- /* @__PURE__ */ jsx15(RefreshCw, { size: 16 })
1105
+ /* @__PURE__ */ jsx16("span", { children: "Tentar novamente" }),
1106
+ /* @__PURE__ */ jsx16(RefreshCw, { size: 16 })
1010
1107
  ]
1011
1108
  }
1012
1109
  )
1013
1110
  ] }) });
1014
1111
  }
1015
- return /* @__PURE__ */ jsx15("div", { id: "pbm-library-root", children: /* @__PURE__ */ jsxs10(Container_default, { variant: "main", children: [
1016
- /* @__PURE__ */ jsx15(Header_default, { originalProductPrice: formatedOriginalProductPrice || 0 }),
1017
- /* @__PURE__ */ jsxs10(Container_default, { variant: "simple", children: [
1018
- state === "isEmpty" && !loading && /* @__PURE__ */ jsxs10(Fragment4, { children: [
1019
- /* @__PURE__ */ jsx15(Form_default, { setLoading }),
1020
- /* @__PURE__ */ jsxs10(
1021
- Button_default,
1022
- {
1023
- 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",
1024
- onClick: () => setState("isPreview"),
1025
- id: "check_benefits_button",
1026
- children: [
1027
- /* @__PURE__ */ jsx15("span", { children: "Consultar benef\xEDcios" }),
1028
- /* @__PURE__ */ jsx15(ArrowRight2, { size: 16 })
1029
- ]
1030
- }
1031
- )
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, {})
1032
1121
  ] }),
1033
- state === "isEmpty" && loading && /* @__PURE__ */ jsx15(Loading_default, {}),
1034
- state === "isInvalid" && !loading && /* @__PURE__ */ jsx15(SecurityNumberInvalid_default, {}),
1035
- state === "isRegistered" && !loading && /* @__PURE__ */ jsx15(SecurityNumberRegitered_default, {}),
1036
- (state === "isActivated" || state === "isPreview") && !loading && /* @__PURE__ */ jsx15(BenefitsTable_default, {})
1122
+ /* @__PURE__ */ jsx16(Footer_default, {})
1037
1123
  ] }),
1038
- /* @__PURE__ */ jsx15(Footer_default, {})
1039
- ] }) });
1124
+ /* @__PURE__ */ jsx16(Modal_default, { ID: "ShopperIsNotAuthenticated" })
1125
+ ] });
1040
1126
  }
1041
1127
  var PBM_default = PBM;
1042
1128
  export {