@ikas/storefront 0.0.50 → 0.0.52
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 -6
- package/build/index.js +243 -5
- 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 () {
|
|
@@ -15244,7 +15255,6 @@ var IkasProductList = /** @class */ (function () {
|
|
|
15244
15255
|
: null;
|
|
15245
15256
|
this.router = router;
|
|
15246
15257
|
makeAutoObservable(this);
|
|
15247
|
-
console.log("constructor");
|
|
15248
15258
|
if (this.isBrowser() && location.search) {
|
|
15249
15259
|
var queryParams = this.getQueryParams();
|
|
15250
15260
|
this.getInitial(queryParams);
|
|
@@ -23261,6 +23271,102 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
23261
23271
|
}());
|
|
23262
23272
|
var templateObject_1$f;
|
|
23263
23273
|
|
|
23274
|
+
var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
23275
|
+
function IkasFavoriteProductAPI() {
|
|
23276
|
+
}
|
|
23277
|
+
IkasFavoriteProductAPI.listFavoriteProducts = function () {
|
|
23278
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23279
|
+
var LIST_FAVORITE_PRODUCTS, _a, data, errors, err_1;
|
|
23280
|
+
return __generator(this, function (_b) {
|
|
23281
|
+
switch (_b.label) {
|
|
23282
|
+
case 0:
|
|
23283
|
+
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 "])));
|
|
23284
|
+
_b.label = 1;
|
|
23285
|
+
case 1:
|
|
23286
|
+
_b.trys.push([1, 3, , 4]);
|
|
23287
|
+
return [4 /*yield*/, apollo
|
|
23288
|
+
.getClient()
|
|
23289
|
+
.query({
|
|
23290
|
+
query: LIST_FAVORITE_PRODUCTS,
|
|
23291
|
+
})];
|
|
23292
|
+
case 2:
|
|
23293
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23294
|
+
if (errors && errors.length)
|
|
23295
|
+
return [2 /*return*/, []];
|
|
23296
|
+
return [2 /*return*/, data.listFavoriteProducts.map(function (fP) { return new IkasFavoriteProduct(fP); })];
|
|
23297
|
+
case 3:
|
|
23298
|
+
err_1 = _b.sent();
|
|
23299
|
+
console.log(err_1);
|
|
23300
|
+
return [3 /*break*/, 4];
|
|
23301
|
+
case 4: return [2 /*return*/, []];
|
|
23302
|
+
}
|
|
23303
|
+
});
|
|
23304
|
+
});
|
|
23305
|
+
};
|
|
23306
|
+
IkasFavoriteProductAPI.isFavoriteProduct = function (productId) {
|
|
23307
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23308
|
+
var IS_FAVORITE_PRODUCT, _a, data, errors, err_2;
|
|
23309
|
+
return __generator(this, function (_b) {
|
|
23310
|
+
switch (_b.label) {
|
|
23311
|
+
case 0:
|
|
23312
|
+
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 "])));
|
|
23313
|
+
_b.label = 1;
|
|
23314
|
+
case 1:
|
|
23315
|
+
_b.trys.push([1, 3, , 4]);
|
|
23316
|
+
return [4 /*yield*/, apollo
|
|
23317
|
+
.getClient()
|
|
23318
|
+
.query({
|
|
23319
|
+
query: IS_FAVORITE_PRODUCT,
|
|
23320
|
+
variables: { productId: productId },
|
|
23321
|
+
})];
|
|
23322
|
+
case 2:
|
|
23323
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23324
|
+
if (errors && errors.length)
|
|
23325
|
+
return [2 /*return*/, false];
|
|
23326
|
+
return [2 /*return*/, data.isFavoriteProduct];
|
|
23327
|
+
case 3:
|
|
23328
|
+
err_2 = _b.sent();
|
|
23329
|
+
console.log(err_2);
|
|
23330
|
+
return [3 /*break*/, 4];
|
|
23331
|
+
case 4: return [2 /*return*/, false];
|
|
23332
|
+
}
|
|
23333
|
+
});
|
|
23334
|
+
});
|
|
23335
|
+
};
|
|
23336
|
+
IkasFavoriteProductAPI.saveFavoriteProduct = function (isFavorite, productId) {
|
|
23337
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23338
|
+
var SAVE_FAVORITE_PRODUCT, _a, data, errors, err_3;
|
|
23339
|
+
return __generator(this, function (_b) {
|
|
23340
|
+
switch (_b.label) {
|
|
23341
|
+
case 0:
|
|
23342
|
+
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 "])));
|
|
23343
|
+
_b.label = 1;
|
|
23344
|
+
case 1:
|
|
23345
|
+
_b.trys.push([1, 3, , 4]);
|
|
23346
|
+
return [4 /*yield*/, apollo
|
|
23347
|
+
.getClient()
|
|
23348
|
+
.mutate({
|
|
23349
|
+
mutation: SAVE_FAVORITE_PRODUCT,
|
|
23350
|
+
variables: { isFavorite: isFavorite, productId: productId },
|
|
23351
|
+
})];
|
|
23352
|
+
case 2:
|
|
23353
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23354
|
+
if (errors && errors.length)
|
|
23355
|
+
return [2 /*return*/, false];
|
|
23356
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.saveFavoriteProduct) || true];
|
|
23357
|
+
case 3:
|
|
23358
|
+
err_3 = _b.sent();
|
|
23359
|
+
console.log(err_3);
|
|
23360
|
+
return [3 /*break*/, 4];
|
|
23361
|
+
case 4: return [2 /*return*/, false];
|
|
23362
|
+
}
|
|
23363
|
+
});
|
|
23364
|
+
});
|
|
23365
|
+
};
|
|
23366
|
+
return IkasFavoriteProductAPI;
|
|
23367
|
+
}());
|
|
23368
|
+
var templateObject_1$g, templateObject_2$5, templateObject_3$2;
|
|
23369
|
+
|
|
23264
23370
|
var IkasStateAPI = /** @class */ (function () {
|
|
23265
23371
|
function IkasStateAPI() {
|
|
23266
23372
|
}
|
|
@@ -23270,7 +23376,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23270
23376
|
return __generator(this, function (_b) {
|
|
23271
23377
|
switch (_b.label) {
|
|
23272
23378
|
case 0:
|
|
23273
|
-
QUERY = src(templateObject_1$
|
|
23379
|
+
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
23380
|
_b.label = 1;
|
|
23275
23381
|
case 1:
|
|
23276
23382
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23307,7 +23413,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23307
23413
|
};
|
|
23308
23414
|
return IkasStateAPI;
|
|
23309
23415
|
}());
|
|
23310
|
-
var templateObject_1$
|
|
23416
|
+
var templateObject_1$h;
|
|
23311
23417
|
|
|
23312
23418
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
23313
23419
|
function IkasStorefrontDomain(data) {
|
|
@@ -23400,7 +23506,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23400
23506
|
return __generator(this, function (_b) {
|
|
23401
23507
|
switch (_b.label) {
|
|
23402
23508
|
case 0:
|
|
23403
|
-
QUERY = src(templateObject_1$
|
|
23509
|
+
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
23510
|
_b.label = 1;
|
|
23405
23511
|
case 1:
|
|
23406
23512
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23430,7 +23536,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23430
23536
|
};
|
|
23431
23537
|
return IkasStorefrontAPI;
|
|
23432
23538
|
}());
|
|
23433
|
-
var templateObject_1$
|
|
23539
|
+
var templateObject_1$i;
|
|
23434
23540
|
|
|
23435
23541
|
var IkasThemeAPI = /** @class */ (function () {
|
|
23436
23542
|
function IkasThemeAPI() {
|
|
@@ -23587,6 +23693,107 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
23587
23693
|
});
|
|
23588
23694
|
});
|
|
23589
23695
|
};
|
|
23696
|
+
this.getFavoriteProductsIds = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23697
|
+
var favoriteProductsResult;
|
|
23698
|
+
return __generator(this, function (_b) {
|
|
23699
|
+
switch (_b.label) {
|
|
23700
|
+
case 0:
|
|
23701
|
+
_b.trys.push([0, 2, , 3]);
|
|
23702
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23703
|
+
case 1:
|
|
23704
|
+
favoriteProductsResult = _b.sent();
|
|
23705
|
+
return [2 /*return*/, favoriteProductsResult];
|
|
23706
|
+
case 2:
|
|
23707
|
+
_b.sent();
|
|
23708
|
+
return [2 /*return*/, []];
|
|
23709
|
+
case 3: return [2 /*return*/];
|
|
23710
|
+
}
|
|
23711
|
+
});
|
|
23712
|
+
}); };
|
|
23713
|
+
this.getFavoriteProducts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23714
|
+
var favoriteProductsResult, productsResult;
|
|
23715
|
+
return __generator(this, function (_b) {
|
|
23716
|
+
switch (_b.label) {
|
|
23717
|
+
case 0:
|
|
23718
|
+
_b.trys.push([0, 3, , 4]);
|
|
23719
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23720
|
+
case 1:
|
|
23721
|
+
favoriteProductsResult = _b.sent();
|
|
23722
|
+
if (!favoriteProductsResult.length)
|
|
23723
|
+
return [2 /*return*/, []];
|
|
23724
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23725
|
+
idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
23726
|
+
})];
|
|
23727
|
+
case 2:
|
|
23728
|
+
productsResult = _b.sent();
|
|
23729
|
+
return [2 /*return*/, productsResult.products];
|
|
23730
|
+
case 3:
|
|
23731
|
+
_b.sent();
|
|
23732
|
+
return [2 /*return*/, []];
|
|
23733
|
+
case 4: return [2 /*return*/];
|
|
23734
|
+
}
|
|
23735
|
+
});
|
|
23736
|
+
}); };
|
|
23737
|
+
this.addItemToFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23738
|
+
var customerId, result;
|
|
23739
|
+
var _b;
|
|
23740
|
+
return __generator(this, function (_c) {
|
|
23741
|
+
switch (_c.label) {
|
|
23742
|
+
case 0:
|
|
23743
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23744
|
+
if (!customerId)
|
|
23745
|
+
throw Error("Unauthorized");
|
|
23746
|
+
_c.label = 1;
|
|
23747
|
+
case 1:
|
|
23748
|
+
_c.trys.push([1, 3, , 4]);
|
|
23749
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(true, productId)];
|
|
23750
|
+
case 2:
|
|
23751
|
+
result = _c.sent();
|
|
23752
|
+
return [2 /*return*/, result];
|
|
23753
|
+
case 3:
|
|
23754
|
+
_c.sent();
|
|
23755
|
+
return [2 /*return*/, false];
|
|
23756
|
+
case 4: return [2 /*return*/];
|
|
23757
|
+
}
|
|
23758
|
+
});
|
|
23759
|
+
}); };
|
|
23760
|
+
this.removeItemFromFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23761
|
+
var customerId, result;
|
|
23762
|
+
var _b;
|
|
23763
|
+
return __generator(this, function (_c) {
|
|
23764
|
+
switch (_c.label) {
|
|
23765
|
+
case 0:
|
|
23766
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23767
|
+
if (!customerId)
|
|
23768
|
+
throw Error("Unauthorized");
|
|
23769
|
+
_c.label = 1;
|
|
23770
|
+
case 1:
|
|
23771
|
+
_c.trys.push([1, 3, , 4]);
|
|
23772
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(false, productId)];
|
|
23773
|
+
case 2:
|
|
23774
|
+
result = _c.sent();
|
|
23775
|
+
return [2 /*return*/, result];
|
|
23776
|
+
case 3:
|
|
23777
|
+
_c.sent();
|
|
23778
|
+
return [2 /*return*/, false];
|
|
23779
|
+
case 4: return [2 /*return*/];
|
|
23780
|
+
}
|
|
23781
|
+
});
|
|
23782
|
+
}); };
|
|
23783
|
+
this.isProductFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23784
|
+
var customerId;
|
|
23785
|
+
var _a;
|
|
23786
|
+
return __generator(this, function (_b) {
|
|
23787
|
+
switch (_b.label) {
|
|
23788
|
+
case 0:
|
|
23789
|
+
customerId = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
23790
|
+
if (!customerId)
|
|
23791
|
+
throw Error("Unauthorized");
|
|
23792
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.isFavoriteProduct(productId)];
|
|
23793
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
23794
|
+
}
|
|
23795
|
+
});
|
|
23796
|
+
}); };
|
|
23590
23797
|
this.baseStore = baseStore;
|
|
23591
23798
|
this.init();
|
|
23592
23799
|
makeAutoObservable(this);
|
|
@@ -27436,6 +27643,34 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
27436
27643
|
'default': editor
|
|
27437
27644
|
});
|
|
27438
27645
|
|
|
27646
|
+
var Page$d = function (_a) {
|
|
27647
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
27648
|
+
var router = useRouter();
|
|
27649
|
+
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
27650
|
+
return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
27651
|
+
};
|
|
27652
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
27653
|
+
var theme, provider;
|
|
27654
|
+
return __generator(this, function (_a) {
|
|
27655
|
+
switch (_a.label) {
|
|
27656
|
+
case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
|
|
27657
|
+
case 1:
|
|
27658
|
+
theme = _a.sent();
|
|
27659
|
+
provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FAVORITE_PRODUCTS);
|
|
27660
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
27661
|
+
case 2:
|
|
27662
|
+
_a.sent();
|
|
27663
|
+
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
27664
|
+
}
|
|
27665
|
+
});
|
|
27666
|
+
}); };
|
|
27667
|
+
|
|
27668
|
+
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
27669
|
+
__proto__: null,
|
|
27670
|
+
'default': Page$d,
|
|
27671
|
+
getStaticProps: getStaticProps$b
|
|
27672
|
+
});
|
|
27673
|
+
|
|
27439
27674
|
configure({
|
|
27440
27675
|
enforceActions: "never",
|
|
27441
27676
|
});
|
|
@@ -27447,4 +27682,4 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
27447
27682
|
return IkasBaseStore;
|
|
27448
27683
|
}());
|
|
27449
27684
|
|
|
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 };
|
|
27685
|
+
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 () {
|
|
@@ -15226,7 +15237,6 @@ var IkasProductList = /** @class */ (function () {
|
|
|
15226
15237
|
: null;
|
|
15227
15238
|
this.router = router;
|
|
15228
15239
|
mobx.makeAutoObservable(this);
|
|
15229
|
-
console.log("constructor");
|
|
15230
15240
|
if (this.isBrowser() && location.search) {
|
|
15231
15241
|
var queryParams = this.getQueryParams();
|
|
15232
15242
|
this.getInitial(queryParams);
|
|
@@ -23240,6 +23250,102 @@ var IkasProductAttributeAPI = /** @class */ (function () {
|
|
|
23240
23250
|
}());
|
|
23241
23251
|
var templateObject_1$f;
|
|
23242
23252
|
|
|
23253
|
+
var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
23254
|
+
function IkasFavoriteProductAPI() {
|
|
23255
|
+
}
|
|
23256
|
+
IkasFavoriteProductAPI.listFavoriteProducts = function () {
|
|
23257
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23258
|
+
var LIST_FAVORITE_PRODUCTS, _a, data, errors, err_1;
|
|
23259
|
+
return __generator(this, function (_b) {
|
|
23260
|
+
switch (_b.label) {
|
|
23261
|
+
case 0:
|
|
23262
|
+
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 "])));
|
|
23263
|
+
_b.label = 1;
|
|
23264
|
+
case 1:
|
|
23265
|
+
_b.trys.push([1, 3, , 4]);
|
|
23266
|
+
return [4 /*yield*/, apollo
|
|
23267
|
+
.getClient()
|
|
23268
|
+
.query({
|
|
23269
|
+
query: LIST_FAVORITE_PRODUCTS,
|
|
23270
|
+
})];
|
|
23271
|
+
case 2:
|
|
23272
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23273
|
+
if (errors && errors.length)
|
|
23274
|
+
return [2 /*return*/, []];
|
|
23275
|
+
return [2 /*return*/, data.listFavoriteProducts.map(function (fP) { return new IkasFavoriteProduct(fP); })];
|
|
23276
|
+
case 3:
|
|
23277
|
+
err_1 = _b.sent();
|
|
23278
|
+
console.log(err_1);
|
|
23279
|
+
return [3 /*break*/, 4];
|
|
23280
|
+
case 4: return [2 /*return*/, []];
|
|
23281
|
+
}
|
|
23282
|
+
});
|
|
23283
|
+
});
|
|
23284
|
+
};
|
|
23285
|
+
IkasFavoriteProductAPI.isFavoriteProduct = function (productId) {
|
|
23286
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23287
|
+
var IS_FAVORITE_PRODUCT, _a, data, errors, err_2;
|
|
23288
|
+
return __generator(this, function (_b) {
|
|
23289
|
+
switch (_b.label) {
|
|
23290
|
+
case 0:
|
|
23291
|
+
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 "])));
|
|
23292
|
+
_b.label = 1;
|
|
23293
|
+
case 1:
|
|
23294
|
+
_b.trys.push([1, 3, , 4]);
|
|
23295
|
+
return [4 /*yield*/, apollo
|
|
23296
|
+
.getClient()
|
|
23297
|
+
.query({
|
|
23298
|
+
query: IS_FAVORITE_PRODUCT,
|
|
23299
|
+
variables: { productId: productId },
|
|
23300
|
+
})];
|
|
23301
|
+
case 2:
|
|
23302
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23303
|
+
if (errors && errors.length)
|
|
23304
|
+
return [2 /*return*/, false];
|
|
23305
|
+
return [2 /*return*/, data.isFavoriteProduct];
|
|
23306
|
+
case 3:
|
|
23307
|
+
err_2 = _b.sent();
|
|
23308
|
+
console.log(err_2);
|
|
23309
|
+
return [3 /*break*/, 4];
|
|
23310
|
+
case 4: return [2 /*return*/, false];
|
|
23311
|
+
}
|
|
23312
|
+
});
|
|
23313
|
+
});
|
|
23314
|
+
};
|
|
23315
|
+
IkasFavoriteProductAPI.saveFavoriteProduct = function (isFavorite, productId) {
|
|
23316
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23317
|
+
var SAVE_FAVORITE_PRODUCT, _a, data, errors, err_3;
|
|
23318
|
+
return __generator(this, function (_b) {
|
|
23319
|
+
switch (_b.label) {
|
|
23320
|
+
case 0:
|
|
23321
|
+
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 "])));
|
|
23322
|
+
_b.label = 1;
|
|
23323
|
+
case 1:
|
|
23324
|
+
_b.trys.push([1, 3, , 4]);
|
|
23325
|
+
return [4 /*yield*/, apollo
|
|
23326
|
+
.getClient()
|
|
23327
|
+
.mutate({
|
|
23328
|
+
mutation: SAVE_FAVORITE_PRODUCT,
|
|
23329
|
+
variables: { isFavorite: isFavorite, productId: productId },
|
|
23330
|
+
})];
|
|
23331
|
+
case 2:
|
|
23332
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
23333
|
+
if (errors && errors.length)
|
|
23334
|
+
return [2 /*return*/, false];
|
|
23335
|
+
return [2 /*return*/, (data === null || data === void 0 ? void 0 : data.saveFavoriteProduct) || true];
|
|
23336
|
+
case 3:
|
|
23337
|
+
err_3 = _b.sent();
|
|
23338
|
+
console.log(err_3);
|
|
23339
|
+
return [3 /*break*/, 4];
|
|
23340
|
+
case 4: return [2 /*return*/, false];
|
|
23341
|
+
}
|
|
23342
|
+
});
|
|
23343
|
+
});
|
|
23344
|
+
};
|
|
23345
|
+
return IkasFavoriteProductAPI;
|
|
23346
|
+
}());
|
|
23347
|
+
var templateObject_1$g, templateObject_2$5, templateObject_3$2;
|
|
23348
|
+
|
|
23243
23349
|
var IkasStateAPI = /** @class */ (function () {
|
|
23244
23350
|
function IkasStateAPI() {
|
|
23245
23351
|
}
|
|
@@ -23249,7 +23355,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23249
23355
|
return __generator(this, function (_b) {
|
|
23250
23356
|
switch (_b.label) {
|
|
23251
23357
|
case 0:
|
|
23252
|
-
QUERY = src(templateObject_1$
|
|
23358
|
+
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
23359
|
_b.label = 1;
|
|
23254
23360
|
case 1:
|
|
23255
23361
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23286,7 +23392,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
23286
23392
|
};
|
|
23287
23393
|
return IkasStateAPI;
|
|
23288
23394
|
}());
|
|
23289
|
-
var templateObject_1$
|
|
23395
|
+
var templateObject_1$h;
|
|
23290
23396
|
|
|
23291
23397
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
23292
23398
|
function IkasStorefrontDomain(data) {
|
|
@@ -23379,7 +23485,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23379
23485
|
return __generator(this, function (_b) {
|
|
23380
23486
|
switch (_b.label) {
|
|
23381
23487
|
case 0:
|
|
23382
|
-
QUERY = src(templateObject_1$
|
|
23488
|
+
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
23489
|
_b.label = 1;
|
|
23384
23490
|
case 1:
|
|
23385
23491
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23409,7 +23515,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
23409
23515
|
};
|
|
23410
23516
|
return IkasStorefrontAPI;
|
|
23411
23517
|
}());
|
|
23412
|
-
var templateObject_1$
|
|
23518
|
+
var templateObject_1$i;
|
|
23413
23519
|
|
|
23414
23520
|
var IkasThemeAPI = /** @class */ (function () {
|
|
23415
23521
|
function IkasThemeAPI() {
|
|
@@ -23566,6 +23672,107 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
23566
23672
|
});
|
|
23567
23673
|
});
|
|
23568
23674
|
};
|
|
23675
|
+
this.getFavoriteProductsIds = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23676
|
+
var favoriteProductsResult;
|
|
23677
|
+
return __generator(this, function (_b) {
|
|
23678
|
+
switch (_b.label) {
|
|
23679
|
+
case 0:
|
|
23680
|
+
_b.trys.push([0, 2, , 3]);
|
|
23681
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23682
|
+
case 1:
|
|
23683
|
+
favoriteProductsResult = _b.sent();
|
|
23684
|
+
return [2 /*return*/, favoriteProductsResult];
|
|
23685
|
+
case 2:
|
|
23686
|
+
_b.sent();
|
|
23687
|
+
return [2 /*return*/, []];
|
|
23688
|
+
case 3: return [2 /*return*/];
|
|
23689
|
+
}
|
|
23690
|
+
});
|
|
23691
|
+
}); };
|
|
23692
|
+
this.getFavoriteProducts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23693
|
+
var favoriteProductsResult, productsResult;
|
|
23694
|
+
return __generator(this, function (_b) {
|
|
23695
|
+
switch (_b.label) {
|
|
23696
|
+
case 0:
|
|
23697
|
+
_b.trys.push([0, 3, , 4]);
|
|
23698
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.listFavoriteProducts()];
|
|
23699
|
+
case 1:
|
|
23700
|
+
favoriteProductsResult = _b.sent();
|
|
23701
|
+
if (!favoriteProductsResult.length)
|
|
23702
|
+
return [2 /*return*/, []];
|
|
23703
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23704
|
+
idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
23705
|
+
})];
|
|
23706
|
+
case 2:
|
|
23707
|
+
productsResult = _b.sent();
|
|
23708
|
+
return [2 /*return*/, productsResult.products];
|
|
23709
|
+
case 3:
|
|
23710
|
+
_b.sent();
|
|
23711
|
+
return [2 /*return*/, []];
|
|
23712
|
+
case 4: return [2 /*return*/];
|
|
23713
|
+
}
|
|
23714
|
+
});
|
|
23715
|
+
}); };
|
|
23716
|
+
this.addItemToFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23717
|
+
var customerId, result;
|
|
23718
|
+
var _b;
|
|
23719
|
+
return __generator(this, function (_c) {
|
|
23720
|
+
switch (_c.label) {
|
|
23721
|
+
case 0:
|
|
23722
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23723
|
+
if (!customerId)
|
|
23724
|
+
throw Error("Unauthorized");
|
|
23725
|
+
_c.label = 1;
|
|
23726
|
+
case 1:
|
|
23727
|
+
_c.trys.push([1, 3, , 4]);
|
|
23728
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(true, productId)];
|
|
23729
|
+
case 2:
|
|
23730
|
+
result = _c.sent();
|
|
23731
|
+
return [2 /*return*/, result];
|
|
23732
|
+
case 3:
|
|
23733
|
+
_c.sent();
|
|
23734
|
+
return [2 /*return*/, false];
|
|
23735
|
+
case 4: return [2 /*return*/];
|
|
23736
|
+
}
|
|
23737
|
+
});
|
|
23738
|
+
}); };
|
|
23739
|
+
this.removeItemFromFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23740
|
+
var customerId, result;
|
|
23741
|
+
var _b;
|
|
23742
|
+
return __generator(this, function (_c) {
|
|
23743
|
+
switch (_c.label) {
|
|
23744
|
+
case 0:
|
|
23745
|
+
customerId = (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id;
|
|
23746
|
+
if (!customerId)
|
|
23747
|
+
throw Error("Unauthorized");
|
|
23748
|
+
_c.label = 1;
|
|
23749
|
+
case 1:
|
|
23750
|
+
_c.trys.push([1, 3, , 4]);
|
|
23751
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.saveFavoriteProduct(false, productId)];
|
|
23752
|
+
case 2:
|
|
23753
|
+
result = _c.sent();
|
|
23754
|
+
return [2 /*return*/, result];
|
|
23755
|
+
case 3:
|
|
23756
|
+
_c.sent();
|
|
23757
|
+
return [2 /*return*/, false];
|
|
23758
|
+
case 4: return [2 /*return*/];
|
|
23759
|
+
}
|
|
23760
|
+
});
|
|
23761
|
+
}); };
|
|
23762
|
+
this.isProductFavorite = function (productId) { return __awaiter(_this, void 0, void 0, function () {
|
|
23763
|
+
var customerId;
|
|
23764
|
+
var _a;
|
|
23765
|
+
return __generator(this, function (_b) {
|
|
23766
|
+
switch (_b.label) {
|
|
23767
|
+
case 0:
|
|
23768
|
+
customerId = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
23769
|
+
if (!customerId)
|
|
23770
|
+
throw Error("Unauthorized");
|
|
23771
|
+
return [4 /*yield*/, IkasFavoriteProductAPI.isFavoriteProduct(productId)];
|
|
23772
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
23773
|
+
}
|
|
23774
|
+
});
|
|
23775
|
+
}); };
|
|
23569
23776
|
this.baseStore = baseStore;
|
|
23570
23777
|
this.init();
|
|
23571
23778
|
mobx.makeAutoObservable(this);
|
|
@@ -27415,6 +27622,34 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
27415
27622
|
'default': editor
|
|
27416
27623
|
});
|
|
27417
27624
|
|
|
27625
|
+
var Page$d = function (_a) {
|
|
27626
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
27627
|
+
var router$1 = router.useRouter();
|
|
27628
|
+
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router$1);
|
|
27629
|
+
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
27630
|
+
};
|
|
27631
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
27632
|
+
var theme, provider;
|
|
27633
|
+
return __generator(this, function (_a) {
|
|
27634
|
+
switch (_a.label) {
|
|
27635
|
+
case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
|
|
27636
|
+
case 1:
|
|
27637
|
+
theme = _a.sent();
|
|
27638
|
+
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
|
|
27639
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
27640
|
+
case 2:
|
|
27641
|
+
_a.sent();
|
|
27642
|
+
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
27643
|
+
}
|
|
27644
|
+
});
|
|
27645
|
+
}); };
|
|
27646
|
+
|
|
27647
|
+
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
27648
|
+
__proto__: null,
|
|
27649
|
+
'default': Page$d,
|
|
27650
|
+
getStaticProps: getStaticProps$b
|
|
27651
|
+
});
|
|
27652
|
+
|
|
27418
27653
|
mobx.configure({
|
|
27419
27654
|
enforceActions: "never",
|
|
27420
27655
|
});
|
|
@@ -27436,6 +27671,7 @@ exports.CustomPage = _slug_;
|
|
|
27436
27671
|
exports.EditorPage = editor$1;
|
|
27437
27672
|
exports.EmailRule = EmailRule;
|
|
27438
27673
|
exports.EqualsRule = EqualsRule;
|
|
27674
|
+
exports.FavoriteProductsPage = favoriteProducts;
|
|
27439
27675
|
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
27440
27676
|
exports.ForgotPasswordPage = forgotPassword;
|
|
27441
27677
|
exports.GTMAddToCart = GTMAddToCart;
|
|
@@ -27470,6 +27706,8 @@ exports.IkasCustomer = IkasCustomer;
|
|
|
27470
27706
|
exports.IkasCustomerAPI = IkasCustomerAPI;
|
|
27471
27707
|
exports.IkasCustomerAddress = IkasCustomerAddress;
|
|
27472
27708
|
exports.IkasDistrictAPI = IkasDistrictAPI;
|
|
27709
|
+
exports.IkasFavoriteProduct = IkasFavoriteProduct;
|
|
27710
|
+
exports.IkasFavoriteProductAPI = IkasFavoriteProductAPI;
|
|
27473
27711
|
exports.IkasHTMLMetaData = IkasHTMLMetaData;
|
|
27474
27712
|
exports.IkasHTMLMetaDataAPI = IkasHTMLMetaDataAPI;
|
|
27475
27713
|
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;
|