@ikas/storefront 0.2.0-alpha.3 → 0.2.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.
Files changed (31) hide show
  1. package/build/__generated__/global-types.d.ts +22 -0
  2. package/build/analytics/ikas.d.ts +18 -11
  3. package/build/api/back-in-stock-reminder/__generated__/listProductBackInStockRemind.d.ts +24 -0
  4. package/build/api/back-in-stock-reminder/__generated__/saveProductBackInStockRemind.d.ts +19 -0
  5. package/build/api/back-in-stock-reminder/index.d.ts +23 -0
  6. package/build/api/customer-review/__generated__/createCustomerReview.d.ts +11 -0
  7. package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +25 -0
  8. package/build/api/customer-review/index.d.ts +24 -0
  9. package/build/api/index.d.ts +2 -0
  10. package/build/components/checkout/components/address-form/model.d.ts +8 -0
  11. package/build/index.css +9 -4
  12. package/build/index.es.css +9 -4
  13. package/build/index.es.js +822 -61
  14. package/build/index.js +826 -60
  15. package/build/models/data/customer-review/index.d.ts +23 -0
  16. package/build/models/data/customer-review-settings/index.d.ts +4 -0
  17. package/build/models/data/index.d.ts +2 -0
  18. package/build/models/data/order/address/index.d.ts +2 -0
  19. package/build/models/data/payment-gateway/index.d.ts +2 -0
  20. package/build/models/data/product/index.d.ts +1 -0
  21. package/build/models/data/product/variant/index.d.ts +7 -0
  22. package/build/models/data/product-back-in-stock-settings/index.d.ts +3 -0
  23. package/build/models/ui/customer-review-list/index.d.ts +43 -0
  24. package/build/models/ui/index.d.ts +2 -0
  25. package/build/models/ui/product-detail/index.d.ts +4 -1
  26. package/build/models/ui/validator/form/customer-review.d.ts +37 -0
  27. package/build/providers/page-data-get.d.ts +2 -0
  28. package/build/providers/page-data-next.d.ts +18 -2
  29. package/build/store/customer.d.ts +7 -0
  30. package/build/storefront/index.d.ts +6 -0
  31. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ export declare class IkasCustomerReview {
2
+ comment: string;
3
+ createdAt: string;
4
+ customerId: string;
5
+ deleted: boolean;
6
+ id: string;
7
+ orderId: string;
8
+ orderNumber: string;
9
+ productId: string;
10
+ salesChannelId: string;
11
+ star: number;
12
+ status: CustomerReviewStatusEnum;
13
+ storefrontId: string;
14
+ title: string;
15
+ updatedAt: string;
16
+ constructor(data: Partial<IkasCustomerReview>);
17
+ }
18
+ declare enum CustomerReviewStatusEnum {
19
+ APPROVED = "APPROVED",
20
+ REJECTED = "REJECTED",
21
+ WAITING = "WAITING"
22
+ }
23
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare type IkasCustomerReviewSettings = {
2
+ customerLoginRequired: boolean;
3
+ customerPurchaseRequired: boolean;
4
+ };
@@ -5,6 +5,8 @@ export * from "./checkout/index";
5
5
  export type { IkasCity } from "./city/index";
6
6
  export * from "./customer/address/index";
7
7
  export { IkasCustomer } from "./customer/index";
8
+ export { IkasCustomerReview } from "./customer-review/index";
9
+ export type { IkasCustomerReviewSettings } from "./customer-review-settings/index";
8
10
  export type { IkasCountry } from "./country/index";
9
11
  export type { IkasDistrict } from "./district/index";
10
12
  export { IkasHTMLMetaData, IkasHTMLMetaDataTargetType } from "./html-meta-data/index";
@@ -29,6 +29,8 @@ declare type IkasOrderAddressLocation = {
29
29
  id?: string;
30
30
  name?: string;
31
31
  code?: string;
32
+ iso2?: string;
33
+ iso3?: string;
32
34
  };
33
35
  export declare type IkasOrderAddressCountry = IkasOrderAddressLocation;
34
36
  export declare type IkasOrderAddressCity = IkasOrderAddressLocation;
