@ikas/storefront 4.0.0-alpha.21 → 4.0.0-alpha.23

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.21",
3
+ "version": "4.0.0-alpha.23",
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.21",
28
- "@ikas/storefront-config": "^4.0.0-alpha.21",
29
- "@ikas/storefront-model-functions": "^4.0.0-alpha.21",
30
- "@ikas/storefront-models": "^4.0.0-alpha.21",
31
- "@ikas/storefront-providers": "^4.0.0-alpha.21",
27
+ "@ikas/storefront-api": "^4.0.0-alpha.23",
28
+ "@ikas/storefront-config": "^4.0.0-alpha.23",
29
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.23",
30
+ "@ikas/storefront-models": "^4.0.0-alpha.23",
31
+ "@ikas/storefront-providers": "^4.0.0-alpha.23",
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.21",
56
- "@ikas/storefront-config": "^4.0.0-alpha.21",
57
- "@ikas/storefront-model-functions": "^4.0.0-alpha.21",
58
- "@ikas/storefront-models": "^4.0.0-alpha.21",
59
- "@ikas/storefront-providers": "^4.0.0-alpha.21",
55
+ "@ikas/storefront-api": "^4.0.0-alpha.23",
56
+ "@ikas/storefront-config": "^4.0.0-alpha.23",
57
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.23",
58
+ "@ikas/storefront-models": "^4.0.0-alpha.23",
59
+ "@ikas/storefront-providers": "^4.0.0-alpha.23",
60
60
  "mobx": "^6.1.3",
61
61
  "mobx-react-lite": "^3.1.5",
62
62
  "next": "12.0.7",
@@ -19,6 +19,7 @@ import { ThemeComponent } from "./ThemeComponent";
19
19
  import { IkasBaseStore } from "../../store";
20
20
  import { initIkasEvents } from "../../analytics/events";
21
21
  import { IkasPageDataInit } from "../../page-data-init";
22
+ import { setAPIClientConfig } from "@ikas/storefront-api";
22
23
 
23
24
  export type IkasPageProps = {
24
25
  propValues: IkasPageComponentPropValue[];
@@ -55,15 +56,16 @@ export const IkasPage: React.FC<IkasPageProps> = observer(
55
56
  productReviewSummary,
56
57
  }) => {
57
58
  const router = useRouter();
58
- const store = IkasBaseStore.getInstance();
59
- store.router = router;
60
59
 
61
60
  IkasStorefrontConfig.init({
62
61
  ...configJson,
63
62
  currentPageComponents: components,
64
63
  });
65
64
  IkasBaseStore.getInstance().router = router;
65
+ setAPIClientConfig();
66
66
 
67
+ const store = IkasBaseStore.getInstance();
68
+ store.router = router;
67
69
  store.currentPageType = pageType;
68
70
 
69
71
  const [isBrowser, setIsBrowser] = React.useState(false);
@@ -23,7 +23,7 @@ import HtmlMetaDataStore from "../../store/html-meta-data";
23
23
  import BlogStore from "../../store/blog";
24
24
  import RaffleStore from "../../store/raffle";
25
25
  import ProductStore from "../../store/product";
26
- import { IkasAPIClientConfig } from "@ikas/storefront-api";
26
+ import { setAPIClientConfig } from "@ikas/storefront-api";
27
27
 
28
28
  const PACKAGE_VERSION = "2.0.20";
29
29
  // import { version as PACKAGE_VERSION } from "../../../package.json";
@@ -536,8 +536,6 @@ export default class IkasPageEditorViewModel {
536
536
 
537
537
  // Message Handlers
538
538
 
539
- static setAPIClientConfig() {}
540
-
541
539
  handleUpdateFrameData = async (data: any) => {
542
540
  this.theme = new IkasThemeJson(data.theme);
543
541
  this.page = this.theme?.pages.find((p) => p.id === data.selectedPage.id);
@@ -573,17 +571,7 @@ export default class IkasPageEditorViewModel {
573
571
  cdnUrl: data.cdnUrl,
574
572
  });
575
573
 
576
- IkasAPIClientConfig.URL = IkasStorefrontConfig.getApiUrl() || "";
577
- IkasAPIClientConfig.HEADERS = {
578
- "x-api-key": IkasStorefrontConfig.getApiKey() || "",
579
- "x-sfid": IkasStorefrontConfig.getStorefrontId() || "",
580
- "x-sfrid": IkasStorefrontConfig.getStorefrontRoutingId() || "",
581
- };
582
-
583
- if (IkasStorefrontConfig.getCustomerToken()) {
584
- IkasAPIClientConfig.TOKEN =
585
- IkasStorefrontConfig.getCustomerToken() || "";
586
- }
574
+ setAPIClientConfig();
587
575
  }
588
576
 
589
577
  // (window as any).editorApiKey = data.apiKey;
@@ -636,8 +624,6 @@ export default class IkasPageEditorViewModel {
636
624
  await this.pageDataProvider.setLinkSlugs();
637
625
 
638
626
  if (pageComponentPropValues) {
639
- pageComponentPropValues.propValues[propName] = propValue;
640
-
641
627
  if (prop.type === IkasThemeJsonComponentPropType.CUSTOM) {
642
628
  IkasPageDataInit.initCustomDataPropValue(
643
629
  prop,
@@ -668,6 +654,12 @@ export default class IkasPageEditorViewModel {
668
654
  propValue,
669
655
  pageComponentPropValues
670
656
  );
657
+ } else if (prop.type === IkasThemeJsonComponentPropType.PRODUCT_LIST) {
658
+ IkasPageDataInit.initProductListPropValue(
659
+ prop,
660
+ propValue,
661
+ pageComponentPropValues
662
+ );
671
663
  } else if (prop.type === IkasThemeJsonComponentPropType.CATEGORY) {
672
664
  IkasPageDataInit.initCategoryPropValue(
673
665
  prop,
@@ -707,6 +699,8 @@ export default class IkasPageEditorViewModel {
707
699
  propValue,
708
700
  pageComponentPropValues
709
701
  );
702
+ } else {
703
+ pageComponentPropValues.propValues[propName] = propValue;
710
704
  }
711
705
  }
712
706
  };
@@ -9,7 +9,7 @@ import IkasCheckoutPage, {
9
9
  import { useRouter } from "next/router.js";
10
10
  import { FullscreenLoading } from "../components/checkout/components/fullscreen-loading";
11
11
  import { CheckoutStep } from "../components/checkout/model";
12
- import { getCartById } from "@ikas/storefront-api";
12
+ import { getCartById, setAPIClientConfig } from "@ikas/storefront-api";
13
13
  import { IkasStorefrontConfig } from "@ikas/storefront-config";
14
14
  import { IkasBaseStore } from "..";
15
15
  import { IkasCheckout, IkasCheckoutSettings } from "../models/data";
@@ -35,6 +35,7 @@ const CheckoutPage: React.FC<Props> = ({
35
35
  const [checkout, setCheckout] = React.useState<IkasCheckout | undefined>();
36
36
 
37
37
  IkasStorefrontConfig.init(configJson);
38
+ setAPIClientConfig();
38
39
 
39
40
  React.useEffect(() => {
40
41
  setCustomizationProps(customizationProps);