@ikas/storefront 4.0.0-alpha.49 → 4.0.0-alpha.5
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/package.json +13 -13
- package/src/analytics/analytics.ts +1 -2
- package/src/analytics/googleUniversal.ts +2 -12
- package/src/analytics/head/index.tsx +2 -1
- package/src/analytics/ikas.ts +7 -25
- package/src/components/checkout/components/address-form/index.tsx +1 -1
- package/src/components/checkout/components/address-form/model.ts +0 -1
- package/src/components/checkout/components/button/style.module.scss +2 -2
- package/src/components/checkout/components/cart-summary/cart-item/index.tsx +29 -16
- package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +23 -60
- package/src/components/checkout/components/cart-summary/index.tsx +27 -58
- package/src/components/checkout/components/cart-summary/style.module.scss +3 -48
- package/src/components/checkout/components/customer-addresses/index.tsx +2 -7
- package/src/components/checkout/components/customer-addresses/model.ts +8 -16
- package/src/components/checkout/components/error/index.tsx +1 -1
- package/src/components/checkout/components/error/unknown-error/index.tsx +2 -4
- package/src/components/checkout/components/form-item/index.tsx +11 -9
- package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +0 -2
- package/src/components/checkout/components/offer-product/index.tsx +19 -16
- package/src/components/checkout/components/offer-product/style.module.scss +3 -1
- package/src/components/checkout/components/phone-number-input/get-countries.ts +5 -37
- package/src/components/checkout/components/phone-number-input/index.tsx +10 -15
- package/src/components/checkout/components/phone-number-input/locale/en.ts +257 -0
- package/src/components/checkout/index.tsx +19 -28
- package/src/components/checkout/model.ts +91 -214
- package/src/components/checkout/modelMasterPass.ts +2 -2
- package/src/components/checkout/steps/step-info/index.tsx +3 -9
- package/src/components/checkout/steps/step-payment/billing-address/index.tsx +1 -1
- package/src/components/checkout/steps/step-payment/index.tsx +2 -11
- package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +3 -12
- package/src/components/checkout/steps/step-payment/payment-gateways/installments/index.tsx +3 -5
- package/src/components/checkout/steps/step-payment/style.module.scss +0 -5
- package/src/components/checkout/steps/step-shipping/index.tsx +4 -9
- package/src/components/checkout/steps/step-success/index.tsx +7 -15
- package/src/components/page/head.tsx +0 -12
- package/src/components/page/index.tsx +9 -10
- package/src/components/page-editor/ThemeComponentEditor.tsx +8 -19
- package/src/components/page-editor/model.ts +107 -44
- package/src/models/data/cart/campaign-offer/index.ts +2 -13
- package/src/models/data/cart/index.ts +1 -1
- package/src/models/data/category/init.ts +33 -0
- package/src/models/data/category/path-item/index.ts +0 -4
- package/src/models/data/checkout/index.ts +4 -36
- package/src/models/data/checkout-settings/price/index.ts +0 -2
- package/src/models/data/country/index.ts +0 -4
- package/src/models/data/index.ts +0 -3
- package/src/models/data/merchant-settings/index.ts +0 -9
- package/src/models/data/order/index.ts +32 -51
- package/src/models/data/order/line-item/index.ts +18 -76
- package/src/models/data/order/line-item/variant/index.ts +0 -8
- package/src/models/data/order/line-item/variant/price/index.ts +0 -2
- package/src/models/data/order/line-item/variant/value/index.ts +1 -1
- package/src/models/data/order/transaction/index.ts +5 -2
- package/src/models/data/product/attribute-value/index.ts +0 -40
- package/src/models/data/product/filter/index.ts +13 -4
- package/src/models/data/product/index.ts +7 -45
- package/src/models/data/product/option-set/index.ts +3 -8
- package/src/models/data/product/option-set/option/index.ts +13 -36
- package/src/models/data/product/variant/index.ts +1 -26
- package/src/models/data/product/variant/price/index.ts +9 -25
- package/src/models/data/product/variant-type/index.ts +0 -2
- package/src/models/data/raffle/index.ts +7 -9
- package/src/models/data/state/index.ts +2 -6
- package/src/models/data/storefront/index.ts +0 -2
- package/src/models/data/storefront/routing/index.tsx +0 -4
- package/src/models/ui/product-list/index.ts +17 -26
- package/src/models/ui/raffle-list/index.ts +1 -1
- package/src/models/ui/validator/form/raffle-form.ts +3 -16
- package/src/models/ui/validator/rules/index.ts +13 -14
- package/src/page-data-init/index.ts +404 -159
- package/src/pages/checkout.tsx +1 -2
- package/src/pages/editor.tsx +2 -5
- package/src/store/base.ts +2 -2
- package/src/store/cart/index.ts +2 -2
- package/src/store/customer/index.ts +17 -7
- package/src/store/index.ts +0 -2
- package/src/store/raffle/index.ts +10 -7
- package/src/utils/constants.ts +1 -1
- package/src/utils/currency.ts +183 -9
- package/src/models/data/country/location-translations/index.ts +0 -15
- package/src/models/data/order/line-item/base-unit/index.ts +0 -22
- package/src/models/data/order/line-item/base-unit/unit-type/index.ts +0 -14
- package/src/models/data/order/line-item/variant/unit/index.ts +0 -17
- package/src/models/data/product/base-unit/index.ts +0 -32
- package/src/models/data/product/variant/unit/index.ts +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"libphonenumber-js": "^1.10.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
28
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
29
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
30
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
31
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
27
|
+
"@ikas/storefront-api": "^4.0.0-alpha.5",
|
|
28
|
+
"@ikas/storefront-config": "^4.0.0-alpha.5",
|
|
29
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.5",
|
|
30
|
+
"@ikas/storefront-models": "^4.0.0-alpha.5",
|
|
31
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.5",
|
|
32
32
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
33
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
34
34
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
35
35
|
"@types/react-phone-number-input": "^3.0.10",
|
|
36
36
|
"mobx": "^6.1.3",
|
|
37
37
|
"mobx-react-lite": "^3.1.5",
|
|
38
|
-
"next": "
|
|
38
|
+
"next": "canary",
|
|
39
39
|
"prettier": "^2.2.1",
|
|
40
40
|
"react": "17.0.2",
|
|
41
41
|
"react-dom": "17.0.2",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"html-react-parser": "^1.4.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
56
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
57
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
58
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
59
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
55
|
+
"@ikas/storefront-api": "^4.0.0-alpha.5",
|
|
56
|
+
"@ikas/storefront-config": "^4.0.0-alpha.5",
|
|
57
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.5",
|
|
58
|
+
"@ikas/storefront-models": "^4.0.0-alpha.5",
|
|
59
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.5",
|
|
60
60
|
"mobx": "^6.1.3",
|
|
61
61
|
"mobx-react-lite": "^3.1.5",
|
|
62
|
-
"next": "
|
|
62
|
+
"next": "canary",
|
|
63
63
|
"react": "17.0.2",
|
|
64
64
|
"react-dom": "17.0.2",
|
|
65
65
|
"lodash": "^4.17.20",
|
|
@@ -54,7 +54,6 @@ export class Analytics {
|
|
|
54
54
|
const customerInfo = await Analytics.getCustomerInfo();
|
|
55
55
|
|
|
56
56
|
GoogleTagManager.pageView(url);
|
|
57
|
-
GoogleUniversal.pageView(window.location.pathname);
|
|
58
57
|
IkasAnalytics.pageView(pageType);
|
|
59
58
|
|
|
60
59
|
tryForEach(Analytics.subscribers, (s) => {
|
|
@@ -195,7 +194,7 @@ export class Analytics {
|
|
|
195
194
|
try {
|
|
196
195
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
197
196
|
|
|
198
|
-
FacebookPixel.purchase(checkout,
|
|
197
|
+
FacebookPixel.purchase(checkout, checkout.orderNumber || "");
|
|
199
198
|
GoogleTagManager.purchase(checkout, checkout.orderNumber || "");
|
|
200
199
|
IkasAnalytics.orderSuccess(checkout);
|
|
201
200
|
GoogleAnalytics.purchase(checkout, checkout.orderNumber || "");
|
|
@@ -8,23 +8,12 @@ export class GoogleUniversal {
|
|
|
8
8
|
makeAutoObservable(this);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
static pageView(url: string) {
|
|
12
|
-
try {
|
|
13
|
-
if (!isServer && (window as any).ga) {
|
|
14
|
-
(window as any).ga("set", "page", url);
|
|
15
|
-
(window as any).ga("send", "pageview");
|
|
16
|
-
}
|
|
17
|
-
return;
|
|
18
|
-
} catch (err) {
|
|
19
|
-
console.error(err);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
static productView(productDetail: IkasProduct) {
|
|
24
12
|
try {
|
|
25
13
|
if (!isServer && (window as any).ga) {
|
|
26
14
|
(window as any).ga("ec:addProduct", productToGUItem(productDetail));
|
|
27
15
|
(window as any).ga("ec:setAction", "detail");
|
|
16
|
+
(window as any).ga("send", "pageview");
|
|
28
17
|
}
|
|
29
18
|
return;
|
|
30
19
|
} catch (err) {
|
|
@@ -90,6 +79,7 @@ export class GoogleUniversal {
|
|
|
90
79
|
shipping: "" + checkout.shippingTotal,
|
|
91
80
|
coupon: checkout.couponCode,
|
|
92
81
|
});
|
|
82
|
+
(window as any).ga("send", "pageview");
|
|
93
83
|
}
|
|
94
84
|
return;
|
|
95
85
|
} catch (err) {
|
|
@@ -79,7 +79,8 @@ export const AnalyticsHead: React.FC<HeadProps> = observer(({ blockHTML }) => {
|
|
|
79
79
|
dangerouslySetInnerHTML={{
|
|
80
80
|
__html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
81
81
|
ga('create', '${universalAnalyticsId}', 'auto');
|
|
82
|
-
ga('require', 'ec')
|
|
82
|
+
ga('require', 'ec');
|
|
83
|
+
ga('send', 'pageview');`,
|
|
83
84
|
}}
|
|
84
85
|
/>
|
|
85
86
|
<script
|
package/src/analytics/ikas.ts
CHANGED
|
@@ -144,18 +144,10 @@ export default class IkasAnalytics {
|
|
|
144
144
|
static sessionId?: string | null;
|
|
145
145
|
static visitorId?: string | null;
|
|
146
146
|
|
|
147
|
-
static async createUUID() {
|
|
148
|
-
const response = await fetch(
|
|
149
|
-
`${process.env.NEXT_PUBLIC_BASE_URL}/generate-id/1`
|
|
150
|
-
);
|
|
151
|
-
const responseJson = await response.json();
|
|
152
|
-
return responseJson.data[0] as string;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
147
|
static async createSessionId() {
|
|
156
148
|
try {
|
|
157
149
|
const idWithExpiry: IdWithExpiry = {
|
|
158
|
-
id:
|
|
150
|
+
id: Date.now() + "",
|
|
159
151
|
expiry: Date.now() + this.EXPIRY_LENGTH,
|
|
160
152
|
};
|
|
161
153
|
|
|
@@ -175,8 +167,7 @@ export default class IkasAnalytics {
|
|
|
175
167
|
if (existingSessionIdData) {
|
|
176
168
|
const idWithExpiry = JSON.parse(existingSessionIdData) as IdWithExpiry;
|
|
177
169
|
|
|
178
|
-
|
|
179
|
-
if (idWithExpiry.expiry < Date.now() || idWithExpiry.id.length <= 13) {
|
|
170
|
+
if (idWithExpiry.expiry < Date.now()) {
|
|
180
171
|
await this.createSessionId();
|
|
181
172
|
} else {
|
|
182
173
|
// Extend the duration of the sessionId
|
|
@@ -190,30 +181,21 @@ export default class IkasAnalytics {
|
|
|
190
181
|
} else {
|
|
191
182
|
await this.createSessionId();
|
|
192
183
|
}
|
|
193
|
-
|
|
194
|
-
IkasStorefrontConfig.init({
|
|
195
|
-
sessionId: this.sessionId || "",
|
|
196
|
-
});
|
|
197
184
|
} catch (err) {
|
|
198
185
|
console.error(err);
|
|
199
186
|
}
|
|
200
187
|
}
|
|
201
188
|
|
|
202
|
-
static
|
|
189
|
+
static checkVisitorId() {
|
|
203
190
|
try {
|
|
204
191
|
const existingVisitorId = localStorage.getItem(this.VISITOR_ID_KEY);
|
|
205
192
|
|
|
206
|
-
|
|
207
|
-
if (existingVisitorId && existingVisitorId.length > 13) {
|
|
193
|
+
if (existingVisitorId) {
|
|
208
194
|
this.visitorId = existingVisitorId;
|
|
209
195
|
} else {
|
|
210
|
-
this.visitorId =
|
|
196
|
+
this.visitorId = Date.now() + "";
|
|
211
197
|
localStorage.setItem(this.VISITOR_ID_KEY, this.visitorId);
|
|
212
198
|
}
|
|
213
|
-
|
|
214
|
-
IkasStorefrontConfig.init({
|
|
215
|
-
visitorId: this.visitorId,
|
|
216
|
-
});
|
|
217
199
|
} catch (err) {
|
|
218
200
|
console.error(err);
|
|
219
201
|
}
|
|
@@ -317,7 +299,7 @@ export default class IkasAnalytics {
|
|
|
317
299
|
static async sendEvents(events: Event[]) {
|
|
318
300
|
try {
|
|
319
301
|
await this.checkSessionId();
|
|
320
|
-
|
|
302
|
+
this.checkVisitorId();
|
|
321
303
|
|
|
322
304
|
const store = IkasBaseStore.getInstance();
|
|
323
305
|
const cloudFrontEvent: CloudFrontEvent = {
|
|
@@ -447,7 +429,7 @@ export default class IkasAnalytics {
|
|
|
447
429
|
};
|
|
448
430
|
|
|
449
431
|
await this.sendEvents([event]);
|
|
450
|
-
|
|
432
|
+
this.createSessionId();
|
|
451
433
|
}
|
|
452
434
|
|
|
453
435
|
static async beginCheckout(checkout: IkasCheckout) {
|
|
@@ -315,7 +315,7 @@ const CityInput: React.FC<FormItemProps> = observer(({ vm }) => {
|
|
|
315
315
|
return (
|
|
316
316
|
<FormItem
|
|
317
317
|
type={FormItemType.TEXT}
|
|
318
|
-
autocomplete="address-
|
|
318
|
+
autocomplete="address-level3"
|
|
319
319
|
label={t("checkout-page:city")}
|
|
320
320
|
value={vm.city?.name || ""}
|
|
321
321
|
onChange={vm.onCityInputChange}
|
|
@@ -4,11 +4,7 @@ import {
|
|
|
4
4
|
IkasOrderLineItem,
|
|
5
5
|
IkasProductOptionType,
|
|
6
6
|
} from "../../../../../models";
|
|
7
|
-
import {
|
|
8
|
-
formatDate,
|
|
9
|
-
formatCurrency,
|
|
10
|
-
useTranslation,
|
|
11
|
-
} from "../../../../../utils";
|
|
7
|
+
import { formatDate, formatMoney, useTranslation } from "../../../../../utils";
|
|
12
8
|
import CheckoutViewModel from "../../../../../components/checkout/model";
|
|
13
9
|
import { Modal } from "../../modal";
|
|
14
10
|
|
|
@@ -26,6 +22,18 @@ export const CartItem: React.FC<Props> = observer(
|
|
|
26
22
|
const [isOptionsModalVisible, setOptionsModalVisible] =
|
|
27
23
|
React.useState(false);
|
|
28
24
|
|
|
25
|
+
const adjustmentAmounts = vm.checkout.orderAdjustments?.map(
|
|
26
|
+
(a) =>
|
|
27
|
+
a.appliedOrderLines
|
|
28
|
+
?.filter((aol) => aol.orderLineId === cartItem.id)
|
|
29
|
+
.reduce((total, current) => total + (current.amount || 0), 0) || 0
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const adjustmentTotal = adjustmentAmounts?.reduce(
|
|
33
|
+
(total, current) => total + current,
|
|
34
|
+
0
|
|
35
|
+
);
|
|
36
|
+
|
|
29
37
|
const formatDateTheme = (val: string) => {
|
|
30
38
|
const date = formatDate(new Date(val)).split(" ");
|
|
31
39
|
date.splice(-1);
|
|
@@ -118,10 +126,12 @@ export const CartItem: React.FC<Props> = observer(
|
|
|
118
126
|
className={styles.Image}
|
|
119
127
|
src={cartItem.variant.mainImage?.thumbnailSrc}
|
|
120
128
|
/>
|
|
121
|
-
<div className={styles.QuantityCircle}>{cartItem.quantity}</div>
|
|
122
129
|
</div>
|
|
123
|
-
<div className={styles.
|
|
130
|
+
<div className={styles.Right}>
|
|
124
131
|
<div className={styles.Name}>{cartItem.variant.name}</div>
|
|
132
|
+
<div className={styles.LightText}>
|
|
133
|
+
{`${t("checkout-page:quantity")}: ` + cartItem.quantity}
|
|
134
|
+
</div>
|
|
125
135
|
<div className={styles.LightText}>
|
|
126
136
|
{cartItem.variant.variantValues
|
|
127
137
|
?.map((vv) => vv.variantValueName)
|
|
@@ -144,22 +154,25 @@ export const CartItem: React.FC<Props> = observer(
|
|
|
144
154
|
onClose={() => setOptionsModalVisible(false)}
|
|
145
155
|
/>
|
|
146
156
|
)}
|
|
147
|
-
</div>
|
|
148
157
|
|
|
149
|
-
<div className={styles.Right}>
|
|
150
158
|
<div className={styles.Price}>
|
|
151
159
|
{!!cartItem.overridenPriceWithQuantity && (
|
|
152
160
|
<span className={styles.GrayPrice}>
|
|
153
|
-
{
|
|
161
|
+
{!!adjustmentTotal
|
|
162
|
+
? formatMoney(cartItem.finalPriceWithQuantity, currencyCode)
|
|
163
|
+
: formatMoney(
|
|
164
|
+
cartItem.overridenPriceWithQuantity,
|
|
165
|
+
currencyCode
|
|
166
|
+
)}
|
|
154
167
|
</span>
|
|
155
168
|
)}
|
|
156
|
-
{
|
|
169
|
+
{!!adjustmentTotal
|
|
170
|
+
? formatMoney(
|
|
171
|
+
cartItem.finalPriceWithQuantity - adjustmentTotal,
|
|
172
|
+
currencyCode
|
|
173
|
+
)
|
|
174
|
+
: formatMoney(cartItem.finalPriceWithQuantity, currencyCode)}
|
|
157
175
|
</div>
|
|
158
|
-
{cartItem.unitPriceText && (
|
|
159
|
-
<div className={[styles.LightText, styles.Small].join(" ")}>
|
|
160
|
-
{cartItem.unitPriceText}
|
|
161
|
-
</div>
|
|
162
|
-
)}
|
|
163
176
|
</div>
|
|
164
177
|
</div>
|
|
165
178
|
);
|
|
@@ -5,47 +5,23 @@
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
margin-bottom: 24px;
|
|
7
7
|
|
|
8
|
-
&:last-child {
|
|
9
|
-
margin-bottom: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
.ImageContainer {
|
|
13
9
|
flex: 0 0 auto;
|
|
14
|
-
width:
|
|
10
|
+
width: 114px;
|
|
11
|
+
height: 114px;
|
|
15
12
|
position: relative;
|
|
16
13
|
margin-right: 16px;
|
|
17
|
-
overflow: visible;
|
|
18
|
-
|
|
19
|
-
@media only screen and (max-width: 375px) {
|
|
20
|
-
width: 56px;
|
|
21
|
-
}
|
|
22
14
|
|
|
23
15
|
.Image {
|
|
24
16
|
width: 100%;
|
|
25
|
-
|
|
17
|
+
height: 100%;
|
|
18
|
+
object-fit: cover;
|
|
26
19
|
border-radius: 8px;
|
|
27
20
|
}
|
|
28
|
-
|
|
29
|
-
.QuantityCircle {
|
|
30
|
-
width: 20px;
|
|
31
|
-
height: 20px;
|
|
32
|
-
border-radius: 10px;
|
|
33
|
-
background-color: $buttonBgColor;
|
|
34
|
-
color: $buttonTextColor;
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
font-weight: 500;
|
|
40
|
-
position: absolute;
|
|
41
|
-
top: -10px;
|
|
42
|
-
right: -10px;
|
|
43
|
-
}
|
|
44
21
|
}
|
|
45
22
|
|
|
46
|
-
.
|
|
23
|
+
.Right {
|
|
47
24
|
position: relative;
|
|
48
|
-
flex: 1 1 auto;
|
|
49
25
|
|
|
50
26
|
.Name {
|
|
51
27
|
font-size: 16px;
|
|
@@ -61,7 +37,12 @@
|
|
|
61
37
|
-webkit-box-orient: vertical;
|
|
62
38
|
}
|
|
63
39
|
|
|
64
|
-
|
|
40
|
+
.LightText {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
color: $secondaryTextColor;
|
|
43
|
+
line-height: 20px;
|
|
44
|
+
margin-top: 2px;
|
|
45
|
+
}
|
|
65
46
|
|
|
66
47
|
.OptionsText {
|
|
67
48
|
font-size: 14px;
|
|
@@ -74,39 +55,21 @@
|
|
|
74
55
|
cursor: pointer;
|
|
75
56
|
text-decoration: underline;
|
|
76
57
|
}
|
|
58
|
+
|
|
77
59
|
}
|
|
78
60
|
}
|
|
79
61
|
|
|
80
|
-
.
|
|
81
|
-
|
|
62
|
+
.Price {
|
|
63
|
+
font-size: 14px;
|
|
82
64
|
display: flex;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.Price {
|
|
87
|
-
font-size: 14px;
|
|
88
|
-
display: flex;
|
|
89
|
-
flex-direction: column;
|
|
90
|
-
align-items: flex-end;
|
|
91
|
-
color: $primaryTextColor;
|
|
92
|
-
}
|
|
93
|
-
|
|
65
|
+
align-items: center;
|
|
66
|
+
color: $primaryTextColor;
|
|
67
|
+
|
|
94
68
|
.GrayPrice {
|
|
95
69
|
font-size: 14px;
|
|
96
70
|
color: $secondaryTextColor;
|
|
97
71
|
text-decoration: line-through;
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.LightText {
|
|
103
|
-
font-size: 14px;
|
|
104
|
-
color: $secondaryTextColor;
|
|
105
|
-
line-height: 20px;
|
|
106
|
-
margin-top: 2px;
|
|
107
|
-
|
|
108
|
-
&.Small {
|
|
109
|
-
font-size: 12px;
|
|
72
|
+
margin-right: 8px;
|
|
110
73
|
}
|
|
111
74
|
}
|
|
112
75
|
|
|
@@ -115,25 +78,25 @@
|
|
|
115
78
|
flex-direction: column;
|
|
116
79
|
margin-bottom: 24px;
|
|
117
80
|
max-width: 400px;
|
|
118
|
-
|
|
81
|
+
|
|
119
82
|
.OptionName {
|
|
120
83
|
font-size: 14px;
|
|
121
84
|
color: $primaryTextColor;
|
|
122
85
|
margin-right: 8px;
|
|
123
86
|
font-weight: 500;
|
|
124
87
|
}
|
|
125
|
-
|
|
88
|
+
|
|
126
89
|
.OptionValue {
|
|
127
90
|
font-size: 14px;
|
|
128
91
|
color: $secondaryTextColor;
|
|
129
92
|
}
|
|
130
|
-
|
|
93
|
+
|
|
131
94
|
.OptionsHorContainer {
|
|
132
95
|
display: flex;
|
|
133
96
|
align-items: center;
|
|
134
97
|
flex-wrap: wrap;
|
|
135
98
|
}
|
|
136
|
-
|
|
99
|
+
|
|
137
100
|
.OptionColorValue {
|
|
138
101
|
width: 24px;
|
|
139
102
|
height: 24px;
|
|
@@ -141,4 +104,4 @@
|
|
|
141
104
|
margin-right: 4px;
|
|
142
105
|
}
|
|
143
106
|
}
|
|
144
|
-
}
|
|
107
|
+
}
|
|
@@ -5,7 +5,7 @@ import _sortBy from "lodash/sortBy";
|
|
|
5
5
|
import InputWithButton from "../input-with-button";
|
|
6
6
|
import NotificationBox from "../notification-box";
|
|
7
7
|
import CheckoutViewModel, { CheckoutStep } from "../../model";
|
|
8
|
-
import {
|
|
8
|
+
import { formatMoney, useTranslation } from "../../../../utils";
|
|
9
9
|
import { CartItem } from "./cart-item";
|
|
10
10
|
import { FormItem } from "../form-item";
|
|
11
11
|
import { FormItemType } from "../form-item/model";
|
|
@@ -95,13 +95,9 @@ export const CartSummary: React.FC<Props> = observer(({ vm, allowExpand }) => {
|
|
|
95
95
|
<div className={styles.Left}>{t("checkout-page:summary")}</div>
|
|
96
96
|
<div className={styles.Price}>
|
|
97
97
|
<span className={styles.PriceText}>
|
|
98
|
-
{`${
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
checkout.currencySymbol
|
|
102
|
-
)} (${checkout.items.length} ${t(
|
|
103
|
-
"checkout-page:cartItemProduct"
|
|
104
|
-
)})`}
|
|
98
|
+
{`${formatMoney(vm.finalPrice || 0, checkout.currencyCode)} (${
|
|
99
|
+
checkout.items.length
|
|
100
|
+
} ${t("checkout-page:cartItemProduct")})`}
|
|
105
101
|
</span>
|
|
106
102
|
<span className={arrowDownClasses}>
|
|
107
103
|
<SVGArrowDown />
|
|
@@ -113,16 +109,15 @@ export const CartSummary: React.FC<Props> = observer(({ vm, allowExpand }) => {
|
|
|
113
109
|
<div className={cartSummaryClasses}>
|
|
114
110
|
<div className={styles.DetailsContainer} style={detailsContainerStyle}>
|
|
115
111
|
<div className={styles.Details} ref={setDetailsContainer}>
|
|
116
|
-
|
|
117
|
-
{
|
|
112
|
+
{checkout.items.map((item, index) => (
|
|
113
|
+
<div key={index}>
|
|
118
114
|
<CartItem
|
|
119
|
-
key={index}
|
|
120
115
|
vm={vm}
|
|
121
116
|
cartItem={item}
|
|
122
117
|
currencyCode={checkout.currencyCode}
|
|
123
118
|
/>
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
</div>
|
|
120
|
+
))}
|
|
126
121
|
<div className={styles.Divider} />
|
|
127
122
|
<div className={styles.SubTotalInfo}>
|
|
128
123
|
{hasCouponError && (
|
|
@@ -137,7 +132,7 @@ export const CartSummary: React.FC<Props> = observer(({ vm, allowExpand }) => {
|
|
|
137
132
|
)}
|
|
138
133
|
<InfoRow
|
|
139
134
|
label={t("checkout-page:subtotal")}
|
|
140
|
-
value={checkout.
|
|
135
|
+
value={formatMoney(checkout.totalPrice, checkout.currencyCode)}
|
|
141
136
|
tooltipText={t("checkout-page:subtotalTooltip")}
|
|
142
137
|
/>
|
|
143
138
|
{!!checkout.shippingLines?.length && (
|
|
@@ -145,19 +140,26 @@ export const CartSummary: React.FC<Props> = observer(({ vm, allowExpand }) => {
|
|
|
145
140
|
label={t("checkout-page:cartShippingTitle")}
|
|
146
141
|
value={
|
|
147
142
|
checkout.shippingTotal
|
|
148
|
-
?
|
|
143
|
+
? formatMoney(
|
|
144
|
+
checkout.shippingTotal,
|
|
145
|
+
checkout.currencyCode
|
|
146
|
+
)
|
|
149
147
|
: t("checkout-page:free")
|
|
150
148
|
}
|
|
151
149
|
/>
|
|
152
150
|
)}
|
|
153
|
-
|
|
151
|
+
{!!checkout.totalTax && !!vm.customizationProps?.showTax && (
|
|
152
|
+
<InfoRow
|
|
153
|
+
label={t("checkout-page:cartTaxTitle")}
|
|
154
|
+
value={formatMoney(checkout.totalTax, checkout.currencyCode)}
|
|
155
|
+
/>
|
|
156
|
+
)}
|
|
154
157
|
{!!vm.installmentExtraPrice && (
|
|
155
158
|
<InfoRow
|
|
156
159
|
label={t("checkout-page:cartInterest")}
|
|
157
|
-
value={
|
|
160
|
+
value={formatMoney(
|
|
158
161
|
vm.installmentExtraPrice,
|
|
159
|
-
checkout.currencyCode
|
|
160
|
-
checkout.currencySymbol
|
|
162
|
+
checkout.currencyCode
|
|
161
163
|
)}
|
|
162
164
|
/>
|
|
163
165
|
)}
|
|
@@ -190,23 +192,8 @@ export const CartSummary: React.FC<Props> = observer(({ vm, allowExpand }) => {
|
|
|
190
192
|
<div className={styles.TitleContainer}>
|
|
191
193
|
<div className={styles.Title}>{t("checkout-page:total")}</div>
|
|
192
194
|
</div>
|
|
193
|
-
<div>
|
|
194
|
-
|
|
195
|
-
<div className={styles.TotalPrice}>
|
|
196
|
-
{formatCurrency(
|
|
197
|
-
vm.finalPrice || 0,
|
|
198
|
-
checkout.currencyCode,
|
|
199
|
-
checkout.currencySymbol
|
|
200
|
-
)}
|
|
201
|
-
</div>
|
|
202
|
-
{!!checkout.$totalTax && !!vm.customizationProps?.showTax && (
|
|
203
|
-
<div className={[styles.TotalTax].join(" ")}>
|
|
204
|
-
{t("checkout-page:cartTaxTitle") +
|
|
205
|
-
" " +
|
|
206
|
-
checkout.$formattedTotalTax}
|
|
207
|
-
</div>
|
|
208
|
-
)}
|
|
209
|
-
</div>
|
|
195
|
+
<div className={styles.TotalPrice}>
|
|
196
|
+
{formatMoney(vm.finalPrice || 0, checkout.currencyCode)}
|
|
210
197
|
</div>
|
|
211
198
|
</div>
|
|
212
199
|
|
|
@@ -286,11 +273,7 @@ const Adjustments: React.FC<CommonProps> = observer(({ vm }) => {
|
|
|
286
273
|
<div className={styles.Value}>
|
|
287
274
|
<span>{adjustment.type === "DECREMENT" ? "- " : ""}</span>{" "}
|
|
288
275
|
<span>
|
|
289
|
-
{
|
|
290
|
-
adjustment.amount,
|
|
291
|
-
vm.checkout.currencyCode,
|
|
292
|
-
vm.checkout.currencySymbol
|
|
293
|
-
)}
|
|
276
|
+
{formatMoney(adjustment.amount, vm.checkout.currencyCode)}
|
|
294
277
|
</span>
|
|
295
278
|
</div>
|
|
296
279
|
</div>
|
|
@@ -321,11 +304,7 @@ const CalculatedAdditionalPrices: React.FC<CommonProps> = observer(({ vm }) => {
|
|
|
321
304
|
<div className={styles.Value}>
|
|
322
305
|
<span>{adjustment.type === "DECREMENT" ? "- " : ""}</span>{" "}
|
|
323
306
|
<span>
|
|
324
|
-
{
|
|
325
|
-
adjustment.amount,
|
|
326
|
-
vm.checkout!.currencyCode,
|
|
327
|
-
vm.checkout!.currencySymbol
|
|
328
|
-
)}
|
|
307
|
+
{formatMoney(adjustment.amount, vm.checkout!.currencyCode)}
|
|
329
308
|
</span>
|
|
330
309
|
</div>
|
|
331
310
|
</div>
|
|
@@ -339,13 +318,7 @@ const CalculatedAdditionalPrices: React.FC<CommonProps> = observer(({ vm }) => {
|
|
|
339
318
|
</div>
|
|
340
319
|
</div>
|
|
341
320
|
<div className={styles.Value}>
|
|
342
|
-
<span>
|
|
343
|
-
{formatCurrency(
|
|
344
|
-
gpl.price,
|
|
345
|
-
vm.checkout.currencyCode,
|
|
346
|
-
vm.checkout!.currencySymbol
|
|
347
|
-
)}
|
|
348
|
-
</span>
|
|
321
|
+
<span>{formatMoney(gpl.price, vm.checkout.currencyCode)}</span>
|
|
349
322
|
</div>
|
|
350
323
|
</div>
|
|
351
324
|
))}
|
|
@@ -437,11 +410,7 @@ const Coupon: React.FC<CouponProps> = observer(
|
|
|
437
410
|
<div className={styles.Value}>
|
|
438
411
|
<span>{adjustment?.type === "DECREMENT" ? "- " : ""}</span>{" "}
|
|
439
412
|
<span>
|
|
440
|
-
{
|
|
441
|
-
adjustment?.amount || 0,
|
|
442
|
-
vm.checkout.currencyCode,
|
|
443
|
-
vm.checkout.currencySymbol
|
|
444
|
-
)}
|
|
413
|
+
{formatMoney(adjustment?.amount || 0, vm.checkout.currencyCode)}
|
|
445
414
|
</span>
|
|
446
415
|
</div>
|
|
447
416
|
)}
|