@plurix/ecom-components 1.14.2-commerce.8 → 1.14.2-shlo1447.0

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.
Files changed (65) hide show
  1. package/dist/assets/svgs/SuccessIconV2.d.ts +1 -0
  2. package/dist/assets/svgs/SuccessIconV2.js +30 -0
  3. package/dist/assets/svgs/WarningIconV2.d.ts +1 -0
  4. package/dist/assets/svgs/WarningIconV2.js +40 -0
  5. package/dist/hooks/useVerticalShelfCarouselProps.d.ts +4 -0
  6. package/dist/hooks/useVerticalShelfCarouselProps.js +14 -0
  7. package/dist/hooks/useWindowDimensions.d.ts +5 -0
  8. package/dist/hooks/useWindowDimensions.js +38 -0
  9. package/dist/main.d.ts +1 -0
  10. package/dist/main.js +19 -17
  11. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +14 -0
  12. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +69 -0
  13. package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +12 -2
  14. package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +79 -71
  15. package/dist/packages/ChangeOrderModal/api/getOrderForm.d.ts +1 -1
  16. package/dist/packages/ChangeOrderModal/api/getOrderForm.js +7 -9
  17. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +7 -5
  18. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +18 -11
  19. package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +6 -1
  20. package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +11 -11
  21. package/dist/packages/Coupons/Coupons.d.ts +4 -1
  22. package/dist/packages/Coupons/Coupons.js +67 -57
  23. package/dist/packages/Coupons/api/addCoupon.js +6 -6
  24. package/dist/packages/Coupons/api/getCoupons.js +5 -5
  25. package/dist/packages/Coupons/components/CouponCard.d.ts +3 -1
  26. package/dist/packages/Coupons/components/CouponCard.js +94 -83
  27. package/dist/packages/Coupons/views/CouponsView.d.ts +3 -1
  28. package/dist/packages/Coupons/views/CouponsView.js +87 -78
  29. package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +13 -10
  30. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +3 -2
  31. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +15 -31
  32. package/dist/packages/ProductCard/ProductCardHorizontal/index.js +31 -30
  33. package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +8 -1
  34. package/dist/packages/ProductCard/ProductCardPrice/index.js +27 -31
  35. package/dist/packages/ProductCard/ProductCardVertical/index.js +16 -15
  36. package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
  37. package/dist/packages/Regionalization/Regionalization.js +15 -13
  38. package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
  39. package/dist/packages/Regionalization/context/RegionalizationContext.js +31 -29
  40. package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +1 -0
  41. package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
  42. package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +21 -0
  43. package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +96 -0
  44. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +1 -0
  45. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +20 -0
  46. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +11 -0
  47. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +33 -0
  48. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +1 -0
  49. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +4 -0
  50. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +16 -0
  51. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +30 -0
  52. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +1 -0
  53. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +4 -0
  54. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +1 -0
  55. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +8 -0
  56. package/dist/styles/adaptive-carousel.global.css +1 -0
  57. package/dist/styles/regionalization.global.css +1 -1
  58. package/dist/styles/vouchers-redeemed.global.css +1 -0
  59. package/dist/types/ProductCard.d.ts +13 -12
  60. package/dist/utils/carousel/carouselProps.d.ts +33 -0
  61. package/dist/utils/carousel/carouselProps.js +59 -0
  62. package/dist/utils/changerOrderModal.js +13 -16
  63. package/dist/utils/scroll/isScrollToEnd.d.ts +1 -0
  64. package/dist/utils/scroll/isScrollToEnd.js +4 -0
  65. package/package.json +69 -69
