@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.
Files changed (32) hide show
  1. package/index.cjs.js +241 -73
  2. package/index.esm.js +240 -74
  3. package/package.json +1 -1
  4. package/src/domain/catalog/models/category-base.d.ts +17 -3
  5. package/src/domain/catalog/models/filter.d.ts +2 -0
  6. package/src/domain/catalog/models/types/category-images.type.d.ts +8 -0
  7. package/src/domain/catalog/models/types/category-metadata.type.d.ts +2 -0
  8. package/src/domain/catalog/models/types/category-most-relevant.type.d.ts +4 -0
  9. package/src/domain/catalog/models/types/index.d.ts +3 -0
  10. package/src/domain/catalog/models/types/report-stock-notification.type.d.ts +17 -0
  11. package/src/domain/catalog/models/wishlist.d.ts +3 -0
  12. package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +2 -1
  13. package/src/domain/catalog/repositories/wishlist.repository.d.ts +3 -0
  14. package/src/domain/shopping/index.d.ts +1 -0
  15. package/src/domain/shopping/models/coupons/coupon.d.ts +1 -1
  16. package/src/domain/shopping/models/index.d.ts +1 -0
  17. package/src/domain/shopping/models/order-blocked.d.ts +26 -0
  18. package/src/domain/shopping/repositories/index.d.ts +1 -0
  19. package/src/domain/shopping/repositories/order-blocked.repository.d.ts +6 -0
  20. package/src/domain/shopping/types/index.d.ts +1 -0
  21. package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
  22. package/src/domain/users/models/enums/index.d.ts +1 -0
  23. package/src/domain/users/models/enums/person-types.enum.d.ts +5 -0
  24. package/src/domain/users/models/index.d.ts +3 -2
  25. package/src/domain/users/models/types/index.d.ts +1 -0
  26. package/src/domain/users/models/types/person.type.d.ts +2 -0
  27. package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
  28. package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
  29. package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +9 -0
  30. package/src/infra/hasura-graphql/models/wishlist-hasura-graphql.d.ts +4 -0
  31. package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +8 -1
  32. package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +11 -9
package/index.cjs.js CHANGED
@@ -42,16 +42,50 @@ 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
+
45
60
  class Filter extends BaseModel {
46
61
  static get identifiersFields() {
47
62
  return ['id'];
48
63
  }
49
64
  }
65
+ tslib.__decorate([
66
+ classTransformer.Type(() => Category),
67
+ tslib.__metadata("design:type", Array)
68
+ ], Filter.prototype, "categories", void 0);
50
69
 
51
70
  class CategoryBase extends BaseModel {
52
71
  static get identifiersFields() {
53
72
  return ['id'];
54
73
  }
74
+ get glamImages() {
75
+ return this.images[exports.Shops.GLAMSHOP];
76
+ }
77
+ get mensImages() {
78
+ return this.images[exports.Shops.MENSMARKET];
79
+ }
80
+ get glamMetadata() {
81
+ return this.metadata.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
82
+ }
83
+ get mensMetadata() {
84
+ return this.metadata.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
85
+ }
86
+ getMostRelevantByShop(shop) {
87
+ return this.mostRelevant && this.mostRelevant[shop] ? this.mostRelevant[shop] : [];
88
+ }
55
89
  }
