@infrab4a/connect 4.9.7-beta.1 → 4.9.7-beta.10

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 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[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'];
@@ -2163,6 +2182,12 @@ tslib.__decorate([
2163
2182
  tslib.__metadata("design:type", Payment)
2164
2183
  ], Order.prototype, "payment", void 0);
2165
2184
 
2185
+ class OrderBlocked extends BaseModel {
2186
+ static get identifiersFields() {
2187
+ return ['id'];
2188
+ }
2189
+ }
2190
+
2166
2191
  class CheckoutSubscription extends BaseModel {
2167
2192
  static get identifiersFields() {
2168
2193
  return ['id'];
@@ -2988,6 +3013,8 @@ const withUpdateFirestore = (MixinBase) => {
2988
3013
  try {
2989
3014
  const identifiers = getValueFromParams(data, keyField);
2990
3015
  const docRef = this.collection(collectionName).getDoc(identifiers.toString());
3016
+ if (!(await docRef.get()).data())
3017
+ throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
2991
3018
  const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2992
3019
  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
3020
  const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
@@ -3552,6 +3579,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3552
3579
  }
3553
3580
  }
3554
3581
 
3582
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3583
+ constructor({ firestore, interceptors, }) {
3584
+ super({
3585
+ firestore,
3586
+ collectionName: 'paymentBlockedAttempts',
3587
+ model: OrderBlocked,
3588
+ interceptors,
3589
+ });
3590
+ }
3591
+ async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
3592
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3593
+ return this.create(OrderBlocked.toInstance({
3594
+ customer: {
3595
+ name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
3596
+ cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
3597
+ id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
3598
+ email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
3599
+ phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
3600
+ isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
3601
+ subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
3602
+ shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
3603
+ },
3604
+ blockType,
3605
+ limiteRange,
3606
+ type,
3607
+ card,
3608
+ checkout: {
3609
+ id: checkout.id,
3610
+ shop: checkout.shop,
3611
+ total: checkout.totalPrice,
3612
+ },
3613
+ date: new Date(),
3614
+ }));
3615
+ }
3616
+ formatZip(zip) {
3617
+ if (zip.length === 8)
3618
+ return zip.substring(0, 5) + '-' + zip.substring(5, 8);
3619
+ return zip;
3620
+ }
3621
+ }
3622
+
3555
3623
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3556
3624
  constructor({ firestore, interceptors }) {
3557
3625
  super({
@@ -4685,6 +4753,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4685
4753
  'name',
4686
4754
  'description',
4687
4755
  'image',
4756
+ { images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
4688
4757
  'published',
4689
4758
  'shop',
4690
4759
  { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
@@ -4740,7 +4809,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4740
4809
  {
4741
4810
  metadata: {
4742
4811
  columnName: 'metadata',
4743
- fields: ['title', 'description'],
4812
+ fields: ['shop', 'title', 'description'],
4744
4813
  bindPersistData: (value) => ({
4745
4814
  metadata: { data: value },
4746
4815
  }),
@@ -4767,7 +4836,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4767
4836
  }
4768
4837
  async create(params) {
4769
4838
  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 } }));
4839
+ return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
4771
4840
  }
4772
4841
  async get(identifiers) {
4773
4842
  var _a;
@@ -4877,7 +4946,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4877
4946
  return products;
4878
4947
  }
4879
4948
  async getChildren(parentId) {
4880
- const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
4949
+ const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
4881
4950
  args: {
4882
4951
  type: 'category_tree_args',
4883
4952
  value: { parentid: parentId },
@@ -4958,22 +5027,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4958
5027
  return plainData.products;
4959
5028
  }
4960
5029
  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;
5030
+ if (Array.isArray(metadata) && !metadata.length)
5031
+ return [];
5032
+ if (Array.isArray(metadata) && metadata.length) {
5033
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5034
+ where: {
5035
+ type: 'category_metadata_bool_exp',
5036
+ required: true,
5037
+ value: { category_id: { _eq: categoryId } },
5038
+ },
5039
+ });
5040
+ await this.mutation('insert_category_metadata', ['affected_rows'], {
5041
+ objects: {
5042
+ type: '[category_metadata_insert_input!]',
5043
+ required: true,
5044
+ value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
5045
+ },
5046
+ });
5047
+ return metadata;
5048
+ }
5049
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
5050
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5051
+ where: {
5052
+ type: 'category_metadata_bool_exp',
5053
+ required: true,
5054
+ value: { category_id: { _eq: categoryId } },
5055
+ },
5056
+ });
5057
+ return [];
5058
+ }
4977
5059
  }
