@agrada_digital/pbm 0.0.70 → 0.0.71
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 +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist-wc/pbm-wc.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -540,7 +540,7 @@ function Item({ data, onChange, checked }) {
|
|
|
540
540
|
"un"
|
|
541
541
|
] }),
|
|
542
542
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "ml-auto relative", children: [
|
|
543
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "absolute -top-4
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "absolute text-white -top-4 py-0.5 font-semibold text-xs bg-[#32b316] px-2 w-auto text-nowrap rounded-2xl -right-3", children: [
|
|
544
544
|
discountValue.toLocaleString("pt-BR", {
|
|
545
545
|
currency: "BRL",
|
|
546
546
|
currencyDisplay: "symbol",
|
|
@@ -710,7 +710,7 @@ function BenefitsTable() {
|
|
|
710
710
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
711
711
|
"form",
|
|
712
712
|
{
|
|
713
|
-
className: "flex flex-col items-center justify-start w-full gap-
|
|
713
|
+
className: "flex flex-col items-center justify-start w-full gap-4.5",
|
|
714
714
|
id: "form_benefits_table_pbm",
|
|
715
715
|
children: [
|
|
716
716
|
!benefitsItems && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-semibold text-start text-zinc-900", id: "benefits_empty_pbm", children: "N\xE3o foi poss\xEDvel encontrar benef\xEDcios para esse produto." }),
|
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}\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};\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});\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 ...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=\"32px\" height=\"32px\" 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 {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 </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-[#44c2c0]/30 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, targetProduct } = 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 securityNumber ?\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-3\"\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 {!securityNumber && (\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, 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 {securityNumber && (\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 </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\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, securityNumber } = 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 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=\"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 cursor-pointer rounded-lg gap-1\"\r\n id={\"label_benefits_\" + ID_INPUT}\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={!securityNumber}\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\">\r\n <span className=\"absolute -top-4 text-emerald-900 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}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"text-start font-normal 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_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 } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct } = usePBMStore();\n \n const fetchProductByEan = async () => {\n try {\n if(!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n return \n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\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 } catch (error) {\n console.error(error);\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 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(\"isActivated\")}\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\" && !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\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface GetAuthorizationParams {\r\n clientID: string;\r\n}\r\n\r\ninterface IAuthData {\r\n expiresIn: number;\r\n refreshExpiresIn: number;\r\n token: string;\r\n refreshToken: string;\r\n}\r\n\r\ninterface IResponseAuth extends IRequestDefault {\r\n data: IAuthData;\r\n}\r\n\r\nexport const GetAuthorization = async ({ clientID }: GetAuthorizationParams): Promise<IResponseAuth> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n const STORE_ID = import.meta.env.VITE_STORE_ID;\r\n const STORE_NAME = import.meta.env.VITE_STORE_NAME;\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 if (!STORE_ID || !STORE_NAME) {\r\n throw new Error('Store ID or Store Name is not defined in environment variables');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/auth`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({\r\n storeId: STORE_ID,\r\n storeName: STORE_NAME,\r\n clientId: clientID\r\n })\r\n });\r\n\r\n const dataResponse: IResponseAuth = 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 Cookies.set('pbm-token', dataResponse.data.token, {\r\n expires: dataResponse.data.expiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', dataResponse.data.refreshToken, {\r\n expires: dataResponse.data.refreshExpiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return dataResponse;\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;AAwBzB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S,SAAS;AACpB,0BAAkB;AAAA,MACpB,OAAO;AACL,gBAAQ,MAAM,+BAA+B;AAAA,MAC/C;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,iCAAiC,KAAK;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAGb,+BAAU,MAAM;AACd,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAE/B,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,aAAa;AAAA,YACrC,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,MAEjE,UAAU,iBAAiB,CAAC,WAC3B,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_jsx_runtime","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","import_meta","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}\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};\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});\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 ...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=\"32px\" height=\"32px\" 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 {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 </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-[#44c2c0]/30 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, targetProduct } = 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 securityNumber ?\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 {!securityNumber && (\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, 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 {securityNumber && (\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 </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\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, securityNumber } = 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 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=\"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 cursor-pointer rounded-lg gap-1\"\r\n id={\"label_benefits_\" + ID_INPUT}\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={!securityNumber}\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\">\r\n <span className=\"absolute 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}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"text-start font-normal 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_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 } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct } = usePBMStore();\n \n const fetchProductByEan = async () => {\n try {\n if(!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n return \n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\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 } catch (error) {\n console.error(error);\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 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(\"isActivated\")}\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\" && !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\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface GetAuthorizationParams {\r\n clientID: string;\r\n}\r\n\r\ninterface IAuthData {\r\n expiresIn: number;\r\n refreshExpiresIn: number;\r\n token: string;\r\n refreshToken: string;\r\n}\r\n\r\ninterface IResponseAuth extends IRequestDefault {\r\n data: IAuthData;\r\n}\r\n\r\nexport const GetAuthorization = async ({ clientID }: GetAuthorizationParams): Promise<IResponseAuth> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n const STORE_ID = import.meta.env.VITE_STORE_ID;\r\n const STORE_NAME = import.meta.env.VITE_STORE_NAME;\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 if (!STORE_ID || !STORE_NAME) {\r\n throw new Error('Store ID or Store Name is not defined in environment variables');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/auth`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({\r\n storeId: STORE_ID,\r\n storeName: STORE_NAME,\r\n clientId: clientID\r\n })\r\n });\r\n\r\n const dataResponse: IResponseAuth = 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 Cookies.set('pbm-token', dataResponse.data.token, {\r\n expires: dataResponse.data.expiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', dataResponse.data.refreshToken, {\r\n expires: dataResponse.data.refreshExpiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return dataResponse;\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)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MACH;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,iCAA6B,2BAAY,YAAY;AACzD,QAAI;AACF,YAAM,WAAW,MAAM,iBAAiB,EAAE,SAAmB,CAAC;AAE9D,UAAI,SAAS,SAAS;AACpB,0BAAkB;AAAA,MACpB,OAAO;AACL,gBAAQ,MAAM,+BAA+B;AAAA,MAC/C;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,iCAAiC,KAAK;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAGb,+BAAU,MAAM;AACd,+BAA2B;AAAA,EAC7B,GAAG,CAAC,0BAA0B,CAAC;AAE/B,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,aAAa;AAAA,YACrC,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,MAEjE,UAAU,iBAAiB,CAAC,WAC3B,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_jsx_runtime","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","import_meta","Cookies","import_lucide_react","import_js_cookie","import_meta","Cookies","import_jsx_runtime"]}
|
package/dist/index.mjs
CHANGED
|
@@ -502,7 +502,7 @@ function Item({ data, onChange, checked }) {
|
|
|
502
502
|
"un"
|
|
503
503
|
] }),
|
|
504
504
|
/* @__PURE__ */ jsxs5("section", { className: "ml-auto relative", children: [
|
|
505
|
-
/* @__PURE__ */ jsxs5("span", { className: "absolute -top-4
|
|
505
|
+
/* @__PURE__ */ jsxs5("span", { className: "absolute text-white -top-4 py-0.5 font-semibold text-xs bg-[#32b316] px-2 w-auto text-nowrap rounded-2xl -right-3", children: [
|
|
506
506
|
discountValue.toLocaleString("pt-BR", {
|
|
507
507
|
currency: "BRL",
|
|
508
508
|
currencyDisplay: "symbol",
|
|
@@ -671,7 +671,7 @@ function BenefitsTable() {
|
|
|
671
671
|
/* @__PURE__ */ jsxs6(
|
|
672
672
|
"form",
|
|
673
673
|
{
|
|
674
|
-
className: "flex flex-col items-center justify-start w-full gap-
|
|
674
|
+
className: "flex flex-col items-center justify-start w-full gap-4.5",
|
|
675
675
|
id: "form_benefits_table_pbm",
|
|
676
676
|
children: [
|
|
677
677
|
!benefitsItems && /* @__PURE__ */ jsx9("p", { className: "text-sm font-semibold text-start text-zinc-900", id: "benefits_empty_pbm", children: "N\xE3o foi poss\xEDvel encontrar benef\xEDcios para esse produto." }),
|
package/dist/index.mjs.map
CHANGED
|
@@ -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}\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};\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});\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 ...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=\"32px\" height=\"32px\" 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 {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 </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-[#44c2c0]/30 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, targetProduct } = 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 securityNumber ?\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-3\"\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 {!securityNumber && (\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, 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 {securityNumber && (\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 </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\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, securityNumber } = 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 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=\"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 cursor-pointer rounded-lg gap-1\"\r\n id={\"label_benefits_\" + ID_INPUT}\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={!securityNumber}\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\">\r\n <span className=\"absolute -top-4 text-emerald-900 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}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"text-start font-normal 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_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 } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct } = usePBMStore();\n \n const fetchProductByEan = async () => {\n try {\n if(!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n return \n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\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 } catch (error) {\n console.error(error);\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 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(\"isActivated\")}\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\" && !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\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface GetAuthorizationParams {\r\n clientID: string;\r\n}\r\n\r\ninterface IAuthData {\r\n expiresIn: number;\r\n refreshExpiresIn: number;\r\n token: string;\r\n refreshToken: string;\r\n}\r\n\r\ninterface IResponseAuth extends IRequestDefault {\r\n data: IAuthData;\r\n}\r\n\r\nexport const GetAuthorization = async ({ clientID }: GetAuthorizationParams): Promise<IResponseAuth> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n const STORE_ID = import.meta.env.VITE_STORE_ID;\r\n const STORE_NAME = import.meta.env.VITE_STORE_NAME;\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 if (!STORE_ID || !STORE_NAME) {\r\n throw new Error('Store ID or Store Name is not defined in environment variables');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/auth`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({\r\n storeId: STORE_ID,\r\n storeName: STORE_NAME,\r\n clientId: clientID\r\n })\r\n });\r\n\r\n const dataResponse: IResponseAuth = 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 Cookies.set('pbm-token', dataResponse.data.token, {\r\n expires: dataResponse.data.expiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', dataResponse.data.refreshToken, {\r\n expires: dataResponse.data.refreshExpiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return dataResponse;\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;AAwBzB,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;AACZ;AAEA,IAAM,iBAAyC,CAAC,SAAS;AAAA,EACvD,GAAG;AAAA,EAEH,mBAAmB,CAAC,mBAA2B,IAA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A,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","jsx","jsxs","Cookies","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}\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};\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});\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 ...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=\"32px\" height=\"32px\" 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 {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 </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-[#44c2c0]/30 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, targetProduct } = 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 securityNumber ?\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 {!securityNumber && (\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, 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 {securityNumber && (\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 </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\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, securityNumber } = 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 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=\"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 cursor-pointer rounded-lg gap-1\"\r\n id={\"label_benefits_\" + ID_INPUT}\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={!securityNumber}\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\">\r\n <span className=\"absolute 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}\r\n\r\nfunction Text(props: TextProps) {\r\n return (\r\n <p\r\n className={classNames(\r\n \"text-start font-normal 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_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 } from \"lucide-react\";\nimport { usePBMStore } from \"./libs/zustand/usePBM\";\nimport { GetProductByEAN } from \"./services/get-product-by-ean\";\n\nexport interface PBMProps {\n originalProductPrice: number | string;\n clientID: string;\n eanProduct: string;\n}\n\nfunction PBM({\n originalProductPrice,\n clientID,\n eanProduct,\n}: PBMProps) {\n const formatedOriginalProductPrice = Number(\n String(originalProductPrice).replace(',', '.')\n );\n\n const [loading, setLoading] = useState<boolean>(false);\n const { setState, state, setTargetProduct, targetProduct } = usePBMStore();\n \n const fetchProductByEan = async () => {\n try {\n if(!eanProduct) {\n console.error(\"PBMLOG: Ean is not defined.\")\n return \n }\n\n const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });\n\n if (response.success && response.data) {\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 } catch (error) {\n console.error(error);\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 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(\"isActivated\")}\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\" && !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\nimport { IRequestDefault } from \"../types/requests\";\r\n\r\ninterface GetAuthorizationParams {\r\n clientID: string;\r\n}\r\n\r\ninterface IAuthData {\r\n expiresIn: number;\r\n refreshExpiresIn: number;\r\n token: string;\r\n refreshToken: string;\r\n}\r\n\r\ninterface IResponseAuth extends IRequestDefault {\r\n data: IAuthData;\r\n}\r\n\r\nexport const GetAuthorization = async ({ clientID }: GetAuthorizationParams): Promise<IResponseAuth> => {\r\n const API_URL = import.meta.env.VITE_API_URL;\r\n const STORE_ID = import.meta.env.VITE_STORE_ID;\r\n const STORE_NAME = import.meta.env.VITE_STORE_NAME;\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 if (!STORE_ID || !STORE_NAME) {\r\n throw new Error('Store ID or Store Name is not defined in environment variables');\r\n }\r\n\r\n const response = await fetch(`${API_URL}/auth`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n },\r\n body: JSON.stringify({\r\n storeId: STORE_ID,\r\n storeName: STORE_NAME,\r\n clientId: clientID\r\n })\r\n });\r\n\r\n const dataResponse: IResponseAuth = 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 Cookies.set('pbm-token', dataResponse.data.token, {\r\n expires: dataResponse.data.expiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n Cookies.set('pbm-token-refresh', dataResponse.data.refreshToken, {\r\n expires: dataResponse.data.refreshExpiresIn / (60 * 60),\r\n secure: true,\r\n sameSite: 'Strict'\r\n });\r\n\r\n return dataResponse;\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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AAA,YACrC,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,MAEjE,UAAU,iBAAiB,CAAC,WAC3B,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","jsx","jsxs","Cookies","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 jw=Object.defineProperty;var Bw=(Or,Xi,_o)=>Xi in Or?jw(Or,Xi,{enumerable:!0,configurable:!0,writable:!0,value:_o}):Or[Xi]=_o;var y1=(Or,Xi,_o)=>Bw(Or,typeof Xi!="symbol"?Xi+"":Xi,_o);(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}}}@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-emerald-900:oklch(37.8% .077 168.94);--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-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-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--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-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-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-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-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.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-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-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-emerald-900{color:var(--color-emerald-900)}.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)}.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)}.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}.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-\\[\\#44c2c0\\]\\/30:focus{background-color:#44c2c04d}.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}@keyframes spin{to{transform:rotate(360deg)}}
|
|
1
|
+
var jw=Object.defineProperty;var Bw=(Or,Xi,_o)=>Xi in Or?jw(Or,Xi,{enumerable:!0,configurable:!0,writable:!0,value:_o}):Or[Xi]=_o;var y1=(Or,Xi,_o)=>Bw(Or,typeof Xi!="symbol"?Xi+"":Xi,_o);(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}}}@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-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-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--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-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-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-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-start{justify-content:flex-start}.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-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-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)}.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)}.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}.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-\\[\\#44c2c0\\]\\/30:focus{background-color:#44c2c04d}.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}@keyframes spin{to{transform:rotate(360deg)}}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(Or);function Xi(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var _o={exports:{}},fm={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -356,4 +356,4 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
356
356
|
*
|
|
357
357
|
* This source code is licensed under the ISC license.
|
|
358
358
|
* See the LICENSE file in the root directory of this source tree.
|
|
359
|
-
*/const p_=Qv("badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/*! js-cookie v3.0.5 | MIT */function Hg(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 g_={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 Jv(d,s){function m(g,v,_){if(!(typeof document>"u")){_=Hg({},s,_),typeof _.expires=="number"&&(_.expires=new Date(Date.now()+_.expires*864e5)),_.expires&&(_.expires=_.expires.toUTCString()),g=encodeURIComponent(g).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var R="";for(var j in _)_[j]&&(R+="; "+j,_[j]!==!0&&(R+="="+_[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("; "):[],_={},R=0;R<v.length;R++){var j=v[R].split("="),A=j.slice(1).join("=");try{var Q=decodeURIComponent(j[0]);if(_[Q]=d.read(A,Q),g===Q)break}catch{}}return g?_[g]:_}}return Object.create({set:m,get:y,remove:function(g,v){m(g,"",Hg({},v,{expires:-1}))},withAttributes:function(g){return Jv(this.converter,Hg({},this.attributes,g))},withConverter:function(g){return Jv(Hg({},this.converter,g),this.attributes)}},{attributes:{value:Object.freeze(s)},converter:{value:Object.freeze(d)}})}var wm=Jv(g_,{path:"/"});const US=async({document:d,products:s})=>{const m="https://pbm.agradadigital.agradalabs.com/api/v1",y=wm.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 kg(d){return pe.jsx("button",{...d,className:Qi("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 v_({setLoading:d}){const{setSecurityNumber:s,setState:m,securityNumber:y,targetProduct:g,setUrlAcceptTerms:v,setUrlRegisterIndustry:_}=wo(),[R,j]=sn.useState(!1),{handleSubmit:A,register:Q,setValue:ce,clearErrors:L,unregister:q,formState:{errors:de}}=PE({resolver:c_(DE),mode:"onSubmit",defaultValues:{securityNumber:y||"",coupon:""}}),He=async Xe=>{R||ce("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 Fe=await US({document:Xe.securityNumber.replace(/\D/g,""),products:[{productId:g.productId,ean:g.ean,requestedQuantity:1,listPrice:g.listPrice,netPrice:g.netPrice??g.listPrice}]});if(Fe.success){const _e={acceptance:"isInvalid","industry registration":"isRegistered",active:"isActivated"};if(s(Xe.securityNumber),m(_e[Fe.data.product[0].statusCustomer]),_e[Fe.data.product[0].statusCustomer]==="isInvalid"){v(Fe.data.product[0].urlAcceptTerm||void 0);return}if(_e[Fe.data.product[0].statusCustomer]==="isRegistered"){_(Fe.data.product[0].informativeLink);return}}}catch(Fe){console.error("PBMLOG: Error validating document -",Fe)}finally{d(!1)}};return pe.jsxs(pe.Fragment,{children:[pe.jsxs("form",{onSubmit:A(He),className:Qi("w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",{"mb-4":de.securityNumber||de.coupon&&R,"gap-2":R}),id:"form_security_number_pbm",children:[pe.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:[pe.jsx("input",{type:"text",className:Qi("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":de.securityNumber,"rounded-lg":R}),placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...Q("securityNumber",{onChange:Xe=>{const Fe=ME(Xe.target.value);ce("securityNumber",Fe,{shouldValidate:!0})}}),defaultValue:y||"",id:"input_security_number_pbm"}),de.securityNumber&&pe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:de.securityNumber.message})]}),R&&pe.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:[pe.jsx("input",{type:"text",className:Qi("w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:outline-[#339c9b] focus:bg-[#44c2c0]/30 text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":de.coupon,"rounded-lg":R}),placeholder:"Cupom / ID do Cartão",...Q("coupon",{required:R?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!R,onChange:Xe=>{ce("coupon",Xe.target.value,{shouldValidate:R})}}),id:"input_coupon_pbm"}),de.coupon&&pe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:de.coupon.message})]}),pe.jsx("button",{type:"submit",className:Qi("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:pe.jsx(Kv,{size:24,color:"white",strokeWidth:2})})]}),pe.jsxs(kg,{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 Xe=!R;j(Xe),Xe||(q("coupon"),L("coupon"))},id:"check_benefits_button",children:[pe.jsx("span",{children:R?"Não possui cupom?":"Possui cupom?"}),pe.jsx(Kv,{size:16,className:Qi({"rotate-0":!R,"rotate-180":R})})]})]})}function b_({textColor:d}){return pe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[pe.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"}),pe.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 $v(d){return pe.jsx("h2",{className:Qi("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 S_({data:d,onChange:s,checked:m}){const{setAvailableDiscountSelected:y,securityNumber:g}=wo(),v="unity_quantity_"+d.authorizedQuantity,_=d.discountPercentual/100,R=d.grossPrice*_,j=R*d.authorizedQuantity,A=d.grossPrice*d.authorizedQuantity-j,Q=sn.useCallback(()=>{if(m){const ce=L=>Math.round(L*100)/100;y({discount:{total:ce(j),unit:ce(R)},quantity:d.authorizedQuantity,totalPrice:ce(A),grossPrice:d.grossPrice})}},[m,d.authorizedQuantity,y,j,A,R]);return sn.useEffect(()=>{Q()},[Q]),pe.jsxs("label",{htmlFor:v,className:"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 cursor-pointer rounded-lg gap-1",id:"label_benefits_"+v,children:[pe.jsx("input",{type:"radio",name:"benefits_discount",id:v,className:"hidden",checked:m,onChange:s,disabled:!g}),m?pe.jsx(y_,{color:"#32b316",size:20}):pe.jsx(p_,{color:"#9f9fa9",size:20}),pe.jsxs("span",{className:"text-zinc-900 font-semibold text-sm",children:[d.authorizedQuantity,"un"]}),pe.jsxs("section",{className:"ml-auto relative",children:[pe.jsxs("span",{className:"absolute -top-4 text-emerald-900 py-0.5 font-semibold text-xs bg-[#32b316] px-2 w-auto text-nowrap rounded-2xl -right-3",children:[j.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]}),pe.jsx("strong",{className:"text-zinc-900 font-semibold text-sm text-center",children:A.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})})]})]})}const T_=async({products:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=wm.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 x_(){const{securityNumber:d,setState:s,targetProduct:m}=wo(),[y,g]=sn.useState(null),[v,_]=sn.useState(!0),[R,j]=sn.useState();return sn.useEffect(()=>{d?(async()=>{if(!d){console.error("PBMLOG: Document is not defined");return}if(!(m!=null&&m.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!m.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!m.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!m.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const ce={productId:Number(m.productId),ean:m.ean,requestedQuantity:1,listPrice:m.listPrice,netPrice:m.price},L=await US({document:d,products:[ce]});L.success&&L.data?j(L.data.product):j(void 0)}catch(ce){j(void 0),console.error(ce)}finally{_(!1)}})():(async()=>{if(!(m!=null&&m.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!m.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!m.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!m.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const ce={productId:Number(m.productId),ean:m.ean,requestedQuantity:1,listPrice:m.listPrice,netPrice:m.price},L=await T_({products:[ce]});L.success&&L.data?j(L.data):j(void 0)}catch(ce){j(void 0),console.error(ce)}finally{_(!1)}})()},[]),v?pe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[pe.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"}),pe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"loading_label",children:"Buscando beneficios disponíveis..."})]}):pe.jsxs("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[pe.jsx($v,{children:"Descontos disponíveis:"}),pe.jsxs("form",{className:"flex flex-col items-center justify-start w-full gap-3",id:"form_benefits_table_pbm",children:[!R&&pe.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."}),R&&R.map((A,Q)=>{const ce="unity_quantity_"+A.authorizedQuantity;return pe.jsx(S_,{data:A,checked:y===ce,onChange:()=>g(ce)},Q)}),R&&pe.jsx("p",{className:"w-full text-sm font-semibold text-center text-zinc-600",id:"benefits_empty_pbm",children:R[0].informativeMessage})]}),!d&&pe.jsxs(kg,{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, por favor"," ",pe.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"})]}),d&&pe.jsx(kg,{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:pe.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"})})]})}function NS(d){return pe.jsx("p",{className:Qi("text-start font-normal text-sm text-zinc-900",d.className),style:{color:d.textColor,fontSize:d.textSize},"data-testid":"test_id_text",id:"text_pbm",children:d.children})}const E_=d=>d===void 0?"":"?"+Object.keys(d).map(s=>s+"="+d[s]).join("&");function HS(d){const{setState:s}=wo();return pe.jsx("a",{...d,target:"_blank",href:typeof d.href=="string"?d.href:d.href.pathname+E_(d.href.param),className:Qi("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 __({textColor:d}){const{urlAcceptTerms:s}=wo();return pe.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:[pe.jsx($v,{className:"w-full",textColor:d,children:"CPF não cadastrado."}),pe.jsxs(NS,{className:"w-full",textColor:d,children:["Conclua seu cadastro para habilitar o benefício. ",pe.jsx("br",{}),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]}),pe.jsx(HS,{href:s||"",children:"Aceitar os termos"})]})}function w_({textColor:d}){const{urlRegisterIndustry:s}=wo();return pe.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:[pe.jsx($v,{className:"w-full",textColor:d,children:"Ops, seu CPF ainda não está habilitado para este produto."}),pe.jsx(NS,{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."}),pe.jsx(HS,{href:s||"",children:"Ativar CPF"})]})}const A_=async({clientID:d})=>{const v=await(await fetch("https://pbm.agradadigital.agradalabs.com/api/v1/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storeId:"84521053000148",storeName:"agradadigital",clientId:d})})).json();if(!v.success)throw new Error(v.message||"Failed to fetch authorization");return wm.set("pbm-token",v.data.token,{expires:v.data.expiresIn/(60*60),secure:!0,sameSite:"Strict"}),wm.set("pbm-token-refresh",v.data.refreshToken,{expires:v.data.refreshExpiresIn/(60*60),secure:!0,sameSite:"Strict"}),v},R_=async({PRODUCT_EAN:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=wm.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 O_({originalProductPrice:d,clientID:s,eanProduct:m}){const y=Number(String(d).replace(",",".")),[g,v]=sn.useState(!1),{setState:_,state:R,setTargetProduct:j,targetProduct:A}=wo(),Q=async()=>{try{if(!m){console.error("PBMLOG: Ean is not defined.");return}const L=await R_({PRODUCT_EAN:m});if(L.success&&L.data){const{pbm:q,sku:de,...He}=L.data;j({...A,...He,productId:Number(He.productId),informativeMessage:q.informativeMessage??"",discountMax:q.discountMax??0,industryLogo:q.imageLink??void 0,ean:m})}}catch(L){console.error(L)}},ce=sn.useCallback(async()=>{try{(await A_({clientID:s})).success?Q():console.error("PBMLOG: Authorization failed!")}catch(L){console.error("Error fetching authorization:",L)}},[s]);return sn.useEffect(()=>{ce()},[ce]),pe.jsx("div",{id:"pbm-library-root",children:pe.jsxs(H1,{variant:"main",children:[pe.jsx(Px,{originalProductPrice:y||0}),pe.jsxs(H1,{variant:"simple",children:[R==="isEmpty"&&!g&&pe.jsxs(pe.Fragment,{children:[pe.jsx(v_,{setLoading:v}),pe.jsxs(kg,{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:()=>_("isActivated"),id:"check_benefits_button",children:[pe.jsx("span",{children:"Consultar benefícios"}),pe.jsx(Kv,{size:16})]})]}),R==="isEmpty"&&g&&pe.jsx(b_,{}),R==="isInvalid"&&!g&&pe.jsx(__,{}),R==="isRegistered"&&!g&&pe.jsx(w_,{}),R==="isActivated"&&!g&&pe.jsx(x_,{})]}),pe.jsx(aE,{})]})})}const z_='/*! 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}}}@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-emerald-900:oklch(37.8% .077 168.94);--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-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-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--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-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-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-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-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.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-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-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-emerald-900{color:var(--color-emerald-900)}.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)}.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)}.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}.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-\\[\\#44c2c0\\]\\/30:focus{background-color:#44c2c04d}.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}@keyframes spin{to{transform:rotate(360deg)}}';window.pbm=Ix();class D_ extends HTMLElement{constructor(){super();y1(this,"root",null);y1(this,"props",{originalProductPrice:0,clientID:"",eanProduct:""});this.attachShadow({mode:"open"})}static get observedAttributes(){return["originalproductprice","clientid","eanproduct"]}updatePropsFromAttributes(){const m=this.getAttribute("originalproductprice"),y=this.getAttribute("clientid"),g=this.getAttribute("eanproduct");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})),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=z_,m.appendChild(g),m.appendChild(y),this.root=Kx.createRoot(y)}this.root&&this.root.render(pe.jsx(O_,{...this.props}))}}}customElements.define("pbm-component",D_)})();
|
|
359
|
+
*/const p_=Qv("badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/*! js-cookie v3.0.5 | MIT */function Hg(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 g_={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 Jv(d,s){function m(g,v,_){if(!(typeof document>"u")){_=Hg({},s,_),typeof _.expires=="number"&&(_.expires=new Date(Date.now()+_.expires*864e5)),_.expires&&(_.expires=_.expires.toUTCString()),g=encodeURIComponent(g).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var R="";for(var j in _)_[j]&&(R+="; "+j,_[j]!==!0&&(R+="="+_[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("; "):[],_={},R=0;R<v.length;R++){var j=v[R].split("="),A=j.slice(1).join("=");try{var Q=decodeURIComponent(j[0]);if(_[Q]=d.read(A,Q),g===Q)break}catch{}}return g?_[g]:_}}return Object.create({set:m,get:y,remove:function(g,v){m(g,"",Hg({},v,{expires:-1}))},withAttributes:function(g){return Jv(this.converter,Hg({},this.attributes,g))},withConverter:function(g){return Jv(Hg({},this.converter,g),this.attributes)}},{attributes:{value:Object.freeze(s)},converter:{value:Object.freeze(d)}})}var wm=Jv(g_,{path:"/"});const US=async({document:d,products:s})=>{const m="https://pbm.agradadigital.agradalabs.com/api/v1",y=wm.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 kg(d){return pe.jsx("button",{...d,className:Qi("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 v_({setLoading:d}){const{setSecurityNumber:s,setState:m,securityNumber:y,targetProduct:g,setUrlAcceptTerms:v,setUrlRegisterIndustry:_}=wo(),[R,j]=sn.useState(!1),{handleSubmit:A,register:Q,setValue:ce,clearErrors:L,unregister:q,formState:{errors:de}}=PE({resolver:c_(DE),mode:"onSubmit",defaultValues:{securityNumber:y||"",coupon:""}}),He=async Xe=>{R||ce("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 Fe=await US({document:Xe.securityNumber.replace(/\D/g,""),products:[{productId:g.productId,ean:g.ean,requestedQuantity:1,listPrice:g.listPrice,netPrice:g.netPrice??g.listPrice}]});if(Fe.success){const _e={acceptance:"isInvalid","industry registration":"isRegistered",active:"isActivated"};if(s(Xe.securityNumber),m(_e[Fe.data.product[0].statusCustomer]),_e[Fe.data.product[0].statusCustomer]==="isInvalid"){v(Fe.data.product[0].urlAcceptTerm||void 0);return}if(_e[Fe.data.product[0].statusCustomer]==="isRegistered"){_(Fe.data.product[0].informativeLink);return}}}catch(Fe){console.error("PBMLOG: Error validating document -",Fe)}finally{d(!1)}};return pe.jsxs(pe.Fragment,{children:[pe.jsxs("form",{onSubmit:A(He),className:Qi("w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",{"mb-4":de.securityNumber||de.coupon&&R,"gap-2":R}),id:"form_security_number_pbm",children:[pe.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:[pe.jsx("input",{type:"text",className:Qi("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":de.securityNumber,"rounded-lg":R}),placeholder:"Digite seu CPF aqui...",required:!0,maxLength:14,...Q("securityNumber",{onChange:Xe=>{const Fe=ME(Xe.target.value);ce("securityNumber",Fe,{shouldValidate:!0})}}),defaultValue:y||"",id:"input_security_number_pbm"}),de.securityNumber&&pe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"security_number_form_error",children:de.securityNumber.message})]}),R&&pe.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:[pe.jsx("input",{type:"text",className:Qi("w-full h-10 bg-gray-100 rounded-s-lg text-sm font-semibold focus:outline focus:outline-[#339c9b] focus:bg-[#44c2c0]/30 text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",{"outline outline-red-600":de.coupon,"rounded-lg":R}),placeholder:"Cupom / ID do Cartão",...Q("coupon",{required:R?"Cupom / ID do Cartão obrigatório.":!1,shouldUnregister:!R,onChange:Xe=>{ce("coupon",Xe.target.value,{shouldValidate:R})}}),id:"input_coupon_pbm"}),de.coupon&&pe.jsx("span",{className:"text-red-400 text-xs font-semibold absolute -bottom-3 left-2 text-nowrap",id:"coupon_form_error",children:de.coupon.message})]}),pe.jsx("button",{type:"submit",className:Qi("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:pe.jsx(Kv,{size:24,color:"white",strokeWidth:2})})]}),pe.jsxs(kg,{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 Xe=!R;j(Xe),Xe||(q("coupon"),L("coupon"))},id:"check_benefits_button",children:[pe.jsx("span",{children:R?"Não possui cupom?":"Possui cupom?"}),pe.jsx(Kv,{size:16,className:Qi({"rotate-0":!R,"rotate-180":R})})]})]})}function b_({textColor:d}){return pe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[pe.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"}),pe.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 $v(d){return pe.jsx("h2",{className:Qi("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 S_({data:d,onChange:s,checked:m}){const{setAvailableDiscountSelected:y,securityNumber:g}=wo(),v="unity_quantity_"+d.authorizedQuantity,_=d.discountPercentual/100,R=d.grossPrice*_,j=R*d.authorizedQuantity,A=d.grossPrice*d.authorizedQuantity-j,Q=sn.useCallback(()=>{if(m){const ce=L=>Math.round(L*100)/100;y({discount:{total:ce(j),unit:ce(R)},quantity:d.authorizedQuantity,totalPrice:ce(A),grossPrice:d.grossPrice})}},[m,d.authorizedQuantity,y,j,A,R]);return sn.useEffect(()=>{Q()},[Q]),pe.jsxs("label",{htmlFor:v,className:"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 cursor-pointer rounded-lg gap-1",id:"label_benefits_"+v,children:[pe.jsx("input",{type:"radio",name:"benefits_discount",id:v,className:"hidden",checked:m,onChange:s,disabled:!g}),m?pe.jsx(y_,{color:"#32b316",size:20}):pe.jsx(p_,{color:"#9f9fa9",size:20}),pe.jsxs("span",{className:"text-zinc-900 font-semibold text-sm",children:[d.authorizedQuantity,"un"]}),pe.jsxs("section",{className:"ml-auto relative",children:[pe.jsxs("span",{className:"absolute text-white -top-4 py-0.5 font-semibold text-xs bg-[#32b316] px-2 w-auto text-nowrap rounded-2xl -right-3",children:[j.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})," ","OFF"]}),pe.jsx("strong",{className:"text-zinc-900 font-semibold text-sm text-center",children:A.toLocaleString("pt-BR",{currency:"BRL",currencyDisplay:"symbol",currencySign:"standard",style:"currency"})})]})]})}const T_=async({products:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=wm.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 x_(){const{securityNumber:d,setState:s,targetProduct:m}=wo(),[y,g]=sn.useState(null),[v,_]=sn.useState(!0),[R,j]=sn.useState();return sn.useEffect(()=>{d?(async()=>{if(!d){console.error("PBMLOG: Document is not defined");return}if(!(m!=null&&m.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!m.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!m.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!m.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const ce={productId:Number(m.productId),ean:m.ean,requestedQuantity:1,listPrice:m.listPrice,netPrice:m.price},L=await US({document:d,products:[ce]});L.success&&L.data?j(L.data.product):j(void 0)}catch(ce){j(void 0),console.error(ce)}finally{_(!1)}})():(async()=>{if(!(m!=null&&m.productId)){console.error("PBMLOG: Product ID is not defined on targetProduct");return}if(!m.ean){console.error("PBMLOG: EAN is not defined on targetProduct");return}if(!m.listPrice){console.error("PBMLOG: List Price is not defined on targetProduct");return}if(!m.price){console.error("PBMLOG: Price is not defined on targetProduct");return}try{const ce={productId:Number(m.productId),ean:m.ean,requestedQuantity:1,listPrice:m.listPrice,netPrice:m.price},L=await T_({products:[ce]});L.success&&L.data?j(L.data):j(void 0)}catch(ce){j(void 0),console.error(ce)}finally{_(!1)}})()},[]),v?pe.jsxs("main",{className:"flex items-center justify-center gap-4",id:"loading_pbm",children:[pe.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"}),pe.jsx("p",{className:"text-sm font-semibold text-start text-zinc-900",id:"loading_label",children:"Buscando beneficios disponíveis..."})]}):pe.jsxs("section",{className:"flex items-start justify-center gap-4 w-full h-auto flex-col",id:"benefits_table_pbm",children:[pe.jsx($v,{children:"Descontos disponíveis:"}),pe.jsxs("form",{className:"flex flex-col items-center justify-start w-full gap-4.5",id:"form_benefits_table_pbm",children:[!R&&pe.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."}),R&&R.map((A,Q)=>{const ce="unity_quantity_"+A.authorizedQuantity;return pe.jsx(S_,{data:A,checked:y===ce,onChange:()=>g(ce)},Q)}),R&&pe.jsx("p",{className:"w-full text-sm font-semibold text-center text-zinc-600",id:"benefits_empty_pbm",children:R[0].informativeMessage})]}),!d&&pe.jsxs(kg,{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, por favor"," ",pe.jsx("span",{className:"underline",children:"insira seu cpf para utilizar os benefícios"})]}),d&&pe.jsx(kg,{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:pe.jsx("span",{className:"underline",children:"Deseja editar o cpf digitado?"})})]})}function NS(d){return pe.jsx("p",{className:Qi("text-start font-normal text-sm text-zinc-900",d.className),style:{color:d.textColor,fontSize:d.textSize},"data-testid":"test_id_text",id:"text_pbm",children:d.children})}const E_=d=>d===void 0?"":"?"+Object.keys(d).map(s=>s+"="+d[s]).join("&");function HS(d){const{setState:s}=wo();return pe.jsx("a",{...d,target:"_blank",href:typeof d.href=="string"?d.href:d.href.pathname+E_(d.href.param),className:Qi("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 __({textColor:d}){const{urlAcceptTerms:s}=wo();return pe.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:[pe.jsx($v,{className:"w-full",textColor:d,children:"CPF não cadastrado."}),pe.jsxs(NS,{className:"w-full",textColor:d,children:["Conclua seu cadastro para habilitar o benefício. ",pe.jsx("br",{}),"Ao clicar em “Aceitar os termos”, você irá para uma página externa. Aceite os termos e volte para continuar."]}),pe.jsx(HS,{href:s||"",children:"Aceitar os termos"})]})}function w_({textColor:d}){const{urlRegisterIndustry:s}=wo();return pe.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:[pe.jsx($v,{className:"w-full",textColor:d,children:"Ops, seu CPF ainda não está habilitado para este produto."}),pe.jsx(NS,{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."}),pe.jsx(HS,{href:s||"",children:"Ativar CPF"})]})}const A_=async({clientID:d})=>{const v=await(await fetch("https://pbm.agradadigital.agradalabs.com/api/v1/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storeId:"84521053000148",storeName:"agradadigital",clientId:d})})).json();if(!v.success)throw new Error(v.message||"Failed to fetch authorization");return wm.set("pbm-token",v.data.token,{expires:v.data.expiresIn/(60*60),secure:!0,sameSite:"Strict"}),wm.set("pbm-token-refresh",v.data.refreshToken,{expires:v.data.refreshExpiresIn/(60*60),secure:!0,sameSite:"Strict"}),v},R_=async({PRODUCT_EAN:d})=>{const s="https://pbm.agradadigital.agradalabs.com/api/v1",m=wm.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 O_({originalProductPrice:d,clientID:s,eanProduct:m}){const y=Number(String(d).replace(",",".")),[g,v]=sn.useState(!1),{setState:_,state:R,setTargetProduct:j,targetProduct:A}=wo(),Q=async()=>{try{if(!m){console.error("PBMLOG: Ean is not defined.");return}const L=await R_({PRODUCT_EAN:m});if(L.success&&L.data){const{pbm:q,sku:de,...He}=L.data;j({...A,...He,productId:Number(He.productId),informativeMessage:q.informativeMessage??"",discountMax:q.discountMax??0,industryLogo:q.imageLink??void 0,ean:m})}}catch(L){console.error(L)}},ce=sn.useCallback(async()=>{try{(await A_({clientID:s})).success?Q():console.error("PBMLOG: Authorization failed!")}catch(L){console.error("Error fetching authorization:",L)}},[s]);return sn.useEffect(()=>{ce()},[ce]),pe.jsx("div",{id:"pbm-library-root",children:pe.jsxs(H1,{variant:"main",children:[pe.jsx(Px,{originalProductPrice:y||0}),pe.jsxs(H1,{variant:"simple",children:[R==="isEmpty"&&!g&&pe.jsxs(pe.Fragment,{children:[pe.jsx(v_,{setLoading:v}),pe.jsxs(kg,{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:()=>_("isActivated"),id:"check_benefits_button",children:[pe.jsx("span",{children:"Consultar benefícios"}),pe.jsx(Kv,{size:16})]})]}),R==="isEmpty"&&g&&pe.jsx(b_,{}),R==="isInvalid"&&!g&&pe.jsx(__,{}),R==="isRegistered"&&!g&&pe.jsx(w_,{}),R==="isActivated"&&!g&&pe.jsx(x_,{})]}),pe.jsx(aE,{})]})})}const z_='/*! 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}}}@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-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-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--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-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-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-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-start{justify-content:flex-start}.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-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-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)}.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)}.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}.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-\\[\\#44c2c0\\]\\/30:focus{background-color:#44c2c04d}.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}@keyframes spin{to{transform:rotate(360deg)}}';window.pbm=Ix();class D_ extends HTMLElement{constructor(){super();y1(this,"root",null);y1(this,"props",{originalProductPrice:0,clientID:"",eanProduct:""});this.attachShadow({mode:"open"})}static get observedAttributes(){return["originalproductprice","clientid","eanproduct"]}updatePropsFromAttributes(){const m=this.getAttribute("originalproductprice"),y=this.getAttribute("clientid"),g=this.getAttribute("eanproduct");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})),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=z_,m.appendChild(g),m.appendChild(y),this.root=Kx.createRoot(y)}this.root&&this.root.render(pe.jsx(O_,{...this.props}))}}}customElements.define("pbm-component",D_)})();
|