56
90
  tslib.__decorate([
57
91
  classTransformer.Type(() => CategoryBase),
@@ -160,21 +194,6 @@ tslib.__decorate([
160
194
  tslib.__metadata("design:type", Category)
161
195
  ], CategoryFilter.prototype, "category", void 0);
162
196
 
163
- exports.GenderDestination = void 0;
164
- (function (GenderDestination) {
165
- GenderDestination["FEMALE"] = "female";
166
- GenderDestination["MALE"] = "male";
167
- GenderDestination["UNISEX"] = "unisex";
168
- })(exports.GenderDestination || (exports.GenderDestination = {}));
169
-
170
- exports.Shops = void 0;
171
- (function (Shops) {
172
- Shops["MENSMARKET"] = "mensmarket";
173
- Shops["GLAMSHOP"] = "Glamshop";
174
- Shops["GLAMPOINTS"] = "Glampoints";
175
- Shops["ALL"] = "ALL";
176
- })(exports.Shops || (exports.Shops = {}));
177
-
178
197
  class FilterOption extends BaseModel {
179
198
  static get identifiersFields() {
180
199
  return ['id'];
@@ -267,6 +286,17 @@ class CampaignHashtag extends BaseModel {
267
286
  }
268
287
  }
269
288
 
289
+ class BeautyProfile extends BaseModel {
290
+ toPlain() {
291
+ const plain = super.toPlain();
292
+ delete plain.id;
293
+ return plain;
294
+ }
295
+ static get identifiersFields() {
296
+ return ['id', 'userId'];
297
+ }
298
+ }
299
+
270
300
  exports.AccessoryImportances = void 0;
271
301
  (function (AccessoryImportances) {
272
302
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -443,6 +473,13 @@ exports.OfficePosition = void 0;
443
473
  OfficePosition["Director"] = "Diretor";
444
474
  })(exports.OfficePosition || (exports.OfficePosition = {}));
445
475
 
476
+ exports.PersonTypes = void 0;
477
+ (function (PersonTypes) {
478
+ PersonTypes["GLAMGIRL"] = "glamgirl";
479
+ PersonTypes["BFLU"] = "bflu";
480
+ PersonTypes["NONE"] = "none";
481
+ })(exports.PersonTypes || (exports.PersonTypes = {}));
482
+
446
483
  exports.ProductSpents = void 0;
447
484
  (function (ProductSpents) {
448
485
  ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
@@ -463,6 +500,12 @@ exports.UserType = void 0;
463
500
  UserType["Influencer"] = "Influencer";
464
501
  })(exports.UserType || (exports.UserType = {}));
465
502
 
503
+ class Lead extends BaseModel {
504
+ static get identifiersFields() {
505
+ return ['id'];
506
+ }
507
+ }
508
+
466
509
  class Edition extends BaseModel {
467
510
  static get identifiersFields() {
468
511
  return ['id', 'subscriptionId'];
@@ -1861,17 +1904,6 @@ class SubscriptionPlan extends BaseModel {
1861
1904
  }
1862
1905
  }
1863
1906
 
1864
- class BeautyProfile extends BaseModel {
1865
- toPlain() {
1866
- const plain = super.toPlain();
1867
- delete plain.id;
1868
- return plain;
1869
- }
1870
- static get identifiersFields() {
1871
- return ['id', 'userId'];
1872
- }
1873
- }
1874
-
1875
1907
  class User extends BaseModel {
1876
1908
  static toInstance(data) {
1877
1909
  const instance = super.toInstance(data);
@@ -1985,12 +2017,6 @@ class UserPaymentMethod extends BaseModel {
1985
2017
  }
1986
2018
  }
1987
2019
 
1988
- class Lead extends BaseModel {
1989
- static get identifiersFields() {
1990
- return ['id'];
1991
- }
1992
- }
1993
-
1994
2020
  class UnauthorizedError extends tsCustomError.CustomError {
1995
2021
  constructor(message) {
1996
2022
  super(message);
@@ -2163,6 +2189,12 @@ tslib.__decorate([
2163
2189
  tslib.__metadata("design:type", Payment)
2164
2190
  ], Order.prototype, "payment", void 0);
2165
2191
 
2192
+ class OrderBlocked extends BaseModel {
2193
+ static get identifiersFields() {
2194
+ return ['id'];
2195
+ }
2196
+ }
2197
+
2166
2198
  class CheckoutSubscription extends BaseModel {
2167
2199
  static get identifiersFields() {
2168
2200
  return ['id'];
@@ -2988,6 +3020,8 @@ const withUpdateFirestore = (MixinBase) => {
2988
3020
  try {
2989
3021
  const identifiers = getValueFromParams(data, keyField);
2990
3022
  const docRef = this.collection(collectionName).getDoc(identifiers.toString());
3023
+ if (!(await docRef.get()).data())
3024
+ throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
2991
3025
  const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2992
3026
  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 }));
2993
3027
  const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
@@ -3552,6 +3586,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3552
3586
  }
3553
3587
  }
3554
3588
 
3589
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3590
+ constructor({ firestore, interceptors, }) {
3591
+ super({
3592
+ firestore,
3593
+ collectionName: 'paymentBlockedAttempts',
3594
+ model: OrderBlocked,
3595
+ interceptors,
3596
+ });
3597
+ }
3598
+ async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
3599
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3600
+ return this.create(OrderBlocked.toInstance({
3601
+ customer: {
3602
+ name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
3603
+ cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
3604
+ id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
3605
+ email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
3606
+ phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
3607
+ isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
3608
+ subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
3609
+ shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
3610
+ },
3611
+ blockType,
3612
+ limiteRange,
3613
+ type,
3614
+ card,
3615
+ checkout: {
3616
+ id: checkout.id,
3617
+ shop: checkout.shop,
3618
+ total: checkout.totalPrice,
3619
+ },
3620
+ date: new Date(),
3621
+ }));
3622
+ }
3623
+ formatZip(zip) {
3624
+ if (zip.length === 8)
3625
+ return zip.substring(0, 5) + '-' + zip.substring(5, 8);
3626
+ return zip;
3627
+ }
3628
+ }
3629
+
3555
3630
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3556
3631
  constructor({ firestore, interceptors }) {
3557
3632
  super({
@@ -4207,7 +4282,7 @@ const withHasuraGraphQL = (MixinBase) => {
4207
4282
  const response = await axios__default["default"](request);
4208
4283
  if (!lodash.isNil(response.data.errors)) {
4209
4284
  this.logger.error({ req: request, res: response.data.errors });
4210
- throw new Error(response.data.errors);
4285
+ throw new Error(JSON.stringify(response.data.errors));
4211
4286
  }
4212
4287
  this.logger.log({ req: request, res: response.data });
4213
4288
  return response.data.data;
@@ -4685,6 +4760,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4685
4760
  'name',
4686
4761
  'description',
4687
4762
  'image',
4763
+ { images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
4688
4764
  'published',
4689
4765
  'shop',
4690
4766
  { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
@@ -4740,7 +4816,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4740
4816
  {
4741
4817
  metadata: {
4742
4818
  columnName: 'metadata',
4743
- fields: ['title', 'description'],
4819
+ fields: ['shop', 'title', 'description'],
4744
4820
  bindPersistData: (value) => ({
4745
4821
  metadata: { data: value },
4746
4822
  }),
@@ -4766,8 +4842,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4766
4842
  this.categoryFilterRepository = categoryFilterRepository;
4767
4843
  }
4768
4844
  async create(params) {
4769
- const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
4770
- return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
4845
+ const { mostRelevant, metadata } = params, data = tslib.__rest(params, ["mostRelevant", "metadata"]);
4846
+ return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }], mostRelevant: mostRelevant || {
4847
+ [exports.Shops.GLAMSHOP]: null,
4848
+ [exports.Shops.MENSMARKET]: null,
4849
+ } }));
4771
4850
  }
4772
4851
  async get(identifiers) {
4773
4852
  var _a;
@@ -4877,7 +4956,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4877
4956
  return products;
4878
4957
  }
4879
4958
  async getChildren(parentId) {
4880
- const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
4959
+ const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
4881
4960
  args: {
4882
4961
  type: 'category_tree_args',
4883
4962
  value: { parentid: parentId },
@@ -4958,22 +5037,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4958
5037
  return plainData.products;
4959
5038
  }
4960
5039
  async updateMetadata(categoryId, { metadata }) {
4961
- const plainData = this.paramsToPlain({ metadata });
4962
- if (!plainData.metadata)
4963
- return null;
4964
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
4965
- pk_columns: {
4966
- value: { category_id: categoryId },
4967
- type: 'category_metadata_pk_columns_input',
4968
- required: true,
4969
- },
4970
- _set: {
4971
- value: lodash.omit(metadata, ['category_id']),
4972
- type: 'category_metadata_set_input',
4973
- required: true,
4974
- },
4975
- });
4976
- return plainData.metadata;
5040
+ if (Array.isArray(metadata) && !metadata.length)
5041
+ return [];
5042
+ if (Array.isArray(metadata) && metadata.length) {
5043
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5044
+ where: {
5045
+ type: 'category_metadata_bool_exp',
5046
+ required: true,
5047
+ value: { category_id: { _eq: categoryId } },
5048
+ },
5049
+ });
5050
+ await this.mutation('insert_category_metadata', ['affected_rows'], {
5051
+ objects: {
5052
+ type: '[category_metadata_insert_input!]',
5053
+ required: true,
5054
+ value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
5055
+ },
5056
+ });
5057
+ return metadata;
5058
+ }
5059
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
5060
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5061
+ where: {
5062
+ type: 'category_metadata_bool_exp',
5063
+ required: true,
5064
+ value: { category_id: { _eq: categoryId } },
5065
+ },
5066
+ });
5067
+ return [];
5068
+ }
4977
5069
  }
