@ikas/storefront 4.0.0-alpha.33 → 4.0.0-alpha.35

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.0.0-alpha.33",
3
+ "version": "4.0.0-alpha.35",
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.33",
28
- "@ikas/storefront-config": "^4.0.0-alpha.33",
29
- "@ikas/storefront-model-functions": "^4.0.0-alpha.33",
30
- "@ikas/storefront-models": "^4.0.0-alpha.33",
31
- "@ikas/storefront-providers": "^4.0.0-alpha.33",
27
+ "@ikas/storefront-api": "^4.0.0-alpha.35",
28
+ "@ikas/storefront-config": "^4.0.0-alpha.35",
29
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.35",
30
+ "@ikas/storefront-models": "^4.0.0-alpha.35",
31
+ "@ikas/storefront-providers": "^4.0.0-alpha.35",
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.33",
56
- "@ikas/storefront-config": "^4.0.0-alpha.33",
57
- "@ikas/storefront-model-functions": "^4.0.0-alpha.33",
58
- "@ikas/storefront-models": "^4.0.0-alpha.33",
59
- "@ikas/storefront-providers": "^4.0.0-alpha.33",
55
+ "@ikas/storefront-api": "^4.0.0-alpha.35",
56
+ "@ikas/storefront-config": "^4.0.0-alpha.35",
57
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.35",
58
+ "@ikas/storefront-models": "^4.0.0-alpha.35",
59
+ "@ikas/storefront-providers": "^4.0.0-alpha.35",
60
60
  "mobx": "^6.1.3",
61
61
  "mobx-react-lite": "^3.1.5",
62
62
  "next": "12.2.0",
@@ -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
- height: 100%;
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
+ }
@@ -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
  }
@@ -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
- height: 100%;
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
- <div
372
- className={styles.EditBtn}
373
- onClick={vm.onBackToShippingClick}
374
- >
375
- {t("checkout-page:actions.edit")}
376
- </div>
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 ? (
@@ -762,6 +762,8 @@ export default class CheckoutViewModel {
762
762
  const newCart = await this.saveCart();
763
763
 
764
764
  if (newCart) this.checkout = new IkasCheckout(newCart);
765
+ if (this.checkout.shippingAddress)
766
+ this.checkout.shippingAddress.checkoutSettings = this.checkoutSettings;
765
767
  this.isChangingShippingMethod = false;
766
768
  };
767
769
 
@@ -986,6 +988,9 @@ export default class CheckoutViewModel {
986
988
  customer.addresses.push(newAddress);
987
989
 
988
990
  await this.store.customerStore.saveCustomer(customer);
991
+ this.store.customerStore.customer.addresses?.forEach(
992
+ (address) => (address.checkoutSettings = this.checkoutSettings)
993
+ );
989
994
 
990
995
  if (type === "shipping") {
991
996
  this.checkout.shippingAddress!.id = newAddress.id;
@@ -48,7 +48,12 @@ export const CheckoutStepPayment: React.FC<Props> = observer(({ vm }) => {
48
48
  const policyLabel = policyInputData.map((p) =>
49
49
  p.isVariable ? (
50
50
  <span
51
- className={styles.TermsLabelSpan}
51
+ className={[
52
+ styles.TermsLabelSpan,
53
+ vm.isErrorsVisible && !vm.isTermsAndConditionsChecked
54
+ ? styles.Error
55
+ : "",
56
+ ].join(" ")}
52
57
  onClick={
53
58
  p.value === "{{ ackPrivacyPolicy }}"
54
59
  ? onShowPrivacyPolicyClick
@@ -5,12 +5,17 @@
5
5
 
6
6
  .TermsLabelSpan {
7
7
  color: $primaryTextColor;
8
+ font-weight: 500;
8
9
 
9
10
  &:hover {
10
11
  text-decoration: underline;
11
12
  }
12
13
  }
13
14
 
15
+ .Error {
16
+ color: $errorColor;
17
+ }
18
+
14
19
  .SecurePaymentContainer {
15
20
  width: 100%;
16
21
  display: flex;
@@ -627,10 +627,7 @@ export default class IkasPageEditorViewModel {
627
627
  prop
628
628
  );
629
629
 
630
- if (
631
- propValue &&
632
- (propValue.linkType || JSON.stringify(propValue)?.includes("linkType"))
633
- )
630
+ if (propValue && JSON.stringify(propValue).includes("href"))
634
631
  await this.pageDataProvider.setLinkSlugs();
635
632
 
636
633
  pageComponentPropValues.propValues[propName] =
@@ -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
 
@@ -20,6 +20,10 @@ export class IkasCheckout extends IkasCart implements ICheckout {
20
20
  constructor(data: Partial<IkasCheckoutConstructorData>) {
21
21
  super(data);
22
22
 
23
+ this.appliedCouponCode = data.couponCode;
24
+ this.selectedPaymentGateway = data.selectedPaymentGateway;
25
+ this.masterPassPaymentGateway = data.masterPassPaymentGateway;
26
+
23
27
  makeObservable(this, {
24
28
  appliedCouponCode: observable,
25
29
  selectedPaymentGateway: 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
  }
@@ -94,6 +94,8 @@ export class IkasOrder extends IkasBaseModel implements IOrder {
94
94
  this.shippingAddress = data.shippingAddress
95
95
  ? new IkasOrderAddress(data.shippingAddress)
96
96
  : null;
97
+ this.shippingLines =
98
+ data.shippingLines?.map((sl) => new IkasOrderShippingLine(sl)) || null;
97
99
  this.shippingMethod =
98
100
  data.shippingMethod || IkasOrderShippingMethod.SHIPMENT;
99
101
  this.status = data.status || IkasOrderStatus.CREATED;
@@ -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.variantTypeName = data.variantTypeName || null;
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
- private _isSelected: boolean;
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._isSelected = data.isSelected || false;
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 {
@@ -1,6 +1,6 @@
1
1
  import { IkasBaseModel } from "../base";
2
2
  import { IkasState as IState } from "@ikas/storefront-models";
3
- import { makeAutoObservable } from "mobx";
3
+ import { makeObservable, observable } from "mobx";
4
4
 
5
5
  export class IkasState extends IkasBaseModel implements IState {
6
6
  countryId: string;
@@ -13,6 +13,10 @@ export class IkasState extends IkasBaseModel implements IState {
13
13
  this.name = data.name;
14
14
  this.stateCode = data.stateCode;
15
15
 
16
- makeAutoObservable(this);
16
+ makeObservable(this, {
17
+ countryId: observable,
18
+ name: observable,
19
+ stateCode: observable,
20
+ });
17
21
  }
18
22
  }
@@ -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 [];