@infrab4a/connect 1.0.5 → 2.0.0-beta.0
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/bundles/infrab4a-connect.umd.js +93 -115
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/enums/index.d.ts +0 -1
- package/domain/catalog/models/enums/shops.enum.d.ts +2 -1
- package/domain/catalog/models/product.d.ts +1 -2
- package/domain/catalog/models/types/index.d.ts +3 -4
- package/domain/shopping/models/coupons/coupon.d.ts +15 -7
- package/domain/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +5 -0
- package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +2 -4
- package/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +4 -1
- package/domain/shopping/models/coupons/index.d.ts +0 -1
- package/domain/shopping/models/enums/checkout-types.enum.d.ts +2 -1
- package/esm2015/domain/catalog/models/enums/index.js +1 -2
- package/esm2015/domain/catalog/models/enums/shops.enum.js +2 -1
- package/esm2015/domain/catalog/models/product.js +1 -1
- package/esm2015/domain/catalog/models/types/index.js +4 -5
- package/esm2015/domain/shopping/models/coupons/coupon.js +18 -3
- package/esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js +7 -0
- package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +1 -1
- package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +7 -5
- package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +4 -1
- package/esm2015/domain/shopping/models/coupons/index.js +1 -2
- package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +2 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +2 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +2 -4
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +3 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +4 -7
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +3 -6
- package/fesm2015/infrab4a-connect.js +42 -59
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
- package/domain/catalog/models/enums/product-genders.enum.d.ts +0 -5
- package/domain/catalog/models/types/product-gender.type.d.ts +0 -1
- package/domain/shopping/models/coupons/financial-coupon.d.ts +0 -9
- package/esm2015/domain/catalog/models/enums/product-genders.enum.js +0 -7
- package/esm2015/domain/catalog/models/types/product-gender.type.js +0 -2
- package/esm2015/domain/shopping/models/coupons/financial-coupon.js +0 -28
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global
|
|
5
|
-
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder'), require('node-fetch')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder', 'node-fetch'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"], global["node-fetch"]));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, axios, firebase, gqlQueryBuilder, fetch) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -856,6 +856,40 @@
|
|
|
856
856
|
return date;
|
|
857
857
|
};
|
|
858
858
|
|
|
859
|
+
exports.CheckoutTypes = void 0;
|
|
860
|
+
(function (CheckoutTypes) {
|
|
861
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
862
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
863
|
+
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
864
|
+
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
865
|
+
|
|
866
|
+
exports.CouponTypes = void 0;
|
|
867
|
+
(function (CouponTypes) {
|
|
868
|
+
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
869
|
+
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
870
|
+
// FINANCIAL = 1,
|
|
871
|
+
// PRODUCT,
|
|
872
|
+
// GIFTCARD,
|
|
873
|
+
// VOUCHER,
|
|
874
|
+
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
875
|
+
|
|
876
|
+
exports.CouponSubtypes = void 0;
|
|
877
|
+
(function (CouponSubtypes) {
|
|
878
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
879
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
880
|
+
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
881
|
+
|
|
882
|
+
exports.Exclusivities = void 0;
|
|
883
|
+
(function (Exclusivities) {
|
|
884
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
885
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
886
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
887
|
+
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
888
|
+
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
889
|
+
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
890
|
+
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
891
|
+
|
|
892
|
+
var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
859
893
|
var Coupon = /** @class */ (function (_super) {
|
|
860
894
|
__extends(Coupon, _super);
|
|
861
895
|
function Coupon() {
|
|
@@ -875,6 +909,20 @@
|
|
|
875
909
|
enumerable: false,
|
|
876
910
|
configurable: true
|
|
877
911
|
});
|
|
912
|
+
Coupon.createCoupon = function (userId) {
|
|
913
|
+
return this.toInstance({
|
|
914
|
+
nickname: "" + Date.now(),
|
|
915
|
+
type: exports.CouponTypes.ABSOLUTE,
|
|
916
|
+
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
917
|
+
discount: 30,
|
|
918
|
+
user: userId,
|
|
919
|
+
useLimit: 1,
|
|
920
|
+
useLimitPerUser: true,
|
|
921
|
+
createdAt: new Date(Date.now()),
|
|
922
|
+
beginAt: new Date(Date.now()),
|
|
923
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
924
|
+
});
|
|
925
|
+
};
|
|
878
926
|
return Coupon;
|
|
879
927
|
}(BaseModel));
|
|
880
928
|
__decorate([
|
|
@@ -1221,18 +1269,12 @@
|
|
|
1221
1269
|
return Category;
|
|
1222
1270
|
}(BaseModel));
|
|
1223
1271
|
|
|
1224
|
-
exports.GenderDestination = void 0;
|
|
1225
|
-
(function (GenderDestination) {
|
|
1226
|
-
GenderDestination["FEMALE"] = "female";
|
|
1227
|
-
GenderDestination["MALE"] = "male";
|
|
1228
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
1229
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
1230
|
-
|
|
1231
1272
|
exports.Shops = void 0;
|
|
1232
1273
|
(function (Shops) {
|
|
1233
1274
|
Shops["MENSMARKET"] = "mensmarket";
|
|
1234
1275
|
Shops["GLAMSHOP"] = "Glamshop";
|
|
1235
1276
|
Shops["GLAMPOINTS"] = "Glampoints";
|
|
1277
|
+
Shops["ALL"] = "ALL";
|
|
1236
1278
|
})(exports.Shops || (exports.Shops = {}));
|
|
1237
1279
|
|
|
1238
1280
|
var Product = /** @class */ (function (_super) {
|
|
@@ -1302,60 +1344,6 @@
|
|
|
1302
1344
|
return Variant;
|
|
1303
1345
|
}(BaseModel));
|
|
1304
1346
|
|
|
1305
|
-
exports.CouponTypes = void 0;
|
|
1306
|
-
(function (CouponTypes) {
|
|
1307
|
-
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
1308
|
-
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
1309
|
-
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
1310
|
-
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
1311
|
-
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
1312
|
-
|
|
1313
|
-
exports.CouponSubtypes = void 0;
|
|
1314
|
-
(function (CouponSubtypes) {
|
|
1315
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1316
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1317
|
-
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
1318
|
-
|
|
1319
|
-
exports.Exclusivities = void 0;
|
|
1320
|
-
(function (Exclusivities) {
|
|
1321
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
1322
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
1323
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
1324
|
-
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
1325
|
-
|
|
1326
|
-
exports.CheckoutTypes = void 0;
|
|
1327
|
-
(function (CheckoutTypes) {
|
|
1328
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
1329
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
1330
|
-
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
1331
|
-
|
|
1332
|
-
var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
1333
|
-
var FinancialCoupon = /** @class */ (function (_super) {
|
|
1334
|
-
__extends(FinancialCoupon, _super);
|
|
1335
|
-
function FinancialCoupon() {
|
|
1336
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1337
|
-
_this.type = exports.CouponTypes.FINANCIAL;
|
|
1338
|
-
return _this;
|
|
1339
|
-
}
|
|
1340
|
-
FinancialCoupon.isFinancialCoupon = function (coupon) {
|
|
1341
|
-
return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
1342
|
-
};
|
|
1343
|
-
FinancialCoupon.createCoupon = function (userId) {
|
|
1344
|
-
return this.toInstance({
|
|
1345
|
-
name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
|
|
1346
|
-
nickname: "" + Date.now(),
|
|
1347
|
-
type: exports.CouponTypes.FINANCIAL,
|
|
1348
|
-
subtype: exports.CouponSubtypes.PERCENTAGE,
|
|
1349
|
-
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
1350
|
-
discount: 30,
|
|
1351
|
-
user: userId,
|
|
1352
|
-
createdAt: new Date(Date.now()),
|
|
1353
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
1354
|
-
});
|
|
1355
|
-
};
|
|
1356
|
-
return FinancialCoupon;
|
|
1357
|
-
}(Coupon));
|
|
1358
|
-
|
|
1359
1347
|
exports.OrderStatus = void 0;
|
|
1360
1348
|
(function (OrderStatus) {
|
|
1361
1349
|
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
@@ -2009,7 +1997,7 @@
|
|
|
2009
1997
|
if (filtersKeysWithUnordered.length)
|
|
2010
1998
|
filtersKeysWithUnordered.forEach(function (filterKey) {
|
|
2011
1999
|
var _a;
|
|
2012
|
-
return (orderBy = Object.assign(
|
|
2000
|
+
return (orderBy = Object.assign((_a = {}, _a[filterKey] = 'asc', _a), orderBy));
|
|
2013
2001
|
});
|
|
2014
2002
|
Object.keys(orderBy).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
|
|
2015
2003
|
}
|
|
@@ -3094,9 +3082,7 @@
|
|
|
3094
3082
|
return false;
|
|
3095
3083
|
var converter = fieldOption.to
|
|
3096
3084
|
? fieldOption.to
|
|
3097
|
-
: function (value) { return filter.operator === exports.Where.LIKE &&
|
|
3098
|
-
? "%" + value + "%"
|
|
3099
|
-
: value; };
|
|
3085
|
+
: function (value) { return (filter.operator === exports.Where.LIKE && value.indexOf('%') < 0 ? "%" + value + "%" : value); };
|
|
3100
3086
|
return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
|
|
3101
3087
|
? filter.value.map(function (fieldValue) { return converter(fieldValue); })
|
|
3102
3088
|
: converter(filter.value);
|
|
@@ -3677,9 +3663,10 @@
|
|
|
3677
3663
|
type: HasuraGraphQLColumnType.Jsonb,
|
|
3678
3664
|
from: function (tags, row) { return ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }); },
|
|
3679
3665
|
bindPersistData: function (value) {
|
|
3666
|
+
var _a, _b;
|
|
3680
3667
|
return {
|
|
3681
3668
|
brand_condition: value.brand,
|
|
3682
|
-
tag_condition: (value === null || value === void 0 ? void 0 : value.tags) ||
|
|
3669
|
+
tag_condition: "{\"" + (((_b = (_a = value === null || value === void 0 ? void 0 : value.tags) === null || _a === void 0 ? void 0 : _a.join) === null || _b === void 0 ? void 0 : _b.call(_a, '","')) || '') + "\"}",
|
|
3683
3670
|
};
|
|
3684
3671
|
},
|
|
3685
3672
|
bindFindFilter: function (sentence) {
|
|
@@ -3711,34 +3698,34 @@
|
|
|
3711
3698
|
});
|
|
3712
3699
|
var _a;
|
|
3713
3700
|
return __awaiter(this, void 0, void 0, function () {
|
|
3714
|
-
var
|
|
3715
|
-
return __generator(this, function (
|
|
3716
|
-
switch (
|
|
3701
|
+
var _c;
|
|
3702
|
+
return __generator(this, function (_d) {
|
|
3703
|
+
switch (_d.label) {
|
|
3717
3704
|
case 0:
|
|
3718
3705
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
3719
3706
|
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
3720
3707
|
case 1:
|
|
3721
|
-
|
|
3708
|
+
_c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
3722
3709
|
return [3 /*break*/, 3];
|
|
3723
3710
|
case 2:
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
case 3: return [2 /*return*/,
|
|
3711
|
+
_c = _super.get.call(this, identifiers);
|
|
3712
|
+
_d.label = 3;
|
|
3713
|
+
case 3: return [2 /*return*/, _c];
|
|
3727
3714
|
}
|
|
3728
3715
|
});
|
|
3729
3716
|
});
|
|
3730
3717
|
};
|
|
3731
3718
|
CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
|
|
3732
3719
|
return __awaiter(this, void 0, void 0, function () {
|
|
3733
|
-
var
|
|
3734
|
-
return __generator(this, function (
|
|
3735
|
-
switch (
|
|
3720
|
+
var _c, data, count;
|
|
3721
|
+
return __generator(this, function (_d) {
|
|
3722
|
+
switch (_d.label) {
|
|
3736
3723
|
case 0:
|
|
3737
3724
|
if (!slug)
|
|
3738
3725
|
return [2 /*return*/];
|
|
3739
3726
|
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
|
|
3740
3727
|
case 1:
|
|
3741
|
-
|
|
3728
|
+
_c = _d.sent(), data = _c.data, count = _c.count;
|
|
3742
3729
|
if (count > 1)
|
|
3743
3730
|
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3744
3731
|
if (!count)
|
|
@@ -3751,33 +3738,33 @@
|
|
|
3751
3738
|
CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
|
|
3752
3739
|
if (limit === void 0) { limit = 4; }
|
|
3753
3740
|
return __awaiter(this, void 0, void 0, function () {
|
|
3754
|
-
var
|
|
3741
|
+
var _c, categories, count, homeSections;
|
|
3755
3742
|
var _this = this;
|
|
3756
|
-
return __generator(this, function (
|
|
3757
|
-
switch (
|
|
3743
|
+
return __generator(this, function (_d) {
|
|
3744
|
+
switch (_d.label) {
|
|
3758
3745
|
case 0: return [4 /*yield*/, this.find({
|
|
3759
3746
|
filters: { firestoreId: { operator: exports.Where.IN, value: categoryIds.filter(Boolean) }, published: true },
|
|
3760
3747
|
})];
|
|
3761
3748
|
case 1:
|
|
3762
|
-
|
|
3749
|
+
_c = _d.sent(), categories = _c.data, count = _c.count;
|
|
3763
3750
|
if (!count)
|
|
3764
3751
|
throw new NotFoundError('Categories not found');
|
|
3765
3752
|
return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
|
|
3766
|
-
var
|
|
3767
|
-
return __generator(this, function (
|
|
3768
|
-
switch (
|
|
3753
|
+
var _c;
|
|
3754
|
+
return __generator(this, function (_d) {
|
|
3755
|
+
switch (_d.label) {
|
|
3769
3756
|
case 0:
|
|
3770
|
-
|
|
3757
|
+
_c = {
|
|
3771
3758
|
category: category
|
|
3772
3759
|
};
|
|
3773
3760
|
return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
|
|
3774
|
-
case 1: return [2 /*return*/, (
|
|
3775
|
-
|
|
3761
|
+
case 1: return [2 /*return*/, (_c.products = _d.sent(),
|
|
3762
|
+
_c)];
|
|
3776
3763
|
}
|
|
3777
3764
|
});
|
|
3778
3765
|
}); }))];
|
|
3779
3766
|
case 2:
|
|
3780
|
-
homeSections =
|
|
3767
|
+
homeSections = _d.sent();
|
|
3781
3768
|
return [2 /*return*/, homeSections];
|
|
3782
3769
|
}
|
|
3783
3770
|
});
|
|
@@ -3786,15 +3773,15 @@
|
|
|
3786
3773
|
CategoryHasuraGraphQLRepository.prototype.mountCategory = function (category, options) {
|
|
3787
3774
|
return __awaiter(this, void 0, void 0, function () {
|
|
3788
3775
|
var products, publishedField, productsData;
|
|
3789
|
-
var
|
|
3790
|
-
return __generator(this, function (
|
|
3791
|
-
switch (
|
|
3776
|
+
var _c;
|
|
3777
|
+
return __generator(this, function (_d) {
|
|
3778
|
+
switch (_d.label) {
|
|
3792
3779
|
case 0:
|
|
3793
3780
|
if (!category.products)
|
|
3794
3781
|
throw new RequiredArgumentError(['Category products is empty']);
|
|
3795
3782
|
products = [];
|
|
3796
3783
|
publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
3797
|
-
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign((
|
|
3784
|
+
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign((_c = { id: { operator: exports.Where.IN, value: category.products } }, _c[publishedField] = true, _c), ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
|
|
3798
3785
|
'id',
|
|
3799
3786
|
'name',
|
|
3800
3787
|
'slug',
|
|
@@ -3819,7 +3806,7 @@
|
|
|
3819
3806
|
'rate',
|
|
3820
3807
|
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
|
|
3821
3808
|
case 1:
|
|
3822
|
-
productsData = (
|
|
3809
|
+
productsData = (_d.sent()).data;
|
|
3823
3810
|
products.push.apply(products, __spreadArray([], __read(productsData)));
|
|
3824
3811
|
return [2 /*return*/, products];
|
|
3825
3812
|
}
|
|
@@ -3909,7 +3896,6 @@
|
|
|
3909
3896
|
'type',
|
|
3910
3897
|
'video',
|
|
3911
3898
|
'weight',
|
|
3912
|
-
'gender',
|
|
3913
3899
|
{
|
|
3914
3900
|
shopAvailability: {
|
|
3915
3901
|
columnName: 'shop_availabilities',
|
|
@@ -4030,8 +4016,6 @@
|
|
|
4030
4016
|
_e.label = 4;
|
|
4031
4017
|
case 4:
|
|
4032
4018
|
product = _c;
|
|
4033
|
-
if (product.productId)
|
|
4034
|
-
throw new NotFoundError('Product not found, it is a variant');
|
|
4035
4019
|
_d = product;
|
|
4036
4020
|
return [4 /*yield*/, this.findReviewsByProduct(+product.id)];
|
|
4037
4021
|
case 5:
|
|
@@ -4194,7 +4178,7 @@
|
|
|
4194
4178
|
where: {
|
|
4195
4179
|
type: 'product_kit_bool_exp',
|
|
4196
4180
|
required: true,
|
|
4197
|
-
value: {
|
|
4181
|
+
value: { product_id: { _eq: productId } },
|
|
4198
4182
|
},
|
|
4199
4183
|
})];
|
|
4200
4184
|
case 1:
|
|
@@ -4204,8 +4188,8 @@
|
|
|
4204
4188
|
type: '[product_kit_insert_input!]',
|
|
4205
4189
|
required: true,
|
|
4206
4190
|
value: plainData.kitProducts.map(function (kitProduct) { return ({
|
|
4207
|
-
kit_product_id: productId,
|
|
4208
|
-
product_id:
|
|
4191
|
+
kit_product_id: kitProduct.productId || kitProduct.product.id,
|
|
4192
|
+
product_id: productId,
|
|
4209
4193
|
quantity: kitProduct.quantity,
|
|
4210
4194
|
}); }),
|
|
4211
4195
|
},
|
|
@@ -4474,7 +4458,7 @@
|
|
|
4474
4458
|
});
|
|
4475
4459
|
var _a;
|
|
4476
4460
|
return __awaiter(this, void 0, void 0, function () {
|
|
4477
|
-
var
|
|
4461
|
+
var _c;
|
|
4478
4462
|
return __generator(this, function (_d) {
|
|
4479
4463
|
switch (_d.label) {
|
|
4480
4464
|
case 0:
|
|
@@ -4482,16 +4466,11 @@
|
|
|
4482
4466
|
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
4483
4467
|
case 1:
|
|
4484
4468
|
_c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
4485
|
-
return [3 /*break*/,
|
|
4486
|
-
case 2:
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
case 4:
|
|
4491
|
-
variant = _c;
|
|
4492
|
-
if (!variant.productId)
|
|
4493
|
-
throw new NotFoundError("Variant not found, it is a product");
|
|
4494
|
-
return [2 /*return*/, variant];
|
|
4469
|
+
return [3 /*break*/, 3];
|
|
4470
|
+
case 2:
|
|
4471
|
+
_c = _super.get.call(this, identifiers);
|
|
4472
|
+
_d.label = 3;
|
|
4473
|
+
case 3: return [2 /*return*/, _c];
|
|
4495
4474
|
}
|
|
4496
4475
|
});
|
|
4497
4476
|
});
|
|
@@ -4679,7 +4658,6 @@
|
|
|
4679
4658
|
exports.CouponFirestoreRepository = CouponFirestoreRepository;
|
|
4680
4659
|
exports.DuplicatedResultsError = DuplicatedResultsError;
|
|
4681
4660
|
exports.Edition = Edition;
|
|
4682
|
-
exports.FinancialCoupon = FinancialCoupon;
|
|
4683
4661
|
exports.Home = Home;
|
|
4684
4662
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
4685
4663
|
exports.InvalidArgumentError = InvalidArgumentError;
|