4978
5060
  async updateFilters(categoryId, { filters }) {
4979
5061
  if ('action' in filters && filters.action === 'remove' && filters.value.length) {
@@ -5085,6 +5167,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
5085
5167
  ],
5086
5168
  },
5087
5169
  },
5170
+ {
5171
+ categories: {
5172
+ columnName: 'categories',
5173
+ foreignKeyColumn: { category_id: 'id' },
5174
+ fields: [{ category: ['id', 'name', 'slug'] }],
5175
+ bindPersistData: (value) => ({
5176
+ categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
5177
+ }),
5178
+ from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
5179
+ },
5180
+ },
5088
5181
  ],
5089
5182
  });
5090
5183
  this.filterOptionRepository = filterOptionRepository;
@@ -5796,7 +5889,24 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
5796
5889
  email,
5797
5890
  });
5798
5891
  }
5892
+ async getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }) {
5893
+ const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (ean && { ean: { _eq: ean } })), (sku && { sku: { _eq: sku } })), (name && { name: { _iregex: name } })), (category && { category: { _iregex: category } })), (reference && { category_reference: { _eq: reference } })), (emailsCount && { emails_registered: { _eq: emailsCount } }));
5894
+ const { report_stock_notification } = await this.query('report_stock_notification', ['ean', 'sku', 'name', 'stock', 'category', 'category_reference', 'emails_registered'], {
5895
+ where: {
5896
+ type: 'report_stock_notification_bool_exp',
5897
+ value: query,
5898
+ required: true,
5899
+ },
5900
+ });
5901
+ return report_stock_notification;
5902
+ }
5799
5903
  }
5904
+ tslib.__decorate([
5905
+ Log(),
5906
+ tslib.__metadata("design:type", Function),
5907
+ tslib.__metadata("design:paramtypes", [Object]),
5908
+ tslib.__metadata("design:returntype", Promise)
5909
+ ], ProductStockNotificationHasuraGraphQLRepository.prototype, "getNotificationsReport", null);
5800
5910
 
5801
5911
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5802
5912
  constructor({ endpoint, authOptions, interceptors, }) {
@@ -5969,7 +6079,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5969
6079
  {
5970
6080
  metadata: {
5971
6081
  columnName: 'metadata',
5972
- fields: ['title', 'description'],
6082
+ fields: ['shop', 'title', 'description'],
5973
6083
  bindPersistData: (value) => ({
5974
6084
  metadata: { data: value },
5975
6085
  }),
@@ -5996,8 +6106,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5996
6106
  this.categoryFilterRepository = categoryFilterRepository;
5997
6107
  }
5998
6108
  async create(params) {
6109
+ var _a;
5999
6110
  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 } }));
6111
+ 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
6112
  }
6002
6113
  async get(identifiers) {
6003
6114
  const data = await super.get(identifiers);
@@ -6121,22 +6232,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6121
6232
  return plainData.products;
6122
6233
  }
6123
6234
  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;
6235
+ if (Array.isArray(metadata) && !metadata.length)
6236
+ return [];
6237
+ if (Array.isArray(metadata) && metadata.length) {
6238
+ const metadataUpdated = [];
6239
+ for (const data of metadata) {
6240
+ const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
6241
+ pk_columns: {
6242
+ value: { category_id: categoryId, shop: data.shop },
6243
+ type: 'category_metadata_pk_columns_input',
6244
+ required: true,
6245
+ },
6246
+ _set: {
6247
+ value: lodash.omit(data, ['category_id', 'shop']),
6248
+ type: 'category_metadata_set_input',
6249
+ required: true,
6250
+ },
6251
+ });
6252
+ metadataUpdated.push(update);
6253
+ }
6254
+ return metadataUpdated;
6255
+ }
6256
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
6257
+ for (let i = 0; i < metadata.value.length; i++) {
6258
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
6259
+ where: {
6260
+ type: 'category_metadata_bool_exp',
6261
+ required: true,
6262
+ value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
6263
+ },
6264
+ });
6265
+ }
6266
+ return [];
6267
+ }
6140
6268
  }
