@ikas/storefront 0.0.50 → 0.0.51
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/api/favorite-product/__generated__/isFavoriteProduct.d.ts +6 -0
- package/build/api/favorite-product/__generated__/listFavoriteProducts.d.ts +12 -0
- package/build/api/favorite-product/__generated__/saveFavoriteProduct.d.ts +7 -0
- package/build/api/favorite-product/index.d.ts +6 -0
- package/build/api/index.d.ts +1 -0
- package/build/index.es.js +241 -5
- package/build/index.js +243 -4
- package/build/models/data/favorite-product/index.d.ts +6 -0
- package/build/models/data/index.d.ts +1 -0
- package/build/models/theme/page/index.d.ts +2 -1
- package/build/pages/account/favorite-products.d.ts +11 -0
- package/build/pages/index.d.ts +2 -1
- package/build/store/customer.d.ts +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface listFavoriteProducts_listFavoriteProducts {
|
|
2
|
+
__typename: "CustomerFavoriteProduct";
|
|
3
|
+
id: string | null;
|
|
4
|
+
createdAt: any | null;
|
|
5
|
+
updatedAt: any | null;
|
|
6
|
+
deleted: boolean | null;
|
|
7
|
+
productId: string;
|
|
8
|
+
customerId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface listFavoriteProducts {
|
|
11
|
+
listFavoriteProducts: listFavoriteProducts_listFavoriteProducts[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IkasFavoriteProduct } from "../../models/index";
|
|
2
|
+
export declare class IkasFavoriteProductAPI {
|
|
3
|
+
static listFavoriteProducts(): Promise<IkasFavoriteProduct[]>;
|
|
4
|
+
static isFavoriteProduct(productId: string): Promise<boolean>;
|
|
5
|
+
static saveFavoriteProduct(isFavorite: boolean, productId: string): Promise<boolean>;
|
|
6
|
+
}
|
package/build/api/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { IkasMerchantAPI } from "./merchant/index";
|
|
|
11
11
|
export { IkasProductAPI } from "./product/index";
|
|
12
12
|
export { IkasProductSearchAPI } from "./product-search/index";
|
|
13
13
|
export { IkasProductAttributeAPI } from "./product-attribute/index";
|
|
14
|
+
export { IkasFavoriteProductAPI } from "./favorite-product/index";
|
|
14
15
|
export { IkasStateAPI } from "./state/index";
|
|
15
16
|
export { IkasStorefrontAPI } from "./storefront/index";
|
|
16
17
|
export { IkasThemeAPI } from "./theme/index";
|
package/build/index.es.js
CHANGED
|
@@ -13507,6 +13507,16 @@ function parseRangeStr(rangeStr) {
|
|
|
13507
13507
|
}
|
|
13508
13508
|
}
|
|
13509
13509
|
|
|
13510
|
+
var IkasFavoriteProduct = /** @class */ (function () {
|
|
13511
|
+
function IkasFavoriteProduct(data) {
|
|
13512
|
+
this.id = data.id || "";
|
|
13513
|
+
this.customerId = data.customerId || "";
|
|
13514
|
+
this.productId = data.productId || "";
|
|
13515
|
+
makeAutoObservable(this);
|
|
13516
|
+
}
|
|
13517
|
+
return IkasFavoriteProduct;
|
|
13518
|
+
}());
|
|
13519
|
+
|
|
13510
13520
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
13511
13521
|
function IkasOrderTransaction(data) {
|
|
13512
13522
|
if (data === void 0) { data = {}; }
|
|
@@ -13778,6 +13788,7 @@ var IkasThemePageType;
|
|
|
13778
13788
|
IkasThemePageType["FORGOT_PASSWORD"] = "FORGOT_PASSWORD";
|
|
13779
13789
|
IkasThemePageType["RECOVER_PASSWORD"] = "RECOVER_PASSWORD";
|
|
13780
13790
|
IkasThemePageType["CART"] = "CART";
|
|
13791
|
+
IkasThemePageType["FAVORITE_PRODUCTS"] = "FAVORITE_PRODUCTS";
|
|
13781
13792
|
})(IkasThemePageType || (IkasThemePageType = {}));
|
|
13782
13793
|
|
|
13783
13794
|
var IkasThemeColor = /** @class */ (function () {
|
|
@@ -23261,6 +23272,102 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
23261
23272
|
}());
|
|
23262
23273
|
var templateObject_1$f;
|
|
23263
23274
|
|
|
23275
|
+
var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
23276
|
+
function IkasFavoriteProductAPI() {
|
|
23277
|
+
}
|
|
23278
|
+
IkasFavoriteProductAPI.listFavoriteProducts = function () {
|
|
23279
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23280
|
+
var LIST_FAVORITE_PRODUCTS, _a, data, errors, err_1;
|
|
23281
|
+
return __generator(this, function (_b) {
|
|
23282
|
+
switch (_b.label) {
|
|
23283
|
+
case 0:
|
|
23284
|
+
LIST_FAVORITE_PRODUCTS = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
|
|
23285
|
+
_b.label = 1;
|
|
23286
|
+
case 1:
|
|
23287
|
+
_b.trys.push([1, 3, , 4]);
|
|
23288
|
+
return [4 /*yield*/, apollo
|
|
23289
|
+
.getClient()
|
|
23290
|
+
.query({
|
|
23291
|
+
query: LIST_FAVORITE_PRODUCTS,
|
|
23292
|
+
})];
|
|
23293
|
+
case 2:
|
|
23294
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23295
|
+
if (errors && errors.length)
|
|
23296
|
+
return [2 /*return*/, []];
|
|
23297
|
+
return [2 /*return*/, data.listFavoriteProducts.map(function (fP) { return new IkasFavoriteProduct(fP); })];
|
|
23298
|
+
case 3:
|
|
23299
|
+
err_1 = _b.sent();
|
|
23300
|
+
console.log(err_1);
|
|
23301
|
+
return [3 /*break*/, 4];
|
|
23302
|
+
case 4: return [2 /*return*/, []];
|
|
23303
|
+
}
|
|
23304
|
+
});
|
|
23305
|
+
});
|
|
23306
|
+
};
|
|
23307
|
+
IkasFavoriteProductAPI.isFavoriteProduct = function (productId) {
|
|
23308
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23309
|
+
var IS_FAVORITE_PRODUCT, _a, data, errors, err_2;
|
|
23310
|
+
return __generator(this, function (_b) {
|
|
23311
|
+
switch (_b.label) {
|
|
23312
|
+
case 0:
|
|
23313
|
+
IS_FAVORITE_PRODUCT = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "], ["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "])));
|
|
23314
|
+
_b.label = 1;
|
|
23315
|
+
case 1:
|
|
23316
|
+
_b.trys.push([1, 3, , 4]);
|
|
23317
|
+
return [4 /*yield*/, apollo
|
|
23318
|
+
.getClient()
|
|
23319
|
+
.query({
|
|
23320
|
+
query: IS_FAVORITE_PRODUCT,
|
|
23321
|
+
variables: { productId: productId },
|
|
23322
|
+
})];
|
|
23323
|
+
case 2:
|
|
23324
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23325
|
+
if (errors && errors.length)
|
|
23326
|
+
return [2 /*return*/, false];
|
|
23327
|
+
return [2 /*return*/, data.isFavoriteProduct];
|
|
23328
|
+
case 3:
|
|
23329
|
+
err_2 = _b.sent();
|
|
23330
|
+
console.log(err_2);
|
|
23331
|
+
return [3 /*break*/, 4];
|
|
23332
|
+
case 4: return [2 /*return*/, false];
|
|
23333
|
+
}
|
|
23334
|
+
});
|
|
23335
|
+
});
|
|
23336
|
+
};
|
|
23337
|
+
IkasFavoriteProductAPI.saveFavoriteProduct = function (isFavorite, productId) {
|
|
23338
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23339
|
+
var SAVE_FAVORITE_PRODUCT, _a, data, errors, err_3;
|
|
23340
|
+
return __generator(this, function (_b) {
|
|
23341
|
+
switch (_b.label) {
|
|
23342
|
+
case 0:
|
|
23343
|
+
SAVE_FAVORITE_PRODUCT = src(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "], ["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "])));
|
|
23344
|
+
_b.label = 1;
|
|
23345
|
+
case 1:
|
|
23346
|
+
_b.trys.push([1, 3, , 4]);
|
|
23347
|
+
return [4 /*yield*/, apollo
|
|
23348
|
+
.getClient()
|
|
23349
|
+
.mutate({
|
|
23350
|
+
mutation: SAVE_FAVORITE_PRODUCT,
|
|
23351
|
+
variables: { isFavorite: isFavorite, productId: productId },
|
|
23352
|
+
})];
|
|
23353
|
+
case 2:
|
|
23354
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23355
|
+
if (errors && errors.length)
|
|
23356
|
+
return [2 /*return*/, false];
|
|
23357
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.saveFavoriteProduct) || true];
|
|
23358
|
+
case 3:
|
|
23359
|
+
err_3 = _b.sent();
|
|
23360
|
+
console.log(err_3);
|
|
23361
|
+
return [3 /*break*/, 4];
|
|
23362
|
+
case 4: return [2 /*return*/, false];
|
|
23363
|
+
}
|
|
23364
|
+
});
|
|
23365
|
+
});
|
|
23366
|
+
};
|
|
23367
|
+
return IkasFavoriteProductAPI;
|
|
23368
|
+
}());
|
|
23369
|
+
var templateObject_1$g, templateObject_2$5, templateObject_3$2;
|
|
23370
|
+
|
|
23264
23371
|
var IkasStateAPI = /** @class */ (function () {
|
|
23265
23372
|
function IkasStateAPI() {
|
|
23266
23373
|
}
|
|
@@ -23270,7 +23377,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23270
23377
|
return __generator(this, function (_b) {
|
|
23271
23378
|
switch (_b.label) {
|
|
23272
23379
|
case 0:
|
|
23273
|
-
QUERY = src(templateObject_1$
|
|
23380
|
+
QUERY = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
23274
23381
|
_b.label = 1;
|
|
23275
23382
|
case 1:
|
|
23276
23383
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23307,7 +23414,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23307
23414
|
};
|
|
23308
23415
|
return IkasStateAPI;
|
|
23309
23416
|
}());
|
|
23310
|
-
var templateObject_1$
|
|
23417
|
+
var templateObject_1$h;
|
|
23311
23418
|
|
|
23312
23419
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
23313
23420
|
function IkasStorefrontDomain(data) {
|
|
@@ -23400,7 +23507,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23400
23507
|
return __generator(this, function (_b) {
|
|
23401
23508
|
switch (_b.label) {
|
|
23402
23509
|
case 0:
|
|
23403
|
-
QUERY = src(templateObject_1$
|
|
23510
|
+
QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
23404
23511
|
_b.label = 1;
|
|
23405
23512
|
case 1:
|
|
23406
23513
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23430,7 +23537,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23430
23537
|
};
|
|
23431
23538
|
return IkasStorefrontAPI;
|
|
23432
23539
|
}());
|
|
23433
|
-
var templateObject_1$
|
|
23540
|
+
var templateObject_1$i;
|
|
23434
23541
|
|
|
23435
23542
|
var IkasThemeAPI = /** @class */ (function () {
|
|
23436
23543
|
function IkasThemeAPI() {
|
|
@@ -23587,6 +23694,107 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
23587
23694
|
});
|
|
23588
23695
|
});
|
|
23589
23696
|
};
|
|
23697
|
+
this.getFavoriteProductsIds = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23698
|
+
var favoriteProductsResult;
|
|
23699
|
+
return __generator(this, function (_b) {
|
|
23700
|
+
switch (_b.label) {
|
|
23701
|
+
case 0:
|
|
23702
|
+
_b.trys.push([0, 2, , 3]);
|
|
23703
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23704
|
+
case 1:
|
|
23705
|
+
favoriteProductsResult = _b.sent();
|
|
23706
|
+
return [2 /*return*/, favoriteProductsResult];
|
|
23707
|
+
case 2:
|
|
23708
|
+
_b.sent();
|
|
23709
|
+
return [2 /*return*/, []];
|
|
23710
|
+
case 3: return [2 /*return*/];
|
|
23711
|
+
}
|
|
23712
|
+
});
|
|
23713
|
+
}); };
|
|
23714
|
+
this.getFavoriteProducts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23715
|
+
var favoriteProductsResult, productsResult;
|
|
23716
|
+
return __generator(this, function (_b) {
|
|
23717
|
+
switch (_b.label) {
|
|
23718
|
+
case 0:
|
|
23719
|
+
_b.trys.push([0, 3, , 4]);
|
|
23720
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23721
|
+
case 1:
|
|
23722
|
+
favoriteProductsResult = _b.sent();
|
|
23723
|
+
if (!favoriteProductsResult.length)
|
|
23724
|
+
return [2 /*return*/, []];
|
|
23725
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23726
|
+
idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
23727
|
+
})];
|
|
23728
|
+
case 2:
|
|
23729
|
+
productsResult = _b.sent();
|
|
23730
|
+
return [2 /*return*/, productsResult.products];
|
|
23731
|
+
case 3:
|
|
23732
|
+
_b.sent();
|
|
23733
|
+
return [2 /*return*/, []];
|
|
23734
|
+
case 4: return [2 /*return*/];
|
|
23735
|
+
}
|
|
23736
|
+
});
|
|
23737
|
+
}); };
|
|
23738
|
+
this.addItemToFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23739
|
+
var customerId, result;
|
|
23740
|
+
var _b;
|
|
23741
|
+
return __generator(this, function (_c) {
|
|
23742
|
+
switch (_c.label) {
|
|
23743
|
+
case 0:
|
|
23744
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23745
|
+
if (!customerId)
|
|
23746
|
+
throw Error("Unauthorized");
|
|
23747
|
+
_c.label = 1;
|
|
23748
|
+
case 1:
|
|
23749
|
+
_c.trys.push([1, 3, , 4]);
|
|
23750
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(true, productId)];
|
|
23751
|
+
case 2:
|
|
23752
|
+
result = _c.sent();
|
|
23753
|
+
return [2 /*return*/, result];
|
|
23754
|
+
case 3:
|
|
23755
|
+
_c.sent();
|
|
23756
|
+
return [2 /*return*/, false];
|
|
23757
|
+
case 4: return [2 /*return*/];
|
|
23758
|
+
}
|
|
23759
|
+
});
|
|
23760
|
+
}); };
|
|
23761
|
+
this.removeItemFromFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23762
|
+
var customerId, result;
|
|
23763
|
+
var _b;
|
|
23764
|
+
return __generator(this, function (_c) {
|
|
23765
|
+
switch (_c.label) {
|
|
23766
|
+
case 0:
|
|
23767
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23768
|
+
if (!customerId)
|
|
23769
|
+
throw Error("Unauthorized");
|
|
23770
|
+
_c.label = 1;
|
|
23771
|
+
case 1:
|
|
23772
|
+
_c.trys.push([1, 3, , 4]);
|
|
23773
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(false, productId)];
|
|
23774
|
+
case 2:
|
|
23775
|
+
result = _c.sent();
|
|
23776
|
+
return [2 /*return*/, result];
|
|
23777
|
+
case 3:
|
|
23778
|
+
_c.sent();
|
|
23779
|
+
return [2 /*return*/, false];
|
|
23780
|
+
case 4: return [2 /*return*/];
|
|
23781
|
+
}
|
|
23782
|
+
});
|
|
23783
|
+
}); };
|
|
23784
|
+
this.isProductFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23785
|
+
var customerId;
|
|
23786
|
+
var _a;
|
|
23787
|
+
return __generator(this, function (_b) {
|
|
23788
|
+
switch (_b.label) {
|
|
23789
|
+
case 0:
|
|
23790
|
+
customerId = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
23791
|
+
if (!customerId)
|
|
23792
|
+
throw Error("Unauthorized");
|
|
23793
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.isFavoriteProduct(productId)];
|
|
23794
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
23795
|
+
}
|
|
23796
|
+
});
|
|
23797
|
+
}); };
|
|
23590
23798
|
this.baseStore = baseStore;
|
|
23591
23799
|
this.init();
|
|
23592
23800
|
makeAutoObservable(this);
|
|
@@ -27436,6 +27644,34 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
27436
27644
|
'default': editor
|
|
27437
27645
|
});
|
|
27438
27646
|
|
|
27647
|
+
var Page$d = function (_a) {
|
|
27648
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
27649
|
+
var router = useRouter();
|
|
27650
|
+
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
27651
|
+
return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
27652
|
+
};
|
|
27653
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
27654
|
+
var theme, provider;
|
|
27655
|
+
return __generator(this, function (_a) {
|
|
27656
|
+
switch (_a.label) {
|
|
27657
|
+
case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
|
|
27658
|
+
case 1:
|
|
27659
|
+
theme = _a.sent();
|
|
27660
|
+
provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FAVORITE_PRODUCTS);
|
|
27661
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
27662
|
+
case 2:
|
|
27663
|
+
_a.sent();
|
|
27664
|
+
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
27665
|
+
}
|
|
27666
|
+
});
|
|
27667
|
+
}); };
|
|
27668
|
+
|
|
27669
|
+
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
27670
|
+
__proto__: null,
|
|
27671
|
+
'default': Page$d,
|
|
27672
|
+
getStaticProps: getStaticProps$b
|
|
27673
|
+
});
|
|
27674
|
+
|
|
27439
27675
|
configure({
|
|
27440
27676
|
enforceActions: "never",
|
|
27441
27677
|
});
|
|
@@ -27447,4 +27683,4 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
27447
27683
|
return IkasBaseStore;
|
|
27448
27684
|
}());
|
|
27449
27685
|
|
|
27450
|
-
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, 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, 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, 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 };
|
|
27686
|
+
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, 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 };
|
package/build/index.js
CHANGED
|
@@ -13499,6 +13499,16 @@ function parseRangeStr(rangeStr) {
|
|
|
13499
13499
|
}
|
|
13500
13500
|
}
|
|
13501
13501
|
|
|
13502
|
+
var IkasFavoriteProduct = /** @class */ (function () {
|
|
13503
|
+
function IkasFavoriteProduct(data) {
|
|
13504
|
+
this.id = data.id || "";
|
|
13505
|
+
this.customerId = data.customerId || "";
|
|
13506
|
+
this.productId = data.productId || "";
|
|
13507
|
+
mobx.makeAutoObservable(this);
|
|
13508
|
+
}
|
|
13509
|
+
return IkasFavoriteProduct;
|
|
13510
|
+
}());
|
|
13511
|
+
|
|
13502
13512
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
13503
13513
|
function IkasOrderTransaction(data) {
|
|
13504
13514
|
if (data === void 0) { data = {}; }
|
|
@@ -13765,6 +13775,7 @@ var IkasThemePage = /** @class */ (function () {
|
|
|
13765
13775
|
IkasThemePageType["FORGOT_PASSWORD"] = "FORGOT_PASSWORD";
|
|
13766
13776
|
IkasThemePageType["RECOVER_PASSWORD"] = "RECOVER_PASSWORD";
|
|
13767
13777
|
IkasThemePageType["CART"] = "CART";
|
|
13778
|
+
IkasThemePageType["FAVORITE_PRODUCTS"] = "FAVORITE_PRODUCTS";
|
|
13768
13779
|
})(exports.IkasThemePageType || (exports.IkasThemePageType = {}));
|
|
13769
13780
|
|
|
13770
13781
|
var IkasThemeColor = /** @class */ (function () {
|
|
@@ -23240,6 +23251,102 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
23240
23251
|
}());
|
|
23241
23252
|
var templateObject_1$f;
|
|
23242
23253
|
|
|
23254
|
+
var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
23255
|
+
function IkasFavoriteProductAPI() {
|
|
23256
|
+
}
|
|
23257
|
+
IkasFavoriteProductAPI.listFavoriteProducts = function () {
|
|
23258
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23259
|
+
var LIST_FAVORITE_PRODUCTS, _a, data, errors, err_1;
|
|
23260
|
+
return __generator(this, function (_b) {
|
|
23261
|
+
switch (_b.label) {
|
|
23262
|
+
case 0:
|
|
23263
|
+
LIST_FAVORITE_PRODUCTS = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
|
|
23264
|
+
_b.label = 1;
|
|
23265
|
+
case 1:
|
|
23266
|
+
_b.trys.push([1, 3, , 4]);
|
|
23267
|
+
return [4 /*yield*/, apollo
|
|
23268
|
+
.getClient()
|
|
23269
|
+
.query({
|
|
23270
|
+
query: LIST_FAVORITE_PRODUCTS,
|
|
23271
|
+
})];
|
|
23272
|
+
case 2:
|
|
23273
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23274
|
+
if (errors && errors.length)
|
|
23275
|
+
return [2 /*return*/, []];
|
|
23276
|
+
return [2 /*return*/, data.listFavoriteProducts.map(function (fP) { return new IkasFavoriteProduct(fP); })];
|
|
23277
|
+
case 3:
|
|
23278
|
+
err_1 = _b.sent();
|
|
23279
|
+
console.log(err_1);
|
|
23280
|
+
return [3 /*break*/, 4];
|
|
23281
|
+
case 4: return [2 /*return*/, []];
|
|
23282
|
+
}
|
|
23283
|
+
});
|
|
23284
|
+
});
|
|
23285
|
+
};
|
|
23286
|
+
IkasFavoriteProductAPI.isFavoriteProduct = function (productId) {
|
|
23287
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23288
|
+
var IS_FAVORITE_PRODUCT, _a, data, errors, err_2;
|
|
23289
|
+
return __generator(this, function (_b) {
|
|
23290
|
+
switch (_b.label) {
|
|
23291
|
+
case 0:
|
|
23292
|
+
IS_FAVORITE_PRODUCT = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "], ["\n query isFavoriteProduct($productId: String!) {\n isFavoriteProduct(productId: $productId)\n }\n "])));
|
|
23293
|
+
_b.label = 1;
|
|
23294
|
+
case 1:
|
|
23295
|
+
_b.trys.push([1, 3, , 4]);
|
|
23296
|
+
return [4 /*yield*/, apollo
|
|
23297
|
+
.getClient()
|
|
23298
|
+
.query({
|
|
23299
|
+
query: IS_FAVORITE_PRODUCT,
|
|
23300
|
+
variables: { productId: productId },
|
|
23301
|
+
})];
|
|
23302
|
+
case 2:
|
|
23303
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23304
|
+
if (errors && errors.length)
|
|
23305
|
+
return [2 /*return*/, false];
|
|
23306
|
+
return [2 /*return*/, data.isFavoriteProduct];
|
|
23307
|
+
case 3:
|
|
23308
|
+
err_2 = _b.sent();
|
|
23309
|
+
console.log(err_2);
|
|
23310
|
+
return [3 /*break*/, 4];
|
|
23311
|
+
case 4: return [2 /*return*/, false];
|
|
23312
|
+
}
|
|
23313
|
+
});
|
|
23314
|
+
});
|
|
23315
|
+
};
|
|
23316
|
+
IkasFavoriteProductAPI.saveFavoriteProduct = function (isFavorite, productId) {
|
|
23317
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23318
|
+
var SAVE_FAVORITE_PRODUCT, _a, data, errors, err_3;
|
|
23319
|
+
return __generator(this, function (_b) {
|
|
23320
|
+
switch (_b.label) {
|
|
23321
|
+
case 0:
|
|
23322
|
+
SAVE_FAVORITE_PRODUCT = src(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "], ["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "])));
|
|
23323
|
+
_b.label = 1;
|
|
23324
|
+
case 1:
|
|
23325
|
+
_b.trys.push([1, 3, , 4]);
|
|
23326
|
+
return [4 /*yield*/, apollo
|
|
23327
|
+
.getClient()
|
|
23328
|
+
.mutate({
|
|
23329
|
+
mutation: SAVE_FAVORITE_PRODUCT,
|
|
23330
|
+
variables: { isFavorite: isFavorite, productId: productId },
|
|
23331
|
+
})];
|
|
23332
|
+
case 2:
|
|
23333
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23334
|
+
if (errors && errors.length)
|
|
23335
|
+
return [2 /*return*/, false];
|
|
23336
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.saveFavoriteProduct) || true];
|
|
23337
|
+
case 3:
|
|
23338
|
+
err_3 = _b.sent();
|
|
23339
|
+
console.log(err_3);
|
|
23340
|
+
return [3 /*break*/, 4];
|
|
23341
|
+
case 4: return [2 /*return*/, false];
|
|
23342
|
+
}
|
|
23343
|
+
});
|
|
23344
|
+
});
|
|
23345
|
+
};
|
|
23346
|
+
return IkasFavoriteProductAPI;
|
|
23347
|
+
}());
|
|
23348
|
+
var templateObject_1$g, templateObject_2$5, templateObject_3$2;
|
|
23349
|
+
|
|
23243
23350
|
var IkasStateAPI = /** @class */ (function () {
|
|
23244
23351
|
function IkasStateAPI() {
|
|
23245
23352
|
}
|
|
@@ -23249,7 +23356,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23249
23356
|
return __generator(this, function (_b) {
|
|
23250
23357
|
switch (_b.label) {
|
|
23251
23358
|
case 0:
|
|
23252
|
-
QUERY = src(templateObject_1$
|
|
23359
|
+
QUERY = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
23253
23360
|
_b.label = 1;
|
|
23254
23361
|
case 1:
|
|
23255
23362
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23286,7 +23393,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23286
23393
|
};
|
|
23287
23394
|
return IkasStateAPI;
|
|
23288
23395
|
}());
|
|
23289
|
-
var templateObject_1$
|
|
23396
|
+
var templateObject_1$h;
|
|
23290
23397
|
|
|
23291
23398
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
23292
23399
|
function IkasStorefrontDomain(data) {
|
|
@@ -23379,7 +23486,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23379
23486
|
return __generator(this, function (_b) {
|
|
23380
23487
|
switch (_b.label) {
|
|
23381
23488
|
case 0:
|
|
23382
|
-
QUERY = src(templateObject_1$
|
|
23489
|
+
QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
23383
23490
|
_b.label = 1;
|
|
23384
23491
|
case 1:
|
|
23385
23492
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23409,7 +23516,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23409
23516
|
};
|
|
23410
23517
|
return IkasStorefrontAPI;
|
|
23411
23518
|
}());
|
|
23412
|
-
var templateObject_1$
|
|
23519
|
+
var templateObject_1$i;
|
|
23413
23520
|
|
|
23414
23521
|
var IkasThemeAPI = /** @class */ (function () {
|
|
23415
23522
|
function IkasThemeAPI() {
|
|
@@ -23566,6 +23673,107 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
23566
23673
|
});
|
|
23567
23674
|
});
|
|
23568
23675
|
};
|
|
23676
|
+
this.getFavoriteProductsIds = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23677
|
+
var favoriteProductsResult;
|
|
23678
|
+
return __generator(this, function (_b) {
|
|
23679
|
+
switch (_b.label) {
|
|
23680
|
+
case 0:
|
|
23681
|
+
_b.trys.push([0, 2, , 3]);
|
|
23682
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23683
|
+
case 1:
|
|
23684
|
+
favoriteProductsResult = _b.sent();
|
|
23685
|
+
return [2 /*return*/, favoriteProductsResult];
|
|
23686
|
+
case 2:
|
|
23687
|
+
_b.sent();
|
|
23688
|
+
return [2 /*return*/, []];
|
|
23689
|
+
case 3: return [2 /*return*/];
|
|
23690
|
+
}
|
|
23691
|
+
});
|
|
23692
|
+
}); };
|
|
23693
|
+
this.getFavoriteProducts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23694
|
+
var favoriteProductsResult, productsResult;
|
|
23695
|
+
return __generator(this, function (_b) {
|
|
23696
|
+
switch (_b.label) {
|
|
23697
|
+
case 0:
|
|
23698
|
+
_b.trys.push([0, 3, , 4]);
|
|
23699
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23700
|
+
case 1:
|
|
23701
|
+
favoriteProductsResult = _b.sent();
|
|
23702
|
+
if (!favoriteProductsResult.length)
|
|
23703
|
+
return [2 /*return*/, []];
|
|
23704
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23705
|
+
idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
23706
|
+
})];
|
|
23707
|
+
case 2:
|
|
23708
|
+
productsResult = _b.sent();
|
|
23709
|
+
return [2 /*return*/, productsResult.products];
|
|
23710
|
+
case 3:
|
|
23711
|
+
_b.sent();
|
|
23712
|
+
return [2 /*return*/, []];
|
|
23713
|
+
case 4: return [2 /*return*/];
|
|
23714
|
+
}
|
|
23715
|
+
});
|
|
23716
|
+
}); };
|
|
23717
|
+
this.addItemToFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23718
|
+
var customerId, result;
|
|
23719
|
+
var _b;
|
|
23720
|
+
return __generator(this, function (_c) {
|
|
23721
|
+
switch (_c.label) {
|
|
23722
|
+
case 0:
|
|
23723
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23724
|
+
if (!customerId)
|
|
23725
|
+
throw Error("Unauthorized");
|
|
23726
|
+
_c.label = 1;
|
|
23727
|
+
case 1:
|
|
23728
|
+
_c.trys.push([1, 3, , 4]);
|
|
23729
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(true, productId)];
|
|
23730
|
+
case 2:
|
|
23731
|
+
result = _c.sent();
|
|
23732
|
+
return [2 /*return*/, result];
|
|
23733
|
+
case 3:
|
|
23734
|
+
_c.sent();
|
|
23735
|
+
return [2 /*return*/, false];
|
|
23736
|
+
case 4: return [2 /*return*/];
|
|
23737
|
+
}
|
|
23738
|
+
});
|
|
23739
|
+
}); };
|
|
23740
|
+
this.removeItemFromFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23741
|
+
var customerId, result;
|
|
23742
|
+
var _b;
|
|
23743
|
+
return __generator(this, function (_c) {
|
|
23744
|
+
switch (_c.label) {
|
|
23745
|
+
case 0:
|
|
23746
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23747
|
+
if (!customerId)
|
|
23748
|
+
throw Error("Unauthorized");
|
|
23749
|
+
_c.label = 1;
|
|
23750
|
+
case 1:
|
|
23751
|
+
_c.trys.push([1, 3, , 4]);
|
|
23752
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(false, productId)];
|
|
23753
|
+
case 2:
|
|
23754
|
+
result = _c.sent();
|
|
23755
|
+
return [2 /*return*/, result];
|
|
23756
|
+
case 3:
|
|
23757
|
+
_c.sent();
|
|
23758
|
+
return [2 /*return*/, false];
|
|
23759
|
+
case 4: return [2 /*return*/];
|
|
23760
|
+
}
|
|
23761
|
+
});
|
|
23762
|
+
}); };
|
|
23763
|
+
this.isProductFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23764
|
+
var customerId;
|
|
23765
|
+
var _a;
|
|
23766
|
+
return __generator(this, function (_b) {
|
|
23767
|
+
switch (_b.label) {
|
|
23768
|
+
case 0:
|
|
23769
|
+
customerId = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
23770
|
+
if (!customerId)
|
|
23771
|
+
throw Error("Unauthorized");
|
|
23772
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.isFavoriteProduct(productId)];
|
|
23773
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
23774
|
+
}
|
|
23775
|
+
});
|
|
23776
|
+
}); };
|
|
23569
23777
|
this.baseStore = baseStore;
|
|
23570
23778
|
this.init();
|
|
23571
23779
|
mobx.makeAutoObservable(this);
|
|
@@ -27415,6 +27623,34 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
27415
27623
|
'default': editor
|
|
27416
27624
|
});
|
|
27417
27625
|
|
|
27626
|
+
var Page$d = function (_a) {
|
|
27627
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
27628
|
+
var router$1 = router.useRouter();
|
|
27629
|
+
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router$1);
|
|
27630
|
+
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
27631
|
+
};
|
|
27632
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
27633
|
+
var theme, provider;
|
|
27634
|
+
return __generator(this, function (_a) {
|
|
27635
|
+
switch (_a.label) {
|
|
27636
|
+
case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
|
|
27637
|
+
case 1:
|
|
27638
|
+
theme = _a.sent();
|
|
27639
|
+
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
|
|
27640
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
27641
|
+
case 2:
|
|
27642
|
+
_a.sent();
|
|
27643
|
+
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
27644
|
+
}
|
|
27645
|
+
});
|
|
27646
|
+
}); };
|
|
27647
|
+
|
|
27648
|
+
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
27649
|
+
__proto__: null,
|
|
27650
|
+
'default': Page$d,
|
|
27651
|
+
getStaticProps: getStaticProps$b
|
|
27652
|
+
});
|
|
27653
|
+
|
|
27418
27654
|
mobx.configure({
|
|
27419
27655
|
enforceActions: "never",
|
|
27420
27656
|
});
|
|
@@ -27436,6 +27672,7 @@ exports.CustomPage = _slug_;
|
|
|
27436
27672
|
exports.EditorPage = editor$1;
|
|
27437
27673
|
exports.EmailRule = EmailRule;
|
|
27438
27674
|
exports.EqualsRule = EqualsRule;
|
|
27675
|
+
exports.FavoriteProductsPage = favoriteProducts;
|
|
27439
27676
|
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
27440
27677
|
exports.ForgotPasswordPage = forgotPassword;
|
|
27441
27678
|
exports.GTMAddToCart = GTMAddToCart;
|
|
@@ -27470,6 +27707,8 @@ exports.IkasCustomer = IkasCustomer;
|
|
|
27470
27707
|
exports.IkasCustomerAPI = IkasCustomerAPI;
|
|
27471
27708
|
exports.IkasCustomerAddress = IkasCustomerAddress;
|
|
27472
27709
|
exports.IkasDistrictAPI = IkasDistrictAPI;
|
|
27710
|
+
exports.IkasFavoriteProduct = IkasFavoriteProduct;
|
|
27711
|
+
exports.IkasFavoriteProductAPI = IkasFavoriteProductAPI;
|
|
27473
27712
|
exports.IkasHTMLMetaData = IkasHTMLMetaData;
|
|
27474
27713
|
exports.IkasHTMLMetaDataAPI = IkasHTMLMetaDataAPI;
|
|
27475
27714
|
exports.IkasImage = IkasImage;
|
|
@@ -20,6 +20,7 @@ export { IkasProductPrice } from "./product/variant/price/index";
|
|
|
20
20
|
export { IkasProductAttribute } from "./product-attribute/index";
|
|
21
21
|
export { IkasProductAttributeValue } from "./product/attribute-value/index";
|
|
22
22
|
export * from "./product-filter/index";
|
|
23
|
+
export { IkasFavoriteProduct } from "./favorite-product/index";
|
|
23
24
|
export type { IkasState } from "./state/index";
|
|
24
25
|
export * from "./variant-type/index";
|
|
25
26
|
export { IkasVariantValue } from "./variant-type/variant-value/index";
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|
|
9
|
+
declare const Page: React.FC<Props>;
|
|
10
|
+
export default Page;
|
|
11
|
+
export declare const getStaticProps: GetStaticProps;
|
package/build/pages/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ import * as ForgotPasswordPage from "./account/forgot-password";
|
|
|
12
12
|
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, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IkasCustomer, IkasOrderTransaction } from "../models/index";
|
|
1
|
+
import { IkasCustomer, IkasFavoriteProduct, IkasOrderTransaction, IkasProduct } from "../models/index";
|
|
2
2
|
import { IkasBaseStore } from "./base";
|
|
3
3
|
export declare class IkasCustomerStore {
|
|
4
4
|
customer?: IkasCustomer | null;
|
|
@@ -22,6 +22,11 @@ export declare class IkasCustomerStore {
|
|
|
22
22
|
id?: string;
|
|
23
23
|
orderId?: string;
|
|
24
24
|
}) => Promise<IkasOrderTransaction[]>;
|
|
25
|
+
getFavoriteProductsIds: () => Promise<IkasFavoriteProduct[]>;
|
|
26
|
+
getFavoriteProducts: () => Promise<IkasProduct[]>;
|
|
27
|
+
addItemToFavorite: (productId: string) => Promise<boolean>;
|
|
28
|
+
removeItemFromFavorite: (productId: string) => Promise<boolean>;
|
|
29
|
+
isProductFavorite: (productId: string) => Promise<boolean>;
|
|
25
30
|
private init;
|
|
26
31
|
private getCustomer;
|
|
27
32
|
private refreshToken;
|