@ikas/storefront 4.0.0-alpha.43 → 4.0.0-alpha.44
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/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 +11 -26
- package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +53 -13
- package/src/components/checkout/components/cart-summary/index.tsx +23 -16
- package/src/components/checkout/components/cart-summary/style.module.scss +48 -3
- package/src/components/checkout/components/customer-addresses/index.tsx +1 -0
- 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/index.tsx +14 -7
- package/src/components/checkout/model.ts +126 -37
- 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 +5 -1
- package/src/components/checkout/steps/step-success/index.tsx +5 -3
- package/src/components/page-editor/ThemeComponentEditor.tsx +4 -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/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 +42 -5
- 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/product/attribute-value/index.ts +40 -0
- package/src/models/data/product/base-unit/index.ts +19 -0
- package/src/models/data/product/index.ts +5 -0
- package/src/models/data/product/variant/index.ts +3 -0
- package/src/models/data/product/variant/unit/index.ts +17 -0
- package/src/models/data/raffle/index.ts +2 -2
- package/src/models/data/storefront/routing/index.tsx +4 -0
- package/src/models/data/category/init.ts +0 -33
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IkasProductUnitType,
|
|
3
|
+
IkasProductBaseUnit as IProductBaseUnit,
|
|
4
|
+
} from "@ikas/storefront-models";
|
|
5
|
+
import { makeAutoObservable } from "mobx";
|
|
6
|
+
|
|
7
|
+
export class IkasProductBaseUnit implements IProductBaseUnit {
|
|
8
|
+
baseAmount: number | null;
|
|
9
|
+
type: IkasProductUnitType;
|
|
10
|
+
unitId: string | null;
|
|
11
|
+
|
|
12
|
+
constructor(data: IProductBaseUnit) {
|
|
13
|
+
this.baseAmount = data.baseAmount;
|
|
14
|
+
this.type = data.type;
|
|
15
|
+
this.unitId = data.unitId;
|
|
16
|
+
|
|
17
|
+
makeAutoObservable(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -25,6 +25,7 @@ import { IkasVariantType } from "../variant-type";
|
|
|
25
25
|
import { IkasBaseStore } from "../../../store/base";
|
|
26
26
|
import { IkasProductAttributeMap } from "./attribute-value";
|
|
27
27
|
import _groupBy from "lodash/groupBy";
|
|
28
|
+
import { IkasProductBaseUnit } from "./base-unit";
|
|
28
29
|
|
|
29
30
|
export class IkasProduct implements IProduct {
|
|
30
31
|
id: string;
|
|
@@ -40,6 +41,7 @@ export class IkasProduct implements IProduct {
|
|
|
40
41
|
attributes: IkasProductAttributeValue[];
|
|
41
42
|
variantTypes: IkasProductVariantType[];
|
|
42
43
|
productOptionSetId: string | null = null;
|
|
44
|
+
baseUnit: IkasProductBaseUnit | null;
|
|
43
45
|
|
|
44
46
|
// Extra
|
|
45
47
|
productOptionSet?: IkasProductOptionSet | null = null;
|
|
@@ -71,6 +73,9 @@ export class IkasProduct implements IProduct {
|
|
|
71
73
|
? data.variantTypes.map((v) => new IkasProductVariantType(v))
|
|
72
74
|
: [];
|
|
73
75
|
this.productOptionSetId = data.productOptionSetId || null;
|
|
76
|
+
this.baseUnit = data.baseUnit
|
|
77
|
+
? new IkasProductBaseUnit(data.baseUnit)
|
|
78
|
+
: null;
|
|
74
79
|
|
|
75
80
|
this.productOptionSet = data.productOptionSet
|
|
76
81
|
? new IkasProductOptionSet(data.productOptionSet)
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
saveProductBackInStockRemind,
|
|
16
16
|
} from "@ikas/storefront-api";
|
|
17
17
|
import _groupBy from "lodash/groupBy";
|
|
18
|
+
import { IkasProductVariantUnit } from "./unit";
|
|
18
19
|
|
|
19
20
|
export class IkasProductVariant implements IProductVariant {
|
|
20
21
|
id: string;
|
|
@@ -29,6 +30,7 @@ export class IkasProductVariant implements IProductVariant {
|
|
|
29
30
|
sellIfOutOfStock: boolean;
|
|
30
31
|
images: IkasProductImage[] | null;
|
|
31
32
|
campaigns?: IkasProductCampaign[];
|
|
33
|
+
unit: IkasProductVariantUnit | null;
|
|
32
34
|
private _backInStockReminderSaved = false;
|
|
33
35
|
|
|
34
36
|
constructor(data: Partial<IProductVariant> = {}) {
|
|
@@ -51,6 +53,7 @@ export class IkasProductVariant implements IProductVariant {
|
|
|
51
53
|
this.stock = data.stock || 0;
|
|
52
54
|
this.isActive = data.isActive !== undefined ? data.isActive : true;
|
|
53
55
|
this.campaigns = data.campaigns || [];
|
|
56
|
+
this.unit = data.unit ? new IkasProductVariantUnit(data.unit) : null;
|
|
54
57
|
this.sellIfOutOfStock = data.sellIfOutOfStock || false;
|
|
55
58
|
|
|
56
59
|
makeAutoObservable(this);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IkasProductUnitType,
|
|
3
|
+
IkasProductVariantUnit as IProductVariantUnit,
|
|
4
|
+
} from "@ikas/storefront-models";
|
|
5
|
+
import { makeAutoObservable } from "mobx";
|
|
6
|
+
|
|
7
|
+
export class IkasProductVariantUnit implements IProductVariantUnit {
|
|
8
|
+
amount: number | null;
|
|
9
|
+
type: IkasProductUnitType;
|
|
10
|
+
|
|
11
|
+
constructor(data: IProductVariantUnit) {
|
|
12
|
+
this.amount = data.amount;
|
|
13
|
+
this.type = data.type;
|
|
14
|
+
|
|
15
|
+
makeAutoObservable(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -113,7 +113,7 @@ export class IkasRaffleParticipant implements IRaffleParticipant {
|
|
|
113
113
|
phone: string | null = null;
|
|
114
114
|
isDeliveredCargo: boolean | null;
|
|
115
115
|
|
|
116
|
-
raffle: IkasRaffle;
|
|
116
|
+
raffle: IkasRaffle | null;
|
|
117
117
|
status: IkasRaffleParticipantStatus | null;
|
|
118
118
|
extraData: Record<string, any> | null = null;
|
|
119
119
|
appliedProduct: IkasRaffleAppliedProduct;
|
|
@@ -133,7 +133,7 @@ export class IkasRaffleParticipant implements IRaffleParticipant {
|
|
|
133
133
|
this.phone = data.phone || null;
|
|
134
134
|
this.isDeliveredCargo = data.isDeliveredCargo || false;
|
|
135
135
|
|
|
136
|
-
this.raffle = new IkasRaffle(data.raffle);
|
|
136
|
+
this.raffle = data.raffle ? new IkasRaffle(data.raffle) : null;
|
|
137
137
|
this.status = data.status || null;
|
|
138
138
|
this.extraData = data.extraData || {};
|
|
139
139
|
this.appliedProduct = new IkasRaffleAppliedProduct(
|
|
@@ -10,6 +10,8 @@ export class IkasStorefrontRouting implements IStorefrontRouting {
|
|
|
10
10
|
path: string | null;
|
|
11
11
|
priceListId: string | null;
|
|
12
12
|
dynamicCurrencySettings: IkasStorefrontDynamicCurrencySettings | null;
|
|
13
|
+
currencyCode: string | null;
|
|
14
|
+
currencySymbol: string | null;
|
|
13
15
|
|
|
14
16
|
constructor(data: IStorefrontRouting) {
|
|
15
17
|
this.id = data.id;
|
|
@@ -19,6 +21,8 @@ export class IkasStorefrontRouting implements IStorefrontRouting {
|
|
|
19
21
|
this.path = data.path;
|
|
20
22
|
this.priceListId = data.priceListId;
|
|
21
23
|
this.dynamicCurrencySettings = data.dynamicCurrencySettings;
|
|
24
|
+
this.currencyCode = data.currencyCode;
|
|
25
|
+
this.currencySymbol = data.currencySymbol;
|
|
22
26
|
|
|
23
27
|
makeAutoObservable(this);
|
|
24
28
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IkasCategory } from ".";
|
|
2
|
-
import { IkasCategoryTranslation } from "./translations";
|
|
3
|
-
import { initIkasHTMLMetaData } from "../html-meta-data/init";
|
|
4
|
-
|
|
5
|
-
export function initIkasCategory(
|
|
6
|
-
category: IkasCategory,
|
|
7
|
-
locale: string | null
|
|
8
|
-
) {
|
|
9
|
-
category.image = category.imageId
|
|
10
|
-
? { id: category.imageId, isVideo: false }
|
|
11
|
-
: undefined;
|
|
12
|
-
|
|
13
|
-
category.metaData && initIkasHTMLMetaData(category.metaData, locale);
|
|
14
|
-
|
|
15
|
-
if (category.translations && locale) {
|
|
16
|
-
setTranslations(category, category.translations, locale);
|
|
17
|
-
delete category.translations;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function setTranslations(
|
|
22
|
-
category: IkasCategory,
|
|
23
|
-
translations: IkasCategoryTranslation[],
|
|
24
|
-
locale: string
|
|
25
|
-
) {
|
|
26
|
-
if (translations && translations.some((t) => t.locale === locale)) {
|
|
27
|
-
const localeTranslations = translations.find((t) => t.locale === locale);
|
|
28
|
-
|
|
29
|
-
if (localeTranslations?.name) category.name = localeTranslations.name;
|
|
30
|
-
if (localeTranslations?.description)
|
|
31
|
-
category.description = localeTranslations.description;
|
|
32
|
-
}
|
|
33
|
-
}
|