@infrab4a/connect 4.22.0-beta.0 → 4.22.0

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
@@ -2537,12 +2537,14 @@ class GlampointsPaymentService {
2537
2537
  glambeauty: hasGlambeauty,
2538
2538
  }),
2539
2539
  });
2540
- console.info('[rewards - rewardByOrder] reward success:', JSON.stringify(result));
2540
+ console.log('[rewards - rewardByOrder] reward success:', order.orderNumber, JSON.stringify(result.data));
2541
2541
  return result.data;
2542
2542
  }
2543
- catch (err) {
2544
- console.log(err);
2545
- console.error('[rewards - rewardByOrder] reward request error', JSON.stringify(err));
2543
+ catch (error) {
2544
+ if (error instanceof axios.AxiosError)
2545
+ console.error('[rewards - rewardByOrder] reward request error', error.response.status, JSON.stringify(error.response.data.message), order.orderNumber);
2546
+ else
2547
+ console.log(JSON.stringify(error));
2546
2548
  }
2547
2549
  }
2548
2550
  async negativateRewardByOrderId(order) {
@@ -2567,7 +2569,10 @@ class GlampointsPaymentService {
2567
2569
  return result;
2568
2570
  }
2569
2571
  catch (error) {
2570
- return error;
2572
+ if (error instanceof axios.AxiosError)
2573
+ console.error('[negativateRewardByOrderId] request error', error.response.status, JSON.stringify(error.response.data.message), order.orderNumber);
2574
+ else
2575
+ console.log(JSON.stringify(error));
2571
2576
  }
2572
2577
  }
2573
2578
  }
@@ -3664,6 +3669,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3664
3669
  async fetchPaginatedReviews() {
3665
3670
  return Promise.resolve([]);
3666
3671
  }
3672
+ productVariantFullReport() {
3673
+ return;
3674
+ }
3667
3675
  }
3668
3676
  tslib.__decorate([
3669
3677
  Log(),
@@ -6255,6 +6263,56 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
6255
6263
  });
6256
6264
  return data && data[0] && this.bindReviewToModel(data[0]);
6257
6265
  }
6266
+ async productVariantFullReport() {
6267
+ const fields = [
6268
+ 'id',
6269
+ 'name',
6270
+ 'description',
6271
+ 'slug',
6272
+ 'sku',
6273
+ 'ean',
6274
+ 'cest',
6275
+ 'ncm',
6276
+ 'has_variants',
6277
+ 'is_variant',
6278
+ 'grade',
6279
+ 'type',
6280
+ 'is_kit',
6281
+ 'tags',
6282
+ 'published',
6283
+ 'stock',
6284
+ 'brand',
6285
+ 'brand_description',
6286
+ 'images',
6287
+ 'miniatures',
6288
+ 'video',
6289
+ 'weight',
6290
+ 'cost_price',
6291
+ 'full_price',
6292
+ 'price',
6293
+ 'subscriber_discount_percentage',
6294
+ 'subscriber_price',
6295
+ 'how_to_use',
6296
+ 'who_must_use',
6297
+ 'differentials',
6298
+ 'ingredients',
6299
+ 'purpose',
6300
+ 'filters',
6301
+ 'category_id',
6302
+ 'outlet',
6303
+ 'label',
6304
+ 'group',
6305
+ 'validity',
6306
+ 'gender',
6307
+ 'shopping_count',
6308
+ 'rating',
6309
+ 'reviews_total',
6310
+ 'created_at',
6311
+ 'updated_at',
6312
+ ];
6313
+ const { product_variant_report_query: data } = await this.query('product_variant_report_query', fields);
6314
+ return data;
6315
+ }
6258
6316
  }
6259
6317
  tslib.__decorate([
6260
6318
  Log(),
package/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import { isNil, isArray, first, last, flatten, compact, get, isString, each, uns
7
7
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
8
8
  import { debug } from 'debug';
9
9
  import { CustomError } from 'ts-custom-error';
10
- import axios from 'axios';
10
+ import axios, { AxiosError } from 'axios';
11
11
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
12
12
  import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc, setDoc, deleteDoc, collection, limit, getDocs, query, where, orderBy, startAfter, addDoc } from 'firebase/firestore';
13
13
  import { ref, uploadBytes } from 'firebase/storage';
@@ -2531,12 +2531,14 @@ class GlampointsPaymentService {
2531
2531
  glambeauty: hasGlambeauty,
2532
2532
  }),
2533
2533
  });
