@infrab4a/connect 5.3.0-beta.30 → 5.3.0-beta.31

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
@@ -20,25 +20,7 @@ var storage = require('firebase/storage');
20
20
 
21
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
22
 
23
- function _interopNamespace(e) {
24
- if (e && e.__esModule) return e;
25
- var n = Object.create(null);
26
- if (e) {
27
- Object.keys(e).forEach(function (k) {
28
- if (k !== 'default') {
29
- var d = Object.getOwnPropertyDescriptor(e, k);
30
- Object.defineProperty(n, k, d.get ? d : {
31
- enumerable: true,
32
- get: function () { return e[k]; }
33
- });
34
- }
35
- });
36
- }
37
- n["default"] = e;
38
- return Object.freeze(n);
39
- }
40
-
41
- var serializeJavascript__namespace = /*#__PURE__*/_interopNamespace(serializeJavascript);
23
+ var serializeJavascript__default = /*#__PURE__*/_interopDefaultLegacy(serializeJavascript);
42
24
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
43
25
 
44
26
  exports.AntifraudProviders = void 0;
@@ -660,9 +642,22 @@ const deserialize = (data) => {
660
642
  return eval('(' + data + ')');
661
643
  };
662
644
  const serialize = (data) => {
663
- return serializeJavascript__namespace(data);
645
+ return serializeJavascript__default["default"](data);
664
646
  };
665
647
 
