@infrab4a/connect 4.9.7-beta.19 → 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 +2 -18
- 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.esm.js
CHANGED
|
@@ -36,21 +36,6 @@ class BaseModel {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
var GenderDestination;
|
|
40
|
-
(function (GenderDestination) {
|
|
41
|
-
GenderDestination["FEMALE"] = "female";
|
|
42
|
-
GenderDestination["MALE"] = "male";
|
|
43
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
44
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
45
|
-
|
|
46
|
-
var Shops;
|
|
47
|
-
(function (Shops) {
|
|
48
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
49
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
50
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
51
|
-
Shops["ALL"] = "ALL";
|
|
52
|
-
})(Shops || (Shops = {}));
|
|
53
|
-
|
|
54
39
|
class Filter extends BaseModel {
|
|
55
40
|
static get identifiersFields() {
|
|
56
41
|
return ['id'];
|
|
@@ -65,33 +50,6 @@ class CategoryBase extends BaseModel {
|
|
|
65
50
|
static get identifiersFields() {
|
|
66
51
|
return ['id'];
|
|
67
52
|
}
|
|
68
|
-
get glamImages() {
|
|
69
|
-
return this.images && this.images[Shops.GLAMSHOP]
|
|
70
|
-
? this.images[Shops.GLAMSHOP]
|
|
71
|
-
: {
|
|
72
|
-
brandBanner: null,
|
|
73
|
-
brandBannerMobile: null,
|
|
74
|
-
image: null,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
get mensImages() {
|
|
78
|
-
return this.images && this.images[Shops.MENSMARKET]
|
|
79
|
-
? this.images[Shops.MENSMARKET]
|
|
80
|
-
: {
|
|
81
|
-
brandBanner: null,
|
|
82
|
-
brandBannerMobile: null,
|
|
83
|
-
image: null,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
get glamMetadata() {
|
|
87
|
-
return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMSHOP);
|
|
88
|
-
}
|
|
89
|
-
get mensMetadata() {
|
|
90
|
-
return this.metadatas.find((metadata) => metadata.shop === Shops.MENSMARKET);
|
|
91
|
-
}
|
|
92
|
-
getMostRelevantByShop(shop) {
|
|
93
|
-
return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
|
|
94
|
-
}
|
|
95
53
|
}
|
|
96
54
|
__decorate([
|
|
97
55
|
Type(() => CategoryBase),
|
|
@@ -200,6 +158,21 @@ __decorate([
|
|
|
200
158
|
__metadata("design:type", Category)
|
|
201
159
|
], CategoryFilter.prototype, "category", void 0);
|
|
202
160
|
|
|
161
|
+
var GenderDestination;
|
|
162
|
+
(function (GenderDestination) {
|
|
163
|
+
GenderDestination["FEMALE"] = "female";
|
|
164
|
+
GenderDestination["MALE"] = "male";
|
|
165
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
166
|
+
})(GenderDestination || (GenderDestination = {}));
|
|
167
|
+
|
|
168
|
+
var Shops;
|
|
169
|
+
(function (Shops) {
|
|
170
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
171
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
172
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
173
|
+
Shops["ALL"] = "ALL";
|
|
174
|
+
})(Shops || (Shops = {}));
|
|
175
|
+
|
|
203
176
|
class FilterOption extends BaseModel {
|
|
204
177
|
static get identifiersFields() {
|
|
205
178
|
return ['id'];
|
|
@@ -292,17 +265,6 @@ class CampaignHashtag extends BaseModel {
|
|
|
292
265
|
}
|
|
293
266
|
}
|
|
294
267
|
|
|
295
|
-
class BeautyProfile extends BaseModel {
|
|
296
|
-
toPlain() {
|
|
297
|
-
const plain = super.toPlain();
|
|
298
|
-
delete plain.id;
|
|
299
|
-
return plain;
|
|
300
|
-
}
|
|
301
|
-
static get identifiersFields() {
|
|
302
|
-
return ['id', 'userId'];
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
268
|
var AccessoryImportances;
|
|
307
269
|
(function (AccessoryImportances) {
|
|
308
270
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -479,13 +441,6 @@ var OfficePosition;
|
|
|
479
441
|
OfficePosition["Director"] = "Diretor";
|
|
480
442
|
})(OfficePosition || (OfficePosition = {}));
|
|
481
443
|
|
|
482
|
-
var PersonTypes;
|
|
483
|
-
(function (PersonTypes) {
|
|
484
|
-
PersonTypes["GLAMGIRL"] = "glamgirl";
|
|
485
|
-
PersonTypes["BFLU"] = "bflu";
|
|
486
|
-
PersonTypes["NONE"] = "none";
|
|
487
|
-
})(PersonTypes || (PersonTypes = {}));
|
|
488
|
-
|
|
489
444
|
var ProductSpents;
|
|
490
445
|
(function (ProductSpents) {
|
|
491
446
|
ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
|
|
@@ -506,12 +461,6 @@ var UserType;
|
|
|
506
461
|
UserType["Influencer"] = "Influencer";
|
|
507
462
|
})(UserType || (UserType = {}));
|
|
508
463
|
|
|
509
|
-
class Lead extends BaseModel {
|
|
510
|
-
static get identifiersFields() {
|
|
511
|
-
return ['id'];
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
464
|
class Edition extends BaseModel {
|
|
516
465
|
static get identifiersFields() {
|
|
517
466
|
return ['id', 'subscriptionId'];
|
|
@@ -1910,6 +1859,17 @@ class SubscriptionPlan extends BaseModel {
|
|
|
1910
1859
|
}
|
|
1911
1860
|
}
|
|
1912
1861
|
|
|
1862
|
+
class BeautyProfile extends BaseModel {
|
|
1863
|
+
toPlain() {
|
|
1864
|
+
const plain = super.toPlain();
|
|
1865
|
+
delete plain.id;
|
|
1866
|
+
return plain;
|
|
1867
|
+
}
|
|
1868
|
+
static get identifiersFields() {
|
|
1869
|
+
return ['id', 'userId'];
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1913
1873
|
class User extends BaseModel {
|
|
1914
1874
|
static toInstance(data) {
|
|
1915
1875
|
const instance = super.toInstance(data);
|
|
@@ -2023,6 +1983,12 @@ class UserPaymentMethod extends BaseModel {
|
|
|
2023
1983
|
}
|
|
2024
1984
|
}
|
|
2025
1985
|
|
|
1986
|
+
class Lead extends BaseModel {
|
|
1987
|
+
static get identifiersFields() {
|
|
1988
|
+
return ['id'];
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
|
|
2026
1992
|
class UnauthorizedError extends CustomError {
|
|
2027
1993
|
constructor(message) {
|
|
2028
1994
|
super(message);
|
|
@@ -2195,12 +2161,6 @@ __decorate([
|
|
|
2195
2161
|
__metadata("design:type", Payment)
|
|
2196
2162
|
], Order.prototype, "payment", void 0);
|
|
2197
2163
|
|
|
2198
|
-
class OrderBlocked extends BaseModel {
|
|
2199
|
-
static get identifiersFields() {
|
|
2200
|
-
return ['id'];
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
2164
|
class CheckoutSubscription extends BaseModel {
|
|
2205
2165
|
static get identifiersFields() {
|
|
2206
2166
|
return ['id'];
|
|
@@ -3026,8 +2986,6 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
3026
2986
|
try {
|
|
3027
2987
|
const identifiers = getValueFromParams(data, keyField);
|
|
3028
2988
|
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3029
|
-
if (!(await docRef.get()).data())
|
|
3030
|
-
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
3031
2989
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
3032
2990
|
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 }));
|
|
3033
2991
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
@@ -3592,47 +3550,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3592
3550
|
}
|
|
3593
3551
|
}
|
|
3594
3552
|
|
|
3595
|
-
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3596
|
-
constructor({ firestore, interceptors, }) {
|
|
3597
|
-
super({
|
|
3598
|
-
firestore,
|
|
3599
|
-
collectionName: 'paymentBlockedAttempts',
|
|
3600
|
-
model: OrderBlocked,
|
|
3601
|
-
interceptors,
|
|
3602
|
-
});
|
|
3603
|
-
}
|
|
3604
|
-
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3605
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3606
|
-
return this.create(OrderBlocked.toInstance({
|
|
3607
|
-
customer: {
|
|
3608
|
-
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3609
|
-
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3610
|
-
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3611
|
-
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3612
|
-
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3613
|
-
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3614
|
-
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3615
|
-
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3616
|
-
},
|
|
3617
|
-
blockType,
|
|
3618
|
-
limiteRange,
|
|
3619
|
-
type,
|
|
3620
|
-
card,
|
|
3621
|
-
checkout: {
|
|
3622
|
-
id: checkout.id,
|
|
3623
|
-
shop: checkout.shop,
|
|
3624
|
-
total: checkout.totalPrice,
|
|
3625
|
-
},
|
|
3626
|
-
date: new Date(),
|
|
3627
|
-
}));
|
|
3628
|
-
}
|
|
3629
|
-
formatZip(zip) {
|
|
3630
|
-
if (zip.length === 8)
|
|
3631
|
-
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3632
|
-
return zip;
|
|
3633
|
-
}
|
|
3634
|
-
}
|
|
3635
|
-
|
|
3636
3553
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3637
3554
|
constructor({ firestore, interceptors }) {
|
|
3638
3555
|
super({
|
|
@@ -4288,7 +4205,7 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
4288
4205
|
const response = await axios(request);
|
|
4289
4206
|
if (!isNil(response.data.errors)) {
|
|
4290
4207
|
this.logger.error({ req: request, res: response.data.errors });
|
|
4291
|
-
throw new Error(
|
|
4208
|
+
throw new Error(response.data.errors);
|
|
4292
4209
|
}
|
|
4293
4210
|
this.logger.log({ req: request, res: response.data });
|
|
4294
4211
|
return response.data.data;
|
|
@@ -4655,7 +4572,6 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
4655
4572
|
fields: [
|
|
4656
4573
|
'id',
|
|
4657
4574
|
'description',
|
|
4658
|
-
'title',
|
|
4659
4575
|
'slug',
|
|
4660
4576
|
'enabled',
|
|
4661
4577
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -4767,7 +4683,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4767
4683
|
'name',
|
|
4768
4684
|
'description',
|
|
4769
4685
|
'image',
|
|
4770
|
-
{ images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4771
4686
|
'published',
|
|
4772
4687
|
'shop',
|
|
4773
4688
|
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
@@ -4800,7 +4715,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4800
4715
|
filters: {
|
|
4801
4716
|
columnName: 'filters',
|
|
4802
4717
|
foreignKeyColumn: { filter_id: 'id' },
|
|
4803
|
-
fields: [{ filter: ['id', '
|
|
4718
|
+
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
4804
4719
|
bindPersistData: (value) => ({
|
|
4805
4720
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4806
4721
|
}),
|
|
@@ -4823,21 +4738,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4823
4738
|
{
|
|
4824
4739
|
metadata: {
|
|
4825
4740
|
columnName: 'metadata',
|
|
4826
|
-
fields: ['
|
|
4741
|
+
fields: ['title', 'description'],
|
|
4827
4742
|
bindPersistData: (value) => ({
|
|
4828
4743
|
metadata: { data: value },
|
|
4829
4744
|
}),
|
|
4830
4745
|
},
|
|
4831
4746
|
},
|
|
4832
|
-
{
|
|
4833
|
-
metadatas: {
|
|
4834
|
-
columnName: 'metadatas',
|
|
4835
|
-
fields: ['shop', 'title', 'description'],
|
|
4836
|
-
bindPersistData: (value) => ({
|
|
4837
|
-
metadatas: { data: value },
|
|
4838
|
-
}),
|
|
4839
|
-
},
|
|
4840
|
-
},
|
|
4841
4747
|
{ isCollection: { columnName: 'is_collection' } },
|
|
4842
4748
|
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4843
4749
|
'reference',
|
|
@@ -4852,29 +4758,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4852
4758
|
'theme',
|
|
4853
4759
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
4854
4760
|
{ mostRelevant: { columnName: 'most_relevant', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4855
|
-
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4856
4761
|
],
|
|
4857
4762
|
});
|
|
4858
4763
|
this.productRepository = productRepository;
|
|
4859
4764
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4860
4765
|
}
|
|
4861
4766
|
async create(params) {
|
|
4862
|
-
const {
|
|
4863
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false,
|
|
4864
|
-
[Shops.GLAMSHOP]: null,
|
|
4865
|
-
[Shops.MENSMARKET]: null,
|
|
4866
|
-
}, images: images || {
|
|
4867
|
-
[Shops.GLAMSHOP]: {
|
|
4868
|
-
brandBanner: null,
|
|
4869
|
-
brandBannerMobile: null,
|
|
4870
|
-
image: null,
|
|
4871
|
-
},
|
|
4872
|
-
[Shops.MENSMARKET]: {
|
|
4873
|
-
brandBanner: null,
|
|
4874
|
-
brandBannerMobile: null,
|
|
4875
|
-
image: null,
|
|
4876
|
-
},
|
|
4877
|
-
} }));
|
|
4767
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4768
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
4878
4769
|
}
|
|
4879
4770
|
async get(identifiers) {
|
|
4880
4771
|
var _a;
|
|
@@ -4883,12 +4774,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4883
4774
|
: super.get(identifiers);
|
|
4884
4775
|
}
|
|
4885
4776
|
async update(params) {
|
|
4886
|
-
const { products, id: checkId,
|
|
4777
|
+
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
4887
4778
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4888
4779
|
const id = await this.getId(plainData.id);
|
|
4889
4780
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
4890
4781
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
4891
|
-
category.
|
|
4782
|
+
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
4892
4783
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
4893
4784
|
return category;
|
|
4894
4785
|
}
|
|
@@ -4984,7 +4875,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4984
4875
|
return products;
|
|
4985
4876
|
}
|
|
4986
4877
|
async getChildren(parentId) {
|
|
4987
|
-
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'
|
|
4878
|
+
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
|
|
4988
4879
|
args: {
|
|
4989
4880
|
type: 'category_tree_args',
|
|
4990
4881
|
value: { parentid: parentId },
|
|
@@ -5064,36 +4955,23 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5064
4955
|
});
|
|
5065
4956
|
return plainData.products;
|
|
5066
4957
|
}
|
|
5067
|
-
async updateMetadata(categoryId, {
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
});
|
|
5085
|
-
return metadatas;
|
|
5086
|
-
}
|
|
5087
|
-
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
5088
|
-
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5089
|
-
where: {
|
|
5090
|
-
type: 'category_metadata_bool_exp',
|
|
5091
|
-
required: true,
|
|
5092
|
-
value: { category_id: { _eq: categoryId } },
|
|
5093
|
-
},
|
|
5094
|
-
});
|
|
5095
|
-
return [];
|
|
5096
|
-
}
|
|
4958
|
+
async updateMetadata(categoryId, { metadata }) {
|
|
4959
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
4960
|
+
if (!plainData.metadata)
|
|
4961
|
+
return null;
|
|
4962
|
+
await this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
4963
|
+
pk_columns: {
|
|
4964
|
+
value: { category_id: categoryId },
|
|
4965
|
+
type: 'category_metadata_pk_columns_input',
|
|
4966
|
+
required: true,
|
|
4967
|
+
},
|
|
4968
|
+
_set: {
|
|
4969
|
+
value: omit(metadata, ['category_id']),
|
|
4970
|
+
type: 'category_metadata_set_input',
|
|
4971
|
+
required: true,
|
|
4972
|
+
},
|
|
4973
|
+
});
|
|
4974
|
+
return plainData.metadata;
|
|
5097
4975
|
}
|
|
5098
4976
|
async updateFilters(categoryId, { filters }) {
|
|
5099
4977
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5187,7 +5065,6 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5187
5065
|
interceptors,
|
|
5188
5066
|
fields: [
|
|
5189
5067
|
'id',
|
|
5190
|
-
'title',
|
|
5191
5068
|
'description',
|
|
5192
5069
|
'slug',
|
|
5193
5070
|
'enabled',
|
|
@@ -5575,8 +5452,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5575
5452
|
enableCount: false,
|
|
5576
5453
|
},
|
|
5577
5454
|
});
|
|
5578
|
-
if (!result.data.length)
|
|
5579
|
-
return null;
|
|
5580
5455
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
5581
5456
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
5582
5457
|
return product;
|
|
@@ -5930,31 +5805,6 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5930
5805
|
email,
|
|
5931
5806
|
});
|
|
5932
5807
|
}
|
|
5933
|
-
async getNotificationsReport(params, orderBy, pagination) {
|
|
5934
|
-
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 } }));
|
|
5935
|
-
const orderByField = {
|
|
5936
|
-
[orderBy.field]: orderBy.direction,
|
|
5937
|
-
};
|
|
5938
|
-
const { report_stock_notification } = await this.query('report_stock_notification', ['product_id', 'ean', 'sku', 'name', 'stock', 'category_id', 'category', 'reference', 'emails_registered'], {
|
|
5939
|
-
where: {
|
|
5940
|
-
type: 'report_stock_notification_bool_exp',
|
|
5941
|
-
value: query,
|
|
5942
|
-
required: true,
|
|
5943
|
-
},
|
|
5944
|
-
order_by: {
|
|
5945
|
-
type: '[report_stock_notification_order_by]',
|
|
5946
|
-
value: orderByField,
|
|
5947
|
-
required: true,
|
|
5948
|
-
},
|
|
5949
|
-
});
|
|
5950
|
-
const data = (pagination === null || pagination === void 0 ? void 0 : pagination.limit)
|
|
5951
|
-
? 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))
|
|
5952
|
-
: report_stock_notification;
|
|
5953
|
-
return {
|
|
5954
|
-
data,
|
|
5955
|
-
count: report_stock_notification.length,
|
|
5956
|
-
};
|
|
5957
|
-
}
|
|
5958
5808
|
}
|
|
5959
5809
|
|
|
5960
5810
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -6063,14 +5913,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6063
5913
|
}
|
|
6064
5914
|
}
|
|
6065
5915
|
|
|
6066
|
-
class WishlistHasuraGraphQL extends Wishlist {
|
|
6067
|
-
}
|
|
6068
|
-
|
|
6069
5916
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6070
5917
|
constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
|
|
6071
5918
|
super({
|
|
6072
5919
|
tableName: 'category',
|
|
6073
|
-
model:
|
|
5920
|
+
model: Wishlist,
|
|
6074
5921
|
endpoint,
|
|
6075
5922
|
authOptions,
|
|
6076
5923
|
interceptors,
|
|
@@ -6131,7 +5978,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6131
5978
|
{
|
|
6132
5979
|
metadata: {
|
|
6133
5980
|
columnName: 'metadata',
|
|
6134
|
-
fields: ['
|
|
5981
|
+
fields: ['title', 'description'],
|
|
6135
5982
|
bindPersistData: (value) => ({
|
|
6136
5983
|
metadata: { data: value },
|
|
6137
5984
|
}),
|
|
@@ -6151,33 +5998,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6151
5998
|
{ personId: { columnName: 'person_id' } },
|
|
6152
5999
|
{ personName: { columnName: 'person_name' } },
|
|
6153
6000
|
{ personPhoto: { columnName: 'person_photo' } },
|
|
6154
|
-
{ personType: { columnName: 'person_type' } },
|
|
6155
|
-
{ personIsSubscriber: { columnName: 'person_is_subscriber' } },
|
|
6156
6001
|
'theme',
|
|
6157
6002
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
6158
|
-
{ personHasPhoto: { columnName: 'person_has_photo' } },
|
|
6159
6003
|
],
|
|
6160
6004
|
});
|
|
6161
6005
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
6162
6006
|
}
|
|
6163
6007
|
async create(params) {
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
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 || {
|
|
6167
|
-
[Shops.GLAMSHOP]: null,
|
|
6168
|
-
[Shops.MENSMARKET]: null,
|
|
6169
|
-
}, images: images || {
|
|
6170
|
-
[Shops.GLAMSHOP]: {
|
|
6171
|
-
brandBanner: null,
|
|
6172
|
-
brandBannerMobile: null,
|
|
6173
|
-
image: null,
|
|
6174
|
-
},
|
|
6175
|
-
[Shops.MENSMARKET]: {
|
|
6176
|
-
brandBanner: null,
|
|
6177
|
-
brandBannerMobile: null,
|
|
6178
|
-
image: null,
|
|
6179
|
-
},
|
|
6180
|
-
} }));
|
|
6008
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
6009
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6181
6010
|
}
|
|
6182
6011
|
async get(identifiers) {
|
|
6183
6012
|
const data = await super.get(identifiers);
|
|
@@ -6190,12 +6019,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6190
6019
|
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
|
|
6191
6020
|
}
|
|
6192
6021
|
async update(params) {
|
|
6193
|
-
const { products, id: checkId,
|
|
6022
|
+
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
6194
6023
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6195
6024
|
const id = plainData.id;
|
|
6196
6025
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6197
6026
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6198
|
-
category.
|
|
6027
|
+
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
6199
6028
|
return category;
|
|
6200
6029
|
}
|
|
6201
6030
|
async getWishlistBySlug(slug) {
|
|
@@ -6232,7 +6061,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6232
6061
|
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
6233
6062
|
return data;
|
|
6234
6063
|
}
|
|
6235
|
-
|
|
6064
|
+
getCategoryBySlug(slug, _shop) {
|
|
6236
6065
|
return this.getWishlistBySlug(slug);
|
|
6237
6066
|
}
|
|
6238
6067
|
async getCategoryByShop(shop) {
|
|
@@ -6250,13 +6079,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6250
6079
|
});
|
|
6251
6080
|
return data;
|
|
6252
6081
|
}
|
|
6253
|
-
async findBfluOrGlamgirlWishlists(params, shops) {
|
|
6254
|
-
var _a, _b;
|
|
6255
|
-
return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true, shops: { operator: Where.LIKE, value: shops }, personType: (_b = (_a = params.filters) === null || _a === void 0 ? void 0 : _a.personType) !== null && _b !== void 0 ? _b : {
|
|
6256
|
-
operator: Where.IN,
|
|
6257
|
-
value: [PersonTypes.BFLU, PersonTypes.GLAMGIRL],
|
|
6258
|
-
} }), orderBy: Object.assign({ personHasPhoto: 'desc' }, omit(params.orderBy, ['personHasPhoto'])) }));
|
|
6259
|
-
}
|
|
6260
6082
|
getCategoriesForHome(categoryIds, limit, gender) {
|
|
6261
6083
|
return;
|
|
6262
6084
|
}
|
|
@@ -6307,40 +6129,23 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6307
6129
|
});
|
|
6308
6130
|
return plainData.products;
|
|
6309
6131
|
}
|
|
6310
|
-
async updateMetadata(categoryId, {
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
});
|
|
6328
|
-
metadataUpdated.push(update);
|
|
6329
|
-
}
|
|
6330
|
-
return metadataUpdated;
|
|
6331
|
-
}
|
|
6332
|
-
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
6333
|
-
for (let i = 0; i < metadatas.value.length; i++) {
|
|
6334
|
-
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6335
|
-
where: {
|
|
6336
|
-
type: 'category_metadata_bool_exp',
|
|
6337
|
-
required: true,
|
|
6338
|
-
value: { category_id: { _eq: categoryId }, shop: metadatas.value[i].shop },
|
|
6339
|
-
},
|
|
6340
|
-
});
|
|
6341
|
-
}
|
|
6342
|
-
return [];
|
|
6343
|
-
}
|
|
6132
|
+
async updateMetadata(categoryId, { metadata }) {
|
|
6133
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
6134
|
+
if (!plainData.metadata)
|
|
6135
|
+
return;
|
|
6136
|
+
await this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
6137
|
+
pk_columns: {
|
|
6138
|
+
value: { category_id: categoryId },
|
|
6139
|
+
type: 'category_metadata_pk_columns_input',
|
|
6140
|
+
required: true,
|
|
6141
|
+
},
|
|
6142
|
+
_set: {
|
|
6143
|
+
value: omit(metadata, ['category_id']),
|
|
6144
|
+
type: 'category_metadata_set_input',
|
|
6145
|
+
required: true,
|
|
6146
|
+
},
|
|
6147
|
+
});
|
|
6148
|
+
return plainData.metadata;
|
|
6344
6149
|
}
|
|
6345
6150
|
}
|
|
6346
6151
|
__decorate([
|
|
@@ -6361,11 +6166,5 @@ __decorate([
|
|
|
6361
6166
|
__metadata("design:paramtypes", [String]),
|
|
6362
6167
|
__metadata("design:returntype", Promise)
|
|
6363
6168
|
], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
|
|
6364
|
-
__decorate([
|
|
6365
|
-
Log(),
|
|
6366
|
-
__metadata("design:type", Function),
|
|
6367
|
-
__metadata("design:paramtypes", [Object, Array]),
|
|
6368
|
-
__metadata("design:returntype", Promise)
|
|
6369
|
-
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6370
6169
|
|
|
6371
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order,
|
|
6170
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier, ModelBaseStructure } from '../../generic/model';
|
|
2
2
|
import { Shops } from './enums';
|
|
3
3
|
import { Filter } from './filter';
|
|
4
|
-
import { CategoryCondition,
|
|
4
|
+
import { CategoryCondition, CategoryMetadata } from './types';
|
|
5
5
|
export declare class CategoryBase<ChildCategory extends ModelBaseStructure<ChildCategory, Identifiers> = ModelBaseStructure<any, any>, Identifiers = ChildCategory['identifiersFields']> extends BaseModel<ChildCategory, Identifiers> {
|
|
6
6
|
id: string;
|
|
7
7
|
brandCategory: boolean;
|
|
@@ -9,7 +9,6 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
9
9
|
name: string;
|
|
10
10
|
slug: string;
|
|
11
11
|
image?: string;
|
|
12
|
-
images?: CategoryImages;
|
|
13
12
|
brandCategoryBanner?: string;
|
|
14
13
|
brandCategoryBannerMobile?: string;
|
|
15
14
|
description: string;
|
|
@@ -20,8 +19,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
20
19
|
shop?: Shops;
|
|
21
20
|
shops?: string[];
|
|
22
21
|
published: boolean;
|
|
23
|
-
metadata
|
|
24
|
-
metadatas: CategoryMetadata[];
|
|
22
|
+
metadata: CategoryMetadata;
|
|
25
23
|
isCollection?: boolean;
|
|
26
24
|
isWishlist?: boolean;
|
|
27
25
|
reference?: string;
|
|
@@ -29,21 +27,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
29
27
|
theme?: string;
|
|
30
28
|
bannerUrl?: string;
|
|
31
29
|
mostRelevant?: string[];
|
|
32
|
-
mostRelevants?: CategoryMostRelevant;
|
|
33
30
|
parent?: CategoryBase;
|
|
34
31
|
filters?: Filter[];
|
|
35
32
|
static get identifiersFields(): GenericIdentifier[];
|
|
36
|
-
get glamImages(): {
|
|
37
|
-
image: string;
|
|
38
|
-
brandBanner: string;
|
|
39
|
-
brandBannerMobile: string;
|
|
40
|
-
};
|
|
41
|
-
get mensImages(): {
|
|
42
|
-
image: string;
|
|
43
|
-
brandBanner: string;
|
|
44
|
-
brandBannerMobile: string;
|
|
45
|
-
};
|
|
46
|
-
get glamMetadata(): CategoryMetadata;
|
|
47
|
-
get mensMetadata(): CategoryMetadata;
|
|
48
|
-
getMostRelevantByShop(shop: Shops): string[];
|
|
49
33
|
}
|