@@ -11,6 +11,8 @@ export declare class IkasPaymentGateway {
11
11
  description: string | null;
12
12
  additionalPrices: IkasPaymentGatewayAdditionalPrice[] | null;
13
13
  translations: IkasPaymentGatewayTranslation[] | null;
14
+ supportedCurrencies: string[];
15
+ availableCountries: string[];
14
16
  constructor(data: Partial<IkasPaymentGateway>);
15
17
  getCalculatedAdditionalPrices(totalFinalPrice: number, shippingLines: IkasOrderShippingLine[] | null): {
16
18
  name: string;
@@ -23,6 +23,7 @@ export declare class IkasProduct {
23
23
  productOptionSet?: IkasProductOptionSet | null;
24
24
  constructor(data?: Partial<IkasProduct>);
25
25
  get hasVariant(): boolean;
26
+ get hasStock(): boolean;
26
27
  get mainVariantType(): import("../index").IkasVariantType | undefined;
27
28
  get href(): string;
28
29
  }
@@ -12,6 +12,13 @@ export declare class IkasProductVariant {
12
12
  price: IkasProductPrice;
13
13
  stock: number;
14
14
  isActive: boolean;
15
+ productId: string;
16
+ private _backInStockReminderSaved;
15
17
  constructor(data?: Partial<IkasProductVariant>);
16
18
  get mainImage(): IkasImage | undefined;
19
+ get hasStock(): boolean;
20
+ get isBackInStockEnabled(): boolean;
21
+ get isBackInStockCustomerLoginRequired(): boolean | null;
22
+ get isBackInStockReminderSaved(): boolean;
23
+ saveBackInStockReminder(email: string): Promise<boolean>;
17
24
  }
@@ -0,0 +1,3 @@
1
+ export declare type IkasProductBackInStockSettings = {
2
+ customerLoginRequired: boolean;
3
+ };
@@ -0,0 +1,43 @@
1
+ import { IkasCustomerReview } from "../../data/customer-review/index";
2
+ export declare class IkasCustomerReviewList {
3
+ data: IkasCustomerReview[];
4
+ private _limit;
5
+ private _page;
6
+ private _count;
7
+ private _initialized;
8
+ private _minPage?;
9
+ private _productId;
10
+ private _isLoading;
11
+ constructor(data: IkasCustomerReviewListParams);
12
+ get limit(): number;
13
+ get page(): number;
14
+ get count(): number;
15
+ get pageCount(): number;
16
+ get isInitialized(): boolean;
17
+ get hasPrev(): boolean;
18
+ get hasNext(): boolean;
19
+ get isLoading(): boolean;
20
+ private listCustomerReviews;
21
+ private getInitial;
22
+ getPrev: () => Promise<void>;
23
+ getNext: () => Promise<void>;
24
+ getPage: (page: number) => Promise<void>;
25
+ toJSON(): {
26
+ data: IkasCustomerReview[];
27
+ limit: number;
28
+ page: number;
29
+ count: number;
30
+ initialized: boolean;
31
+ minPage: number | null | undefined;
32
+ productId: string;
33
+ };
34
+ }
35
+ export declare type IkasCustomerReviewListParams = {
36
+ data?: IkasCustomerReview[];
37
+ limit?: number;
38
+ page?: number;
39
+ count?: number;
40
+ initialized?: boolean;
41
+ minPage?: number;
42
+ productId: string;
43
+ };
@@ -8,6 +8,7 @@ export { IkasProductDetail, IkasDisplayedVariantType, IkasDisplayedVariantValue,
8
8
  export { IkasProductList, IkasProductListType, IkasProductListSortType, } from "./product-list/index";
9
9
  export * from "./product-attribute-detail/index";
10
10
  export * from "./product-attribute-list/index";
11
+ export * from "./customer-review-list/index";
11
12
  export { Validator, ValidationStatus } from "./validator/index";
12
13
  export * from "./validator/rules/index";
13
14
  export { LoginForm } from "./validator/form/login";
@@ -17,4 +18,5 @@ export { ContactForm } from "./validator/form/contact-form";
17
18
  export { ForgotPasswordForm } from "./validator/form/forgot-password";
18
19
  export { RecoverPasswordForm } from "./validator/form/recover-password";
19
20
  export { AccountInfoForm } from "./validator/form/account-info";
21
+ export { CustomerReviewForm } from "./validator/form/customer-review";
20
22
  export * from "./component-renderer/index";
@@ -1,4 +1,4 @@
1
- import { IkasProduct, IkasVariantValue } from "../../index";
1
+ import { IkasProduct, IkasVariantValue, IkasCustomerReviewList } from "../../index";
2
2
  import { NextRouter } from "next/router";
3
3
  import { IkasProductVariant, IkasVariantType } from "../../data/index";
4
4
  export declare class IkasProductDetail {
@@ -11,6 +11,9 @@ export declare class IkasProductDetail {
11
11
  get href(): string;
12
12
  get hasStock(): boolean;
13
13
  get displayedVariantTypes(): IkasDisplayedVariantType[];
14
+ get isCustomerReviewEnabled(): boolean;
15
+ get isCustomerReviewLoginRequired(): boolean;
16
+ getCustomerReviews(): Promise<IkasCustomerReviewList>;
14
17
  selectVariantValue(variantValue: IkasVariantValue): void;
15
18
  }
16
19
  export declare type IkasDisplayedVariantValue = {
@@ -0,0 +1,37 @@
1
+ import { IkasBaseStore } from "../../../../store/index";
2
+ declare type CustomerReviewFormProps<T> = {
3
+ productId: string;
4
+ message: {
5
+ starRule: ((model: T) => string) | string;
6
+ };
7
+ store: IkasBaseStore;
8
+ };
9
+ declare type CustomerReviewFormModel = {
10
+ title: string;
11
+ comment: string;
12
+ star: number;
13
+ };
14
+ export declare class CustomerReviewForm {
15
+ private productId;
16
+ private model;
17
+ private validator;
18
+ private store;
19
+ constructor(props: CustomerReviewFormProps<CustomerReviewFormModel>);
20
+ get title(): string;
21
+ set title(value: string);
22
+ get comment(): string;
23
+ set comment(value: string);
24
+ get star(): number;
25
+ set star(value: number);
26
+ get hasError(): boolean;
27
+ get starErrorMessage(): string | undefined;
28
+ onTitleChange: (value: string) => void;
29
+ onCommentChange: (value: string) => void;
30
+ onStarChange: (value: number) => void;
31
+ validateAll(): Promise<boolean>;
32
+ submit(): Promise<{
33
+ isFormError: boolean;
34
+ isSuccess: boolean;
35
+ }>;
36
+ }
37
+ export {};
@@ -35,6 +35,8 @@ export declare class IkasPageDataProvider {
35
35
  stockPreference: import("../models/theme/settings/index").IkasThemeStockPreference;
36
36
  storefrontJSScripts: string[];
37
37
  translations: Record<string, any>;
38
+ customerReviewSettings: import("../models/index").IkasCustomerReviewSettings | null;
39
+ productBackInStockSettings: any;
38
40
  };
39
41
  };
40
42
  };
@@ -1,16 +1,17 @@
1
1
  /// <reference types="node" />
2
2
  import { GetServerSidePropsContext, GetStaticPropsContext } from "next";
3
3
  import { ParsedUrlQuery } from "querystring";
4
- import { IkasTheme, IkasThemePageType } from "../models/index";
4
+ import { IkasTheme, IkasThemePageType, IkasCustomerReviewSettings } from "../models/index";
5
5
  import { IkasStorefront } from "../models/data/storefront/index";
6
6
  import { IkasSalesChannel } from "../models/data/sales-channel/index";
7
7
  import { IkasStorefrontRouting } from "../models/data/storefront/routing/index";
8
8
  import { IkasStorefrontThemeLocalization } from "../models/data/storefront/theme-localization/index";
9
9
  import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon/index";
10
10
  import { IkasThemeSettings, IkasThemeStockPreference } from "../models/theme/settings/index";
11
+ import { IkasProductBackInStockSettings } from "../models/data/product-back-in-stock-settings/index";
11
12
  export declare class IkasNextPageDataProvider {
12
13
  static readLocalTheme(): Promise<IkasTheme>;
13
- static readSettingsFile(): Promise<any>;
14
+ static readSettingsFile(): Promise<SettingsData | null>;
14
15
  static getSettings(locale: string): Promise<SettingsData | null>;
15
16
  static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[], isEditor?: boolean): Promise<{
16
17
  props: {};
@@ -41,6 +42,8 @@ export declare class IkasNextPageDataProvider {
41
42
  stockPreference: IkasThemeStockPreference;
42
43
  storefrontJSScripts: string[];
43
44
  translations: Record<string, any>;
45
+ customerReviewSettings: IkasCustomerReviewSettings | null;
46
+ productBackInStockSettings: any;
44
47
  };
45
48
  };
46
49
  notFound?: undefined;
@@ -70,6 +73,8 @@ export declare class IkasNextPageDataProvider {
70
73
  stockPreference: IkasThemeStockPreference;
71
74
  storefrontJSScripts: string[];
72
75
  translations: Record<string, any>;
76
+ customerReviewSettings: IkasCustomerReviewSettings | null;
77
+ productBackInStockSettings: any;
73
78
  };
74
79
  };
75
80
  revalidate: number;
@@ -108,6 +113,8 @@ export declare class IkasNextPageDataProvider {
108
113
  stockPreference: IkasThemeStockPreference;
109
114
  storefrontJSScripts: string[];
110
115
  translations: Record<string, any>;
116
+ customerReviewSettings: IkasCustomerReviewSettings | null;
117
+ productBackInStockSettings: any;
111
118
  };
112
119
  };
113
120
  notFound?: undefined;
@@ -137,6 +144,8 @@ export declare class IkasNextPageDataProvider {
137
144
  stockPreference: IkasThemeStockPreference;
138
145
  storefrontJSScripts: string[];
139
146
  translations: Record<string, any>;
147
+ customerReviewSettings: IkasCustomerReviewSettings | null;
148
+ productBackInStockSettings: any;
140
149
  };
141
150
  };