6141
6269
  }
6142
6270
  tslib.__decorate([
@@ -6332,6 +6460,8 @@ exports.Log = Log;
6332
6460
  exports.Logger = Logger;
6333
6461
  exports.NotFoundError = NotFoundError;
6334
6462
  exports.Order = Order;
6463
+ exports.OrderBlocked = OrderBlocked;
6464
+ exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
6335
6465
  exports.OrderFirestoreRepository = OrderFirestoreRepository;
6336
6466
  exports.Payment = Payment;
6337
6467
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
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[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'];
@@ -2157,6 +2176,12 @@ __decorate([
2157
2176
  __metadata("design:type", Payment)
2158
2177
  ], Order.prototype, "payment", void 0);
2159
2178
 
2179
+ class OrderBlocked extends BaseModel {
2180
+ static get identifiersFields() {
2181
+ return ['id'];
2182
+ }
2183
+ }
2184
+
2160
2185
  class CheckoutSubscription extends BaseModel {
2161
2186
  static get identifiersFields() {
2162
2187
  return ['id'];
@@ -2982,6 +3007,8 @@ const withUpdateFirestore = (MixinBase) => {
2982
3007
  try {
2983
3008
  const identifiers = getValueFromParams(data, keyField);
2984
3009
  const docRef = this.collection(collectionName).getDoc(identifiers.toString());
3010
+ if (!(await docRef.get()).data())
3011
+ throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
2985
3012
  const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2986
3013
  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
3014
  const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
@@ -3546,6 +3573,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3546
3573
  }
3547
3574
  }
3548
3575
 
3576
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3577
+ constructor({ firestore, interceptors, }) {
3578
+ super({
3579
+ firestore,
3580
+ collectionName: 'paymentBlockedAttempts',
3581
+ model: OrderBlocked,
3582
+ interceptors,
3583
+ });
3584
+ }
3585
+ async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
3586
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3587
+ return this.create(OrderBlocked.toInstance({
3588
+ customer: {
3589
+ name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
3590
+ cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
3591
+ id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
3592
+ email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
3593
+ phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
3594
+ isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
3595
+ subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
3596
+ shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
3597
+ },
3598
+ blockType,
3599
+ limiteRange,
3600
+ type,
3601
+ card,
3602
+ checkout: {
3603
+ id: checkout.id,
3604
+ shop: checkout.shop,
3605
+ total: checkout.totalPrice,
3606
+ },
3607
+ date: new Date(),
3608
+ }));
3609
+ }
3610
+ formatZip(zip) {
3611
+ if (zip.length === 8)
3612
+ return zip.substring(0, 5) + '-' + zip.substring(5, 8);
3613
+ return zip;
3614
+ }
3615
+ }
3616
+
3549
3617
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3550
3618
  constructor({ firestore, interceptors }) {
3551
3619
  super({
@@ -4679,6 +4747,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4679
4747
  'name',
4680
4748
  'description',
4681
4749
  'image',
4750
+ { images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
4682
4751
  'published',
4683
4752
  'shop',
4684
4753
  { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
@@ -4734,7 +4803,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4734
4803
  {
4735
4804
  metadata: {
4736
4805
  columnName: 'metadata',
4737
- fields: ['title', 'description'],
4806
+ fields: ['shop', 'title', 'description'],
4738
4807
  bindPersistData: (value) => ({
4739
4808
  metadata: { data: value },
4740
4809
  }),
@@ -4761,7 +4830,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4761
4830
  }
4762
4831
  async create(params) {
4763
4832
  const { metadata } = params, data = __rest(params, ["metadata"]);
4764
- return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
4833
+ return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
4765
4834
  }
4766
4835
  async get(identifiers) {
4767
4836
  var _a;
@@ -4871,7 +4940,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4871
4940
  return products;
4872
4941
  }
4873
4942
  async getChildren(parentId) {
4874
- const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
4943
+ const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
4875
4944
  args: {
4876
4945
  type: 'category_tree_args',
4877
4946
  value: { parentid: parentId },
@@ -4952,22 +5021,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4952
5021
  return plainData.products;
4953
5022
  }
4954
5023
  async updateMetadata(categoryId, { metadata }) {
4955
- const plainData = this.paramsToPlain({ metadata });
4956
- if (!plainData.metadata)
4957
- return null;
4958
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
4959
- pk_columns: {
4960
- value: { category_id: categoryId },
4961
- type: 'category_metadata_pk_columns_input',
4962
- required: true,
4963
- },
4964
- _set: {
4965
- value: omit(metadata, ['category_id']),
4966
- type: 'category_metadata_set_input',
4967
- required: true,
4968
- },
4969
- });
4970
- return plainData.metadata;
5024
+ if (Array.isArray(metadata) && !metadata.length)
5025
+ return [];
5026
+ if (Array.isArray(metadata) && metadata.length) {
5027
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5028
+ where: {
5029
+ type: 'category_metadata_bool_exp',
5030
+ required: true,
5031
+ value: { category_id: { _eq: categoryId } },
5032
+ },
5033
+ });
5034
+ await this.mutation('insert_category_metadata', ['affected_rows'], {
5035
+ objects: {
5036
+ type: '[category_metadata_insert_input!]',
5037
+ required: true,
5038
+ value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
5039
+ },
5040
+ });
5041
+ return metadata;
5042
+ }
5043
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
5044
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
5045
+ where: {
5046
+ type: 'category_metadata_bool_exp',
5047
+ required: true,
5048
+ value: { category_id: { _eq: categoryId } },
5049
+ },
5050
+ });
5051
+ return [];
5052
+ }
4971
5053
  }
4972
5054
  async updateFilters(categoryId, { filters }) {
4973
5055
  if ('action' in filters && filters.action === 'remove' && filters.value.length) {
@@ -5079,6 +5161,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
5079
5161
  ],
5080
5162
  },
5081
5163
  },
5164
+ {
5165
+ categories: {
5166
+ columnName: 'categories',
5167
+ foreignKeyColumn: { category_id: 'id' },
5168
+ fields: [{ category: ['id', 'name', 'slug'] }],
5169
+ bindPersistData: (value) => ({
5170
+ categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
5171
+ }),
5172
+ from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
5173
+ },
5174
+ },
5082
5175
  ],
5083
5176
  });
