@infrab4a/connect 5.3.4-beta.9 → 5.3.5-beta.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
@@ -6,11 +6,11 @@ require('reflect-metadata');
6
6
  var tslib = require('tslib');
7
7
  var classTransformer = require('class-transformer');
8
8
  var dateFns = require('date-fns');
9
+ var dateFnsTz = require('date-fns-tz');
9
10
  var lodash = require('lodash');
10
11
  var debug = require('debug');
11
12
  var serializeJavascript = require('serialize-javascript');
12
13
  var tsCustomError = require('ts-custom-error');
13
- var dateFnsTz = require('date-fns-tz');
14
14
  var axios = require('axios');
15
15
  var auth = require('firebase/auth');
16
16
  var tsMd5 = require('ts-md5');
@@ -1801,8 +1801,6 @@ class AntifraudCardService {
1801
1801
  const dateRange = this.getTodayDateRange();
1802
1802
  const blockedOrders = await this.getBlockedOrdersByMultipleCriteria(checkout, dateRange);
1803
1803
  const totalBlockedAttempts = this.calculateUniqueBlockedAttempts(blockedOrders, checkout);
1804
- // eslint-disable-next-line no-console
1805
- console.log('totalBlockedAttempts', totalBlockedAttempts);
1806
1804
  if (totalBlockedAttempts >= this.LIMIT_BLOCKED_ORDERS_DAY) {
1807
1805
  await this.createBlockedOrderRecord({
1808
1806
  checkout,
@@ -1820,11 +1818,7 @@ class AntifraudCardService {
1820
1818
  const today = dateFnsTz.toZonedTime(new Date(), timeZone);
1821
1819
  const day = dateFns.startOfDay(today);
1822
1820
  const endOfDay = dateFns.endOfDay(today);
1823
- // eslint-disable-next-line no-console
1824
- console.log('day not zoned', dateFns.startOfDay(new Date()), 'endOfDay not zoned', dateFns.endOfDay(new Date()));
1825
- // eslint-disable-next-line no-console
1826
- console.log('day zoned', day, 'endOfDay zoned', endOfDay);
1827
- return { day, endOfDay };
1821
+ return { day: dateFns.addHours(day, 3), endOfDay: dateFns.addHours(endOfDay, 3) };
1828
1822
  }
1829
1823
  async getBlockedOrdersByMultipleCriteria(checkout, dateRange) {
1830
1824
  const { day, endOfDay } = dateRange;
@@ -1832,8 +1826,6 @@ class AntifraudCardService {
1832
1826
  { operator: exports.Where.GTE, value: day },
1833
1827
  { operator: exports.Where.LTE, value: endOfDay },
1834
1828
  ];
1835
- // eslint-disable-next-line no-console
1836
- console.log('dateFilter', dateFilter);
1837
1829
  const [ordersBlockedWithCpf, ordersBlockedWithEmail, ordersBlockedWithCep, ordersBlockedWithPhone] = await Promise.all([
1838
1830
  this.getBlockedOrdersByCpf(checkout.user?.cpf, dateFilter),
1839
1831
  this.getBlockedOrdersByEmail(checkout.user?.email, dateFilter),
@@ -7380,6 +7372,12 @@ const commonFields = [
7380
7372
  to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7381
7373
  },
7382
7374
  },
7375
+ {
7376
+ imagesCard: {
7377
+ columnName: 'images_card',
7378
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7379
+ },
7380
+ },
7383
7381
  'name',
7384
7382
  {
7385
7383
  price: {
@@ -7525,6 +7523,8 @@ const fieldsConfiguration$2 = [
7525
7523
  fields: [
7526
7524
  'id',
7527
7525
  'ean',
7526
+ 'sku',
7527
+ 'description',
7528
7528
  {
7529
7529
  grade: {
7530
7530
  columnName: 'grade',
@@ -7578,9 +7578,24 @@ const fieldsConfiguration$2 = [
7578
7578
  to: (value) => (lodash.isNil(value?.quantity) ? value : value?.quantity),
7579
7579
  },
7580
7580
  },
7581
- 'description',
7582
- 'images',
7583
- 'miniatures',
7581
+ {
7582
+ images: {
7583
+ columnName: 'images',
7584
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7585
+ },
7586
+ },
7587
+ {
7588
+ miniatures: {
7589
+ columnName: 'miniatures',
7590
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7591
+ },
7592
+ },
7593
+ {
7594
+ imagesCard: {
7595
+ columnName: 'images_card',
7596
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7597
+ },
7598
+ },
7584
7599
  { tagsProfile: { columnName: 'tags_profile' } },
7585
7600
  { tagsCollection: { columnName: 'tags_collection' } },
7586
7601
  ],
@@ -8251,8 +8266,24 @@ const fieldsConfiguration$1 = [
8251
8266
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
8252
8267
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
8253
8268
  { daysOfUse: { columnName: 'days_of_use' } },
8254
- 'images',
8255
- 'miniatures',
8269
+ {
8270
+ images: {
8271
+ columnName: 'images',
8272
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8273
+ },
8274
+ },
8275
+ {
8276
+ miniatures: {
8277
+ columnName: 'miniatures',
8278
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8279
+ },
8280
+ },
8281
+ {
8282
+ imagesCard: {
8283
+ columnName: 'images_card',
8284
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8285
+ },
8286
+ },
8256
8287
  ];
8257
8288
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
8258
8289
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -9680,6 +9711,18 @@ Object.defineProperty(exports, 'subDays', {
9680
9711
  enumerable: true,
9681
9712
  get: function () { return dateFns.subDays; }
9682
9713
  });
9714
+ Object.defineProperty(exports, 'formatInTimeZone', {
9715
+ enumerable: true,
9716
+ get: function () { return dateFnsTz.formatInTimeZone; }
9717
+ });
9718
+ Object.defineProperty(exports, 'fromZonedTime', {
9719
+ enumerable: true,
9720
+ get: function () { return dateFnsTz.fromZonedTime; }
9721
+ });
9722
+ Object.defineProperty(exports, 'toZonedTime', {
9723
+ enumerable: true,
9724
+ get: function () { return dateFnsTz.toZonedTime; }
9725
+ });
9683
9726
  Object.defineProperty(exports, 'chunk', {
9684
9727
  enumerable: true,
9685
9728
  get: function () { return lodash.chunk; }
package/index.esm.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import 'reflect-metadata';
2
2
  import { __decorate, __metadata } from 'tslib';
3
3
  import { plainToInstance, instanceToPlain, Type } from 'class-transformer';
4
- import { parseISO, startOfDay, endOfDay, subDays, format, addDays } from 'date-fns';
4
+ import { parseISO, startOfDay, endOfDay, addHours, subDays, format, addDays } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
6
+ import { toZonedTime } from 'date-fns-tz';
7
+ export { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
6
8
  import { compact, get, isNil, isArray, first, last, flatten, isString, omit, each, unset, isObject, isEmpty, isDate, isBoolean, isInteger, isNumber, isNaN as isNaN$1, set, chunk, sortBy } from 'lodash';
7
9
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
8
10
  import { debug } from 'debug';
9
11
  import * as serializeJavascript from 'serialize-javascript';
10
12
  import { CustomError } from 'ts-custom-error';
11
- import { toZonedTime } from 'date-fns-tz';
12
13
  import axios, { AxiosError } from 'axios';
13
14
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, browserPopupRedirectResolver, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
14
15
  import { Md5 } from 'ts-md5';
@@ -1776,8 +1777,6 @@ class AntifraudCardService {
1776
1777
  const dateRange = this.getTodayDateRange();
1777
1778
  const blockedOrders = await this.getBlockedOrdersByMultipleCriteria(checkout, dateRange);
1778
1779
  const totalBlockedAttempts = this.calculateUniqueBlockedAttempts(blockedOrders, checkout);
1779
- // eslint-disable-next-line no-console
1780
- console.log('totalBlockedAttempts', totalBlockedAttempts);
1781
1780
  if (totalBlockedAttempts >= this.LIMIT_BLOCKED_ORDERS_DAY) {
1782
1781
  await this.createBlockedOrderRecord({
1783
1782
  checkout,
@@ -1795,11 +1794,7 @@ class AntifraudCardService {
1795
1794
  const today = toZonedTime(new Date(), timeZone);
1796
1795
  const day = startOfDay(today);
1797
1796
  const endOfDay$1 = endOfDay(today);
1798
- // eslint-disable-next-line no-console
1799
- console.log('day not zoned', startOfDay(new Date()), 'endOfDay not zoned', endOfDay(new Date()));
1800
- // eslint-disable-next-line no-console
1801
- console.log('day zoned', day, 'endOfDay zoned', endOfDay$1);
1802
- return { day, endOfDay: endOfDay$1 };
1797
+ return { day: addHours(day, 3), endOfDay: addHours(endOfDay$1, 3) };
1803
1798
  }
1804
1799
  async getBlockedOrdersByMultipleCriteria(checkout, dateRange) {
1805
1800
  const { day, endOfDay } = dateRange;
@@ -1807,8 +1802,6 @@ class AntifraudCardService {
1807
1802
  { operator: Where.GTE, value: day },
1808
1803
  { operator: Where.LTE, value: endOfDay },
1809
1804
  ];
1810
- // eslint-disable-next-line no-console
1811
- console.log('dateFilter', dateFilter);
1812
1805
  const [ordersBlockedWithCpf, ordersBlockedWithEmail, ordersBlockedWithCep, ordersBlockedWithPhone] = await Promise.all([
1813
1806
  this.getBlockedOrdersByCpf(checkout.user?.cpf, dateFilter),
1814
1807
  this.getBlockedOrdersByEmail(checkout.user?.email, dateFilter),
@@ -7355,6 +7348,12 @@ const commonFields = [
7355
7348
  to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7356
7349
  },
7357
7350
  },
7351
+ {
7352
+ imagesCard: {
7353
+ columnName: 'images_card',
7354
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7355
+ },
7356
+ },
7358
7357
  'name',
7359
7358
  {
7360
7359
  price: {
@@ -7500,6 +7499,8 @@ const fieldsConfiguration$2 = [
7500
7499
  fields: [
7501
7500
  'id',
7502
7501
  'ean',
7502
+ 'sku',
7503
+ 'description',
7503
7504
  {
7504
7505
  grade: {
7505
7506
  columnName: 'grade',
@@ -7553,9 +7554,24 @@ const fieldsConfiguration$2 = [
7553
7554
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
7554
7555
  },
7555
7556
  },
7556
- 'description',
7557
- 'images',
7558
- 'miniatures',
7557
+ {
7558
+ images: {
7559
+ columnName: 'images',
7560
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7561
+ },
7562
+ },
7563
+ {
7564
+ miniatures: {
7565
+ columnName: 'miniatures',
7566
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7567
+ },
7568
+ },
7569
+ {
7570
+ imagesCard: {
7571
+ columnName: 'images_card',
7572
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7573
+ },
7574
+ },
7559
7575
  { tagsProfile: { columnName: 'tags_profile' } },
7560
7576
  { tagsCollection: { columnName: 'tags_collection' } },
7561
7577
  ],
@@ -8226,8 +8242,24 @@ const fieldsConfiguration$1 = [
8226
8242
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
8227
8243
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
8228
8244
  { daysOfUse: { columnName: 'days_of_use' } },
8229
- 'images',
8230
- 'miniatures',
8245
+ {
8246
+ images: {
8247
+ columnName: 'images',
8248
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8249
+ },
8250
+ },
8251
+ {
8252
+ miniatures: {
8253
+ columnName: 'miniatures',
8254
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8255
+ },
8256
+ },
8257
+ {
8258
+ imagesCard: {
8259
+ columnName: 'images_card',
8260
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8261
+ },
8262
+ },
8231
8263
  ];
8232
8264
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
8233
8265
  constructor({ endpoint, authOptions, interceptors, cache, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.3.4-beta.9",
3
+ "version": "5.3.5-beta.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -19,6 +19,7 @@ export declare class ProductBase<T extends ProductBase<T, I>, I = ProductIdentif
19
19
  costPrice: number;
20
20
  images?: string[];
21
21
  miniatures?: string[];
22
+ imagesCard?: string[];
22
23
  published: boolean;
23
24
  createdAt?: Date;
24
25
  updatedAt?: Date;
@@ -1,4 +1,5 @@
1
1
  import { add, addBusinessDays, addDays, addMonths, addYears, Duration, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
2
+ import { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
2
3
  import { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
3
4
  export type DateDuration = Duration;
4
5
  export * from './circular-dependencies';
@@ -13,4 +14,4 @@ export * from './obs-emitter';
13
14
  export * from './parse-datetime';
14
15
  export * from './serialize';
15
16
  export * from './types';
16
- export { add, addBusinessDays, addDays, addMonths, addYears, chunk, each, endOfDay, format, formatISO9075, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, parseISO, pick, set, sortBy, startOfDay, sub, subDays, unset, };
17
+ export { add, addBusinessDays, addDays, addMonths, addYears, toZonedTime, formatInTimeZone, fromZonedTime, chunk, each, endOfDay, format, formatISO9075, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, parseISO, pick, set, sortBy, startOfDay, sub, subDays, unset, };