@springmicro/cart 0.5.14 → 0.5.16
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/.eslintrc.cjs +21 -21
- package/README.md +64 -64
- package/dist/index.js +1004 -990
- package/dist/index.umd.cjs +42 -42
- package/package.json +3 -3
- package/src/AddToCartForm.tsx +16 -16
- package/src/CartButton.tsx +15 -7
- package/src/ProductCard.css +106 -106
- package/src/ProductCard.tsx +0 -0
- package/src/checkout/ReviewCartAndCalculateTaxes.css +93 -93
- package/src/checkout/ReviewCartAndCalculateTaxes.tsx +18 -16
- package/src/checkout/components/AddCard.tsx +128 -107
- package/src/checkout/components/Address.tsx +0 -0
- package/src/checkout/components/CartList.tsx +1 -0
- package/src/checkout/components/CartProductCard.css +67 -67
- package/src/checkout/components/CartProductCard.tsx +0 -0
- package/src/checkout/components/Invoice.tsx +145 -145
- package/src/checkout/components/ProviderLogos.tsx +93 -93
- package/src/checkout/components/StatusBar.tsx +0 -0
- package/src/checkout/index.tsx +1 -1
- package/src/index.css +5 -5
- package/src/index.ts +0 -0
- package/src/types.d.ts +56 -56
- package/src/utils/api.ts +67 -67
- package/src/utils/cartAuthHandler.ts +50 -50
- package/src/utils/index.ts +0 -0
- package/src/utils/storage.ts +0 -0
- package/tsconfig.json +24 -24
- package/tsconfig.node.json +11 -11
- package/vite.config.ts +25 -25
- package/springmicro-cart-0.3.4.tgz +0 -0
|
@@ -55,6 +55,7 @@ export type AddCardProps = {
|
|
|
55
55
|
};
|
|
56
56
|
stacked?: boolean;
|
|
57
57
|
error?: string;
|
|
58
|
+
cardRequired?: boolean;
|
|
58
59
|
address?: boolean;
|
|
59
60
|
onSubmit?: (
|
|
60
61
|
values: CreditCardValues & Partial<AddressValues>
|
|
@@ -71,6 +72,7 @@ export type AddCardProps = {
|
|
|
71
72
|
|
|
72
73
|
export const AddCard = ({
|
|
73
74
|
contact,
|
|
75
|
+
cardRequired = true,
|
|
74
76
|
error,
|
|
75
77
|
stacked = false,
|
|
76
78
|
address = true,
|
|
@@ -102,33 +104,37 @@ export const AddCard = ({
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<div>
|
|
111
|
-
<TextField
|
|
112
|
-
sx={stacked ? { mt: 2 } : {}}
|
|
113
|
-
fullWidth
|
|
114
|
-
type="tel"
|
|
115
|
-
name="number"
|
|
116
|
-
label="Card Number"
|
|
117
|
-
required
|
|
118
|
-
onBlur={formik.handleBlur}
|
|
119
|
-
onChange={handleInputChange}
|
|
120
|
-
onFocus={handleInputFocus}
|
|
121
|
-
variant="outlined"
|
|
122
|
-
value={formik.values.number}
|
|
123
|
-
error={Boolean(formik.touched.number && formik.errors.number)}
|
|
124
|
-
helperText={formik.touched.number && formik.errors.number}
|
|
107
|
+
{cardRequired && (
|
|
108
|
+
<Cards
|
|
109
|
+
{...(formik.values as CreditCardValues)}
|
|
110
|
+
focused={formik.values.focus || "number"}
|
|
125
111
|
/>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
<Box sx={{ flexGrow: cardRequired ? undefined : 1 }}>
|
|
115
|
+
{cardRequired && (
|
|
116
|
+
<TextField
|
|
117
|
+
sx={stacked ? { mt: 2 } : {}}
|
|
118
|
+
fullWidth
|
|
119
|
+
type="tel"
|
|
120
|
+
name="number"
|
|
121
|
+
label="Card Number"
|
|
122
|
+
required
|
|
123
|
+
onBlur={formik.handleBlur}
|
|
124
|
+
onChange={handleInputChange}
|
|
125
|
+
onFocus={handleInputFocus}
|
|
126
|
+
variant="outlined"
|
|
127
|
+
value={formik.values.number}
|
|
128
|
+
error={Boolean(formik.touched.number && formik.errors.number)}
|
|
129
|
+
helperText={formik.touched.number && formik.errors.number}
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
126
132
|
<TextField
|
|
127
133
|
sx={{ mt: 2 }}
|
|
128
134
|
fullWidth
|
|
129
135
|
type="text"
|
|
130
136
|
name="name"
|
|
131
|
-
label="Name on Card"
|
|
137
|
+
label={cardRequired ? "Name on Card" : "Name"}
|
|
132
138
|
required
|
|
133
139
|
onBlur={formik.handleBlur}
|
|
134
140
|
onChange={handleInputChange}
|
|
@@ -138,104 +144,119 @@ export const AddCard = ({
|
|
|
138
144
|
error={Boolean(formik.touched.name && formik.errors.name)}
|
|
139
145
|
helperText={formik.touched.name && formik.errors.name}
|
|
140
146
|
/>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
147
|
+
{cardRequired && (
|
|
148
|
+
<>
|
|
149
|
+
<TextField
|
|
150
|
+
sx={{ mt: 2, width: "calc(50% - 8px)", mr: 1 }}
|
|
151
|
+
type="tel"
|
|
152
|
+
name="expiry"
|
|
153
|
+
label="Valid Thru"
|
|
154
|
+
placeholder="MM/YY"
|
|
155
|
+
inputProps={{ pattern: "[0-9]{2}/[0-9]{2}" }}
|
|
156
|
+
required
|
|
157
|
+
onBlur={formik.handleBlur}
|
|
158
|
+
onChange={handleInputChange}
|
|
159
|
+
onFocus={handleInputFocus}
|
|
160
|
+
variant="outlined"
|
|
161
|
+
value={formik.values.expiry}
|
|
162
|
+
error={Boolean(formik.touched.expiry && formik.errors.expiry)}
|
|
163
|
+
helperText={
|
|
164
|
+
(formik.touched.expiry && formik.errors.expiry) || "MM/YY"
|
|
165
|
+
}
|
|
166
|
+
/>
|
|
167
|
+
<TextField
|
|
168
|
+
sx={{ mt: 2, width: "calc(50% - 8px)", ml: 1 }}
|
|
169
|
+
type="tel"
|
|
170
|
+
name="cvc"
|
|
171
|
+
label="CVC"
|
|
172
|
+
required
|
|
173
|
+
onBlur={formik.handleBlur}
|
|
174
|
+
onChange={handleInputChange}
|
|
175
|
+
onFocus={handleInputFocus}
|
|
176
|
+
variant="outlined"
|
|
177
|
+
value={formik.values.cvc}
|
|
178
|
+
error={Boolean(formik.touched.cvc && formik.errors.cvc)}
|
|
179
|
+
helperText={formik.touched.cvc && formik.errors.cvc}
|
|
180
|
+
/>
|
|
181
|
+
</>
|
|
182
|
+
)}
|
|
183
|
+
</Box>
|
|
174
184
|
{/* {formik.errors.submit && (
|
|
175
185
|
<Typography color="error" sx={{ mt: 2 }} variant="body2">
|
|
176
186
|
{formik.errors.submit}
|
|
177
187
|
</Typography>
|
|
178
188
|
)} */}
|
|
179
189
|
</Box>
|
|
180
|
-
|
|
181
|
-
sx={{ display: "flex", flexDirection: "row", gap: 2, width: "100%" }}
|
|
182
|
-
>
|
|
183
|
-
<Box sx={{ flexGrow: 1 }}>
|
|
184
|
-
{!address ? null : (
|
|
185
|
-
<Box>
|
|
186
|
-
<Typography variant="h6" sx={{ mt: 2, mb: 3 }}>
|
|
187
|
-
Billing Address
|
|
188
|
-
</Typography>
|
|
189
|
-
<AddressCountryField formik={formik} name="country" />
|
|
190
|
-
<AddressEmailField
|
|
191
|
-
formik={formik}
|
|
192
|
-
name="email"
|
|
193
|
-
sx={{ mt: 2 }}
|
|
194
|
-
/>
|
|
195
|
-
<AddressOrganizationNameField
|
|
196
|
-
sx={{ mt: 2 }}
|
|
197
|
-
formik={formik}
|
|
198
|
-
name="organization"
|
|
199
|
-
/>
|
|
200
|
-
<AddressStreetField
|
|
201
|
-
sx={{ mt: 2 }}
|
|
202
|
-
formik={formik}
|
|
203
|
-
name="line1"
|
|
204
|
-
lineNo="1"
|
|
205
|
-
/>
|
|
206
|
-
<AddressStreetField
|
|
207
|
-
sx={{ mt: 2 }}
|
|
208
|
-
formik={formik}
|
|
209
|
-
name="line2"
|
|
210
|
-
lineNo="2"
|
|
211
|
-
required={false}
|
|
212
|
-
/>
|
|
213
|
-
<AddressCityField sx={{ mt: 2 }} formik={formik} name="city" />
|
|
214
|
-
<AddressRegionField
|
|
215
|
-
sx={{ mt: 2 }}
|
|
216
|
-
formik={formik}
|
|
217
|
-
name="region"
|
|
218
|
-
/>
|
|
219
|
-
<AddressPostalCodeField
|
|
220
|
-
sx={{ mt: 2 }}
|
|
221
|
-
formik={formik}
|
|
222
|
-
name="postal_code"
|
|
223
|
-
/>
|
|
224
|
-
</Box>
|
|
225
|
-
)}
|
|
226
|
-
</Box>
|
|
190
|
+
{cardRequired && (
|
|
227
191
|
<Box
|
|
228
192
|
sx={{
|
|
229
|
-
mt: "16px",
|
|
230
193
|
display: "flex",
|
|
231
|
-
flexDirection: "
|
|
232
|
-
|
|
233
|
-
|
|
194
|
+
flexDirection: "row",
|
|
195
|
+
gap: 2,
|
|
196
|
+
width: "100%",
|
|
234
197
|
}}
|
|
235
198
|
>
|
|
236
|
-
{
|
|
199
|
+
<Box sx={{ flexGrow: 1 }}>
|
|
200
|
+
{!address ? null : (
|
|
201
|
+
<Box>
|
|
202
|
+
<Typography variant="h6" sx={{ mt: 2, mb: 3 }}>
|
|
203
|
+
Billing Address
|
|
204
|
+
</Typography>
|
|
205
|
+
<AddressCountryField formik={formik} name="country" />
|
|
206
|
+
<AddressEmailField
|
|
207
|
+
formik={formik}
|
|
208
|
+
name="email"
|
|
209
|
+
sx={{ mt: 2 }}
|
|
210
|
+
/>
|
|
211
|
+
<AddressOrganizationNameField
|
|
212
|
+
sx={{ mt: 2 }}
|
|
213
|
+
formik={formik}
|
|
214
|
+
name="organization"
|
|
215
|
+
/>
|
|
216
|
+
<AddressStreetField
|
|
217
|
+
sx={{ mt: 2 }}
|
|
218
|
+
formik={formik}
|
|
219
|
+
name="line1"
|
|
220
|
+
lineNo="1"
|
|
221
|
+
/>
|
|
222
|
+
<AddressStreetField
|
|
223
|
+
sx={{ mt: 2 }}
|
|
224
|
+
formik={formik}
|
|
225
|
+
name="line2"
|
|
226
|
+
lineNo="2"
|
|
227
|
+
required={false}
|
|
228
|
+
/>
|
|
229
|
+
<AddressCityField
|
|
230
|
+
sx={{ mt: 2 }}
|
|
231
|
+
formik={formik}
|
|
232
|
+
name="city"
|
|
233
|
+
/>
|
|
234
|
+
<AddressRegionField
|
|
235
|
+
sx={{ mt: 2 }}
|
|
236
|
+
formik={formik}
|
|
237
|
+
name="region"
|
|
238
|
+
/>
|
|
239
|
+
<AddressPostalCodeField
|
|
240
|
+
sx={{ mt: 2 }}
|
|
241
|
+
formik={formik}
|
|
242
|
+
name="postal_code"
|
|
243
|
+
/>
|
|
244
|
+
</Box>
|
|
245
|
+
)}
|
|
246
|
+
</Box>
|
|
247
|
+
<Box
|
|
248
|
+
sx={{
|
|
249
|
+
mt: "16px",
|
|
250
|
+
display: "flex",
|
|
251
|
+
flexDirection: "column",
|
|
252
|
+
alignItems: "flex-end",
|
|
253
|
+
flexGrow: 1,
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
{PriceDetails}
|
|
257
|
+
</Box>
|
|
237
258
|
</Box>
|
|
238
|
-
|
|
259
|
+
)}
|
|
239
260
|
{error && (
|
|
240
261
|
<Typography color="error" sx={{ mt: 2 }} variant="body2">
|
|
241
262
|
{error}
|
|
File without changes
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
.product-card {
|
|
2
|
-
width: 500px;
|
|
3
|
-
/* display: flex;
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
justify-content: space-between; */
|
|
6
|
-
display: grid;
|
|
7
|
-
grid-template-columns: 1fr 40px;
|
|
8
|
-
gap: 0.5rem;
|
|
9
|
-
border-radius: 8px;
|
|
10
|
-
padding: 1rem;
|
|
11
|
-
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0);
|
|
12
|
-
transition: all 0.3s 0.1s;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
min-height: 48px;
|
|
15
|
-
flex-shrink: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.product-card:hover {
|
|
19
|
-
box-shadow: 0px 2px 5px 2px #dfdfdfff;
|
|
20
|
-
transition: all 0.3s 0s;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.left-section {
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: row;
|
|
26
|
-
gap: 1rem;
|
|
27
|
-
flex-grow: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.left-section > img,
|
|
31
|
-
.missing-image {
|
|
32
|
-
min-height: 100%;
|
|
33
|
-
max-height: 100px;
|
|
34
|
-
aspect-ratio: 1;
|
|
35
|
-
border-radius: 6px;
|
|
36
|
-
overflow: hidden;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.missing-image {
|
|
40
|
-
background-color: rgb(222, 222, 222);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.two-row {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.two-row :nth-child(1) {
|
|
49
|
-
font-size: 20px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.two-row :nth-child(2) {
|
|
53
|
-
font-size: 14px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.two-row > * {
|
|
57
|
-
margin: 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.remove-button {
|
|
61
|
-
color: #ff000040 !important;
|
|
62
|
-
transition: all 0.2s !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.product-card:hover .remove-button {
|
|
66
|
-
color: red !important;
|
|
67
|
-
}
|
|
1
|
+
.product-card {
|
|
2
|
+
width: 500px;
|
|
3
|
+
/* display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: space-between; */
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 1fr 40px;
|
|
8
|
+
gap: 0.5rem;
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0);
|
|
12
|
+
transition: all 0.3s 0.1s;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
min-height: 48px;
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.product-card:hover {
|
|
19
|
+
box-shadow: 0px 2px 5px 2px #dfdfdfff;
|
|
20
|
+
transition: all 0.3s 0s;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.left-section {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
gap: 1rem;
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.left-section > img,
|
|
31
|
+
.missing-image {
|
|
32
|
+
min-height: 100%;
|
|
33
|
+
max-height: 100px;
|
|
34
|
+
aspect-ratio: 1;
|
|
35
|
+
border-radius: 6px;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.missing-image {
|
|
40
|
+
background-color: rgb(222, 222, 222);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.two-row {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.two-row :nth-child(1) {
|
|
49
|
+
font-size: 20px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.two-row :nth-child(2) {
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.two-row > * {
|
|
57
|
+
margin: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.remove-button {
|
|
61
|
+
color: #ff000040 !important;
|
|
62
|
+
transition: all 0.2s !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.product-card:hover .remove-button {
|
|
66
|
+
color: red !important;
|
|
67
|
+
}
|
|
File without changes
|