@infrab4a/connect 4.9.7-beta.1 → 4.9.7-beta.11
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 +241 -73
- package/index.esm.js +240 -74
- package/package.json +1 -1
- package/src/domain/catalog/models/category-base.d.ts +17 -3
- package/src/domain/catalog/models/filter.d.ts +2 -0
- package/src/domain/catalog/models/types/category-images.type.d.ts +8 -0
- package/src/domain/catalog/models/types/category-metadata.type.d.ts +2 -0
- package/src/domain/catalog/models/types/category-most-relevant.type.d.ts +4 -0
- package/src/domain/catalog/models/types/index.d.ts +3 -0
- package/src/domain/catalog/models/types/report-stock-notification.type.d.ts +17 -0
- package/src/domain/catalog/models/wishlist.d.ts +3 -0
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +2 -1
- package/src/domain/catalog/repositories/wishlist.repository.d.ts +3 -0
- package/src/domain/shopping/index.d.ts +1 -0
- package/src/domain/shopping/models/coupons/coupon.d.ts +1 -1
- package/src/domain/shopping/models/index.d.ts +1 -0
- package/src/domain/shopping/models/order-blocked.d.ts +26 -0
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +6 -0
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
- package/src/domain/users/models/enums/index.d.ts +1 -0
- package/src/domain/users/models/enums/person-types.enum.d.ts +5 -0
- package/src/domain/users/models/index.d.ts +3 -2
- package/src/domain/users/models/types/index.d.ts +1 -0
- package/src/domain/users/models/types/person.type.d.ts +2 -0
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +9 -0
- package/src/infra/hasura-graphql/models/wishlist-hasura-graphql.d.ts +4 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +8 -1
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +11 -9
package/index.esm.js
CHANGED
|
@@ -36,16 +36,50 @@ 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
|
+
|
|
39
54
|
class Filter extends BaseModel {
|
|
40
55
|
static get identifiersFields() {
|
|
41
56
|
return ['id'];
|
|
42
57
|
}
|
|
43
58
|
}
|
|
59
|
+
__decorate([
|
|
60
|
+
Type(() => Category),
|
|
61
|
+
__metadata("design:type", Array)
|
|
62
|
+
], Filter.prototype, "categories", void 0);
|
|
44
63
|
|
|
45
64
|
class CategoryBase extends BaseModel {
|
|
46
65
|
static get identifiersFields() {
|
|
47
66
|
return ['id'];
|
|
48
67
|
}
|
|
68
|
+
get glamImages() {
|
|
69
|
+
return this.images[Shops.GLAMSHOP];
|
|
70
|
+
}
|
|
71
|
+
get mensImages() {
|
|
72
|
+
return this.images[Shops.MENSMARKET];
|
|
73
|
+
}
|
|
74
|
+
get glamMetadata() {
|
|
75
|
+
return this.metadata.find((metadata) => metadata.shop === Shops.GLAMSHOP);
|
|
76
|
+
}
|
|
77
|
+
get mensMetadata() {
|
|
78
|
+
return this.metadata.find((metadata) => metadata.shop === Shops.MENSMARKET);
|
|
79
|
+
}
|
|
80
|
+
getMostRelevantByShop(shop) {
|
|
81
|
+
return this.mostRelevant && this.mostRelevant[shop] ? this.mostRelevant[shop] : [];
|
|
82
|
+
}
|
|
49
83
|
}
|
|
50
84
|
__decorate([
|
|
51
85
|
Type(() => CategoryBase),
|
|
@@ -154,21 +188,6 @@ __decorate([
|
|
|
154
188
|
__metadata("design:type", Category)
|
|
155
189
|
], CategoryFilter.prototype, "category", void 0);
|
|
156
190
|
|
|
157
|
-
var GenderDestination;
|
|
158
|
-
(function (GenderDestination) {
|
|
159
|
-
GenderDestination["FEMALE"] = "female";
|
|
160
|
-
GenderDestination["MALE"] = "male";
|
|
161
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
162
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
163
|
-
|
|
164
|
-
var Shops;
|
|
165
|
-
(function (Shops) {
|
|
166
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
167
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
168
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
169
|
-
Shops["ALL"] = "ALL";
|
|
170
|
-
})(Shops || (Shops = {}));
|
|
171
|
-
|
|
172
191
|
class FilterOption extends BaseModel {
|
|
173
192
|
static get identifiersFields() {
|
|
174
193
|
return ['id'];
|
|
@@ -261,6 +280,17 @@ class CampaignHashtag extends BaseModel {
|
|
|
261
280
|
}
|
|
262
281
|
}
|
|
263
282
|
|
|
283
|
+
class BeautyProfile extends BaseModel {
|
|
284
|
+
toPlain() {
|
|
285
|
+
const plain = super.toPlain();
|
|
286
|
+
delete plain.id;
|
|
287
|
+
return plain;
|
|
288
|
+
}
|
|
289
|
+
static get identifiersFields() {
|
|
290
|
+
return ['id', 'userId'];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
264
294
|
var AccessoryImportances;
|
|
265
295
|
(function (AccessoryImportances) {
|
|
266
296
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -437,6 +467,13 @@ var OfficePosition;
|
|
|
437
467
|
OfficePosition["Director"] = "Diretor";
|
|
438
468
|
})(OfficePosition || (OfficePosition = {}));
|
|
439
469
|
|
|
470
|
+
var PersonTypes;
|
|
471
|
+
(function (PersonTypes) {
|
|
472
|
+
PersonTypes["GLAMGIRL"] = "glamgirl";
|
|
473
|
+
PersonTypes["BFLU"] = "bflu";
|
|
474
|
+
PersonTypes["NONE"] = "none";
|
|
475
|
+
})(PersonTypes || (PersonTypes = {}));
|
|
476
|
+
|
|
440
477
|
var ProductSpents;
|
|
441
478
|
(function (ProductSpents) {
|
|
442
479
|
ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
|
|
@@ -457,6 +494,12 @@ var UserType;
|
|
|
457
494
|
UserType["Influencer"] = "Influencer";
|
|
458
495
|
})(UserType || (UserType = {}));
|
|
459
496
|
|
|
497
|
+
class Lead extends BaseModel {
|
|
498
|
+
static get identifiersFields() {
|
|
499
|
+
return ['id'];
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
460
503
|
class Edition extends BaseModel {
|
|
461
504
|
static get identifiersFields() {
|
|
462
505
|
return ['id', 'subscriptionId'];
|
|
@@ -1855,17 +1898,6 @@ class SubscriptionPlan extends BaseModel {
|
|
|
1855
1898
|
}
|
|
1856
1899
|
}
|
|
1857
1900
|
|
|
1858
|
-
class BeautyProfile extends BaseModel {
|
|
1859
|
-
toPlain() {
|
|
1860
|
-
const plain = super.toPlain();
|
|
1861
|
-
delete plain.id;
|
|
1862
|
-
return plain;
|
|
1863
|
-
}
|
|
1864
|
-
static get identifiersFields() {
|
|
1865
|
-
return ['id', 'userId'];
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
1901
|
class User extends BaseModel {
|
|
1870
1902
|
static toInstance(data) {
|
|
1871
1903
|
const instance = super.toInstance(data);
|
|
@@ -1979,12 +2011,6 @@ class UserPaymentMethod extends BaseModel {
|
|
|
1979
2011
|
}
|
|
1980
2012
|
}
|
|
1981
2013
|
|
|
1982
|
-
class Lead extends BaseModel {
|
|
1983
|
-
static get identifiersFields() {
|
|
1984
|
-
return ['id'];
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
2014
|
class UnauthorizedError extends CustomError {
|
|
1989
2015
|
constructor(message) {
|
|
1990
2016
|
super(message);
|
|
@@ -2157,6 +2183,12 @@ __decorate([
|
|
|
2157
2183
|
__metadata("design:type", Payment)
|
|
2158
2184
|
], Order.prototype, "payment", void 0);
|
|
2159
2185
|
|
|
2186
|
+
class OrderBlocked extends BaseModel {
|
|
2187
|
+
static get identifiersFields() {
|
|
2188
|
+
return ['id'];
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2160
2192
|
class CheckoutSubscription extends BaseModel {
|
|
2161
2193
|
static get identifiersFields() {
|
|
2162
2194
|
return ['id'];
|
|
@@ -2982,6 +3014,8 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2982
3014
|
try {
|
|
2983
3015
|
const identifiers = getValueFromParams(data, keyField);
|
|
2984
3016
|
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3017
|
+
if (!(await docRef.get()).data())
|
|
3018
|
+
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
2985
3019
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
2986
3020
|
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 }));
|
|
2987
3021
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
@@ -3546,6 +3580,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3546
3580
|
}
|
|
3547
3581
|
}
|
|
3548
3582
|
|
|
3583
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3584
|
+
constructor({ firestore, interceptors, }) {
|
|
3585
|
+
super({
|
|
3586
|
+
firestore,
|
|
3587
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3588
|
+
model: OrderBlocked,
|
|
3589
|
+
interceptors,
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3592
|
+
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3593
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3594
|
+
return this.create(OrderBlocked.toInstance({
|
|
3595
|
+
customer: {
|
|
3596
|
+
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3597
|
+
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3598
|
+
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3599
|
+
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3600
|
+
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3601
|
+
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3602
|
+
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3603
|
+
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3604
|
+
},
|
|
3605
|
+
blockType,
|
|
3606
|
+
limiteRange,
|
|
3607
|
+
type,
|
|
3608
|
+
card,
|
|
3609
|
+
checkout: {
|
|
3610
|
+
id: checkout.id,
|
|
3611
|
+
shop: checkout.shop,
|
|
3612
|
+
total: checkout.totalPrice,
|
|
3613
|
+
},
|
|
3614
|
+
date: new Date(),
|
|
3615
|
+
}));
|
|
3616
|
+
}
|
|
3617
|
+
formatZip(zip) {
|
|
3618
|
+
if (zip.length === 8)
|
|
3619
|
+
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3620
|
+
return zip;
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3549
3624
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3550
3625
|
constructor({ firestore, interceptors }) {
|
|
3551
3626
|
super({
|
|
@@ -4201,7 +4276,7 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
4201
4276
|
const response = await axios(request);
|
|
4202
4277
|
if (!isNil(response.data.errors)) {
|
|
4203
4278
|
this.logger.error({ req: request, res: response.data.errors });
|
|
4204
|
-
throw new Error(response.data.errors);
|
|
4279
|
+
throw new Error(JSON.stringify(response.data.errors));
|
|
4205
4280
|
}
|
|
4206
4281
|
this.logger.log({ req: request, res: response.data });
|
|
4207
4282
|
return response.data.data;
|
|
@@ -4679,6 +4754,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4679
4754
|
'name',
|
|
4680
4755
|
'description',
|
|
4681
4756
|
'image',
|
|
4757
|
+
{ images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4682
4758
|
'published',
|
|
4683
4759
|
'shop',
|
|
4684
4760
|
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
@@ -4734,7 +4810,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4734
4810
|
{
|
|
4735
4811
|
metadata: {
|
|
4736
4812
|
columnName: 'metadata',
|
|
4737
|
-
fields: ['title', 'description'],
|
|
4813
|
+
fields: ['shop', 'title', 'description'],
|
|
4738
4814
|
bindPersistData: (value) => ({
|
|
4739
4815
|
metadata: { data: value },
|
|
4740
4816
|
}),
|
|
@@ -4760,8 +4836,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4760
4836
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4761
4837
|
}
|
|
4762
4838
|
async create(params) {
|
|
4763
|
-
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4764
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null }
|
|
4839
|
+
const { mostRelevant, metadata } = params, data = __rest(params, ["mostRelevant", "metadata"]);
|
|
4840
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }], mostRelevant: mostRelevant || {
|
|
4841
|
+
[Shops.GLAMSHOP]: null,
|
|
4842
|
+
[Shops.MENSMARKET]: null,
|
|
4843
|
+
} }));
|
|
4765
4844
|
}
|
|
4766
4845
|
async get(identifiers) {
|
|
4767
4846
|
var _a;
|
|
@@ -4871,7 +4950,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4871
4950
|
return products;
|
|
4872
4951
|
}
|
|
4873
4952
|
async getChildren(parentId) {
|
|
4874
|
-
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
|
|
4953
|
+
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
|
|
4875
4954
|
args: {
|
|
4876
4955
|
type: 'category_tree_args',
|
|
4877
4956
|
value: { parentid: parentId },
|
|
@@ -4952,22 +5031,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4952
5031
|
return plainData.products;
|
|
4953
5032
|
}
|
|
4954
5033
|
async updateMetadata(categoryId, { metadata }) {
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
5034
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
5035
|
+
return [];
|
|
5036
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
5037
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5038
|
+
where: {
|
|
5039
|
+
type: 'category_metadata_bool_exp',
|
|
5040
|
+
required: true,
|
|
5041
|
+
value: { category_id: { _eq: categoryId } },
|
|
5042
|
+
},
|
|
5043
|
+
});
|
|
5044
|
+
await this.mutation('insert_category_metadata', ['affected_rows'], {
|
|
5045
|
+
objects: {
|
|
5046
|
+
type: '[category_metadata_insert_input!]',
|
|
5047
|
+
required: true,
|
|
5048
|
+
value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
|
|
5049
|
+
},
|
|
5050
|
+
});
|
|
5051
|
+
return metadata;
|
|
5052
|
+
}
|
|
5053
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
5054
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5055
|
+
where: {
|
|
5056
|
+
type: 'category_metadata_bool_exp',
|
|
5057
|
+
required: true,
|
|
5058
|
+
value: { category_id: { _eq: categoryId } },
|
|
5059
|
+
},
|
|
5060
|
+
});
|
|
5061
|
+
return [];
|
|
5062
|
+
}
|
|
4971
5063
|
}
|
|
4972
5064
|
async updateFilters(categoryId, { filters }) {
|
|
4973
5065
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5079,6 +5171,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5079
5171
|
],
|
|
5080
5172
|
},
|
|
5081
5173
|
},
|
|
5174
|
+
{
|
|
5175
|
+
categories: {
|
|
5176
|
+
columnName: 'categories',
|
|
5177
|
+
foreignKeyColumn: { category_id: 'id' },
|
|
5178
|
+
fields: [{ category: ['id', 'name', 'slug'] }],
|
|
5179
|
+
bindPersistData: (value) => ({
|
|
5180
|
+
categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
5181
|
+
}),
|
|
5182
|
+
from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
|
|
5183
|
+
},
|
|
5184
|
+
},
|
|
5082
5185
|
],
|
|
5083
5186
|
});
|
|
5084
5187
|
this.filterOptionRepository = filterOptionRepository;
|
|
@@ -5790,6 +5893,32 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5790
5893
|
email,
|
|
5791
5894
|
});
|
|
5792
5895
|
}
|
|
5896
|
+
async getNotificationsReport(params, orderBy, pagination) {
|
|
5897
|
+
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.ean && { ean: { _eq: params.ean } })), (params.sku && { sku: { _eq: params.sku } })), (params.name && { name: { _iregex: params.name } })), (params.category && { category: { _iregex: params.category } })), (params.reference && { category_reference: { _eq: params.reference } })), (params.emailsCount && { emails_registered: { _eq: params.emailsCount } }));
|
|
5898
|
+
const orderByField = {
|
|
5899
|
+
[orderBy.field]: orderBy.direction,
|
|
5900
|
+
};
|
|
5901
|
+
const limit = Object.assign({}, ((pagination === null || pagination === void 0 ? void 0 : pagination.limit) && {
|
|
5902
|
+
limit: {
|
|
5903
|
+
value: pagination === null || pagination === void 0 ? void 0 : pagination.limit,
|
|
5904
|
+
},
|
|
5905
|
+
}));
|
|
5906
|
+
const offset = Object.assign({}, ((pagination === null || pagination === void 0 ? void 0 : pagination.offset) && {
|
|
5907
|
+
offset: {
|
|
5908
|
+
value: pagination === null || pagination === void 0 ? void 0 : pagination.offset,
|
|
5909
|
+
},
|
|
5910
|
+
}));
|
|
5911
|
+
const { report_stock_notification } = await this.query('report_stock_notification', ['product_id', 'ean', 'sku', 'name', 'stock', 'category_id', 'category', 'reference', 'emails_registered'], Object.assign(Object.assign({ where: {
|
|
5912
|
+
type: 'report_stock_notification_bool_exp',
|
|
5913
|
+
value: query,
|
|
5914
|
+
required: true,
|
|
5915
|
+
}, order_by: {
|
|
5916
|
+
type: '[report_stock_notification_order_by]',
|
|
5917
|
+
value: orderByField,
|
|
5918
|
+
required: true,
|
|
5919
|
+
} }, limit), offset));
|
|
5920
|
+
return report_stock_notification;
|
|
5921
|
+
}
|
|
5793
5922
|
}
|
|
5794
5923
|
|
|
5795
5924
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -5898,11 +6027,14 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5898
6027
|
}
|
|
5899
6028
|
}
|
|
5900
6029
|
|
|
6030
|
+
class WishlistHasuraGraphQL extends Wishlist {
|
|
6031
|
+
}
|
|
6032
|
+
|
|
5901
6033
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5902
6034
|
constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
|
|
5903
6035
|
super({
|
|
5904
6036
|
tableName: 'category',
|
|
5905
|
-
model:
|
|
6037
|
+
model: WishlistHasuraGraphQL,
|
|
5906
6038
|
endpoint,
|
|
5907
6039
|
authOptions,
|
|
5908
6040
|
interceptors,
|
|
@@ -5963,7 +6095,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5963
6095
|
{
|
|
5964
6096
|
metadata: {
|
|
5965
6097
|
columnName: 'metadata',
|
|
5966
|
-
fields: ['title', 'description'],
|
|
6098
|
+
fields: ['shop', 'title', 'description'],
|
|
5967
6099
|
bindPersistData: (value) => ({
|
|
5968
6100
|
metadata: { data: value },
|
|
5969
6101
|
}),
|
|
@@ -5983,15 +6115,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5983
6115
|
{ personId: { columnName: 'person_id' } },
|
|
5984
6116
|
{ personName: { columnName: 'person_name' } },
|
|
5985
6117
|
{ personPhoto: { columnName: 'person_photo' } },
|
|
6118
|
+
{ personType: { columnName: 'person_type' } },
|
|
6119
|
+
{ personIsSubscriber: { columnName: 'person_is_subscriber' } },
|
|
5986
6120
|
'theme',
|
|
5987
6121
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
6122
|
+
{ personHasPhoto: { columnName: 'person_has_photo' } },
|
|
5988
6123
|
],
|
|
5989
6124
|
});
|
|
5990
6125
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5991
6126
|
}
|
|
5992
6127
|
async create(params) {
|
|
6128
|
+
var _a;
|
|
5993
6129
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
5994
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6130
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }] }));
|
|
5995
6131
|
}
|
|
5996
6132
|
async get(identifiers) {
|
|
5997
6133
|
const data = await super.get(identifiers);
|
|
@@ -6046,7 +6182,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6046
6182
|
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
6047
6183
|
return data;
|
|
6048
6184
|
}
|
|
6049
|
-
getCategoryBySlug(slug, _shop) {
|
|
6185
|
+
async getCategoryBySlug(slug, _shop) {
|
|
6050
6186
|
return this.getWishlistBySlug(slug);
|
|
6051
6187
|
}
|
|
6052
6188
|
async getCategoryByShop(shop) {
|
|
@@ -6064,6 +6200,13 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6064
6200
|
});
|
|
6065
6201
|
return data;
|
|
6066
6202
|
}
|
|
6203
|
+
async findBfluOrGlamgirlWishlists(params, shops) {
|
|
6204
|
+
var _a, _b;
|
|
6205
|
+
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 : {
|
|
6206
|
+
operator: Where.IN,
|
|
6207
|
+
value: [PersonTypes.BFLU, PersonTypes.GLAMGIRL],
|
|
6208
|
+
} }), orderBy: Object.assign({ personHasPhoto: 'desc' }, omit(params.orderBy, ['personHasPhoto'])) }));
|
|
6209
|
+
}
|
|
6067
6210
|
getCategoriesForHome(categoryIds, limit, gender) {
|
|
6068
6211
|
return;
|
|
6069
6212
|
}
|
|
@@ -6115,22 +6258,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6115
6258
|
return plainData.products;
|
|
6116
6259
|
}
|
|
6117
6260
|
async updateMetadata(categoryId, { metadata }) {
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6261
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
6262
|
+
return [];
|
|
6263
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
6264
|
+
const metadataUpdated = [];
|
|
6265
|
+
for (const data of metadata) {
|
|
6266
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6267
|
+
pk_columns: {
|
|
6268
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
6269
|
+
type: 'category_metadata_pk_columns_input',
|
|
6270
|
+
required: true,
|
|
6271
|
+
},
|
|
6272
|
+
_set: {
|
|
6273
|
+
value: omit(data, ['category_id', 'shop']),
|
|
6274
|
+
type: 'category_metadata_set_input',
|
|
6275
|
+
required: true,
|
|
6276
|
+
},
|
|
6277
|
+
});
|
|
6278
|
+
metadataUpdated.push(update);
|
|
6279
|
+
}
|
|
6280
|
+
return metadataUpdated;
|
|
6281
|
+
}
|
|
6282
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
6283
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
6284
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6285
|
+
where: {
|
|
6286
|
+
type: 'category_metadata_bool_exp',
|
|
6287
|
+
required: true,
|
|
6288
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
6289
|
+
},
|
|
6290
|
+
});
|
|
6291
|
+
}
|
|
6292
|
+
return [];
|
|
6293
|
+
}
|
|
6134
6294
|
}
|
|
6135
6295
|
}
|
|
6136
6296
|
__decorate([
|
|
@@ -6151,5 +6311,11 @@ __decorate([
|
|
|
6151
6311
|
__metadata("design:paramtypes", [String]),
|
|
6152
6312
|
__metadata("design:returntype", Promise)
|
|
6153
6313
|
], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
|
|
6314
|
+
__decorate([
|
|
6315
|
+
Log(),
|
|
6316
|
+
__metadata("design:type", Function),
|
|
6317
|
+
__metadata("design:paramtypes", [Object, Array]),
|
|
6318
|
+
__metadata("design:returntype", Promise)
|
|
6319
|
+
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6154
6320
|
|
|
6155
|
-
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 };
|
|
6321
|
+
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, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, 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, CategoryMetadata } from './types';
|
|
4
|
+
import { CategoryCondition, CategoryImages, CategoryMetadata, CategoryMostRelevant } 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,6 +9,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
9
9
|
name: string;
|
|
10
10
|
slug: string;
|
|
11
11
|
image?: string;
|
|
12
|
+
images?: CategoryImages;
|
|
12
13
|
brandCategoryBanner?: string;
|
|
13
14
|
brandCategoryBannerMobile?: string;
|
|
14
15
|
description: string;
|
|
@@ -19,15 +20,28 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
19
20
|
shop?: Shops;
|
|
20
21
|
shops?: string[];
|
|
21
22
|
published: boolean;
|
|
22
|
-
metadata: CategoryMetadata;
|
|
23
|
+
metadata: CategoryMetadata[];
|
|
23
24
|
isCollection?: boolean;
|
|
24
25
|
isWishlist?: boolean;
|
|
25
26
|
reference?: string;
|
|
26
27
|
parentId?: number;
|
|
27
28
|
theme?: string;
|
|
28
29
|
bannerUrl?: string;
|
|
29
|
-
mostRelevant?:
|
|
30
|
+
mostRelevant?: CategoryMostRelevant;
|
|
30
31
|
parent?: CategoryBase;
|
|
31
32
|
filters?: Filter[];
|
|
32
33
|
static get identifiersFields(): GenericIdentifier[];
|
|
34
|
+
get glamImages(): {
|
|
35
|
+
image: string;
|
|
36
|
+
brandBanner: string;
|
|
37
|
+
brandBannerMobile: string;
|
|
38
|
+
};
|
|
39
|
+
get mensImages(): {
|
|
40
|
+
image: string;
|
|
41
|
+
brandBanner: string;
|
|
42
|
+
brandBannerMobile: string;
|
|
43
|
+
};
|
|
44
|
+
get glamMetadata(): CategoryMetadata;
|
|
45
|
+
get mensMetadata(): CategoryMetadata;
|
|
46
|
+
getMostRelevantByShop(shop: Shops): string[];
|
|
33
47
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier } from '../../generic/model';
|
|
2
|
+
import { Category } from './category';
|
|
2
3
|
import { FilterOption } from './filter-option';
|
|
3
4
|
export declare class Filter extends BaseModel<Filter> {
|
|
4
5
|
id: number;
|
|
@@ -8,5 +9,6 @@ export declare class Filter extends BaseModel<Filter> {
|
|
|
8
9
|
options?: FilterOption[];
|
|
9
10
|
createdAt?: Date;
|
|
10
11
|
updatedAt?: Date;
|
|
12
|
+
categories?: Category[];
|
|
11
13
|
static get identifiersFields(): GenericIdentifier[];
|
|
12
14
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export * from './category-condition.type';
|
|
2
|
+
export * from './category-images.type';
|
|
2
3
|
export * from './category-metadata.type';
|
|
4
|
+
export * from './category-most-relevant.type';
|
|
3
5
|
export * from './category-product';
|
|
4
6
|
export * from './product-evaluation.type';
|
|
5
7
|
export * from './product-gender.type';
|
|
6
8
|
export * from './product-metadata.type';
|
|
7
9
|
export * from './product-review.type';
|
|
10
|
+
export * from './report-stock-notification.type';
|
|
8
11
|
export * from './shop-description.type';
|
|
9
12
|
export * from './shop-price.type';
|
|
10
13
|
export * from './stock.type';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ReportStockNotification = {
|
|
2
|
+
ean: string;
|
|
3
|
+
sku: string;
|
|
4
|
+
name: string;
|
|
5
|
+
stock: number;
|
|
6
|
+
category: string;
|
|
7
|
+
category_reference: string;
|
|
8
|
+
emails_registered: number;
|
|
9
|
+
};
|
|
10
|
+
export type ReportStockNotificationInput = {
|
|
11
|
+
ean?: string;
|
|
12
|
+
sku?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
reference?: string;
|
|
16
|
+
emailsCount?: number;
|
|
17
|
+
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { GenericIdentifier } from '../../generic/model';
|
|
2
|
+
import { PersonType } from '../../users';
|
|
2
3
|
import { Category } from './category';
|
|
3
4
|
export declare class Wishlist extends Category {
|
|
4
5
|
personId?: string;
|
|
5
6
|
personName?: string;
|
|
6
7
|
personPhoto?: string;
|
|
8
|
+
personType?: PersonType;
|
|
9
|
+
personIsSubscriber?: boolean;
|
|
7
10
|
static get identifiersFields(): GenericIdentifier[];
|
|
8
11
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
-
import { ProductStockNotification, Shops } from '../models';
|
|
2
|
+
import { ProductStockNotification, ReportStockNotification, ReportStockNotificationInput, Shops } from '../models';
|
|
3
3
|
export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
|
|
4
4
|
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
5
|
+
getNotificationsReport(params: ReportStockNotificationInput): Promise<ReportStockNotification[]>;
|
|
5
6
|
}
|