@ikas/storefront 0.0.63 → 0.0.64

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/build/index.es.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { makeAutoObservable, toJS, runInAction, reaction, makeObservable, computed, observable, action, configure } from 'mobx';
2
+ import fs from 'fs';
2
3
  import React, { createElement, useState, useEffect, Fragment, useCallback, useRef, useMemo } from 'react';
3
4
  import { observer } from 'mobx-react-lite';
4
5
  import { useRouter } from 'next/router';
@@ -10864,11 +10865,10 @@ function setContext(setter) {
10864
10865
  var IkasStorefrontConfig = /** @class */ (function () {
10865
10866
  function IkasStorefrontConfig() {
10866
10867
  }
10867
- IkasStorefrontConfig.init = function (store, components, config, localTheme, apiUrlOverride) {
10868
+ IkasStorefrontConfig.init = function (store, components, config, apiUrlOverride) {
10868
10869
  IkasStorefrontConfig.store = store;
10869
10870
  IkasStorefrontConfig.components = components;
10870
10871
  IkasStorefrontConfig.config = config;
10871
- IkasStorefrontConfig.localTheme = localTheme;
10872
10872
  IkasStorefrontConfig.apiUrlOverride = apiUrlOverride || null;
10873
10873
  };
10874
10874
  IkasStorefrontConfig.components = {};
@@ -24065,9 +24065,16 @@ var IkasThemeAPI = /** @class */ (function () {
24065
24065
  function IkasThemeAPI() {
24066
24066
  }
24067
24067
  IkasThemeAPI.fetchTheme = function () {
24068
- return __awaiter(this, void 0, void 0, function () {
24069
- return __generator(this, function (_a) {
24070
- return [2 /*return*/, IkasStorefrontConfig.localTheme];
24068
+ return new Promise(function (resolve, reject) {
24069
+ var themeJSONPath = "./public/theme.json";
24070
+ fs.readFile(themeJSONPath, {
24071
+ flag: "a+",
24072
+ }, function (err, file) {
24073
+ if (err) {
24074
+ return reject(err);
24075
+ }
24076
+ var result = file.length ? JSON.parse(file.toString()) : {};
24077
+ resolve(new IkasTheme(result));
24071
24078
  });
24072
24079
  });
24073
24080
  };
package/build/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var mobx = require('mobx');
6
+ var fs = require('fs');
6
7
  var React = require('react');
7
8
  var mobxReactLite = require('mobx-react-lite');
8
9
  var router = require('next/router');
@@ -13,6 +14,7 @@ var dynamic = require('next/dynamic');
13
14
 
14
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
16
 
17
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
16
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
19
  var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image$1);
18
20
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
@@ -10876,11 +10878,10 @@ function setContext(setter) {
10876
10878
  var IkasStorefrontConfig = /** @class */ (function () {
10877
10879
  function IkasStorefrontConfig() {
10878
10880
  }
10879
- IkasStorefrontConfig.init = function (store, components, config, localTheme, apiUrlOverride) {
10881
+ IkasStorefrontConfig.init = function (store, components, config, apiUrlOverride) {
10880
10882
  IkasStorefrontConfig.store = store;
10881
10883
  IkasStorefrontConfig.components = components;
10882
10884
  IkasStorefrontConfig.config = config;
10883
- IkasStorefrontConfig.localTheme = localTheme;
10884
10885
  IkasStorefrontConfig.apiUrlOverride = apiUrlOverride || null;
10885
10886
  };
10886
10887
  IkasStorefrontConfig.components = {};
@@ -24043,9 +24044,16 @@ var IkasThemeAPI = /** @class */ (function () {
24043
24044
  function IkasThemeAPI() {
24044
24045
  }
24045
24046
  IkasThemeAPI.fetchTheme = function () {
24046
- return __awaiter(this, void 0, void 0, function () {
24047
- return __generator(this, function (_a) {
24048
- return [2 /*return*/, IkasStorefrontConfig.localTheme];
24047
+ return new Promise(function (resolve, reject) {
24048
+ var themeJSONPath = "./public/theme.json";
24049
+ fs__default['default'].readFile(themeJSONPath, {
24050
+ flag: "a+",
24051
+ }, function (err, file) {
24052
+ if (err) {
24053
+ return reject(err);
24054
+ }
24055
+ var result = file.length ? JSON.parse(file.toString()) : {};
24056
+ resolve(new IkasTheme(result));
24049
24057
  });
24050
24058
  });
24051
24059
  };
@@ -1,10 +1,8 @@
1
- import { IkasTheme } from "../models/index";
2
1
  import { IkasBaseStore } from "../store/index";
3
2
  export declare class IkasStorefrontConfig {
4
3
  static store: IkasBaseStore;
5
4
  static components: any;
6
5
  static config: Record<string, any>;
7
- static localTheme: IkasTheme;
8
6
  static apiUrlOverride: string | null;
9
- static init(store: IkasBaseStore, components: any, config: Record<string, any>, localTheme: IkasTheme, apiUrlOverride?: string): void;
7
+ static init(store: IkasBaseStore, components: any, config: Record<string, any>, apiUrlOverride?: string): void;
10
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",