4978
5070
  async updateFilters(categoryId, { filters }) {
4979
5071
  if ('action' in filters && filters.action === 'remove' && filters.value.length) {
@@ -5085,6 +5177,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
5085
5177
  ],
5086
5178
  },
5087
5179
  },
5180
+ {
5181
+ categories: {
5182
+ columnName: 'categories',
5183
+ foreignKeyColumn: { category_id: 'id' },
5184
+ fields: [{ category: ['id', 'name', 'slug'] }],
5185
+ bindPersistData: (value) => ({
5186
+ categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
5187
+ }),
5188
+ from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
5189
+ },
5190
+ },
5088
5191
  ],
5089
5192
  });
5090
5193
  this.filterOptionRepository = filterOptionRepository;
@@ -5796,6 +5899,32 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
5796
5899
  email,
5797
5900
  });
5798
5901
  }
5902
+ async getNotificationsReport(params, orderBy, pagination) {
5903
+ 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 } }));
5904
+ const orderByField = {
5905
+ [orderBy.field]: orderBy.direction,
5906
+ };
5907
+ const limit = Object.assign({}, ((pagination === null || pagination === void 0 ? void 0 : pagination.limit) && {
5908
+ limit: {
5909
+ value: pagination === null || pagination === void 0 ? void 0 : pagination.limit,
5910
+ },
5911
+ }));
5912
+ const offset = Object.assign({}, ((pagination === null || pagination === void 0 ? void 0 : pagination.offset) && {
5913
+ offset: {
5914
+ value: pagination === null || pagination === void 0 ? void 0 : pagination.offset,
5915
+ },
5916
+ }));
5917
+ 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: {
5918
+ type: 'report_stock_notification_bool_exp',
5919
+ value: query,
5920
+ required: true,
5921
+ }, order_by: {
5922
+ type: '[report_stock_notification_order_by]',
5923
+ value: orderByField,
5924
+ required: true,
5925
+ } }, limit), offset));
5926
+ return report_stock_notification;
5927
+ }
5799
5928
  }