5084
5177
  this.filterOptionRepository = filterOptionRepository;
@@ -5790,7 +5883,24 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
5790
5883
  email,
5791
5884
  });
5792
5885
  }
5886
+ async getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }) {
5887
+ const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (ean && { ean: { _eq: ean } })), (sku && { sku: { _eq: sku } })), (name && { name: { _iregex: name } })), (category && { category: { _iregex: category } })), (reference && { category_reference: { _eq: reference } })), (emailsCount && { emails_registered: { _eq: emailsCount } }));
5888
+ const { report_stock_notification } = await this.query('report_stock_notification', ['ean', 'sku', 'name', 'stock', 'category', 'category_reference', 'emails_registered'], {
5889
+ where: {
5890
+ type: 'report_stock_notification_bool_exp',
5891
+ value: query,
5892
+ required: true,
5893
+ },
5894
+ });
5895
+ return report_stock_notification;
5896
+ }
5793
5897
  }
5898
+ __decorate([
5899
+ Log(),
5900
+ __metadata("design:type", Function),
5901
+ __metadata("design:paramtypes", [Object]),
5902
+ __metadata("design:returntype", Promise)
5903
+ ], ProductStockNotificationHasuraGraphQLRepository.prototype, "getNotificationsReport", null);
5794
5904
 
5795
5905
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5796
5906
  constructor({ endpoint, authOptions, interceptors, }) {
@@ -5963,7 +6073,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5963
6073
  {
5964
6074
  metadata: {
5965
6075
  columnName: 'metadata',
5966
- fields: ['title', 'description'],
6076
+ fields: ['shop', 'title', 'description'],
5967
6077
  bindPersistData: (value) => ({
5968
6078
  metadata: { data: value },
5969
6079
  }),
@@ -5990,8 +6100,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5990
6100
  this.categoryFilterRepository = categoryFilterRepository;
5991
6101
  }
5992
6102
  async create(params) {
6103
+ var _a;
5993
6104
  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 } }));
6105
+ 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
6106
  }
5996
6107
  async get(identifiers) {
5997
6108
  const data = await super.get(identifiers);
@@ -6115,22 +6226,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6115
6226
  return plainData.products;
6116
6227
  }