648
+ /**
649
+ * Converts a BRL major-unit amount (e.g. 10.5) to integer cents (1050).
650
+ * Uses fixed 2-decimal normalization to avoid IEEE-754 artifacts like 19.99 * 100.
651
+ */
652
+ function toCents(amount) {
653
+ if (!Number.isFinite(amount)) {
654
+ throw new Error(`Invalid amount: ${amount}`);
655
+ }
656
+ const sign = amount < 0 ? -1 : 1;
657
+ const [whole, fraction = '0'] = Math.abs(amount).toFixed(2).split('.');
658
+ return sign * (Number(whole) * 100 + Number(fraction));
659
+ }
660
+
666
661
  class BaseModel {
667
662
  get identifier() {
668
663
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
@@ -2720,11 +2715,39 @@ class AdyenCardAxiosAdapter {
2720
2715
  }
2721
2716
  }
2722
2717
 
2718
+ function resolveCacheConfig(cache) {
2719
+ if (lodash.isNil(cache) || typeof cache !== 'object')
2720
+ return undefined;
2721
+ const candidate = cache;
2722
+ const cacheAdapter = candidate.cacheAdapter;
2723
+ if (!cacheAdapter)
2724
+ return undefined;
2725
+ if (!isCacheAdapter(cacheAdapter))
2726
+ return undefined;
2727
+ if (typeof cacheAdapter.isConfigured === 'function' && !cacheAdapter.isConfigured()) {
2728
+ return undefined;
2729
+ }
2730
+ return {
2731
+ cacheAdapter,
2732
+ ttlDefault: candidate.ttlDefault,
2733
+ };
2734
+ }
2735
+ function isCacheAdapter(adapter) {
2736
+ return (typeof adapter.get === 'function' &&
2737
+ typeof adapter.set === 'function' &&
2738
+ typeof adapter.remove === 'function' &&
2739
+ typeof adapter.clear === 'function');
2740
+ }
2741
+
2723
2742
  class RestCacheAdapter {
2724
2743
  constructor(config) {
2744
+ this.client = null;
2725
2745
  this.logger = new DebugHelper('RestCacheAdapter');
2746
+ this.configured = this.isValidBaseURL(config.baseURL);
2747
+ if (!this.configured)
2748
+ return;
2726
2749
  this.client = axios__default["default"].create({
2727
- baseURL: config.baseURL,
2750
+ baseURL: config.baseURL.trim(),
2728
2751
  headers: {
2729
2752
  'Content-Type': 'application/json',
2730
2753
  ...(lodash.isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
@@ -2732,7 +2755,12 @@ class RestCacheAdapter {
2732
2755
  },
2733
2756
  });
2734
2757
  }
2758
+ isConfigured() {
2759
+ return this.configured;
2760
+ }
2735
2761
  async set(options) {
2762
+ if (!this.client)
2763
+ return false;
2736
2764
  try {
2737
2765
  const response = await this.client.post('/redis/set', {
2738
2766
  key: options.key,
@@ -2748,6 +2776,8 @@ class RestCacheAdapter {
2748
2776
  }
2749
2777
  }
2750
2778
  async get(key) {
2779
+ if (!this.client)
2780
+ return null;
2751
2781
  try {
2752
2782
  const response = await this.client.post('/redis/get', {
2753
2783
  key,
@@ -2764,6 +2794,8 @@ class RestCacheAdapter {
2764
2794
  }
2765
2795
  }
2766
2796
  async remove(key) {
2797
+ if (!this.client)
2798
+ return false;
2767
2799
  try {
2768
2800
  const response = await this.client.post('/redis/del', {
2769
2801
  key,
@@ -2777,6 +2809,8 @@ class RestCacheAdapter {
2777
2809
  }
2778
2810
  }
2779
2811
  async clear() {
2812
+ if (!this.client)
2813
+ return false;
2780
2814
  try {
2781
2815
  const response = await this.client.post('/redis/flushdb', {});
2782
2816
  return response.data.success;
@@ -2787,6 +2821,9 @@ class RestCacheAdapter {
2787
2821
  return false;
2788
2822
  }
2789
2823
  }
2824
+ isValidBaseURL(baseURL) {
2825
+ return lodash.isString(baseURL) && baseURL.trim().length > 0;
2826
+ }
2790
2827
  }
2791
2828
 
2792
2829
  class AxiosAdapter {
@@ -6133,7 +6170,7 @@ function createHasuraGraphQLClass(MixinBase) {
6133
6170
  this.model = options.model;
6134
6171
  this.fields = options.fields || this.model.identifiersFields;
6135
6172
  this.logger = DebugHelper.from(this);
6136
- this.cache = options.cache;
6173
+ this.cache = resolveCacheConfig(options.cache);
6137
6174
  }
6138
6175
  get headers() {
6139
6176
  return HasuraAuthHelper.buildHeaders(this.authOptions);
@@ -11130,9 +11167,9 @@ class PagarmeV5BaseAxiosAdapter {
11130
11167
  }
11131
11168
  async refund(order, amount) {
11132
11169
  try {
11133
- console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
11134
- const amountToSend = +amount.toFixed(2) * 100;
11135
- console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
11170
+ console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment.payment_method, order.payment.amount, 'to refund with amount', amount);
11171
+ const amountInCents = toCents(amount);
11172
+ console.warn('[PAGARME REFUND] Amount to send in cents', amountInCents);
11136
11173
  const { data } = await axios__default["default"]({
11137
11174
  method: 'DELETE',
11138
11175
  url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
@@ -11141,7 +11178,7 @@ class PagarmeV5BaseAxiosAdapter {
11141
11178
  'Content-Type': 'application/json',
11142
11179
  },
11143
11180
  data: {
11144
- amount: amountToSend,
11181
+ amount: amountInCents,
11145
11182
  },
11146
11183
  });
11147
11184
  console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
@@ -11157,7 +11194,13 @@ class PagarmeV5BaseAxiosAdapter {
11157
11194
  });
11158
11195
  return {
11159
11196
  status: this.getRefundStatus(data.status),
11160
- success: [exports.PagarMeV5OrderStatus.Pago, exports.PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
11197
+ success: [
11198
+ exports.PagarMeV5OrderStatus.Pago,
11199
+ exports.PagarMeV5OrderStatus.Cancelado,
11200
+ exports.PagarMeV5PaymentStatus['Em processamento'],
11201
+ ].includes(data.status)
11202
+ ? true
11203
+ : false,
11161
11204
  };
11162
11205
  }
11163
11206
  catch (error) {
@@ -11859,8 +11902,10 @@ exports.isDebuggable = isDebuggable;
11859
11902
  exports.isUUID = isUUID;
11860
11903
  exports.parseDateTime = parseDateTime;
11861
11904
  exports.registerClass = registerClass;
11905
+ exports.resolveCacheConfig = resolveCacheConfig;
11862
11906
  exports.resolveClass = resolveClass;
11863
11907
  exports.serialize = serialize;
11908
+ exports.toCents = toCents;
11864
11909
  exports.withCreateFirestore = withCreateFirestore;
11865
11910
  exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
11866
11911
  exports.withCrudFirestore = withCrudFirestore;
package/index.esm.js CHANGED
@@ -8,7 +8,7 @@ export { formatInTimeZone } from 'date-fns-tz';
8
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';
9
9
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
10
10
  import { debug } from 'debug';
11
- import * as serializeJavascript from 'serialize-javascript';
11
+ import serializeJavascript from 'serialize-javascript';
12
12
  import { CustomError } from 'ts-custom-error';
13
13
  import axios, { AxiosError } from 'axios';
14
14
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, browserPopupRedirectResolver, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
@@ -639,6 +639,19 @@ const serialize = (data) => {
639
639
  return serializeJavascript(data);
640
640
  };
641
641
 
642
+ /**
643
+ * Converts a BRL major-unit amount (e.g. 10.5) to integer cents (1050).
644
+ * Uses fixed 2-decimal normalization to avoid IEEE-754 artifacts like 19.99 * 100.
645
+ */
646
+ function toCents(amount) {
647
+ if (!Number.isFinite(amount)) {
648
+ throw new Error(`Invalid amount: ${amount}`);
649
+ }
650
+ const sign = amount < 0 ? -1 : 1;
651
+ const [whole, fraction = '0'] = Math.abs(amount).toFixed(2).split('.');
652
+ return sign * (Number(whole) * 100 + Number(fraction));
653
+ }
654
+
642
655
  class BaseModel {
643
656
  get identifier() {
644
657
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
@@ -2696,11 +2709,39 @@ class AdyenCardAxiosAdapter {
2696
2709
  }
2697
2710
  }
2698
2711
 
2712
+ function resolveCacheConfig(cache) {
2713
+ if (isNil(cache) || typeof cache !== 'object')
2714
+ return undefined;
2715
+ const candidate = cache;
2716
+ const cacheAdapter = candidate.cacheAdapter;
2717
+ if (!cacheAdapter)
2718
+ return undefined;
2719
+ if (!isCacheAdapter(cacheAdapter))
2720
+ return undefined;
2721
+ if (typeof cacheAdapter.isConfigured === 'function' && !cacheAdapter.isConfigured()) {
2722
+ return undefined;
2723
+ }
2724
+ return {
2725
+ cacheAdapter,
2726
+ ttlDefault: candidate.ttlDefault,
2727
+ };
2728
+ }
2729
+ function isCacheAdapter(adapter) {
2730
+ return (typeof adapter.get === 'function' &&
2731
+ typeof adapter.set === 'function' &&
2732
+ typeof adapter.remove === 'function' &&
2733
+ typeof adapter.clear === 'function');
2734
+ }
2735
+
2699
2736
  class RestCacheAdapter {
2700
2737
  constructor(config) {
2738
+ this.client = null;
2701
2739
  this.logger = new DebugHelper('RestCacheAdapter');
2740
+ this.configured = this.isValidBaseURL(config.baseURL);
2741
+ if (!this.configured)
2742
+ return;
2702
2743
  this.client = axios.create({
2703
- baseURL: config.baseURL,
2744
+ baseURL: config.baseURL.trim(),
2704
2745
  headers: {
2705
2746
  'Content-Type': 'application/json',
2706
2747
  ...(isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
@@ -2708,7 +2749,12 @@ class RestCacheAdapter {
2708
2749
  },
2709
2750
  });
2710
2751
  }
2752
+ isConfigured() {
2753
+ return this.configured;
2754
+ }
2711
2755
  async set(options) {
2756
+ if (!this.client)
2757
+ return false;
2712
2758
  try {
2713
2759
  const response = await this.client.post('/redis/set', {
2714
2760
  key: options.key,
@@ -2724,6 +2770,8 @@ class RestCacheAdapter {
2724
2770
  }
2725
2771
  }
2726
2772
  async get(key) {
2773
+ if (!this.client)
2774
+ return null;
2727
2775
  try {
2728
2776
  const response = await this.client.post('/redis/get', {
2729
2777
  key,
@@ -2740,6 +2788,8 @@ class RestCacheAdapter {
2740
2788
  }
2741
2789
  }
2742
2790
  async remove(key) {
2791
+ if (!this.client)
2792
+ return false;
2743
2793
  try {
2744
2794
  const response = await this.client.post('/redis/del', {
2745
2795
  key,
@@ -2753,6 +2803,8 @@ class RestCacheAdapter {
2753
2803
  }
2754
2804
  }
2755
2805
  async clear() {
2806
+ if (!this.client)
2807
+ return false;
2756
2808
  try {
2757
2809
  const response = await this.client.post('/redis/flushdb', {});
2758
2810
  return response.data.success;
@@ -2763,6 +2815,9 @@ class RestCacheAdapter {
2763
2815
  return false;
2764
2816
  }
2765
2817
  }
2818
+ isValidBaseURL(baseURL) {
2819
+ return isString(baseURL) && baseURL.trim().length > 0;
2820
+ }
2766
2821
  }
2767
2822
 
2768
2823
  class AxiosAdapter {
@@ -6109,7 +6164,7 @@ function createHasuraGraphQLClass(MixinBase) {
6109
6164
  this.model = options.model;
6110
6165
  this.fields = options.fields || this.model.identifiersFields;
6111
6166
  this.logger = DebugHelper.from(this);
6112
- this.cache = options.cache;
6167
+ this.cache = resolveCacheConfig(options.cache);
6113
6168
  }
6114
6169
  get headers() {
6115
6170
  return HasuraAuthHelper.buildHeaders(this.authOptions);
@@ -11106,9 +11161,9 @@ class PagarmeV5BaseAxiosAdapter {
11106
11161
  }
11107
11162
  async refund(order, amount) {
11108
11163
  try {
11109
- console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
11110
- const amountToSend = +amount.toFixed(2) * 100;
11111
- console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
11164
+ console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment.payment_method, order.payment.amount, 'to refund with amount', amount);
11165
+ const amountInCents = toCents(amount);
11166
+ console.warn('[PAGARME REFUND] Amount to send in cents', amountInCents);
11112
11167
  const { data } = await axios({
11113
11168
  method: 'DELETE',
11114
11169
  url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
@@ -11117,7 +11172,7 @@ class PagarmeV5BaseAxiosAdapter {
11117
11172
  'Content-Type': 'application/json',
11118
11173
  },
11119
11174
  data: {
11120
- amount: amountToSend,
11175
+ amount: amountInCents,
11121
11176
  },
11122
11177
  });
11123
11178
  console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
@@ -11133,7 +11188,13 @@ class PagarmeV5BaseAxiosAdapter {
11133
11188
  });
11134
11189
  return {
11135
11190
  status: this.getRefundStatus(data.status),
11136
- success: [PagarMeV5OrderStatus.Pago, PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
11191
+ success: [
11192
+ PagarMeV5OrderStatus.Pago,
11193
+ PagarMeV5OrderStatus.Cancelado,
11194
+ PagarMeV5PaymentStatus['Em processamento'],
11195
+ ].includes(data.status)
11196
+ ? true
11197
+ : false,
11137
11198
  };
11138
11199
  }
11139
11200
  catch (error) {
@@ -11520,4 +11581,4 @@ class ProductsVertexSearch {
11520
11581
  }
11521
11582
  }
11522
11583
 
11523
- export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandCategory, BrandCategoryFirestoreRepository, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, ErrorsCode, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, InvalidCheckoutError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, MercadoPagoBankSlipAxiosAdapter, MercadoPagoCardAxiosAdapter, MercadoPagoErrorHelper, MercadoPagoPaymentMethodFactory, MercadoPagoPixAxiosAdapter, MercadoPagoRequestHelper, MercadoPagoResponseHelper, MercadoPagoStatusDetailEnum, MercadoPagoStatusEnum, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderPaymentStatus, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5BaseAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQL, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductGroup, ProductGroupHasuraGraphQLRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductPriceLog, ProductPriceLogHasuraGraphQLRepository, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockEntry, ProductStockEntryHasuraGraphQL, ProductStockEntryHasuraGraphQLRepository, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopConfigs, ShopConfigsFirestoreRepository, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, ShoppingRecurrence, ShoppingRecurrenceCycle, ShoppingRecurrenceEdition, ShoppingRecurrenceEditionFirestoreRepository, ShoppingRecurrenceEditionStatus, ShoppingRecurrenceErrorLog, ShoppingRecurrenceErrorLogFirestoreRepository, ShoppingRecurrenceFirestoreRepository, ShoppingRecurrenceStatus, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
11584
+ export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandCategory, BrandCategoryFirestoreRepository, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, ErrorsCode, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, InvalidCheckoutError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, MercadoPagoBankSlipAxiosAdapter, MercadoPagoCardAxiosAdapter, MercadoPagoErrorHelper, MercadoPagoPaymentMethodFactory, MercadoPagoPixAxiosAdapter, MercadoPagoRequestHelper, MercadoPagoResponseHelper, MercadoPagoStatusDetailEnum, MercadoPagoStatusEnum, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderPaymentStatus, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5BaseAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQL, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductGroup, ProductGroupHasuraGraphQLRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductPriceLog, ProductPriceLogHasuraGraphQLRepository, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockEntry, ProductStockEntryHasuraGraphQL, ProductStockEntryHasuraGraphQLRepository, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopConfigs, ShopConfigsFirestoreRepository, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, ShoppingRecurrence, ShoppingRecurrenceCycle, ShoppingRecurrenceEdition, ShoppingRecurrenceEditionFirestoreRepository, ShoppingRecurrenceEditionStatus, ShoppingRecurrenceErrorLog, ShoppingRecurrenceErrorLogFirestoreRepository, ShoppingRecurrenceFirestoreRepository, ShoppingRecurrenceStatus, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveCacheConfig, resolveClass, serialize, toCents, 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": "5.3.0-beta.30",
3
+ "version": "5.3.0-beta.31",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -16,6 +16,8 @@ export declare class Checkout extends BaseModel<Checkout> {
16
16
  totalPrice?: number;
17
17
  shop: Shops;
18
18
  glampoints?: number;
19
+ pointsUsed?: number;
20
+ pointsDiscount?: number;
19
21
  lineItems?: LineItem[];
20
22
  user?: User;
21
23
  shippingAddress?: UserAddress;
@@ -1,4 +1,5 @@
1
1
  import { Product } from '../../catalog/models/product';
2
+ import { ShoppingRecurrenceCycle } from './enums';
2
3
  export declare class LineItem extends Product {
3
4
  parentId?: string;
4
5
  quantity: number;
@@ -7,5 +8,8 @@ export declare class LineItem extends Product {
7
8
  discount?: number;
8
9
  image?: string;
9
10
  refunded?: boolean;
11
+ recurrenceCartItem?: boolean;
12
+ recurrenceCycle?: ShoppingRecurrenceCycle;
13
+ recurrenceDiscountPercentage?: number;
10
14
  get pricePaidWithDiscount(): number;
11
15
  }
@@ -18,6 +18,7 @@ export declare class Order extends Checkout {
18
18
  isReshipment?: boolean;
19
19
  isRecurrenceOrder?: boolean;
20
20
  recurrenceId?: string;
21
+ recurrenceIds?: string[];
21
22
  recurrenceExecutionId?: string;
22
23
  metadata?: {
23
24
  ip?: string;
@@ -1,2 +1,2 @@
1
1
  import { LineItem } from '../line-item';
2
- export type LineItemRecurrence = Pick<LineItem, 'id' | 'EAN' | 'sku' | 'slug' | 'name' | 'description' | 'brand' | 'gender' | 'costPrice' | 'discount' | 'weight' | 'pricePaid' | 'quantity' | 'images' | 'miniatures'>;
2
+ export type LineItemRecurrence = Pick<LineItem, 'id' | 'EAN' | 'sku' | 'slug' | 'name' | 'description' | 'brand' | 'gender' | 'costPrice' | 'discount' | 'weight' | 'pricePaid' | 'quantity' | 'images' | 'miniatures' | 'recurrenceCycle' | 'recurrenceDiscountPercentage'>;
@@ -1,8 +1,6 @@
1
- import { ShoppingRecurrenceCycle } from '../models/enums/shopping-recurrence-cycle.enum';
2
1
  import { PaymentCardInfo } from './payment-card-info.type';
3
2
  export type CreateShoppingRecurrencyPayload = {
4
3
  shopId: string;
5
4
  cards?: PaymentCardInfo[];
6
5
  orderId: string;
7
- recurrence: ShoppingRecurrenceCycle;
8
6
  };
@@ -18,3 +18,4 @@ export * from './payment-method.type';
18
18
  export * from './payment-provider.type';
19
19
  export * from './shipping-method-response.type';
20
20
  export * from './shipping-product-request.type';
21
+ export * from './shopping-recurrence-update-payloads.type';
@@ -0,0 +1,35 @@
1
+ import { UserAddress } from '../../users';
2
+ import { ShoppingRecurrenceCycle } from '../models/enums/shopping-recurrence-cycle.enum';
3
+ import { LineItemRecurrence } from '../models/types/line-item-recurrence.type';
4
+ import { CardForPaymentInfo } from './payment-card-info.type';
5
+ export type UpdateShoppingRecurrencePaymentMethodPayload = {
6
+ recurrenceId: string;
7
+ cards: CardForPaymentInfo[];
8
+ };
9
+ export type GetShoppingRecurrenceAvailableShippingPayload = {
10
+ recurrenceId: string;
11
+ shippingAddress?: UserAddress;
12
+ };
13
+ export type UpdateShoppingRecurrenceShippingAddressPayload = {
14
+ recurrenceId: string;
15
+ shippingAddress: UserAddress;
16
+ shippingOption: string;
17
+ };
18
+ export type CancelShoppingRecurrencePayload = {
19
+ recurrenceId: string;
20
+ };
21
+ export type EnableOrDisableShoppingRecurrencePayload = {
22
+ recurrenceId: string;
23
+ active: boolean;
24
+ };
25
+ export type SkipShoppingRecurrenceEditionPayload = {
26
+ recurrenceEditionId: string;
27
+ };
28
+ export type UpdateShoppingRecurrenceFrequencyPayload = {
29
+ recurrenceId: string;
30
+ frequency: ShoppingRecurrenceCycle;
31
+ };
32
+ export type UpdateShoppingRecurrenceLineItemsPayload = {
33
+ recurrenceId: string;
34
+ lineItems: LineItemRecurrence[];
35
+ };
@@ -1 +1,2 @@
1
+ export * from './resolve-cache-config';
1
2
  export * from './restcache.adapter';
@@ -0,0 +1,2 @@
1
+ import { CacheConfig } from '../../domain/generic/repository/types/repository-cache-options.type';
2
+ export declare function resolveCacheConfig(cache: unknown): CacheConfig | undefined;
@@ -7,9 +7,12 @@ export interface RESTCacheConfig {
7
7
  export declare class RestCacheAdapter implements CacheAdapter {
8
8
  private client;
9
9
  private readonly logger;
10
+ private readonly configured;
10
11
  constructor(config: RESTCacheConfig);
12
+ isConfigured(): boolean;
11
13
  set(options: CacheOptions): Promise<boolean>;
12
14
  get<T = any>(key: string): Promise<T | null>;
13
15
  remove(key: string): Promise<boolean>;
14
16
  clear(): Promise<boolean>;
17
+ private isValidBaseURL;
15
18
  }
@@ -13,5 +13,6 @@ export * from './mixins';
13
13
  export * from './obs-emitter';
14
14
  export * from './parse-datetime';
15
15
  export * from './serialize';
16
+ export * from './to-cents';
16
17
  export * from './types';
17
18
  export { add, addBusinessDays, addHours, addDays, addMonths, addYears, formatInTimeZone, 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, };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts a BRL major-unit amount (e.g. 10.5) to integer cents (1050).
3
+ * Uses fixed 2-decimal normalization to avoid IEEE-754 artifacts like 19.99 * 100.
4
+ */
5
+ export declare function toCents(amount: number): number;