@agrada_digital/pbm 0.0.49 → 0.0.50
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 +4 -38
- package/dist/index.d.ts +4 -38
- package/dist/index.js +81 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -86
- package/dist/index.mjs.map +1 -1
- package/dist-wc/pbm-wc.js +81 -81
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { StoreApi } from 'zustand';
|
|
|
4
4
|
|
|
5
5
|
interface PBMProps {
|
|
6
6
|
originalProductPrice: number;
|
|
7
|
-
industryLogo
|
|
7
|
+
industryLogo?: string;
|
|
8
8
|
clientID: string;
|
|
9
9
|
eanProduct: string;
|
|
10
10
|
}
|
|
@@ -23,45 +23,11 @@ interface usePBMTypes {
|
|
|
23
23
|
totalPrice: number;
|
|
24
24
|
};
|
|
25
25
|
campaign: "pbm_campaign";
|
|
26
|
-
targetProduct:
|
|
26
|
+
targetProduct: IProduct | null;
|
|
27
27
|
}
|
|
28
|
-
interface
|
|
29
|
-
name: string;
|
|
30
|
-
presentationId: string;
|
|
31
|
-
presentation: string;
|
|
32
|
-
maximumPrice: number;
|
|
33
|
-
salePrice: number;
|
|
34
|
-
discountPercent: number;
|
|
35
|
-
comboAvailable: boolean;
|
|
36
|
-
progressiveDiscount: boolean;
|
|
37
|
-
replacementIndustryPrice: number;
|
|
38
|
-
replacementPurchasePrice: number;
|
|
39
|
-
replacementIndustryDiscount: number;
|
|
40
|
-
commercialGradeId: number;
|
|
41
|
-
commercialGrade: string;
|
|
42
|
-
calculationRuleTypeId: number;
|
|
43
|
-
calculationRuleType: string;
|
|
44
|
-
}
|
|
45
|
-
interface ITargetProductPBM {
|
|
46
|
-
productId: string;
|
|
28
|
+
interface IProduct {
|
|
47
29
|
ean: string;
|
|
48
|
-
|
|
49
|
-
name: string;
|
|
50
|
-
stock: number;
|
|
51
|
-
listPrice: number;
|
|
52
|
-
salesPrice: number;
|
|
53
|
-
availabilityText: string;
|
|
54
|
-
discountMin: number;
|
|
55
|
-
discountMaxNewPatient: number;
|
|
56
|
-
discountMax: number;
|
|
57
|
-
industryName: string;
|
|
58
|
-
informativeMessage: string;
|
|
59
|
-
authorizer: string;
|
|
60
|
-
discountMinNewPatient: number;
|
|
61
|
-
qtyForDiscountMax: number;
|
|
62
|
-
programName: string;
|
|
63
|
-
dataSource: string;
|
|
64
|
-
epharma: IEpharma;
|
|
30
|
+
quantity: number;
|
|
65
31
|
}
|
|
66
32
|
|
|
67
33
|
interface PBMStore extends usePBMTypes {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { StoreApi } from 'zustand';
|
|
|
4
4
|
|
|
5
5
|
interface PBMProps {
|
|
6
6
|
originalProductPrice: number;
|
|
7
|
-
industryLogo
|
|
7
|
+
industryLogo?: string;
|
|
8
8
|
clientID: string;
|
|
9
9
|
eanProduct: string;
|
|
10
10
|
}
|
|
@@ -23,45 +23,11 @@ interface usePBMTypes {
|
|
|
23
23
|
totalPrice: number;
|
|
24
24
|
};
|
|
25
25
|
campaign: "pbm_campaign";
|
|
26
|
-
targetProduct:
|
|
26
|
+
targetProduct: IProduct | null;
|
|
27
27
|
}
|
|
28
|
-
interface
|
|
29
|
-
name: string;
|
|
30
|
-
presentationId: string;
|
|
31
|
-
presentation: string;
|
|
32
|
-
maximumPrice: number;
|
|
33
|
-
salePrice: number;
|
|
34
|
-
discountPercent: number;
|
|
35
|
-
comboAvailable: boolean;
|
|
36
|
-
progressiveDiscount: boolean;
|
|
37
|
-
replacementIndustryPrice: number;
|
|
38
|
-
replacementPurchasePrice: number;
|
|
39
|
-
replacementIndustryDiscount: number;
|
|
40
|
-
commercialGradeId: number;
|
|
41
|
-
commercialGrade: string;
|
|
42
|
-
calculationRuleTypeId: number;
|
|
43
|
-
calculationRuleType: string;
|
|
44
|
-
}
|
|
45
|
-
interface ITargetProductPBM {
|
|
46
|
-
productId: string;
|
|
28
|
+
interface IProduct {
|
|
47
29
|
ean: string;
|
|
48
|
-
|
|
49
|
-
name: string;
|
|
50
|
-
stock: number;
|
|
51
|
-
listPrice: number;
|
|
52
|
-
salesPrice: number;
|
|
53
|
-
availabilityText: string;
|
|
54
|
-
discountMin: number;
|
|
55
|
-
discountMaxNewPatient: number;
|
|
56
|
-
discountMax: number;
|
|
57
|
-
industryName: string;
|
|
58
|
-
informativeMessage: string;
|
|
59
|
-
authorizer: string;
|
|
60
|
-
discountMinNewPatient: number;
|
|
61
|
-
qtyForDiscountMax: number;
|
|
62
|
-
programName: string;
|
|
63
|
-
dataSource: string;
|
|
64
|
-
epharma: IEpharma;
|
|
30
|
+
quantity: number;
|
|
65
31
|
}
|
|
66
32
|
|
|
67
33
|
interface PBMStore extends usePBMTypes {
|
package/dist/index.js
CHANGED
|
@@ -89,9 +89,10 @@ function Container({
|
|
|
89
89
|
var Container_default = Container;
|
|
90
90
|
|
|
91
91
|
// src/components/Footer/index.tsx
|
|
92
|
+
var import_classnames2 = __toESM(require("classnames"));
|
|
92
93
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
93
94
|
function Footer({ industryLogo }) {
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("footer", { className: "w-full h-auto relative", id: "footer_pbm", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "flex items-center
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("footer", { className: "w-full h-auto relative", id: "footer_pbm", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: (0, import_classnames2.default)("flex items-center w-full h-auto gap-4", { "justify-center": industryLogo, "justify-start": !industryLogo }), children: [
|
|
95
96
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "w-4/5 h-auto", children: [
|
|
96
97
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "text-start font-semibold text-sm", children: "Economize com o benef\xEDcio do laborat\xF3rio." }),
|
|
97
98
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-start font-normal text-sm", children: "Este produto tem pre\xE7o exclusivo para clientes cadastrados no programa." })
|
|
@@ -134,7 +135,7 @@ var toFormat = (value) => {
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
// src/components/Form/index.tsx
|
|
137
|
-
var
|
|
138
|
+
var import_classnames3 = __toESM(require("classnames"));
|
|
138
139
|
var import_zod2 = require("@hookform/resolvers/zod");
|
|
139
140
|
var import_react_hook_form = require("react-hook-form");
|
|
140
141
|
var import_lucide_react = require("lucide-react");
|
|
@@ -165,10 +166,37 @@ var createPBMStore = (set) => ({
|
|
|
165
166
|
var usePBMStore = (0, import_zustand.create)(createPBMStore);
|
|
166
167
|
var pbmStore = (0, import_zustand.createStore)(createPBMStore);
|
|
167
168
|
|
|
169
|
+
// src/services/validate-document.ts
|
|
170
|
+
var import_js_cookie = __toESM(require("js-cookie"));
|
|
171
|
+
var import_meta = {};
|
|
172
|
+
var ValidateDocument = async ({ document, products }) => {
|
|
173
|
+
const API_URL = import_meta.env.VITE_API_URL;
|
|
174
|
+
if (!API_URL) {
|
|
175
|
+
throw new Error("API URL is not defined in environment variables");
|
|
176
|
+
}
|
|
177
|
+
const AUTH_TOKEN = import_js_cookie.default.get("pbm-token");
|
|
178
|
+
if (!AUTH_TOKEN) {
|
|
179
|
+
throw new Error("Token is not defined in cookies or is expired");
|
|
180
|
+
}
|
|
181
|
+
const response = await fetch(`${API_URL}/transactions/validate`, {
|
|
182
|
+
method: "POST",
|
|
183
|
+
headers: {
|
|
184
|
+
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
185
|
+
"Content-Type": "application/json"
|
|
186
|
+
},
|
|
187
|
+
body: JSON.stringify({ document, products })
|
|
188
|
+
});
|
|
189
|
+
const dataResponse = await response.json();
|
|
190
|
+
if (!dataResponse.success) {
|
|
191
|
+
throw new Error(dataResponse.message || "Failed to fetch document validation");
|
|
192
|
+
}
|
|
193
|
+
return dataResponse;
|
|
194
|
+
};
|
|
195
|
+
|
|
168
196
|
// src/components/Form/index.tsx
|
|
169
197
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
170
198
|
function Form({ setLoading }) {
|
|
171
|
-
const { setSecurityNumber, setState, securityNumber } = usePBMStore();
|
|
199
|
+
const { setSecurityNumber, setState, securityNumber, targetProduct } = usePBMStore();
|
|
172
200
|
const {
|
|
173
201
|
handleSubmit,
|
|
174
202
|
register,
|
|
@@ -180,28 +208,37 @@ function Form({ setLoading }) {
|
|
|
180
208
|
securityNumber: securityNumber || ""
|
|
181
209
|
}
|
|
182
210
|
});
|
|
183
|
-
const onSubmitDefault = (values) => {
|
|
211
|
+
const onSubmitDefault = async (values) => {
|
|
184
212
|
setLoading(true);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
213
|
+
try {
|
|
214
|
+
if (targetProduct === null) {
|
|
215
|
+
console.error("Product is not defined!");
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const response = await ValidateDocument({
|
|
219
|
+
document: values.securityNumber.replace(/\D/g, ""),
|
|
220
|
+
products: [{ ean: targetProduct.ean, quantity: targetProduct.quantity }]
|
|
221
|
+
});
|
|
222
|
+
if (response.success) {
|
|
223
|
+
const status = {
|
|
224
|
+
"active": "isActivated",
|
|
225
|
+
"nonexistent": "isInvalid"
|
|
226
|
+
};
|
|
227
|
+
setSecurityNumber(values.securityNumber);
|
|
228
|
+
setState(status[response.data.process_platform.status]);
|
|
229
|
+
}
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.error("Error validating document:", error);
|
|
232
|
+
} finally {
|
|
197
233
|
setLoading(false);
|
|
198
|
-
}
|
|
234
|
+
}
|
|
235
|
+
;
|
|
199
236
|
};
|
|
200
237
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
201
238
|
"form",
|
|
202
239
|
{
|
|
203
240
|
onSubmit: handleSubmit(onSubmitDefault),
|
|
204
|
-
className: (0,
|
|
241
|
+
className: (0, import_classnames3.default)(
|
|
205
242
|
"w-full h-auto flex items-center justify-center mb-0 transition-all duration-150",
|
|
206
243
|
{ "mb-4": errors.securityNumber }
|
|
207
244
|
),
|
|
@@ -218,7 +255,7 @@ function Form({ setLoading }) {
|
|
|
218
255
|
"input",
|
|
219
256
|
{
|
|
220
257
|
type: "text",
|
|
221
|
-
className: (0,
|
|
258
|
+
className: (0, import_classnames3.default)(
|
|
222
259
|
"w-full h-8 bg-[#44c2c0]/20 rounded-s-full 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",
|
|
223
260
|
{ "outline outline-red-600": errors.securityNumber }
|
|
224
261
|
),
|
|
@@ -282,14 +319,14 @@ function Loading({ textColor }) {
|
|
|
282
319
|
var Loading_default = Loading;
|
|
283
320
|
|
|
284
321
|
// src/components/UI/Button/index.tsx
|
|
285
|
-
var
|
|
322
|
+
var import_classnames4 = __toESM(require("classnames"));
|
|
286
323
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
287
324
|
function Button(props) {
|
|
288
325
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
289
326
|
"button",
|
|
290
327
|
{
|
|
291
328
|
...props,
|
|
292
|
-
className: (0,
|
|
329
|
+
className: (0, import_classnames4.default)(
|
|
293
330
|
"w-3xs cursor-pointer h-10 rounded-full bg-blue-500 hover:bg-blue-400 text-white text-sm font-semibold transition-colors",
|
|
294
331
|
props.className
|
|
295
332
|
),
|
|
@@ -328,13 +365,13 @@ var BENEFITS_ITEMS = [
|
|
|
328
365
|
];
|
|
329
366
|
|
|
330
367
|
// src/components/UI/Title/index.tsx
|
|
331
|
-
var
|
|
368
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
332
369
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
333
370
|
function Title(props) {
|
|
334
371
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
335
372
|
"h2",
|
|
336
373
|
{
|
|
337
|
-
className: (0,
|
|
374
|
+
className: (0, import_classnames5.default)(
|
|
338
375
|
"text-start font-semibold text-sm text-zinc-900",
|
|
339
376
|
props.className
|
|
340
377
|
),
|
|
@@ -491,13 +528,13 @@ function BenefitsTable({
|
|
|
491
528
|
var BenefitsTable_default = BenefitsTable;
|
|
492
529
|
|
|
493
530
|
// src/components/UI/Text/index.tsx
|
|
494
|
-
var
|
|
531
|
+
var import_classnames6 = __toESM(require("classnames"));
|
|
495
532
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
496
533
|
function Text(props) {
|
|
497
534
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
498
535
|
"p",
|
|
499
536
|
{
|
|
500
|
-
className: (0,
|
|
537
|
+
className: (0, import_classnames6.default)(
|
|
501
538
|
"text-start font-normal text-sm text-zinc-900",
|
|
502
539
|
props.className
|
|
503
540
|
),
|
|
@@ -511,14 +548,14 @@ function Text(props) {
|
|
|
511
548
|
var Text_default = Text;
|
|
512
549
|
|
|
513
550
|
// src/components/Iframe/index.tsx
|
|
514
|
-
var
|
|
551
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
515
552
|
var import_lucide_react3 = require("lucide-react");
|
|
516
553
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
517
554
|
function Iframe({ url, title, openModal, setOpenModal }) {
|
|
518
555
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
519
556
|
"main",
|
|
520
557
|
{
|
|
521
|
-
className: (0,
|
|
558
|
+
className: (0, import_classnames7.default)(
|
|
522
559
|
"fixed inset-0 flex items-center justify-center z-50 flex-col transition-all shadow",
|
|
523
560
|
{
|
|
524
561
|
"opacity-100 pointer-events-auto": openModal,
|
|
@@ -619,7 +656,7 @@ var SecurityNumberInvalid_default = SecurityNumberInvalid;
|
|
|
619
656
|
var import_react4 = require("react");
|
|
620
657
|
|
|
621
658
|
// src/components/UI/Link/index.tsx
|
|
622
|
-
var
|
|
659
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
623
660
|
|
|
624
661
|
// src/utils/getParams.ts
|
|
625
662
|
var getParams = (params) => {
|
|
@@ -636,7 +673,7 @@ function Link(props) {
|
|
|
636
673
|
...props,
|
|
637
674
|
target: "_blank",
|
|
638
675
|
href: typeof props.href === "string" ? props.href : props.href.pathname + getParams(props.href.param),
|
|
639
|
-
className: (0,
|
|
676
|
+
className: (0, import_classnames8.default)(
|
|
640
677
|
"w-3xs cursor-pointer h-10 rounded-full bg-blue-500 hover:bg-blue-400 text-white text-sm font-semibold transition-colors flex items-center justify-center",
|
|
641
678
|
props.className
|
|
642
679
|
),
|
|
@@ -677,12 +714,12 @@ function SecurityNumberRegitered({ textColor }) {
|
|
|
677
714
|
var SecurityNumberRegitered_default = SecurityNumberRegitered;
|
|
678
715
|
|
|
679
716
|
// src/services/authorization.ts
|
|
680
|
-
var
|
|
681
|
-
var
|
|
717
|
+
var import_js_cookie2 = __toESM(require("js-cookie"));
|
|
718
|
+
var import_meta2 = {};
|
|
682
719
|
var GetAuthorization = async ({ clientID }) => {
|
|
683
|
-
const API_URL =
|
|
684
|
-
const STORE_ID =
|
|
685
|
-
const STORE_NAME =
|
|
720
|
+
const API_URL = import_meta2.env.VITE_API_URL;
|
|
721
|
+
const STORE_ID = import_meta2.env.VITE_STORE_ID;
|
|
722
|
+
const STORE_NAME = import_meta2.env.VITE_STORE_NAME;
|
|
686
723
|
if (!API_URL) {
|
|
687
724
|
throw new Error("API URL is not defined in environment variables");
|
|
688
725
|
}
|
|
@@ -704,12 +741,12 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
704
741
|
if (!dataResponse.success) {
|
|
705
742
|
throw new Error(dataResponse.message || "Failed to fetch authorization");
|
|
706
743
|
}
|
|
707
|
-
|
|
744
|
+
import_js_cookie2.default.set("pbm-token", dataResponse.data.token, {
|
|
708
745
|
expires: parseInt(dataResponse.data.expiresIn, 10) / (60 * 60),
|
|
709
746
|
secure: true,
|
|
710
747
|
sameSite: "Strict"
|
|
711
748
|
});
|
|
712
|
-
|
|
749
|
+
import_js_cookie2.default.set("pbm-token-refresh", dataResponse.data.refreshToken, {
|
|
713
750
|
secure: true,
|
|
714
751
|
sameSite: "Strict"
|
|
715
752
|
});
|
|
@@ -718,42 +755,6 @@ var GetAuthorization = async ({ clientID }) => {
|
|
|
718
755
|
|
|
719
756
|
// src/PBM.tsx
|
|
720
757
|
var import_lucide_react4 = require("lucide-react");
|
|
721
|
-
|
|
722
|
-
// src/services/get-product-by-ean.ts
|
|
723
|
-
var import_js_cookie2 = __toESM(require("js-cookie"));
|
|
724
|
-
var import_meta2 = {};
|
|
725
|
-
var GetProductByEAN = async ({ PRODUCT_EAN }) => {
|
|
726
|
-
const API_URL = import_meta2.env.VITE_API_URL;
|
|
727
|
-
const AUTH_TOKEN = import_js_cookie2.default.get("pbm-token");
|
|
728
|
-
if (!AUTH_TOKEN) {
|
|
729
|
-
throw new Error("Token is not defined in cookies or is expired");
|
|
730
|
-
}
|
|
731
|
-
const response = await fetch(`${API_URL}/core/products?ean=${PRODUCT_EAN}`, {
|
|
732
|
-
method: "GET",
|
|
733
|
-
headers: {
|
|
734
|
-
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
735
|
-
"Content-Type": "application/json"
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
const dataResponse = await response.json();
|
|
739
|
-
if (!dataResponse.success) {
|
|
740
|
-
throw new Error(dataResponse.message || "Failed to fetch authorization");
|
|
741
|
-
}
|
|
742
|
-
return dataResponse;
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
// src/libs/zustand/useTargetProduct.tsx
|
|
746
|
-
var import_zustand2 = require("zustand");
|
|
747
|
-
var initialTargetProductState = {
|
|
748
|
-
targetProductInternal: null
|
|
749
|
-
};
|
|
750
|
-
var createPBMStore2 = (set) => ({
|
|
751
|
-
...initialTargetProductState,
|
|
752
|
-
setTargetProductInternal: (targetProductInternal) => set({ targetProductInternal })
|
|
753
|
-
});
|
|
754
|
-
var useTargetProducts = (0, import_zustand2.create)(createPBMStore2);
|
|
755
|
-
|
|
756
|
-
// src/PBM.tsx
|
|
757
758
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
758
759
|
function PBM({
|
|
759
760
|
originalProductPrice,
|
|
@@ -761,38 +762,27 @@ function PBM({
|
|
|
761
762
|
clientID,
|
|
762
763
|
eanProduct
|
|
763
764
|
}) {
|
|
765
|
+
const formatedOriginalProductPrice = originalProductPrice.toString().includes(",") ? Number(originalProductPrice.toString().replace(",", ".")) : originalProductPrice;
|
|
764
766
|
const [loading, setLoading] = (0, import_react4.useState)(false);
|
|
765
767
|
const { setState, state, setTargetProduct } = usePBMStore();
|
|
766
|
-
const { setTargetProductInternal } = useTargetProducts();
|
|
767
|
-
const handleGetProductByEAN = (0, import_react4.useCallback)(async () => {
|
|
768
|
-
try {
|
|
769
|
-
const response = await GetProductByEAN({ PRODUCT_EAN: eanProduct });
|
|
770
|
-
if (response.success) {
|
|
771
|
-
const productByEan = response.data.message.products[0];
|
|
772
|
-
setTargetProduct(productByEan);
|
|
773
|
-
setTargetProductInternal(productByEan);
|
|
774
|
-
}
|
|
775
|
-
} catch (error) {
|
|
776
|
-
console.error(error);
|
|
777
|
-
}
|
|
778
|
-
}, [eanProduct, setTargetProduct, setTargetProductInternal]);
|
|
779
768
|
const handleAuthorizationRequest = (0, import_react4.useCallback)(async () => {
|
|
780
769
|
try {
|
|
781
770
|
const response = await GetAuthorization({ clientID });
|
|
782
|
-
if (response.success
|
|
783
|
-
|
|
771
|
+
if (response.success) {
|
|
772
|
+
setTargetProduct({ ean: eanProduct, quantity: 1 });
|
|
773
|
+
console.log("Authorization successful:", response.data);
|
|
784
774
|
} else {
|
|
785
775
|
console.error("Authorization failed:", response.message);
|
|
786
776
|
}
|
|
787
777
|
} catch (error) {
|
|
788
778
|
console.error("Error fetching authorization:", error);
|
|
789
779
|
}
|
|
790
|
-
}, [clientID,
|
|
780
|
+
}, [clientID, eanProduct]);
|
|
791
781
|
(0, import_react4.useEffect)(() => {
|
|
792
782
|
handleAuthorizationRequest();
|
|
793
783
|
}, [handleAuthorizationRequest]);
|
|
794
784
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Container_default, { variant: "main", children: [
|
|
795
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Header_default, { originalProductPrice:
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Header_default, { originalProductPrice: formatedOriginalProductPrice || 0 }),
|
|
796
786
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Container_default, { variant: "simple", children: [
|
|
797
787
|
state === "isEmpty" && !loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
798
788
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Form_default, { setLoading }),
|
|
@@ -812,9 +802,9 @@ function PBM({
|
|
|
812
802
|
state === "isEmpty" && loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loading_default, {}),
|
|
813
803
|
state === "isInvalid" && !loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SecurityNumberInvalid_default, {}),
|
|
814
804
|
state === "isRegistered" && !loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SecurityNumberRegitered_default, {}),
|
|
815
|
-
state === "isActivated" && !loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BenefitsTable_default, { originalProductPrice })
|
|
805
|
+
state === "isActivated" && !loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BenefitsTable_default, { originalProductPrice: formatedOriginalProductPrice })
|
|
816
806
|
] }),
|
|
817
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Footer_default, { industryLogo })
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Footer_default, { industryLogo: industryLogo || void 0 })
|
|
818
808
|
] });
|
|
819
809
|
}
|
|
820
810
|
var PBM_default = PBM;
|