@ikas/storefront 0.0.68 → 0.0.70

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.
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
+ import { CheckoutError } from "../../../model";
2
3
  declare type Props = {
4
+ error?: CheckoutError | null;
3
5
  onClose: () => void;
4
6
  };
5
7
  export declare const PaymentError: React.FC<Props>;
package/build/index.es.js CHANGED
@@ -18216,6 +18216,7 @@ var IkasThemePageType;
18216
18216
  IkasThemePageType["RECOVER_PASSWORD"] = "RECOVER_PASSWORD";
18217
18217
  IkasThemePageType["CART"] = "CART";
18218
18218
  IkasThemePageType["FAVORITE_PRODUCTS"] = "FAVORITE_PRODUCTS";
18219
+ IkasThemePageType["SEARCH"] = "SEARCH";
18219
18220
  })(IkasThemePageType || (IkasThemePageType = {}));
18220
18221
 
18221
18222
  var IkasThemeColor = /** @class */ (function () {
@@ -20168,6 +20169,9 @@ var IkasProductList = /** @class */ (function () {
20168
20169
  filter.applyQueryParam(value);
20169
20170
  }
20170
20171
  });
20172
+ var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
20173
+ if (querySearch)
20174
+ this._searchKeyword = querySearch;
20171
20175
  }
