contentoh-components-library 21.4.20 → 21.4.21
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/.env.development +5 -2
- package/.env.production +3 -1
- package/dist/components/atoms/Avatar/index.js +3 -2
- package/dist/components/atoms/Card/index.js +46 -5
- package/dist/components/atoms/Card/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +7 -2
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/atoms/SliderToolTip/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +27 -8
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +49 -4
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/organisms/PanelLayout/PanelLayout.stories.js +87 -0
- package/dist/components/organisms/PanelLayout/index.js +29 -0
- package/dist/components/organisms/PanelLayout/styles.js +32 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +60 -116
- package/dist/components/pages/ProviderProductEdition/index.js +117 -142
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +8 -4
- package/dist/components/pages/RetailerProductEdition/index.js +316 -308
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +247 -52
- package/package.json +4 -1
- package/src/components/atoms/Avatar/index.js +8 -2
- package/src/components/atoms/Card/index.js +35 -2
- package/src/components/atoms/Card/styles.js +41 -5
- package/src/components/atoms/CheckBox/index.js +4 -1
- package/src/components/atoms/CheckBox/styles.js +2 -0
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
- package/src/components/atoms/ImageCarousel/index.js +103 -0
- package/src/components/atoms/ImageCarousel/styles.js +79 -0
- package/src/components/atoms/InputFormatter/styles.js +2 -1
- package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
- package/src/components/atoms/PercentTag/index.js +9 -0
- package/src/components/atoms/PercentTag/styles.js +69 -0
- package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
- package/src/components/atoms/RatingStars/index.js +31 -0
- package/src/components/atoms/RatingStars/styles.js +28 -0
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
- package/src/components/atoms/RetailerCatalog/index.js +49 -0
- package/src/components/atoms/RetailerCatalog/styles.js +30 -0
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
- package/src/components/atoms/RetailerOption/index.js +53 -0
- package/src/components/atoms/RetailerOption/styles.js +41 -0
- package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
- package/src/components/atoms/RetailersList/index.js +20 -0
- package/src/components/atoms/RetailersList/styles.js +19 -0
- package/src/components/atoms/SliderToolTip/styles.js +1 -1
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
- package/src/components/atoms/UserCatalog/index.js +100 -0
- package/src/components/atoms/UserCatalog/styles.js +24 -0
- package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
- package/src/components/atoms/UserOption/index.js +95 -0
- package/src/components/atoms/UserOption/styles.js +61 -0
- package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
- package/src/components/atoms/UserSelector/index.js +86 -0
- package/src/components/atoms/UserSelector/styles.js +55 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
- package/src/components/molecules/GridItem/index.js +105 -0
- package/src/components/molecules/GridItem/styles.js +104 -0
- package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
- package/src/components/molecules/HeaderItem/index.js +26 -0
- package/src/components/molecules/HeaderItem/styles.js +27 -0
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/molecules/RowItem/ColumnItem.js +9 -0
- package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
- package/src/components/molecules/RowItem/index.js +45 -0
- package/src/components/molecules/RowItem/styles.js +40 -0
- package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +13 -0
- package/src/components/molecules/StripeCardForm/index.js +42 -0
- package/src/components/molecules/StripeCardForm/paymentForm.js +124 -0
- package/src/components/molecules/StripeCardForm/styles.js +73 -0
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
- package/src/components/molecules/StripeCardSelector/index.js +44 -0
- package/src/components/molecules/StripeCardSelector/styles.js +4 -0
- package/src/components/molecules/StripeCardSelector/utils.js +17 -0
- package/src/components/molecules/TagAndInput/index.js +10 -8
- package/src/components/organisms/Chat/Chat.stories.js +27 -7
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
- package/src/components/organisms/Chat/ContentChat/index.js +88 -12
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +46 -4
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
- package/src/components/organisms/GridProducts/index.js +50 -0
- package/src/components/organisms/GridProducts/styles.js +14 -0
- package/src/components/organisms/GridProducts/utils.js +111 -0
- package/src/components/organisms/Modal/styles.js +4 -1
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
- package/src/components/organisms/PanelLayout/PanelLayout.stories.js +63 -0
- package/src/components/organisms/PanelLayout/index.js +11 -0
- package/src/components/organisms/PanelLayout/styles.js +39 -0
- package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
- package/src/components/organisms/SideModal/index.js +50 -0
- package/src/components/organisms/SideModal/styles.js +30 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +66 -116
- package/src/components/pages/ProviderProductEdition/index.js +97 -129
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +7 -3
- package/src/components/pages/RetailerProductEdition/index.js +158 -184
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +16 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { ColumnItem } from "./ColumnItem";
|
|
3
|
+
import { CheckBox } from "../../atoms/CheckBox";
|
|
4
|
+
|
|
5
|
+
export const RowItem = ({
|
|
6
|
+
productsArray = [],
|
|
7
|
+
chkOnChange,
|
|
8
|
+
onGridClick,
|
|
9
|
+
chkChecked,
|
|
10
|
+
}) => {
|
|
11
|
+
return (
|
|
12
|
+
<Container>
|
|
13
|
+
{productsArray.map(({ cols, product, id }, i) => (
|
|
14
|
+
<div
|
|
15
|
+
className="row-container"
|
|
16
|
+
key={id}
|
|
17
|
+
onClick={(e) => onGridClick && onGridClick(e, product, i)}
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
className="chk-container"
|
|
21
|
+
onClick={(e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<CheckBox
|
|
26
|
+
id={"chk-" + id}
|
|
27
|
+
name={"chk-" + id}
|
|
28
|
+
className="chk-item"
|
|
29
|
+
onChange={(e) => chkOnChange && chkOnChange(e, product)}
|
|
30
|
+
defaultChecked={chkChecked && chkChecked(product)}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
{cols.map((col, i) => (
|
|
34
|
+
<ColumnItem
|
|
35
|
+
key={id + "-" + i}
|
|
36
|
+
element={col.name}
|
|
37
|
+
flex={col.flex}
|
|
38
|
+
minWidth={col.minWidth}
|
|
39
|
+
/>
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</Container>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
height: calc(100% - 36px);
|
|
6
|
+
overflow: auto;
|
|
7
|
+
min-width: fit-content;
|
|
8
|
+
|
|
9
|
+
.row-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
&:hover {
|
|
13
|
+
background-color: #fafafa;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.chk-container {
|
|
17
|
+
width: 30px;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
.chk-item {
|
|
22
|
+
width: 16px;
|
|
23
|
+
height: 16px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const Column = styled.div`
|
|
30
|
+
flex: ${({ flex }) => (flex ? flex : 1)};
|
|
31
|
+
min-width: ${({ minWidth }) => (minWidth ? minWidth : 100)}px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
color: #262626;
|
|
34
|
+
font-family: ${FontFamily.Lato};
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
line-height: 16px;
|
|
37
|
+
padding: 10px 5px;
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StripeCardForm } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/StripeCardForm",
|
|
5
|
+
component: StripeCardForm,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <StripeCardForm {...args} />;
|
|
9
|
+
export const StripeCardFormDefault = Template.bind({});
|
|
10
|
+
StripeCardFormDefault.args = {
|
|
11
|
+
customerId: "cus_KuEt6R6vwmN09f",
|
|
12
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5ZjQzNjAwMC0wYzgyLTRjNzYtYWEzNi1kM2Q1NGJjZTZiMTMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4NTU2OTUyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2ODU1NzMxMjMsImlhdCI6MTY4NTU2OTUyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.EotcxmtkUpBxwlXa3bo25iLAmRcT0kj1G3PVITVB_0ZtF8UC19rJIMTNSc1hYkl8cbfCuB_vkjYCAxi4b2SOru5MdMTRhgNjcQTVbiwIYww-QdUWq0WSv84nW_HaRoxCJ8ezm-wBZgUTpcD3VFuynUICbODKKHUfxVdKdVoAM6GGE6ymSbO7-0C7ZumoWEqaZ22BF4G1H-JvLkR-tL5iqXa2N-QCnNoteFmHstBfH6Sp5UZhPav1VBEGRmwdFfUnC-Xc-aNeIFwgWCXMsOXFWbbmWeh0uNF-Btu-QEJ7VkCu4pbElqHWJKBYLCx1zqDBrKrsrNxyvQlxsJ9NSOae8Q",
|
|
13
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { loadStripe } from "@stripe/stripe-js";
|
|
4
|
+
import { Elements } from "@stripe/react-stripe-js";
|
|
5
|
+
import { PaymentForm } from "./paymentForm";
|
|
6
|
+
import { Loading } from "../../atoms/Loading";
|
|
7
|
+
const stripeApiKey = loadStripe(`${process.env.REACT_APP_KEY_STRIPE}`);
|
|
8
|
+
|
|
9
|
+
export const StripeCardForm = ({
|
|
10
|
+
setToken,
|
|
11
|
+
setCard,
|
|
12
|
+
setStripe,
|
|
13
|
+
setModalErrorCard,
|
|
14
|
+
setMsj,
|
|
15
|
+
}) => {
|
|
16
|
+
const [stripeLoaded, setStripeLoaded] = useState(false);
|
|
17
|
+
|
|
18
|
+
const loadStripeJS = async () => {
|
|
19
|
+
await stripeApiKey;
|
|
20
|
+
setStripeLoaded(true);
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
loadStripeJS();
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return stripeLoaded ? (
|
|
27
|
+
<Container>
|
|
28
|
+
<Elements stripe={stripeApiKey}>
|
|
29
|
+
<PaymentForm
|
|
30
|
+
labelForm={"Pago con tarjeta"}
|
|
31
|
+
setToken={setToken}
|
|
32
|
+
setCard={setCard}
|
|
33
|
+
setStripe={setStripe}
|
|
34
|
+
setModalErrorCard={setModalErrorCard}
|
|
35
|
+
setMsj={setMsj}
|
|
36
|
+
/>
|
|
37
|
+
</Elements>
|
|
38
|
+
</Container>
|
|
39
|
+
) : (
|
|
40
|
+
<Loading />
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { PaymentFormContainer } from "./styles";
|
|
3
|
+
import {
|
|
4
|
+
useStripe,
|
|
5
|
+
useElements,
|
|
6
|
+
CardNumberElement,
|
|
7
|
+
CardExpiryElement,
|
|
8
|
+
CardCvcElement,
|
|
9
|
+
} from "@stripe/react-stripe-js";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
|
|
12
|
+
export const PaymentForm = ({
|
|
13
|
+
labelForm = "Pago con tarjeta",
|
|
14
|
+
setToken,
|
|
15
|
+
setCard,
|
|
16
|
+
setStripe,
|
|
17
|
+
setModalErrorCard,
|
|
18
|
+
setMsj,
|
|
19
|
+
}) => {
|
|
20
|
+
const stripe = useStripe();
|
|
21
|
+
const elements = useElements();
|
|
22
|
+
const [cardName, setCardName] = useState("");
|
|
23
|
+
const [valuesComplete, setValuesComplete] = useState({
|
|
24
|
+
name: false,
|
|
25
|
+
number: false,
|
|
26
|
+
cvc: false,
|
|
27
|
+
exp: false,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const handleIputChange = (event, key) => {
|
|
31
|
+
const temp = { ...valuesComplete };
|
|
32
|
+
if (key === "name") {
|
|
33
|
+
temp[key] = event?.length;
|
|
34
|
+
setValuesComplete(temp);
|
|
35
|
+
} else {
|
|
36
|
+
temp[key] = event.complete;
|
|
37
|
+
setValuesComplete(temp);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Este método crea un nuevo token que será enviado a la bd para generar una nueva tarjeta
|
|
43
|
+
*/
|
|
44
|
+
const createToken = async () => {
|
|
45
|
+
/* isNew values
|
|
46
|
+
1: is new
|
|
47
|
+
0: use card existing
|
|
48
|
+
-1: use other payment metoh */
|
|
49
|
+
let token = "";
|
|
50
|
+
token = await stripe.createToken(elements.getElement(CardNumberElement));
|
|
51
|
+
|
|
52
|
+
const { error, paymentMethod } = await stripe.createPaymentMethod({
|
|
53
|
+
type: "card",
|
|
54
|
+
card: elements.getElement(CardNumberElement),
|
|
55
|
+
billing_details: {
|
|
56
|
+
name: cardName,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
if (token.token) {
|
|
62
|
+
token = token.token.id;
|
|
63
|
+
} else {
|
|
64
|
+
setModalErrorCard && setModalErrorCard(true);
|
|
65
|
+
setMsj && setMsj(token.error.message);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
paymentMethod.isNew = 1;
|
|
69
|
+
setToken && setToken(token);
|
|
70
|
+
setCard && setCard(paymentMethod);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.log(err, error);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const valuesArray = Object.values(valuesComplete);
|
|
78
|
+
const allValuesComplete = valuesArray?.every((val) => val);
|
|
79
|
+
allValuesComplete ? createToken() : "le falta algo oiga";
|
|
80
|
+
setStripe && setStripe(stripe);
|
|
81
|
+
}, [valuesComplete]);
|
|
82
|
+
|
|
83
|
+
const handleCardNameChange = (event) => {
|
|
84
|
+
handleIputChange(event.target.value, "name");
|
|
85
|
+
setCardName(event.target.value);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<PaymentFormContainer>
|
|
90
|
+
<h2>{labelForm}</h2>
|
|
91
|
+
<div className="card-fields">
|
|
92
|
+
<div className="element card-name">
|
|
93
|
+
<label>Nombre en la tarjeta</label>
|
|
94
|
+
<input
|
|
95
|
+
className="card-input"
|
|
96
|
+
value={cardName}
|
|
97
|
+
onChange={handleCardNameChange}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
<div className="element card-number">
|
|
101
|
+
<label>No. de tarjeta</label>
|
|
102
|
+
<CardNumberElement
|
|
103
|
+
className="card-input"
|
|
104
|
+
onChange={(e) => handleIputChange(e, "number")}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
<div className="element expiration-date">
|
|
108
|
+
<label>Fecha de expiración</label>
|
|
109
|
+
<CardExpiryElement
|
|
110
|
+
className="card-input"
|
|
111
|
+
onChange={(e) => handleIputChange(e, "exp")}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
<div className="element cvc-code ">
|
|
115
|
+
<label>CVC</label>
|
|
116
|
+
<CardCvcElement
|
|
117
|
+
className="card-input"
|
|
118
|
+
onChange={(e) => handleIputChange(e, "cvc")}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</PaymentFormContainer>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div``;
|
|
5
|
+
|
|
6
|
+
export const PaymentFormContainer = styled.form`
|
|
7
|
+
padding: 20px;
|
|
8
|
+
border: 1px solid #f0f0f0;
|
|
9
|
+
border-radius: 10px;
|
|
10
|
+
|
|
11
|
+
h2 {
|
|
12
|
+
font-size: 15px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
color: #262626;
|
|
15
|
+
font-family: ${FontFamily.Lato};
|
|
16
|
+
|
|
17
|
+
& + * {
|
|
18
|
+
margin-top: 10px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.card-fields {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
gap: 10px;
|
|
26
|
+
.element {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
|
|
30
|
+
label {
|
|
31
|
+
color: #808080;
|
|
32
|
+
font-family: ${FontFamily.Lato};
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
display: flex;
|
|
35
|
+
|
|
36
|
+
& + * {
|
|
37
|
+
margin-left: 6px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card-input {
|
|
42
|
+
border: 1px solid #f0f0f0 !important;
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
padding: 3px;
|
|
45
|
+
font-family: ${FontFamily.Lato};
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
flex: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.card-name {
|
|
51
|
+
flex: 1 0 100%;
|
|
52
|
+
label + * {
|
|
53
|
+
margin-left: 6px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.card-number {
|
|
58
|
+
flex: 1 0 100%;
|
|
59
|
+
label + * {
|
|
60
|
+
margin-left: 43px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.expiration-date,
|
|
65
|
+
&.cvc-code {
|
|
66
|
+
flex: 1 1 49%;
|
|
67
|
+
label + * {
|
|
68
|
+
margin-left: 9px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CardSelector } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/CardSelector",
|
|
5
|
+
component: CardSelector,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <CardSelector {...args} />;
|
|
9
|
+
export const CardSelectorDefault = Template.bind({});
|
|
10
|
+
CardSelectorDefault.args = {
|
|
11
|
+
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dVoAM6GGE6ymSbO7-0C7ZumoWEqaZ22BF4G1H-JvLkR-tL5iqXa2N-QCnNoteFmHstBfH6Sp5UZhPav1VBEGRmwdFfUnC-Xc-aNeIFwgWCXMsOXFWbbmWeh0uNF-Btu-QEJ7VkCu4pbElqHWJKBYLCx1zqDBrKrsrNxyvQlxsJ9NSOae8Q",
|
|
12
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { Container } from "./styles";
|
|
3
|
+
import { loadStripe } from "@stripe/stripe-js";
|
|
4
|
+
import { Elements } from "@stripe/react-stripe-js";
|
|
5
|
+
import { getAllCards } from "./utils";
|
|
6
|
+
import { Card } from "../../atoms/Card";
|
|
7
|
+
import { Loading } from "../../atoms/Loading";
|
|
8
|
+
const stripeApiKey = loadStripe(`${process.env.REACT_APP_KEY_STRIPE}`);
|
|
9
|
+
|
|
10
|
+
export const CardSelector = ({ jwt, setCard, setStripe }) => {
|
|
11
|
+
const [stripeLoaded, setStripeLoaded] = useState(false);
|
|
12
|
+
const [cards, setCards] = useState([]);
|
|
13
|
+
const [selectedCard, setSelectedCard] = useState("");
|
|
14
|
+
|
|
15
|
+
const loadStripeJS = async () => {
|
|
16
|
+
await stripeApiKey;
|
|
17
|
+
setStripeLoaded(true);
|
|
18
|
+
const cardsResponse = await getAllCards(jwt);
|
|
19
|
+
setCards(cardsResponse);
|
|
20
|
+
};
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
loadStripeJS();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return stripeLoaded ? (
|
|
26
|
+
<Container>
|
|
27
|
+
<h2>Tarjetas guardadas</h2>
|
|
28
|
+
<Elements stripe={stripeApiKey}>
|
|
29
|
+
{cards.map((card) => (
|
|
30
|
+
<Card
|
|
31
|
+
key={card.id}
|
|
32
|
+
card={card}
|
|
33
|
+
selectedCard={selectedCard}
|
|
34
|
+
setSelectedCard={setSelectedCard}
|
|
35
|
+
setCard={setCard}
|
|
36
|
+
setStripe={setStripe}
|
|
37
|
+
/>
|
|
38
|
+
))}
|
|
39
|
+
</Elements>
|
|
40
|
+
</Container>
|
|
41
|
+
) : (
|
|
42
|
+
<Loading />
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export const getAllCards = async (jwt) => {
|
|
4
|
+
try {
|
|
5
|
+
const response = await axios({
|
|
6
|
+
method: "get",
|
|
7
|
+
url: `${process.env.REACT_APP_CARDS_ENDPOINT}`,
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: jwt,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const stripeCards = JSON.parse(response.data.body).data;
|
|
13
|
+
return stripeCards;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.log(error);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -36,14 +36,16 @@ export const TagAndInput = ({
|
|
|
36
36
|
className={"input-container"}
|
|
37
37
|
key={`generalTagInput-${inputType}`}
|
|
38
38
|
>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
{label?.length && (
|
|
40
|
+
<div className="title-container">
|
|
41
|
+
<ScreenHeader
|
|
42
|
+
text={label}
|
|
43
|
+
headerType={"input-name-header"}
|
|
44
|
+
color={color}
|
|
45
|
+
/>
|
|
46
|
+
{showTooltip && <span className="tooltip">{label}</span>}
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
47
49
|
<GeneralInput
|
|
48
50
|
inputId={inputId}
|
|
49
51
|
inputType={inputType}
|
|
@@ -148,17 +148,37 @@ chatTicket_userTECH.args = {
|
|
|
148
148
|
chatType: "ticket",
|
|
149
149
|
chatContainerType: "fixed",
|
|
150
150
|
chatData: {
|
|
151
|
-
id:
|
|
152
|
-
ticketOwnerUserId:
|
|
153
|
-
|
|
154
|
-
statusTicket: "PENDING",
|
|
151
|
+
id: 171,
|
|
152
|
+
ticketOwnerUserId: 52,
|
|
153
|
+
statusTicket: "IN_PROGRESS",
|
|
155
154
|
currentUser: {
|
|
156
155
|
token:
|
|
157
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
158
|
-
id:
|
|
159
|
-
companyId:
|
|
156
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI3M2NjOGQ0MC1jODQxLTQyMmEtYTJmMi1lNjlkN2ZlMjZlYmYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjczY2M4ZDQwLWM4NDEtNDIyYS1hMmYyLWU2OWQ3ZmUyNmViZiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIwYWNiYTdlYy01OGJhLTQyNGYtOTM5OC02ZGMxOGI1YTRkODYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4ODk0MzcxNywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4ODk0NzMxNywiaWF0IjoxNjg4OTQzNzE3LCJlbWFpbCI6Im9hcmVuYXNAY29udGVudG9oLmNvbSJ9.SHeA5EMqLdqlTuDBTpJ3l_lAAqjMlOT2Dm9U9yf-Y3-4FR-3cwQ_16sdsmGCjJpwkhdYBEyuQbFkY1xnQHOBLMow0izWD4CDlhlNXkWBE_3DjgCspyPMlz31Lfik2ddnkHp3HQeLwucC4uyum3N-roQA7HkuWQHSBIplp6b-Xd44OmN9X-V_kseN3QOX6o7kxNFjwZL_DUzTJUdMDOtIXXIKYO2FLkR1eWJDNdvee5FEIWAxJXfaSZ__Awawfi5k93ILXrPX7QVt78lOH3THMyiPTtfiOOwMhoSQz_k5DIuofE8FM_1-nLNajM18pI49wPQ_-k3ltCjChjqy-OlERQ",
|
|
157
|
+
id: 65,
|
|
158
|
+
companyId: 2,
|
|
160
159
|
isUserTech: true,
|
|
161
160
|
},
|
|
162
161
|
},
|
|
163
162
|
classNameContainerFixed: "chatTicket",
|
|
164
163
|
};
|
|
164
|
+
|
|
165
|
+
// ejemplo del chat para los cambios de status del producto.
|
|
166
|
+
export const chatProduct_status = Template.bind({});
|
|
167
|
+
chatProduct_status.args = {
|
|
168
|
+
chatType: "product_status",
|
|
169
|
+
chatContainerType: "popUp",
|
|
170
|
+
chatData: {
|
|
171
|
+
id: 37414,
|
|
172
|
+
version: 7,
|
|
173
|
+
retailerId: 70,
|
|
174
|
+
status: "AA",
|
|
175
|
+
orderId: 15189,
|
|
176
|
+
userToken:
|
|
177
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZS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|
|
@@ -22,6 +22,7 @@ import { Tooltip } from "../../../atoms/Tooltip";
|
|
|
22
22
|
import { Slide, Zoom } from "@mui/material";
|
|
23
23
|
import { useRef } from "react";
|
|
24
24
|
import { ImagePreview } from "../../../atoms/ImagePreview";
|
|
25
|
+
import { Status } from "../../../atoms/Status";
|
|
25
26
|
import { isUserTech } from "../../../../global-files/handle_userTech";
|
|
26
27
|
import { container } from "aws-amplify";
|
|
27
28
|
|
|
@@ -55,7 +56,10 @@ export const ContainerItems = (props) => {
|
|
|
55
56
|
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
if (!items) return;
|
|
58
|
-
if (
|
|
59
|
+
if (
|
|
60
|
+
["merchant_product", "order_product", "product_status"].includes(chatType)
|
|
61
|
+
)
|
|
62
|
+
renderItems();
|
|
59
63
|
else if (chatType === "ticket") renderItemsTicket();
|
|
60
64
|
else setCustomItems([]);
|
|
61
65
|
}, [items]);
|
|
@@ -130,6 +134,16 @@ export const ContainerItems = (props) => {
|
|
|
130
134
|
return <label className="item-statusTicket">{item.value}</label>;
|
|
131
135
|
};
|
|
132
136
|
|
|
137
|
+
const renderStatusItem = (item) => {
|
|
138
|
+
const splitText = item.value.split("|");
|
|
139
|
+
let message = [];
|
|
140
|
+
splitText.forEach((text, i) => {
|
|
141
|
+
if (i === 1 || i === 3) message.push(<Status statusType={text} />);
|
|
142
|
+
else message.push(text);
|
|
143
|
+
});
|
|
144
|
+
return <label className="item-statusItem">{message}</label>;
|
|
145
|
+
};
|
|
146
|
+
|
|
133
147
|
const renderStatusTicketNeutral = (item) => {
|
|
134
148
|
return (
|
|
135
149
|
<Tooltip
|
|
@@ -304,7 +318,7 @@ export const ContainerItems = (props) => {
|
|
|
304
318
|
>
|
|
305
319
|
<li
|
|
306
320
|
className={
|
|
307
|
-
(ownMessage ? "own-message " : "") +
|
|
321
|
+
(ownMessage && item.type !== "status" ? "own-message " : "") +
|
|
308
322
|
(lastUserId === item.userId ? "sameUser" : "")
|
|
309
323
|
}
|
|
310
324
|
>
|
|
@@ -339,6 +353,8 @@ export const ContainerItems = (props) => {
|
|
|
339
353
|
? renderComment(item)
|
|
340
354
|
: item.type === "img"
|
|
341
355
|
? renderImg(item)
|
|
356
|
+
: item.type === "status"
|
|
357
|
+
? renderStatusItem(item)
|
|
342
358
|
: item.type === "file"
|
|
343
359
|
? renderFile(item, ownMessage)
|
|
344
360
|
: item.type === "statusTicket" &&
|
|
@@ -158,7 +158,8 @@ export const Container = styled.div`
|
|
|
158
158
|
.item-message,
|
|
159
159
|
.item-comment,
|
|
160
160
|
.item-file,
|
|
161
|
-
.item-statusTicket
|
|
161
|
+
.item-statusTicket,
|
|
162
|
+
.item-statusItem {
|
|
162
163
|
border-radius: 10px;
|
|
163
164
|
padding: 10px;
|
|
164
165
|
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
@@ -173,10 +174,17 @@ export const Container = styled.div`
|
|
|
173
174
|
.item-file {
|
|
174
175
|
background-color: #8386ee;
|
|
175
176
|
}
|
|
176
|
-
.item-statusTicket
|
|
177
|
+
.item-statusTicket,
|
|
178
|
+
.item-statusItem {
|
|
177
179
|
background-color: #85bc5b;
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
.item-statusItem {
|
|
183
|
+
display: flex;
|
|
184
|
+
gap: 3px;
|
|
185
|
+
align-items: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
180
188
|
.item-message {
|
|
181
189
|
&.different-company {
|
|
182
190
|
border: 1px solid #e33aa9;
|