2534
- console.info('[rewards - rewardByOrder] reward success:', JSON.stringify(result));
2534
+ console.log('[rewards - rewardByOrder] reward success:', order.orderNumber, JSON.stringify(result.data));
2535
2535
  return result.data;
2536
2536
  }
2537
- catch (err) {
2538
- console.log(err);
2539
- console.error('[rewards - rewardByOrder] reward request error', JSON.stringify(err));
2537
+ catch (error) {
2538
+ if (error instanceof AxiosError)
2539
+ console.error('[rewards - rewardByOrder] reward request error', error.response.status, JSON.stringify(error.response.data.message), order.orderNumber);
2540
+ else
2541
+ console.log(JSON.stringify(error));
2540
2542
  }
2541
2543
  }
2542
2544
  async negativateRewardByOrderId(order) {
@@ -2561,7 +2563,10 @@ class GlampointsPaymentService {
2561
2563
  return result;
2562
2564
  }
2563
2565
  catch (error) {
2564
- return error;
2566
+ if (error instanceof AxiosError)
2567
+ console.error('[negativateRewardByOrderId] request error', error.response.status, JSON.stringify(error.response.data.message), order.orderNumber);
2568
+ else
2569
+ console.log(JSON.stringify(error));
2565
2570
  }
2566
2571
  }
2567
2572
  }
@@ -3658,6 +3663,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3658
3663
  async fetchPaginatedReviews() {
3659
3664
  return Promise.resolve([]);
3660
3665
  }
3666
+ productVariantFullReport() {
3667
+ return;
3668
+ }
3661
3669
  }
3662
3670
  __decorate([
3663
3671
  Log(),
@@ -6249,6 +6257,56 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
6249
6257
  });
6250
6258
  return data && data[0] && this.bindReviewToModel(data[0]);
6251
6259
  }
6260
+ async productVariantFullReport() {
6261
+ const fields = [
6262
+ 'id',
6263
+ 'name',
6264
+ 'description',
6265
+ 'slug',
6266
+ 'sku',
6267
+ 'ean',
6268
+ 'cest',
6269
+ 'ncm',
6270
+ 'has_variants',
6271
+ 'is_variant',
6272
+ 'grade',
6273
+ 'type',
6274
+ 'is_kit',
6275
+ 'tags',
6276
+ 'published',
6277
+ 'stock',
6278
+ 'brand',
6279
+ 'brand_description',
6280
+ 'images',
6281
+ 'miniatures',
6282
+ 'video',
6283
+ 'weight',
6284
+ 'cost_price',
6285
+ 'full_price',
6286
+ 'price',
6287
+ 'subscriber_discount_percentage',
6288
+ 'subscriber_price',
6289
+ 'how_to_use',
6290
+ 'who_must_use',
6291
+ 'differentials',
6292
+ 'ingredients',
6293
+ 'purpose',
6294
+ 'filters',
6295
+ 'category_id',
6296
+ 'outlet',
6297
+ 'label',
6298
+ 'group',
6299
+ 'validity',
6300
+ 'gender',
6301
+ 'shopping_count',
6302
+ 'rating',
6303
+ 'reviews_total',
6304
+ 'created_at',
6305
+ 'updated_at',
6306
+ ];
6307
+ const { product_variant_report_query: data } = await this.query('product_variant_report_query', fields);
6308
+ return data;
6309
+ }
6252
6310
  }