@@ -0,0 +1 @@
1
+ export declare const SuccessIconV2: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsxs as s, jsx as C } from "react/jsx-runtime";
2
+ const i = () => /* @__PURE__ */ s(
3
+ "svg",
4
+ {
5
+ width: "32",
6
+ height: "32",
7
+ viewBox: "0 0 32 32",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: [
11
+ /* @__PURE__ */ C(
12
+ "path",
13
+ {
14
+ d: "M29.5869 5.26648C29.0362 4.71573 28.1435 4.71592 27.5933 5.26667L14.9419 17.9202L9.11396 12.092C8.56321 11.5414 7.67054 11.5413 7.12036 12.0918C6.56961 12.6424 6.56961 13.535 7.12017 14.0854L13.9451 20.9107C14.2096 21.1752 14.5681 21.3237 14.9421 21.3237C15.316 21.3237 15.6746 21.1752 15.9391 20.9107L29.5873 7.26008C30.1375 6.70971 30.1375 5.81704 29.5869 5.26648Z",
15
+ fill: "#177336"
16
+ }
17
+ ),
18
+ /* @__PURE__ */ C(
19
+ "path",
20
+ {
21
+ d: "M26.5431 14.3016C25.7645 14.3016 25.1333 14.9326 25.1333 15.7113V26.1567H4.81953V5.84297H20.904C21.6828 5.84297 22.3138 5.21196 22.3138 4.4332C22.3138 3.65464 21.6828 3.02344 20.904 3.02344H3.40976C2.6312 3.02344 2 3.65445 2 4.4332V27.5665C2 28.3453 2.6312 28.9763 3.40976 28.9763H26.5431C27.3218 28.9763 27.9528 28.3453 27.9528 27.5665V15.7113C27.9528 14.9328 27.3218 14.3016 26.5431 14.3016Z",
22
+ fill: "#177336"
23
+ }
24
+ )
25
+ ]
26
+ }
27
+ );
28
+ export {
29
+ i as SuccessIconV2
30
+ };
@@ -0,0 +1 @@
1
+ export declare const WarningIconV2: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsxs as i, jsx as C } from "react/jsx-runtime";
2
+ const t = () => /* @__PURE__ */ i(
3
+ "svg",
4
+ {
5
+ width: "32",
6
+ height: "32",
7
+ viewBox: "0 0 32 32",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: [
11
+ /* @__PURE__ */ i("g", { clipPath: "url(#clip0_471_4351)", children: [
12
+ /* @__PURE__ */ C(
13
+ "path",
14
+ {
15
+ d: "M29.4265 22.6539C29.4265 22.6539 19.5314 4.469 19.5261 4.46024C17.9376 1.78483 14.064 1.78205 12.4736 4.46024C12.4684 4.469 12.4633 4.47797 12.4584 4.48694L2.57341 22.6539C0.96419 25.3874 2.93251 28.8346 6.10802 28.8346H25.8918C29.0648 28.8346 31.037 25.3897 29.4265 22.6539ZM25.8918 27.1944H6.10802C4.19994 27.1944 3.01732 25.1193 3.99208 23.4776C3.99742 23.4686 4.00255 23.4599 4.00746 23.4507L13.8914 5.28546C14.848 3.69461 17.153 3.69654 18.1083 5.28546C18.1083 5.28546 28.0024 23.4686 28.0076 23.4774C28.9817 25.118 27.8012 27.1944 25.8918 27.1944Z",
16
+ fill: "#B28100"
17
+ }
18
+ ),
19
+ /* @__PURE__ */ C(
20
+ "path",
21
+ {
22
+ d: "M15.9998 9.51758C14.6431 9.51758 13.5393 10.6216 13.5393 11.9783V16.8995C13.5393 18.2562 14.6431 19.36 15.9998 19.36C17.3567 19.36 18.4605 18.2562 18.4605 16.8995V11.9783C18.4605 10.6216 17.3567 9.51758 15.9998 9.51758ZM16.8201 16.8995C16.8201 17.3518 16.4523 17.7196 15.9998 17.7196C15.5476 17.7196 15.1797 17.3518 15.1797 16.8995V11.9783C15.1797 11.5261 15.5476 11.158 15.9998 11.158C16.4523 11.158 16.8201 11.5261 16.8201 11.9783V16.8995Z",
23
+ fill: "#B28100"
24
+ }
25
+ ),
26
+ /* @__PURE__ */ C(
27
+ "path",
28
+ {
29
+ d: "M15.9998 21.0005C14.6431 21.0005 13.5393 22.1043 13.5393 23.461C13.5393 24.8177 14.6431 25.9217 15.9998 25.9217C17.3567 25.9217 18.4605 24.8177 18.4605 23.461C18.4605 22.1043 17.3567 21.0005 15.9998 21.0005ZM15.9998 24.2813C15.5476 24.2813 15.1797 23.9132 15.1797 23.461C15.1797 23.0088 15.5476 22.6409 15.9998 22.6409C16.4523 22.6409 16.8201 23.0088 16.8201 23.461C16.8201 23.9132 16.4523 24.2813 15.9998 24.2813Z",
30
+ fill: "#B28100"
31
+ }
32
+ )
33
+ ] }),
34
+ /* @__PURE__ */ C("defs", { children: /* @__PURE__ */ C("clipPath", { id: "clip0_471_4351", children: /* @__PURE__ */ C("rect", { width: "28", height: "28", fill: "white", transform: "translate(2 2)" }) }) })
35
+ ]
36
+ }
37
+ );
38
+ export {
39
+ t as WarningIconV2
40
+ };
@@ -0,0 +1,4 @@
1
+ import { CarouselProps } from '../packages/Carousel/Carousel';
2
+
3
+ export type CarouselPropsWithoutChildren = Omit<CarouselProps, 'children'>;
4
+ export declare function useVerticalShelfCarouselProps(): CarouselPropsWithoutChildren;
@@ -0,0 +1,14 @@
1
+ import i from "./useWindowDimensions.js";
2
+ function o() {
3
+ const { isMobile: e } = i();
4
+ return {
5
+ arrow: { isVisible: !1 },
6
+ gapItems: 8,
7
+ itemWidthProp: 290,
8
+ bullet: { isVisible: !1 },
9
+ isMobile: e
10
+ };
11
+ }
12
+ export {
13
+ o as useVerticalShelfCarouselProps
14
+ };
@@ -0,0 +1,5 @@
1
+ export default function useWindowDimensions(): {
2
+ width: number | null;
3
+ height: number | null;
4
+ isMobile: boolean;
5
+ };
@@ -0,0 +1,38 @@
1
+ import { useState as u, useCallback as l, useEffect as w } from "react";
2
+ function a() {
3
+ const [o, s] = u({
4
+ width: null,
5
+ height: null,
6
+ isMobile: !1
7
+ }), n = l(() => {
8
+ var t;
9
+ if (typeof window == "undefined")
10
+ return {
11
+ width: null,
12
+ height: null,
13
+ isMobile: !1
14
+ };
15
+ const e = parseInt(
16
+ (t = getComputedStyle(document.documentElement).getPropertyValue(
17
+ "--breakpoint-notebook"
18
+ )) != null ? t : 1280,
19
+ 10
20
+ ), i = window.innerWidth, d = window.innerHeight, r = i < e;
21
+ return {
22
+ width: i,
23
+ height: d,
24
+ isMobile: r
25
+ };
26
+ }, []);
27
+ return w(() => {
28
+ if (typeof window == "undefined")
29
+ return;
30
+ function e() {
31
+ s(n());
32
+ }
33
+ return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
34
+ }, [n]), o;
35
+ }
36
+ export {
37
+ a as default
38
+ };
package/dist/main.d.ts CHANGED
@@ -17,3 +17,4 @@ export type { SearchSuggestionsProps } from './packages/SearchSugestions/types/S
17
17
  export type { SearchSuggestionsApiResponse, Searches } from './packages/SearchSugestions/types/ResponseApi';