142
151
  revalidate: number;
@@ -175,6 +184,8 @@ export declare class IkasNextPageDataProvider {
175
184
  stockPreference: IkasThemeStockPreference;
176
185
  storefrontJSScripts: string[];
177
186
  translations: Record<string, any>;
187
+ customerReviewSettings: IkasCustomerReviewSettings | null;
188
+ productBackInStockSettings: any;
178
189
  };
179
190
  };
180
191
  notFound?: undefined;
@@ -204,6 +215,8 @@ export declare class IkasNextPageDataProvider {
204
215
  stockPreference: IkasThemeStockPreference;
205
216
  storefrontJSScripts: string[];
206
217
  translations: Record<string, any>;
218
+ customerReviewSettings: IkasCustomerReviewSettings | null;
219
+ productBackInStockSettings: any;
207
220
  };
208
221
  };
209
222
  revalidate: number;
@@ -220,8 +233,11 @@ export declare type SettingsData = {
220
233
  themeLocalization: IkasStorefrontThemeLocalization;
221
234
  salesChannel: IkasSalesChannel;
222
235
  routing: IkasStorefrontRouting;
236
+ localizationMap?: Record<string, any>;
223
237
  favicon: IkasThemeFavicon;
224
238
  stockPreference: IkasThemeStockPreference;
225
239
  storefrontJSScripts: string[];
226
240
  domain: string;
241
+ productBackInStockSettings: IkasProductBackInStockSettings | null;
242
+ customerReviewSettings: IkasCustomerReviewSettings | null;
227
243
  };