5800
5929
 
5801
5930
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
@@ -5904,11 +6033,14 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5904
6033
  }
5905
6034
  }
5906
6035
 
6036
+ class WishlistHasuraGraphQL extends Wishlist {
6037
+ }
6038
+
5907
6039
  class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5908
6040
  constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
5909
6041
  super({
5910
6042
  tableName: 'category',
5911
- model: Wishlist,
6043
+ model: WishlistHasuraGraphQL,
5912
6044
  endpoint,
5913
6045
  authOptions,
5914
6046
  interceptors,
@@ -5969,7 +6101,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5969
6101
  {
5970
6102
  metadata: {
5971
6103
  columnName: 'metadata',
5972
- fields: ['title', 'description'],
6104
+ fields: ['shop', 'title', 'description'],
5973
6105
  bindPersistData: (value) => ({
5974
6106
  metadata: { data: value },
5975
6107
  }),
@@ -5989,15 +6121,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5989
6121
  { personId: { columnName: 'person_id' } },
5990
6122
  { personName: { columnName: 'person_name' } },
5991
6123
  { personPhoto: { columnName: 'person_photo' } },
6124
+ { personType: { columnName: 'person_type' } },
6125
+ { personIsSubscriber: { columnName: 'person_is_subscriber' } },
5992
6126
  'theme',
5993
6127
  { bannerUrl: { columnName: 'banner_url' } },
6128
+ { personHasPhoto: { columnName: 'person_has_photo' } },
5994
6129
  ],
5995
6130
  });
5996
6131
  this.categoryFilterRepository = categoryFilterRepository;
5997
6132
  }
5998
6133
  async create(params) {
6134
+ var _a;
5999
6135
  const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
6000
- return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
6136
+ 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 }] }));
6001
6137
  }