20172
20176
  catch (err) {
20173
20177
  console.log(err);
@@ -24587,6 +24591,7 @@ var CheckoutViewModel = /** @class */ (function () {
24587
24591
  if (typeof queryParams.failed === "string") {
24588
24592
  this.error = {
24589
24593
  type: ErrorType.PAYMENT_ERROR,
24594
+ data: queryParams.error || null,
24590
24595
  };
24591
24596
  }
24592
24597
  merchantId = decodeBase64(IkasStorefrontConfig.config.apiKey || "");
@@ -26325,9 +26330,10 @@ var UnknownError = observer(function (_a) {
26325
26330
  });
26326
26331
 
26327
26332
  var PaymentError = observer(function (_a) {
26328
- var onClose = _a.onClose;
26333
+ var error = _a.error, onClose = _a.onClose;
26329
26334
  return (createElement(ErrorContainer, { onClose: onClose },
26330
- createElement("div", null, "\u00D6demeniz al\u0131namad\u0131. L\u00FCtfen bilgilerinizi kontrol edip tekrar deneyin.")));
26335
+ createElement("div", null, (error === null || error === void 0 ? void 0 : error.data) ||
26336
+ "Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.")));
26331
26337
  });
26332
26338
 
26333
26339
  var NoShippingError = observer(function (_a) {
@@ -26968,7 +26974,7 @@ function createStoreSchema(merchantSettings) {
26968
26974
  };
26969
26975
  }
26970
26976
  function createProductSchema(productDetail) {
26971
- var _a;
26977
+ var _a, _b;
26972
26978
  try {
26973
26979
  var isBrowser = typeof window !== "undefined";
26974
26980
  if (isBrowser) {
@@ -26985,20 +26991,20 @@ function createProductSchema(productDetail) {
26985
26991
  "@context": "https://schema.org/",
26986
26992
  "@type": "Product",
26987
26993
  name: productDetail.product.name,
26994
+ description: (_a = productDetail.product.metaData) === null || _a === void 0 ? void 0 : _a.description,
26988
26995
  image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
26989
- description: "",
26990
26996
  sku: productDetail.selectedVariant.sku,
26991
26997
  mpn: productDetail.selectedVariant.barcodeList.length
26992
26998
  ? productDetail.selectedVariant.barcodeList[0]
26993
26999
  : "",
26994
27000
  brand: {
26995
27001
  "@type": "Brand",
26996
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
27002
+ name: (_b = productDetail.product.brand) === null || _b === void 0 ? void 0 : _b.name,
26997
27003
  },
26998
27004
  offers: {
26999
27005
  "@type": "Offer",
27000
27006
  url: "https://" + window.location.hostname + productDetail.href,
27001
- priceCurrency: productDetail.selectedVariant.price.currency,
27007
+ priceCurrency: productDetail.selectedVariant.price.currency || "TRY",
27002
27008
  price: productDetail.selectedVariant.price.finalPrice,
27003
27009
  priceValidUntil: "",
27004
27010
  itemCondition: "https://schema.org/NewCondition",
@@ -27122,7 +27128,7 @@ var IkasCheckoutPage = observer(function (_a) {
27122
27128
  return createElement(StockError, { error: vm.error, onClose: onErrorClose });
27123
27129
  };
27124
27130
  var renderPaymentError = function () {
27125
- return createElement(PaymentError, { onClose: onErrorClose });
27131
+ return createElement(PaymentError, { error: vm.error, onClose: onErrorClose });
27126
27132
  };
27127
27133
  var renderNoShipingError = function () {
27128
27134
  return createElement(NoShippingError, { onClose: onErrorClose });
@@ -28260,6 +28266,34 @@ var favoriteProducts = /*#__PURE__*/Object.freeze({
28260
28266
  getStaticProps: getStaticProps$b
28261
28267
  });
28262
28268
 
28269
+ var Page$e = function (_a) {
28270
+ var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28271
+ var router = useRouter();
28272
+ var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
28273
+ return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28274
+ };
28275
+ var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28276
+ var theme, provider;
28277
+ return __generator(this, function (_a) {
28278
+ switch (_a.label) {
28279
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28280
+ case 1:
28281
+ theme = _a.sent();
28282
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.SEARCH);
28283
+ return [4 /*yield*/, provider.getPageData()];
28284
+ case 2:
28285
+ _a.sent();
28286
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28287
+ }
28288
+ });
28289
+ }); };
28290
+
28291
+ var search = /*#__PURE__*/Object.freeze({
28292
+ __proto__: null,
28293
+ 'default': Page$e,
28294
+ getStaticProps: getStaticProps$c
28295
+ });
28296
+
28263
28297
  configure({
28264
28298
  enforceActions: "never",
28265
28299
  });
@@ -28271,4 +28305,4 @@ var IkasBaseStore = /** @class */ (function () {
28271
28305
  return IkasBaseStore;
28272
28306
  }());
28273
28307
 
28274
- export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, cart as CartPage, _id_$1 as CheckoutPage, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, GTMAddToCart, GTMBeginCheckout, GTMBody, GTMCheckoutStep, GTMDisableHTML, GTMHead, GTMPageView, GTMProductView, GTMPurchase, GTMRemoveFromCart, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
28308
+ export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, cart as CartPage, _id_$1 as CheckoutPage, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, GTMAddToCart, GTMBeginCheckout, GTMBody, GTMCheckoutStep, GTMDisableHTML, GTMHead, GTMPageView, GTMProductView, GTMPurchase, GTMRemoveFromCart, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
package/build/index.js CHANGED
@@ -18204,6 +18204,7 @@ var IkasThemePage = /** @class */ (function () {
18204
18204
  IkasThemePageType["RECOVER_PASSWORD"] = "RECOVER_PASSWORD";
18205
18205
  IkasThemePageType["CART"] = "CART";
18206
18206
  IkasThemePageType["FAVORITE_PRODUCTS"] = "FAVORITE_PRODUCTS";
18207
+ IkasThemePageType["SEARCH"] = "SEARCH";
18207
18208
  })(exports.IkasThemePageType || (exports.IkasThemePageType = {}));
18208
18209
 
18209
18210
  var IkasThemeColor = /** @class */ (function () {
@@ -20151,6 +20152,9 @@ var IkasProductList = /** @class */ (function () {
20151
20152
  filter.applyQueryParam(value);
20152
20153
  }
20153
20154
  });
20155
+ var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
20156
+ if (querySearch)
20157
+ this._searchKeyword = querySearch;
20154
20158
  }
20155
20159
  catch (err) {
20156
20160
  console.log(err);
@@ -24567,6 +24571,7 @@ var CheckoutViewModel = /** @class */ (function () {
24567
24571
  if (typeof queryParams.failed === "string") {
24568
24572
  this.error = {
24569
24573
  type: ErrorType.PAYMENT_ERROR,
24574
+ data: queryParams.error || null,
24570
24575
  };
24571
24576
  }
24572
24577
  merchantId = decodeBase64(IkasStorefrontConfig.config.apiKey || "");
@@ -26305,9 +26310,10 @@ var UnknownError = mobxReactLite.observer(function (_a) {
26305
26310
  });
26306
26311
 
26307
26312
  var PaymentError = mobxReactLite.observer(function (_a) {
26308
- var onClose = _a.onClose;
26313
+ var error = _a.error, onClose = _a.onClose;
26309
26314
  return (React.createElement(ErrorContainer, { onClose: onClose },
26310
- React.createElement("div", null, "\u00D6demeniz al\u0131namad\u0131. L\u00FCtfen bilgilerinizi kontrol edip tekrar deneyin.")));
26315
+ React.createElement("div", null, (error === null || error === void 0 ? void 0 : error.data) ||
26316
+ "Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.")));
26311
26317
  });
26312
26318
 
26313
26319
  var NoShippingError = mobxReactLite.observer(function (_a) {
@@ -26948,7 +26954,7 @@ function createStoreSchema(merchantSettings) {
26948
26954
  };
26949
26955
  }
26950
26956
  function createProductSchema(productDetail) {
26951
- var _a;
26957
+ var _a, _b;
26952
26958
  try {
26953
26959
  var isBrowser = typeof window !== "undefined";
26954
26960
  if (isBrowser) {
@@ -26965,20 +26971,20 @@ function createProductSchema(productDetail) {
26965
26971
  "@context": "https://schema.org/",
26966
26972
  "@type": "Product",
26967
26973
  name: productDetail.product.name,
26974
+ description: (_a = productDetail.product.metaData) === null || _a === void 0 ? void 0 : _a.description,
26968
26975
  image: productDetail.selectedVariant.images.map(function (i) { return i.src; }),
26969
- description: "",
26970
26976
  sku: productDetail.selectedVariant.sku,
26971
26977
  mpn: productDetail.selectedVariant.barcodeList.length
26972
26978
  ? productDetail.selectedVariant.barcodeList[0]
26973
26979
  : "",
26974
26980
  brand: {
26975
26981
  "@type": "Brand",
26976
- name: (_a = productDetail.product.brand) === null || _a === void 0 ? void 0 : _a.name,
26982
+ name: (_b = productDetail.product.brand) === null || _b === void 0 ? void 0 : _b.name,
26977
26983
  },
26978
26984
  offers: {
26979
26985
  "@type": "Offer",
26980
26986
  url: "https://" + window.location.hostname + productDetail.href,
26981
- priceCurrency: productDetail.selectedVariant.price.currency,
26987
+ priceCurrency: productDetail.selectedVariant.price.currency || "TRY",
26982
26988
  price: productDetail.selectedVariant.price.finalPrice,
26983
26989
  priceValidUntil: "",
26984
26990
  itemCondition: "https://schema.org/NewCondition",
@@ -27102,7 +27108,7 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27102
27108
  return React.createElement(StockError, { error: vm.error, onClose: onErrorClose });
27103
27109
  };
27104
27110
  var renderPaymentError = function () {
27105
- return React.createElement(PaymentError, { onClose: onErrorClose });
27111
+ return React.createElement(PaymentError, { error: vm.error, onClose: onErrorClose });
27106
27112
  };
27107
27113
  var renderNoShipingError = function () {
27108
27114
  return React.createElement(NoShippingError, { onClose: onErrorClose });
@@ -28240,6 +28246,34 @@ var favoriteProducts = /*#__PURE__*/Object.freeze({
28240
28246
  getStaticProps: getStaticProps$b
28241
28247
  });
28242
28248
 
28249
+ var Page$e = function (_a) {
28250
+ var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28251
+ var router$1 = router.useRouter();
28252
+ var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router$1);
28253
+ return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28254
+ };
28255
+ var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28256
+ var theme, provider;
28257
+ return __generator(this, function (_a) {
28258
+ switch (_a.label) {
28259
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28260
+ case 1:
28261
+ theme = _a.sent();
28262
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.SEARCH);
28263
+ return [4 /*yield*/, provider.getPageData()];
28264
+ case 2:
28265
+ _a.sent();
28266
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28267
+ }
28268
+ });
28269
+ }); };
28270
+
28271
+ var search = /*#__PURE__*/Object.freeze({
28272
+ __proto__: null,
28273
+ 'default': Page$e,
28274
+ getStaticProps: getStaticProps$c
28275
+ });
28276
+
28243
28277
  mobx.configure({
28244
28278
  enforceActions: "never",
28245
28279
  });
@@ -28359,6 +28393,7 @@ exports.RecoverPasswordPage = recoverPassword;
28359
28393
  exports.RegisterForm = RegisterForm;
28360
28394
  exports.RegisterPage = register;
28361
28395
  exports.RequiredRule = RequiredRule;
28396
+ exports.SearchPage = search;
28362
28397
  exports.SlugPage = index$2;
28363
28398
  exports.ValidationRule = ValidationRule;
28364
28399
  exports.Validator = Validator;
@@ -24,5 +24,6 @@ export declare enum IkasThemePageType {
24
24
  FORGOT_PASSWORD = "FORGOT_PASSWORD",
25
25
  RECOVER_PASSWORD = "RECOVER_PASSWORD",
26
26
  CART = "CART",
27
- FAVORITE_PRODUCTS = "FAVORITE_PRODUCTS"
27
+ FAVORITE_PRODUCTS = "FAVORITE_PRODUCTS",
28
+ SEARCH = "SEARCH"
28
29
  }
@@ -13,4 +13,5 @@ import * as RecoverPasswordPage from "./account/recover-password";
13
13
  import * as CartPage from "./cart";
14
14
  import * as EditorPage from "./editor";
15
15
  import * as FavoriteProductsPage from "./account/favorite-products";
16
- export { IndexPage, SlugPage, CustomPage, CheckoutPage, AccountPage, AddressesPage, OrdersPage, OrderDetailPage, LoginPage, RegisterPage, ForgotPasswordPage, RecoverPasswordPage, CartPage, EditorPage, FavoriteProductsPage, };
16
+ import * as SearchPage from "./search";
17
+ export { IndexPage, SlugPage, CustomPage, CheckoutPage, AccountPage, AddressesPage, OrdersPage, OrderDetailPage, LoginPage, RegisterPage, ForgotPasswordPage, RecoverPasswordPage, CartPage, EditorPage, FavoriteProductsPage, SearchPage, };
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { GetStaticProps } from "next";
3
+ import { IkasThemePage } from "../models/index";
4
+ declare type Props = {
5
+ propValuesStr: string;
6
+ page: IkasThemePage;
7
+ settingsStr: string;
8
+ merchantSettings: string;
9
+ };
10
+ declare const Page: React.FC<Props>;
11
+ export default Page;
12
+ export declare const getStaticProps: GetStaticProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",