@agrada_digital/pbm 0.0.83 → 0.0.84

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.js CHANGED
@@ -997,6 +997,7 @@ function PBM({
997
997
  } catch (error) {
998
998
  console.error(error);
999
999
  } finally {
1000
+ setIsReady(true);
1000
1001
  }
1001
1002
  };
1002
1003
  const handleAuthorizationRequest = (0, import_react5.useCallback)(async () => {
@@ -1015,7 +1016,7 @@ function PBM({
1015
1016
  handleAuthorizationRequest();
1016
1017
  }, [handleAuthorizationRequest]);
1017
1018
  if (!isReady) {
1018
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "rounded-xl w-[556px] h-[358px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n hover:shadow-[0_0_30px_rgba(0,0,0,0.3)] \n transition-all duration-500 ease-in-out" });
1019
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "rounded-xl w-[250px] h-[250px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n transition-all duration-500 ease-in-out" });
1019
1020
  }
1020
1021
  if (!EanProductExist) {
1021
1022
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { id: "pbm-library-root", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Container_default, { variant: "main", children: [
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/libs/zustand/usePBM.tsx","../src/components/Header/index.tsx","../src/components/UI/Container/index.tsx","../src/components/Footer/index.tsx","../src/schema/validation-schema.ts","../src/utils/format.ts","../src/components/Form/index.tsx","../src/services/benefits-with-document.ts","../src/components/UI/Button/index.tsx","../src/components/UI/Loading/index.tsx","../src/components/BenefitsTable/index.tsx","../src/components/UI/Title/index.tsx","../src/components/BenefitsTable/Item.tsx","../src/services/benefits-without-document.ts","../src/components/UI/Text/index.tsx","../src/components/UI/Link/index.tsx","../src/utils/getParams.ts","../src/components/SecurityNumberInvalid/index.tsx","../src/PBM.tsx","../src/components/SecurityNumberRegitered/index.tsx","../src/services/authorization.ts","../src/services/get-product-by-ean.ts"],"sourcesContent":["// Estilos - importa CSS escopado para evitar conflitos\r\nimport './pbm-scoped.css';\r\n\r\n// Componente Principal\r\nexport { default as PBM } from \"./PBM\";\r\n\r\n// Tipos\r\nexport type { PBMProps } from \"./PBM\";\r\nexport type { PBMStore } from \"./libs/zustand/usePBM\";\r\n\r\n// Hooks\r\nexport { usePBMStore } from \"./libs/zustand/usePBM\"; \r\n","import { createStore, StateCreator, StoreApi } from \"zustand\";\r\nimport { useStore } from \"zustand/react\";\r\nimport { IProduct, usePBMTypes } from \"../../types/globals\";\r\n\r\nexport interface PBMStore extends usePBMTypes {\r\n setSecurityNumber: (securityNumber: string) => void;\r\n setState: (state: usePBMTypes[\"state\"]) => void;\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => void;\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) => void;\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) => void;\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) => void;\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) => void;\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => void;\r\n}\r\n\r\n// Tipo apenas com os getters (estado readonly)\r\nexport type PBMStoreReadonly = Omit<PBMStore,\r\n | 'setSecurityNumber'\r\n | 'setState'\r\n | 'setAvailableDiscountSelected'\r\n | 'setTargetProduct'\r\n | 'setUrlAcceptTerms'\r\n | 'setUrlRegisterIndustry'\r\n>;\r\n\r\nconst initialPBMState: usePBMTypes = {\r\n securityNumber: \"\",\r\n state: \"isEmpty\",\r\n availableDiscountSelected: {\r\n quantity: 0,\r\n discount: {\r\n unit: 0,\r\n total: 0,\r\n },\r\n totalPrice: 0,\r\n grossPrice: 0\r\n },\r\n targetProduct: null,\r\n campaign: \"pbm_campaign\",\r\n isAuthenticatedShopper: false,\r\n customLoginUrl: \"/login\"\r\n};\r\n\r\nconst createPBMStore: StateCreator<PBMStore> = (set) => ({\r\n ...initialPBMState,\r\n\r\n setSecurityNumber: (securityNumber: string) => set({ securityNumber }),\r\n setState: (state: usePBMTypes[\"state\"]) => set({ state }),\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) =>\r\n set({ targetProduct }),\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => set({ availableDiscountSelected: availableDiscount }),\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) =>\r\n set({ urlAcceptTerms: urlAcceptTerms }),\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) =>\r\n set({ urlRegisterIndustry: urlRegisterIndustry }),\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) =>\r\n set({ isAuthenticatedShopper: isAuthenticatedShopper }),\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => set({ customLoginUrl: customLoginUrl })\r\n\r\n});\r\n\r\n// Store completa (uso interno na biblioteca)\r\nexport const pbmStore: StoreApi<PBMStore> = createStore<PBMStore>(createPBMStore);\r\n\r\n// Cria uma versão somente leitura da store para exposição pública\r\nexport const createReadonlyStore = (): StoreApi<PBMStoreReadonly> => {\r\n return {\r\n getState: () => {\r\n const fullState = pbmStore.getState();\r\n // Remove os setters do estado retornado\r\n const {\r\n setSecurityNumber,\r\n setState,\r\n setAvailableDiscountSelected,\r\n setTargetProduct,\r\n setUrlAcceptTerms,\r\n setUrlRegisterIndustry,\r\n setIsAuthenticatedShopper,\r\n setCustomLoginUrl,\r\n ...readonlyState\r\n } = fullState;\r\n\r\n const { quantity, productId, skuId, discountMax, netPrice, stockBalance, listPrice, price, ...limitedTargetProductData } = fullState.targetProduct as IProduct;\r\n\r\n return { ...readonlyState, targetProduct: limitedTargetProductData } as PBMStoreReadonly;\r\n }\r\n } as StoreApi<PBMStoreReadonly>;\r\n};\r\n\r\n// React hook (usado dentro de componentes React)\r\nexport function usePBMStore(): PBMStore;\r\nexport function usePBMStore<T>(selector: (state: PBMStore) => T): T;\r\nexport function usePBMStore<T>(selector?: (state: PBMStore) => T): PBMStore | T {\r\n if (selector) {\r\n return useStore(pbmStore, selector);\r\n }\r\n return useStore(pbmStore, (state) => state);\r\n}\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Header({ originalProductPrice }: { originalProductPrice: number }) {\r\n const { targetProduct } = usePBMStore();\r\n const Price = (targetProduct?.listPrice || originalProductPrice);\r\n const Discount = Price * ((targetProduct?.discountMax || 0) / 100)\r\n\r\n return (\r\n <header\r\n className=\"flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5\"\r\n id=\"header_pbm\"\r\n >\r\n <span\r\n 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\"\r\n data-testid=\"test_id_header_price\"\r\n id=\"header_price\"\r\n >\r\n <span className=\"absolute -top-6 left-10 bg-emerald-500 px-4 py-1 rounded-t-lg text-xs font-medium text-white\">{targetProduct?.discountMax}% OFF</span>\r\n\r\n <svg width=\"36px\" height=\"36px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g id=\"SVGRepo_bgCarrier\" strokeWidth=\"0\"></g>\r\n <g id=\"SVGRepo_tracerCarrier\" strokeLinecap=\"round\" strokeLinejoin=\"round\"></g>\r\n <g id=\"SVGRepo_iconCarrier\">\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n </g>\r\n </svg>\r\n\r\n <section className=\"flex flex-col items-start justify-center-safe gap-0\">\r\n <span className=\"line-through text-sm font-light\">\r\n {Number(Price)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </span>\r\n {Number(Price - Discount)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </section>\r\n </span>\r\n <h1 id=\"header_title\" className=\"text-center w-full text-[#339c9b] font-bold text-xs px-4 md:text-sm\">\r\n Desconto de Laboratório\r\n </h1>\r\n </header>\r\n );\r\n}\r\n\r\nexport default Header;\r\n","import classNames from \"classnames\";\r\nimport React from \"react\";\r\n\r\nfunction Container({\r\n children,\r\n variant,\r\n}: {\r\n children: React.ReactNode;\r\n variant: \"simple\" | \"main\";\r\n}) {\r\n return (\r\n <main\r\n className={classNames({\r\n \"border-3 border-[#44c2c0] flex flex-col items-center justify-center min-w-[var(--min-container)] max-w-[var(--max-container)] w-full h-auto rounded-xl p-4 bg-white gap-4 relative\":\r\n variant === \"main\",\r\n \"w-full h-auto relative\": variant === \"simple\",\r\n })}\r\n data-testid=\"test_id_container\"\r\n data-variant={variant}\r\n id=\"container_pbm\"\r\n >\r\n {children}\r\n </main>\r\n );\r\n}\r\n\r\nexport default Container;\r\n","import classNames from \"classnames\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Footer() {\r\n const { targetProduct, setTargetProduct, state } = usePBMStore();\r\n\r\n return (\r\n <footer className=\"w-full h-auto relative\" id=\"footer_pbm\">\r\n {(state !== \"isActivated\" && targetProduct?.informativeMessage) && <p className=\"text-start mb-3 font-semibold text-sm text-amber-500\">{targetProduct?.informativeMessage}</p>}\r\n\r\n <section className={classNames(\"flex items-center w-full h-auto gap-4\", { \"justify-center\": targetProduct?.industryLogo, \"justify-start\": !targetProduct?.industryLogo })}>\r\n <section className=\"w-4/5 h-auto\">\r\n <h3 className=\"text-start font-semibold text-sm\">\r\n Economize com o benefício do laboratório.\r\n </h3>\r\n <p className=\"text-start font-normal text-sm\">\r\n Este produto tem preço exclusivo para clientes cadastrados no\r\n programa.\r\n </p>\r\n </section>\r\n {targetProduct?.industryLogo && (\r\n <img\r\n src={targetProduct.industryLogo}\r\n alt=\"parceiro\"\r\n className=\"w-1/5 min-w-20 h-auto aspect-auto rounded-xl\"\r\n loading=\"eager\"\r\n id=\"footer_industry_logo_pbm\"\r\n data-testid=\"footer_industry_logo_pbm\"\r\n />\r\n )}\r\n </section>\r\n </footer>\r\n );\r\n}\r\n\r\nexport default Footer;\r\n","import { z } from \"zod\";\r\n\r\nexport const validationSchema = z.object({\r\n securityNumber: z\r\n .string({\r\n required_error: 'CPF é obrigatório.',\r\n })\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return replacedDoc.length >= 11;\r\n }, 'CPF deve conter no mínimo 11 caracteres.')\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return !!Number(replacedDoc);\r\n }, 'CPF deve conter apenas números.'),\r\n\r\n coupon: z.string({ required_error: 'Cupom / ID do Cartão obrigatório.'}).optional()\r\n});\r\n\r\nexport type validationSchemaType = z.infer<typeof validationSchema>","export const toFormat = (value: string) => {\r\n const cleanedValue = value.replace(/\\D/g, '');\r\n\r\n if (cleanedValue.length <= 11) {\r\n return cleanedValue\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d{1,2})/, '$1-$2')\r\n .replace(/(-\\d{2})\\d+?$/, '$1');\r\n }\r\n};","import {\r\n validationSchema,\r\n validationSchemaType,\r\n} from \"../../schema/validation-schema\";\r\nimport { toFormat } from \"../../utils/format\";\r\n\r\nimport classNames from \"classnames\";\r\nimport { zodResolver } from \"@hookform/resolvers/zod\";\r\nimport { useForm } from \"react-hook-form\";\r\n\r\nimport { ArrowRight } from \"lucide-react\";\r\nimport { Dispatch, SetStateAction, useState } from \"react\";\r\n\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\nimport Button from \"../UI/Button\";\r\n\r\ninterface IForm {\r\n setLoading: Dispatch<SetStateAction<boolean>>;\r\n}\r\n\r\nfunction Form({ setLoading }: IForm) {\r\n const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();\r\n const [showCoupoField, setShowCoupoField] = useState<boolean>(false);\r\n\r\n const {\r\n handleSubmit,\r\n register,\r\n setValue,\r\n clearErrors,\r\n unregister,\r\n formState: { errors },\r\n } = useForm<validationSchemaType>({\r\n resolver: zodResolver(validationSchema),\r\n mode: 'onSubmit',\r\n defaultValues: {\r\n securityNumber: securityNumber || \"\",\r\n coupon: \"\",\r\n },\r\n });\r\n\r\n const onSubmitDefault = async (values: validationSchemaType) => {\r\n if (!showCoupoField) {\r\n setValue(\"coupon\", undefined, { shouldValidate: false });\r\n }\r\n\r\n setLoading(true);\r\n\r\n try {\r\n if (targetProduct === null) {\r\n console.error(\"PBMLOG: Product is not defined!\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined!\");\r\n return\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined!\");\r\n return\r\n }\r\n\r\n const response = await BenefitsWithDocument({\r\n document: values.securityNumber.replace(/\\D/g, ''),\r\n products: [{\r\n productId: targetProduct.productId,\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.netPrice ?? targetProduct.listPrice\r\n }]\r\n });\r\n\r\n if (response.success) {\r\n const status: Record<\"acceptance\" | \"industry registration\" | \"active\", \"isRegistered\" | \"isActivated\" | \"isInvalid\" | \"isEmpty\"> = {\r\n \"acceptance\": \"isInvalid\",\r\n \"industry registration\": \"isRegistered\",\r\n \"active\": \"isActivated\"\r\n }\r\n\r\n setSecurityNumber(values.securityNumber);\r\n setState(status[response.data.product[0].statusCustomer]);\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isInvalid\") {\r\n setUrlAcceptTerms(response.data.product[0].urlAcceptTerm || undefined)\r\n return;\r\n }\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isRegistered\") {\r\n setUrlRegisterIndustry(response.data.product[0].informativeLink);\r\n return;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(\"PBMLOG: Error validating document -\", error);\r\n } finally {\r\n setLoading(false);\r\n };\r\n };\r\n\r\n return (\r\n <>\r\n <form\r\n onSubmit={handleSubmit(onSubmitDefault)}\r\n className={classNames(\r\n \"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150\",\r\n { \"mb-4\": errors.securityNumber || (errors.coupon && showCoupoField), \"gap-2\": showCoupoField }\r\n )}\r\n id=\"form_security_number_pbm\"\r\n >\r\n <label\r\n htmlFor=\"cpf\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_security_number_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.securityNumber, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Digite seu CPF aqui...\"\r\n required\r\n maxLength={14}\r\n {...register(\"securityNumber\", {\r\n onChange: (e) => {\r\n const formatted = toFormat(e.target.value);\r\n setValue(\"securityNumber\", formatted as string, {\r\n shouldValidate: true,\r\n });\r\n },\r\n })}\r\n defaultValue={securityNumber || \"\"}\r\n id=\"input_security_number_pbm\"\r\n />\r\n {errors.securityNumber && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"security_number_form_error\">\r\n {errors.securityNumber.message}\r\n </span>\r\n )}\r\n </label>\r\n {showCoupoField && (\r\n <label\r\n htmlFor=\"coupon\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_coupon_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.coupon, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Cupom / ID do Cartão\"\r\n {...register(\"coupon\", {\r\n required: showCoupoField ? 'Cupom / ID do Cartão obrigatório.' : false,\r\n shouldUnregister: !showCoupoField,\r\n onChange: (e) => {\r\n setValue(\"coupon\", e.target.value, {\r\n shouldValidate: showCoupoField,\r\n });\r\n },\r\n })}\r\n id=\"input_coupon_pbm\"\r\n />\r\n {errors.coupon && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"coupon_form_error\">\r\n {errors.coupon.message}\r\n </span>\r\n )}\r\n </label>\r\n )}\r\n <button\r\n type=\"submit\"\r\n className={classNames(\r\n \"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer\",\r\n { \"rounded-lg\": showCoupoField }\r\n )}\r\n id=\"button_submit_security_number_pbm\"\r\n >\r\n <ArrowRight size={24} color=\"white\" strokeWidth={2} />\r\n </button>\r\n </form>\r\n <Button\r\n 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\"\r\n onClick={() => {\r\n const newValue = !showCoupoField;\r\n setShowCoupoField(newValue);\r\n if (!newValue) {\r\n // Quando esconder o campo, desregistrar, limpar o valor e os erros\r\n unregister(\"coupon\");\r\n clearErrors(\"coupon\");\r\n }\r\n }}\r\n id=\"check_benefits_button\"\r\n >\r\n <span>{!showCoupoField ? \"Possui cupom?\" : \"Não possui cupom?\"}</span>\r\n <ArrowRight size={16} className={classNames({ \"rotate-0\": !showCoupoField, \"rotate-180\": showCoupoField })} />\r\n </Button>\r\n </>\r\n );\r\n}\r\n\r\nexport default Form;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\nexport interface IProductWithDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n urlAcceptTerm: string;\r\n informativeLink: string;\r\n productId: number;\r\n statusCustomer: \"acceptance\" | \"industry registration\" | \"active\";\r\n}\r\n\r\ninterface IResponseBenefitsWithDocument extends IRequestDefault {\r\n data: { product: IProductWithDocumentData[] };\r\n}\r\n\r\ninterface ProductRequestBody {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n netPrice: number;\r\n}\r\n\r\ninterface IBenefitsWithDocumentParams {\r\n document: string;\r\n products: ProductRequestBody[];\r\n}\r\n\r\nexport const BenefitsWithDocument = async ({ document, products }: IBenefitsWithDocumentParams): Promise<IResponseBenefitsWithDocument> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/benefitByDocument`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ consumer: { document }, products })\r\n })\r\n\r\n const dataResponse: IResponseBenefitsWithDocument = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch document validation');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { ButtonHTMLAttributes } from \"react\";\r\n\r\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction Button(props: ButtonProps) {\r\n return (\r\n <button\r\n {...props}\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors\",\r\n props.className\r\n )}\r\n >\r\n {props.children}\r\n </button>\r\n );\r\n}\r\n\r\nexport default Button;\r\n","interface LoadingProps {\r\n textColor?: string;\r\n}\r\n\r\nfunction Loading({ textColor }: LoadingProps) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n style={{ color: textColor }}\r\n id=\"loading_label\"\r\n >\r\n Um momento... estamos verificando seus dados.\r\n </p>\r\n </main>\r\n );\r\n}\r\n\r\nexport default Loading;\r\n","import { useEffect, useState } from \"react\";\r\nimport Title from \"../UI/Title\";\r\nimport Item from \"./Item\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Button from \"../UI/Button\";\r\nimport { CheckBenefistWithoutDocument } from \"../../services/benefits-without-document\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\n\r\nfunction BenefitsTable() {\r\n const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();\r\n const [selectedDiscout, setSelectedDiscount] = useState<string | null>(null);\r\n const [loading, setLoading] = useState<boolean>(true);\r\n const [benefitsItems, setBenefitsItems] = useState<IBenefitsItem[] | undefined>();\r\n\r\n useEffect(() => {\r\n const fetchDicountsWithoutDocument = async () => {\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await CheckBenefistWithoutDocument({ products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n const fetchDiscountWithDocument = async () => {\r\n if (!securityNumber) {\r\n console.error(\"PBMLOG: Document is not defined\");\r\n return;\r\n }\r\n\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await BenefitsWithDocument({ document: securityNumber, products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data.product)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n state === \"isActivated\" ?\r\n fetchDiscountWithDocument() :\r\n fetchDicountsWithoutDocument();\r\n }, [])\r\n\r\n if (loading) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n id=\"loading_label\"\r\n >\r\n Buscando beneficios disponíveis...\r\n </p>\r\n </main>\r\n )\r\n }\r\n\r\n return (\r\n <section\r\n className=\"flex items-start justify-center gap-4 w-full h-auto flex-col\"\r\n id=\"benefits_table_pbm\"\r\n >\r\n <Title>Descontos disponíveis:</Title>\r\n\r\n <form\r\n className=\"flex flex-col items-center justify-start w-full gap-4.5\"\r\n id=\"form_benefits_table_pbm\"\r\n >\r\n {!benefitsItems && (\r\n <p className=\"text-sm font-semibold text-start text-zinc-900\" id=\"benefits_empty_pbm\">Não foi possível encontrar benefícios para esse produto.</p>\r\n )}\r\n\r\n {benefitsItems && benefitsItems.map((item, index) => {\r\n const ID_INPUT = \"unity_quantity_\" + item.authorizedQuantity;\r\n\r\n return (\r\n <Item\r\n key={index}\r\n data={item}\r\n checked={selectedDiscout === ID_INPUT}\r\n onChange={() => setSelectedDiscount(ID_INPUT)}\r\n />\r\n );\r\n })}\r\n\r\n {benefitsItems && (\r\n <p className=\"w-full text-sm font-semibold text-center text-zinc-600\" id=\"benefits_empty_pbm\">{benefitsItems[0].informativeMessage}</p>\r\n )}\r\n </form>\r\n\r\n {state === \"isPreview\" && (\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n className=\"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start\"\r\n id=\"unauthorized_benefits_button\"\r\n >\r\n Atenção: Não é possível utilizar os benefícos sem realizar a consulta\r\n do CPF e o Login, por favor{\" \"}\r\n <span className=\"underline\">\r\n insira seu cpf para utilizar os benefícios\r\n </span>\r\n </Button>\r\n )}\r\n\r\n {state === \"isActivated\" && (\r\n <>\r\n {!isAuthenticatedShopper && <Button\r\n onClick={() => window.location.href = customLoginUrl || \"/login\"}\r\n 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\"\r\n id=\"login\"\r\n >\r\n <span className=\"underline\">Por favor, faça o Login para aproveitar os benefícios!</span>\r\n </Button>}\r\n\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n 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\"\r\n id=\"change_security_number\"\r\n >\r\n <span className=\"underline\">Deseja editar o cpf digitado?</span>\r\n </Button>\r\n </>\r\n )}\r\n </section>\r\n );\r\n}\r\n\r\nexport default BenefitsTable;\r\n","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TitleProps extends HTMLAttributes<HTMLTitleElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n}\r\n\r\nfunction Title(props: TitleProps) {\r\n return (\r\n <h2\r\n className={classNames(\r\n \"text-start font-semibold text-sm text-zinc-900\",\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize }}\r\n data-testid=\"test_id_title\"\r\n id=\"title_pbm\"\r\n >\r\n {props.children}\r\n </h2>\r\n );\r\n}\r\n\r\nexport default Title;\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nimport { Badge, BadgeCheck } from \"lucide-react\";\r\nimport { useCallback, useEffect } from \"react\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface ItemProps {\r\n data: IBenefitsItem;\r\n onChange: VoidFunction;\r\n checked: boolean;\r\n}\r\n\r\nfunction Item({ data, onChange, checked }: ItemProps) {\r\n const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();\r\n\r\n const ID_INPUT = \"unity_quantity_\" + data.authorizedQuantity;\r\n\r\n const decimalDiscount = data.discountPercentual / 100;\r\n\r\n const unitDiscountValue = data.grossPrice * decimalDiscount;\r\n\r\n \r\n const discountValue = unitDiscountValue * data.authorizedQuantity;\r\n\r\n const totalPriceProductWithDiscountBenefit =\r\n (data.grossPrice * data.authorizedQuantity) - discountValue;\r\n\r\n const updateStorageData = useCallback(() => {\r\n if (checked) {\r\n // Arredonda para 2 casas decimais\r\n const roundToTwoDecimals = (value: number) => Math.round(value * 100) / 100;\r\n\r\n setAvailableDiscountSelected({\r\n discount: {\r\n total: roundToTwoDecimals(discountValue),\r\n unit: roundToTwoDecimals(unitDiscountValue),\r\n },\r\n quantity: data.authorizedQuantity,\r\n totalPrice: roundToTwoDecimals(totalPriceProductWithDiscountBenefit),\r\n grossPrice: data.grossPrice\r\n });\r\n }\r\n }, [\r\n checked,\r\n data.authorizedQuantity,\r\n setAvailableDiscountSelected,\r\n discountValue,\r\n totalPriceProductWithDiscountBenefit,\r\n unitDiscountValue,\r\n ]);\r\n\r\n useEffect(() => {\r\n updateStorageData();\r\n }, [updateStorageData]);\r\n\r\n return (\r\n <label\r\n htmlFor={ID_INPUT}\r\n className={classNames(\r\n \"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\",\r\n { \"cursor-not-allowed\": state === \"isPreview\" || !isAuthenticatedShopper, \"cursor-pointer\": state === \"isActivated\" && isAuthenticatedShopper }\r\n )}\r\n id={\"label_benefits_\" + ID_INPUT}\r\n title={!isAuthenticatedShopper ? \"Necessário fazer login!\" : \"\"}\r\n >\r\n <input\r\n type=\"radio\"\r\n name=\"benefits_discount\"\r\n id={ID_INPUT}\r\n className=\"hidden\"\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={state === \"isPreview\" || !isAuthenticatedShopper}\r\n />\r\n\r\n {!checked ? (\r\n <Badge color=\"#9f9fa9\" size={20} />\r\n ) : (\r\n <BadgeCheck color=\"#32b316\" size={20} />\r\n )}\r\n\r\n <span className=\"text-zinc-900 font-semibold text-sm\">\r\n {data.authorizedQuantity}un\r\n </span>\r\n\r\n <section className=\"ml-auto relative gap-2 flex items-center-safe justify-end-safe\">\r\n <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\">\r\n {discountValue.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}{\" \"}\r\n OFF\r\n </span>\r\n <strong className=\"text-zinc-900 font-semibold text-sm text-center\">\r\n {totalPriceProductWithDiscountBenefit.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </strong>\r\n </section>\r\n </label>\r\n );\r\n}\r\n\r\nexport default Item;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface ICheckBenefitsWithoutDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n}\r\n\r\ninterface ICheckBenefitsWithoutDocumentResponse extends IRequestDefault {\r\n data: ICheckBenefitsWithoutDocumentData[];\r\n}\r\n\r\ninterface IProductsCheckBenefits {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n}\r\n\r\ninterface ICheckBenefistWithoutDocumentParams {\r\n products: IProductsCheckBenefits[];\r\n}\r\n\r\nexport const CheckBenefistWithoutDocument = async ({ products }: ICheckBenefistWithoutDocumentParams): Promise<ICheckBenefitsWithoutDocumentResponse> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/genericBenefit`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ products })\r\n })\r\n\r\n const dataResponse: ICheckBenefitsWithoutDocumentResponse = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch benefits without document');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TextProps extends HTMLAttributes<HTMLParagraphElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n textAlign?: \"start\" | \"center\" | \"end\";\r\n}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"font-normal text-sm text-zinc-900\",\r\n props.textAlign && `text-${props.textAlign}`,\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign }}\r\n data-testid=\"test_id_text\"\r\n id=\"text_pbm\"\r\n >\r\n {props.children}\r\n </p>\r\n );\r\n}\r\n\r\nexport default Text;\r\n","import { ILinkHref } from \"../../../types/globals\";\r\nimport classNames from \"classnames\";\r\nimport React from \"react\";\r\nimport { getParams } from \"../../../utils/getParams\";\r\nimport { usePBMStore } from \"../../../libs/zustand/usePBM\";\r\n\r\ninterface LinkProps {\r\n className?: string;\r\n children: React.ReactNode;\r\n href: ILinkHref | string;\r\n}\r\n\r\nfunction Link(props: LinkProps) {\r\n const { setState } = usePBMStore();\r\n\r\n return (\r\n <a\r\n {...props}\r\n target=\"_blank\"\r\n href={\r\n typeof props.href === \"string\"\r\n ? props.href\r\n : props.href.pathname + getParams(props.href.param)\r\n }\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center\",\r\n props.className\r\n )}\r\n data-testid=\"test_id_link\"\r\n id=\"link_pbm\"\r\n onClick={() => setState(\"isEmpty\")}\r\n >\r\n {props.children}\r\n </a>\r\n );\r\n}\r\n\r\nexport default Link;\r\n","export const getParams = (\r\n params: { [key: string]: string | number } | undefined\r\n) => {\r\n if (params === undefined) return \"\";\r\n\r\n return (\r\n \"?\" +\r\n Object.keys(params)\r\n .map((paramter) => paramter + \"=\" + params[paramter])\r\n .join(\"&\")\r\n );\r\n};","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\n// import Button from \"../UI/Button\";\r\n// import Iframe from \"../Iframe\";\r\n\r\n// import { useState } from \"react\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Link from \"../UI/Link\";\r\n\r\nfunction SecurityNumberInvalid({ textColor }: { textColor?: string }) {\r\n // const [openModal, setOpenModal] = useState<boolean>(false);\r\n const { urlAcceptTerms } = usePBMStore();\r\n return (\r\n <section\r\n data-testid=\"test_id_invalid\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_invalid_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n CPF não cadastrado.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Conclua seu cadastro para habilitar o benefício. <br />\r\n Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar.\r\n </Text>\r\n {/* <Button\r\n data-testid=\"test_id_openiframe\"\r\n onClick={() => setOpenModal(true)}\r\n id=\"button_accept_terms_pbm\"\r\n >\r\n Aceitar os termos\r\n </Button> */}\r\n\r\n <Link\r\n href={urlAcceptTerms || \"\"}\r\n >\r\n Aceitar os termos\r\n </Link>\r\n\r\n {/* <Iframe\r\n url={urlAcceptTerms || \"\"}\r\n title=\"Aceitar termos PBM\"\r\n openModal={openModal}\r\n setOpenModal={setOpenModal}\r\n /> */}\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberInvalid;\r\n","import Header from \"./components/Header\";\nimport Container from \"./components/UI/Container\";\nimport Footer from \"./components/Footer\";\nimport Form from \"./components/Form\";\nimport Loading from \"./components/UI/Loading\";\nimport Button from \"./components/UI/Button\";\nimport BenefitsTable from \"./components/BenefitsTable\";\nimport SecurityNumberInvalid from \"./components/SecurityNumberInvalid\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport SecurityNumberRegitered from \"./components/SecurityNumberRegitered\";\nimport { GetAuthorization } from \"./services/authorization\";\nimport { ArrowRight, RefreshCw } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\nimport Title from \"./components/UI/Title\";\nimport Text from \"./components/UI/Text\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n isAuthenticatedShopper: boolean;\n customLoginUrl?: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n isAuthenticatedShopper,\n customLoginUrl,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [isReady, setIsReady] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();\n const [EanProductExist, setEanProductExist] = useState<boolean>(true);\n\n const fetchProductByEan = async () => {\n try {\n if (!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n setEanProductExist(false);\n return\n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\n setEanProductExist(true);\n\n const { pbm, sku, ...targetProductNewData } = response.data;\n\n setTargetProduct({\n ...targetProduct,\n ...targetProductNewData,\n productId: Number(targetProductNewData.productId),\n informativeMessage: pbm.informativeMessage ?? \"\",\n discountMax: pbm.discountMax ?? 0,\n industryLogo: pbm.imageLink ?? undefined,\n ean: eanProduct\n })\n\n setIsAuthenticatedShopper(isAuthenticatedShopper);\n setCustomLoginUrl(customLoginUrl)\n }\n } catch (error) {\n console.error(error);\n } finally {\n // setIsReady(true)\n }\n }\n\n const handleAuthorizationRequest = useCallback(async () => {\n try {\n const response = await GetAuthorization({ clientID: clientID });\n\n if (response.success) {\n fetchProductByEan();\n } else {\n console.error(\"PBMLOG: Authorization failed!\");\n }\n } catch (error) {\n console.error(\"Error fetching authorization:\", error);\n }\n }, [clientID]);\n\n\n useEffect(() => {\n handleAuthorizationRequest();\n }, [handleAuthorizationRequest]);\n\n if (!isReady) {\n return (\n <div className=\"rounded-xl w-[556px] h-[358px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n hover:shadow-[0_0_30px_rgba(0,0,0,0.3)] \n transition-all duration-500 ease-in-out\">\n </div>\n )\n }\n\n if (!EanProductExist) {\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Title>Erro ao Aplicar o Benefício</Title>\n <Text textAlign=\"center\">O produto não foi encontrado no sistema. <br /> Por favor, tente novamente mais tarde ou contate o suporte.</Text>\n <Button\n 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\"\n onClick={() => window.location.reload()}\n id=\"check_benefits_button\"\n >\n <span>Tentar novamente</span>\n <RefreshCw size={16} />\n </Button>\n </Container>\n </div>\n )\n }\n\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Header originalProductPrice={formatedOriginalProductPrice || 0} />\n\n <Container variant=\"simple\">\n {state === \"isEmpty\" && !loading && (\n <>\n <Form setLoading={setLoading} />\n <Button\n 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\"\n onClick={() => setState(\"isPreview\")}\n id=\"check_benefits_button\"\n >\n <span>Consultar benefícios</span>\n <ArrowRight size={16} />\n </Button>\n </>\n )}\n\n {state === \"isEmpty\" && loading && <Loading />}\n\n {state === \"isInvalid\" && !loading && <SecurityNumberInvalid />}\n\n {state === \"isRegistered\" && !loading && <SecurityNumberRegitered />}\n\n {(state === \"isActivated\" || state === \"isPreview\") && !loading && (\n <BenefitsTable />\n )}\n </Container>\n\n <Footer />\n </Container>\n </div>\n );\n}\n\nexport default PBM;\n","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\nimport Link from \"../UI/Link\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction SecurityNumberRegitered({ textColor }: { textColor?: string }) {\r\n const { urlRegisterIndustry } = usePBMStore();\r\n\r\n return (\r\n <section\r\n data-testid=\"test_id_registered\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_registered_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n Ops, seu CPF ainda não está habilitado para este produto.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui.\r\n </Text>\r\n <Link\r\n href={urlRegisterIndustry || \"\"}\r\n >\r\n Ativar CPF\r\n </Link>\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberRegitered;\r\n","import Cookies from \"js-cookie\";\r\n\r\nexport const GetAuthorization = async ({ clientID }: { clientID: string }) => {\r\n const response = await fetch(\r\n 'https://pbm-auth-serverless.vercel.app/api/auth',\r\n {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n credentials: 'include',\r\n body: JSON.stringify({\r\n clientId: clientID\r\n })\r\n }\r\n );\r\n\r\n const data = await response.json();\r\n\r\n if (!data.success) {\r\n throw new Error('Authorization failed');\r\n }\r\n\r\n Cookies.set('pbm-token', data.tokens.token, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', data.tokens.refreshToken, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return data;\r\n};","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface IPBM {\r\n source: string;\r\n programName: string;\r\n industryName: string;\r\n discountMax: number;\r\n discountMin: number;\r\n informativeMessage: string;\r\n discountMaxNewPatient: number;\r\n discountMinNewPatient: number;\r\n discountFirstBox: number;\r\n suggestedPriceValue: string;\r\n imageLink: string | null;\r\n eanCombos: number | null;\r\n qtyDiscountMax: number;\r\n requestCoupon: string | null;\r\n}\r\n\r\nexport interface IDataRequestListProducts {\r\n productId: string;\r\n productName: string;\r\n sku: string;\r\n skuId: string;\r\n ean: string;\r\n price: number;\r\n listPrice: number;\r\n stockBalance: number;\r\n availabilityText: string;\r\n brandName: string;\r\n categoryName: string;\r\n pbm: IPBM;\r\n}\r\n\r\ninterface IResponseGetProducts extends IRequestDefault {\r\n data: IDataRequestListProducts\r\n}\r\n\r\nexport const GetProductByEAN = async ({ PRODUCT_EAN }: { PRODUCT_EAN: string }): Promise<IResponseGetProducts> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n });\r\n\r\n const dataResponse: IResponseGetProducts = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch authorization');\r\n }\r\n\r\n return dataResponse;\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAoD;AACpD,mBAAyB;AA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,+CAAC,gBAAK,WAAU,UAAS;AAAA;AAAA,QAAyC,8CAAC,QAAG;AAAA,QAAE;AAAA,SAA4D;AAAA,MACpI;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAS,MAAM,OAAO,SAAS,OAAO;AAAA,UACtC,IAAG;AAAA,UAEH;AAAA,0DAAC,UAAK,8BAAgB;AAAA,YACtB,8CAAC,kCAAU,MAAM,IAAI;AAAA;AAAA;AAAA,MACvB;AAAA,OACF,GACF;AAAA,EAEJ;AAEA,SACE,8CAAC,SAAI,IAAG,oBACN,yDAAC,qBAAU,SAAQ,QACjB;AAAA,kDAAC,kBAAO,sBAAsB,gCAAgC,GAAG;AAAA,IAEjE,+CAAC,qBAAU,SAAQ,UAChB;AAAA,gBAAU,aAAa,CAAC,WACvB,gFACE;AAAA,sDAAC,gBAAK,YAAwB;AAAA,QAC9B;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,MAAM,SAAS,WAAW;AAAA,YACnC,IAAG;AAAA,YAEH;AAAA,4DAAC,UAAK,qCAAoB;AAAA,cAC1B,8CAAC,mCAAW,MAAM,IAAI;AAAA;AAAA;AAAA,QACxB;AAAA,SACF;AAAA,MAGD,UAAU,aAAa,WAAW,8CAAC,mBAAQ;AAAA,MAE3C,UAAU,eAAe,CAAC,WAAW,8CAAC,iCAAsB;AAAA,MAE5D,UAAU,kBAAkB,CAAC,WAAW,8CAAC,mCAAwB;AAAA,OAEhE,UAAU,iBAAiB,UAAU,gBAAgB,CAAC,WACtD,8CAAC,yBAAc;AAAA,OAEnB;AAAA,IAEA,8CAAC,kBAAO;AAAA,KACV,GACF;AAEJ;AAEA,IAAO,cAAQ;","names":["import_jsx_runtime","classNames","import_classnames","import_jsx_runtime","classNames","import_classnames","import_zod","import_react","Cookies","import_classnames","import_jsx_runtime","classNames","import_jsx_runtime","classNames","import_jsx_runtime","import_react","import_classnames","import_jsx_runtime","classNames","import_lucide_react","import_react","import_classnames","import_jsx_runtime","classNames","import_js_cookie","import_meta","Cookies","import_jsx_runtime","import_classnames","import_jsx_runtime","classNames","import_classnames","import_jsx_runtime","classNames","import_jsx_runtime","import_react","import_jsx_runtime","import_js_cookie","Cookies","import_lucide_react","import_js_cookie","import_meta","Cookies","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/libs/zustand/usePBM.tsx","../src/components/Header/index.tsx","../src/components/UI/Container/index.tsx","../src/components/Footer/index.tsx","../src/schema/validation-schema.ts","../src/utils/format.ts","../src/components/Form/index.tsx","../src/services/benefits-with-document.ts","../src/components/UI/Button/index.tsx","../src/components/UI/Loading/index.tsx","../src/components/BenefitsTable/index.tsx","../src/components/UI/Title/index.tsx","../src/components/BenefitsTable/Item.tsx","../src/services/benefits-without-document.ts","../src/components/UI/Text/index.tsx","../src/components/UI/Link/index.tsx","../src/utils/getParams.ts","../src/components/SecurityNumberInvalid/index.tsx","../src/PBM.tsx","../src/components/SecurityNumberRegitered/index.tsx","../src/services/authorization.ts","../src/services/get-product-by-ean.ts"],"sourcesContent":["// Estilos - importa CSS escopado para evitar conflitos\r\nimport './pbm-scoped.css';\r\n\r\n// Componente Principal\r\nexport { default as PBM } from \"./PBM\";\r\n\r\n// Tipos\r\nexport type { PBMProps } from \"./PBM\";\r\nexport type { PBMStore } from \"./libs/zustand/usePBM\";\r\n\r\n// Hooks\r\nexport { usePBMStore } from \"./libs/zustand/usePBM\"; \r\n","import { createStore, StateCreator, StoreApi } from \"zustand\";\r\nimport { useStore } from \"zustand/react\";\r\nimport { IProduct, usePBMTypes } from \"../../types/globals\";\r\n\r\nexport interface PBMStore extends usePBMTypes {\r\n setSecurityNumber: (securityNumber: string) => void;\r\n setState: (state: usePBMTypes[\"state\"]) => void;\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => void;\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) => void;\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) => void;\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) => void;\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) => void;\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => void;\r\n}\r\n\r\n// Tipo apenas com os getters (estado readonly)\r\nexport type PBMStoreReadonly = Omit<PBMStore,\r\n | 'setSecurityNumber'\r\n | 'setState'\r\n | 'setAvailableDiscountSelected'\r\n | 'setTargetProduct'\r\n | 'setUrlAcceptTerms'\r\n | 'setUrlRegisterIndustry'\r\n>;\r\n\r\nconst initialPBMState: usePBMTypes = {\r\n securityNumber: \"\",\r\n state: \"isEmpty\",\r\n availableDiscountSelected: {\r\n quantity: 0,\r\n discount: {\r\n unit: 0,\r\n total: 0,\r\n },\r\n totalPrice: 0,\r\n grossPrice: 0\r\n },\r\n targetProduct: null,\r\n campaign: \"pbm_campaign\",\r\n isAuthenticatedShopper: false,\r\n customLoginUrl: \"/login\"\r\n};\r\n\r\nconst createPBMStore: StateCreator<PBMStore> = (set) => ({\r\n ...initialPBMState,\r\n\r\n setSecurityNumber: (securityNumber: string) => set({ securityNumber }),\r\n setState: (state: usePBMTypes[\"state\"]) => set({ state }),\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) =>\r\n set({ targetProduct }),\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => set({ availableDiscountSelected: availableDiscount }),\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) =>\r\n set({ urlAcceptTerms: urlAcceptTerms }),\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) =>\r\n set({ urlRegisterIndustry: urlRegisterIndustry }),\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) =>\r\n set({ isAuthenticatedShopper: isAuthenticatedShopper }),\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => set({ customLoginUrl: customLoginUrl })\r\n\r\n});\r\n\r\n// Store completa (uso interno na biblioteca)\r\nexport const pbmStore: StoreApi<PBMStore> = createStore<PBMStore>(createPBMStore);\r\n\r\n// Cria uma versão somente leitura da store para exposição pública\r\nexport const createReadonlyStore = (): StoreApi<PBMStoreReadonly> => {\r\n return {\r\n getState: () => {\r\n const fullState = pbmStore.getState();\r\n // Remove os setters do estado retornado\r\n const {\r\n setSecurityNumber,\r\n setState,\r\n setAvailableDiscountSelected,\r\n setTargetProduct,\r\n setUrlAcceptTerms,\r\n setUrlRegisterIndustry,\r\n setIsAuthenticatedShopper,\r\n setCustomLoginUrl,\r\n ...readonlyState\r\n } = fullState;\r\n\r\n const { quantity, productId, skuId, discountMax, netPrice, stockBalance, listPrice, price, ...limitedTargetProductData } = fullState.targetProduct as IProduct;\r\n\r\n return { ...readonlyState, targetProduct: limitedTargetProductData } as PBMStoreReadonly;\r\n }\r\n } as StoreApi<PBMStoreReadonly>;\r\n};\r\n\r\n// React hook (usado dentro de componentes React)\r\nexport function usePBMStore(): PBMStore;\r\nexport function usePBMStore<T>(selector: (state: PBMStore) => T): T;\r\nexport function usePBMStore<T>(selector?: (state: PBMStore) => T): PBMStore | T {\r\n if (selector) {\r\n return useStore(pbmStore, selector);\r\n }\r\n return useStore(pbmStore, (state) => state);\r\n}\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Header({ originalProductPrice }: { originalProductPrice: number }) {\r\n const { targetProduct } = usePBMStore();\r\n const Price = (targetProduct?.listPrice || originalProductPrice);\r\n const Discount = Price * ((targetProduct?.discountMax || 0) / 100)\r\n\r\n return (\r\n <header\r\n className=\"flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5\"\r\n id=\"header_pbm\"\r\n >\r\n <span\r\n 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\"\r\n data-testid=\"test_id_header_price\"\r\n id=\"header_price\"\r\n >\r\n <span className=\"absolute -top-6 left-10 bg-emerald-500 px-4 py-1 rounded-t-lg text-xs font-medium text-white\">{targetProduct?.discountMax}% OFF</span>\r\n\r\n <svg width=\"36px\" height=\"36px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g id=\"SVGRepo_bgCarrier\" strokeWidth=\"0\"></g>\r\n <g id=\"SVGRepo_tracerCarrier\" strokeLinecap=\"round\" strokeLinejoin=\"round\"></g>\r\n <g id=\"SVGRepo_iconCarrier\">\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n </g>\r\n </svg>\r\n\r\n <section className=\"flex flex-col items-start justify-center-safe gap-0\">\r\n <span className=\"line-through text-sm font-light\">\r\n {Number(Price)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </span>\r\n {Number(Price - Discount)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </section>\r\n </span>\r\n <h1 id=\"header_title\" className=\"text-center w-full text-[#339c9b] font-bold text-xs px-4 md:text-sm\">\r\n Desconto de Laboratório\r\n </h1>\r\n </header>\r\n );\r\n}\r\n\r\nexport default Header;\r\n","import classNames from \"classnames\";\r\nimport React from \"react\";\r\n\r\nfunction Container({\r\n children,\r\n variant,\r\n}: {\r\n children: React.ReactNode;\r\n variant: \"simple\" | \"main\";\r\n}) {\r\n return (\r\n <main\r\n className={classNames({\r\n \"border-3 border-[#44c2c0] flex flex-col items-center justify-center min-w-[var(--min-container)] max-w-[var(--max-container)] w-full h-auto rounded-xl p-4 bg-white gap-4 relative\":\r\n variant === \"main\",\r\n \"w-full h-auto relative\": variant === \"simple\",\r\n })}\r\n data-testid=\"test_id_container\"\r\n data-variant={variant}\r\n id=\"container_pbm\"\r\n >\r\n {children}\r\n </main>\r\n );\r\n}\r\n\r\nexport default Container;\r\n","import classNames from \"classnames\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Footer() {\r\n const { targetProduct, setTargetProduct, state } = usePBMStore();\r\n\r\n return (\r\n <footer className=\"w-full h-auto relative\" id=\"footer_pbm\">\r\n {(state !== \"isActivated\" && targetProduct?.informativeMessage) && <p className=\"text-start mb-3 font-semibold text-sm text-amber-500\">{targetProduct?.informativeMessage}</p>}\r\n\r\n <section className={classNames(\"flex items-center w-full h-auto gap-4\", { \"justify-center\": targetProduct?.industryLogo, \"justify-start\": !targetProduct?.industryLogo })}>\r\n <section className=\"w-4/5 h-auto\">\r\n <h3 className=\"text-start font-semibold text-sm\">\r\n Economize com o benefício do laboratório.\r\n </h3>\r\n <p className=\"text-start font-normal text-sm\">\r\n Este produto tem preço exclusivo para clientes cadastrados no\r\n programa.\r\n </p>\r\n </section>\r\n {targetProduct?.industryLogo && (\r\n <img\r\n src={targetProduct.industryLogo}\r\n alt=\"parceiro\"\r\n className=\"w-1/5 min-w-20 h-auto aspect-auto rounded-xl\"\r\n loading=\"eager\"\r\n id=\"footer_industry_logo_pbm\"\r\n data-testid=\"footer_industry_logo_pbm\"\r\n />\r\n )}\r\n </section>\r\n </footer>\r\n );\r\n}\r\n\r\nexport default Footer;\r\n","import { z } from \"zod\";\r\n\r\nexport const validationSchema = z.object({\r\n securityNumber: z\r\n .string({\r\n required_error: 'CPF é obrigatório.',\r\n })\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return replacedDoc.length >= 11;\r\n }, 'CPF deve conter no mínimo 11 caracteres.')\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return !!Number(replacedDoc);\r\n }, 'CPF deve conter apenas números.'),\r\n\r\n coupon: z.string({ required_error: 'Cupom / ID do Cartão obrigatório.'}).optional()\r\n});\r\n\r\nexport type validationSchemaType = z.infer<typeof validationSchema>","export const toFormat = (value: string) => {\r\n const cleanedValue = value.replace(/\\D/g, '');\r\n\r\n if (cleanedValue.length <= 11) {\r\n return cleanedValue\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d{1,2})/, '$1-$2')\r\n .replace(/(-\\d{2})\\d+?$/, '$1');\r\n }\r\n};","import {\r\n validationSchema,\r\n validationSchemaType,\r\n} from \"../../schema/validation-schema\";\r\nimport { toFormat } from \"../../utils/format\";\r\n\r\nimport classNames from \"classnames\";\r\nimport { zodResolver } from \"@hookform/resolvers/zod\";\r\nimport { useForm } from \"react-hook-form\";\r\n\r\nimport { ArrowRight } from \"lucide-react\";\r\nimport { Dispatch, SetStateAction, useState } from \"react\";\r\n\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\nimport Button from \"../UI/Button\";\r\n\r\ninterface IForm {\r\n setLoading: Dispatch<SetStateAction<boolean>>;\r\n}\r\n\r\nfunction Form({ setLoading }: IForm) {\r\n const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();\r\n const [showCoupoField, setShowCoupoField] = useState<boolean>(false);\r\n\r\n const {\r\n handleSubmit,\r\n register,\r\n setValue,\r\n clearErrors,\r\n unregister,\r\n formState: { errors },\r\n } = useForm<validationSchemaType>({\r\n resolver: zodResolver(validationSchema),\r\n mode: 'onSubmit',\r\n defaultValues: {\r\n securityNumber: securityNumber || \"\",\r\n coupon: \"\",\r\n },\r\n });\r\n\r\n const onSubmitDefault = async (values: validationSchemaType) => {\r\n if (!showCoupoField) {\r\n setValue(\"coupon\", undefined, { shouldValidate: false });\r\n }\r\n\r\n setLoading(true);\r\n\r\n try {\r\n if (targetProduct === null) {\r\n console.error(\"PBMLOG: Product is not defined!\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined!\");\r\n return\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined!\");\r\n return\r\n }\r\n\r\n const response = await BenefitsWithDocument({\r\n document: values.securityNumber.replace(/\\D/g, ''),\r\n products: [{\r\n productId: targetProduct.productId,\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.netPrice ?? targetProduct.listPrice\r\n }]\r\n });\r\n\r\n if (response.success) {\r\n const status: Record<\"acceptance\" | \"industry registration\" | \"active\", \"isRegistered\" | \"isActivated\" | \"isInvalid\" | \"isEmpty\"> = {\r\n \"acceptance\": \"isInvalid\",\r\n \"industry registration\": \"isRegistered\",\r\n \"active\": \"isActivated\"\r\n }\r\n\r\n setSecurityNumber(values.securityNumber);\r\n setState(status[response.data.product[0].statusCustomer]);\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isInvalid\") {\r\n setUrlAcceptTerms(response.data.product[0].urlAcceptTerm || undefined)\r\n return;\r\n }\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isRegistered\") {\r\n setUrlRegisterIndustry(response.data.product[0].informativeLink);\r\n return;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(\"PBMLOG: Error validating document -\", error);\r\n } finally {\r\n setLoading(false);\r\n };\r\n };\r\n\r\n return (\r\n <>\r\n <form\r\n onSubmit={handleSubmit(onSubmitDefault)}\r\n className={classNames(\r\n \"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150\",\r\n { \"mb-4\": errors.securityNumber || (errors.coupon && showCoupoField), \"gap-2\": showCoupoField }\r\n )}\r\n id=\"form_security_number_pbm\"\r\n >\r\n <label\r\n htmlFor=\"cpf\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_security_number_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.securityNumber, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Digite seu CPF aqui...\"\r\n required\r\n maxLength={14}\r\n {...register(\"securityNumber\", {\r\n onChange: (e) => {\r\n const formatted = toFormat(e.target.value);\r\n setValue(\"securityNumber\", formatted as string, {\r\n shouldValidate: true,\r\n });\r\n },\r\n })}\r\n defaultValue={securityNumber || \"\"}\r\n id=\"input_security_number_pbm\"\r\n />\r\n {errors.securityNumber && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"security_number_form_error\">\r\n {errors.securityNumber.message}\r\n </span>\r\n )}\r\n </label>\r\n {showCoupoField && (\r\n <label\r\n htmlFor=\"coupon\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_coupon_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.coupon, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Cupom / ID do Cartão\"\r\n {...register(\"coupon\", {\r\n required: showCoupoField ? 'Cupom / ID do Cartão obrigatório.' : false,\r\n shouldUnregister: !showCoupoField,\r\n onChange: (e) => {\r\n setValue(\"coupon\", e.target.value, {\r\n shouldValidate: showCoupoField,\r\n });\r\n },\r\n })}\r\n id=\"input_coupon_pbm\"\r\n />\r\n {errors.coupon && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"coupon_form_error\">\r\n {errors.coupon.message}\r\n </span>\r\n )}\r\n </label>\r\n )}\r\n <button\r\n type=\"submit\"\r\n className={classNames(\r\n \"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer\",\r\n { \"rounded-lg\": showCoupoField }\r\n )}\r\n id=\"button_submit_security_number_pbm\"\r\n >\r\n <ArrowRight size={24} color=\"white\" strokeWidth={2} />\r\n </button>\r\n </form>\r\n <Button\r\n 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\"\r\n onClick={() => {\r\n const newValue = !showCoupoField;\r\n setShowCoupoField(newValue);\r\n if (!newValue) {\r\n // Quando esconder o campo, desregistrar, limpar o valor e os erros\r\n unregister(\"coupon\");\r\n clearErrors(\"coupon\");\r\n }\r\n }}\r\n id=\"check_benefits_button\"\r\n >\r\n <span>{!showCoupoField ? \"Possui cupom?\" : \"Não possui cupom?\"}</span>\r\n <ArrowRight size={16} className={classNames({ \"rotate-0\": !showCoupoField, \"rotate-180\": showCoupoField })} />\r\n </Button>\r\n </>\r\n );\r\n}\r\n\r\nexport default Form;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\nexport interface IProductWithDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n urlAcceptTerm: string;\r\n informativeLink: string;\r\n productId: number;\r\n statusCustomer: \"acceptance\" | \"industry registration\" | \"active\";\r\n}\r\n\r\ninterface IResponseBenefitsWithDocument extends IRequestDefault {\r\n data: { product: IProductWithDocumentData[] };\r\n}\r\n\r\ninterface ProductRequestBody {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n netPrice: number;\r\n}\r\n\r\ninterface IBenefitsWithDocumentParams {\r\n document: string;\r\n products: ProductRequestBody[];\r\n}\r\n\r\nexport const BenefitsWithDocument = async ({ document, products }: IBenefitsWithDocumentParams): Promise<IResponseBenefitsWithDocument> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/benefitByDocument`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ consumer: { document }, products })\r\n })\r\n\r\n const dataResponse: IResponseBenefitsWithDocument = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch document validation');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { ButtonHTMLAttributes } from \"react\";\r\n\r\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction Button(props: ButtonProps) {\r\n return (\r\n <button\r\n {...props}\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors\",\r\n props.className\r\n )}\r\n >\r\n {props.children}\r\n </button>\r\n );\r\n}\r\n\r\nexport default Button;\r\n","interface LoadingProps {\r\n textColor?: string;\r\n}\r\n\r\nfunction Loading({ textColor }: LoadingProps) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n style={{ color: textColor }}\r\n id=\"loading_label\"\r\n >\r\n Um momento... estamos verificando seus dados.\r\n </p>\r\n </main>\r\n );\r\n}\r\n\r\nexport default Loading;\r\n","import { useEffect, useState } from \"react\";\r\nimport Title from \"../UI/Title\";\r\nimport Item from \"./Item\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Button from \"../UI/Button\";\r\nimport { CheckBenefistWithoutDocument } from \"../../services/benefits-without-document\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\n\r\nfunction BenefitsTable() {\r\n const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();\r\n const [selectedDiscout, setSelectedDiscount] = useState<string | null>(null);\r\n const [loading, setLoading] = useState<boolean>(true);\r\n const [benefitsItems, setBenefitsItems] = useState<IBenefitsItem[] | undefined>();\r\n\r\n useEffect(() => {\r\n const fetchDicountsWithoutDocument = async () => {\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await CheckBenefistWithoutDocument({ products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n const fetchDiscountWithDocument = async () => {\r\n if (!securityNumber) {\r\n console.error(\"PBMLOG: Document is not defined\");\r\n return;\r\n }\r\n\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await BenefitsWithDocument({ document: securityNumber, products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data.product)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n state === \"isActivated\" ?\r\n fetchDiscountWithDocument() :\r\n fetchDicountsWithoutDocument();\r\n }, [])\r\n\r\n if (loading) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n id=\"loading_label\"\r\n >\r\n Buscando beneficios disponíveis...\r\n </p>\r\n </main>\r\n )\r\n }\r\n\r\n return (\r\n <section\r\n className=\"flex items-start justify-center gap-4 w-full h-auto flex-col\"\r\n id=\"benefits_table_pbm\"\r\n >\r\n <Title>Descontos disponíveis:</Title>\r\n\r\n <form\r\n className=\"flex flex-col items-center justify-start w-full gap-4.5\"\r\n id=\"form_benefits_table_pbm\"\r\n >\r\n {!benefitsItems && (\r\n <p className=\"text-sm font-semibold text-start text-zinc-900\" id=\"benefits_empty_pbm\">Não foi possível encontrar benefícios para esse produto.</p>\r\n )}\r\n\r\n {benefitsItems && benefitsItems.map((item, index) => {\r\n const ID_INPUT = \"unity_quantity_\" + item.authorizedQuantity;\r\n\r\n return (\r\n <Item\r\n key={index}\r\n data={item}\r\n checked={selectedDiscout === ID_INPUT}\r\n onChange={() => setSelectedDiscount(ID_INPUT)}\r\n />\r\n );\r\n })}\r\n\r\n {benefitsItems && (\r\n <p className=\"w-full text-sm font-semibold text-center text-zinc-600\" id=\"benefits_empty_pbm\">{benefitsItems[0].informativeMessage}</p>\r\n )}\r\n </form>\r\n\r\n {state === \"isPreview\" && (\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n className=\"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start\"\r\n id=\"unauthorized_benefits_button\"\r\n >\r\n Atenção: Não é possível utilizar os benefícos sem realizar a consulta\r\n do CPF e o Login, por favor{\" \"}\r\n <span className=\"underline\">\r\n insira seu cpf para utilizar os benefícios\r\n </span>\r\n </Button>\r\n )}\r\n\r\n {state === \"isActivated\" && (\r\n <>\r\n {!isAuthenticatedShopper && <Button\r\n onClick={() => window.location.href = customLoginUrl || \"/login\"}\r\n 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\"\r\n id=\"login\"\r\n >\r\n <span className=\"underline\">Por favor, faça o Login para aproveitar os benefícios!</span>\r\n </Button>}\r\n\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n 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\"\r\n id=\"change_security_number\"\r\n >\r\n <span className=\"underline\">Deseja editar o cpf digitado?</span>\r\n </Button>\r\n </>\r\n )}\r\n </section>\r\n );\r\n}\r\n\r\nexport default BenefitsTable;\r\n","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TitleProps extends HTMLAttributes<HTMLTitleElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n}\r\n\r\nfunction Title(props: TitleProps) {\r\n return (\r\n <h2\r\n className={classNames(\r\n \"text-start font-semibold text-sm text-zinc-900\",\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize }}\r\n data-testid=\"test_id_title\"\r\n id=\"title_pbm\"\r\n >\r\n {props.children}\r\n </h2>\r\n );\r\n}\r\n\r\nexport default Title;\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nimport { Badge, BadgeCheck } from \"lucide-react\";\r\nimport { useCallback, useEffect } from \"react\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface ItemProps {\r\n data: IBenefitsItem;\r\n onChange: VoidFunction;\r\n checked: boolean;\r\n}\r\n\r\nfunction Item({ data, onChange, checked }: ItemProps) {\r\n const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();\r\n\r\n const ID_INPUT = \"unity_quantity_\" + data.authorizedQuantity;\r\n\r\n const decimalDiscount = data.discountPercentual / 100;\r\n\r\n const unitDiscountValue = data.grossPrice * decimalDiscount;\r\n\r\n \r\n const discountValue = unitDiscountValue * data.authorizedQuantity;\r\n\r\n const totalPriceProductWithDiscountBenefit =\r\n (data.grossPrice * data.authorizedQuantity) - discountValue;\r\n\r\n const updateStorageData = useCallback(() => {\r\n if (checked) {\r\n // Arredonda para 2 casas decimais\r\n const roundToTwoDecimals = (value: number) => Math.round(value * 100) / 100;\r\n\r\n setAvailableDiscountSelected({\r\n discount: {\r\n total: roundToTwoDecimals(discountValue),\r\n unit: roundToTwoDecimals(unitDiscountValue),\r\n },\r\n quantity: data.authorizedQuantity,\r\n totalPrice: roundToTwoDecimals(totalPriceProductWithDiscountBenefit),\r\n grossPrice: data.grossPrice\r\n });\r\n }\r\n }, [\r\n checked,\r\n data.authorizedQuantity,\r\n setAvailableDiscountSelected,\r\n discountValue,\r\n totalPriceProductWithDiscountBenefit,\r\n unitDiscountValue,\r\n ]);\r\n\r\n useEffect(() => {\r\n updateStorageData();\r\n }, [updateStorageData]);\r\n\r\n return (\r\n <label\r\n htmlFor={ID_INPUT}\r\n className={classNames(\r\n \"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\",\r\n { \"cursor-not-allowed\": state === \"isPreview\" || !isAuthenticatedShopper, \"cursor-pointer\": state === \"isActivated\" && isAuthenticatedShopper }\r\n )}\r\n id={\"label_benefits_\" + ID_INPUT}\r\n title={!isAuthenticatedShopper ? \"Necessário fazer login!\" : \"\"}\r\n >\r\n <input\r\n type=\"radio\"\r\n name=\"benefits_discount\"\r\n id={ID_INPUT}\r\n className=\"hidden\"\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={state === \"isPreview\" || !isAuthenticatedShopper}\r\n />\r\n\r\n {!checked ? (\r\n <Badge color=\"#9f9fa9\" size={20} />\r\n ) : (\r\n <BadgeCheck color=\"#32b316\" size={20} />\r\n )}\r\n\r\n <span className=\"text-zinc-900 font-semibold text-sm\">\r\n {data.authorizedQuantity}un\r\n </span>\r\n\r\n <section className=\"ml-auto relative gap-2 flex items-center-safe justify-end-safe\">\r\n <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\">\r\n {discountValue.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}{\" \"}\r\n OFF\r\n </span>\r\n <strong className=\"text-zinc-900 font-semibold text-sm text-center\">\r\n {totalPriceProductWithDiscountBenefit.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </strong>\r\n </section>\r\n </label>\r\n );\r\n}\r\n\r\nexport default Item;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface ICheckBenefitsWithoutDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n}\r\n\r\ninterface ICheckBenefitsWithoutDocumentResponse extends IRequestDefault {\r\n data: ICheckBenefitsWithoutDocumentData[];\r\n}\r\n\r\ninterface IProductsCheckBenefits {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n}\r\n\r\ninterface ICheckBenefistWithoutDocumentParams {\r\n products: IProductsCheckBenefits[];\r\n}\r\n\r\nexport const CheckBenefistWithoutDocument = async ({ products }: ICheckBenefistWithoutDocumentParams): Promise<ICheckBenefitsWithoutDocumentResponse> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/genericBenefit`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ products })\r\n })\r\n\r\n const dataResponse: ICheckBenefitsWithoutDocumentResponse = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch benefits without document');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TextProps extends HTMLAttributes<HTMLParagraphElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n textAlign?: \"start\" | \"center\" | \"end\";\r\n}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"font-normal text-sm text-zinc-900\",\r\n props.textAlign && `text-${props.textAlign}`,\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign }}\r\n data-testid=\"test_id_text\"\r\n id=\"text_pbm\"\r\n >\r\n {props.children}\r\n </p>\r\n );\r\n}\r\n\r\nexport default Text;\r\n","import { ILinkHref } from \"../../../types/globals\";\r\nimport classNames from \"classnames\";\r\nimport React from \"react\";\r\nimport { getParams } from \"../../../utils/getParams\";\r\nimport { usePBMStore } from \"../../../libs/zustand/usePBM\";\r\n\r\ninterface LinkProps {\r\n className?: string;\r\n children: React.ReactNode;\r\n href: ILinkHref | string;\r\n}\r\n\r\nfunction Link(props: LinkProps) {\r\n const { setState } = usePBMStore();\r\n\r\n return (\r\n <a\r\n {...props}\r\n target=\"_blank\"\r\n href={\r\n typeof props.href === \"string\"\r\n ? props.href\r\n : props.href.pathname + getParams(props.href.param)\r\n }\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center\",\r\n props.className\r\n )}\r\n data-testid=\"test_id_link\"\r\n id=\"link_pbm\"\r\n onClick={() => setState(\"isEmpty\")}\r\n >\r\n {props.children}\r\n </a>\r\n );\r\n}\r\n\r\nexport default Link;\r\n","export const getParams = (\r\n params: { [key: string]: string | number } | undefined\r\n) => {\r\n if (params === undefined) return \"\";\r\n\r\n return (\r\n \"?\" +\r\n Object.keys(params)\r\n .map((paramter) => paramter + \"=\" + params[paramter])\r\n .join(\"&\")\r\n );\r\n};","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\n// import Button from \"../UI/Button\";\r\n// import Iframe from \"../Iframe\";\r\n\r\n// import { useState } from \"react\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Link from \"../UI/Link\";\r\n\r\nfunction SecurityNumberInvalid({ textColor }: { textColor?: string }) {\r\n // const [openModal, setOpenModal] = useState<boolean>(false);\r\n const { urlAcceptTerms } = usePBMStore();\r\n return (\r\n <section\r\n data-testid=\"test_id_invalid\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_invalid_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n CPF não cadastrado.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Conclua seu cadastro para habilitar o benefício. <br />\r\n Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar.\r\n </Text>\r\n {/* <Button\r\n data-testid=\"test_id_openiframe\"\r\n onClick={() => setOpenModal(true)}\r\n id=\"button_accept_terms_pbm\"\r\n >\r\n Aceitar os termos\r\n </Button> */}\r\n\r\n <Link\r\n href={urlAcceptTerms || \"\"}\r\n >\r\n Aceitar os termos\r\n </Link>\r\n\r\n {/* <Iframe\r\n url={urlAcceptTerms || \"\"}\r\n title=\"Aceitar termos PBM\"\r\n openModal={openModal}\r\n setOpenModal={setOpenModal}\r\n /> */}\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberInvalid;\r\n","import Header from \"./components/Header\";\nimport Container from \"./components/UI/Container\";\nimport Footer from \"./components/Footer\";\nimport Form from \"./components/Form\";\nimport Loading from \"./components/UI/Loading\";\nimport Button from \"./components/UI/Button\";\nimport BenefitsTable from \"./components/BenefitsTable\";\nimport SecurityNumberInvalid from \"./components/SecurityNumberInvalid\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport SecurityNumberRegitered from \"./components/SecurityNumberRegitered\";\nimport { GetAuthorization } from \"./services/authorization\";\nimport { ArrowRight, RefreshCw } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\nimport Title from \"./components/UI/Title\";\nimport Text from \"./components/UI/Text\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n isAuthenticatedShopper: boolean;\n customLoginUrl?: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n isAuthenticatedShopper,\n customLoginUrl,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [isReady, setIsReady] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();\n const [EanProductExist, setEanProductExist] = useState<boolean>(true);\n\n const fetchProductByEan = async () => {\n try {\n if (!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n setEanProductExist(false);\n return\n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\n setEanProductExist(true);\n\n const { pbm, sku, ...targetProductNewData } = response.data;\n\n setTargetProduct({\n ...targetProduct,\n ...targetProductNewData,\n productId: Number(targetProductNewData.productId),\n informativeMessage: pbm.informativeMessage ?? \"\",\n discountMax: pbm.discountMax ?? 0,\n industryLogo: pbm.imageLink ?? undefined,\n ean: eanProduct\n })\n\n setIsAuthenticatedShopper(isAuthenticatedShopper);\n setCustomLoginUrl(customLoginUrl)\n }\n } catch (error) {\n console.error(error);\n } finally {\n setIsReady(true)\n }\n }\n\n const handleAuthorizationRequest = useCallback(async () => {\n try {\n const response = await GetAuthorization({ clientID: clientID });\n\n if (response.success) {\n fetchProductByEan();\n } else {\n console.error(\"PBMLOG: Authorization failed!\");\n }\n } catch (error) {\n console.error(\"Error fetching authorization:\", error);\n }\n }, [clientID]);\n\n\n useEffect(() => {\n handleAuthorizationRequest();\n }, [handleAuthorizationRequest]);\n\n if (!isReady) {\n return (\n <div className=\"rounded-xl w-[250px] h-[250px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n transition-all duration-500 ease-in-out\">\n </div>\n )\n }\n\n if (!EanProductExist) {\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Title>Erro ao Aplicar o Benefício</Title>\n <Text textAlign=\"center\">O produto não foi encontrado no sistema. <br /> Por favor, tente novamente mais tarde ou contate o suporte.</Text>\n <Button\n 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\"\n onClick={() => window.location.reload()}\n id=\"check_benefits_button\"\n >\n <span>Tentar novamente</span>\n <RefreshCw size={16} />\n </Button>\n </Container>\n </div>\n )\n }\n\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Header originalProductPrice={formatedOriginalProductPrice || 0} />\n\n <Container variant=\"simple\">\n {state === \"isEmpty\" && !loading && (\n <>\n <Form setLoading={setLoading} />\n <Button\n 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\"\n onClick={() => setState(\"isPreview\")}\n id=\"check_benefits_button\"\n >\n <span>Consultar benefícios</span>\n <ArrowRight size={16} />\n </Button>\n </>\n )}\n\n {state === \"isEmpty\" && loading && <Loading />}\n\n {state === \"isInvalid\" && !loading && <SecurityNumberInvalid />}\n\n {state === \"isRegistered\" && !loading && <SecurityNumberRegitered />}\n\n {(state === \"isActivated\" || state === \"isPreview\") && !loading && (\n <BenefitsTable />\n )}\n </Container>\n\n <Footer />\n </Container>\n </div>\n );\n}\n\nexport default PBM;\n","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\nimport Link from \"../UI/Link\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction SecurityNumberRegitered({ textColor }: { textColor?: string }) {\r\n const { urlRegisterIndustry } = usePBMStore();\r\n\r\n return (\r\n <section\r\n data-testid=\"test_id_registered\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_registered_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n Ops, seu CPF ainda não está habilitado para este produto.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui.\r\n </Text>\r\n <Link\r\n href={urlRegisterIndustry || \"\"}\r\n >\r\n Ativar CPF\r\n </Link>\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberRegitered;\r\n","import Cookies from \"js-cookie\";\r\n\r\nexport const GetAuthorization = async ({ clientID }: { clientID: string }) => {\r\n const response = await fetch(\r\n 'https://pbm-auth-serverless.vercel.app/api/auth',\r\n {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n credentials: 'include',\r\n body: JSON.stringify({\r\n clientId: clientID\r\n })\r\n }\r\n );\r\n\r\n const data = await response.json();\r\n\r\n if (!data.success) {\r\n throw new Error('Authorization failed');\r\n }\r\n\r\n Cookies.set('pbm-token', data.tokens.token, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', data.tokens.refreshToken, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return data;\r\n};","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface IPBM {\r\n source: string;\r\n programName: string;\r\n industryName: string;\r\n discountMax: number;\r\n discountMin: number;\r\n informativeMessage: string;\r\n discountMaxNewPatient: number;\r\n discountMinNewPatient: number;\r\n discountFirstBox: number;\r\n suggestedPriceValue: string;\r\n imageLink: string | null;\r\n eanCombos: number | null;\r\n qtyDiscountMax: number;\r\n requestCoupon: string | null;\r\n}\r\n\r\nexport interface IDataRequestListProducts {\r\n productId: string;\r\n productName: string;\r\n sku: string;\r\n skuId: string;\r\n ean: string;\r\n price: number;\r\n listPrice: number;\r\n stockBalance: number;\r\n availabilityText: string;\r\n brandName: string;\r\n categoryName: string;\r\n pbm: IPBM;\r\n}\r\n\r\ninterface IResponseGetProducts extends IRequestDefault {\r\n data: IDataRequestListProducts\r\n}\r\n\r\nexport const GetProductByEAN = async ({ PRODUCT_EAN }: { PRODUCT_EAN: string }): Promise<IResponseGetProducts> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n });\r\n\r\n const dataResponse: IResponseGetProducts = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch authorization');\r\n }\r\n\r\n return dataResponse;\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAoD;AACpD,mBAAyB;AA0BzB,IAAM,kBAA+B;AAAA,EACnC,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV,wBAAwB;AAAA,EACxB,gBAAgB;AAClB;AAEA,IAAM,iBAAyC,CAAC,SAAS;AAAA,EACvD,GAAG;AAAA,EAEH,mBAAmB,CAAC,mBAA2B,IAAI,EAAE,eAAe,CAAC;AAAA,EACrE,UAAU,CAAC,UAAgC,IAAI,EAAE,MAAM,CAAC;AAAA,EACxD,kBAAkB,CAAC,kBACjB,IAAI,EAAE,cAAc,CAAC;AAAA,EACvB,8BAA8B,CAC5B,sBACG,IAAI,EAAE,2BAA2B,kBAAkB,CAAC;AAAA,EACzD,mBAAmB,CAAC,mBAClB,IAAI,EAAE,eAA+B,CAAC;AAAA,EACxC,wBAAwB,CAAC,wBACvB,IAAI,EAAE,oBAAyC,CAAC;AAAA,EAClD,2BAA2B,CAAC,2BAC1B,IAAI,EAAE,uBAA+C,CAAC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ACxB;AAAA,SACF;AAAA,MAGD,UAAU,aAAa,WAAW,8CAAC,mBAAQ;AAAA,MAE3C,UAAU,eAAe,CAAC,WAAW,8CAAC,iCAAsB;AAAA,MAE5D,UAAU,kBAAkB,CAAC,WAAW,8CAAC,mCAAwB;AAAA,OAEhE,UAAU,iBAAiB,UAAU,gBAAgB,CAAC,WACtD,8CAAC,yBAAc;AAAA,OAEnB;AAAA,IAEA,8CAAC,kBAAO;AAAA,KACV,GACF;AAEJ;AAEA,IAAO,cAAQ;","names":["import_jsx_runtime","classNames","import_classnames","import_jsx_runtime","classNames","import_classnames","import_zod","import_react","Cookies","import_classnames","import_jsx_runtime","classNames","import_jsx_runtime","classNames","import_jsx_runtime","import_react","import_classnames","import_jsx_runtime","classNames","import_lucide_react","import_react","import_classnames","import_jsx_runtime","classNames","import_js_cookie","import_meta","Cookies","import_jsx_runtime","import_classnames","import_jsx_runtime","classNames","import_classnames","import_jsx_runtime","classNames","import_jsx_runtime","import_react","import_jsx_runtime","import_js_cookie","Cookies","import_lucide_react","import_js_cookie","import_meta","Cookies","import_jsx_runtime"]}
package/dist/index.mjs CHANGED
@@ -957,6 +957,7 @@ function PBM({
957
957
  } catch (error) {
958
958
  console.error(error);
959
959
  } finally {
960
+ setIsReady(true);
960
961
  }
961
962
  };
962
963
  const handleAuthorizationRequest = useCallback2(async () => {
@@ -975,7 +976,7 @@ function PBM({
975
976
  handleAuthorizationRequest();
976
977
  }, [handleAuthorizationRequest]);
977
978
  if (!isReady) {
978
- return /* @__PURE__ */ jsx14("div", { className: "rounded-xl w-[556px] h-[358px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n hover:shadow-[0_0_30px_rgba(0,0,0,0.3)] \n transition-all duration-500 ease-in-out" });
979
+ return /* @__PURE__ */ jsx14("div", { className: "rounded-xl w-[250px] h-[250px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n transition-all duration-500 ease-in-out" });
979
980
  }
980
981
  if (!EanProductExist) {
981
982
  return /* @__PURE__ */ jsx14("div", { id: "pbm-library-root", children: /* @__PURE__ */ jsxs9(Container_default, { variant: "main", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/libs/zustand/usePBM.tsx","../src/components/Header/index.tsx","../src/components/UI/Container/index.tsx","../src/components/Footer/index.tsx","../src/schema/validation-schema.ts","../src/utils/format.ts","../src/components/Form/index.tsx","../src/services/benefits-with-document.ts","../src/components/UI/Button/index.tsx","../src/components/UI/Loading/index.tsx","../src/components/BenefitsTable/index.tsx","../src/components/UI/Title/index.tsx","../src/components/BenefitsTable/Item.tsx","../src/services/benefits-without-document.ts","../src/components/UI/Text/index.tsx","../src/components/UI/Link/index.tsx","../src/utils/getParams.ts","../src/components/SecurityNumberInvalid/index.tsx","../src/PBM.tsx","../src/components/SecurityNumberRegitered/index.tsx","../src/services/authorization.ts","../src/services/get-product-by-ean.ts"],"sourcesContent":["import { createStore, StateCreator, StoreApi } from \"zustand\";\r\nimport { useStore } from \"zustand/react\";\r\nimport { IProduct, usePBMTypes } from \"../../types/globals\";\r\n\r\nexport interface PBMStore extends usePBMTypes {\r\n setSecurityNumber: (securityNumber: string) => void;\r\n setState: (state: usePBMTypes[\"state\"]) => void;\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => void;\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) => void;\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) => void;\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) => void;\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) => void;\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => void;\r\n}\r\n\r\n// Tipo apenas com os getters (estado readonly)\r\nexport type PBMStoreReadonly = Omit<PBMStore,\r\n | 'setSecurityNumber'\r\n | 'setState'\r\n | 'setAvailableDiscountSelected'\r\n | 'setTargetProduct'\r\n | 'setUrlAcceptTerms'\r\n | 'setUrlRegisterIndustry'\r\n>;\r\n\r\nconst initialPBMState: usePBMTypes = {\r\n securityNumber: \"\",\r\n state: \"isEmpty\",\r\n availableDiscountSelected: {\r\n quantity: 0,\r\n discount: {\r\n unit: 0,\r\n total: 0,\r\n },\r\n totalPrice: 0,\r\n grossPrice: 0\r\n },\r\n targetProduct: null,\r\n campaign: \"pbm_campaign\",\r\n isAuthenticatedShopper: false,\r\n customLoginUrl: \"/login\"\r\n};\r\n\r\nconst createPBMStore: StateCreator<PBMStore> = (set) => ({\r\n ...initialPBMState,\r\n\r\n setSecurityNumber: (securityNumber: string) => set({ securityNumber }),\r\n setState: (state: usePBMTypes[\"state\"]) => set({ state }),\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) =>\r\n set({ targetProduct }),\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => set({ availableDiscountSelected: availableDiscount }),\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) =>\r\n set({ urlAcceptTerms: urlAcceptTerms }),\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) =>\r\n set({ urlRegisterIndustry: urlRegisterIndustry }),\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) =>\r\n set({ isAuthenticatedShopper: isAuthenticatedShopper }),\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => set({ customLoginUrl: customLoginUrl })\r\n\r\n});\r\n\r\n// Store completa (uso interno na biblioteca)\r\nexport const pbmStore: StoreApi<PBMStore> = createStore<PBMStore>(createPBMStore);\r\n\r\n// Cria uma versão somente leitura da store para exposição pública\r\nexport const createReadonlyStore = (): StoreApi<PBMStoreReadonly> => {\r\n return {\r\n getState: () => {\r\n const fullState = pbmStore.getState();\r\n // Remove os setters do estado retornado\r\n const {\r\n setSecurityNumber,\r\n setState,\r\n setAvailableDiscountSelected,\r\n setTargetProduct,\r\n setUrlAcceptTerms,\r\n setUrlRegisterIndustry,\r\n setIsAuthenticatedShopper,\r\n setCustomLoginUrl,\r\n ...readonlyState\r\n } = fullState;\r\n\r\n const { quantity, productId, skuId, discountMax, netPrice, stockBalance, listPrice, price, ...limitedTargetProductData } = fullState.targetProduct as IProduct;\r\n\r\n return { ...readonlyState, targetProduct: limitedTargetProductData } as PBMStoreReadonly;\r\n }\r\n } as StoreApi<PBMStoreReadonly>;\r\n};\r\n\r\n// React hook (usado dentro de componentes React)\r\nexport function usePBMStore(): PBMStore;\r\nexport function usePBMStore<T>(selector: (state: PBMStore) => T): T;\r\nexport function usePBMStore<T>(selector?: (state: PBMStore) => T): PBMStore | T {\r\n if (selector) {\r\n return useStore(pbmStore, selector);\r\n }\r\n return useStore(pbmStore, (state) => state);\r\n}\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Header({ originalProductPrice }: { originalProductPrice: number }) {\r\n const { targetProduct } = usePBMStore();\r\n const Price = (targetProduct?.listPrice || originalProductPrice);\r\n const Discount = Price * ((targetProduct?.discountMax || 0) / 100)\r\n\r\n return (\r\n <header\r\n className=\"flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5\"\r\n id=\"header_pbm\"\r\n >\r\n <span\r\n 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\"\r\n data-testid=\"test_id_header_price\"\r\n id=\"header_price\"\r\n >\r\n <span className=\"absolute -top-6 left-10 bg-emerald-500 px-4 py-1 rounded-t-lg text-xs font-medium text-white\">{targetProduct?.discountMax}% OFF</span>\r\n\r\n <svg width=\"36px\" height=\"36px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g id=\"SVGRepo_bgCarrier\" strokeWidth=\"0\"></g>\r\n <g id=\"SVGRepo_tracerCarrier\" strokeLinecap=\"round\" strokeLinejoin=\"round\"></g>\r\n <g id=\"SVGRepo_iconCarrier\">\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n </g>\r\n </svg>\r\n\r\n <section className=\"flex flex-col items-start justify-center-safe gap-0\">\r\n <span className=\"line-through text-sm font-light\">\r\n {Number(Price)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </span>\r\n {Number(Price - Discount)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </section>\r\n </span>\r\n <h1 id=\"header_title\" className=\"text-center w-full text-[#339c9b] font-bold text-xs px-4 md:text-sm\">\r\n Desconto de Laboratório\r\n </h1>\r\n </header>\r\n );\r\n}\r\n\r\nexport default Header;\r\n","import classNames from \"classnames\";\r\nimport React from \"react\";\r\n\r\nfunction Container({\r\n children,\r\n variant,\r\n}: {\r\n children: React.ReactNode;\r\n variant: \"simple\" | \"main\";\r\n}) {\r\n return (\r\n <main\r\n className={classNames({\r\n \"border-3 border-[#44c2c0] flex flex-col items-center justify-center min-w-[var(--min-container)] max-w-[var(--max-container)] w-full h-auto rounded-xl p-4 bg-white gap-4 relative\":\r\n variant === \"main\",\r\n \"w-full h-auto relative\": variant === \"simple\",\r\n })}\r\n data-testid=\"test_id_container\"\r\n data-variant={variant}\r\n id=\"container_pbm\"\r\n >\r\n {children}\r\n </main>\r\n );\r\n}\r\n\r\nexport default Container;\r\n","import classNames from \"classnames\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Footer() {\r\n const { targetProduct, setTargetProduct, state } = usePBMStore();\r\n\r\n return (\r\n <footer className=\"w-full h-auto relative\" id=\"footer_pbm\">\r\n {(state !== \"isActivated\" && targetProduct?.informativeMessage) && <p className=\"text-start mb-3 font-semibold text-sm text-amber-500\">{targetProduct?.informativeMessage}</p>}\r\n\r\n <section className={classNames(\"flex items-center w-full h-auto gap-4\", { \"justify-center\": targetProduct?.industryLogo, \"justify-start\": !targetProduct?.industryLogo })}>\r\n <section className=\"w-4/5 h-auto\">\r\n <h3 className=\"text-start font-semibold text-sm\">\r\n Economize com o benefício do laboratório.\r\n </h3>\r\n <p className=\"text-start font-normal text-sm\">\r\n Este produto tem preço exclusivo para clientes cadastrados no\r\n programa.\r\n </p>\r\n </section>\r\n {targetProduct?.industryLogo && (\r\n <img\r\n src={targetProduct.industryLogo}\r\n alt=\"parceiro\"\r\n className=\"w-1/5 min-w-20 h-auto aspect-auto rounded-xl\"\r\n loading=\"eager\"\r\n id=\"footer_industry_logo_pbm\"\r\n data-testid=\"footer_industry_logo_pbm\"\r\n />\r\n )}\r\n </section>\r\n </footer>\r\n );\r\n}\r\n\r\nexport default Footer;\r\n","import { z } from \"zod\";\r\n\r\nexport const validationSchema = z.object({\r\n securityNumber: z\r\n .string({\r\n required_error: 'CPF é obrigatório.',\r\n })\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return replacedDoc.length >= 11;\r\n }, 'CPF deve conter no mínimo 11 caracteres.')\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return !!Number(replacedDoc);\r\n }, 'CPF deve conter apenas números.'),\r\n\r\n coupon: z.string({ required_error: 'Cupom / ID do Cartão obrigatório.'}).optional()\r\n});\r\n\r\nexport type validationSchemaType = z.infer<typeof validationSchema>","export const toFormat = (value: string) => {\r\n const cleanedValue = value.replace(/\\D/g, '');\r\n\r\n if (cleanedValue.length <= 11) {\r\n return cleanedValue\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d{1,2})/, '$1-$2')\r\n .replace(/(-\\d{2})\\d+?$/, '$1');\r\n }\r\n};","import {\r\n validationSchema,\r\n validationSchemaType,\r\n} from \"../../schema/validation-schema\";\r\nimport { toFormat } from \"../../utils/format\";\r\n\r\nimport classNames from \"classnames\";\r\nimport { zodResolver } from \"@hookform/resolvers/zod\";\r\nimport { useForm } from \"react-hook-form\";\r\n\r\nimport { ArrowRight } from \"lucide-react\";\r\nimport { Dispatch, SetStateAction, useState } from \"react\";\r\n\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\nimport Button from \"../UI/Button\";\r\n\r\ninterface IForm {\r\n setLoading: Dispatch<SetStateAction<boolean>>;\r\n}\r\n\r\nfunction Form({ setLoading }: IForm) {\r\n const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();\r\n const [showCoupoField, setShowCoupoField] = useState<boolean>(false);\r\n\r\n const {\r\n handleSubmit,\r\n register,\r\n setValue,\r\n clearErrors,\r\n unregister,\r\n formState: { errors },\r\n } = useForm<validationSchemaType>({\r\n resolver: zodResolver(validationSchema),\r\n mode: 'onSubmit',\r\n defaultValues: {\r\n securityNumber: securityNumber || \"\",\r\n coupon: \"\",\r\n },\r\n });\r\n\r\n const onSubmitDefault = async (values: validationSchemaType) => {\r\n if (!showCoupoField) {\r\n setValue(\"coupon\", undefined, { shouldValidate: false });\r\n }\r\n\r\n setLoading(true);\r\n\r\n try {\r\n if (targetProduct === null) {\r\n console.error(\"PBMLOG: Product is not defined!\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined!\");\r\n return\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined!\");\r\n return\r\n }\r\n\r\n const response = await BenefitsWithDocument({\r\n document: values.securityNumber.replace(/\\D/g, ''),\r\n products: [{\r\n productId: targetProduct.productId,\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.netPrice ?? targetProduct.listPrice\r\n }]\r\n });\r\n\r\n if (response.success) {\r\n const status: Record<\"acceptance\" | \"industry registration\" | \"active\", \"isRegistered\" | \"isActivated\" | \"isInvalid\" | \"isEmpty\"> = {\r\n \"acceptance\": \"isInvalid\",\r\n \"industry registration\": \"isRegistered\",\r\n \"active\": \"isActivated\"\r\n }\r\n\r\n setSecurityNumber(values.securityNumber);\r\n setState(status[response.data.product[0].statusCustomer]);\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isInvalid\") {\r\n setUrlAcceptTerms(response.data.product[0].urlAcceptTerm || undefined)\r\n return;\r\n }\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isRegistered\") {\r\n setUrlRegisterIndustry(response.data.product[0].informativeLink);\r\n return;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(\"PBMLOG: Error validating document -\", error);\r\n } finally {\r\n setLoading(false);\r\n };\r\n };\r\n\r\n return (\r\n <>\r\n <form\r\n onSubmit={handleSubmit(onSubmitDefault)}\r\n className={classNames(\r\n \"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150\",\r\n { \"mb-4\": errors.securityNumber || (errors.coupon && showCoupoField), \"gap-2\": showCoupoField }\r\n )}\r\n id=\"form_security_number_pbm\"\r\n >\r\n <label\r\n htmlFor=\"cpf\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_security_number_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.securityNumber, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Digite seu CPF aqui...\"\r\n required\r\n maxLength={14}\r\n {...register(\"securityNumber\", {\r\n onChange: (e) => {\r\n const formatted = toFormat(e.target.value);\r\n setValue(\"securityNumber\", formatted as string, {\r\n shouldValidate: true,\r\n });\r\n },\r\n })}\r\n defaultValue={securityNumber || \"\"}\r\n id=\"input_security_number_pbm\"\r\n />\r\n {errors.securityNumber && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"security_number_form_error\">\r\n {errors.securityNumber.message}\r\n </span>\r\n )}\r\n </label>\r\n {showCoupoField && (\r\n <label\r\n htmlFor=\"coupon\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_coupon_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.coupon, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Cupom / ID do Cartão\"\r\n {...register(\"coupon\", {\r\n required: showCoupoField ? 'Cupom / ID do Cartão obrigatório.' : false,\r\n shouldUnregister: !showCoupoField,\r\n onChange: (e) => {\r\n setValue(\"coupon\", e.target.value, {\r\n shouldValidate: showCoupoField,\r\n });\r\n },\r\n })}\r\n id=\"input_coupon_pbm\"\r\n />\r\n {errors.coupon && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"coupon_form_error\">\r\n {errors.coupon.message}\r\n </span>\r\n )}\r\n </label>\r\n )}\r\n <button\r\n type=\"submit\"\r\n className={classNames(\r\n \"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer\",\r\n { \"rounded-lg\": showCoupoField }\r\n )}\r\n id=\"button_submit_security_number_pbm\"\r\n >\r\n <ArrowRight size={24} color=\"white\" strokeWidth={2} />\r\n </button>\r\n </form>\r\n <Button\r\n 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\"\r\n onClick={() => {\r\n const newValue = !showCoupoField;\r\n setShowCoupoField(newValue);\r\n if (!newValue) {\r\n // Quando esconder o campo, desregistrar, limpar o valor e os erros\r\n unregister(\"coupon\");\r\n clearErrors(\"coupon\");\r\n }\r\n }}\r\n id=\"check_benefits_button\"\r\n >\r\n <span>{!showCoupoField ? \"Possui cupom?\" : \"Não possui cupom?\"}</span>\r\n <ArrowRight size={16} className={classNames({ \"rotate-0\": !showCoupoField, \"rotate-180\": showCoupoField })} />\r\n </Button>\r\n </>\r\n );\r\n}\r\n\r\nexport default Form;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\nexport interface IProductWithDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n urlAcceptTerm: string;\r\n informativeLink: string;\r\n productId: number;\r\n statusCustomer: \"acceptance\" | \"industry registration\" | \"active\";\r\n}\r\n\r\ninterface IResponseBenefitsWithDocument extends IRequestDefault {\r\n data: { product: IProductWithDocumentData[] };\r\n}\r\n\r\ninterface ProductRequestBody {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n netPrice: number;\r\n}\r\n\r\ninterface IBenefitsWithDocumentParams {\r\n document: string;\r\n products: ProductRequestBody[];\r\n}\r\n\r\nexport const BenefitsWithDocument = async ({ document, products }: IBenefitsWithDocumentParams): Promise<IResponseBenefitsWithDocument> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/benefitByDocument`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ consumer: { document }, products })\r\n })\r\n\r\n const dataResponse: IResponseBenefitsWithDocument = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch document validation');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { ButtonHTMLAttributes } from \"react\";\r\n\r\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction Button(props: ButtonProps) {\r\n return (\r\n <button\r\n {...props}\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors\",\r\n props.className\r\n )}\r\n >\r\n {props.children}\r\n </button>\r\n );\r\n}\r\n\r\nexport default Button;\r\n","interface LoadingProps {\r\n textColor?: string;\r\n}\r\n\r\nfunction Loading({ textColor }: LoadingProps) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n style={{ color: textColor }}\r\n id=\"loading_label\"\r\n >\r\n Um momento... estamos verificando seus dados.\r\n </p>\r\n </main>\r\n );\r\n}\r\n\r\nexport default Loading;\r\n","import { useEffect, useState } from \"react\";\r\nimport Title from \"../UI/Title\";\r\nimport Item from \"./Item\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Button from \"../UI/Button\";\r\nimport { CheckBenefistWithoutDocument } from \"../../services/benefits-without-document\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\n\r\nfunction BenefitsTable() {\r\n const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();\r\n const [selectedDiscout, setSelectedDiscount] = useState<string | null>(null);\r\n const [loading, setLoading] = useState<boolean>(true);\r\n const [benefitsItems, setBenefitsItems] = useState<IBenefitsItem[] | undefined>();\r\n\r\n useEffect(() => {\r\n const fetchDicountsWithoutDocument = async () => {\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await CheckBenefistWithoutDocument({ products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n const fetchDiscountWithDocument = async () => {\r\n if (!securityNumber) {\r\n console.error(\"PBMLOG: Document is not defined\");\r\n return;\r\n }\r\n\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await BenefitsWithDocument({ document: securityNumber, products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data.product)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n state === \"isActivated\" ?\r\n fetchDiscountWithDocument() :\r\n fetchDicountsWithoutDocument();\r\n }, [])\r\n\r\n if (loading) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n id=\"loading_label\"\r\n >\r\n Buscando beneficios disponíveis...\r\n </p>\r\n </main>\r\n )\r\n }\r\n\r\n return (\r\n <section\r\n className=\"flex items-start justify-center gap-4 w-full h-auto flex-col\"\r\n id=\"benefits_table_pbm\"\r\n >\r\n <Title>Descontos disponíveis:</Title>\r\n\r\n <form\r\n className=\"flex flex-col items-center justify-start w-full gap-4.5\"\r\n id=\"form_benefits_table_pbm\"\r\n >\r\n {!benefitsItems && (\r\n <p className=\"text-sm font-semibold text-start text-zinc-900\" id=\"benefits_empty_pbm\">Não foi possível encontrar benefícios para esse produto.</p>\r\n )}\r\n\r\n {benefitsItems && benefitsItems.map((item, index) => {\r\n const ID_INPUT = \"unity_quantity_\" + item.authorizedQuantity;\r\n\r\n return (\r\n <Item\r\n key={index}\r\n data={item}\r\n checked={selectedDiscout === ID_INPUT}\r\n onChange={() => setSelectedDiscount(ID_INPUT)}\r\n />\r\n );\r\n })}\r\n\r\n {benefitsItems && (\r\n <p className=\"w-full text-sm font-semibold text-center text-zinc-600\" id=\"benefits_empty_pbm\">{benefitsItems[0].informativeMessage}</p>\r\n )}\r\n </form>\r\n\r\n {state === \"isPreview\" && (\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n className=\"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start\"\r\n id=\"unauthorized_benefits_button\"\r\n >\r\n Atenção: Não é possível utilizar os benefícos sem realizar a consulta\r\n do CPF e o Login, por favor{\" \"}\r\n <span className=\"underline\">\r\n insira seu cpf para utilizar os benefícios\r\n </span>\r\n </Button>\r\n )}\r\n\r\n {state === \"isActivated\" && (\r\n <>\r\n {!isAuthenticatedShopper && <Button\r\n onClick={() => window.location.href = customLoginUrl || \"/login\"}\r\n 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\"\r\n id=\"login\"\r\n >\r\n <span className=\"underline\">Por favor, faça o Login para aproveitar os benefícios!</span>\r\n </Button>}\r\n\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n 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\"\r\n id=\"change_security_number\"\r\n >\r\n <span className=\"underline\">Deseja editar o cpf digitado?</span>\r\n </Button>\r\n </>\r\n )}\r\n </section>\r\n );\r\n}\r\n\r\nexport default BenefitsTable;\r\n","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TitleProps extends HTMLAttributes<HTMLTitleElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n}\r\n\r\nfunction Title(props: TitleProps) {\r\n return (\r\n <h2\r\n className={classNames(\r\n \"text-start font-semibold text-sm text-zinc-900\",\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize }}\r\n data-testid=\"test_id_title\"\r\n id=\"title_pbm\"\r\n >\r\n {props.children}\r\n </h2>\r\n );\r\n}\r\n\r\nexport default Title;\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nimport { Badge, BadgeCheck } from \"lucide-react\";\r\nimport { useCallback, useEffect } from \"react\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface ItemProps {\r\n data: IBenefitsItem;\r\n onChange: VoidFunction;\r\n checked: boolean;\r\n}\r\n\r\nfunction Item({ data, onChange, checked }: ItemProps) {\r\n const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();\r\n\r\n const ID_INPUT = \"unity_quantity_\" + data.authorizedQuantity;\r\n\r\n const decimalDiscount = data.discountPercentual / 100;\r\n\r\n const unitDiscountValue = data.grossPrice * decimalDiscount;\r\n\r\n \r\n const discountValue = unitDiscountValue * data.authorizedQuantity;\r\n\r\n const totalPriceProductWithDiscountBenefit =\r\n (data.grossPrice * data.authorizedQuantity) - discountValue;\r\n\r\n const updateStorageData = useCallback(() => {\r\n if (checked) {\r\n // Arredonda para 2 casas decimais\r\n const roundToTwoDecimals = (value: number) => Math.round(value * 100) / 100;\r\n\r\n setAvailableDiscountSelected({\r\n discount: {\r\n total: roundToTwoDecimals(discountValue),\r\n unit: roundToTwoDecimals(unitDiscountValue),\r\n },\r\n quantity: data.authorizedQuantity,\r\n totalPrice: roundToTwoDecimals(totalPriceProductWithDiscountBenefit),\r\n grossPrice: data.grossPrice\r\n });\r\n }\r\n }, [\r\n checked,\r\n data.authorizedQuantity,\r\n setAvailableDiscountSelected,\r\n discountValue,\r\n totalPriceProductWithDiscountBenefit,\r\n unitDiscountValue,\r\n ]);\r\n\r\n useEffect(() => {\r\n updateStorageData();\r\n }, [updateStorageData]);\r\n\r\n return (\r\n <label\r\n htmlFor={ID_INPUT}\r\n className={classNames(\r\n \"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\",\r\n { \"cursor-not-allowed\": state === \"isPreview\" || !isAuthenticatedShopper, \"cursor-pointer\": state === \"isActivated\" && isAuthenticatedShopper }\r\n )}\r\n id={\"label_benefits_\" + ID_INPUT}\r\n title={!isAuthenticatedShopper ? \"Necessário fazer login!\" : \"\"}\r\n >\r\n <input\r\n type=\"radio\"\r\n name=\"benefits_discount\"\r\n id={ID_INPUT}\r\n className=\"hidden\"\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={state === \"isPreview\" || !isAuthenticatedShopper}\r\n />\r\n\r\n {!checked ? (\r\n <Badge color=\"#9f9fa9\" size={20} />\r\n ) : (\r\n <BadgeCheck color=\"#32b316\" size={20} />\r\n )}\r\n\r\n <span className=\"text-zinc-900 font-semibold text-sm\">\r\n {data.authorizedQuantity}un\r\n </span>\r\n\r\n <section className=\"ml-auto relative gap-2 flex items-center-safe justify-end-safe\">\r\n <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\">\r\n {discountValue.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}{\" \"}\r\n OFF\r\n </span>\r\n <strong className=\"text-zinc-900 font-semibold text-sm text-center\">\r\n {totalPriceProductWithDiscountBenefit.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </strong>\r\n </section>\r\n </label>\r\n );\r\n}\r\n\r\nexport default Item;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface ICheckBenefitsWithoutDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n}\r\n\r\ninterface ICheckBenefitsWithoutDocumentResponse extends IRequestDefault {\r\n data: ICheckBenefitsWithoutDocumentData[];\r\n}\r\n\r\ninterface IProductsCheckBenefits {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n}\r\n\r\ninterface ICheckBenefistWithoutDocumentParams {\r\n products: IProductsCheckBenefits[];\r\n}\r\n\r\nexport const CheckBenefistWithoutDocument = async ({ products }: ICheckBenefistWithoutDocumentParams): Promise<ICheckBenefitsWithoutDocumentResponse> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/genericBenefit`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ products })\r\n })\r\n\r\n const dataResponse: ICheckBenefitsWithoutDocumentResponse = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch benefits without document');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TextProps extends HTMLAttributes<HTMLParagraphElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n textAlign?: \"start\" | \"center\" | \"end\";\r\n}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"font-normal text-sm text-zinc-900\",\r\n props.textAlign && `text-${props.textAlign}`,\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign }}\r\n data-testid=\"test_id_text\"\r\n id=\"text_pbm\"\r\n >\r\n {props.children}\r\n </p>\r\n );\r\n}\r\n\r\nexport default Text;\r\n","import { ILinkHref } from \"../../../types/globals\";\r\nimport classNames from \"classnames\";\r\nimport React from \"react\";\r\nimport { getParams } from \"../../../utils/getParams\";\r\nimport { usePBMStore } from \"../../../libs/zustand/usePBM\";\r\n\r\ninterface LinkProps {\r\n className?: string;\r\n children: React.ReactNode;\r\n href: ILinkHref | string;\r\n}\r\n\r\nfunction Link(props: LinkProps) {\r\n const { setState } = usePBMStore();\r\n\r\n return (\r\n <a\r\n {...props}\r\n target=\"_blank\"\r\n href={\r\n typeof props.href === \"string\"\r\n ? props.href\r\n : props.href.pathname + getParams(props.href.param)\r\n }\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center\",\r\n props.className\r\n )}\r\n data-testid=\"test_id_link\"\r\n id=\"link_pbm\"\r\n onClick={() => setState(\"isEmpty\")}\r\n >\r\n {props.children}\r\n </a>\r\n );\r\n}\r\n\r\nexport default Link;\r\n","export const getParams = (\r\n params: { [key: string]: string | number } | undefined\r\n) => {\r\n if (params === undefined) return \"\";\r\n\r\n return (\r\n \"?\" +\r\n Object.keys(params)\r\n .map((paramter) => paramter + \"=\" + params[paramter])\r\n .join(\"&\")\r\n );\r\n};","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\n// import Button from \"../UI/Button\";\r\n// import Iframe from \"../Iframe\";\r\n\r\n// import { useState } from \"react\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Link from \"../UI/Link\";\r\n\r\nfunction SecurityNumberInvalid({ textColor }: { textColor?: string }) {\r\n // const [openModal, setOpenModal] = useState<boolean>(false);\r\n const { urlAcceptTerms } = usePBMStore();\r\n return (\r\n <section\r\n data-testid=\"test_id_invalid\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_invalid_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n CPF não cadastrado.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Conclua seu cadastro para habilitar o benefício. <br />\r\n Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar.\r\n </Text>\r\n {/* <Button\r\n data-testid=\"test_id_openiframe\"\r\n onClick={() => setOpenModal(true)}\r\n id=\"button_accept_terms_pbm\"\r\n >\r\n Aceitar os termos\r\n </Button> */}\r\n\r\n <Link\r\n href={urlAcceptTerms || \"\"}\r\n >\r\n Aceitar os termos\r\n </Link>\r\n\r\n {/* <Iframe\r\n url={urlAcceptTerms || \"\"}\r\n title=\"Aceitar termos PBM\"\r\n openModal={openModal}\r\n setOpenModal={setOpenModal}\r\n /> */}\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberInvalid;\r\n","import Header from \"./components/Header\";\nimport Container from \"./components/UI/Container\";\nimport Footer from \"./components/Footer\";\nimport Form from \"./components/Form\";\nimport Loading from \"./components/UI/Loading\";\nimport Button from \"./components/UI/Button\";\nimport BenefitsTable from \"./components/BenefitsTable\";\nimport SecurityNumberInvalid from \"./components/SecurityNumberInvalid\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport SecurityNumberRegitered from \"./components/SecurityNumberRegitered\";\nimport { GetAuthorization } from \"./services/authorization\";\nimport { ArrowRight, RefreshCw } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\nimport Title from \"./components/UI/Title\";\nimport Text from \"./components/UI/Text\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n isAuthenticatedShopper: boolean;\n customLoginUrl?: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n isAuthenticatedShopper,\n customLoginUrl,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [isReady, setIsReady] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();\n const [EanProductExist, setEanProductExist] = useState<boolean>(true);\n\n const fetchProductByEan = async () => {\n try {\n if (!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n setEanProductExist(false);\n return\n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\n setEanProductExist(true);\n\n const { pbm, sku, ...targetProductNewData } = response.data;\n\n setTargetProduct({\n ...targetProduct,\n ...targetProductNewData,\n productId: Number(targetProductNewData.productId),\n informativeMessage: pbm.informativeMessage ?? \"\",\n discountMax: pbm.discountMax ?? 0,\n industryLogo: pbm.imageLink ?? undefined,\n ean: eanProduct\n })\n\n setIsAuthenticatedShopper(isAuthenticatedShopper);\n setCustomLoginUrl(customLoginUrl)\n }\n } catch (error) {\n console.error(error);\n } finally {\n // setIsReady(true)\n }\n }\n\n const handleAuthorizationRequest = useCallback(async () => {\n try {\n const response = await GetAuthorization({ clientID: clientID });\n\n if (response.success) {\n fetchProductByEan();\n } else {\n console.error(\"PBMLOG: Authorization failed!\");\n }\n } catch (error) {\n console.error(\"Error fetching authorization:\", error);\n }\n }, [clientID]);\n\n\n useEffect(() => {\n handleAuthorizationRequest();\n }, [handleAuthorizationRequest]);\n\n if (!isReady) {\n return (\n <div className=\"rounded-xl w-[556px] h-[358px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n hover:shadow-[0_0_30px_rgba(0,0,0,0.3)] \n transition-all duration-500 ease-in-out\">\n </div>\n )\n }\n\n if (!EanProductExist) {\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Title>Erro ao Aplicar o Benefício</Title>\n <Text textAlign=\"center\">O produto não foi encontrado no sistema. <br /> Por favor, tente novamente mais tarde ou contate o suporte.</Text>\n <Button\n 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\"\n onClick={() => window.location.reload()}\n id=\"check_benefits_button\"\n >\n <span>Tentar novamente</span>\n <RefreshCw size={16} />\n </Button>\n </Container>\n </div>\n )\n }\n\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Header originalProductPrice={formatedOriginalProductPrice || 0} />\n\n <Container variant=\"simple\">\n {state === \"isEmpty\" && !loading && (\n <>\n <Form setLoading={setLoading} />\n <Button\n 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\"\n onClick={() => setState(\"isPreview\")}\n id=\"check_benefits_button\"\n >\n <span>Consultar benefícios</span>\n <ArrowRight size={16} />\n </Button>\n </>\n )}\n\n {state === \"isEmpty\" && loading && <Loading />}\n\n {state === \"isInvalid\" && !loading && <SecurityNumberInvalid />}\n\n {state === \"isRegistered\" && !loading && <SecurityNumberRegitered />}\n\n {(state === \"isActivated\" || state === \"isPreview\") && !loading && (\n <BenefitsTable />\n )}\n </Container>\n\n <Footer />\n </Container>\n </div>\n );\n}\n\nexport default PBM;\n","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\nimport Link from \"../UI/Link\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction SecurityNumberRegitered({ textColor }: { textColor?: string }) {\r\n const { urlRegisterIndustry } = usePBMStore();\r\n\r\n return (\r\n <section\r\n data-testid=\"test_id_registered\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_registered_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n Ops, seu CPF ainda não está habilitado para este produto.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui.\r\n </Text>\r\n <Link\r\n href={urlRegisterIndustry || \"\"}\r\n >\r\n Ativar CPF\r\n </Link>\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberRegitered;\r\n","import Cookies from \"js-cookie\";\r\n\r\nexport const GetAuthorization = async ({ clientID }: { clientID: string }) => {\r\n const response = await fetch(\r\n 'https://pbm-auth-serverless.vercel.app/api/auth',\r\n {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n credentials: 'include',\r\n body: JSON.stringify({\r\n clientId: clientID\r\n })\r\n }\r\n );\r\n\r\n const data = await response.json();\r\n\r\n if (!data.success) {\r\n throw new Error('Authorization failed');\r\n }\r\n\r\n Cookies.set('pbm-token', data.tokens.token, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', data.tokens.refreshToken, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return data;\r\n};","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface IPBM {\r\n source: string;\r\n programName: string;\r\n industryName: string;\r\n discountMax: number;\r\n discountMin: number;\r\n informativeMessage: string;\r\n discountMaxNewPatient: number;\r\n discountMinNewPatient: number;\r\n discountFirstBox: number;\r\n suggestedPriceValue: string;\r\n imageLink: string | null;\r\n eanCombos: number | null;\r\n qtyDiscountMax: number;\r\n requestCoupon: string | null;\r\n}\r\n\r\nexport interface IDataRequestListProducts {\r\n productId: string;\r\n productName: string;\r\n sku: string;\r\n skuId: string;\r\n ean: string;\r\n price: number;\r\n listPrice: number;\r\n stockBalance: number;\r\n availabilityText: string;\r\n brandName: string;\r\n categoryName: string;\r\n pbm: IPBM;\r\n}\r\n\r\ninterface IResponseGetProducts extends IRequestDefault {\r\n data: IDataRequestListProducts\r\n}\r\n\r\nexport const GetProductByEAN = async ({ PRODUCT_EAN }: { PRODUCT_EAN: string }): Promise<IResponseGetProducts> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n });\r\n\r\n const dataResponse: IResponseGetProducts = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch authorization');\r\n }\r\n\r\n return dataResponse;\r\n}"],"mappings":";AAAA,SAAS,mBAA2C;AACpD,SAAS,gBAAgB;AA0BzB,IAAM,kBAA+B;AAAA,EACnC,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV,wBAAwB;AAAA,EACxB,gBAAgB;AAClB;AAEA,IAAM,iBAAyC,CAAC,SAAS;AAAA,EACvD,GAAG;AAAA,EAEH,mBAAmB,CAAC,mBAA2B,IAAI,EAAE,eAAe,CAAC;AAAA,EACrE,UAAU,CAAC,UAAgC,IAAI,EAAE,MAAM,CAAC;AAAA,EACxD,kBAAkB,CAAC,kBACjB,IAAI,EAAE,cAAc,CAAC;AAAA,EACvB,8BAA8B,CAC5B,sBACG,IAAI,EAAE,2BAA2B,kBAAkB,CAAC;AAAA,EACzD,mBAAmB,CAAC,mBAClB,IAAI,EAAE,eAA+B,CAAC;AAAA,EACxC,wBAAwB,CAAC,wBACvB,IAAI,EAAE,oBAAyC,CAAC;AAAA,EAClD,2BAA2B,CAAC,2BAC1B,IAAI,EAAE,uBAA+C,CAAC;AAAA,EACxD,mBAAmB,CAAC,mBAAkD,IAAI,EAAE,eAA+B,CAAC;AAE9G;AAGO,IAAM,WAA+B,YAAsB,cAAc;AA8BzE,SAAS,YAAe,UAAiD;AAC9E,MAAI,UAAU;AACZ,WAAO,SAAS,UAAU,QAAQ;AAAA,EACpC;AACA,SAAO,SAAS,UAAU,CAAC,UAAU,KAAK;AAC5C;;;ACpFQ,SAGE,KAHF;AAfR,SAAS,OAAO,EAAE,qBAAqB,GAAqC;AAC1E,QAAM,EAAE,cAAc,IAAI,Y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AO,sBAAsB,gCAAgC,GAAG;AAAA,IAEjE,gBAAAC,MAAC,qBAAU,SAAQ,UAChB;AAAA,gBAAU,aAAa,CAAC,WACvB,gBAAAA,MAAAF,WAAA,EACE;AAAA,wBAAAC,MAAC,gBAAK,YAAwB;AAAA,QAC9B,gBAAAC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,MAAM,SAAS,WAAW;AAAA,YACnC,IAAG;AAAA,YAEH;AAAA,8BAAAD,MAAC,UAAK,qCAAoB;AAAA,cAC1B,gBAAAA,MAACK,aAAA,EAAW,MAAM,IAAI;AAAA;AAAA;AAAA,QACxB;AAAA,SACF;AAAA,MAGD,UAAU,aAAa,WAAW,gBAAAL,MAAC,mBAAQ;AAAA,MAE3C,UAAU,eAAe,CAAC,WAAW,gBAAAA,MAAC,iCAAsB;AAAA,MAE5D,UAAU,kBAAkB,CAAC,WAAW,gBAAAA,MAAC,mCAAwB;AAAA,OAEhE,UAAU,iBAAiB,UAAU,gBAAgB,CAAC,WACtD,gBAAAA,MAAC,yBAAc;AAAA,OAEnB;AAAA,IAEA,gBAAAA,MAAC,kBAAO;AAAA,KACV,GACF;AAEJ;AAEA,IAAO,cAAQ;","names":["jsx","classNames","jsx","jsxs","classNames","classNames","classNames","jsx","jsx","jsxs","classNames","jsx","jsxs","useEffect","useState","classNames","jsx","classNames","jsx","jsxs","Cookies","Fragment","jsx","jsxs","useState","useEffect","classNames","jsx","classNames","jsx","classNames","jsx","jsxs","useCallback","useEffect","useState","jsx","jsxs","Cookies","ArrowRight","Cookies","Fragment","jsx","jsxs","useState","useCallback","useEffect","ArrowRight"]}
1
+ {"version":3,"sources":["../src/libs/zustand/usePBM.tsx","../src/components/Header/index.tsx","../src/components/UI/Container/index.tsx","../src/components/Footer/index.tsx","../src/schema/validation-schema.ts","../src/utils/format.ts","../src/components/Form/index.tsx","../src/services/benefits-with-document.ts","../src/components/UI/Button/index.tsx","../src/components/UI/Loading/index.tsx","../src/components/BenefitsTable/index.tsx","../src/components/UI/Title/index.tsx","../src/components/BenefitsTable/Item.tsx","../src/services/benefits-without-document.ts","../src/components/UI/Text/index.tsx","../src/components/UI/Link/index.tsx","../src/utils/getParams.ts","../src/components/SecurityNumberInvalid/index.tsx","../src/PBM.tsx","../src/components/SecurityNumberRegitered/index.tsx","../src/services/authorization.ts","../src/services/get-product-by-ean.ts"],"sourcesContent":["import { createStore, StateCreator, StoreApi } from \"zustand\";\r\nimport { useStore } from \"zustand/react\";\r\nimport { IProduct, usePBMTypes } from \"../../types/globals\";\r\n\r\nexport interface PBMStore extends usePBMTypes {\r\n setSecurityNumber: (securityNumber: string) => void;\r\n setState: (state: usePBMTypes[\"state\"]) => void;\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => void;\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) => void;\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) => void;\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) => void;\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) => void;\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => void;\r\n}\r\n\r\n// Tipo apenas com os getters (estado readonly)\r\nexport type PBMStoreReadonly = Omit<PBMStore,\r\n | 'setSecurityNumber'\r\n | 'setState'\r\n | 'setAvailableDiscountSelected'\r\n | 'setTargetProduct'\r\n | 'setUrlAcceptTerms'\r\n | 'setUrlRegisterIndustry'\r\n>;\r\n\r\nconst initialPBMState: usePBMTypes = {\r\n securityNumber: \"\",\r\n state: \"isEmpty\",\r\n availableDiscountSelected: {\r\n quantity: 0,\r\n discount: {\r\n unit: 0,\r\n total: 0,\r\n },\r\n totalPrice: 0,\r\n grossPrice: 0\r\n },\r\n targetProduct: null,\r\n campaign: \"pbm_campaign\",\r\n isAuthenticatedShopper: false,\r\n customLoginUrl: \"/login\"\r\n};\r\n\r\nconst createPBMStore: StateCreator<PBMStore> = (set) => ({\r\n ...initialPBMState,\r\n\r\n setSecurityNumber: (securityNumber: string) => set({ securityNumber }),\r\n setState: (state: usePBMTypes[\"state\"]) => set({ state }),\r\n setTargetProduct: (targetProduct: usePBMTypes[\"targetProduct\"]) =>\r\n set({ targetProduct }),\r\n setAvailableDiscountSelected: (\r\n availableDiscount: usePBMTypes[\"availableDiscountSelected\"]\r\n ) => set({ availableDiscountSelected: availableDiscount }),\r\n setUrlAcceptTerms: (urlAcceptTerms: usePBMTypes[\"urlAcceptTerms\"]) =>\r\n set({ urlAcceptTerms: urlAcceptTerms }),\r\n setUrlRegisterIndustry: (urlRegisterIndustry: usePBMTypes[\"urlRegisterIndustry\"]) =>\r\n set({ urlRegisterIndustry: urlRegisterIndustry }),\r\n setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes[\"isAuthenticatedShopper\"]) =>\r\n set({ isAuthenticatedShopper: isAuthenticatedShopper }),\r\n setCustomLoginUrl: (customLoginUrl: usePBMTypes[\"customLoginUrl\"]) => set({ customLoginUrl: customLoginUrl })\r\n\r\n});\r\n\r\n// Store completa (uso interno na biblioteca)\r\nexport const pbmStore: StoreApi<PBMStore> = createStore<PBMStore>(createPBMStore);\r\n\r\n// Cria uma versão somente leitura da store para exposição pública\r\nexport const createReadonlyStore = (): StoreApi<PBMStoreReadonly> => {\r\n return {\r\n getState: () => {\r\n const fullState = pbmStore.getState();\r\n // Remove os setters do estado retornado\r\n const {\r\n setSecurityNumber,\r\n setState,\r\n setAvailableDiscountSelected,\r\n setTargetProduct,\r\n setUrlAcceptTerms,\r\n setUrlRegisterIndustry,\r\n setIsAuthenticatedShopper,\r\n setCustomLoginUrl,\r\n ...readonlyState\r\n } = fullState;\r\n\r\n const { quantity, productId, skuId, discountMax, netPrice, stockBalance, listPrice, price, ...limitedTargetProductData } = fullState.targetProduct as IProduct;\r\n\r\n return { ...readonlyState, targetProduct: limitedTargetProductData } as PBMStoreReadonly;\r\n }\r\n } as StoreApi<PBMStoreReadonly>;\r\n};\r\n\r\n// React hook (usado dentro de componentes React)\r\nexport function usePBMStore(): PBMStore;\r\nexport function usePBMStore<T>(selector: (state: PBMStore) => T): T;\r\nexport function usePBMStore<T>(selector?: (state: PBMStore) => T): PBMStore | T {\r\n if (selector) {\r\n return useStore(pbmStore, selector);\r\n }\r\n return useStore(pbmStore, (state) => state);\r\n}\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Header({ originalProductPrice }: { originalProductPrice: number }) {\r\n const { targetProduct } = usePBMStore();\r\n const Price = (targetProduct?.listPrice || originalProductPrice);\r\n const Discount = Price * ((targetProduct?.discountMax || 0) / 100)\r\n\r\n return (\r\n <header\r\n className=\"flex items-center justify-between w-full p-0.5 rounded-xl bg-[#44c2c0]/30 mt-5\"\r\n id=\"header_pbm\"\r\n >\r\n <span\r\n 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\"\r\n data-testid=\"test_id_header_price\"\r\n id=\"header_price\"\r\n >\r\n <span className=\"absolute -top-6 left-10 bg-emerald-500 px-4 py-1 rounded-t-lg text-xs font-medium text-white\">{targetProduct?.discountMax}% OFF</span>\r\n\r\n <svg width=\"36px\" height=\"36px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <g id=\"SVGRepo_bgCarrier\" strokeWidth=\"0\"></g>\r\n <g id=\"SVGRepo_tracerCarrier\" strokeLinecap=\"round\" strokeLinejoin=\"round\"></g>\r\n <g id=\"SVGRepo_iconCarrier\">\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n <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\"></path>\r\n </g>\r\n </svg>\r\n\r\n <section className=\"flex flex-col items-start justify-center-safe gap-0\">\r\n <span className=\"line-through text-sm font-light\">\r\n {Number(Price)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </span>\r\n {Number(Price - Discount)?.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </section>\r\n </span>\r\n <h1 id=\"header_title\" className=\"text-center w-full text-[#339c9b] font-bold text-xs px-4 md:text-sm\">\r\n Desconto de Laboratório\r\n </h1>\r\n </header>\r\n );\r\n}\r\n\r\nexport default Header;\r\n","import classNames from \"classnames\";\r\nimport React from \"react\";\r\n\r\nfunction Container({\r\n children,\r\n variant,\r\n}: {\r\n children: React.ReactNode;\r\n variant: \"simple\" | \"main\";\r\n}) {\r\n return (\r\n <main\r\n className={classNames({\r\n \"border-3 border-[#44c2c0] flex flex-col items-center justify-center min-w-[var(--min-container)] max-w-[var(--max-container)] w-full h-auto rounded-xl p-4 bg-white gap-4 relative\":\r\n variant === \"main\",\r\n \"w-full h-auto relative\": variant === \"simple\",\r\n })}\r\n data-testid=\"test_id_container\"\r\n data-variant={variant}\r\n id=\"container_pbm\"\r\n >\r\n {children}\r\n </main>\r\n );\r\n}\r\n\r\nexport default Container;\r\n","import classNames from \"classnames\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction Footer() {\r\n const { targetProduct, setTargetProduct, state } = usePBMStore();\r\n\r\n return (\r\n <footer className=\"w-full h-auto relative\" id=\"footer_pbm\">\r\n {(state !== \"isActivated\" && targetProduct?.informativeMessage) && <p className=\"text-start mb-3 font-semibold text-sm text-amber-500\">{targetProduct?.informativeMessage}</p>}\r\n\r\n <section className={classNames(\"flex items-center w-full h-auto gap-4\", { \"justify-center\": targetProduct?.industryLogo, \"justify-start\": !targetProduct?.industryLogo })}>\r\n <section className=\"w-4/5 h-auto\">\r\n <h3 className=\"text-start font-semibold text-sm\">\r\n Economize com o benefício do laboratório.\r\n </h3>\r\n <p className=\"text-start font-normal text-sm\">\r\n Este produto tem preço exclusivo para clientes cadastrados no\r\n programa.\r\n </p>\r\n </section>\r\n {targetProduct?.industryLogo && (\r\n <img\r\n src={targetProduct.industryLogo}\r\n alt=\"parceiro\"\r\n className=\"w-1/5 min-w-20 h-auto aspect-auto rounded-xl\"\r\n loading=\"eager\"\r\n id=\"footer_industry_logo_pbm\"\r\n data-testid=\"footer_industry_logo_pbm\"\r\n />\r\n )}\r\n </section>\r\n </footer>\r\n );\r\n}\r\n\r\nexport default Footer;\r\n","import { z } from \"zod\";\r\n\r\nexport const validationSchema = z.object({\r\n securityNumber: z\r\n .string({\r\n required_error: 'CPF é obrigatório.',\r\n })\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return replacedDoc.length >= 11;\r\n }, 'CPF deve conter no mínimo 11 caracteres.')\r\n .refine((doc) => {\r\n const replacedDoc = doc.replace(/\\D/g, '');\r\n return !!Number(replacedDoc);\r\n }, 'CPF deve conter apenas números.'),\r\n\r\n coupon: z.string({ required_error: 'Cupom / ID do Cartão obrigatório.'}).optional()\r\n});\r\n\r\nexport type validationSchemaType = z.infer<typeof validationSchema>","export const toFormat = (value: string) => {\r\n const cleanedValue = value.replace(/\\D/g, '');\r\n\r\n if (cleanedValue.length <= 11) {\r\n return cleanedValue\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d)/, '$1.$2')\r\n .replace(/(\\d{3})(\\d{1,2})/, '$1-$2')\r\n .replace(/(-\\d{2})\\d+?$/, '$1');\r\n }\r\n};","import {\r\n validationSchema,\r\n validationSchemaType,\r\n} from \"../../schema/validation-schema\";\r\nimport { toFormat } from \"../../utils/format\";\r\n\r\nimport classNames from \"classnames\";\r\nimport { zodResolver } from \"@hookform/resolvers/zod\";\r\nimport { useForm } from \"react-hook-form\";\r\n\r\nimport { ArrowRight } from \"lucide-react\";\r\nimport { Dispatch, SetStateAction, useState } from \"react\";\r\n\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\nimport Button from \"../UI/Button\";\r\n\r\ninterface IForm {\r\n setLoading: Dispatch<SetStateAction<boolean>>;\r\n}\r\n\r\nfunction Form({ setLoading }: IForm) {\r\n const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();\r\n const [showCoupoField, setShowCoupoField] = useState<boolean>(false);\r\n\r\n const {\r\n handleSubmit,\r\n register,\r\n setValue,\r\n clearErrors,\r\n unregister,\r\n formState: { errors },\r\n } = useForm<validationSchemaType>({\r\n resolver: zodResolver(validationSchema),\r\n mode: 'onSubmit',\r\n defaultValues: {\r\n securityNumber: securityNumber || \"\",\r\n coupon: \"\",\r\n },\r\n });\r\n\r\n const onSubmitDefault = async (values: validationSchemaType) => {\r\n if (!showCoupoField) {\r\n setValue(\"coupon\", undefined, { shouldValidate: false });\r\n }\r\n\r\n setLoading(true);\r\n\r\n try {\r\n if (targetProduct === null) {\r\n console.error(\"PBMLOG: Product is not defined!\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined!\");\r\n return\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined!\");\r\n return\r\n }\r\n\r\n const response = await BenefitsWithDocument({\r\n document: values.securityNumber.replace(/\\D/g, ''),\r\n products: [{\r\n productId: targetProduct.productId,\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.netPrice ?? targetProduct.listPrice\r\n }]\r\n });\r\n\r\n if (response.success) {\r\n const status: Record<\"acceptance\" | \"industry registration\" | \"active\", \"isRegistered\" | \"isActivated\" | \"isInvalid\" | \"isEmpty\"> = {\r\n \"acceptance\": \"isInvalid\",\r\n \"industry registration\": \"isRegistered\",\r\n \"active\": \"isActivated\"\r\n }\r\n\r\n setSecurityNumber(values.securityNumber);\r\n setState(status[response.data.product[0].statusCustomer]);\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isInvalid\") {\r\n setUrlAcceptTerms(response.data.product[0].urlAcceptTerm || undefined)\r\n return;\r\n }\r\n\r\n if (status[response.data.product[0].statusCustomer] === \"isRegistered\") {\r\n setUrlRegisterIndustry(response.data.product[0].informativeLink);\r\n return;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(\"PBMLOG: Error validating document -\", error);\r\n } finally {\r\n setLoading(false);\r\n };\r\n };\r\n\r\n return (\r\n <>\r\n <form\r\n onSubmit={handleSubmit(onSubmitDefault)}\r\n className={classNames(\r\n \"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150\",\r\n { \"mb-4\": errors.securityNumber || (errors.coupon && showCoupoField), \"gap-2\": showCoupoField }\r\n )}\r\n id=\"form_security_number_pbm\"\r\n >\r\n <label\r\n htmlFor=\"cpf\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_security_number_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.securityNumber, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Digite seu CPF aqui...\"\r\n required\r\n maxLength={14}\r\n {...register(\"securityNumber\", {\r\n onChange: (e) => {\r\n const formatted = toFormat(e.target.value);\r\n setValue(\"securityNumber\", formatted as string, {\r\n shouldValidate: true,\r\n });\r\n },\r\n })}\r\n defaultValue={securityNumber || \"\"}\r\n id=\"input_security_number_pbm\"\r\n />\r\n {errors.securityNumber && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"security_number_form_error\">\r\n {errors.securityNumber.message}\r\n </span>\r\n )}\r\n </label>\r\n {showCoupoField && (\r\n <label\r\n htmlFor=\"coupon\"\r\n className=\"w-4/5 h-auto flex items-start flex-col justify-center relative py-2\"\r\n id=\"label_coupon_pbm\"\r\n >\r\n <input\r\n type=\"text\"\r\n className={classNames(\r\n \"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\",\r\n { \"outline outline-red-600\": errors.coupon, \"rounded-lg\": showCoupoField }\r\n )}\r\n placeholder=\"Cupom / ID do Cartão\"\r\n {...register(\"coupon\", {\r\n required: showCoupoField ? 'Cupom / ID do Cartão obrigatório.' : false,\r\n shouldUnregister: !showCoupoField,\r\n onChange: (e) => {\r\n setValue(\"coupon\", e.target.value, {\r\n shouldValidate: showCoupoField,\r\n });\r\n },\r\n })}\r\n id=\"input_coupon_pbm\"\r\n />\r\n {errors.coupon && (\r\n <span className=\"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap\" id=\"coupon_form_error\">\r\n {errors.coupon.message}\r\n </span>\r\n )}\r\n </label>\r\n )}\r\n <button\r\n type=\"submit\"\r\n className={classNames(\r\n \"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer\",\r\n { \"rounded-lg\": showCoupoField }\r\n )}\r\n id=\"button_submit_security_number_pbm\"\r\n >\r\n <ArrowRight size={24} color=\"white\" strokeWidth={2} />\r\n </button>\r\n </form>\r\n <Button\r\n 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\"\r\n onClick={() => {\r\n const newValue = !showCoupoField;\r\n setShowCoupoField(newValue);\r\n if (!newValue) {\r\n // Quando esconder o campo, desregistrar, limpar o valor e os erros\r\n unregister(\"coupon\");\r\n clearErrors(\"coupon\");\r\n }\r\n }}\r\n id=\"check_benefits_button\"\r\n >\r\n <span>{!showCoupoField ? \"Possui cupom?\" : \"Não possui cupom?\"}</span>\r\n <ArrowRight size={16} className={classNames({ \"rotate-0\": !showCoupoField, \"rotate-180\": showCoupoField })} />\r\n </Button>\r\n </>\r\n );\r\n}\r\n\r\nexport default Form;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\nexport interface IProductWithDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n urlAcceptTerm: string;\r\n informativeLink: string;\r\n productId: number;\r\n statusCustomer: \"acceptance\" | \"industry registration\" | \"active\";\r\n}\r\n\r\ninterface IResponseBenefitsWithDocument extends IRequestDefault {\r\n data: { product: IProductWithDocumentData[] };\r\n}\r\n\r\ninterface ProductRequestBody {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n netPrice: number;\r\n}\r\n\r\ninterface IBenefitsWithDocumentParams {\r\n document: string;\r\n products: ProductRequestBody[];\r\n}\r\n\r\nexport const BenefitsWithDocument = async ({ document, products }: IBenefitsWithDocumentParams): Promise<IResponseBenefitsWithDocument> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/benefitByDocument`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ consumer: { document }, products })\r\n })\r\n\r\n const dataResponse: IResponseBenefitsWithDocument = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch document validation');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { ButtonHTMLAttributes } from \"react\";\r\n\r\ninterface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction Button(props: ButtonProps) {\r\n return (\r\n <button\r\n {...props}\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors\",\r\n props.className\r\n )}\r\n >\r\n {props.children}\r\n </button>\r\n );\r\n}\r\n\r\nexport default Button;\r\n","interface LoadingProps {\r\n textColor?: string;\r\n}\r\n\r\nfunction Loading({ textColor }: LoadingProps) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n style={{ color: textColor }}\r\n id=\"loading_label\"\r\n >\r\n Um momento... estamos verificando seus dados.\r\n </p>\r\n </main>\r\n );\r\n}\r\n\r\nexport default Loading;\r\n","import { useEffect, useState } from \"react\";\r\nimport Title from \"../UI/Title\";\r\nimport Item from \"./Item\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Button from \"../UI/Button\";\r\nimport { CheckBenefistWithoutDocument } from \"../../services/benefits-without-document\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport { BenefitsWithDocument } from \"../../services/benefits-with-document\";\r\n\r\nfunction BenefitsTable() {\r\n const { securityNumber, setState, state, targetProduct, customLoginUrl, isAuthenticatedShopper } = usePBMStore();\r\n const [selectedDiscout, setSelectedDiscount] = useState<string | null>(null);\r\n const [loading, setLoading] = useState<boolean>(true);\r\n const [benefitsItems, setBenefitsItems] = useState<IBenefitsItem[] | undefined>();\r\n\r\n useEffect(() => {\r\n const fetchDicountsWithoutDocument = async () => {\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await CheckBenefistWithoutDocument({ products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n const fetchDiscountWithDocument = async () => {\r\n if (!securityNumber) {\r\n console.error(\"PBMLOG: Document is not defined\");\r\n return;\r\n }\r\n\r\n if (!targetProduct?.productId) {\r\n console.error(\"PBMLOG: Product ID is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.ean) {\r\n console.error(\"PBMLOG: EAN is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.listPrice) {\r\n console.error(\"PBMLOG: List Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n if (!targetProduct.price) {\r\n console.error(\"PBMLOG: Price is not defined on targetProduct\");\r\n return;\r\n }\r\n\r\n try {\r\n const data = {\r\n productId: Number(targetProduct.productId),\r\n ean: targetProduct.ean,\r\n requestedQuantity: 1,\r\n listPrice: targetProduct.listPrice,\r\n netPrice: targetProduct.price\r\n }\r\n\r\n const response = await BenefitsWithDocument({ document: securityNumber, products: [data] });\r\n\r\n if (response.success && response.data) {\r\n setBenefitsItems(response.data.product)\r\n } else {\r\n setBenefitsItems(undefined)\r\n }\r\n } catch (error) {\r\n setBenefitsItems(undefined)\r\n console.error(error);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }\r\n\r\n state === \"isActivated\" ?\r\n fetchDiscountWithDocument() :\r\n fetchDicountsWithoutDocument();\r\n }, [])\r\n\r\n if (loading) {\r\n return (\r\n <main className=\"flex items-center justify-center gap-4\" id=\"loading_pbm\">\r\n <div\r\n data-testid=\"test_id_spin\"\r\n className=\"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin\"\r\n id=\"loading_spin\"\r\n ></div>\r\n <p\r\n className={\"text-sm font-semibold text-start text-zinc-900\"}\r\n id=\"loading_label\"\r\n >\r\n Buscando beneficios disponíveis...\r\n </p>\r\n </main>\r\n )\r\n }\r\n\r\n return (\r\n <section\r\n className=\"flex items-start justify-center gap-4 w-full h-auto flex-col\"\r\n id=\"benefits_table_pbm\"\r\n >\r\n <Title>Descontos disponíveis:</Title>\r\n\r\n <form\r\n className=\"flex flex-col items-center justify-start w-full gap-4.5\"\r\n id=\"form_benefits_table_pbm\"\r\n >\r\n {!benefitsItems && (\r\n <p className=\"text-sm font-semibold text-start text-zinc-900\" id=\"benefits_empty_pbm\">Não foi possível encontrar benefícios para esse produto.</p>\r\n )}\r\n\r\n {benefitsItems && benefitsItems.map((item, index) => {\r\n const ID_INPUT = \"unity_quantity_\" + item.authorizedQuantity;\r\n\r\n return (\r\n <Item\r\n key={index}\r\n data={item}\r\n checked={selectedDiscout === ID_INPUT}\r\n onChange={() => setSelectedDiscount(ID_INPUT)}\r\n />\r\n );\r\n })}\r\n\r\n {benefitsItems && (\r\n <p className=\"w-full text-sm font-semibold text-center text-zinc-600\" id=\"benefits_empty_pbm\">{benefitsItems[0].informativeMessage}</p>\r\n )}\r\n </form>\r\n\r\n {state === \"isPreview\" && (\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n className=\"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start\"\r\n id=\"unauthorized_benefits_button\"\r\n >\r\n Atenção: Não é possível utilizar os benefícos sem realizar a consulta\r\n do CPF e o Login, por favor{\" \"}\r\n <span className=\"underline\">\r\n insira seu cpf para utilizar os benefícios\r\n </span>\r\n </Button>\r\n )}\r\n\r\n {state === \"isActivated\" && (\r\n <>\r\n {!isAuthenticatedShopper && <Button\r\n onClick={() => window.location.href = customLoginUrl || \"/login\"}\r\n 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\"\r\n id=\"login\"\r\n >\r\n <span className=\"underline\">Por favor, faça o Login para aproveitar os benefícios!</span>\r\n </Button>}\r\n\r\n <Button\r\n onClick={() => setState(\"isEmpty\")}\r\n 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\"\r\n id=\"change_security_number\"\r\n >\r\n <span className=\"underline\">Deseja editar o cpf digitado?</span>\r\n </Button>\r\n </>\r\n )}\r\n </section>\r\n );\r\n}\r\n\r\nexport default BenefitsTable;\r\n","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TitleProps extends HTMLAttributes<HTMLTitleElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n}\r\n\r\nfunction Title(props: TitleProps) {\r\n return (\r\n <h2\r\n className={classNames(\r\n \"text-start font-semibold text-sm text-zinc-900\",\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize }}\r\n data-testid=\"test_id_title\"\r\n id=\"title_pbm\"\r\n >\r\n {props.children}\r\n </h2>\r\n );\r\n}\r\n\r\nexport default Title;\r\n","import { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nimport { Badge, BadgeCheck } from \"lucide-react\";\r\nimport { useCallback, useEffect } from \"react\";\r\nimport { IBenefitsItem } from \"../../types/globals\";\r\nimport classNames from \"classnames\";\r\n\r\ninterface ItemProps {\r\n data: IBenefitsItem;\r\n onChange: VoidFunction;\r\n checked: boolean;\r\n}\r\n\r\nfunction Item({ data, onChange, checked }: ItemProps) {\r\n const { setAvailableDiscountSelected, state, isAuthenticatedShopper } = usePBMStore();\r\n\r\n const ID_INPUT = \"unity_quantity_\" + data.authorizedQuantity;\r\n\r\n const decimalDiscount = data.discountPercentual / 100;\r\n\r\n const unitDiscountValue = data.grossPrice * decimalDiscount;\r\n\r\n \r\n const discountValue = unitDiscountValue * data.authorizedQuantity;\r\n\r\n const totalPriceProductWithDiscountBenefit =\r\n (data.grossPrice * data.authorizedQuantity) - discountValue;\r\n\r\n const updateStorageData = useCallback(() => {\r\n if (checked) {\r\n // Arredonda para 2 casas decimais\r\n const roundToTwoDecimals = (value: number) => Math.round(value * 100) / 100;\r\n\r\n setAvailableDiscountSelected({\r\n discount: {\r\n total: roundToTwoDecimals(discountValue),\r\n unit: roundToTwoDecimals(unitDiscountValue),\r\n },\r\n quantity: data.authorizedQuantity,\r\n totalPrice: roundToTwoDecimals(totalPriceProductWithDiscountBenefit),\r\n grossPrice: data.grossPrice\r\n });\r\n }\r\n }, [\r\n checked,\r\n data.authorizedQuantity,\r\n setAvailableDiscountSelected,\r\n discountValue,\r\n totalPriceProductWithDiscountBenefit,\r\n unitDiscountValue,\r\n ]);\r\n\r\n useEffect(() => {\r\n updateStorageData();\r\n }, [updateStorageData]);\r\n\r\n return (\r\n <label\r\n htmlFor={ID_INPUT}\r\n className={classNames(\r\n \"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\",\r\n { \"cursor-not-allowed\": state === \"isPreview\" || !isAuthenticatedShopper, \"cursor-pointer\": state === \"isActivated\" && isAuthenticatedShopper }\r\n )}\r\n id={\"label_benefits_\" + ID_INPUT}\r\n title={!isAuthenticatedShopper ? \"Necessário fazer login!\" : \"\"}\r\n >\r\n <input\r\n type=\"radio\"\r\n name=\"benefits_discount\"\r\n id={ID_INPUT}\r\n className=\"hidden\"\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={state === \"isPreview\" || !isAuthenticatedShopper}\r\n />\r\n\r\n {!checked ? (\r\n <Badge color=\"#9f9fa9\" size={20} />\r\n ) : (\r\n <BadgeCheck color=\"#32b316\" size={20} />\r\n )}\r\n\r\n <span className=\"text-zinc-900 font-semibold text-sm\">\r\n {data.authorizedQuantity}un\r\n </span>\r\n\r\n <section className=\"ml-auto relative gap-2 flex items-center-safe justify-end-safe\">\r\n <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\">\r\n {discountValue.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}{\" \"}\r\n OFF\r\n </span>\r\n <strong className=\"text-zinc-900 font-semibold text-sm text-center\">\r\n {totalPriceProductWithDiscountBenefit.toLocaleString(\"pt-BR\", {\r\n currency: \"BRL\",\r\n currencyDisplay: \"symbol\",\r\n currencySign: \"standard\",\r\n style: \"currency\",\r\n })}\r\n </strong>\r\n </section>\r\n </label>\r\n );\r\n}\r\n\r\nexport default Item;\r\n","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface ICheckBenefitsWithoutDocumentData {\r\n id: number;\r\n ean: number;\r\n authorizedQuantity: number;\r\n discountValue: string;\r\n discountPercentual: number;\r\n authorizer: string;\r\n industryName: string;\r\n requestCoupon: string;\r\n requestHolderId: string;\r\n comboId: number;\r\n grossPrice: number;\r\n allowsAdhesion: string;\r\n discountMaxNewPatient: number;\r\n informativeMessage: string;\r\n priceWithBenefit: number;\r\n}\r\n\r\ninterface ICheckBenefitsWithoutDocumentResponse extends IRequestDefault {\r\n data: ICheckBenefitsWithoutDocumentData[];\r\n}\r\n\r\ninterface IProductsCheckBenefits {\r\n productId: number;\r\n ean: string;\r\n requestedQuantity: number;\r\n listPrice: number;\r\n}\r\n\r\ninterface ICheckBenefistWithoutDocumentParams {\r\n products: IProductsCheckBenefits[];\r\n}\r\n\r\nexport const CheckBenefistWithoutDocument = async ({ products }: ICheckBenefistWithoutDocumentParams): Promise<ICheckBenefitsWithoutDocumentResponse> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n if (!API_URL) {\r\n throw new Error('API URL is not defined in environment variables');\r\n }\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/genericBenefit`, {\r\n method: 'POST',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({ products })\r\n })\r\n\r\n const dataResponse: ICheckBenefitsWithoutDocumentResponse = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch benefits without document');\r\n }\r\n\r\n return dataResponse;\r\n}","import classNames from \"classnames\";\r\nimport React, { HTMLAttributes } from \"react\";\r\n\r\ninterface TextProps extends HTMLAttributes<HTMLParagraphElement> {\r\n children: React.ReactNode;\r\n textColor?: string;\r\n textSize?: string;\r\n textAlign?: \"start\" | \"center\" | \"end\";\r\n}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"font-normal text-sm text-zinc-900\",\r\n props.textAlign && `text-${props.textAlign}`,\r\n props.className\r\n )}\r\n style={{ color: props.textColor, fontSize: props.textSize, textAlign: props.textAlign }}\r\n data-testid=\"test_id_text\"\r\n id=\"text_pbm\"\r\n >\r\n {props.children}\r\n </p>\r\n );\r\n}\r\n\r\nexport default Text;\r\n","import { ILinkHref } from \"../../../types/globals\";\r\nimport classNames from \"classnames\";\r\nimport React from \"react\";\r\nimport { getParams } from \"../../../utils/getParams\";\r\nimport { usePBMStore } from \"../../../libs/zustand/usePBM\";\r\n\r\ninterface LinkProps {\r\n className?: string;\r\n children: React.ReactNode;\r\n href: ILinkHref | string;\r\n}\r\n\r\nfunction Link(props: LinkProps) {\r\n const { setState } = usePBMStore();\r\n\r\n return (\r\n <a\r\n {...props}\r\n target=\"_blank\"\r\n href={\r\n typeof props.href === \"string\"\r\n ? props.href\r\n : props.href.pathname + getParams(props.href.param)\r\n }\r\n className={classNames(\r\n \"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center\",\r\n props.className\r\n )}\r\n data-testid=\"test_id_link\"\r\n id=\"link_pbm\"\r\n onClick={() => setState(\"isEmpty\")}\r\n >\r\n {props.children}\r\n </a>\r\n );\r\n}\r\n\r\nexport default Link;\r\n","export const getParams = (\r\n params: { [key: string]: string | number } | undefined\r\n) => {\r\n if (params === undefined) return \"\";\r\n\r\n return (\r\n \"?\" +\r\n Object.keys(params)\r\n .map((paramter) => paramter + \"=\" + params[paramter])\r\n .join(\"&\")\r\n );\r\n};","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\n// import Button from \"../UI/Button\";\r\n// import Iframe from \"../Iframe\";\r\n\r\n// import { useState } from \"react\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\nimport Link from \"../UI/Link\";\r\n\r\nfunction SecurityNumberInvalid({ textColor }: { textColor?: string }) {\r\n // const [openModal, setOpenModal] = useState<boolean>(false);\r\n const { urlAcceptTerms } = usePBMStore();\r\n return (\r\n <section\r\n data-testid=\"test_id_invalid\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_invalid_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n CPF não cadastrado.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Conclua seu cadastro para habilitar o benefício. <br />\r\n Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar.\r\n </Text>\r\n {/* <Button\r\n data-testid=\"test_id_openiframe\"\r\n onClick={() => setOpenModal(true)}\r\n id=\"button_accept_terms_pbm\"\r\n >\r\n Aceitar os termos\r\n </Button> */}\r\n\r\n <Link\r\n href={urlAcceptTerms || \"\"}\r\n >\r\n Aceitar os termos\r\n </Link>\r\n\r\n {/* <Iframe\r\n url={urlAcceptTerms || \"\"}\r\n title=\"Aceitar termos PBM\"\r\n openModal={openModal}\r\n setOpenModal={setOpenModal}\r\n /> */}\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberInvalid;\r\n","import Header from \"./components/Header\";\nimport Container from \"./components/UI/Container\";\nimport Footer from \"./components/Footer\";\nimport Form from \"./components/Form\";\nimport Loading from \"./components/UI/Loading\";\nimport Button from \"./components/UI/Button\";\nimport BenefitsTable from \"./components/BenefitsTable\";\nimport SecurityNumberInvalid from \"./components/SecurityNumberInvalid\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport SecurityNumberRegitered from \"./components/SecurityNumberRegitered\";\nimport { GetAuthorization } from \"./services/authorization\";\nimport { ArrowRight, RefreshCw } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\nimport Title from \"./components/UI/Title\";\nimport Text from \"./components/UI/Text\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n isAuthenticatedShopper: boolean;\n customLoginUrl?: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n isAuthenticatedShopper,\n customLoginUrl,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [isReady, setIsReady] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct, setIsAuthenticatedShopper, setCustomLoginUrl } = usePBMStore();\n const [EanProductExist, setEanProductExist] = useState<boolean>(true);\n\n const fetchProductByEan = async () => {\n try {\n if (!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n setEanProductExist(false);\n return\n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\n setEanProductExist(true);\n\n const { pbm, sku, ...targetProductNewData } = response.data;\n\n setTargetProduct({\n ...targetProduct,\n ...targetProductNewData,\n productId: Number(targetProductNewData.productId),\n informativeMessage: pbm.informativeMessage ?? \"\",\n discountMax: pbm.discountMax ?? 0,\n industryLogo: pbm.imageLink ?? undefined,\n ean: eanProduct\n })\n\n setIsAuthenticatedShopper(isAuthenticatedShopper);\n setCustomLoginUrl(customLoginUrl)\n }\n } catch (error) {\n console.error(error);\n } finally {\n setIsReady(true)\n }\n }\n\n const handleAuthorizationRequest = useCallback(async () => {\n try {\n const response = await GetAuthorization({ clientID: clientID });\n\n if (response.success) {\n fetchProductByEan();\n } else {\n console.error(\"PBMLOG: Authorization failed!\");\n }\n } catch (error) {\n console.error(\"Error fetching authorization:\", error);\n }\n }, [clientID]);\n\n\n useEffect(() => {\n handleAuthorizationRequest();\n }, [handleAuthorizationRequest]);\n\n if (!isReady) {\n return (\n <div className=\"rounded-xl w-[250px] h-[250px] bg-zinc-500/20 \n shadow-[0_0_15px_rgba(0,0,0,0.1)] \n transition-all duration-500 ease-in-out\">\n </div>\n )\n }\n\n if (!EanProductExist) {\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Title>Erro ao Aplicar o Benefício</Title>\n <Text textAlign=\"center\">O produto não foi encontrado no sistema. <br /> Por favor, tente novamente mais tarde ou contate o suporte.</Text>\n <Button\n 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\"\n onClick={() => window.location.reload()}\n id=\"check_benefits_button\"\n >\n <span>Tentar novamente</span>\n <RefreshCw size={16} />\n </Button>\n </Container>\n </div>\n )\n }\n\n return (\n <div id=\"pbm-library-root\">\n <Container variant=\"main\">\n <Header originalProductPrice={formatedOriginalProductPrice || 0} />\n\n <Container variant=\"simple\">\n {state === \"isEmpty\" && !loading && (\n <>\n <Form setLoading={setLoading} />\n <Button\n 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\"\n onClick={() => setState(\"isPreview\")}\n id=\"check_benefits_button\"\n >\n <span>Consultar benefícios</span>\n <ArrowRight size={16} />\n </Button>\n </>\n )}\n\n {state === \"isEmpty\" && loading && <Loading />}\n\n {state === \"isInvalid\" && !loading && <SecurityNumberInvalid />}\n\n {state === \"isRegistered\" && !loading && <SecurityNumberRegitered />}\n\n {(state === \"isActivated\" || state === \"isPreview\") && !loading && (\n <BenefitsTable />\n )}\n </Container>\n\n <Footer />\n </Container>\n </div>\n );\n}\n\nexport default PBM;\n","import Title from \"../UI/Title\";\r\nimport Text from \"../UI/Text\";\r\nimport Link from \"../UI/Link\";\r\nimport { usePBMStore } from \"../../libs/zustand/usePBM\";\r\n\r\nfunction SecurityNumberRegitered({ textColor }: { textColor?: string }) {\r\n const { urlRegisterIndustry } = usePBMStore();\r\n\r\n return (\r\n <section\r\n data-testid=\"test_id_registered\"\r\n className=\"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6\"\r\n id=\"security_number_registered_container_pbm\"\r\n >\r\n <Title className=\"w-full\" textColor={textColor}>\r\n Ops, seu CPF ainda não está habilitado para este produto.\r\n </Title>\r\n <Text className=\"w-full\" textColor={textColor}>\r\n Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui.\r\n </Text>\r\n <Link\r\n href={urlRegisterIndustry || \"\"}\r\n >\r\n Ativar CPF\r\n </Link>\r\n </section>\r\n );\r\n}\r\n\r\nexport default SecurityNumberRegitered;\r\n","import Cookies from \"js-cookie\";\r\n\r\nexport const GetAuthorization = async ({ clientID }: { clientID: string }) => {\r\n const response = await fetch(\r\n 'https://pbm-auth-serverless.vercel.app/api/auth',\r\n {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n credentials: 'include',\r\n body: JSON.stringify({\r\n clientId: clientID\r\n })\r\n }\r\n );\r\n\r\n const data = await response.json();\r\n\r\n if (!data.success) {\r\n throw new Error('Authorization failed');\r\n }\r\n\r\n Cookies.set('pbm-token', data.tokens.token, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', data.tokens.refreshToken, {\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return data;\r\n};","import Cookies from \"js-cookie\";\r\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface IPBM {\r\n source: string;\r\n programName: string;\r\n industryName: string;\r\n discountMax: number;\r\n discountMin: number;\r\n informativeMessage: string;\r\n discountMaxNewPatient: number;\r\n discountMinNewPatient: number;\r\n discountFirstBox: number;\r\n suggestedPriceValue: string;\r\n imageLink: string | null;\r\n eanCombos: number | null;\r\n qtyDiscountMax: number;\r\n requestCoupon: string | null;\r\n}\r\n\r\nexport interface IDataRequestListProducts {\r\n productId: string;\r\n productName: string;\r\n sku: string;\r\n skuId: string;\r\n ean: string;\r\n price: number;\r\n listPrice: number;\r\n stockBalance: number;\r\n availabilityText: string;\r\n brandName: string;\r\n categoryName: string;\r\n pbm: IPBM;\r\n}\r\n\r\ninterface IResponseGetProducts extends IRequestDefault {\r\n data: IDataRequestListProducts\r\n}\r\n\r\nexport const GetProductByEAN = async ({ PRODUCT_EAN }: { PRODUCT_EAN: string }): Promise<IResponseGetProducts> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n\r\n const AUTH_TOKEN = Cookies.get(\"pbm-token\");\r\n\r\n if (!AUTH_TOKEN) {\r\n throw new Error('Token is not defined in cookies or is expired');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${AUTH_TOKEN}`,\r\n 'Content-Type': 'application/json',\r\n },\r\n });\r\n\r\n const dataResponse: IResponseGetProducts = await response.json();\r\n\r\n if (!dataResponse.success) {\r\n throw new Error(dataResponse.message || 'Failed to fetch authorization');\r\n }\r\n\r\n return dataResponse;\r\n}"],"mappings":";AAAA,SAAS,mBAA2C;AACpD,SAAS,gBAAgB;AA0BzB,IAAM,kBAA+B;AAAA,EACnC,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACA,eAAe;AAAA,E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AA,EAAW,MAAM,IAAI;AAAA;AAAA;AAAA,QACxB;AAAA,SACF;AAAA,MAGD,UAAU,aAAa,WAAW,gBAAAL,MAAC,mBAAQ;AAAA,MAE3C,UAAU,eAAe,CAAC,WAAW,gBAAAA,MAAC,iCAAsB;AAAA,MAE5D,UAAU,kBAAkB,CAAC,WAAW,gBAAAA,MAAC,mCAAwB;AAAA,OAEhE,UAAU,iBAAiB,UAAU,gBAAgB,CAAC,WACtD,gBAAAA,MAAC,yBAAc;AAAA,OAEnB;AAAA,IAEA,gBAAAA,MAAC,kBAAO;AAAA,KACV,GACF;AAEJ;AAEA,IAAO,cAAQ;","names":["jsx","classNames","jsx","jsxs","classNames","classNames","classNames","jsx","jsx","jsxs","classNames","jsx","jsxs","useEffect","useState","classNames","jsx","classNames","jsx","jsxs","Cookies","Fragment","jsx","jsxs","useState","useEffect","classNames","jsx","classNames","jsx","classNames","jsx","jsxs","useCallback","useEffect","useState","jsx","jsxs","Cookies","ArrowRight","Cookies","Fragment","jsx","jsxs","useState","useCallback","useEffect","ArrowRight"]}
package/dist-wc/pbm-wc.js CHANGED
@@ -1,4 +1,4 @@
1
- var Bw=Object.defineProperty;var Lw=(Or,Qi,Eo)=>Qi in Or?Bw(Or,Qi,{enumerable:!0,configurable:!0,writable:!0,value:Eo}):Or[Qi]=Eo;var g1=(Or,Qi,Eo)=>Lw(Or,typeof Qi!="symbol"?Qi+"":Qi,Eo);(function(){"use strict";var Or=document.createElement("style");Or.textContent=`/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-700:oklch(37.3% .034 259.733);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xs:16rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-4{top:calc(var(--spacing)*-4)}.-top-6{top:calc(var(--spacing)*-6)}.-right-3{right:calc(var(--spacing)*-3)}.-bottom-3{bottom:calc(var(--spacing)*-3)}.left-2{left:calc(var(--spacing)*2)}.left-10{left:calc(var(--spacing)*10)}.z-10{z-index:10}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-5{margin-top:calc(var(--spacing)*5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-auto{aspect-ratio:auto}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-\\[80\\%\\]{height:80%}.h-\\[358px\\]{height:358px}.h-auto{height:auto}.w-1\\/5{width:20%}.w-3xs{width:var(--container-3xs)}.w-4\\/5{width:80%}.w-8{width:calc(var(--spacing)*8)}.w-\\[556px\\]{width:556px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[var\\(--max-container\\)\\]{max-width:var(--max-container)}.max-w-md{max-width:var(--container-md)}.min-w-20{min-width:calc(var(--spacing)*20)}.min-w-\\[var\\(--min-container\\)\\]{min-width:var(--min-container)}.shrink-0{flex-shrink:0}.rotate-0{rotate:none}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-4\\.5{gap:calc(var(--spacing)*4.5)}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s-lg{border-start-start-radius:var(--radius-lg);border-end-start-radius:var(--radius-lg)}.rounded-ss-2xl{border-start-start-radius:var(--radius-2xl)}.rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.rounded-se-2xl{border-start-end-radius:var(--radius-2xl)}.rounded-ee-2xl{border-end-end-radius:var(--radius-2xl)}.rounded-es-2xl{border-end-start-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-\\[\\#44c2c0\\]{border-color:#44c2c0}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-300{border-color:var(--color-gray-300)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-zinc-300{border-color:var(--color-zinc-300)}.border-zinc-400\\/50{border-color:#9f9fa980}@supports (color:color-mix(in lab,red,red)){.border-zinc-400\\/50{border-color:color-mix(in oklab,var(--color-zinc-400)50%,transparent)}}.border-t-gray-700{border-top-color:var(--color-gray-700)}.bg-\\[\\#32b316\\]{background-color:#32b316}.bg-\\[\\#44c2c0\\]{background-color:#44c2c0}.bg-\\[\\#44c2c0\\]\\/30{background-color:#44c2c04d}.bg-black\\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-zinc-300\\/60{background-color:#d4d4d899}@supports (color:color-mix(in lab,red,red)){.bg-zinc-300\\/60{background-color:color-mix(in oklab,var(--color-zinc-300)60%,transparent)}}.bg-zinc-500\\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\\/20{background-color:color-mix(in oklab,var(--color-zinc-500)20%,transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-6{padding-block:calc(var(--spacing)*6)}.pl-2{padding-left:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-nowrap{text-wrap:nowrap}.text-\\[\\#339c9b\\]{color:#339c9b}.text-amber-500{color:var(--color-amber-500)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.text-zinc-600{color:var(--color-zinc-600)}.text-zinc-800{color:var(--color-zinc-800)}.text-zinc-900{color:var(--color-zinc-900)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_15px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 0 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-red-600{outline-color:var(--color-red-600)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.placeholder\\:font-semibold::placeholder{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.placeholder\\:text-zinc-600::placeholder{color:var(--color-zinc-600)}@media (hover:hover){.hover\\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\\:bg-emerald-400:hover{background-color:var(--color-emerald-400)}.hover\\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:bg-zinc-300:hover{background-color:var(--color-zinc-300)}.hover\\:text-zinc-400:hover{color:var(--color-zinc-400)}.hover\\:text-zinc-900:hover{color:var(--color-zinc-900)}.hover\\:shadow-\\[0_0_30px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]:hover{--tw-shadow:0 0 30px var(--tw-shadow-color,#0000004d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:bg-white:focus{background-color:var(--color-white)}.focus\\:outline:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\\:outline-\\[\\#339c9b\\]:focus{outline-color:#339c9b}@media (min-width:48rem){.md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}}:root{--max-container:556px;--min-container:350px}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
1
+ var Bw=Object.defineProperty;var Lw=(Or,Qi,Eo)=>Qi in Or?Bw(Or,Qi,{enumerable:!0,configurable:!0,writable:!0,value:Eo}):Or[Qi]=Eo;var g1=(Or,Qi,Eo)=>Lw(Or,typeof Qi!="symbol"?Qi+"":Qi,Eo);(function(){"use strict";var Or=document.createElement("style");Or.textContent=`/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-700:oklch(37.3% .034 259.733);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xs:16rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-4{top:calc(var(--spacing)*-4)}.-top-6{top:calc(var(--spacing)*-6)}.-right-3{right:calc(var(--spacing)*-3)}.-bottom-3{bottom:calc(var(--spacing)*-3)}.left-2{left:calc(var(--spacing)*2)}.left-10{left:calc(var(--spacing)*10)}.z-10{z-index:10}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-5{margin-top:calc(var(--spacing)*5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-auto{aspect-ratio:auto}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-\\[80\\%\\]{height:80%}.h-\\[250px\\]{height:250px}.h-auto{height:auto}.w-1\\/5{width:20%}.w-3xs{width:var(--container-3xs)}.w-4\\/5{width:80%}.w-8{width:calc(var(--spacing)*8)}.w-\\[250px\\]{width:250px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[var\\(--max-container\\)\\]{max-width:var(--max-container)}.max-w-md{max-width:var(--container-md)}.min-w-20{min-width:calc(var(--spacing)*20)}.min-w-\\[var\\(--min-container\\)\\]{min-width:var(--min-container)}.shrink-0{flex-shrink:0}.rotate-0{rotate:none}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-4\\.5{gap:calc(var(--spacing)*4.5)}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s-lg{border-start-start-radius:var(--radius-lg);border-end-start-radius:var(--radius-lg)}.rounded-ss-2xl{border-start-start-radius:var(--radius-2xl)}.rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.rounded-se-2xl{border-start-end-radius:var(--radius-2xl)}.rounded-ee-2xl{border-end-end-radius:var(--radius-2xl)}.rounded-es-2xl{border-end-start-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-\\[\\#44c2c0\\]{border-color:#44c2c0}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-300{border-color:var(--color-gray-300)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-zinc-300{border-color:var(--color-zinc-300)}.border-zinc-400\\/50{border-color:#9f9fa980}@supports (color:color-mix(in lab,red,red)){.border-zinc-400\\/50{border-color:color-mix(in oklab,var(--color-zinc-400)50%,transparent)}}.border-t-gray-700{border-top-color:var(--color-gray-700)}.bg-\\[\\#32b316\\]{background-color:#32b316}.bg-\\[\\#44c2c0\\]{background-color:#44c2c0}.bg-\\[\\#44c2c0\\]\\/30{background-color:#44c2c04d}.bg-black\\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-zinc-300\\/60{background-color:#d4d4d899}@supports (color:color-mix(in lab,red,red)){.bg-zinc-300\\/60{background-color:color-mix(in oklab,var(--color-zinc-300)60%,transparent)}}.bg-zinc-500\\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\\/20{background-color:color-mix(in oklab,var(--color-zinc-500)20%,transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-6{padding-block:calc(var(--spacing)*6)}.pl-2{padding-left:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-nowrap{text-wrap:nowrap}.text-\\[\\#339c9b\\]{color:#339c9b}.text-amber-500{color:var(--color-amber-500)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.text-zinc-600{color:var(--color-zinc-600)}.text-zinc-800{color:var(--color-zinc-800)}.text-zinc-900{color:var(--color-zinc-900)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_15px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 0 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-red-600{outline-color:var(--color-red-600)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.placeholder\\:font-semibold::placeholder{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.placeholder\\:text-zinc-600::placeholder{color:var(--color-zinc-600)}@media (hover:hover){.hover\\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\\:bg-emerald-400:hover{background-color:var(--color-emerald-400)}.hover\\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:bg-zinc-300:hover{background-color:var(--color-zinc-300)}.hover\\:text-zinc-400:hover{color:var(--color-zinc-400)}.hover\\:text-zinc-900:hover{color:var(--color-zinc-900)}}.focus\\:bg-white:focus{background-color:var(--color-white)}.focus\\:outline:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\\:outline-\\[\\#339c9b\\]:focus{outline-color:#339c9b}@media (min-width:48rem){.md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}}:root{--max-container:556px;--min-container:350px}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
2
2
  /*$vite$:1*/`,document.head.appendChild(Or);function Qi(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var Eo={exports:{}},dm={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -361,7 +361,6 @@ You might need to use a local HTTP server (instead of file://): https://react.de
361
361
  *
362
362
  * This source code is licensed under the ISC license.
363
363
  * See the LICENSE file in the root directory of this source tree.
364
- */const gE=kg("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/*! js-cookie v3.0.5 | MIT */function jg(d){for(var s=1;s<arguments.length;s++){var m=arguments[s];for(var y in m)d[y]=m[y]}return d}var vE={read:function(d){return d[0]==='"'&&(d=d.slice(1,-1)),d.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(d){return encodeURIComponent(d).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Wv(d,s){function m(g,v,E){if(!(typeof document>"u")){E=jg({},s,E),typeof E.expires=="number"&&(E.expires=new Date(Date.now()+E.expires*864e5)),E.expires&&(E.expires=E.expires.toUTCString()),g=encodeURIComponent(g).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var R="";for(var j in E)E[j]&&(R+="; "+j,E[j]!==!0&&(R+="="+E[j].split(";")[0]));return document.cookie=g+"="+d.write(v,g)+R}}function y(g){if(!(typeof document>"u"||arguments.length&&!g)){for(var v=document.cookie?document.cookie.split("; "):[],E={},R=0;R<v.length;R++){var j=v[R].split("="),w=j.slice(1).join("=");try{var Z=decodeURIComponent(j[0]);if(E[Z]=d.read(w,Z),g===Z)break}catch{}}return g?E[g]:E}}return Object.create({set:m,get:y,remove:function(g,v){m(g,"",jg({},v,{expires:-1}))},withAttributes:function(g){return Wv(this.converter,jg({},this.attributes,g))},withConverter:function(g){return Wv(jg({},this.converter,g),this.attributes)}},{attributes:{value:Object.freeze(s)},converter:{value:Object.freeze(d)}})}var Am=Wv(vE,{path:"/"});const NS=async({document:d,products:s})=>{const m="https://pbm.agradadigital.agradalabs.com/api/v1",y=Am.get("pbm-token");if(!y)throw new Error("Token is not defined in cookies or is expired");const v=await(await fetch(`${m}/products/benefitByDocument`,{method:"POST",headers:{Authorization:`Bearer ${y}`,"Content-Type":"application/json"},body:JSON.stringify({consumer:{document:d},products:s})})).json();if(!v.success)throw new Error(v.message||"Failed to fetch document validation");return v};function Wf(d){return fe.jsx("button",{...d,className:hi("w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors",d.className),children:d.children})}function bE({setLoading:d}){const{setSecurityNumber:s,setState:m,securityNumber:y,targetProduct:g,setUrlAcceptTerms:v,setUrlRegisterIndustry:E}=wo(),[R,j]=Va.useState(!1),{handleSubmit:w,register:Z,setValue:de,clearErrors:Y,unregister:V,formState:{errors:re}}=P_({resolver:cE(D_),mode:"onSubmit",defaultValues:{securityNumber:y||"",coupon:""}}),we=async Ze=>{R||de("coupon",void 0,{shouldValidate:!1}),d(!0);try{if(g===null){console.error("PBMLOG: Product is not defined!");return}if(!g.productId){console.error("PBMLOG: Product ID is not defined!");return}if(!g.listPrice){console.error("PBMLOG: List Price is not defined!");return}const Qe=await NS({document:Ze.securityNumber.replace(/\D/g,""),products:[{productId:g.productId,ean:g.ean,requestedQuantity:1,listPrice:g.listPrice,netPrice:g.netPrice??g.listPrice}]});if(Qe.success){const Ee={acceptance:"isInvalid","industry registration":"isRegistered",active:"isActivated"};if(s(Ze.securityNumber),m(Ee[Qe.data.product[0].statusCustomer]),Ee[Qe.data.product[0].statusCustomer]==="isInvalid"){v(Qe.data.product[0].urlAcceptTerm||void 0);return}if(Ee[Qe.data.product[0].statusCustomer]==="isRegistered"){E(Qe.data.product[0].informativeLink);return}}}catch(Qe){console.error("PBMLOG: Error validating document -",Qe)}finally{d(!1)}};return fe.jsxs(fe.Fragment,{children:[fe.jsxs("form",{onSubmit:w(we),className:hi("w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",{"mb-4":re.securityNumber||re.coupon&&R,"gap-2":R}),id:"form_security_number_pbm",children:[fe.jsxs("label",{htmlFor:"cpf",className:"w-4/5 h-auto flex items-start flex-col justify-center relative py-2",id:"label_security_number_pbm",children:[fe.jsx("input",{type:"text",className:hi("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",{"outline outline-red-600":re.securityNumber,"rounded-lg":R}),placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...Z("securityNumber",{onChange:Ze=>{const Qe=M_(Ze.target.value);de("securityNumber",Qe,{shouldValidate:!0})}}),defaultValue:y||"",id:"input_security_number_pbm"}),re.securityNumber&&fe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:re.securityNumber.message})]}),R&&fe.jsxs("label",{htmlFor:"coupon",className:"w-4/5 h-auto flex items-start flex-col justify-center relative py-2",id:"label_coupon_pbm",children:[fe.jsx("input",{type:"text",className:hi("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",{"outline outline-red-600":re.coupon,"rounded-lg":R}),placeholder:"Cupom / ID do Cartão",...Z("coupon",{required:R?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!R,onChange:Ze=>{de("coupon",Ze.target.value,{shouldValidate:R})}}),id:"input_coupon_pbm"}),re.coupon&&fe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:re.coupon.message})]}),fe.jsx("button",{type:"submit",className:hi("bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",{"rounded-lg":R}),id:"button_submit_security_number_pbm",children:fe.jsx($v,{size:24,color:"white",strokeWidth:2})})]}),fe.jsxs(Wf,{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",onClick:()=>{const Ze=!R;j(Ze),Ze||(V("coupon"),Y("coupon"))},id:"check_benefits_button",children:[fe.jsx("span",{children:R?"Não possui cupom?":"Possui cupom?"}),fe.jsx($v,{size:16,className:hi({"rotate-0":!R,"rotate-180":R})})]})]})}function SE({textColor:d}){return fe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[fe.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin",id:"loading_spin"}),fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",style:{color:d},id:"loading_label",children:"Um momento... estamos verificando seus dados."})]})}function Bg(d){return fe.jsx("h2",{className:hi("text-start font-semibold text-sm text-zinc-900",d.className),style:{color:d.textColor,fontSize:d.textSize},"data-testid":"test_id_title",id:"title_pbm",children:d.children})}function TE({data:d,onChange:s,checked:m}){const{setAvailableDiscountSelected:y,state:g,isAuthenticatedShopper:v}=wo(),E="unity_quantity_"+d.authorizedQuantity,R=d.discountPercentual/100,j=d.grossPrice*R,w=j*d.authorizedQuantity,Z=d.grossPrice*d.authorizedQuantity-w,de=Va.useCallback(()=>{if(m){const Y=V=>Math.round(V*100)/100;y({discount:{total:Y(w),unit:Y(j)},quantity:d.authorizedQuantity,totalPrice:Y(Z),grossPrice:d.grossPrice})}},[m,d.authorizedQuantity,y,w,Z,j]);return Va.useEffect(()=>{de()},[de]),fe.jsxs("label",{htmlFor:E,className:hi("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",{"cursor-not-allowed":g==="isPreview"||!v,"cursor-pointer":g==="isActivated"&&v}),id:"label_benefits_"+E,title:v?"":"Necessário fazer login!",children:[fe.jsx("input",{type:"radio",name:"benefits_discount",id:E,className:"hidden",checked:m,onChange:s,disabled:g==="isPreview"||!v}),m?fe.jsx(yE,{color:"#32b316",size:20}):fe.jsx(pE,{color:"#9f9fa9",size:20}),fe.jsxs("span",{className:"text-zinc-900 font-semibold text-sm",children:[d.authorizedQuantity,"un"]}),fe.jsxs("section",{className:"ml-auto relative gap-2 flex items-center-safe justify-end-safe",children:[fe.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:[w.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]}),fe.jsx("strong",{className:"text-zinc-900 font-semibold text-sm text-center",children:Z.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})})]})]})}const xE=async({products:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=Am.get("pbm-token");if(!m)throw new Error("Token is not defined in cookies or is expired");const g=await(await fetch(`${s}/products/genericBenefit`,{method:"POST",headers:{Authorization:`Bearer ${m}`,"Content-Type":"application/json"},body:JSON.stringify({products:d})})).json();if(!g.success)throw new Error(g.message||"Failed to fetch benefits without document");return g};function _E(){const{securityNumber:d,setState:s,state:m,targetProduct:y,customLoginUrl:g,isAuthenticatedShopper:v}=wo(),[E,R]=Va.useState(null),[j,w]=Va.useState(!0),[Z,de]=Va.useState();return Va.useEffect(()=>{m==="isActivated"?(async()=>{if(!d){console.error("PBMLOG: Document is not defined");return}if(!(y!=null&&y.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!y.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!y.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!y.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const re={productId:Number(y.productId),ean:y.ean,requestedQuantity:1,listPrice:y.listPrice,netPrice:y.price},we=await NS({document:d,products:[re]});we.success&&we.data?de(we.data.product):de(void 0)}catch(re){de(void 0),console.error(re)}finally{w(!1)}})():(async()=>{if(!(y!=null&&y.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!y.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!y.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!y.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const re={productId:Number(y.productId),ean:y.ean,requestedQuantity:1,listPrice:y.listPrice,netPrice:y.price},we=await xE({products:[re]});we.success&&we.data?de(we.data):de(void 0)}catch(re){de(void 0),console.error(re)}finally{w(!1)}})()},[]),j?fe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[fe.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin",id:"loading_spin"}),fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"loading_label",children:"Buscando beneficios disponíveis..."})]}):fe.jsxs("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[fe.jsx(Bg,{children:"Descontos disponíveis:"}),fe.jsxs("form",{className:"flex flex-col items-center justify-start w-full gap-4.5",id:"form_benefits_table_pbm",children:[!Z&&fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"benefits_empty_pbm",children:"Não foi possível encontrar benefícios para esse produto."}),Z&&Z.map((Y,V)=>{const re="unity_quantity_"+Y.authorizedQuantity;return fe.jsx(TE,{data:Y,checked:E===re,onChange:()=>R(re)},V)}),Z&&fe.jsx("p",{className:"w-full text-sm font-semibold text-center text-zinc-600",id:"benefits_empty_pbm",children:Z[0].informativeMessage})]}),m==="isPreview"&&fe.jsxs(Wf,{onClick:()=>s("isEmpty"),className:"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"unauthorized_benefits_button",children:["Atenção: Não é possível utilizar os benefícos sem realizar a consulta do CPF e o Login, por favor"," ",fe.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"})]}),m==="isActivated"&&fe.jsxs(fe.Fragment,{children:[!v&&fe.jsx(Wf,{onClick:()=>window.location.href=g||"/login",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",id:"login",children:fe.jsx("span",{className:"underline",children:"Por favor, faça o Login para aproveitar os benefícios!"})}),fe.jsx(Wf,{onClick:()=>s("isEmpty"),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",id:"change_security_number",children:fe.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"})})]})]})}function Fv(d){return fe.jsx("p",{className:hi("font-normal text-sm text-zinc-900",d.textAlign&&`text-${d.textAlign}`,d.className),style:{color:d.textColor,fontSize:d.textSize,textAlign:d.textAlign},"data-testid":"test_id_text",id:"text_pbm",children:d.children})}const EE=d=>d===void 0?"":"?"+Object.keys(d).map(s=>s+"="+d[s]).join("&");function HS(d){const{setState:s}=wo();return fe.jsx("a",{...d,target:"_blank",href:typeof d.href=="string"?d.href:d.href.pathname+EE(d.href.param),className:hi("w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center",d.className),"data-testid":"test_id_link",id:"link_pbm",onClick:()=>s("isEmpty"),children:d.children})}function wE({textColor:d}){const{urlAcceptTerms:s}=wo();return fe.jsxs("section",{"data-testid":"test_id_invalid",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",id:"security_number_invalid_container_pbm",children:[fe.jsx(Bg,{className:"w-full",textColor:d,children:"CPF não cadastrado."}),fe.jsxs(Fv,{className:"w-full",textColor:d,children:["Conclua seu cadastro para habilitar o benefício. ",fe.jsx("br",{}),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]}),fe.jsx(HS,{href:s||"",children:"Aceitar os termos"})]})}function AE({textColor:d}){const{urlRegisterIndustry:s}=wo();return fe.jsxs("section",{"data-testid":"test_id_registered",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",id:"security_number_registered_container_pbm",children:[fe.jsx(Bg,{className:"w-full",textColor:d,children:"Ops, seu CPF ainda não está habilitado para este produto."}),fe.jsx(Fv,{className:"w-full",textColor:d,children:"Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui."}),fe.jsx(HS,{href:s||"",children:"Ativar CPF"})]})}const RE=async({clientID:d})=>{const m=await(await fetch("https://pbm-auth-serverless.vercel.app/api/auth",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({clientId:d})})).json();if(!m.success)throw new Error("Authorization failed");return Am.set("pbm-token",m.tokens.token,{secure:!0,sameSite:"Strict"}),Am.set("pbm-token-refresh",m.tokens.refreshToken,{secure:!0,sameSite:"Strict"}),m},OE=async({PRODUCT_EAN:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=Am.get("pbm-token");if(!m)throw new Error("Token is not defined in cookies or is expired");const g=await(await fetch(`${s}/products/ean/${d}`,{method:"GET",headers:{Authorization:`Bearer ${m}`,"Content-Type":"application/json"}})).json();if(!g.success)throw new Error(g.message||"Failed to fetch authorization");return g};function zE({originalProductPrice:d,clientID:s,eanProduct:m,isAuthenticatedShopper:y,customLoginUrl:g}){const v=Number(String(d).replace(",",".")),[E,R]=Va.useState(!1),[j,w]=Va.useState(!1),{setState:Z,state:de,setTargetProduct:Y,targetProduct:V,setIsAuthenticatedShopper:re,setCustomLoginUrl:we}=wo(),[Ze,Qe]=Va.useState(!0),Ee=async()=>{try{if(!m){console.error("PBMLOG: Ean is not defined."),Qe(!1);return}const We=await OE({PRODUCT_EAN:m});if(We.success&&We.data){Qe(!0);const{pbm:Me,sku:Gt,...gt}=We.data;Y({...V,...gt,productId:Number(gt.productId),informativeMessage:Me.informativeMessage??"",discountMax:Me.discountMax??0,industryLogo:Me.imageLink??void 0,ean:m}),re(y),we(g)}}catch(We){console.error(We)}finally{}},St=Va.useCallback(async()=>{try{(await RE({clientID:s})).success?Ee():console.error("PBMLOG: Authorization failed!")}catch(We){console.error("Error fetching authorization:",We)}},[s]);return Va.useEffect(()=>{St()},[St]),E?Ze?fe.jsx("div",{id:"pbm-library-root",children:fe.jsxs(Cv,{variant:"main",children:[fe.jsx(Px,{originalProductPrice:v||0}),fe.jsxs(Cv,{variant:"simple",children:[de==="isEmpty"&&!j&&fe.jsxs(fe.Fragment,{children:[fe.jsx(bE,{setLoading:w}),fe.jsxs(Wf,{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",onClick:()=>Z("isPreview"),id:"check_benefits_button",children:[fe.jsx("span",{children:"Consultar benefícios"}),fe.jsx($v,{size:16})]})]}),de==="isEmpty"&&j&&fe.jsx(SE,{}),de==="isInvalid"&&!j&&fe.jsx(wE,{}),de==="isRegistered"&&!j&&fe.jsx(AE,{}),(de==="isActivated"||de==="isPreview")&&!j&&fe.jsx(_E,{})]}),fe.jsx(a_,{})]})}):fe.jsx("div",{id:"pbm-library-root",children:fe.jsxs(Cv,{variant:"main",children:[fe.jsx(Bg,{children:"Erro ao Aplicar o Benefício"}),fe.jsxs(Fv,{textAlign:"center",children:["O produto não foi encontrado no sistema. ",fe.jsx("br",{})," Por favor, tente novamente mais tarde ou contate o suporte."]}),fe.jsxs(Wf,{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",onClick:()=>window.location.reload(),id:"check_benefits_button",children:[fe.jsx("span",{children:"Tentar novamente"}),fe.jsx(gE,{size:16})]})]})}):fe.jsx("div",{className:`rounded-xl w-[556px] h-[358px] bg-zinc-500/20
364
+ */const gE=kg("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/*! js-cookie v3.0.5 | MIT */function jg(d){for(var s=1;s<arguments.length;s++){var m=arguments[s];for(var y in m)d[y]=m[y]}return d}var vE={read:function(d){return d[0]==='"'&&(d=d.slice(1,-1)),d.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(d){return encodeURIComponent(d).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Wv(d,s){function m(g,v,E){if(!(typeof document>"u")){E=jg({},s,E),typeof E.expires=="number"&&(E.expires=new Date(Date.now()+E.expires*864e5)),E.expires&&(E.expires=E.expires.toUTCString()),g=encodeURIComponent(g).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var R="";for(var j in E)E[j]&&(R+="; "+j,E[j]!==!0&&(R+="="+E[j].split(";")[0]));return document.cookie=g+"="+d.write(v,g)+R}}function y(g){if(!(typeof document>"u"||arguments.length&&!g)){for(var v=document.cookie?document.cookie.split("; "):[],E={},R=0;R<v.length;R++){var j=v[R].split("="),w=j.slice(1).join("=");try{var Z=decodeURIComponent(j[0]);if(E[Z]=d.read(w,Z),g===Z)break}catch{}}return g?E[g]:E}}return Object.create({set:m,get:y,remove:function(g,v){m(g,"",jg({},v,{expires:-1}))},withAttributes:function(g){return Wv(this.converter,jg({},this.attributes,g))},withConverter:function(g){return Wv(jg({},this.converter,g),this.attributes)}},{attributes:{value:Object.freeze(s)},converter:{value:Object.freeze(d)}})}var Am=Wv(vE,{path:"/"});const NS=async({document:d,products:s})=>{const m="https://pbm.agradadigital.agradalabs.com/api/v1",y=Am.get("pbm-token");if(!y)throw new Error("Token is not defined in cookies or is expired");const v=await(await fetch(`${m}/products/benefitByDocument`,{method:"POST",headers:{Authorization:`Bearer ${y}`,"Content-Type":"application/json"},body:JSON.stringify({consumer:{document:d},products:s})})).json();if(!v.success)throw new Error(v.message||"Failed to fetch document validation");return v};function Wf(d){return fe.jsx("button",{...d,className:hi("w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors",d.className),children:d.children})}function bE({setLoading:d}){const{setSecurityNumber:s,setState:m,securityNumber:y,targetProduct:g,setUrlAcceptTerms:v,setUrlRegisterIndustry:E}=wo(),[R,j]=Va.useState(!1),{handleSubmit:w,register:Z,setValue:de,clearErrors:Y,unregister:V,formState:{errors:re}}=P_({resolver:cE(D_),mode:"onSubmit",defaultValues:{securityNumber:y||"",coupon:""}}),we=async Ze=>{R||de("coupon",void 0,{shouldValidate:!1}),d(!0);try{if(g===null){console.error("PBMLOG: Product is not defined!");return}if(!g.productId){console.error("PBMLOG: Product ID is not defined!");return}if(!g.listPrice){console.error("PBMLOG: List Price is not defined!");return}const Qe=await NS({document:Ze.securityNumber.replace(/\D/g,""),products:[{productId:g.productId,ean:g.ean,requestedQuantity:1,listPrice:g.listPrice,netPrice:g.netPrice??g.listPrice}]});if(Qe.success){const Ee={acceptance:"isInvalid","industry registration":"isRegistered",active:"isActivated"};if(s(Ze.securityNumber),m(Ee[Qe.data.product[0].statusCustomer]),Ee[Qe.data.product[0].statusCustomer]==="isInvalid"){v(Qe.data.product[0].urlAcceptTerm||void 0);return}if(Ee[Qe.data.product[0].statusCustomer]==="isRegistered"){E(Qe.data.product[0].informativeLink);return}}}catch(Qe){console.error("PBMLOG: Error validating document -",Qe)}finally{d(!1)}};return fe.jsxs(fe.Fragment,{children:[fe.jsxs("form",{onSubmit:w(we),className:hi("w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",{"mb-4":re.securityNumber||re.coupon&&R,"gap-2":R}),id:"form_security_number_pbm",children:[fe.jsxs("label",{htmlFor:"cpf",className:"w-4/5 h-auto flex items-start flex-col justify-center relative py-2",id:"label_security_number_pbm",children:[fe.jsx("input",{type:"text",className:hi("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",{"outline outline-red-600":re.securityNumber,"rounded-lg":R}),placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...Z("securityNumber",{onChange:Ze=>{const Qe=M_(Ze.target.value);de("securityNumber",Qe,{shouldValidate:!0})}}),defaultValue:y||"",id:"input_security_number_pbm"}),re.securityNumber&&fe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:re.securityNumber.message})]}),R&&fe.jsxs("label",{htmlFor:"coupon",className:"w-4/5 h-auto flex items-start flex-col justify-center relative py-2",id:"label_coupon_pbm",children:[fe.jsx("input",{type:"text",className:hi("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",{"outline outline-red-600":re.coupon,"rounded-lg":R}),placeholder:"Cupom / ID do Cartão",...Z("coupon",{required:R?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!R,onChange:Ze=>{de("coupon",Ze.target.value,{shouldValidate:R})}}),id:"input_coupon_pbm"}),re.coupon&&fe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:re.coupon.message})]}),fe.jsx("button",{type:"submit",className:hi("bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",{"rounded-lg":R}),id:"button_submit_security_number_pbm",children:fe.jsx($v,{size:24,color:"white",strokeWidth:2})})]}),fe.jsxs(Wf,{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",onClick:()=>{const Ze=!R;j(Ze),Ze||(V("coupon"),Y("coupon"))},id:"check_benefits_button",children:[fe.jsx("span",{children:R?"Não possui cupom?":"Possui cupom?"}),fe.jsx($v,{size:16,className:hi({"rotate-0":!R,"rotate-180":R})})]})]})}function SE({textColor:d}){return fe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[fe.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin",id:"loading_spin"}),fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",style:{color:d},id:"loading_label",children:"Um momento... estamos verificando seus dados."})]})}function Bg(d){return fe.jsx("h2",{className:hi("text-start font-semibold text-sm text-zinc-900",d.className),style:{color:d.textColor,fontSize:d.textSize},"data-testid":"test_id_title",id:"title_pbm",children:d.children})}function TE({data:d,onChange:s,checked:m}){const{setAvailableDiscountSelected:y,state:g,isAuthenticatedShopper:v}=wo(),E="unity_quantity_"+d.authorizedQuantity,R=d.discountPercentual/100,j=d.grossPrice*R,w=j*d.authorizedQuantity,Z=d.grossPrice*d.authorizedQuantity-w,de=Va.useCallback(()=>{if(m){const Y=V=>Math.round(V*100)/100;y({discount:{total:Y(w),unit:Y(j)},quantity:d.authorizedQuantity,totalPrice:Y(Z),grossPrice:d.grossPrice})}},[m,d.authorizedQuantity,y,w,Z,j]);return Va.useEffect(()=>{de()},[de]),fe.jsxs("label",{htmlFor:E,className:hi("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",{"cursor-not-allowed":g==="isPreview"||!v,"cursor-pointer":g==="isActivated"&&v}),id:"label_benefits_"+E,title:v?"":"Necessário fazer login!",children:[fe.jsx("input",{type:"radio",name:"benefits_discount",id:E,className:"hidden",checked:m,onChange:s,disabled:g==="isPreview"||!v}),m?fe.jsx(yE,{color:"#32b316",size:20}):fe.jsx(pE,{color:"#9f9fa9",size:20}),fe.jsxs("span",{className:"text-zinc-900 font-semibold text-sm",children:[d.authorizedQuantity,"un"]}),fe.jsxs("section",{className:"ml-auto relative gap-2 flex items-center-safe justify-end-safe",children:[fe.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:[w.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]}),fe.jsx("strong",{className:"text-zinc-900 font-semibold text-sm text-center",children:Z.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})})]})]})}const xE=async({products:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=Am.get("pbm-token");if(!m)throw new Error("Token is not defined in cookies or is expired");const g=await(await fetch(`${s}/products/genericBenefit`,{method:"POST",headers:{Authorization:`Bearer ${m}`,"Content-Type":"application/json"},body:JSON.stringify({products:d})})).json();if(!g.success)throw new Error(g.message||"Failed to fetch benefits without document");return g};function _E(){const{securityNumber:d,setState:s,state:m,targetProduct:y,customLoginUrl:g,isAuthenticatedShopper:v}=wo(),[E,R]=Va.useState(null),[j,w]=Va.useState(!0),[Z,de]=Va.useState();return Va.useEffect(()=>{m==="isActivated"?(async()=>{if(!d){console.error("PBMLOG: Document is not defined");return}if(!(y!=null&&y.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!y.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!y.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!y.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const re={productId:Number(y.productId),ean:y.ean,requestedQuantity:1,listPrice:y.listPrice,netPrice:y.price},we=await NS({document:d,products:[re]});we.success&&we.data?de(we.data.product):de(void 0)}catch(re){de(void 0),console.error(re)}finally{w(!1)}})():(async()=>{if(!(y!=null&&y.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!y.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!y.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!y.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const re={productId:Number(y.productId),ean:y.ean,requestedQuantity:1,listPrice:y.listPrice,netPrice:y.price},we=await xE({products:[re]});we.success&&we.data?de(we.data):de(void 0)}catch(re){de(void 0),console.error(re)}finally{w(!1)}})()},[]),j?fe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[fe.jsx("div",{"data-testid":"test_id_spin",className:"w-8 h-8 border-4 border-t-gray-700 border-gray-300 rounded-full animate-spin",id:"loading_spin"}),fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"loading_label",children:"Buscando beneficios disponíveis..."})]}):fe.jsxs("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[fe.jsx(Bg,{children:"Descontos disponíveis:"}),fe.jsxs("form",{className:"flex flex-col items-center justify-start w-full gap-4.5",id:"form_benefits_table_pbm",children:[!Z&&fe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"benefits_empty_pbm",children:"Não foi possível encontrar benefícios para esse produto."}),Z&&Z.map((Y,V)=>{const re="unity_quantity_"+Y.authorizedQuantity;return fe.jsx(TE,{data:Y,checked:E===re,onChange:()=>R(re)},V)}),Z&&fe.jsx("p",{className:"w-full text-sm font-semibold text-center text-zinc-600",id:"benefits_empty_pbm",children:Z[0].informativeMessage})]}),m==="isPreview"&&fe.jsxs(Wf,{onClick:()=>s("isEmpty"),className:"bg-transparent p-0 w-auto h-auto text-zinc-600 cursor-pointer hover:text-zinc-900 hover:bg-transparent text-start",id:"unauthorized_benefits_button",children:["Atenção: Não é possível utilizar os benefícos sem realizar a consulta do CPF e o Login, por favor"," ",fe.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"})]}),m==="isActivated"&&fe.jsxs(fe.Fragment,{children:[!v&&fe.jsx(Wf,{onClick:()=>window.location.href=g||"/login",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",id:"login",children:fe.jsx("span",{className:"underline",children:"Por favor, faça o Login para aproveitar os benefícios!"})}),fe.jsx(Wf,{onClick:()=>s("isEmpty"),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",id:"change_security_number",children:fe.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"})})]})]})}function Fv(d){return fe.jsx("p",{className:hi("font-normal text-sm text-zinc-900",d.textAlign&&`text-${d.textAlign}`,d.className),style:{color:d.textColor,fontSize:d.textSize,textAlign:d.textAlign},"data-testid":"test_id_text",id:"text_pbm",children:d.children})}const EE=d=>d===void 0?"":"?"+Object.keys(d).map(s=>s+"="+d[s]).join("&");function HS(d){const{setState:s}=wo();return fe.jsx("a",{...d,target:"_blank",href:typeof d.href=="string"?d.href:d.href.pathname+EE(d.href.param),className:hi("w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors flex items-center justify-center",d.className),"data-testid":"test_id_link",id:"link_pbm",onClick:()=>s("isEmpty"),children:d.children})}function wE({textColor:d}){const{urlAcceptTerms:s}=wo();return fe.jsxs("section",{"data-testid":"test_id_invalid",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",id:"security_number_invalid_container_pbm",children:[fe.jsx(Bg,{className:"w-full",textColor:d,children:"CPF não cadastrado."}),fe.jsxs(Fv,{className:"w-full",textColor:d,children:["Conclua seu cadastro para habilitar o benefício. ",fe.jsx("br",{}),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]}),fe.jsx(HS,{href:s||"",children:"Aceitar os termos"})]})}function AE({textColor:d}){const{urlRegisterIndustry:s}=wo();return fe.jsxs("section",{"data-testid":"test_id_registered",className:"flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",id:"security_number_registered_container_pbm",children:[fe.jsx(Bg,{className:"w-full",textColor:d,children:"Ops, seu CPF ainda não está habilitado para este produto."}),fe.jsx(Fv,{className:"w-full",textColor:d,children:"Para ativar o benefício, clique em “Ativar CPF” e conclua a etapa na página externa. Depois, é só voltar para continuar — vamos aguardar você aqui."}),fe.jsx(HS,{href:s||"",children:"Ativar CPF"})]})}const RE=async({clientID:d})=>{const m=await(await fetch("https://pbm-auth-serverless.vercel.app/api/auth",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({clientId:d})})).json();if(!m.success)throw new Error("Authorization failed");return Am.set("pbm-token",m.tokens.token,{secure:!0,sameSite:"Strict"}),Am.set("pbm-token-refresh",m.tokens.refreshToken,{secure:!0,sameSite:"Strict"}),m},OE=async({PRODUCT_EAN:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=Am.get("pbm-token");if(!m)throw new Error("Token is not defined in cookies or is expired");const g=await(await fetch(`${s}/products/ean/${d}`,{method:"GET",headers:{Authorization:`Bearer ${m}`,"Content-Type":"application/json"}})).json();if(!g.success)throw new Error(g.message||"Failed to fetch authorization");return g};function zE({originalProductPrice:d,clientID:s,eanProduct:m,isAuthenticatedShopper:y,customLoginUrl:g}){const v=Number(String(d).replace(",",".")),[E,R]=Va.useState(!1),[j,w]=Va.useState(!1),{setState:Z,state:de,setTargetProduct:Y,targetProduct:V,setIsAuthenticatedShopper:re,setCustomLoginUrl:we}=wo(),[Ze,Qe]=Va.useState(!0),Ee=async()=>{try{if(!m){console.error("PBMLOG: Ean is not defined."),Qe(!1);return}const We=await OE({PRODUCT_EAN:m});if(We.success&&We.data){Qe(!0);const{pbm:Me,sku:Gt,...gt}=We.data;Y({...V,...gt,productId:Number(gt.productId),informativeMessage:Me.informativeMessage??"",discountMax:Me.discountMax??0,industryLogo:Me.imageLink??void 0,ean:m}),re(y),we(g)}}catch(We){console.error(We)}finally{R(!0)}},St=Va.useCallback(async()=>{try{(await RE({clientID:s})).success?Ee():console.error("PBMLOG: Authorization failed!")}catch(We){console.error("Error fetching authorization:",We)}},[s]);return Va.useEffect(()=>{St()},[St]),E?Ze?fe.jsx("div",{id:"pbm-library-root",children:fe.jsxs(Cv,{variant:"main",children:[fe.jsx(Px,{originalProductPrice:v||0}),fe.jsxs(Cv,{variant:"simple",children:[de==="isEmpty"&&!j&&fe.jsxs(fe.Fragment,{children:[fe.jsx(bE,{setLoading:w}),fe.jsxs(Wf,{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",onClick:()=>Z("isPreview"),id:"check_benefits_button",children:[fe.jsx("span",{children:"Consultar benefícios"}),fe.jsx($v,{size:16})]})]}),de==="isEmpty"&&j&&fe.jsx(SE,{}),de==="isInvalid"&&!j&&fe.jsx(wE,{}),de==="isRegistered"&&!j&&fe.jsx(AE,{}),(de==="isActivated"||de==="isPreview")&&!j&&fe.jsx(_E,{})]}),fe.jsx(a_,{})]})}):fe.jsx("div",{id:"pbm-library-root",children:fe.jsxs(Cv,{variant:"main",children:[fe.jsx(Bg,{children:"Erro ao Aplicar o Benefício"}),fe.jsxs(Fv,{textAlign:"center",children:["O produto não foi encontrado no sistema. ",fe.jsx("br",{})," Por favor, tente novamente mais tarde ou contate o suporte."]}),fe.jsxs(Wf,{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",onClick:()=>window.location.reload(),id:"check_benefits_button",children:[fe.jsx("span",{children:"Tentar novamente"}),fe.jsx(gE,{size:16})]})]})}):fe.jsx("div",{className:`rounded-xl w-[250px] h-[250px] bg-zinc-500/20
365
365
  shadow-[0_0_15px_rgba(0,0,0,0.1)]
366
- hover:shadow-[0_0_30px_rgba(0,0,0,0.3)]
367
- transition-all duration-500 ease-in-out`})}const DE='/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-700:oklch(37.3% .034 259.733);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xs:16rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-4{top:calc(var(--spacing)*-4)}.-top-6{top:calc(var(--spacing)*-6)}.-right-3{right:calc(var(--spacing)*-3)}.-bottom-3{bottom:calc(var(--spacing)*-3)}.left-2{left:calc(var(--spacing)*2)}.left-10{left:calc(var(--spacing)*10)}.z-10{z-index:10}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-5{margin-top:calc(var(--spacing)*5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-auto{aspect-ratio:auto}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-\\[80\\%\\]{height:80%}.h-\\[358px\\]{height:358px}.h-auto{height:auto}.w-1\\/5{width:20%}.w-3xs{width:var(--container-3xs)}.w-4\\/5{width:80%}.w-8{width:calc(var(--spacing)*8)}.w-\\[556px\\]{width:556px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[var\\(--max-container\\)\\]{max-width:var(--max-container)}.max-w-md{max-width:var(--container-md)}.min-w-20{min-width:calc(var(--spacing)*20)}.min-w-\\[var\\(--min-container\\)\\]{min-width:var(--min-container)}.shrink-0{flex-shrink:0}.rotate-0{rotate:none}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-4\\.5{gap:calc(var(--spacing)*4.5)}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s-lg{border-start-start-radius:var(--radius-lg);border-end-start-radius:var(--radius-lg)}.rounded-ss-2xl{border-start-start-radius:var(--radius-2xl)}.rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.rounded-se-2xl{border-start-end-radius:var(--radius-2xl)}.rounded-ee-2xl{border-end-end-radius:var(--radius-2xl)}.rounded-es-2xl{border-end-start-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-\\[\\#44c2c0\\]{border-color:#44c2c0}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-300{border-color:var(--color-gray-300)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-zinc-300{border-color:var(--color-zinc-300)}.border-zinc-400\\/50{border-color:#9f9fa980}@supports (color:color-mix(in lab,red,red)){.border-zinc-400\\/50{border-color:color-mix(in oklab,var(--color-zinc-400)50%,transparent)}}.border-t-gray-700{border-top-color:var(--color-gray-700)}.bg-\\[\\#32b316\\]{background-color:#32b316}.bg-\\[\\#44c2c0\\]{background-color:#44c2c0}.bg-\\[\\#44c2c0\\]\\/30{background-color:#44c2c04d}.bg-black\\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-zinc-300\\/60{background-color:#d4d4d899}@supports (color:color-mix(in lab,red,red)){.bg-zinc-300\\/60{background-color:color-mix(in oklab,var(--color-zinc-300)60%,transparent)}}.bg-zinc-500\\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\\/20{background-color:color-mix(in oklab,var(--color-zinc-500)20%,transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-6{padding-block:calc(var(--spacing)*6)}.pl-2{padding-left:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-nowrap{text-wrap:nowrap}.text-\\[\\#339c9b\\]{color:#339c9b}.text-amber-500{color:var(--color-amber-500)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.text-zinc-600{color:var(--color-zinc-600)}.text-zinc-800{color:var(--color-zinc-800)}.text-zinc-900{color:var(--color-zinc-900)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_15px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 0 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-red-600{outline-color:var(--color-red-600)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.placeholder\\:font-semibold::placeholder{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.placeholder\\:text-zinc-600::placeholder{color:var(--color-zinc-600)}@media (hover:hover){.hover\\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\\:bg-emerald-400:hover{background-color:var(--color-emerald-400)}.hover\\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:bg-zinc-300:hover{background-color:var(--color-zinc-300)}.hover\\:text-zinc-400:hover{color:var(--color-zinc-400)}.hover\\:text-zinc-900:hover{color:var(--color-zinc-900)}.hover\\:shadow-\\[0_0_30px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]:hover{--tw-shadow:0 0 30px var(--tw-shadow-color,#0000004d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:bg-white:focus{background-color:var(--color-white)}.focus\\:outline:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\\:outline-\\[\\#339c9b\\]:focus{outline-color:#339c9b}@media (min-width:48rem){.md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}}:root{--max-container:556px;--min-container:350px}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}';window.pbm=Ix();class ME extends HTMLElement{constructor(){super();g1(this,"root",null);g1(this,"props",{originalProductPrice:0,clientID:"",eanProduct:"",isAuthenticatedShopper:!1,customLoginUrl:"/login"});this.attachShadow({mode:"open"})}static get observedAttributes(){return["originalproductprice","clientid","eanproduct","isauthenticatedshopper","customloginurl"]}updatePropsFromAttributes(){const m=this.getAttribute("originalproductprice"),y=this.getAttribute("clientid"),g=this.getAttribute("eanproduct"),v=this.getAttribute("isauthenticatedshopper"),E=this.getAttribute("customloginurl");v!==null&&(this.props.isAuthenticatedShopper=v==="true"),E!==null&&(this.props.customLoginUrl=E===""?"/login":E),m!==null&&(this.props.originalProductPrice=m),y!==null&&(this.props.clientID=y),g!==null&&(this.props.eanProduct=g,g&&Eg.getState().setTargetProduct({ean:g,quantity:1}))}connectedCallback(){this.updatePropsFromAttributes(),this.mount()}attributeChangedCallback(m,y,g){m==="originalproductprice"&&(this.props.originalProductPrice=parseFloat(g)),m==="clientid"&&(this.props.clientID=g),m==="eanproduct"&&(this.props.eanProduct=g,g&&Eg.getState().setTargetProduct({ean:g,quantity:1})),m==="isauthenticatedshopper"&&(this.props.isAuthenticatedShopper=g==="true"),m==="customloginurl"&&(this.props.customLoginUrl=g===""?"/login":g),this.mount()}mount(){if(!this.isConnected)return;let m=this.shadowRoot;if(!(!m&&(this.attachShadow({mode:"open"}),m=this.shadowRoot,!m))){if(!m.querySelector("#pbm-shadow-root")){const y=document.createElement("div");y.id="pbm-shadow-root";const g=document.createElement("style");g.textContent=DE,m.appendChild(g),m.appendChild(y),this.root=Kx.createRoot(y)}this.root&&this.root.render(fe.jsx(zE,{...this.props}))}}}customElements.define("pbm-component",ME)})();
366
+ transition-all duration-500 ease-in-out`})}const DE='/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-700:oklch(37.3% .034 259.733);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xs:16rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-4{top:calc(var(--spacing)*-4)}.-top-6{top:calc(var(--spacing)*-6)}.-right-3{right:calc(var(--spacing)*-3)}.-bottom-3{bottom:calc(var(--spacing)*-3)}.left-2{left:calc(var(--spacing)*2)}.left-10{left:calc(var(--spacing)*10)}.z-10{z-index:10}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-5{margin-top:calc(var(--spacing)*5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-auto{aspect-ratio:auto}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-\\[80\\%\\]{height:80%}.h-\\[250px\\]{height:250px}.h-auto{height:auto}.w-1\\/5{width:20%}.w-3xs{width:var(--container-3xs)}.w-4\\/5{width:80%}.w-8{width:calc(var(--spacing)*8)}.w-\\[250px\\]{width:250px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[var\\(--max-container\\)\\]{max-width:var(--max-container)}.max-w-md{max-width:var(--container-md)}.min-w-20{min-width:calc(var(--spacing)*20)}.min-w-\\[var\\(--min-container\\)\\]{min-width:var(--min-container)}.shrink-0{flex-shrink:0}.rotate-0{rotate:none}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-4\\.5{gap:calc(var(--spacing)*4.5)}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s-lg{border-start-start-radius:var(--radius-lg);border-end-start-radius:var(--radius-lg)}.rounded-ss-2xl{border-start-start-radius:var(--radius-2xl)}.rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.rounded-se-2xl{border-start-end-radius:var(--radius-2xl)}.rounded-ee-2xl{border-end-end-radius:var(--radius-2xl)}.rounded-es-2xl{border-end-start-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-\\[\\#44c2c0\\]{border-color:#44c2c0}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-300{border-color:var(--color-gray-300)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-zinc-300{border-color:var(--color-zinc-300)}.border-zinc-400\\/50{border-color:#9f9fa980}@supports (color:color-mix(in lab,red,red)){.border-zinc-400\\/50{border-color:color-mix(in oklab,var(--color-zinc-400)50%,transparent)}}.border-t-gray-700{border-top-color:var(--color-gray-700)}.bg-\\[\\#32b316\\]{background-color:#32b316}.bg-\\[\\#44c2c0\\]{background-color:#44c2c0}.bg-\\[\\#44c2c0\\]\\/30{background-color:#44c2c04d}.bg-black\\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-zinc-300\\/60{background-color:#d4d4d899}@supports (color:color-mix(in lab,red,red)){.bg-zinc-300\\/60{background-color:color-mix(in oklab,var(--color-zinc-300)60%,transparent)}}.bg-zinc-500\\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\\/20{background-color:color-mix(in oklab,var(--color-zinc-500)20%,transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-6{padding-block:calc(var(--spacing)*6)}.pl-2{padding-left:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-nowrap{text-wrap:nowrap}.text-\\[\\#339c9b\\]{color:#339c9b}.text-amber-500{color:var(--color-amber-500)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.text-zinc-600{color:var(--color-zinc-600)}.text-zinc-800{color:var(--color-zinc-800)}.text-zinc-900{color:var(--color-zinc-900)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_15px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 0 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-red-600{outline-color:var(--color-red-600)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.placeholder\\:font-semibold::placeholder{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.placeholder\\:text-zinc-600::placeholder{color:var(--color-zinc-600)}@media (hover:hover){.hover\\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\\:bg-emerald-400:hover{background-color:var(--color-emerald-400)}.hover\\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:bg-zinc-300:hover{background-color:var(--color-zinc-300)}.hover\\:text-zinc-400:hover{color:var(--color-zinc-400)}.hover\\:text-zinc-900:hover{color:var(--color-zinc-900)}}.focus\\:bg-white:focus{background-color:var(--color-white)}.focus\\:outline:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\\:outline-\\[\\#339c9b\\]:focus{outline-color:#339c9b}@media (min-width:48rem){.md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}}:root{--max-container:556px;--min-container:350px}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}';window.pbm=Ix();class ME extends HTMLElement{constructor(){super();g1(this,"root",null);g1(this,"props",{originalProductPrice:0,clientID:"",eanProduct:"",isAuthenticatedShopper:!1,customLoginUrl:"/login"});this.attachShadow({mode:"open"})}static get observedAttributes(){return["originalproductprice","clientid","eanproduct","isauthenticatedshopper","customloginurl"]}updatePropsFromAttributes(){const m=this.getAttribute("originalproductprice"),y=this.getAttribute("clientid"),g=this.getAttribute("eanproduct"),v=this.getAttribute("isauthenticatedshopper"),E=this.getAttribute("customloginurl");v!==null&&(this.props.isAuthenticatedShopper=v==="true"),E!==null&&(this.props.customLoginUrl=E===""?"/login":E),m!==null&&(this.props.originalProductPrice=m),y!==null&&(this.props.clientID=y),g!==null&&(this.props.eanProduct=g,g&&Eg.getState().setTargetProduct({ean:g,quantity:1}))}connectedCallback(){this.updatePropsFromAttributes(),this.mount()}attributeChangedCallback(m,y,g){m==="originalproductprice"&&(this.props.originalProductPrice=parseFloat(g)),m==="clientid"&&(this.props.clientID=g),m==="eanproduct"&&(this.props.eanProduct=g,g&&Eg.getState().setTargetProduct({ean:g,quantity:1})),m==="isauthenticatedshopper"&&(this.props.isAuthenticatedShopper=g==="true"),m==="customloginurl"&&(this.props.customLoginUrl=g===""?"/login":g),this.mount()}mount(){if(!this.isConnected)return;let m=this.shadowRoot;if(!(!m&&(this.attachShadow({mode:"open"}),m=this.shadowRoot,!m))){if(!m.querySelector("#pbm-shadow-root")){const y=document.createElement("div");y.id="pbm-shadow-root";const g=document.createElement("style");g.textContent=DE,m.appendChild(g),m.appendChild(y),this.root=Kx.createRoot(y)}this.root&&this.root.render(fe.jsx(zE,{...this.props}))}}}customElements.define("pbm-component",ME)})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agrada_digital/pbm",
3
3
  "private": false,
4
- "version": "0.0.83",
4
+ "version": "0.0.84",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",