@agrada_digital/pbm 0.0.69 → 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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +99 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -90
- package/dist/index.mjs.map +1 -1
- package/dist-wc/pbm-wc.js +76 -76
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -107,72 +107,20 @@ var Container_default = Container;
|
|
|
107
107
|
|
|
108
108
|
// src/components/Footer/index.tsx
|
|
109
109
|
import classNames2 from "classnames";
|
|
110
|
-
import { useEffect, useState } from "react";
|
|
111
|
-
|
|
112
|
-
// src/services/get-product-by-ean.ts
|
|
113
|
-
import Cookies from "js-cookie";
|
|
114
|
-
var GetProductByEAN = async ({ PRODUCT_EAN }) => {
|
|
115
|
-
const API_URL = import.meta.env.VITE_API_URL;
|
|
116
|
-
const AUTH_TOKEN = Cookies.get("pbm-token");
|
|
117
|
-
if (!AUTH_TOKEN) {
|
|
118
|
-
throw new Error("Token is not defined in cookies or is expired");
|
|
119
|
-
}
|
|
120
|
-
const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {
|
|
121
|
-
method: "GET",
|
|
122
|
-
headers: {
|
|
123
|
-
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
124
|
-
"Content-Type": "application/json"
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
const dataResponse = await response.json();
|
|
128
|
-
if (!dataResponse.success) {
|
|
129
|
-
throw new Error(dataResponse.message || "Failed to fetch authorization");
|
|
130
|
-
}
|
|
131
|
-
return dataResponse;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// src/components/Footer/index.tsx
|
|
135
110
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
136
111
|
function Footer() {
|
|
137
|
-
const [industryLogo, setIndustryLogo] = useState(null);
|
|
138
112
|
const { targetProduct, setTargetProduct, state } = usePBMStore();
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (!targetProduct?.ean) return;
|
|
141
|
-
let isMounted = true;
|
|
142
|
-
const fetchProductByEan = async () => {
|
|
143
|
-
try {
|
|
144
|
-
const response = await GetProductByEAN({ PRODUCT_EAN: targetProduct.ean });
|
|
145
|
-
if (response.success && response.data) {
|
|
146
|
-
setIndustryLogo(response.data.pbm.imageLink);
|
|
147
|
-
const { pbm, sku, ...targetProductNewData } = response.data;
|
|
148
|
-
setTargetProduct({
|
|
149
|
-
...targetProduct,
|
|
150
|
-
...targetProductNewData,
|
|
151
|
-
productId: Number(targetProductNewData.productId),
|
|
152
|
-
informativeMessage: pbm.informativeMessage ?? "",
|
|
153
|
-
discountMax: pbm.discountMax ?? 0
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error(error);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
fetchProductByEan();
|
|
161
|
-
return () => {
|
|
162
|
-
isMounted = false;
|
|
163
|
-
};
|
|
164
|
-
}, [targetProduct?.ean]);
|
|
165
113
|
return /* @__PURE__ */ jsxs2("footer", { className: "w-full h-auto relative", id: "footer_pbm", children: [
|
|
166
114
|
state !== "isActivated" && targetProduct?.informativeMessage && /* @__PURE__ */ jsx3("p", { className: "text-start mb-3 font-semibold text-sm text-amber-500", children: targetProduct?.informativeMessage }),
|
|
167
|
-
/* @__PURE__ */ jsxs2("section", { className: classNames2("flex items-center w-full h-auto gap-4", { "justify-center": industryLogo, "justify-start": !industryLogo }), children: [
|
|
115
|
+
/* @__PURE__ */ jsxs2("section", { className: classNames2("flex items-center w-full h-auto gap-4", { "justify-center": targetProduct?.industryLogo, "justify-start": !targetProduct?.industryLogo }), children: [
|
|
168
116
|
/* @__PURE__ */ jsxs2("section", { className: "w-4/5 h-auto", children: [
|
|
169
117
|
/* @__PURE__ */ jsx3("h3", { className: "text-start font-semibold text-sm", children: "Economize com o benef\xEDcio do laborat\xF3rio." }),
|
|
170
118
|
/* @__PURE__ */ jsx3("p", { className: "text-start font-normal text-sm", children: "Este produto tem pre\xE7o exclusivo para clientes cadastrados no programa." })
|
|
171
119
|
] }),
|
|
172
|
-
industryLogo && /* @__PURE__ */ jsx3(
|
|
120
|
+
targetProduct?.industryLogo && /* @__PURE__ */ jsx3(
|
|
173
121
|
"img",
|
|
174
122
|
{
|
|
175
|
-
src: industryLogo,
|
|
123
|
+
src: targetProduct.industryLogo,
|
|
176
124
|
alt: "parceiro",
|
|
177
125
|
className: "w-1/5 min-w-20 h-auto aspect-auto rounded-xl",
|
|
178
126
|
loading: "eager",
|
|
@@ -213,16 +161,16 @@ import classNames4 from "classnames";
|
|
|
213
161
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
214
162
|
import { useForm } from "react-hook-form";
|
|
215
163
|
import { ArrowRight } from "lucide-react";
|
|
216
|
-
import { useState
|
|
164
|
+
import { useState } from "react";
|
|
217
165
|
|
|
218
166
|
// src/services/benefits-with-document.ts
|
|
219
|
-
import
|
|
167
|
+
import Cookies from "js-cookie";
|
|
220
168
|
var BenefitsWithDocument = async ({ document, products }) => {
|
|
221
169
|
const API_URL = import.meta.env.VITE_API_URL;
|
|
222
170
|
if (!API_URL) {
|
|
223
171
|
throw new Error("API URL is not defined in environment variables");
|
|
224
172
|
}
|
|
225
|
-
const AUTH_TOKEN =
|
|
173
|
+
const AUTH_TOKEN = Cookies.get("pbm-token");
|
|
226
174
|
if (!AUTH_TOKEN) {
|
|
227
175
|
throw new Error("Token is not defined in cookies or is expired");
|
|
228
176
|
}
|
|
@@ -250,7 +198,7 @@ function Button(props) {
|
|
|
250
198
|
{
|
|
251
199
|
...props,
|
|
252
200
|
className: classNames3(
|
|
253
|
-
"w-3xs cursor-pointer h-10 rounded-
|
|
201
|
+
"w-3xs cursor-pointer h-10 rounded-lg bg-emerald-500 hover:bg-emerald-400 text-white text-sm font-semibold transition-colors",
|
|
254
202
|
props.className
|
|
255
203
|
),
|
|
256
204
|
children: props.children
|
|
@@ -263,7 +211,7 @@ var Button_default = Button;
|
|
|
263
211
|
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
212
|
function Form({ setLoading }) {
|
|
265
213
|
const { setSecurityNumber, setState, securityNumber, targetProduct, setUrlAcceptTerms, setUrlRegisterIndustry } = usePBMStore();
|
|
266
|
-
const [showCoupoField, setShowCoupoField] =
|
|
214
|
+
const [showCoupoField, setShowCoupoField] = useState(false);
|
|
267
215
|
const {
|
|
268
216
|
handleSubmit,
|
|
269
217
|
register,
|
|
@@ -414,7 +362,7 @@ function Form({ setLoading }) {
|
|
|
414
362
|
type: "submit",
|
|
415
363
|
className: classNames4(
|
|
416
364
|
"bg-emerald-500 w-1/5 h-10 rounded-e-lg flex items-center justify-center cursor-pointer",
|
|
417
|
-
{ "rounded-
|
|
365
|
+
{ "rounded-lg": showCoupoField }
|
|
418
366
|
),
|
|
419
367
|
id: "button_submit_security_number_pbm",
|
|
420
368
|
children: /* @__PURE__ */ jsx5(ArrowRight, { size: 24, color: "white", strokeWidth: 2 })
|
|
@@ -472,7 +420,7 @@ function Loading({ textColor }) {
|
|
|
472
420
|
var Loading_default = Loading;
|
|
473
421
|
|
|
474
422
|
// src/components/BenefitsTable/index.tsx
|
|
475
|
-
import { useEffect as
|
|
423
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
476
424
|
|
|
477
425
|
// src/components/UI/Title/index.tsx
|
|
478
426
|
import classNames5 from "classnames";
|
|
@@ -496,7 +444,7 @@ var Title_default = Title;
|
|
|
496
444
|
|
|
497
445
|
// src/components/BenefitsTable/Item.tsx
|
|
498
446
|
import { Badge, BadgeCheck } from "lucide-react";
|
|
499
|
-
import { useCallback, useEffect
|
|
447
|
+
import { useCallback, useEffect } from "react";
|
|
500
448
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
501
449
|
function Item({ data, onChange, checked }) {
|
|
502
450
|
const { setAvailableDiscountSelected, securityNumber } = usePBMStore();
|
|
@@ -526,14 +474,14 @@ function Item({ data, onChange, checked }) {
|
|
|
526
474
|
totalPriceProductWithDiscountBenefit,
|
|
527
475
|
unitDiscountValue
|
|
528
476
|
]);
|
|
529
|
-
|
|
477
|
+
useEffect(() => {
|
|
530
478
|
updateStorageData();
|
|
531
479
|
}, [updateStorageData]);
|
|
532
480
|
return /* @__PURE__ */ jsxs5(
|
|
533
481
|
"label",
|
|
534
482
|
{
|
|
535
483
|
htmlFor: ID_INPUT,
|
|
536
|
-
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-
|
|
484
|
+
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",
|
|
537
485
|
id: "label_benefits_" + ID_INPUT,
|
|
538
486
|
children: [
|
|
539
487
|
/* @__PURE__ */ jsx8(
|
|
@@ -554,7 +502,7 @@ function Item({ data, onChange, checked }) {
|
|
|
554
502
|
"un"
|
|
555
503
|
] }),
|
|
556
504
|
/* @__PURE__ */ jsxs5("section", { className: "ml-auto relative", children: [
|
|
557
|
-
/* @__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: [
|
|
558
506
|
discountValue.toLocaleString("pt-BR", {
|
|
559
507
|
currency: "BRL",
|
|
560
508
|
currencyDisplay: "symbol",
|
|
@@ -578,13 +526,13 @@ function Item({ data, onChange, checked }) {
|
|
|
578
526
|
var Item_default = Item;
|
|
579
527
|
|
|
580
528
|
// src/services/benefits-without-document.ts
|
|
581
|
-
import
|
|
529
|
+
import Cookies2 from "js-cookie";
|
|
582
530
|
var CheckBenefistWithoutDocument = async ({ products }) => {
|
|
583
531
|
const API_URL = import.meta.env.VITE_API_URL;
|
|
584
532
|
if (!API_URL) {
|
|
585
533
|
throw new Error("API URL is not defined in environment variables");
|
|
586
534
|
}
|
|
587
|
-
const AUTH_TOKEN =
|
|
535
|
+
const AUTH_TOKEN = Cookies2.get("pbm-token");
|
|
588
536
|
if (!AUTH_TOKEN) {
|
|
589
537
|
throw new Error("Token is not defined in cookies or is expired");
|
|
590
538
|
}
|
|
@@ -607,10 +555,10 @@ var CheckBenefistWithoutDocument = async ({ products }) => {
|
|
|
607
555
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
608
556
|
function BenefitsTable() {
|
|
609
557
|
const { securityNumber, setState, targetProduct } = usePBMStore();
|
|
610
|
-
const [selectedDiscout, setSelectedDiscount] =
|
|
611
|
-
const [loading, setLoading] =
|
|
612
|
-
const [benefitsItems, setBenefitsItems] =
|
|
613
|
-
|
|
558
|
+
const [selectedDiscout, setSelectedDiscount] = useState2(null);
|
|
559
|
+
const [loading, setLoading] = useState2(true);
|
|
560
|
+
const [benefitsItems, setBenefitsItems] = useState2();
|
|
561
|
+
useEffect2(() => {
|
|
614
562
|
const fetchDicountsWithoutDocument = async () => {
|
|
615
563
|
if (!targetProduct?.productId) {
|
|
616
564
|
console.error("PBMLOG: Product ID is not defined on targetProduct");
|
|
@@ -723,7 +671,7 @@ function BenefitsTable() {
|
|
|
723
671
|
/* @__PURE__ */ jsxs6(
|
|
724
672
|
"form",
|
|
725
673
|
{
|
|
726
|
-
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",
|
|
727
675
|
id: "form_benefits_table_pbm",
|
|
728
676
|
children: [
|
|
729
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." }),
|
|
@@ -803,6 +751,7 @@ var getParams = (params) => {
|
|
|
803
751
|
// src/components/UI/Link/index.tsx
|
|
804
752
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
805
753
|
function Link(props) {
|
|
754
|
+
const { setState } = usePBMStore();
|
|
806
755
|
return /* @__PURE__ */ jsx11(
|
|
807
756
|
"a",
|
|
808
757
|
{
|
|
@@ -810,11 +759,12 @@ function Link(props) {
|
|
|
810
759
|
target: "_blank",
|
|
811
760
|
href: typeof props.href === "string" ? props.href : props.href.pathname + getParams(props.href.param),
|
|
812
761
|
className: classNames7(
|
|
813
|
-
"w-3xs cursor-pointer h-10 rounded-
|
|
762
|
+
"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",
|
|
814
763
|
props.className
|
|
815
764
|
),
|
|
816
765
|
"data-testid": "test_id_link",
|
|
817
766
|
id: "link_pbm",
|
|
767
|
+
onClick: () => setState("isEmpty"),
|
|
818
768
|
children: props.children
|
|
819
769
|
}
|
|
820
770
|
);
|
|
@@ -832,8 +782,12 @@ function SecurityNumberInvalid({ textColor }) {
|
|
|
832
782
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
833
783
|
id: "security_number_invalid_container_pbm",
|
|
834
784
|
children: [
|
|
835
|
-
/* @__PURE__ */ jsx12(Title_default, { className: "w-full", textColor, children: "CPF n\xE3o cadastrado
|
|
836
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ jsx12(Title_default, { className: "w-full", textColor, children: "CPF n\xE3o cadastrado." }),
|
|
786
|
+
/* @__PURE__ */ jsxs7(Text_default, { className: "w-full", textColor, children: [
|
|
787
|
+
"Conclua seu cadastro para habilitar o benef\xEDcio. ",
|
|
788
|
+
/* @__PURE__ */ jsx12("br", {}),
|
|
789
|
+
"Ao clicar em \u201CAceitar os termos\u201D, voc\xEA ir\xE1 para uma p\xE1gina externa. Aceite os termos e volte para continuar."
|
|
790
|
+
] }),
|
|
837
791
|
/* @__PURE__ */ jsx12(
|
|
838
792
|
Link_default,
|
|
839
793
|
{
|
|
@@ -848,7 +802,7 @@ function SecurityNumberInvalid({ textColor }) {
|
|
|
848
802
|
var SecurityNumberInvalid_default = SecurityNumberInvalid;
|
|
849
803
|
|
|
850
804
|
// src/PBM.tsx
|
|
851
|
-
import { useCallback as useCallback2, useEffect as
|
|
805
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
852
806
|
|
|
853
807
|
// src/components/SecurityNumberRegitered/index.tsx
|
|
854
808
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -861,8 +815,8 @@ function SecurityNumberRegitered({ textColor }) {
|
|
|
861
815
|
className: "flex items-end justify-center gap-2 w-full h-auto flex-col border-y border-zinc-300 py-6",
|
|
862
816
|
id: "security_number_registered_container_pbm",
|
|
863
817
|
children: [
|
|
864
|
-
/* @__PURE__ */ jsx13(Title_default, { className: "w-full", textColor, children: "CPF n\xE3o habilitado
|
|
865
|
-
/* @__PURE__ */ jsx13(Text_default, { className: "w-full", textColor, children: "
|
|
818
|
+
/* @__PURE__ */ jsx13(Title_default, { className: "w-full", textColor, children: "Ops, seu CPF ainda n\xE3o est\xE1 habilitado para este produto." }),
|
|
819
|
+
/* @__PURE__ */ jsx13(Text_default, { className: "w-full", textColor, children: "Para ativar o benef\xEDcio, clique em \u201CAtivar CPF\u201D e conclua a etapa na p\xE1gina externa. Depois, \xE9 s\xF3 voltar para continuar \u2014 vamos aguardar voc\xEA aqui." }),
|
|
866
820
|
/* @__PURE__ */ jsx13(
|
|
867
821
|
Link_default,
|
|
868
822
|
{
|
|
@@ -877,7 +831,7 @@ function SecurityNumberRegitered({ textColor }) {
|
|
|
877
831
|
var SecurityNumberRegitered_default = SecurityNumberRegitered;
|
|
878
832
|
|
|
879
833
|
// src/services/authorization.ts
|
|
880
|
-
import
|
|
834
|
+
import Cookies3 from "js-cookie";
|
|
881
835
|
var GetAuthorization = async ({ clientID }) => {
|
|
882
836
|
const API_URL = import.meta.env.VITE_API_URL;
|
|
883
837
|
const STORE_ID = import.meta.env.VITE_STORE_ID;
|
|
@@ -903,12 +857,12 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
903
857
|
if (!dataResponse.success) {
|
|
904
858
|
throw new Error(dataResponse.message || "Failed to fetch authorization");
|
|
905
859
|
}
|
|
906
|
-
|
|
860
|
+
Cookies3.set("pbm-token", dataResponse.data.token, {
|
|
907
861
|
expires: dataResponse.data.expiresIn / (60 * 60),
|
|
908
862
|
secure: true,
|
|
909
863
|
sameSite: "Strict"
|
|
910
864
|
});
|
|
911
|
-
|
|
865
|
+
Cookies3.set("pbm-token-refresh", dataResponse.data.refreshToken, {
|
|
912
866
|
expires: dataResponse.data.refreshExpiresIn / (60 * 60),
|
|
913
867
|
secure: true,
|
|
914
868
|
sameSite: "Strict"
|
|
@@ -918,6 +872,30 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
918
872
|
|
|
919
873
|
// src/PBM.tsx
|
|
920
874
|
import { ArrowRight as ArrowRight2 } from "lucide-react";
|
|
875
|
+
|
|
876
|
+
// src/services/get-product-by-ean.ts
|
|
877
|
+
import Cookies4 from "js-cookie";
|
|
878
|
+
var GetProductByEAN = async ({ PRODUCT_EAN }) => {
|
|
879
|
+
const API_URL = import.meta.env.VITE_API_URL;
|
|
880
|
+
const AUTH_TOKEN = Cookies4.get("pbm-token");
|
|
881
|
+
if (!AUTH_TOKEN) {
|
|
882
|
+
throw new Error("Token is not defined in cookies or is expired");
|
|
883
|
+
}
|
|
884
|
+
const response = await fetch(`${API_URL}/products/ean/${PRODUCT_EAN}`, {
|
|
885
|
+
method: "GET",
|
|
886
|
+
headers: {
|
|
887
|
+
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
888
|
+
"Content-Type": "application/json"
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
const dataResponse = await response.json();
|
|
892
|
+
if (!dataResponse.success) {
|
|
893
|
+
throw new Error(dataResponse.message || "Failed to fetch authorization");
|
|
894
|
+
}
|
|
895
|
+
return dataResponse;
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/PBM.tsx
|
|
921
899
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
922
900
|
function PBM({
|
|
923
901
|
originalProductPrice,
|
|
@@ -927,24 +905,44 @@ function PBM({
|
|
|
927
905
|
const formatedOriginalProductPrice = Number(
|
|
928
906
|
String(originalProductPrice).replace(",", ".")
|
|
929
907
|
);
|
|
930
|
-
const [loading, setLoading] =
|
|
931
|
-
const { setState, state, setTargetProduct } = usePBMStore();
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
908
|
+
const [loading, setLoading] = useState3(false);
|
|
909
|
+
const { setState, state, setTargetProduct, targetProduct } = usePBMStore();
|
|
910
|
+
const fetchProductByEan = async () => {
|
|
911
|
+
try {
|
|
912
|
+
if (!eanProduct) {
|
|
913
|
+
console.error("PBMLOG: Ean is not defined.");
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });
|
|
917
|
+
if (response.success && response.data) {
|
|
918
|
+
const { pbm, sku, ...targetProductNewData } = response.data;
|
|
919
|
+
setTargetProduct({
|
|
920
|
+
...targetProduct,
|
|
921
|
+
...targetProductNewData,
|
|
922
|
+
productId: Number(targetProductNewData.productId),
|
|
923
|
+
informativeMessage: pbm.informativeMessage ?? "",
|
|
924
|
+
discountMax: pbm.discountMax ?? 0,
|
|
925
|
+
industryLogo: pbm.imageLink ?? void 0,
|
|
926
|
+
ean: eanProduct
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
} catch (error) {
|
|
930
|
+
console.error(error);
|
|
935
931
|
}
|
|
936
|
-
}
|
|
932
|
+
};
|
|
937
933
|
const handleAuthorizationRequest = useCallback2(async () => {
|
|
938
934
|
try {
|
|
939
935
|
const response = await GetAuthorization({ clientID });
|
|
940
|
-
if (
|
|
936
|
+
if (response.success) {
|
|
937
|
+
fetchProductByEan();
|
|
938
|
+
} else {
|
|
941
939
|
console.error("PBMLOG: Authorization failed!");
|
|
942
940
|
}
|
|
943
941
|
} catch (error) {
|
|
944
942
|
console.error("Error fetching authorization:", error);
|
|
945
943
|
}
|
|
946
944
|
}, [clientID]);
|
|
947
|
-
|
|
945
|
+
useEffect3(() => {
|
|
948
946
|
handleAuthorizationRequest();
|
|
949
947
|
}, [handleAuthorizationRequest]);
|
|
950
948
|
return /* @__PURE__ */ jsx14("div", { id: "pbm-library-root", children: /* @__PURE__ */ jsxs9(Container_default, { variant: "main", children: [
|