@@ -36,6 +36,7 @@ export declare class IkasCustomerStore {
36
36
  removeItemFromFavorite: (productId: string) => Promise<boolean>;
37
37
  isProductFavorite: (productId: string) => Promise<boolean>;
38
38
  createEmailSubscription: (email: string) => Promise<boolean>;
39
+ sendReview: (input: IkasCustomerReviewForm) => Promise<false | import("../api/customer-review/__generated__/createCustomerReview").createCustomerReview_createCustomerReview | undefined>;
39
40
  onCustomerConsentGrant: () => void;
40
41
  waitUntilInitialized: () => Promise<unknown>;
41
42
  private init;
@@ -63,3 +64,9 @@ export declare type IkasContactForm = {
63
64
  email: string;
64
65
  message: string;
65
66
  };
67
+ export declare type IkasCustomerReviewForm = {
68
+ comment?: string;
69
+ productId: string;
70
+ star: number;
71
+ title?: string;
72
+ };
@@ -1,8 +1,10 @@
1
+ import { IkasProductBackInStockSettings } from "../models/data/product-back-in-stock-settings/index";
1
2
  import { IkasSalesChannelPaymentGateway } from "../models/data/sales-channel/index";
2
3
  import { IkasStorefrontRouting } from "../models/data/storefront/routing/index";
3
4
  import { IkasThemeStockPreference } from "../models/theme/settings/index";
4
5
  import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon/index";
5
6
  import { IkasBaseStore } from "../store/index";
7
+ import { IkasCustomerReviewSettings } from "../models/index";
6
8
  export declare class IkasStorefrontConfig {
7
9
  static store: IkasBaseStore;
8
10
  static components: any;
@@ -24,6 +26,8 @@ export declare class IkasStorefrontConfig {
24
26
  static translations: Record<string, any>;
25
27
  static storefrontJSScripts: string[];
26
28
  static isEditor: boolean;
29
+ static customerReviewSettings: IkasCustomerReviewSettings | null;
30
+ static productBackInStockSettings: IkasProductBackInStockSettings | null;
27
31
  static init(store: IkasBaseStore, components: any, config: Record<string, any>, apiUrlOverride?: string): void;
28
32
  static initWithJson(json: Record<string, any>): void;
29
33
  static getCurrentLocale(): string;
@@ -43,5 +47,7 @@ export declare class IkasStorefrontConfig {
43
47
  stockPreference: IkasThemeStockPreference;
44
48
  storefrontJSScripts: string[];
45
49
  translations: Record<string, any>;
50
+ customerReviewSettings: IkasCustomerReviewSettings | null;
51
+ productBackInStockSettings: any;
46
52
  };
47
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.2.0-alpha.3",
3
+ "version": "0.2.0-alpha.5",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",