18
18
  export { ProductCard } from './packages/ProductCard';
19
19
  export { ProductCardSeeMore } from './packages/ProductCardSeeMore/ProductCardSeeMore';
20
+ export { VouchersRedeemed } from './packages/VouchersRedeemed/VouchersRedeemed';
package/dist/main.js CHANGED
@@ -1,28 +1,30 @@
1
1
  import { CartClubAlert as e } from "./packages/CartClubAlert/CartClubAlert.js";
2
- import { Carousel as p } from "./packages/Carousel/Carousel.js";
2
+ import { Carousel as m } from "./packages/Carousel/Carousel.js";
3
3
  import { Coupons as f } from "./packages/Coupons/Coupons.js";
4
- import { Onboarding as x } from "./packages/Onboarding/Onboarding.js";
4
+ import { Onboarding as a } from "./packages/Onboarding/Onboarding.js";
5
5
  import { Tour as n } from "./packages/Tour/Tour.js";
6
- import { Regionalization as l } from "./packages/Regionalization/Regionalization.js";
7
- import { Modal as g } from "./packages/Modal/Modal.js";
8
- import { ContactCard as c } from "./packages/ContactCard/ContactCard.js";
6
+ import { Regionalization as u } from "./packages/Regionalization/Regionalization.js";
7
+ import { Modal as c } from "./packages/Modal/Modal.js";
8
+ import { ContactCard as i } from "./packages/ContactCard/ContactCard.js";
9
9
  import { ChangeOrderModal as S } from "./packages/ChangeOrderModal/ChangeOrderModal.js";
