@ikas/storefront 0.0.161 → 0.0.162-alpha.1

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.
@@ -9,6 +9,7 @@ export default class PageViewModel {
9
9
  hoveredPageComponentId?: string | null;
10
10
  componentRefs: any;
11
11
  isLoading: boolean;
12
+ locale: string;
12
13
  pageParams: Record<string, any>;
13
14
  queryParams: Record<string, any>;
14
15
  apiKey?: string | null;
package/build/index.es.js CHANGED
@@ -5,6 +5,7 @@ import Head from 'next/head';
5
5
  import { useRouter } from 'next/router';
6
6
  import Link from 'next/link';
7
7
  import NextImage from 'next/image';
8
+ import { useTranslation } from 'next-i18next';
8
9
  import fs from 'fs';
9
10
  import getConfig from 'next/config';
10
11
  import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
@@ -37207,6 +37208,7 @@ var PageViewModel = /** @class */ (function () {
37207
37208
  this.hoveredPageComponentId = null;
37208
37209
  this.componentRefs = {};
37209
37210
  this.isLoading = false;
37211
+ this.locale = "en";
37210
37212
  this.pageParams = {};
37211
37213
  this.queryParams = {};
37212
37214
  this.apiKey = null;
@@ -37359,6 +37361,7 @@ var PageViewModel = /** @class */ (function () {
37359
37361
  this.pageParams = data.pageParams;
37360
37362
  this.queryParams = data.queryParams;
37361
37363
  this.apiKey = data.apiKey;
37364
+ this.locale = data.locale || "en";
37362
37365
  apollo.createApolloClient(this.apiKey || undefined);
37363
37366
  window.editorApiKey = data.apiKey;
37364
37367
  return [4 /*yield*/, this.getPagePropValues()];
@@ -37647,7 +37650,13 @@ var overlayStyle = {
37647
37650
  var IkasPageEditor = observer(function () {
37648
37651
  var _a, _b, _c;
37649
37652
  var router = useRouter();
37653
+ var i18n = useTranslation().i18n;
37650
37654
  var vm = useState(function () { return new PageViewModel(router); })[0];
37655
+ useEffect(function () {
37656
+ if (typeof i18n.changeLanguage === "function") {
37657
+ i18n.changeLanguage(vm.locale);
37658
+ }
37659
+ }, [vm.locale]);
37651
37660
  if (vm.isLoading)
37652
37661
  return null;
37653
37662
  var headerPageComponent = (_a = vm.pageComponents) === null || _a === void 0 ? void 0 : _a.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id); });
package/build/index.js CHANGED
@@ -9,6 +9,7 @@ var Head = require('next/head');
9
9
  var router = require('next/router');
10
10
  var Link = require('next/link');
11
11
  var NextImage = require('next/image');
12
+ var nextI18next = require('next-i18next');
12
13
  var fs = require('fs');
13
14
  var getConfig = require('next/config');
14
15
  var serverSideTranslations = require('next-i18next/serverSideTranslations');
@@ -37184,6 +37185,7 @@ var PageViewModel = /** @class */ (function () {
37184
37185
  this.hoveredPageComponentId = null;
37185
37186
  this.componentRefs = {};
37186
37187
  this.isLoading = false;
37188
+ this.locale = "en";
37187
37189
  this.pageParams = {};
37188
37190
  this.queryParams = {};
37189
37191
  this.apiKey = null;
@@ -37336,6 +37338,7 @@ var PageViewModel = /** @class */ (function () {
37336
37338
  this.pageParams = data.pageParams;
37337
37339
  this.queryParams = data.queryParams;
37338
37340
  this.apiKey = data.apiKey;
37341
+ this.locale = data.locale || "en";
37339
37342
  apollo.createApolloClient(this.apiKey || undefined);
37340
37343
  window.editorApiKey = data.apiKey;
37341
37344
  return [4 /*yield*/, this.getPagePropValues()];
@@ -37624,7 +37627,13 @@ var overlayStyle = {
37624
37627
  var IkasPageEditor = mobxReactLite.observer(function () {
37625
37628
  var _a, _b, _c;
37626
37629
  var router$1 = router.useRouter();
37630
+ var i18n = nextI18next.useTranslation().i18n;
37627
37631
  var vm = React.useState(function () { return new PageViewModel(router$1); })[0];
37632
+ React.useEffect(function () {
37633
+ if (typeof i18n.changeLanguage === "function") {
37634
+ i18n.changeLanguage(vm.locale);
37635
+ }
37636
+ }, [vm.locale]);
37628
37637
  if (vm.isLoading)
37629
37638
  return null;
37630
37639
  var headerPageComponent = (_a = vm.pageComponents) === null || _a === void 0 ? void 0 : _a.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.161",
3
+ "version": "0.0.162-alpha.1",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",