@infrab4a/connect 4.9.7-beta.18 → 4.9.7-beta.2
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/index.cjs.js +81 -284
- package/index.esm.js +82 -283
- package/package.json +1 -1
- package/src/domain/catalog/models/category-base.d.ts +1 -17
- package/src/domain/catalog/models/filter.d.ts +1 -3
- package/src/domain/catalog/models/types/category-metadata.type.d.ts +0 -2
- package/src/domain/catalog/models/types/index.d.ts +0 -3
- package/src/domain/catalog/models/wishlist.d.ts +0 -3
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +1 -9
- package/src/domain/catalog/repositories/wishlist.repository.d.ts +0 -3
- package/src/domain/shopping/index.d.ts +0 -1
- package/src/domain/shopping/models/coupons/coupon.d.ts +1 -1
- package/src/domain/shopping/models/index.d.ts +0 -1
- package/src/domain/shopping/repositories/index.d.ts +0 -1
- package/src/domain/users/models/enums/index.d.ts +0 -1
- package/src/domain/users/models/index.d.ts +2 -3
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +0 -1
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +1 -8
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +9 -11
- package/src/domain/catalog/models/types/category-images.type.d.ts +0 -8
- package/src/domain/catalog/models/types/category-most-relevant.type.d.ts +0 -4
- package/src/domain/catalog/models/types/report-stock-notification.type.d.ts +0 -21
- package/src/domain/shopping/models/order-blocked.d.ts +0 -26
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +0 -6
- package/src/domain/shopping/types/index.d.ts +0 -1
- package/src/domain/shopping/types/payment-card-info.type.d.ts +0 -4
- package/src/domain/users/models/enums/person-types.enum.d.ts +0 -5
- package/src/domain/users/models/types/index.d.ts +0 -1
- package/src/domain/users/models/types/person.type.d.ts +0 -2
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +0 -9
- package/src/infra/hasura-graphql/models/wishlist-hasura-graphql.d.ts +0 -4
package/index.cjs.js
CHANGED
|
@@ -42,21 +42,6 @@ class BaseModel {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
exports.GenderDestination = void 0;
|
|
46
|
-
(function (GenderDestination) {
|
|
47
|
-
GenderDestination["FEMALE"] = "female";
|
|
48
|
-
GenderDestination["MALE"] = "male";
|
|
49
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
50
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
51
|
-
|
|
52
|
-
exports.Shops = void 0;
|
|
53
|
-
(function (Shops) {
|
|
54
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
55
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
56
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
57
|
-
Shops["ALL"] = "ALL";
|
|
58
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
59
|
-
|
|
60
45
|
class Filter extends BaseModel {
|
|
61
46
|
static get identifiersFields() {
|
|
62
47
|
return ['id'];
|
|
@@ -71,33 +56,6 @@ class CategoryBase extends BaseModel {
|
|
|
71
56
|
static get identifiersFields() {
|
|
72
57
|
return ['id'];
|
|
73
58
|
}
|
|
74
|
-
get glamImages() {
|
|
75
|
-
return this.images && this.images[exports.Shops.GLAMSHOP]
|
|
76
|
-
? this.images[exports.Shops.GLAMSHOP]
|
|
77
|
-
: {
|
|
78
|
-
brandBanner: null,
|
|
79
|
-
brandBannerMobile: null,
|
|
80
|
-
image: null,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
get mensImages() {
|
|
84
|
-
return this.images && this.images[exports.Shops.MENSMARKET]
|
|
85
|
-
? this.images[exports.Shops.MENSMARKET]
|
|
86
|
-
: {
|
|
87
|
-
brandBanner: null,
|
|
88
|
-
brandBannerMobile: null,
|
|
89
|
-
image: null,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
get glamMetadata() {
|
|
93
|
-
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
|
|
94
|
-
}
|
|
95
|
-
get mensMetadata() {
|
|
96
|
-
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
|
|
97
|
-
}
|
|
98
|
-
getMostRelevantByShop(shop) {
|
|
99
|
-
return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
|
|
100
|
-
}
|
|
101
59
|
}
|
|
102
60
|
tslib.__decorate([
|
|
103
61
|
classTransformer.Type(() => CategoryBase),
|
|
@@ -206,6 +164,21 @@ tslib.__decorate([
|
|
|
206
164
|
tslib.__metadata("design:type", Category)
|
|
207
165
|
], CategoryFilter.prototype, "category", void 0);
|
|
208
166
|
|
|
167
|
+
exports.GenderDestination = void 0;
|
|
168
|
+
(function (GenderDestination) {
|
|
169
|
+
GenderDestination["FEMALE"] = "female";
|
|
170
|
+
GenderDestination["MALE"] = "male";
|
|
171
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
172
|
+
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
173
|
+
|
|
174
|
+
exports.Shops = void 0;
|
|
175
|
+
(function (Shops) {
|
|
176
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
177
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
178
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
179
|
+
Shops["ALL"] = "ALL";
|
|
180
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
181
|
+
|
|
209
182
|
class FilterOption extends BaseModel {
|
|
210
183
|
static get identifiersFields() {
|
|
211
184
|
return ['id'];
|
|
@@ -298,17 +271,6 @@ class CampaignHashtag extends BaseModel {
|
|
|
298
271
|
}
|
|
299
272
|
}
|
|
300
273
|
|
|
301
|
-
class BeautyProfile extends BaseModel {
|
|
302
|
-
toPlain() {
|
|
303
|
-
const plain = super.toPlain();
|
|
304
|
-
delete plain.id;
|
|
305
|
-
return plain;
|
|
306
|
-
}
|
|
307
|
-
static get identifiersFields() {
|
|
308
|
-
return ['id', 'userId'];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
274
|
exports.AccessoryImportances = void 0;
|
|
313
275
|
(function (AccessoryImportances) {
|
|
314
276
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -485,13 +447,6 @@ exports.OfficePosition = void 0;
|
|
|
485
447
|
OfficePosition["Director"] = "Diretor";
|
|
486
448
|
})(exports.OfficePosition || (exports.OfficePosition = {}));
|
|
487
449
|
|
|
488
|
-
exports.PersonTypes = void 0;
|
|
489
|
-
(function (PersonTypes) {
|
|
490
|
-
PersonTypes["GLAMGIRL"] = "glamgirl";
|
|
491
|
-
PersonTypes["BFLU"] = "bflu";
|
|
492
|
-
PersonTypes["NONE"] = "none";
|
|
493
|
-
})(exports.PersonTypes || (exports.PersonTypes = {}));
|
|
494
|
-
|
|
495
450
|
exports.ProductSpents = void 0;
|
|
496
451
|
(function (ProductSpents) {
|
|
497
452
|
ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
|
|
@@ -512,12 +467,6 @@ exports.UserType = void 0;
|
|
|
512
467
|
UserType["Influencer"] = "Influencer";
|
|
513
468
|
})(exports.UserType || (exports.UserType = {}));
|
|
514
469
|
|
|
515
|
-
class Lead extends BaseModel {
|
|
516
|
-
static get identifiersFields() {
|
|
517
|
-
return ['id'];
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
470
|
class Edition extends BaseModel {
|
|
522
471
|
static get identifiersFields() {
|
|
523
472
|
return ['id', 'subscriptionId'];
|
|
@@ -1916,6 +1865,17 @@ class SubscriptionPlan extends BaseModel {
|
|
|
1916
1865
|
}
|
|
1917
1866
|
}
|
|
1918
1867
|
|
|
1868
|
+
class BeautyProfile extends BaseModel {
|
|
1869
|
+
toPlain() {
|
|
1870
|
+
const plain = super.toPlain();
|
|
1871
|
+
delete plain.id;
|
|
1872
|
+
return plain;
|
|
1873
|
+
}
|
|
1874
|
+
static get identifiersFields() {
|
|
1875
|
+
return ['id', 'userId'];
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1919
1879
|
class User extends BaseModel {
|
|
1920
1880
|
static toInstance(data) {
|
|
1921
1881
|
const instance = super.toInstance(data);
|
|
@@ -2029,6 +1989,12 @@ class UserPaymentMethod extends BaseModel {
|
|
|
2029
1989
|
}
|
|
2030
1990
|
}
|
|
2031
1991
|
|
|
1992
|
+
class Lead extends BaseModel {
|
|
1993
|
+
static get identifiersFields() {
|
|
1994
|
+
return ['id'];
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
|
|
2032
1998
|
class UnauthorizedError extends tsCustomError.CustomError {
|
|
2033
1999
|
constructor(message) {
|
|
2034
2000
|
super(message);
|
|
@@ -2201,12 +2167,6 @@ tslib.__decorate([
|
|
|
2201
2167
|
tslib.__metadata("design:type", Payment)
|
|
2202
2168
|
], Order.prototype, "payment", void 0);
|
|
2203
2169
|
|
|
2204
|
-
class OrderBlocked extends BaseModel {
|
|
2205
|
-
static get identifiersFields() {
|
|
2206
|
-
return ['id'];
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
2170
|
class CheckoutSubscription extends BaseModel {
|
|
2211
2171
|
static get identifiersFields() {
|
|
2212
2172
|
return ['id'];
|
|
@@ -3032,8 +2992,6 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
3032
2992
|
try {
|
|
3033
2993
|
const identifiers = getValueFromParams(data, keyField);
|
|
3034
2994
|
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3035
|
-
if (!(await docRef.get()).data())
|
|
3036
|
-
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
3037
2995
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
3038
2996
|
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
|
|
3039
2997
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
@@ -3598,47 +3556,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3598
3556
|
}
|
|
3599
3557
|
}
|
|
3600
3558
|
|
|
3601
|
-
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3602
|
-
constructor({ firestore, interceptors, }) {
|
|
3603
|
-
super({
|
|
3604
|
-
firestore,
|
|
3605
|
-
collectionName: 'paymentBlockedAttempts',
|
|
3606
|
-
model: OrderBlocked,
|
|
3607
|
-
interceptors,
|
|
3608
|
-
});
|
|
3609
|
-
}
|
|
3610
|
-
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3611
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3612
|
-
return this.create(OrderBlocked.toInstance({
|
|
3613
|
-
customer: {
|
|
3614
|
-
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3615
|
-
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3616
|
-
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3617
|
-
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3618
|
-
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3619
|
-
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3620
|
-
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3621
|
-
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3622
|
-
},
|
|
3623
|
-
blockType,
|
|
3624
|
-
limiteRange,
|
|
3625
|
-
type,
|
|
3626
|
-
card,
|
|
3627
|
-
checkout: {
|
|
3628
|
-
id: checkout.id,
|
|
3629
|
-
shop: checkout.shop,
|
|
3630
|
-
total: checkout.totalPrice,
|
|
3631
|
-
},
|
|
3632
|
-
date: new Date(),
|
|
3633
|
-
}));
|
|
3634
|
-
}
|
|
3635
|
-
formatZip(zip) {
|
|
3636
|
-
if (zip.length === 8)
|
|
3637
|
-
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3638
|
-
return zip;
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
3559
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3643
3560
|
constructor({ firestore, interceptors }) {
|
|
3644
3561
|
super({
|
|
@@ -4294,7 +4211,7 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
4294
4211
|
const response = await axios__default["default"](request);
|
|
4295
4212
|
if (!lodash.isNil(response.data.errors)) {
|
|
4296
4213
|
this.logger.error({ req: request, res: response.data.errors });
|
|
4297
|
-
throw new Error(
|
|
4214
|
+
throw new Error(response.data.errors);
|
|
4298
4215
|
}
|
|
4299
4216
|
this.logger.log({ req: request, res: response.data });
|
|
4300
4217
|
return response.data.data;
|
|
@@ -4661,7 +4578,6 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
4661
4578
|
fields: [
|
|
4662
4579
|
'id',
|
|
4663
4580
|
'description',
|
|
4664
|
-
'title',
|
|
4665
4581
|
'slug',
|
|
4666
4582
|
'enabled',
|
|
4667
4583
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -4773,7 +4689,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4773
4689
|
'name',
|
|
4774
4690
|
'description',
|
|
4775
4691
|
'image',
|
|
4776
|
-
{ images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4777
4692
|
'published',
|
|
4778
4693
|
'shop',
|
|
4779
4694
|
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
@@ -4806,7 +4721,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4806
4721
|
filters: {
|
|
4807
4722
|
columnName: 'filters',
|
|
4808
4723
|
foreignKeyColumn: { filter_id: 'id' },
|
|
4809
|
-
fields: [{ filter: ['id', '
|
|
4724
|
+
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
4810
4725
|
bindPersistData: (value) => ({
|
|
4811
4726
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4812
4727
|
}),
|
|
@@ -4829,21 +4744,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4829
4744
|
{
|
|
4830
4745
|
metadata: {
|
|
4831
4746
|
columnName: 'metadata',
|
|
4832
|
-
fields: ['
|
|
4747
|
+
fields: ['title', 'description'],
|
|
4833
4748
|
bindPersistData: (value) => ({
|
|
4834
4749
|
metadata: { data: value },
|
|
4835
4750
|
}),
|
|
4836
4751
|
},
|
|
4837
4752
|
},
|
|
4838
|
-
{
|
|
4839
|
-
metadatas: {
|
|
4840
|
-
columnName: 'metadatas',
|
|
4841
|
-
fields: ['shop', 'title', 'description'],
|
|
4842
|
-
bindPersistData: (value) => ({
|
|
4843
|
-
metadatas: { data: value },
|
|
4844
|
-
}),
|
|
4845
|
-
},
|
|
4846
|
-
},
|
|
4847
4753
|
{ isCollection: { columnName: 'is_collection' } },
|
|
4848
4754
|
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4849
4755
|
'reference',
|
|
@@ -4858,29 +4764,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4858
4764
|
'theme',
|
|
4859
4765
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
4860
4766
|
{ mostRelevant: { columnName: 'most_relevant', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4861
|
-
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4862
4767
|
],
|
|
4863
4768
|
});
|
|
4864
4769
|
this.productRepository = productRepository;
|
|
4865
4770
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4866
4771
|
}
|
|
4867
4772
|
async create(params) {
|
|
4868
|
-
const {
|
|
4869
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false,
|
|
4870
|
-
[exports.Shops.GLAMSHOP]: null,
|
|
4871
|
-
[exports.Shops.MENSMARKET]: null,
|
|
4872
|
-
}, images: images || {
|
|
4873
|
-
[exports.Shops.GLAMSHOP]: {
|
|
4874
|
-
brandBanner: null,
|
|
4875
|
-
brandBannerMobile: null,
|
|
4876
|
-
image: null,
|
|
4877
|
-
},
|
|
4878
|
-
[exports.Shops.MENSMARKET]: {
|
|
4879
|
-
brandBanner: null,
|
|
4880
|
-
brandBannerMobile: null,
|
|
4881
|
-
image: null,
|
|
4882
|
-
},
|
|
4883
|
-
} }));
|
|
4773
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
4774
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
4884
4775
|
}
|
|
4885
4776
|
async get(identifiers) {
|
|
4886
4777
|
var _a;
|
|
@@ -4889,12 +4780,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4889
4780
|
: super.get(identifiers);
|
|
4890
4781
|
}
|
|
4891
4782
|
async update(params) {
|
|
4892
|
-
const { products, id: checkId,
|
|
4783
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
4893
4784
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4894
4785
|
const id = await this.getId(plainData.id);
|
|
4895
4786
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
4896
4787
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
4897
|
-
category.
|
|
4788
|
+
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
4898
4789
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
4899
4790
|
return category;
|
|
4900
4791
|
}
|
|
@@ -4990,7 +4881,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4990
4881
|
return products;
|
|
4991
4882
|
}
|
|
4992
4883
|
async getChildren(parentId) {
|
|
4993
|
-
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'
|
|
4884
|
+
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
|
|
4994
4885
|
args: {
|
|
4995
4886
|
type: 'category_tree_args',
|
|
4996
4887
|
value: { parentid: parentId },
|
|
@@ -5070,36 +4961,23 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5070
4961
|
});
|
|
5071
4962
|
return plainData.products;
|
|
5072
4963
|
}
|
|
5073
|
-
async updateMetadata(categoryId, {
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
});
|
|
5091
|
-
return metadatas;
|
|
5092
|
-
}
|
|
5093
|
-
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
5094
|
-
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5095
|
-
where: {
|
|
5096
|
-
type: 'category_metadata_bool_exp',
|
|
5097
|
-
required: true,
|
|
5098
|
-
value: { category_id: { _eq: categoryId } },
|
|
5099
|
-
},
|
|
5100
|
-
});
|
|
5101
|
-
return [];
|
|
5102
|
-
}
|
|
4964
|
+
async updateMetadata(categoryId, { metadata }) {
|
|
4965
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
4966
|
+
if (!plainData.metadata)
|
|
4967
|
+
return null;
|
|
4968
|
+
await this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
4969
|
+
pk_columns: {
|
|
4970
|
+
value: { category_id: categoryId },
|
|
4971
|
+
type: 'category_metadata_pk_columns_input',
|
|
4972
|
+
required: true,
|
|
4973
|
+
},
|
|
4974
|
+
_set: {
|
|
4975
|
+
value: lodash.omit(metadata, ['category_id']),
|
|
4976
|
+
type: 'category_metadata_set_input',
|
|
4977
|
+
required: true,
|
|
4978
|
+
},
|
|
4979
|
+
});
|
|
4980
|
+
return plainData.metadata;
|
|
5103
4981
|
}
|
|
5104
4982
|
async updateFilters(categoryId, { filters }) {
|
|
5105
4983
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5193,7 +5071,6 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5193
5071
|
interceptors,
|
|
5194
5072
|
fields: [
|
|
5195
5073
|
'id',
|
|
5196
|
-
'title',
|
|
5197
5074
|
'description',
|
|
5198
5075
|
'slug',
|
|
5199
5076
|
'enabled',
|
|
@@ -5581,8 +5458,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5581
5458
|
enableCount: false,
|
|
5582
5459
|
},
|
|
5583
5460
|
});
|
|
5584
|
-
if (!result.data.length)
|
|
5585
|
-
return null;
|
|
5586
5461
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
5587
5462
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
5588
5463
|
return product;
|
|
@@ -5936,31 +5811,6 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5936
5811
|
email,
|
|
5937
5812
|
});
|
|
5938
5813
|
}
|
|
5939
|
-
async getNotificationsReport(params, orderBy, pagination) {
|
|
5940
|
-
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.productId && { product_id: { _eq: params.productId } })), (params.ean && { ean: { _eq: params.ean } })), (params.sku && { sku: { _eq: params.sku } })), (params.name && { name: { _iregex: params.name } })), (params.categoryId && { category_id: { _eq: params.categoryId } })), (params.category && { category: { _iregex: params.category } })), (params.reference && { category_reference: { _eq: params.reference } })), (params.emailsCount && { emails_registered: { _eq: params.emailsCount } }));
|
|
5941
|
-
const orderByField = {
|
|
5942
|
-
[orderBy.field]: orderBy.direction,
|
|
5943
|
-
};
|
|
5944
|
-
const { report_stock_notification } = await this.query('report_stock_notification', ['product_id', 'ean', 'sku', 'name', 'stock', 'category_id', 'category', 'reference', 'emails_registered'], {
|
|
5945
|
-
where: {
|
|
5946
|
-
type: 'report_stock_notification_bool_exp',
|
|
5947
|
-
value: query,
|
|
5948
|
-
required: true,
|
|
5949
|
-
},
|
|
5950
|
-
order_by: {
|
|
5951
|
-
type: '[report_stock_notification_order_by]',
|
|
5952
|
-
value: orderByField,
|
|
5953
|
-
required: true,
|
|
5954
|
-
},
|
|
5955
|
-
});
|
|
5956
|
-
const data = (pagination === null || pagination === void 0 ? void 0 : pagination.limit)
|
|
5957
|
-
? report_stock_notification.slice(pagination === null || pagination === void 0 ? void 0 : pagination.offset, (pagination === null || pagination === void 0 ? void 0 : pagination.offset) + (pagination === null || pagination === void 0 ? void 0 : pagination.limit))
|
|
5958
|
-
: report_stock_notification;
|
|
5959
|
-
return {
|
|
5960
|
-
data,
|
|
5961
|
-
count: report_stock_notification.length,
|
|
5962
|
-
};
|
|
5963
|
-
}
|
|
5964
5814
|
}
|
|
5965
5815
|
|
|
5966
5816
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -6069,14 +5919,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6069
5919
|
}
|
|
6070
5920
|
}
|
|
6071
5921
|
|
|
6072
|
-
class WishlistHasuraGraphQL extends Wishlist {
|
|
6073
|
-
}
|
|
6074
|
-
|
|
6075
5922
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6076
5923
|
constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
|
|
6077
5924
|
super({
|
|
6078
5925
|
tableName: 'category',
|
|
6079
|
-
model:
|
|
5926
|
+
model: Wishlist,
|
|
6080
5927
|
endpoint,
|
|
6081
5928
|
authOptions,
|
|
6082
5929
|
interceptors,
|
|
@@ -6137,7 +5984,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6137
5984
|
{
|
|
6138
5985
|
metadata: {
|
|
6139
5986
|
columnName: 'metadata',
|
|
6140
|
-
fields: ['
|
|
5987
|
+
fields: ['title', 'description'],
|
|
6141
5988
|
bindPersistData: (value) => ({
|
|
6142
5989
|
metadata: { data: value },
|
|
6143
5990
|
}),
|
|
@@ -6157,33 +6004,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6157
6004
|
{ personId: { columnName: 'person_id' } },
|
|
6158
6005
|
{ personName: { columnName: 'person_name' } },
|
|
6159
6006
|
{ personPhoto: { columnName: 'person_photo' } },
|
|
6160
|
-
{ personType: { columnName: 'person_type' } },
|
|
6161
|
-
{ personIsSubscriber: { columnName: 'person_is_subscriber' } },
|
|
6162
6007
|
'theme',
|
|
6163
6008
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
6164
|
-
{ personHasPhoto: { columnName: 'person_has_photo' } },
|
|
6165
6009
|
],
|
|
6166
6010
|
});
|
|
6167
6011
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
6168
6012
|
}
|
|
6169
6013
|
async create(params) {
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadatas: metadatas || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }], mostRelevants: mostRelevants || {
|
|
6173
|
-
[exports.Shops.GLAMSHOP]: null,
|
|
6174
|
-
[exports.Shops.MENSMARKET]: null,
|
|
6175
|
-
}, images: images || {
|
|
6176
|
-
[exports.Shops.GLAMSHOP]: {
|
|
6177
|
-
brandBanner: null,
|
|
6178
|
-
brandBannerMobile: null,
|
|
6179
|
-
image: null,
|
|
6180
|
-
},
|
|
6181
|
-
[exports.Shops.MENSMARKET]: {
|
|
6182
|
-
brandBanner: null,
|
|
6183
|
-
brandBannerMobile: null,
|
|
6184
|
-
image: null,
|
|
6185
|
-
},
|
|
6186
|
-
} }));
|
|
6014
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
6015
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6187
6016
|
}
|
|
6188
6017
|
async get(identifiers) {
|
|
6189
6018
|
const data = await super.get(identifiers);
|
|
@@ -6196,12 +6025,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6196
6025
|
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
|
|
6197
6026
|
}
|
|
6198
6027
|
async update(params) {
|
|
6199
|
-
const { products, id: checkId,
|
|
6028
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
6200
6029
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6201
6030
|
const id = plainData.id;
|
|
6202
6031
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6203
6032
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6204
|
-
category.
|
|
6033
|
+
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
6205
6034
|
return category;
|
|
6206
6035
|
}
|
|
6207
6036
|
async getWishlistBySlug(slug) {
|
|
@@ -6238,7 +6067,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6238
6067
|
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
6239
6068
|
return data;
|
|
6240
6069
|
}
|
|
6241
|
-
|
|
6070
|
+
getCategoryBySlug(slug, _shop) {
|
|
6242
6071
|
return this.getWishlistBySlug(slug);
|
|
6243
6072
|
}
|
|
6244
6073
|
async getCategoryByShop(shop) {
|
|
@@ -6256,13 +6085,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6256
6085
|
});
|
|
6257
6086
|
return data;
|
|
6258
6087
|
}
|
|
6259
|
-
async findBfluOrGlamgirlWishlists(params, shops) {
|
|
6260
|
-
var _a, _b;
|
|
6261
|
-
return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true, shops: { operator: exports.Where.LIKE, value: shops }, personType: (_b = (_a = params.filters) === null || _a === void 0 ? void 0 : _a.personType) !== null && _b !== void 0 ? _b : {
|
|
6262
|
-
operator: exports.Where.IN,
|
|
6263
|
-
value: [exports.PersonTypes.BFLU, exports.PersonTypes.GLAMGIRL],
|
|
6264
|
-
} }), orderBy: Object.assign({ personHasPhoto: 'desc' }, lodash.omit(params.orderBy, ['personHasPhoto'])) }));
|
|
6265
|
-
}
|
|
6266
6088
|
getCategoriesForHome(categoryIds, limit, gender) {
|
|
6267
6089
|
return;
|
|
6268
6090
|
}
|
|
@@ -6313,40 +6135,23 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6313
6135
|
});
|
|
6314
6136
|
return plainData.products;
|
|
6315
6137
|
}
|
|
6316
|
-
async updateMetadata(categoryId, {
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
});
|
|
6334
|
-
metadataUpdated.push(update);
|
|
6335
|
-
}
|
|
6336
|
-
return metadataUpdated;
|
|
6337
|
-
}
|
|
6338
|
-
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
6339
|
-
for (let i = 0; i < metadatas.value.length; i++) {
|
|
6340
|
-
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6341
|
-
where: {
|
|
6342
|
-
type: 'category_metadata_bool_exp',
|
|
6343
|
-
required: true,
|
|
6344
|
-
value: { category_id: { _eq: categoryId }, shop: metadatas.value[i].shop },
|
|
6345
|
-
},
|
|
6346
|
-
});
|
|
6347
|
-
}
|
|
6348
|
-
return [];
|
|
6349
|
-
}
|
|
6138
|
+
async updateMetadata(categoryId, { metadata }) {
|
|
6139
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
6140
|
+
if (!plainData.metadata)
|
|
6141
|
+
return;
|
|
6142
|
+
await this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
6143
|
+
pk_columns: {
|
|
6144
|
+
value: { category_id: categoryId },
|
|
6145
|
+
type: 'category_metadata_pk_columns_input',
|
|
6146
|
+
required: true,
|
|
6147
|
+
},
|
|
6148
|
+
_set: {
|
|
6149
|
+
value: lodash.omit(metadata, ['category_id']),
|
|
6150
|
+
type: 'category_metadata_set_input',
|
|
6151
|
+
required: true,
|
|
6152
|
+
},
|
|
6153
|
+
});
|
|
6154
|
+
return plainData.metadata;
|
|
6350
6155
|
}
|
|
6351
6156
|
}
|
|
6352
6157
|
tslib.__decorate([
|
|
@@ -6367,12 +6172,6 @@ tslib.__decorate([
|
|
|
6367
6172
|
tslib.__metadata("design:paramtypes", [String]),
|
|
6368
6173
|
tslib.__metadata("design:returntype", Promise)
|
|
6369
6174
|
], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
|
|
6370
|
-
tslib.__decorate([
|
|
6371
|
-
Log(),
|
|
6372
|
-
tslib.__metadata("design:type", Function),
|
|
6373
|
-
tslib.__metadata("design:paramtypes", [Object, Array]),
|
|
6374
|
-
tslib.__metadata("design:returntype", Promise)
|
|
6375
|
-
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6376
6175
|
|
|
6377
6176
|
Object.defineProperty(exports, 'add', {
|
|
6378
6177
|
enumerable: true,
|
|
@@ -6548,8 +6347,6 @@ exports.Log = Log;
|
|
|
6548
6347
|
exports.Logger = Logger;
|
|
6549
6348
|
exports.NotFoundError = NotFoundError;
|
|
6550
6349
|
exports.Order = Order;
|
|
6551
|
-
exports.OrderBlocked = OrderBlocked;
|
|
6552
|
-
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
6553
6350
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
6554
6351
|
exports.Payment = Payment;
|
|
6555
6352
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|