@plurix/ecom-components 1.14.1-eng-task-1249.11 → 1.14.1-eng-task-1249.12
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.
|
@@ -1,7 +1,6 @@
|
|
|
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 { GetOrderFormMutationInput } from './api/getOrderForm';
|
|
5
4
|
|
|
6
5
|
export interface ChangeOrderModalProps {
|
|
7
6
|
postalCode: string;
|
|
@@ -12,15 +11,19 @@ export interface ChangeOrderModalProps {
|
|
|
12
11
|
isClubClient?: boolean;
|
|
13
12
|
orderFormId: string;
|
|
14
13
|
saveSelectedSimilarProduct?: (similarProduct: SimilarProductsProps | undefined) => void;
|
|
15
|
-
getOrderFormMutation?: (variables:
|
|
14
|
+
getOrderFormMutation?: (variables: {}) => Promise<CustomDataMutationResponse>;
|
|
15
|
+
getProductsSimilarsMutation?: any;
|
|
16
|
+
postChangeOrderMutation?: any;
|
|
17
|
+
}
|
|
18
|
+
interface CustomDataMutationResponse {
|
|
19
|
+
data: {
|
|
16
20
|
getOrderForm: {
|
|
17
21
|
data: string;
|
|
18
22
|
};
|
|
19
|
-
}
|
|
20
|
-
getProductsSimilarsMutation?: any;
|
|
21
|
-
postChangeOrderMutation?: any;
|
|
23
|
+
};
|
|
22
24
|
}
|
|
23
25
|
export interface idSubstitutionCriteriasProps {
|
|
24
26
|
[key: string]: string;
|
|
25
27
|
}
|
|
26
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,116 +1,119 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { ProductSelected as
|
|
5
|
-
import { SimilarProducts as
|
|
6
|
-
import { ModalFooter as
|
|
7
|
-
/* empty css */import { getProductsSimilars as
|
|
8
|
-
import
|
|
9
|
-
import { NoSimilarProduct as
|
|
10
|
-
import { getOrderForm as
|
|
11
|
-
import { postChangeOrder as
|
|
12
|
-
import { Skeleton as
|
|
13
|
-
const
|
|
1
|
+
import { jsx as s, jsxs as E, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, 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 so = ({
|
|
14
14
|
selectedItem: o,
|
|
15
|
-
postalCode:
|
|
16
|
-
orderFormId:
|
|
17
|
-
isClubClient:
|
|
18
|
-
isOpen:
|
|
19
|
-
environment:
|
|
15
|
+
postalCode: O,
|
|
16
|
+
orderFormId: d,
|
|
17
|
+
isClubClient: b,
|
|
18
|
+
isOpen: C,
|
|
19
|
+
environment: P,
|
|
20
20
|
setIsOpen: p,
|
|
21
|
-
saveSelectedSimilarProduct:
|
|
22
|
-
getOrderFormMutation:
|
|
23
|
-
getProductsSimilarsMutation:
|
|
21
|
+
saveSelectedSimilarProduct: f,
|
|
22
|
+
getOrderFormMutation: g,
|
|
23
|
+
getProductsSimilarsMutation: x,
|
|
24
24
|
postChangeOrderMutation: F
|
|
25
25
|
}) => {
|
|
26
|
-
const [a,
|
|
27
|
-
|
|
26
|
+
const [a, N] = e(), [j, m] = e(!1), r = P === "io", { genericTaggingEvent: q } = z(), [t, h] = e({ itemId: "" });
|
|
27
|
+
M(() => {
|
|
28
28
|
(async () => {
|
|
29
29
|
m(!0);
|
|
30
30
|
try {
|
|
31
|
-
const
|
|
32
|
-
postalCode:
|
|
31
|
+
const i = await $({
|
|
32
|
+
postalCode: O,
|
|
33
33
|
selectedItem: o,
|
|
34
|
-
isIO:
|
|
35
|
-
getProductsSimilarsMutation:
|
|
36
|
-
}),
|
|
37
|
-
|
|
34
|
+
isIO: r,
|
|
35
|
+
getProductsSimilarsMutation: x
|
|
36
|
+
}), u = (i == null ? void 0 : i.products) || [];
|
|
37
|
+
N(u);
|
|
38
38
|
} finally {
|
|
39
39
|
m(!1);
|
|
40
40
|
}
|
|
41
41
|
})(), (async () => {
|
|
42
|
-
var
|
|
42
|
+
var i, u;
|
|
43
43
|
m(!0);
|
|
44
44
|
try {
|
|
45
|
-
const c =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
|
|
45
|
+
const S = r && G(d, r), c = g && g({
|
|
46
|
+
input: {
|
|
47
|
+
orderFormId: d
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (console.log("mutationResponse", c), !S)
|
|
51
|
+
return;
|
|
52
|
+
const l = r ? S : JSON.parse(c == null ? void 0 : c.getOrderForm.data), n = ((u = (i = l == null ? void 0 : l.customData) == null ? void 0 : i.customApps) == null ? void 0 : u.find(
|
|
53
|
+
(A) => A.id === "janis"
|
|
51
54
|
)) || null;
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
let y = {};
|
|
56
|
+
n != null && n.fields.idSubstitutionCriterias && (y = JSON.parse(
|
|
57
|
+
n == null ? void 0 : n.fields.idSubstitutionCriterias
|
|
55
58
|
));
|
|
56
59
|
const w = o == null ? void 0 : o.productOriginId;
|
|
57
|
-
|
|
58
|
-
itemId: `${
|
|
60
|
+
h({
|
|
61
|
+
itemId: `${y[w]}`
|
|
59
62
|
});
|
|
60
63
|
} finally {
|
|
61
64
|
m(!1);
|
|
62
65
|
}
|
|
63
66
|
})();
|
|
64
67
|
}, []);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const k = () => {
|
|
69
|
+
H(
|
|
70
|
+
d,
|
|
71
|
+
r,
|
|
69
72
|
o.productOriginId,
|
|
70
|
-
|
|
73
|
+
t.itemId,
|
|
71
74
|
F
|
|
72
|
-
),
|
|
75
|
+
), t && (f == null || f(t), q("salvar_substituto", {
|
|
73
76
|
name: o.name,
|
|
74
|
-
replacement_item:
|
|
77
|
+
replacement_item: t == null ? void 0 : t.name
|
|
75
78
|
})), p(!1);
|
|
76
79
|
};
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
|
|
80
|
+
return /* @__PURE__ */ s(
|
|
81
|
+
_,
|
|
79
82
|
{
|
|
80
|
-
isOpen:
|
|
83
|
+
isOpen: C,
|
|
81
84
|
setIsOpen: p,
|
|
82
85
|
className: "change-order-modal",
|
|
83
86
|
title: "Produto com estoque baixo",
|
|
84
|
-
Footer: a && a.length > 0 && /* @__PURE__ */
|
|
85
|
-
|
|
87
|
+
Footer: a && a.length > 0 && /* @__PURE__ */ s(
|
|
88
|
+
T,
|
|
86
89
|
{
|
|
87
|
-
saveSelectedSimilarProduct:
|
|
90
|
+
saveSelectedSimilarProduct: k
|
|
88
91
|
}
|
|
89
92
|
),
|
|
90
|
-
children:
|
|
91
|
-
|
|
93
|
+
children: j ? /* @__PURE__ */ s(
|
|
94
|
+
K,
|
|
92
95
|
{
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
96
|
+
width: r ? "100%" : "90%",
|
|
97
|
+
height: r ? 600 : 425,
|
|
95
98
|
backgroundColor: "var(--color-grayScale-faded)",
|
|
96
99
|
margin: "auto",
|
|
97
100
|
animation: !0
|
|
98
101
|
}
|
|
99
|
-
) : /* @__PURE__ */
|
|
100
|
-
o && /* @__PURE__ */
|
|
101
|
-
a && a.length > 0 ? /* @__PURE__ */
|
|
102
|
-
|
|
102
|
+
) : /* @__PURE__ */ E(J, { children: [
|
|
103
|
+
o && /* @__PURE__ */ s(v, { selectedItem: o }),
|
|
104
|
+
a && a.length > 0 ? /* @__PURE__ */ s(
|
|
105
|
+
L,
|
|
103
106
|
{
|
|
104
|
-
isClubClient:
|
|
105
|
-
similarProductSelect:
|
|
106
|
-
setSimilarProductSelect:
|
|
107
|
+
isClubClient: b,
|
|
108
|
+
similarProductSelect: t,
|
|
109
|
+
setSimilarProductSelect: h,
|
|
107
110
|
products: a
|
|
108
111
|
}
|
|
109
|
-
) : /* @__PURE__ */
|
|
112
|
+
) : /* @__PURE__ */ s(B, {})
|
|
110
113
|
] })
|
|
111
114
|
}
|
|
112
115
|
);
|
|
113
116
|
};
|
|
114
117
|
export {
|
|
115
|
-
|
|
118
|
+
so as ChangeOrderModal
|
|
116
119
|
};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
getOrderForm: {
|
|
3
|
-
data: string;
|
|
4
|
-
};
|
|
5
|
-
}
|
|
6
|
-
export interface CustomData {
|
|
7
|
-
customApps: CustomApp[];
|
|
8
|
-
customFields: unknown[];
|
|
9
|
-
}
|
|
10
|
-
export interface GetOrderFormMutationInput {
|
|
11
|
-
input: {
|
|
12
|
-
orderFormId: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface CustomApp {
|
|
16
|
-
fields: Record<string, string>;
|
|
17
|
-
id: string;
|
|
18
|
-
major: number;
|
|
19
|
-
}
|
|
20
|
-
export declare const getOrderForm: (orderFormId: string, isIO: boolean, getOrderFormMutation?: (variables: GetOrderFormMutationInput) => Promise<{
|
|
21
|
-
getOrderForm: {
|
|
22
|
-
data: string;
|
|
23
|
-
};
|
|
24
|
-
}>) => Promise<any>;
|
|
1
|
+
export declare const getOrderForm: (orderFormId: string, isIO: boolean) => Promise<any>;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import e from "axios";
|
|
2
|
+
const c = async (o, t) => {
|
|
3
3
|
try {
|
|
4
|
-
if (
|
|
5
|
-
const { data:
|
|
6
|
-
`/api/checkout/pub/orderForm/${
|
|
4
|
+
if (t) {
|
|
5
|
+
const { data: r } = await e.post(
|
|
6
|
+
`/api/checkout/pub/orderForm/${o}`
|
|
7
7
|
);
|
|
8
|
-
return
|
|
8
|
+
return r;
|
|
9
9
|
}
|
|
10
|
-
if (!e)
|
|
11
|
-
return;
|
|
12
|
-
const { getOrderForm: r } = await e({
|
|
13
|
-
input: {
|
|
14
|
-
orderFormId: t
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return JSON.parse(r.data);
|
|
18
10
|
} catch (r) {
|
|
19
11
|
console.error("Error in Change Order Modal", r);
|
|
20
12
|
}
|
|
21
13
|
};
|
|
22
14
|
export {
|
|
23
|
-
|
|
15
|
+
c as getOrderForm
|
|
24
16
|
};
|