@ikas/storefront 4.0.0-alpha.34 → 4.0.0-alpha.36
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 +11 -11
- package/src/analytics/ikas.ts +15 -5
- package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +7 -10
- package/src/components/checkout/components/customer-addresses/index.tsx +6 -2
- package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +2 -0
- package/src/components/checkout/components/offer-product/index.tsx +12 -16
- package/src/components/checkout/components/offer-product/style.module.scss +1 -3
- package/src/components/checkout/index.tsx +10 -9
- package/src/components/checkout/model.ts +86 -60
- package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +6 -1
- package/src/models/data/cart/campaign-offer/index.ts +13 -2
- package/src/models/data/category/path-item/index.ts +4 -0
- package/src/models/data/merchant-settings/index.ts +3 -0
- package/src/models/data/order/line-item/index.ts +2 -0
- package/src/models/data/order/line-item/variant/value/index.ts +1 -1
- package/src/models/data/product/filter/index.ts +4 -13
- package/src/store/customer/index.ts +1 -1
- package/src/utils/constants.ts +1 -1
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.36",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,11 +24,11 @@
|
|
|
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.36",
|
|
28
|
+
"@ikas/storefront-config": "^4.0.0-alpha.36",
|
|
29
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.36",
|
|
30
|
+
"@ikas/storefront-models": "^4.0.0-alpha.36",
|
|
31
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.36",
|
|
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",
|
|
@@ -52,11 +52,11 @@
|
|
|
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.36",
|
|
56
|
+
"@ikas/storefront-config": "^4.0.0-alpha.36",
|
|
57
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.36",
|
|
58
|
+
"@ikas/storefront-models": "^4.0.0-alpha.36",
|
|
59
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.36",
|
|
60
60
|
"mobx": "^6.1.3",
|
|
61
61
|
"mobx-react-lite": "^3.1.5",
|
|
62
62
|
"next": "12.2.0",
|
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
|
|
@@ -190,14 +199,15 @@ export default class IkasAnalytics {
|
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
|
|
193
|
-
static checkVisitorId() {
|
|
202
|
+
static async checkVisitorId() {
|
|
194
203
|
try {
|
|
195
204
|
const existingVisitorId = localStorage.getItem(this.VISITOR_ID_KEY);
|
|
196
205
|
|
|
197
|
-
|
|
206
|
+
// Remove old ids so that they can be replaced with UUIDs (length 13 check)
|
|
207
|
+
if (existingVisitorId && existingVisitorId.length > 13) {
|
|
198
208
|
this.visitorId = existingVisitorId;
|
|
199
209
|
} else {
|
|
200
|
-
this.visitorId =
|
|
210
|
+
this.visitorId = await this.createUUID();
|
|
201
211
|
localStorage.setItem(this.VISITOR_ID_KEY, this.visitorId);
|
|
202
212
|
}
|
|
203
213
|
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
.ImageContainer {
|
|
9
9
|
flex: 0 0 auto;
|
|
10
10
|
width: 114px;
|
|
11
|
-
height: 114px;
|
|
12
11
|
position: relative;
|
|
13
12
|
margin-right: 16px;
|
|
14
13
|
|
|
15
14
|
.Image {
|
|
16
15
|
width: 100%;
|
|
17
|
-
|
|
18
|
-
object-fit: cover;
|
|
16
|
+
object-fit: contain;
|
|
19
17
|
border-radius: 8px;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
cursor: pointer;
|
|
56
54
|
text-decoration: underline;
|
|
57
55
|
}
|
|
58
|
-
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
|
|
@@ -64,7 +61,7 @@
|
|
|
64
61
|
display: flex;
|
|
65
62
|
align-items: center;
|
|
66
63
|
color: $primaryTextColor;
|
|
67
|
-
|
|
64
|
+
|
|
68
65
|
.GrayPrice {
|
|
69
66
|
font-size: 14px;
|
|
70
67
|
color: $secondaryTextColor;
|
|
@@ -78,25 +75,25 @@
|
|
|
78
75
|
flex-direction: column;
|
|
79
76
|
margin-bottom: 24px;
|
|
80
77
|
max-width: 400px;
|
|
81
|
-
|
|
78
|
+
|
|
82
79
|
.OptionName {
|
|
83
80
|
font-size: 14px;
|
|
84
81
|
color: $primaryTextColor;
|
|
85
82
|
margin-right: 8px;
|
|
86
83
|
font-weight: 500;
|
|
87
84
|
}
|
|
88
|
-
|
|
85
|
+
|
|
89
86
|
.OptionValue {
|
|
90
87
|
font-size: 14px;
|
|
91
88
|
color: $secondaryTextColor;
|
|
92
89
|
}
|
|
93
|
-
|
|
90
|
+
|
|
94
91
|
.OptionsHorContainer {
|
|
95
92
|
display: flex;
|
|
96
93
|
align-items: center;
|
|
97
94
|
flex-wrap: wrap;
|
|
98
95
|
}
|
|
99
|
-
|
|
96
|
+
|
|
100
97
|
.OptionColorValue {
|
|
101
98
|
width: 24px;
|
|
102
99
|
height: 24px;
|
|
@@ -104,4 +101,4 @@
|
|
|
104
101
|
margin-right: 4px;
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
|
-
}
|
|
104
|
+
}
|
|
@@ -143,7 +143,9 @@ const CustomerAddresses: React.FC<Props> = ({ vm }) => {
|
|
|
143
143
|
|
|
144
144
|
{!!vm.vm.store.customerStore.customer &&
|
|
145
145
|
!vm.editingCustomerAddress &&
|
|
146
|
-
vm.vm.deliveryMethod === "address"
|
|
146
|
+
(vm.vm.deliveryMethod === "address" ||
|
|
147
|
+
(vm.vm.step === CheckoutStep.PAYMENT &&
|
|
148
|
+
vm.vm.deliveryMethod === "in-store")) && (
|
|
147
149
|
<div className={checkoutStyles.RowPB}>
|
|
148
150
|
{vm.vm.store.customerStore.customer.addresses?.map((address) => (
|
|
149
151
|
<SelectBox
|
|
@@ -183,7 +185,9 @@ const CustomerAddresses: React.FC<Props> = ({ vm }) => {
|
|
|
183
185
|
vm.vm.step === CheckoutStep.INFO &&
|
|
184
186
|
vm.vm.deliveryMethod === "address"
|
|
185
187
|
? addressForm
|
|
186
|
-
: vm.vm.step === CheckoutStep.PAYMENT &&
|
|
188
|
+
: vm.vm.step === CheckoutStep.PAYMENT &&
|
|
189
|
+
!vm.vm.store.customerStore.customer &&
|
|
190
|
+
addressForm}
|
|
187
191
|
|
|
188
192
|
{vm.vm.deliveryMethod === "in-store" && (
|
|
189
193
|
<div className={checkoutStyles.RowPB}>
|
|
@@ -132,7 +132,9 @@ const CreditCardFormMasterPass = observer(({ vm }: Props) => {
|
|
|
132
132
|
<div className={checkoutStyles.RowPB}>
|
|
133
133
|
<FormItem
|
|
134
134
|
name="masterPassPhoneNumber"
|
|
135
|
+
autocomplete="tel"
|
|
135
136
|
type={FormItemType.TEL}
|
|
137
|
+
currentCountryCode={vm.store.currentCountryCode}
|
|
136
138
|
disabled={
|
|
137
139
|
vm.mpVM.isSaveCardToMasterPassPhoneNumberInputDisabled
|
|
138
140
|
}
|
|
@@ -18,7 +18,7 @@ type Props = {
|
|
|
18
18
|
const OfferProduct: React.FC<Props> = ({ vm, campaignOffer }) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
const [selectedVariant, setSelectedVariant] =
|
|
21
|
-
React.useState<IkasProductVariant>(campaignOffer
|
|
21
|
+
React.useState<IkasProductVariant>(campaignOffer.variants[0]);
|
|
22
22
|
|
|
23
23
|
const acceptOffer = () => {
|
|
24
24
|
vm.updateCartCampaignOffer({
|
|
@@ -43,7 +43,7 @@ const OfferProduct: React.FC<Props> = ({ vm, campaignOffer }) => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const onVariantChange = (value: string) => {
|
|
46
|
-
const variant = campaignOffer.
|
|
46
|
+
const variant = campaignOffer.variants.find((v) => v.id === value);
|
|
47
47
|
|
|
48
48
|
if (variant) {
|
|
49
49
|
setSelectedVariant(variant);
|
|
@@ -105,26 +105,22 @@ const OfferProduct: React.FC<Props> = ({ vm, campaignOffer }) => {
|
|
|
105
105
|
)}
|
|
106
106
|
</div>
|
|
107
107
|
<div className={styles.Actions}>
|
|
108
|
-
{campaignOffer.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}))}
|
|
119
|
-
/>
|
|
120
|
-
)}
|
|
108
|
+
{campaignOffer.variants.length > 1 && (
|
|
109
|
+
<Select
|
|
110
|
+
value={selectedVariant.id}
|
|
111
|
+
onSelectChange={onVariantChange}
|
|
112
|
+
options={campaignOffer.variants.map((v) => ({
|
|
113
|
+
label: v.variantValues.map((vv) => vv.name).join(", "),
|
|
114
|
+
value: v.id,
|
|
115
|
+
}))}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
121
118
|
<Button
|
|
122
119
|
style={{
|
|
123
120
|
width: "100%",
|
|
124
121
|
height: 44,
|
|
125
122
|
fontSize: 14,
|
|
126
123
|
}}
|
|
127
|
-
isDisabled={!campaignOffer.product.hasStock}
|
|
128
124
|
text={t("checkout-page:actions.addToCart")}
|
|
129
125
|
onClick={acceptOffer}
|
|
130
126
|
/>
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.ImageContainer {
|
|
65
|
-
height: 136px;
|
|
66
65
|
width: 136px;
|
|
67
66
|
position: relative;
|
|
68
67
|
background-color: #fff;
|
|
@@ -73,8 +72,7 @@
|
|
|
73
72
|
|
|
74
73
|
.Image {
|
|
75
74
|
width: 100%;
|
|
76
|
-
|
|
77
|
-
object-fit: cover;
|
|
75
|
+
object-fit: contain;
|
|
78
76
|
border-radius: 8px;
|
|
79
77
|
}
|
|
80
78
|
|
|
@@ -366,15 +366,16 @@ const Steps: React.FC<CommonProps> = observer(({ vm }) => {
|
|
|
366
366
|
vm.step === CheckoutStep.PAYMENT ? (
|
|
367
367
|
<div className={styles.AdressStepInfo}>
|
|
368
368
|
<StepSummaryShipping vm={vm} />
|
|
369
|
-
{vm.checkout.availableShippingMethods &&
|
|
370
|
-
vm.checkout.availableShippingMethods.length > 1
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
369
|
+
{((vm.checkout.availableShippingMethods &&
|
|
370
|
+
vm.checkout.availableShippingMethods.length > 1) ||
|
|
371
|
+
vm.checkoutSettings.isGiftPackageEnabled) && (
|
|
372
|
+
<div
|
|
373
|
+
className={styles.EditBtn}
|
|
374
|
+
onClick={vm.onBackToShippingClick}
|
|
375
|
+
>
|
|
376
|
+
{t("checkout-page:actions.edit")}
|
|
377
|
+
</div>
|
|
378
|
+
)}
|
|
378
379
|
</div>
|
|
379
380
|
) : undefined,
|
|
380
381
|
vm.step === CheckoutStep.PAYMENT ? (
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
IkasOrderCustomer,
|
|
13
13
|
IkasCartCampaignOfferStatus,
|
|
14
14
|
IkasProduct,
|
|
15
|
+
IkasProductVariant,
|
|
15
16
|
IkasCartCampaignOffer,
|
|
16
17
|
IkasCheckout,
|
|
17
18
|
IkasStockLocation,
|
|
@@ -91,8 +92,8 @@ export default class CheckoutViewModel {
|
|
|
91
92
|
|
|
92
93
|
stripeResponse: CreateStripePaymentIntentResponse | null = null;
|
|
93
94
|
|
|
94
|
-
checkoutCampaignOffer
|
|
95
|
-
postCheckoutCampaignOffer
|
|
95
|
+
checkoutCampaignOffer?: CampaignOfferType;
|
|
96
|
+
postCheckoutCampaignOffer?: CampaignOfferType;
|
|
96
97
|
|
|
97
98
|
returnPolicy: string;
|
|
98
99
|
privacyPolicy: string;
|
|
@@ -252,6 +253,9 @@ export default class CheckoutViewModel {
|
|
|
252
253
|
if (this.step === CheckoutStep.PAYMENT) {
|
|
253
254
|
if (this.isInStoreDelivery) {
|
|
254
255
|
this.checkout.billingAddress = new IkasOrderAddress();
|
|
256
|
+
if (this.checkoutSettings) {
|
|
257
|
+
this.checkout.billingAddress.checkoutSettings = this.checkoutSettings;
|
|
258
|
+
}
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
261
|
|
|
@@ -737,7 +741,7 @@ export default class CheckoutViewModel {
|
|
|
737
741
|
this.checkout.billingAddress =
|
|
738
742
|
this.checkout.billingAddress || new IkasOrderAddress();
|
|
739
743
|
} else {
|
|
740
|
-
if (this.isInStoreDelivery) {
|
|
744
|
+
if (this.isInStoreDelivery || this.checkout.billingAddress) {
|
|
741
745
|
this.checkout.billingAddress = new IkasOrderAddress(
|
|
742
746
|
_cloneDeep(this.checkout.billingAddress) || {}
|
|
743
747
|
);
|
|
@@ -747,6 +751,7 @@ export default class CheckoutViewModel {
|
|
|
747
751
|
);
|
|
748
752
|
}
|
|
749
753
|
}
|
|
754
|
+
|
|
750
755
|
this.checkout.billingAddress.checkoutSettings = this.checkoutSettings;
|
|
751
756
|
}
|
|
752
757
|
};
|
|
@@ -1324,32 +1329,25 @@ export default class CheckoutViewModel {
|
|
|
1324
1329
|
this.isContactModalVisible = value;
|
|
1325
1330
|
};
|
|
1326
1331
|
|
|
1327
|
-
|
|
1332
|
+
getWaitingForActionCampaignOffers = (
|
|
1328
1333
|
targetPage: IkasCampaignOfferTargetPageType
|
|
1329
1334
|
) => {
|
|
1330
|
-
if (this.checkout.campaignOffers
|
|
1331
|
-
|
|
1332
|
-
(co) =>
|
|
1333
|
-
co.status === IkasCartCampaignOfferStatus.WAITING_FOR_ACTION &&
|
|
1334
|
-
co.campaignOffer?.targetPageTypes.some((tpt) => tpt === targetPage)
|
|
1335
|
-
);
|
|
1336
|
-
|
|
1337
|
-
if (filteredCampaignOffer.length) {
|
|
1338
|
-
return filteredCampaignOffer[0];
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1335
|
+
if (!this.checkout.campaignOffers || !this.checkout.campaignOffers.length)
|
|
1336
|
+
return;
|
|
1341
1337
|
|
|
1342
|
-
|
|
1338
|
+
const filteredCampaignOffers = this.checkout.campaignOffers.filter(
|
|
1339
|
+
(co) =>
|
|
1340
|
+
co.status === IkasCartCampaignOfferStatus.WAITING_FOR_ACTION &&
|
|
1341
|
+
co.campaignOffer?.targetPageTypes.some((tpt) => tpt === targetPage)
|
|
1342
|
+
);
|
|
1343
|
+
return filteredCampaignOffers;
|
|
1343
1344
|
};
|
|
1344
1345
|
|
|
1345
1346
|
getOffer = (waitingForActionCampaignOffer: IkasCartCampaignOffer) => {
|
|
1346
|
-
if (waitingForActionCampaignOffer.campaignOffer)
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
return null;
|
|
1347
|
+
if (!waitingForActionCampaignOffer.campaignOffer) return null;
|
|
1348
|
+
return waitingForActionCampaignOffer.campaignOffer.offers.find(
|
|
1349
|
+
(o) => o.id === waitingForActionCampaignOffer.campaignOfferProductId
|
|
1350
|
+
);
|
|
1353
1351
|
};
|
|
1354
1352
|
|
|
1355
1353
|
getProduct = async (productId: string) => {
|
|
@@ -1359,61 +1357,88 @@ export default class CheckoutViewModel {
|
|
|
1359
1357
|
},
|
|
1360
1358
|
});
|
|
1361
1359
|
|
|
1362
|
-
if (
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1360
|
+
if (!productsResponse.isSuccess || !productsResponse?.data?.data?.length)
|
|
1361
|
+
return null;
|
|
1362
|
+
|
|
1363
|
+
const product = productsResponse.data.data[0];
|
|
1364
|
+
const selectedVariant = product.variants.find((v) => v.isActive);
|
|
1365
|
+
const productDetail = new IkasProduct({
|
|
1366
|
+
...product,
|
|
1367
|
+
selectedVariantValues: (selectedVariant || product.variants[0])
|
|
1368
|
+
.variantValues,
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
return productDetail;
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
getOfferProductVariants = ({
|
|
1375
|
+
offer,
|
|
1376
|
+
product,
|
|
1377
|
+
}: {
|
|
1378
|
+
offer: IkasCampaignOfferProduct;
|
|
1379
|
+
product: IkasProduct;
|
|
1380
|
+
}) => {
|
|
1381
|
+
const variants: IkasProductVariant[] = [];
|
|
1382
|
+
|
|
1383
|
+
if (offer.excludedVariantIdList?.length) {
|
|
1384
|
+
product.variants.forEach((v) => {
|
|
1385
|
+
const isVariantExcluded = offer!.excludedVariantIdList?.some(
|
|
1386
|
+
(ev) => ev === v.id
|
|
1387
|
+
);
|
|
1388
|
+
if (!v.hasStock || isVariantExcluded) return;
|
|
1375
1389
|
|
|
1376
|
-
|
|
1390
|
+
variants.push(v);
|
|
1391
|
+
});
|
|
1392
|
+
} else {
|
|
1393
|
+
variants.push(...product.variants.filter((v) => v.hasStock));
|
|
1377
1394
|
}
|
|
1378
1395
|
|
|
1379
|
-
return
|
|
1396
|
+
return variants;
|
|
1380
1397
|
};
|
|
1381
1398
|
|
|
1382
1399
|
getCampaignOfferProducts = async (
|
|
1383
1400
|
targetPage: IkasCampaignOfferTargetPageType
|
|
1384
|
-
) => {
|
|
1385
|
-
const
|
|
1386
|
-
this.
|
|
1401
|
+
): Promise<CampaignOfferType | undefined> => {
|
|
1402
|
+
const waitingForActionCampaignOffers =
|
|
1403
|
+
this.getWaitingForActionCampaignOffers(targetPage);
|
|
1387
1404
|
|
|
1388
1405
|
if (
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
)
|
|
1406
|
+
!waitingForActionCampaignOffers ||
|
|
1407
|
+
!waitingForActionCampaignOffers.length
|
|
1408
|
+
)
|
|
1409
|
+
return;
|
|
1410
|
+
|
|
1411
|
+
for (let i = 0; i < waitingForActionCampaignOffers.length; i++) {
|
|
1412
|
+
const waitingForActionCampaignOffer = waitingForActionCampaignOffers[i];
|
|
1413
|
+
|
|
1392
1414
|
const offer = this.getOffer(waitingForActionCampaignOffer);
|
|
1415
|
+
if (!offer) continue;
|
|
1393
1416
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1417
|
+
const product = await this.getProduct(offer.productId);
|
|
1418
|
+
if (!product) continue;
|
|
1396
1419
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1420
|
+
const variants: IkasProductVariant[] = this.getOfferProductVariants({
|
|
1421
|
+
offer,
|
|
1422
|
+
product,
|
|
1423
|
+
});
|
|
1424
|
+
if (!variants.length) continue;
|
|
1406
1425
|
|
|
1407
|
-
|
|
1426
|
+
return {
|
|
1427
|
+
product,
|
|
1428
|
+
variants,
|
|
1429
|
+
campaignOffer: waitingForActionCampaignOffer,
|
|
1430
|
+
offer,
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1408
1433
|
};
|
|
1409
1434
|
|
|
1410
1435
|
getCampaignOffer = async () => {
|
|
1411
|
-
this.checkoutCampaignOffer =
|
|
1436
|
+
this.checkoutCampaignOffer = await this.getCampaignOfferProducts(
|
|
1412
1437
|
IkasCampaignOfferTargetPageType.CHECKOUT
|
|
1413
|
-
)
|
|
1414
|
-
this.postCheckoutCampaignOffer =
|
|
1438
|
+
);
|
|
1439
|
+
this.postCheckoutCampaignOffer = await this.getCampaignOfferProducts(
|
|
1415
1440
|
IkasCampaignOfferTargetPageType.POST_CHECKOUT
|
|
1416
|
-
)
|
|
1441
|
+
);
|
|
1417
1442
|
};
|
|
1418
1443
|
|
|
1419
1444
|
updateCartCampaignOffer = async (props: UpdateCartCampaignOfferInput) => {
|
|
@@ -1469,6 +1494,7 @@ export type StockErrorData = {
|
|
|
1469
1494
|
|
|
1470
1495
|
export type CampaignOfferType = {
|
|
1471
1496
|
product: IkasProduct;
|
|
1497
|
+
variants: IkasProductVariant[];
|
|
1472
1498
|
campaignOffer: IkasCartCampaignOffer;
|
|
1473
1499
|
offer: IkasCampaignOfferProduct;
|
|
1474
1500
|
};
|
|
@@ -16,11 +16,16 @@ import { formatCurrency, useTranslation } from "../../../../../utils";
|
|
|
16
16
|
import SVGExternal from "../../../components/svg/external";
|
|
17
17
|
import SVGMasterCard from "../../../components/master-pass/payment-gateway/svg/master-card";
|
|
18
18
|
import { IkasPaymentGatewayAdditionalPrice } from "../../../../../models/data/payment-gateway/additional-price";
|
|
19
|
-
import
|
|
19
|
+
import dynamic from "next/dynamic";
|
|
20
20
|
import { Card as MasterPassCard } from "../../../modelMasterPass";
|
|
21
21
|
import CreditCardData from "../../../components/credit-card-form/model";
|
|
22
22
|
import CreditCardFormMasterPass from "../../../components/master-pass/credit-card-form";
|
|
23
23
|
|
|
24
|
+
//@ts-ignore
|
|
25
|
+
const StripeForm = dynamic(() =>
|
|
26
|
+
import("../../../components/stripe").then((mod) => mod.StripeForm)
|
|
27
|
+
);
|
|
28
|
+
|
|
24
29
|
type Props = {
|
|
25
30
|
vm: CheckoutViewModel;
|
|
26
31
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
IkasCartCampaignOfferStatus,
|
|
4
4
|
IkasCartCampaignOffer as ICartCampaignOffer,
|
|
5
5
|
} from "@ikas/storefront-models";
|
|
6
|
-
import { makeAutoObservable } from "mobx";
|
|
6
|
+
import { makeAutoObservable, makeObservable, observable } from "mobx";
|
|
7
7
|
import { IkasBaseModel } from "../../base";
|
|
8
8
|
import { IkasCampaignOffer } from "../../campaign-offer";
|
|
9
9
|
|
|
@@ -36,7 +36,18 @@ export class IkasCartCampaignOffer
|
|
|
36
36
|
this.targetPageTypes = data.targetPageTypes;
|
|
37
37
|
this.triggerSourceOrderLineId = data.triggerSourceOrderLineId;
|
|
38
38
|
|
|
39
|
-
makeAutoObservable(this);
|
|
39
|
+
// makeAutoObservable(this);
|
|
40
|
+
makeObservable(this, {
|
|
41
|
+
appliedOrderLineId: observable,
|
|
42
|
+
campaignOfferId: observable,
|
|
43
|
+
campaignOffer: observable,
|
|
44
|
+
campaignOfferProductId: observable,
|
|
45
|
+
offerEndDate: observable,
|
|
46
|
+
offerStartDate: observable,
|
|
47
|
+
status: observable,
|
|
48
|
+
targetPageTypes: observable,
|
|
49
|
+
triggerSourceOrderLineId: observable,
|
|
50
|
+
});
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
|
|
@@ -3,6 +3,8 @@ import { IkasBaseModel } from "../../base";
|
|
|
3
3
|
import { IkasCategoryPathItem as ICategoryPathItem } from "@ikas/storefront-models";
|
|
4
4
|
import { computed, makeObservable, observable } from "mobx";
|
|
5
5
|
import { IkasCategoryPathItemFunctions } from "@ikas/storefront-model-functions";
|
|
6
|
+
import { IkasCategoryTranslation } from "../translations";
|
|
7
|
+
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
6
8
|
|
|
7
9
|
export class IkasCategoryPathItem
|
|
8
10
|
extends IkasBaseModel
|
|
@@ -12,6 +14,7 @@ export class IkasCategoryPathItem
|
|
|
12
14
|
description: string | null;
|
|
13
15
|
imageId: string | null;
|
|
14
16
|
name: string;
|
|
17
|
+
translations?: IkasCategoryTranslation[] | null = null;
|
|
15
18
|
|
|
16
19
|
constructor(data: ICategoryPathItem) {
|
|
17
20
|
super(data);
|
|
@@ -20,6 +23,7 @@ export class IkasCategoryPathItem
|
|
|
20
23
|
this.description = data.description || null;
|
|
21
24
|
this.imageId = data.imageId || null;
|
|
22
25
|
this.name = data.name;
|
|
26
|
+
this.translations = data.translations || null;
|
|
23
27
|
|
|
24
28
|
makeObservable(this, {
|
|
25
29
|
metaData: observable,
|
|
@@ -26,6 +26,9 @@ export class IkasMerchantSettings implements IMerchantSettings {
|
|
|
26
26
|
this.address = data.address || null;
|
|
27
27
|
|
|
28
28
|
this.logo = data.logo ? new IkasImage(data.logo) : null;
|
|
29
|
+
if (!this.logo && this.logoId) {
|
|
30
|
+
this.logo = new IkasImage({ id: this.logoId, isVideo: false });
|
|
31
|
+
}
|
|
29
32
|
|
|
30
33
|
makeAutoObservable(this);
|
|
31
34
|
}
|
|
@@ -71,6 +71,8 @@ export class IkasOrderLineItem extends IkasBaseModel implements IOrderLineItem {
|
|
|
71
71
|
taxValue: observable,
|
|
72
72
|
variant: observable,
|
|
73
73
|
orderedAt: observable,
|
|
74
|
+
//@ts-ignore
|
|
75
|
+
_refundQuantity: observable,
|
|
74
76
|
|
|
75
77
|
priceWithQuantity: computed,
|
|
76
78
|
formattedPriceWithQuantity: computed,
|
|
@@ -16,7 +16,7 @@ export class IkasOrderLineVariantVariantValue
|
|
|
16
16
|
this.variantTypeId = data.variantTypeId;
|
|
17
17
|
this.variantTypeName = data.variantTypeName || null;
|
|
18
18
|
this.variantValueId = data.variantValueId;
|
|
19
|
-
this.
|
|
19
|
+
this.variantValueName = data.variantValueName || null;
|
|
20
20
|
|
|
21
21
|
makeAutoObservable(this);
|
|
22
22
|
}
|
|
@@ -160,7 +160,7 @@ export class IkasApplicableProductFilterValue
|
|
|
160
160
|
resultCount?: number | null;
|
|
161
161
|
|
|
162
162
|
// Extra
|
|
163
|
-
|
|
163
|
+
isSelected: boolean;
|
|
164
164
|
|
|
165
165
|
constructor(data: IApplicableProductFilterValue) {
|
|
166
166
|
this.id = data.id || "";
|
|
@@ -174,7 +174,7 @@ export class IkasApplicableProductFilterValue
|
|
|
174
174
|
isVideo: false,
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
this.
|
|
177
|
+
this.isSelected = data.isSelected || false;
|
|
178
178
|
this.resultCount =
|
|
179
179
|
data.resultCount !== undefined && data.resultCount !== null
|
|
180
180
|
? data.resultCount
|
|
@@ -182,17 +182,6 @@ export class IkasApplicableProductFilterValue
|
|
|
182
182
|
|
|
183
183
|
makeAutoObservable(this);
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
get isSelected() {
|
|
187
|
-
return this._isSelected;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
toJSON() {
|
|
191
|
-
return {
|
|
192
|
-
...this,
|
|
193
|
-
isSelected: this._isSelected,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
185
|
}
|
|
197
186
|
|
|
198
187
|
export class IkasProductFilterValue implements IProductFilterValue {
|
|
@@ -216,12 +205,14 @@ export class IkasProductFilterSettings implements IProductFilterSettings {
|
|
|
216
205
|
showCollapsedOnDesktop: boolean;
|
|
217
206
|
showCollapsedOnMobile: boolean;
|
|
218
207
|
sortType: IkasProductFilterSortType;
|
|
208
|
+
customSortedValues: string[] | null;
|
|
219
209
|
|
|
220
210
|
constructor(data: Partial<IkasProductFilterSettings>) {
|
|
221
211
|
this.useAndFilter = data.useAndFilter || false;
|
|
222
212
|
this.showCollapsedOnDesktop = data.showCollapsedOnDesktop || false;
|
|
223
213
|
this.showCollapsedOnMobile = data.showCollapsedOnMobile || false;
|
|
224
214
|
this.sortType = data.sortType || IkasProductFilterSortType.ALPHABETICAL_ASC;
|
|
215
|
+
this.customSortedValues = data.customSortedValues || null;
|
|
225
216
|
|
|
226
217
|
makeAutoObservable(this);
|
|
227
218
|
}
|
|
@@ -294,7 +294,7 @@ export class IkasCustomerStore {
|
|
|
294
294
|
const favoriteProductsResponse =
|
|
295
295
|
await CustomerStoreAPI.listFavoriteProducts();
|
|
296
296
|
if (
|
|
297
|
-
favoriteProductsResponse.isSuccess ||
|
|
297
|
+
!favoriteProductsResponse.isSuccess ||
|
|
298
298
|
!favoriteProductsResponse.data?.length
|
|
299
299
|
)
|
|
300
300
|
return [];
|
package/src/utils/constants.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const FREE_TEXT_CITY_COUNTRY_LIST = ["DE", "US"];
|
|
1
|
+
export const FREE_TEXT_CITY_COUNTRY_LIST = ["DE", "US", "AT"];
|
|
2
2
|
export const DISTRICT_HIDDEN_COUNTRY_LIST = ["US"];
|