@agrada_digital/pbm 0.0.113 → 0.0.114
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.css +31 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +76 -50
- package/dist/vanilla.js +13 -13
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -332,6 +332,9 @@
|
|
|
332
332
|
.top-1\/2 {
|
|
333
333
|
top: calc(1 / 2 * 100%);
|
|
334
334
|
}
|
|
335
|
+
.top-3\.5 {
|
|
336
|
+
top: calc(var(--spacing) * 3.5);
|
|
337
|
+
}
|
|
335
338
|
.-right-3 {
|
|
336
339
|
right: calc(var(--spacing) * -3);
|
|
337
340
|
}
|
|
@@ -344,6 +347,9 @@
|
|
|
344
347
|
.left-2 {
|
|
345
348
|
left: calc(var(--spacing) * 2);
|
|
346
349
|
}
|
|
350
|
+
.left-17 {
|
|
351
|
+
left: calc(var(--spacing) * 17);
|
|
352
|
+
}
|
|
347
353
|
.z-10 {
|
|
348
354
|
z-index: 10;
|
|
349
355
|
}
|
|
@@ -368,9 +374,6 @@
|
|
|
368
374
|
max-width: 96rem;
|
|
369
375
|
}
|
|
370
376
|
}
|
|
371
|
-
.mx-1 {
|
|
372
|
-
margin-inline: calc(var(--spacing) * 1);
|
|
373
|
-
}
|
|
374
377
|
.mx-4 {
|
|
375
378
|
margin-inline: calc(var(--spacing) * 4);
|
|
376
379
|
}
|
|
@@ -431,6 +434,9 @@
|
|
|
431
434
|
.aspect-auto {
|
|
432
435
|
aspect-ratio: auto;
|
|
433
436
|
}
|
|
437
|
+
.h-0 {
|
|
438
|
+
height: calc(var(--spacing) * 0);
|
|
439
|
+
}
|
|
434
440
|
.h-0\.5 {
|
|
435
441
|
height: calc(var(--spacing) * 0.5);
|
|
436
442
|
}
|
|
@@ -503,6 +509,9 @@
|
|
|
503
509
|
.w-8 {
|
|
504
510
|
width: calc(var(--spacing) * 8);
|
|
505
511
|
}
|
|
512
|
+
.w-10 {
|
|
513
|
+
width: calc(var(--spacing) * 10);
|
|
514
|
+
}
|
|
506
515
|
.w-16 {
|
|
507
516
|
width: calc(var(--spacing) * 16);
|
|
508
517
|
}
|
|
@@ -521,6 +530,9 @@
|
|
|
521
530
|
.max-w-\[var\(--max-container\)\] {
|
|
522
531
|
max-width: var(--max-container);
|
|
523
532
|
}
|
|
533
|
+
.max-w-max {
|
|
534
|
+
max-width: max-content;
|
|
535
|
+
}
|
|
524
536
|
.max-w-md {
|
|
525
537
|
max-width: var(--container-md);
|
|
526
538
|
}
|
|
@@ -742,6 +754,9 @@
|
|
|
742
754
|
border-color: color-mix(in oklab, var(--color-zinc-400) 50%, transparent);
|
|
743
755
|
}
|
|
744
756
|
}
|
|
757
|
+
.bg-\(--pbm-input-background\) {
|
|
758
|
+
background-color: var(--pbm-input-background);
|
|
759
|
+
}
|
|
745
760
|
.bg-\(--pbm-primary\) {
|
|
746
761
|
background-color: var(--pbm-primary);
|
|
747
762
|
}
|
|
@@ -1112,6 +1127,9 @@
|
|
|
1112
1127
|
outline-style: var(--tw-outline-style);
|
|
1113
1128
|
outline-width: 1px;
|
|
1114
1129
|
}
|
|
1130
|
+
.outline-\(--pbm-outline-color\) {
|
|
1131
|
+
outline-color: var(--pbm-outline-color);
|
|
1132
|
+
}
|
|
1115
1133
|
.outline-red-600 {
|
|
1116
1134
|
outline-color: var(--color-red-600);
|
|
1117
1135
|
}
|
|
@@ -1399,6 +1417,11 @@
|
|
|
1399
1417
|
border-color: var(--color-blue-500);
|
|
1400
1418
|
}
|
|
1401
1419
|
}
|
|
1420
|
+
.focus\:bg-\(--pbm-input-focus\) {
|
|
1421
|
+
&:focus {
|
|
1422
|
+
background-color: var(--pbm-input-focus);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1402
1425
|
.focus\:bg-white {
|
|
1403
1426
|
&:focus {
|
|
1404
1427
|
background-color: var(--color-white);
|
|
@@ -1429,6 +1452,11 @@
|
|
|
1429
1452
|
outline-width: 1px;
|
|
1430
1453
|
}
|
|
1431
1454
|
}
|
|
1455
|
+
.focus\:outline-\(--pbm-outline-focus-color\) {
|
|
1456
|
+
&:focus {
|
|
1457
|
+
outline-color: var(--pbm-outline-focus-color);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1432
1460
|
.active\:scale-95 {
|
|
1433
1461
|
&:active {
|
|
1434
1462
|
--tw-scale-x: 95%;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ interface PBMTheme {
|
|
|
6
6
|
backgroundColor?: string;
|
|
7
7
|
textColor?: string;
|
|
8
8
|
borderColor?: string;
|
|
9
|
+
inputOutlineColor?: string;
|
|
10
|
+
inputOutlineFocusColor?: string;
|
|
11
|
+
inputBackgroundColor?: string;
|
|
12
|
+
inputFocusBackgroundColor?: string;
|
|
9
13
|
}
|
|
10
14
|
interface PBMProps {
|
|
11
15
|
original_product_price: number | string;
|
|
@@ -33,6 +37,7 @@ interface usePBMTypes {
|
|
|
33
37
|
campaign: "pbm_campaign";
|
|
34
38
|
targetProduct: IProduct | null;
|
|
35
39
|
isAuthenticatedShopper: boolean;
|
|
40
|
+
benefitsEnabled: boolean;
|
|
36
41
|
urlAcceptTerms?: string;
|
|
37
42
|
urlRegisterIndustry?: string;
|
|
38
43
|
customLoginUrl?: string;
|
|
@@ -70,6 +75,7 @@ interface PBMStore extends usePBMTypes {
|
|
|
70
75
|
setIsAuthenticatedShopper: (isAuthenticatedShopper: usePBMTypes["isAuthenticatedShopper"]) => void;
|
|
71
76
|
setCustomLoginUrl: (customLoginUrl: usePBMTypes["customLoginUrl"]) => void;
|
|
72
77
|
setCardID: (cardID: usePBMTypes["cardID"]) => void;
|
|
78
|
+
setBenefitsEnabled: (benefitsEnabled: boolean) => void;
|
|
73
79
|
}
|
|
74
80
|
declare function usePBMStore(): PBMStore;
|
|
75
81
|
declare function usePBMStore<T>(selector: (state: PBMStore) => T): T;
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ var initialPBMState = {
|
|
|
49
49
|
totalPrice: 0,
|
|
50
50
|
grossPrice: 0
|
|
51
51
|
},
|
|
52
|
+
benefitsEnabled: true,
|
|
52
53
|
targetProduct: null,
|
|
53
54
|
campaign: "pbm_campaign",
|
|
54
55
|
isAuthenticatedShopper: false,
|
|
@@ -65,7 +66,8 @@ var createPBMStore = (set) => ({
|
|
|
65
66
|
setUrlRegisterIndustry: (urlRegisterIndustry) => set({ urlRegisterIndustry }),
|
|
66
67
|
setIsAuthenticatedShopper: (isAuthenticatedShopper) => set({ isAuthenticatedShopper }),
|
|
67
68
|
setCustomLoginUrl: (customLoginUrl) => set({ customLoginUrl }),
|
|
68
|
-
setCardID: (cardID) => set({ cardID })
|
|
69
|
+
setCardID: (cardID) => set({ cardID }),
|
|
70
|
+
setBenefitsEnabled: (benefitsEnabled) => set({ benefitsEnabled })
|
|
69
71
|
});
|
|
70
72
|
var pbmStore = createStore(createPBMStore);
|
|
71
73
|
function usePBMStore(selector) {
|
|
@@ -349,7 +351,7 @@ function Form({ startTransition }) {
|
|
|
349
351
|
{
|
|
350
352
|
type: "text",
|
|
351
353
|
className: classNames2(
|
|
352
|
-
"w-full h-10 bg-
|
|
354
|
+
"w-full h-10 bg-(--pbm-input-background) rounded-lg text-sm font-semibold outline-(--pbm-outline-color) focus:outline focus:bg-(--pbm-input-focus) focus:outline-(--pbm-outline-focus-color) text-zinc-600 placeholder:text-zinc-600 px-4 placeholder:text-sm placeholder:font-semibold",
|
|
353
355
|
{
|
|
354
356
|
"outline outline-red-600": errors.securityNumber,
|
|
355
357
|
"rounded-lg": showCardIDField
|
|
@@ -654,7 +656,7 @@ var Icons = {
|
|
|
654
656
|
// src/components/Header/index.tsx
|
|
655
657
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
656
658
|
function Header({ originalProductPrice }) {
|
|
657
|
-
const { targetProduct } = usePBMStore();
|
|
659
|
+
const { targetProduct, benefitsEnabled, setBenefitsEnabled } = usePBMStore();
|
|
658
660
|
const Price = targetProduct?.listPrice || originalProductPrice;
|
|
659
661
|
const Discount = Price * ((targetProduct?.discountMax || 0) / 100);
|
|
660
662
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -664,7 +666,16 @@ function Header({ originalProductPrice }) {
|
|
|
664
666
|
id: "header_pbm",
|
|
665
667
|
children: [
|
|
666
668
|
/* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
667
|
-
/* @__PURE__ */ jsx4(
|
|
669
|
+
/* @__PURE__ */ jsx4(
|
|
670
|
+
"input",
|
|
671
|
+
{
|
|
672
|
+
type: "checkbox",
|
|
673
|
+
name: "option",
|
|
674
|
+
className: "peer hidden",
|
|
675
|
+
checked: benefitsEnabled,
|
|
676
|
+
onChange: (e) => setBenefitsEnabled(e.target.checked)
|
|
677
|
+
}
|
|
678
|
+
),
|
|
668
679
|
/* @__PURE__ */ jsx4("div", { className: "w-5 h-5 border border-(--pbm-primary) rounded-full flex items-center justify-center transition-all duration-300 after:content-[''] after:w-2 after:h-2 after:rounded-full after:bg-(--pbm-primary) after:scale-0 after:transition-transform after:duration-200 peer-checked:after:scale-100" }),
|
|
669
680
|
/* @__PURE__ */ jsx4("p", { className: "font-medium text-(--pbm-primary) select-none text-sm", children: "Desconto de Laborat\xF3rio" }),
|
|
670
681
|
/* @__PURE__ */ jsx4(Icons.Pills, { size: 16, color: "var(--pbm-primary)" })
|
|
@@ -891,12 +902,14 @@ function Container({
|
|
|
891
902
|
children,
|
|
892
903
|
variant
|
|
893
904
|
}) {
|
|
905
|
+
const { benefitsEnabled } = usePBMStore();
|
|
894
906
|
return /* @__PURE__ */ jsx9(
|
|
895
907
|
"main",
|
|
896
908
|
{
|
|
897
909
|
className: classNames6({
|
|
898
|
-
"border-3 border-(--pbm-border) flex flex-col items-center justify-center min-w-(--min-container) max-w-(--max-container) w-full h-auto rounded-xl p-4 bg-white gap-4 relative": variant === "main",
|
|
899
|
-
"w-full
|
|
910
|
+
"border-3 border-(--pbm-border) overflow-hidden flex flex-col items-center justify-center min-w-(--min-container) max-w-(--max-container) w-full h-auto rounded-xl p-4 bg-white gap-4 relative": variant === "main",
|
|
911
|
+
"w-full relative": variant === "simple",
|
|
912
|
+
"h-0 overflow-hidden": !benefitsEnabled && variant === "simple"
|
|
900
913
|
}),
|
|
901
914
|
"data-testid": "test_id_container",
|
|
902
915
|
"data-variant": variant,
|
|
@@ -2441,51 +2454,58 @@ var STEP_LABELS = [
|
|
|
2441
2454
|
"M\xE9dico",
|
|
2442
2455
|
"Aceites"
|
|
2443
2456
|
];
|
|
2444
|
-
var StepProgress = ({ current }) => /* @__PURE__ */ jsx23("div", { className: "flex items-center
|
|
2457
|
+
var StepProgress = ({ current }) => /* @__PURE__ */ jsx23("div", { className: "flex items-center w-full justify-center mb-6", children: STEP_LABELS.map((label, i) => {
|
|
2445
2458
|
const done = i < current;
|
|
2446
2459
|
const active = i === current;
|
|
2447
|
-
return /* @__PURE__ */ jsxs19(
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
),
|
|
2456
|
-
children: done ? /* @__PURE__ */ jsx23("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 12 10", fill: "none", children: /* @__PURE__ */ jsx23(
|
|
2457
|
-
"path",
|
|
2460
|
+
return /* @__PURE__ */ jsxs19(
|
|
2461
|
+
"div",
|
|
2462
|
+
{
|
|
2463
|
+
className: "flex items-center w-full min-w-0 justify-center relative",
|
|
2464
|
+
children: [
|
|
2465
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-center justify-center gap-1 shrink-0", children: [
|
|
2466
|
+
/* @__PURE__ */ jsx23(
|
|
2467
|
+
"div",
|
|
2458
2468
|
{
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2469
|
+
className: classNames12(
|
|
2470
|
+
"flex h-7 w-7 items-center justify-center rounded-full text-xs font-semibold transition-all",
|
|
2471
|
+
done ? "bg-emerald-600 text-white" : active ? "bg-(--pbm-primary) text-white ring-4 ring-(--pbm-primary)/15" : "bg-zinc-100 text-zinc-400"
|
|
2472
|
+
),
|
|
2473
|
+
children: done ? /* @__PURE__ */ jsx23("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 12 10", fill: "none", children: /* @__PURE__ */ jsx23(
|
|
2474
|
+
"path",
|
|
2475
|
+
{
|
|
2476
|
+
d: "M1 5l4 4 6-8",
|
|
2477
|
+
stroke: "currentColor",
|
|
2478
|
+
strokeWidth: "2",
|
|
2479
|
+
strokeLinecap: "round",
|
|
2480
|
+
strokeLinejoin: "round"
|
|
2481
|
+
}
|
|
2482
|
+
) }) : i + 1
|
|
2464
2483
|
}
|
|
2465
|
-
) }) : i + 1
|
|
2466
|
-
}
|
|
2467
|
-
),
|
|
2468
|
-
/* @__PURE__ */ jsx23(
|
|
2469
|
-
"span",
|
|
2470
|
-
{
|
|
2471
|
-
className: classNames12(
|
|
2472
|
-
"text-[10px] font-medium whitespace-nowrap hidden sm:block",
|
|
2473
|
-
active ? "text-(--pbm-primary)" : done ? "text-emerald-600" : "text-zinc-400"
|
|
2474
2484
|
),
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
+
/* @__PURE__ */ jsx23(
|
|
2486
|
+
"span",
|
|
2487
|
+
{
|
|
2488
|
+
className: classNames12(
|
|
2489
|
+
"text-[10px] font-medium whitespace-nowrap hidden sm:block",
|
|
2490
|
+
active ? "text-(--pbm-primary)" : done ? "text-emerald-600" : "text-zinc-400"
|
|
2491
|
+
),
|
|
2492
|
+
children: label
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
] }),
|
|
2496
|
+
i < STEP_LABELS.length - 1 && /* @__PURE__ */ jsx23(
|
|
2497
|
+
"div",
|
|
2498
|
+
{
|
|
2499
|
+
className: classNames12(
|
|
2500
|
+
"h-0.5 w-10 rounded transition-all absolute top-3.5 left-17",
|
|
2501
|
+
"bg-zinc-200"
|
|
2502
|
+
)
|
|
2503
|
+
}
|
|
2485
2504
|
)
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2505
|
+
]
|
|
2506
|
+
},
|
|
2507
|
+
i
|
|
2508
|
+
);
|
|
2489
2509
|
}) });
|
|
2490
2510
|
var StepProgress_default = StepProgress;
|
|
2491
2511
|
|
|
@@ -2582,7 +2602,7 @@ var CustomerNotRegistered = ({ ID }) => {
|
|
|
2582
2602
|
),
|
|
2583
2603
|
children: [
|
|
2584
2604
|
/* @__PURE__ */ jsx25("div", { className: "absolute inset-0", onClick: closeModal }),
|
|
2585
|
-
/* @__PURE__ */ jsxs21("section", { className: "z-10 bg-white flex flex-col p-6 rounded-2xl w-full max-w-
|
|
2605
|
+
/* @__PURE__ */ jsxs21("section", { className: "z-10 bg-white flex flex-col p-6 rounded-2xl w-full max-w-max mx-4 shadow-xl max-h-[90vh] overflow-y-auto", children: [
|
|
2586
2606
|
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2587
2607
|
/* @__PURE__ */ jsx25(Title_default, { textSize: "18px", textAlign: "start", children: done ? "Tudo pronto!" : "Benef\xEDcio de Farm\xE1cia" }),
|
|
2588
2608
|
/* @__PURE__ */ jsx25(
|
|
@@ -2809,9 +2829,11 @@ var initialThemeState = {
|
|
|
2809
2829
|
secondaryColor: "#339c9b",
|
|
2810
2830
|
backgroundColor: "#ffffff",
|
|
2811
2831
|
textColor: "#52525b",
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2832
|
+
borderColor: "#44c2c0",
|
|
2833
|
+
inputOutlineColor: "transparent",
|
|
2834
|
+
inputOutlineFocusColor: "#323232",
|
|
2835
|
+
inputBackgroundColor: "#EDEDED",
|
|
2836
|
+
inputFocusBackgroundColor: "#EDEDED"
|
|
2815
2837
|
};
|
|
2816
2838
|
var themeStore = createStore2(
|
|
2817
2839
|
(set) => ({
|
|
@@ -2962,7 +2984,11 @@ function PBM(props) {
|
|
|
2962
2984
|
"--pbm-secondary": theme.secondaryColor,
|
|
2963
2985
|
"--pbm-bg": theme.backgroundColor,
|
|
2964
2986
|
"--pbm-text": theme.textColor,
|
|
2965
|
-
"--pbm-border": theme.borderColor
|
|
2987
|
+
"--pbm-border": theme.borderColor,
|
|
2988
|
+
"--pbm-outline-color": theme.inputOutlineColor,
|
|
2989
|
+
"--pbm-outline-focus-color": theme.inputOutlineFocusColor,
|
|
2990
|
+
"--pbm-input-focus-background": theme.inputFocusBackgroundColor,
|
|
2991
|
+
"--pbm-input-background": theme.inputBackgroundColor
|
|
2966
2992
|
},
|
|
2967
2993
|
children: [
|
|
2968
2994
|
/* @__PURE__ */ jsxs23(Container_default, { variant: "main", children: [
|