6253
6311
  __decorate([
6254
6312
  Log(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.22.0-beta.0",
3
+ "version": "4.22.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -7,6 +7,7 @@ export * from './product-gender.type';
7
7
  export * from './product-label.type';
8
8
  export * from './product-metadata.type';
9
9
  export * from './product-review.type';
10
+ export * from './product-variant-report.type';
10
11
  export * from './report-stock-notification.type';
11
12
  export * from './shop-description.type';
12
13
  export * from './shop-price.type';
@@ -0,0 +1,46 @@
1
+ export type ProductVariantReport = {
2
+ id: number;
3
+ name?: string;
4
+ description?: string;
5
+ slug?: string;
6
+ sku?: string;
7
+ ean?: string;
8
+ cest?: string;
9
+ ncm?: string;
10
+ has_variants?: boolean;
11
+ is_variant?: boolean;
12
+ grade: any;
13
+ type?: string;
14
+ is_kit?: boolean;
15
+ tags?: string[];
16
+ published?: boolean;
17
+ stock?: number;
18
+ brand?: string;
19
+ brand_description?: string;
20
+ images?: string[];
21
+ miniatures?: string[];
22
+ video?: string;
23
+ weight?: number;
24
+ cost_price?: number;
25
+ full_price?: number;
26
+ price?: number;
27
+ subscriber_discount_percentage?: number;
28
+ subscriber_price?: number;
29
+ how_to_use?: string;
30
+ who_must_use?: string;
31
+ differentials?: string;
32
+ ingredients?: string;
33
+ purpose?: string;
34
+ filters: string[];
35
+ category_id?: number;
36
+ outlet?: boolean;
37
+ label?: string;
38
+ group?: number;
39
+ validity?: boolean;
40
+ gender?: string;
41
+ shopping_count?: number;
42
+ rating?: number;
43
+ reviews_total?: number;
44
+ created_at?: Date;
45
+ updated_at?: Date;
46
+ };
@@ -1,6 +1,6 @@
1
1
  import { FindRepositoryParams, RepositoryFindResult } from '../../generic';
2
2
  import { CrudRepository } from '../../generic/repository/crud.repository';
3
- import { Product, ProductGender, ProductReview } from '../models';
3
+ import { Product, ProductGender, ProductReview, ProductVariantReport } from '../models';
4
4
  export type ReviewStatusParams = 'pending' | 'approved' | 'rejected';
5
5
  export type ReviewWithProductData = ProductReview & {
6
6
  productId: string;
@@ -25,4 +25,5 @@ export interface ProductRepository extends CrudRepository<Product> {
25
25
  fetchProductReviews(filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
26
26
  cleanShoppingCountFromIds(ids: string[]): Promise<any>;
27
27
  findCatalog(params: FindRepositoryParams<Product>, mainGender?: Extract<ProductGender, 'female' | 'male' | 'unisex'>): Promise<RepositoryFindResult<Product>>;
28
+ productVariantFullReport(): Promise<ProductVariantReport[]>;
28
29
  }
@@ -1,4 +1,4 @@
1
- import { FindRepositoryParams, PaginatedReviewFilters, Product, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
1
+ import { FindRepositoryParams, PaginatedReviewFilters, Product, ProductRepository, ProductVariantReport, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
2
2
  import { FirestoreConstructorParams } from '../../mixins';
3
3
  declare const ProductFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<Product> & import("../../../../../domain").CrudRepository<Product, import("../../../../../domain").CrudParams<Product>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<Product>, ...any[]]>;
4
4
  export declare class ProductFirestoreRepository extends ProductFirestoreRepository_base implements ProductRepository {
@@ -10,5 +10,6 @@ export declare class ProductFirestoreRepository extends ProductFirestoreReposito
10
10
  cleanShoppingCountFromIds(): Promise<void>;
11
11
  findCatalog(params: FindRepositoryParams<Product>): Promise<RepositoryFindResult<Product>>;
12
12
  fetchPaginatedReviews(): Promise<ReviewWithProductData[]>;
13
+ productVariantFullReport(): Promise<ProductVariantReport[]>;
13
14
  }
14
15
  export {};
@@ -1,4 +1,4 @@
1
- import { CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, ProductGender, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData, UpdateRepositoryParams } from '../../../../domain';
1
+ import { CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, ProductGender, ProductRepository, ProductVariantReport, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData, UpdateRepositoryParams } from '../../../../domain';
2
2
  import { HasuraConstructorParams } from '../../mixins';
3
3
  import { ProductHasuraGraphQL } from '../../models';
4
4
  declare const ProductHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<ProductHasuraGraphQL> & import("../../../../domain").CrudRepository<ProductHasuraGraphQL, import("../../../../domain").CrudParams<ProductHasuraGraphQL>> & import("../../../../domain").UpdateRepository<ProductHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<ProductHasuraGraphQL>> & {
@@ -27,5 +27,6 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
27
27
  private getReviewByAuthorAndEmail;
28
28
  private bindReviewToModel;
29
29
  private bindReviewToHasura;
30
+ productVariantFullReport(): Promise<ProductVariantReport[]>;
30
31
  }
31
32
  export {};