10
- import { Skeleton as b } from "./packages/Skeleton/index.js";
10
+ import { Skeleton as M } from "./packages/Skeleton/index.js";
11
11
  import { SearchSuggestions as O } from "./packages/SearchSugestions/components/SearchSuggestions/index.js";
12
- import { ProductCard as k } from "./packages/ProductCard/index.js";
13
- import { ProductCardSeeMore as A } from "./packages/ProductCardSeeMore/ProductCardSeeMore.js";
12
+ import { ProductCard as R } from "./packages/ProductCard/index.js";
13
+ import { ProductCardSeeMore as z } from "./packages/ProductCardSeeMore/ProductCardSeeMore.js";
14
+ import { VouchersRedeemed as T } from "./packages/VouchersRedeemed/VouchersRedeemed.js";
14
15
  export {
15
- p as Carousel,
16
+ m as Carousel,
16
17
  e as CartClubAlert,
17
18
  S as ChangeOrderModal,
18
- c as ContactCard,
19
+ i as ContactCard,
19
20
  f as Coupons,
20
- g as Modal,
21
- x as Onboarding,
22
- k as ProductCard,
23
- A as ProductCardSeeMore,
24
- l as Regionalization,
21
+ c as Modal,
22
+ a as Onboarding,
23
+ R as ProductCard,
24
+ z as ProductCardSeeMore,
25
+ u as Regionalization,
25
26
  O as SearchSuggestions,
26
- b as Skeleton,
27
- n as Tour
27
+ M as Skeleton,
28
+ n as Tour,
29
+ T as VouchersRedeemed
28
30
  };
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { CarouselPropsWithoutChildren } from '../../hooks/useVerticalShelfCarouselProps';
3
+
4
+ interface AdaptiveCarouselProps {
5
+ quantity: number;
6
+ children: React.ReactNode;
7
+ quantityToCarousel?: number;
8
+ propsCarousel?: CarouselPropsWithoutChildren;
9
+ activeBlur?: boolean;
10
+ forceCarousel?: boolean;
11
+ isNewDots?: boolean;
12
+ }
13
+ export declare const AdaptiveCarousel: ({ quantity, children, quantityToCarousel, propsCarousel, activeBlur, forceCarousel, isNewDots }: AdaptiveCarouselProps) => import("react/jsx-runtime").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,69 @@
1
+ var D = Object.defineProperty, P = Object.defineProperties;
2
+ var T = Object.getOwnPropertyDescriptors;
3
+ var g = Object.getOwnPropertySymbols;
4
+ var $ = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
5
+ var b = (o, s, r) => s in o ? D(o, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[s] = r, n = (o, s) => {
6
+ for (var r in s || (s = {}))
7
+ $.call(s, r) && b(o, r, s[r]);
8
+ if (g)
9
+ for (var r of g(s))
10
+ q.call(s, r) && b(o, r, s[r]);
11
+ return o;
12
+ }, h = (o, s) => P(o, T(s));
13
+ import { jsx as f, jsxs as w, Fragment as y } from "react/jsx-runtime";
14
+ /* empty css */import { useRef as z, useState as v, useEffect as E } from "react";
15
+ import { isScrollToEnd as F } from "../../utils/scroll/isScrollToEnd.js";
16
+ import I from "../../hooks/useWindowDimensions.js";
17
+ import { Carousel as R } from "../Carousel/Carousel.js";
18
+ import { carouselProps as W } from "../../utils/carousel/carouselProps.js";
19
+ const U = ({
20
+ quantity: o,
21
+ children: s,
22
+ quantityToCarousel: r = 6,
23
+ propsCarousel: N,
24
+ activeBlur: l = !0,
25
+ forceCarousel: x,
26
+ isNewDots: L
27
+ }) => {
28
+ const c = z(null), [m, S] = v(!1), [e, j] = v({
29
+ left: !1,
30
+ right: !1
31
+ }), { width: u } = I(), i = x || o >= r, k = n(n({}, W(u != null ? u : 0)), N);
32
+ return E(() => {
33
+ S(!0);
34
+ }, []), E(() => {
35
+ var p, d;
36
+ if (i && l) {
37
+ const t = (d = (p = c == null ? void 0 : c.current) == null ? void 0 : p.querySelector(".carousel-container")) != null ? d : null, a = () => {
38
+ j({
39
+ left: !!(t != null && t.scrollLeft),
40
+ right: !F(t)
41
+ });
42
+ };
43
+ return a(), t == null || t.addEventListener(
44
+ "scroll",
45
+ a,
46
+ {
47
+ passive: !1
48
+ }
49
+ ), () => t == null ? void 0 : t.removeEventListener(
50
+ "scroll",
51
+ a
52
+ );
53
+ }
54
+ }, [m, i, l]), m ? /* @__PURE__ */ f(
55
+ "div",
56
+ {
57
+ className: `adaptiveCarousel-container ${i ? "isCarousel" : "notCarousel"} ${L ? "isNewDots" : ""}`,
58
+ ref: c,
59
+ children: i ? /* @__PURE__ */ w(y, { children: [
60
+ l && (e == null ? void 0 : e.left) && /* @__PURE__ */ f("div", { className: "background-blur-left" }),
61
+ /* @__PURE__ */ f(R, h(n({}, k), { children: s })),
62
+ l && (e == null ? void 0 : e.right) && /* @__PURE__ */ f("div", { className: "background-blur-right" })
63
+ ] }) : s
64
+ }
65
+ ) : null;
66
+ };
67
+ export {
68
+ U as AdaptiveCarousel
69
+ };
@@ -1,6 +1,8 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { SelectedItemProps } from './components/ProductSelected';
3
3
  import { SimilarProducts as SimilarProductsProps } from '../../types/ChangeOrderModal';
4
+ import { GetProductsSimilarsResponse } from './api/getProductsSimilars';
5
+ import { PostChangeOrderMutationResponse } from './api/postChangeOrder';
4
6
 
5
7
  export interface ChangeOrderModalProps {
6
8
  postalCode: string;
@@ -11,9 +13,17 @@ export interface ChangeOrderModalProps {
11
13
  isClubClient?: boolean;
12
14
  orderFormId: string;
13
15
  saveSelectedSimilarProduct?: (similarProduct: SimilarProductsProps | undefined) => void;
14
- account: string;
16
+ getOrderFormMutation?: (variables: {}) => Promise<CustomDataMutationResponse>;
17
+ getProductsSimilarsMutation?: (variables: {}) => Promise<GetProductsSimilarsResponse>;
18
+ postChangeOrderMutation?: (variables: {}) => Promise<PostChangeOrderMutationResponse>;
19
+ }
20
+ interface CustomDataMutationResponse {
21
+ getOrderForm: {
22
+ data: string;
23
+ };
15
24
  }
16
25
  export interface idSubstitutionCriteriasProps {
17
26
  [key: string]: string;
18
27
  }
19
- export declare const ChangeOrderModal: ({ selectedItem, postalCode, orderFormId, isClubClient, isOpen, environment, setIsOpen, saveSelectedSimilarProduct, account }: ChangeOrderModalProps) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const ChangeOrderModal: ({ selectedItem, postalCode, orderFormId, isClubClient, isOpen, environment, setIsOpen, saveSelectedSimilarProduct, getOrderFormMutation, getProductsSimilarsMutation, postChangeOrderMutation }: ChangeOrderModalProps) => import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -1,108 +1,116 @@
1
- import { jsx as n, jsxs as q, Fragment as w } from "react/jsx-runtime";
2
- import { useState as l, useEffect as M } from "react";
3
- import { Modal as N } from "../Modal/Modal.js";
4
- import { ProductSelected as k } from "./components/ProductSelected.js";
5
- import { SimilarProducts as v } from "./components/SimilarProducts.js";
6
- import { ModalFooter as A } from "./components/ModalFooter.js";
7
- /* empty css */import { getProductsSimilars as E } from "./api/getProductsSimilars.js";
8
- import _ from "../../hooks/useAnalitcsEvents.js";
9
- import { NoSimilarProduct as J } from "./components/NoSimilarProduct.js";
10
- import { getOrderForm as L } from "./api/getOrderForm.js";
11
- import { postChangeOrder as T } from "./api/postChangeOrder.js";
12
- import { Skeleton as $ } from "../Skeleton/index.js";
13
- const or = ({
14
- selectedItem: r,
15
- postalCode: h,
16
- orderFormId: c,
17
- isClubClient: y,
18
- isOpen: O,
1
+ import { jsx as a, jsxs as E, Fragment as J } from "react/jsx-runtime";
2
+ import { useState as f, useEffect as M } from "react";
3
+ import { Modal as _ } from "../Modal/Modal.js";
4
+ import { ProductSelected as v } from "./components/ProductSelected.js";
5
+ import { SimilarProducts as L } from "./components/SimilarProducts.js";
6
+ import { ModalFooter as T } from "./components/ModalFooter.js";
7
+ /* empty css */import { getProductsSimilars as $ } from "./api/getProductsSimilars.js";
8
+ import z from "../../hooks/useAnalitcsEvents.js";
9
+ import { NoSimilarProduct as B } from "./components/NoSimilarProduct.js";
10
+ import { getOrderForm as G } from "./api/getOrderForm.js";
11
+ import { postChangeOrder as H } from "./api/postChangeOrder.js";
12
+ import { Skeleton as K } from "../Skeleton/index.js";
13
+ const ao = ({
14
+ selectedItem: o,
15
+ postalCode: S,
16
+ orderFormId: d,
17
+ isClubClient: O,
18
+ isOpen: y,
19
19
  environment: b,
20
20
  setIsOpen: p,
21
- saveSelectedSimilarProduct: m,
22
- account: u
21
+ saveSelectedSimilarProduct: c,
22
+ getOrderFormMutation: l,
23
+ getProductsSimilarsMutation: C,
24
+ postChangeOrderMutation: F
23
25
  }) => {
24
- const [e, P] = l(), [C, s] = l(!1), a = b === "io", { genericTaggingEvent: F } = _(), [o, g] = l({ itemId: "" });
25
- return M(() => {
26
+ const [s, P] = f(), [x, m] = f(!1), r = b === "io", { genericTaggingEvent: N } = z(), [t, g] = f({ itemId: "" });
27
+ M(() => {
26
28
  (async () => {
27
- s(!0);
29
+ m(!0);
28
30
  try {
29
- const i = await E({
30
- postalCode: h,
31
- selectedItem: r,
32
- isIO: a,
33
- account: u
34
- }), d = (i == null ? void 0 : i.products) || [];
35
- P(d);
31
+ const i = await $({
32
+ postalCode: S,
33
+ selectedItem: o,
34
+ isIO: r,
35
+ getProductsSimilarsMutation: C
36
+ }), u = (i == null ? void 0 : i.products) || [];
37
+ P(u);
36
38
  } finally {
37
- s(!1);
39
+ m(!1);
38
40
  }
39
41
  })(), (async () => {
40
- var i, d;
41
- s(!0);
42
+ var i, u;
43
+ m(!0);
42
44
  try {
43
- const f = await L(c, a, u), t = ((d = (i = f == null ? void 0 : f.customData) == null ? void 0 : i.customApps) == null ? void 0 : d.find(
44
- (j) => j.id === "janis"
45
+ const q = r && G(d, r), w = l && await l({
46
+ input: {
47
+ orderFormId: d
48
+ }
49
+ }) || { getOrderForm: { data: "" } }, e = r ? q : JSON.parse(w.getOrderForm.data), n = ((u = (i = e == null ? void 0 : e.customData) == null ? void 0 : i.customApps) == null ? void 0 : u.find(
50
+ (A) => A.id === "janis"
45
51
  )) || null;
46
- let S = {};
47
- t != null && t.fields.idSubstitutionCriterias && (S = JSON.parse(
48
- t == null ? void 0 : t.fields.idSubstitutionCriterias
52
+ let h = {};
53
+ n != null && n.fields.idSubstitutionCriterias && (h = JSON.parse(
54
+ n == null ? void 0 : n.fields.idSubstitutionCriterias
49
55
  ));
50
- const x = r == null ? void 0 : r.productOriginId;
56
+ const k = o == null ? void 0 : o.productOriginId;
51
57
  g({
52
- itemId: `${S[x]}`
58
+ itemId: `${h[k]}`
53
59
  });
54
60
  } finally {
55
- s(!1);
61
+ m(!1);
56
62
  }
57
63
  })();
58
- }, []), /* @__PURE__ */ n(
59
- N,
64
+ }, []);
65
+ const j = () => {
66
+ H(
67
+ d,
68
+ r,
69
+ o.productOriginId,
70
+ t.itemId,
71
+ F
72
+ ), t && (c == null || c(t), N("salvar_substituto", {
73
+ name: o.name,
74
+ replacement_item: t == null ? void 0 : t.name
75
+ })), p(!1);
76
+ };
77
+ return /* @__PURE__ */ a(
78
+ _,
60
79
  {
61
- isOpen: O,
80
+ isOpen: y,
62
81
  setIsOpen: p,
63
82
  className: "change-order-modal",
64
83
  title: "Produto com estoque baixo",
65
- Footer: /* @__PURE__ */ n(
66
- A,
84
+ Footer: s && s.length > 0 && /* @__PURE__ */ a(
85
+ T,
67
86
  {
68
- saveSelectedSimilarProduct: () => {
69
- T(
70
- c,
71
- a,
72
- r.productOriginId,
73
- o.itemId,
74
- u
75
- ), o && (m == null || m(o), F("salvar_substituto", {
76
- name: r.name,
77
- replacement_item: o == null ? void 0 : o.name
78
- })), p(!1);
79
- }
87
+ saveSelectedSimilarProduct: j
80
88
  }
81
89
  ),
82
- children: C ? /* @__PURE__ */ n(
83
- $,
90
+ children: x ? /* @__PURE__ */ a(
91
+ K,
84
92
  {
85
- width: a ? "100%" : "90%",
86
- height: a ? 600 : 425,
93
+ width: r ? "100%" : "90%",
94
+ height: r ? 600 : 425,
87
95
  backgroundColor: "var(--color-grayScale-faded)",
88
96
  margin: "auto",
89
97
  animation: !0
90
98
  }
91
- ) : /* @__PURE__ */ q(w, { children: [
92
- r && /* @__PURE__ */ n(k, { selectedItem: r }),
93
- e && e.length > 0 ? /* @__PURE__ */ n(
94
- v,
99
+ ) : /* @__PURE__ */ E(J, { children: [
100
+ o && /* @__PURE__ */ a(v, { selectedItem: o }),
101
+ s && s.length > 0 ? /* @__PURE__ */ a(
102
+ L,
95
103
  {
96
- isClubClient: y,
97
- similarProductSelect: o,
104
+ isClubClient: O,
105
+ similarProductSelect: t,
98
106
  setSimilarProductSelect: g,
99
- products: e
107
+ products: s
100
108
  }
101
- ) : /* @__PURE__ */ n(J, {})
109
+ ) : /* @__PURE__ */ a(B, {})
102
110
  ] })
103
111
  }
104
112
  );
105
113
  };
106
114
  export {
107
- or as ChangeOrderModal
115
+ ao as ChangeOrderModal
108
116
  };
@@ -1 +1 @@
1
- export declare const getOrderForm: (orderFormId: string, isIO: boolean, account: string) => Promise<any>;
1
+ export declare const getOrderForm: (orderFormId: string, isIO: boolean) => Promise<any>;
@@ -1,18 +1,16 @@
1
- import o from "axios";
2
- const i = async (t, a, e) => {
1
+ import e from "axios";
2
+ const c = async (o, t) => {
3
3
  try {
4
- if (a) {
5
- const { data: c } = await o.post(
6
- `/api/checkout/pub/orderForm/${t}`
4
+ if (t) {
5
+ const { data: r } = await e.post(
6
+ `/api/checkout/pub/orderForm/${o}`
7
7
  );
8
- return c;
8
+ return r;
9
9
  }
10
- const { data: r } = await o.get(`https://${e}.myvtex.com/api/checkout/pub/orderForm/${t}`);
11
- return r;
12
10
  } catch (r) {
13
11
  console.error("Error in Change Order Modal", r);
14
12
  }
15
13
  };
16
14
  export {
17
- i as getOrderForm
15
+ c as getOrderForm
18
16
  };
@@ -4,10 +4,12 @@ interface GetProductsSimilarsProps {
4
4
  postalCode: string;
5
5
  isIO: boolean;
6
6
  selectedItem: SelectedItemProps;
7
- account: string;
7
+ getProductsSimilarsMutation?: (variables: {}) => Promise<GetProductsSimilarsResponse>;
8
8
  }
9
- export declare const getProductsSimilars: ({ postalCode, isIO, selectedItem, account }: GetProductsSimilarsProps) => Promise<{
10
- productOrigin: string;
11
- products: import('../../../main').SimilarProducts[];
12
- } | undefined>;
9
+ export interface GetProductsSimilarsResponse {
10
+ getProductsSimilars: {
11
+ data: string;
12
+ };
13
+ }
14
+ export declare const getProductsSimilars: ({ postalCode, isIO, selectedItem, getProductsSimilarsMutation }: GetProductsSimilarsProps) => Promise<any>;
13
15
  export {};
@@ -1,27 +1,34 @@
1
- import n from "axios";
2
- const f = async ({
3
- postalCode: a,
1
+ import c from "axios";
2
+ const P = async ({
3
+ postalCode: n,
4
4
  isIO: u,
5
5
  selectedItem: r,
6
- account: s
6
+ getProductsSimilarsMutation: a
7
7
  }) => {
8
8
  try {
9
9
  if (u) {
10
- const { data: o } = await n.get(
11
- `/_v/commerce/products/productsSimilar?postalCode=${a}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`
10
+ const { data: o } = await c.get(
11
+ `/_v/commerce/products/productsSimilar?postalCode=${n}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`
12
12
  ), { similarProducts: p } = o;
13
13
  return p.find(
14
- (d) => d.productOrigin === (r == null ? void 0 : r.productOriginId)
14
+ (s) => s.productOrigin === (r == null ? void 0 : r.productOriginId)
15
15
  );
16
16
  }
17
- const { data: i } = await n.get(`https://${s}.myvtex.com/_v/commerce/products/productsSimilar?postalCode=${a}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`), { similarProducts: c } = i;
18
- return c.find(
17
+ const i = a && await a({
18
+ input: {
19
+ postalCode: n,
20
+ productOriginId: r == null ? void 0 : r.productOriginId
21
+ }
22
+ });
23
+ return i ? JSON.parse(
24
+ i == null ? void 0 : i.getProductsSimilars.data
25
+ ).similarProducts.find(
19
26
  (o) => o.productOrigin === r.productOriginId
20
- );
27
+ ) : void 0;
21
28
  } catch (i) {
22
29
  console.error("Error in Change Order Modal", i);
23
30
  }
24
31
  };
25
32
  export {
26
- f as getProductsSimilars
33
+ P as getProductsSimilars
27
34
  };
@@ -1 +1,6 @@
1
- export declare const postChangeOrder: (orderFormId: string, isIO: boolean, skuId: string, substitutionId: string, account: string) => Promise<any>;
1
+ export interface PostChangeOrderMutationResponse {
2
+ postChangeOrder: {
3
+ data: string;
4
+ };
5
+ }
6
+ export declare const postChangeOrder: (orderFormId: string, isIO: boolean, skuId: string, substitutionId: string, postChangeOrderMutation?: (variables: {}) => Promise<PostChangeOrderMutationResponse>) => Promise<any>;
@@ -1,26 +1,26 @@
1
- import o from "axios";
2
- const h = async (e, t, a, c, n) => {
1
+ import s from "axios";
2
+ const p = async (o, e, n, c, t) => {
3
3
  try {
4
4
  const r = {
5
- orderFormId: e,
6
- skuId: a,
5
+ orderFormId: o,
6
+ skuId: n,
7
7
  substitutionId: c
8
8
  };
9
- if (t) {
10
- const { data: s } = await o.post(
9
+ if (e) {
10
+ const { data: d } = await s.post(
11
11
  "/_v/commerce/orderform/changeOrder",
12
12
  r
13
13
  );
14
- return s;
14
+ return d;
15
15
  }
16
- const { data: d } = await o.post(`https://${n}.myvtex.com/_v/commerce/orderform/changeOrder`, {
17
- body: r
16
+ const a = t && await t({
17
+ input: r
18
18
  });
19
- return d;
19
+ return a ? JSON.parse(a == null ? void 0 : a.postChangeOrder.data) : void 0;
20
20
  } catch (r) {
21
21
  console.error("Error in Change Order Modal", r);
22
22
  }
23
23
  };
24
24
  export {
25
- h as postChangeOrder
25
+ p as postChangeOrder
26
26
  };