6002
6138
  async get(identifiers) {
6003
6139
  const data = await super.get(identifiers);
@@ -6052,7 +6188,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6052
6188
  throw new NotFoundError(`Wishlists from person ${personId} not found`);
6053
6189
  return data;
6054
6190
  }
6055
- getCategoryBySlug(slug, _shop) {
6191
+ async getCategoryBySlug(slug, _shop) {
6056
6192
  return this.getWishlistBySlug(slug);
6057
6193
  }
6058
6194
  async getCategoryByShop(shop) {
@@ -6070,6 +6206,13 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6070
6206
  });
6071
6207
  return data;
6072
6208
  }
6209
+ async findBfluOrGlamgirlWishlists(params, shops) {
6210
+ var _a, _b;
6211
+ 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 : {
6212
+ operator: exports.Where.IN,
6213
+ value: [exports.PersonTypes.BFLU, exports.PersonTypes.GLAMGIRL],
6214
+ } }), orderBy: Object.assign({ personHasPhoto: 'desc' }, lodash.omit(params.orderBy, ['personHasPhoto'])) }));
6215
+ }
6073
6216
  getCategoriesForHome(categoryIds, limit, gender) {
6074
6217
  return;
6075
6218
  }
@@ -6121,22 +6264,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6121
6264
  return plainData.products;
6122
6265
  }
6123
6266
  async updateMetadata(categoryId, { metadata }) {
6124
- const plainData = this.paramsToPlain({ metadata });
6125
- if (!plainData.metadata)
6126
- return;
6127
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
6128
- pk_columns: {
6129
- value: { category_id: categoryId },
6130
- type: 'category_metadata_pk_columns_input',
6131
- required: true,
6132
- },
6133
- _set: {
6134
- value: lodash.omit(metadata, ['category_id']),
6135
- type: 'category_metadata_set_input',
6136
- required: true,
6137
- },
6138
- });
6139
- return plainData.metadata;
6267
+ if (Array.isArray(metadata) && !metadata.length)
6268
+ return [];
6269
+ if (Array.isArray(metadata) && metadata.length) {
6270
+ const metadataUpdated = [];
6271
+ for (const data of metadata) {
6272
+ const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
6273
+ pk_columns: {
6274
+ value: { category_id: categoryId, shop: data.shop },
6275
+ type: 'category_metadata_pk_columns_input',
6276
+ required: true,
6277
+ },
6278
+ _set: {
6279
+ value: lodash.omit(data, ['category_id', 'shop']),
6280
+ type: 'category_metadata_set_input',
6281
+ required: true,
6282
+ },
6283
+ });
6284
+ metadataUpdated.push(update);
6285
+ }
6286
+ return metadataUpdated;
6287
+ }
6288
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
6289
+ for (let i = 0; i < metadata.value.length; i++) {
6290
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
6291
+ where: {
6292
+ type: 'category_metadata_bool_exp',
6293
+ required: true,
6294
+ value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
6295
+ },
6296
+ });
6297
+ }
6298
+ return [];
6299
+ }
6140
6300
  }
6141
6301
  }
6142
6302
  tslib.__decorate([
@@ -6157,6 +6317,12 @@ tslib.__decorate([
6157
6317
  tslib.__metadata("design:paramtypes", [String]),
6158
6318
  tslib.__metadata("design:returntype", Promise)
6159
6319
  ], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
6320
+ tslib.__decorate([
6321
+ Log(),
6322
+ tslib.__metadata("design:type", Function),
6323
+ tslib.__metadata("design:paramtypes", [Object, Array]),
6324
+ tslib.__metadata("design:returntype", Promise)
6325
+ ], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
6160
6326
 
6161
6327
  Object.defineProperty(exports, 'add', {
6162
6328
  enumerable: true,
@@ -6332,6 +6498,8 @@ exports.Log = Log;
6332
6498
  exports.Logger = Logger;
6333
6499
  exports.NotFoundError = NotFoundError;
6334
6500
  exports.Order = Order;
6501
+ exports.OrderBlocked = OrderBlocked;
6502
+ exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
6335
6503
  exports.OrderFirestoreRepository = OrderFirestoreRepository;
6336
6504
  exports.Payment = Payment;
6337
6505
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;