6117
6228
  async updateMetadata(categoryId, { metadata }) {
6118
- const plainData = this.paramsToPlain({ metadata });
6119
- if (!plainData.metadata)
6120
- return;
6121
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
6122
- pk_columns: {
6123
- value: { category_id: categoryId },
6124
- type: 'category_metadata_pk_columns_input',
6125
- required: true,
6126
- },
6127
- _set: {
6128
- value: omit(metadata, ['category_id']),
6129
- type: 'category_metadata_set_input',
6130
- required: true,
6131
- },
6132
- });
6133
- return plainData.metadata;
6229
+ if (Array.isArray(metadata) && !metadata.length)
6230
+ return [];
6231
+ if (Array.isArray(metadata) && metadata.length) {
6232
+ const metadataUpdated = [];
6233
+ for (const data of metadata) {
6234
+ const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
6235
+ pk_columns: {
6236
+ value: { category_id: categoryId, shop: data.shop },
6237
+ type: 'category_metadata_pk_columns_input',
6238
+ required: true,
6239
+ },
6240
+ _set: {
6241
+ value: omit(data, ['category_id', 'shop']),
6242
+ type: 'category_metadata_set_input',
6243
+ required: true,
6244
+ },
6245
+ });
6246
+ metadataUpdated.push(update);
6247
+ }
6248
+ return metadataUpdated;
6249
+ }
6250
+ if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
6251
+ for (let i = 0; i < metadata.value.length; i++) {
6252
+ await this.mutation('delete_category_metadata', ['affected_rows'], {
6253
+ where: {
6254
+ type: 'category_metadata_bool_exp',
6255
+ required: true,
6256
+ value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
6257
+ },
6258
+ });
6259
+ }
6260
+ return [];
6261
+ }
6134
6262
  }
6135
6263
  }
6136
6264
  __decorate([
@@ -6152,4 +6280,4 @@ __decorate([
6152
6280
  __metadata("design:returntype", Promise)
6153
6281
  ], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
6154
6282
 
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 };
6283
+ 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, 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.9.7-beta.1",
3
+ "version": "4.9.7-beta.10",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -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?: string[];
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
  }
@@ -0,0 +1,8 @@
1
+ import { Shops } from '../enums';
2
+ export type CategoryImages = {
3
+ [shop in Shops]?: {
4
+ image: string;
5
+ brandBanner: string;
6
+ brandBannerMobile: string;
7
+ };
8
+ };
@@ -1,4 +1,6 @@
1
+ import { Shops } from '../enums';
1
2
  export type CategoryMetadata = {
3
+ shop: Shops;
2
4
  title?: string;
3
5
  description?: string;
4
6
  };
@@ -0,0 +1,4 @@
1
+ import { Shops } from '../enums';
2
+ export type CategoryMostRelevant = {
3
+ [shop in Shops]?: string[];
4
+ };
@@ -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,9 @@
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
+ };
@@ -1,5 +1,13 @@
1
1
  import { CrudRepository } from '../../generic/repository/crud.repository';
2
- import { ProductStockNotification, Shops } from '../models';
2
+ import { ProductStockNotification, ReportStockNotification, 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({ ean, sku, name, category, reference, emailsCount, }: {
6
+ ean?: string;
7
+ sku?: string;
8
+ name?: string;
9
+ category?: string;
10
+ reference?: string;
11
+ emailsCount?: number;
12
+ }): Promise<ReportStockNotification[]>;
5
13
  }
@@ -1,2 +1,3 @@
1
1
  export * from './models';
2
2
  export * from './repositories';
