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