3
+ export * from './types';
@@ -56,7 +56,7 @@ export declare class Coupon extends BaseModel<Coupon> {
56
56
  createdAt: Date;
57
57
  updatedAt?: Date;
58
58
  checkoutType: CheckoutTypes;
59
- exclusivityType?: [Exclusivities];
59
+ exclusivityType?: Exclusivities[];
60
60
  get isInfluencer(): boolean;
61
61
  static get identifiersFields(): GenericIdentifier[];
62
62
  static createCoupon(userId: string): Coupon;
@@ -6,6 +6,7 @@ export * from './coupons';
6
6
  export * from './enums';
7
7
  export * from './line-item';
8
8
  export * from './order';
9
+ export * from './order-blocked';
9
10
  export * from './payment';
10
11
  export * from './shipping-method';
11
12
  export * from './subscription';
@@ -0,0 +1,26 @@
1
+ import { BaseModel, GenericIdentifier } from '../../generic';
2
+ import { UserAddress } from '../../users';
3
+ export declare class OrderBlocked extends BaseModel<OrderBlocked> {
4
+ id?: string;
5
+ customer: {
6
+ name: string;
7
+ cpf: string;
8
+ id: string;
9
+ email: string;
10
+ phoneNumber: string;
11
+ isSubscriber: boolean;
12
+ subscriptionPlan: string;
13
+ shippingAddress: UserAddress;
14
+ };
15
+ blockType: string;
16
+ limiteRange: string;
17
+ type: string;
18
+ card?: any;
19
+ checkout: {
20
+ id: string;
21
+ shop: string;
22
+ total: number;
23
+ };
24
+ date: Date;
25
+ static get identifiersFields(): GenericIdentifier[];
26
+ }
@@ -4,6 +4,7 @@ export * from './campaign-hashtag.repository';
4
4
  export * from './checkout.repository';
5
5
  export * from './coupon.repository';
6
6
  export * from './legacy-order.repository';
7
+ export * from './order-blocked.repository';
7
8
  export * from './order.repository';
8
9
  export * from './payment.repository';
9
10
  export * from './subscription';
@@ -0,0 +1,6 @@
1
+ import { CrudRepository } from '../../generic/repository/crud.repository';
2
+ import { Checkout, OrderBlocked } from '../models';
3
+ import { PaymentCardInfo } from '../types';
4
+ export interface OrderBlockedRepository extends CrudRepository<OrderBlocked> {
5
+ createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
6
+ }
@@ -0,0 +1 @@
1
+ export * from './payment-card-info.type';
@@ -0,0 +1,4 @@
1
+ export type PaymentCardInfo = {
2
+ cardId: string;
3
+ installments: number;
4
+ };
@@ -5,6 +5,7 @@ export * from './checkout-firestore.repository';
5
5
  export * from './checkout-subscription-firestore.repository';
6
6
  export * from './coupon-firestore.repository';
7
7
  export * from './legacy-order-firestore.repository';
8
+ export * from './order-blocked-firestore.repository.ts';
8
9
  export * from './order-firestore.repository';
9
10
  export * from './payment-firestore.repository';
10
11
  export * from './subscription-plan-firestore.repository';
@@ -0,0 +1,9 @@
1
+ import { Checkout, OrderBlocked, OrderBlockedRepository, PaymentCardInfo } from '../../../../../domain';
2
+ import { FirestoreConstructorParams } from '../../mixins';
3
+ declare const OrderBlockedFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<OrderBlocked> & import("../../../../../domain").CrudRepository<OrderBlocked, import("../../../../../domain").CrudParams<OrderBlocked>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<OrderBlocked>, ...any[]]>;
4
+ export declare class OrderBlockedFirestoreRepository extends OrderBlockedFirestoreRepository_base implements OrderBlockedRepository {
5
+ constructor({ firestore, interceptors, }: Pick<FirestoreConstructorParams<OrderBlocked>, 'firestore' | 'interceptors'>);
6
+ createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
7
+ private formatZip;
8
+ }
9
+ export {};
@@ -1,4 +1,4 @@
1
- import { Filter, ProductStockNotification, Shops } from '../../../../domain';
1
+ import { Filter, ProductStockNotification, ReportStockNotification, Shops } from '../../../../domain';
2
2
  import { ProductStockNotificationRepository } from '../../../../domain/catalog/repositories';
3
3
  import { HasuraConstructorParams } from '../../mixins';
4
4
  declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<ProductStockNotification> & import("../../../../domain").CrudRepository<ProductStockNotification, import("../../../../domain").CrudParams<ProductStockNotification>> & import("../../../../domain").UpdateRepository<ProductStockNotification, import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>> & {
@@ -7,5 +7,13 @@ declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../.
7
7
  export declare class ProductStockNotificationHasuraGraphQLRepository extends ProductStockNotificationHasuraGraphQLRepository_base implements ProductStockNotificationRepository {
8
8
  constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors'>);
9
9
  addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
10
+ getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }: {
11
+ ean?: string;
12
+ sku?: string;
13
+ name?: string;
14
+ category?: string;
15
+ reference?: string;
16
+ emailsCount?: number;
17
+ }): Promise<ReportStockNotification[]>;
10
18
  }
11
19
  export {};