@infrab4a/connect 5.7.6 → 5.7.7

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
@@ -17,6 +17,7 @@ var tsMd5 = require('ts-md5');
17
17
  var gqlQueryBuilder = require('gql-query-builder');
18
18
  var firestore = require('firebase/firestore');
19
19
  var storage = require('firebase/storage');
20
+ var currency = require('currency.js');
20
21
 
21
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
23
 
@@ -40,6 +41,7 @@ function _interopNamespace(e) {
40
41
 
41
42
  var serializeJavascript__namespace = /*#__PURE__*/_interopNamespace(serializeJavascript);
42
43
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
44
+ var currency__namespace = /*#__PURE__*/_interopNamespace(currency);
43
45
 
44
46
  exports.AntifraudProviders = void 0;
45
47
  (function (AntifraudProviders) {
@@ -175,51 +177,6 @@ class PaymentProviderFactory {
175
177
  }
176
178
  }
177
179
 
178
- function toLineItemRecurrence(item) {
179
- if (item.recurrenceCycle == null) {
180
- throw new Error(`Line item ${item.id ?? item.sku ?? 'unknown'} is missing recurrenceCycle`);
181
- }
182
- return {
183
- id: item.id,
184
- EAN: item.EAN,
185
- sku: item.sku,
186
- slug: item.slug,
187
- name: item.name,
188
- description: item.description,
189
- brand: item.brand,
190
- gender: item.gender,
191
- costPrice: item.costPrice,
192
- discount: item.discount,
193
- weight: item.weight,
194
- pricePaid: item.pricePaid,
195
- quantity: item.quantity,
196
- images: item.images,
197
- miniatures: item.miniatures,
198
- recurrenceCycle: item.recurrenceCycle,
199
- recurrenceDiscountPercentage: item.recurrenceDiscountPercentage,
200
- };
201
- }
202
- function groupRecurringLineItemsByCycle(items) {
203
- const groups = new Map();
204
- for (const item of items) {
205
- if (!item.recurrenceCartItem) {
206
- continue;
207
- }
208
- if (item.recurrenceCycle == null) {
209
- throw new Error(`Line item ${item.id ?? item.sku ?? 'unknown'} has recurrenceCartItem but is missing recurrenceCycle`);
210
- }
211
- const mapped = toLineItemRecurrence(item);
212
- const existing = groups.get(item.recurrenceCycle);
213
- if (existing) {
214
- existing.push(mapped);
215
- }
216
- else {
217
- groups.set(item.recurrenceCycle, [mapped]);
218
- }
219
- }
220
- return groups;
221
- }
222
-
223
180
  const registry = new Map();
224
181
  function registerClass(name, classConstructor) {
225
182
  registry.set(name, classConstructor);
@@ -2765,39 +2722,11 @@ class AdyenCardAxiosAdapter {
2765
2722
  }
2766
2723
  }
2767
2724
 
2768
- function resolveCacheConfig(cache) {
2769
- if (lodash.isNil(cache) || typeof cache !== 'object')
2770
- return undefined;
2771
- const candidate = cache;
2772
- const cacheAdapter = candidate.cacheAdapter;
2773
- if (!cacheAdapter)
2774
- return undefined;
2775
- if (!isCacheAdapter(cacheAdapter))
2776
- return undefined;
2777
- if (typeof cacheAdapter.isConfigured === 'function' && !cacheAdapter.isConfigured()) {
2778
- return undefined;
2779
- }
2780
- return {
2781
- cacheAdapter,
2782
- ttlDefault: candidate.ttlDefault,
2783
- };
2784
- }
2785
- function isCacheAdapter(adapter) {
2786
- return (typeof adapter.get === 'function' &&
2787
- typeof adapter.set === 'function' &&
2788
- typeof adapter.remove === 'function' &&
2789
- typeof adapter.clear === 'function');
2790
- }
2791
-
2792
2725
  class RestCacheAdapter {
2793
2726
  constructor(config) {
2794
- this.client = null;
2795
2727
  this.logger = new DebugHelper('RestCacheAdapter');
2796
- this.configured = this.isValidBaseURL(config.baseURL);
2797
- if (!this.configured)
2798
- return;
2799
2728
  this.client = axios__default["default"].create({
2800
- baseURL: config.baseURL.trim(),
2729
+ baseURL: config.baseURL,
2801
2730
  headers: {
2802
2731
  'Content-Type': 'application/json',
2803
2732
  ...(lodash.isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
@@ -2805,12 +2734,7 @@ class RestCacheAdapter {
2805
2734
  },
2806
2735
  });
2807
2736
  }
2808
- isConfigured() {
2809
- return this.configured;
2810
- }
2811
2737
  async set(options) {
2812
- if (!this.client)
2813
- return false;
2814
2738
  try {
2815
2739
  const response = await this.client.post('/redis/set', {
2816
2740
  key: options.key,
@@ -2826,8 +2750,6 @@ class RestCacheAdapter {
2826
2750
  }
2827
2751
  }
2828
2752
  async get(key) {
2829
- if (!this.client)
2830
- return null;
2831
2753
  try {
2832
2754
  const response = await this.client.post('/redis/get', {
2833
2755
  key,
@@ -2844,8 +2766,6 @@ class RestCacheAdapter {
2844
2766
  }
2845
2767
  }
2846
2768
  async remove(key) {
2847
- if (!this.client)
2848
- return false;
2849
2769
  try {
2850
2770
  const response = await this.client.post('/redis/del', {
2851
2771
  key,
@@ -2859,8 +2779,6 @@ class RestCacheAdapter {
2859
2779
  }
2860
2780
  }
2861
2781
  async clear() {
2862
- if (!this.client)
2863
- return false;
2864
2782
  try {
2865
2783
  const response = await this.client.post('/redis/flushdb', {});
2866
2784
  return response.data.success;
@@ -2871,9 +2789,6 @@ class RestCacheAdapter {
2871
2789
  return false;
2872
2790
  }
2873
2791
  }
2874
- isValidBaseURL(baseURL) {
2875
- return lodash.isString(baseURL) && baseURL.trim().length > 0;
2876
- }
2877
2792
  }
2878
2793
 
2879
2794
  class AxiosAdapter {
@@ -6220,7 +6135,7 @@ function createHasuraGraphQLClass(MixinBase) {
6220
6135
  this.model = options.model;
6221
6136
  this.fields = options.fields || this.model.identifiersFields;
6222
6137
  this.logger = DebugHelper.from(this);
6223
- this.cache = resolveCacheConfig(options.cache);
6138
+ this.cache = options.cache;
6224
6139
  }
6225
6140
  get headers() {
6226
6141
  return HasuraAuthHelper.buildHeaders(this.authOptions);
@@ -11217,9 +11132,9 @@ class PagarmeV5BaseAxiosAdapter {
11217
11132
  }
11218
11133
  async refund(order, amount) {
11219
11134
  try {
11220
- console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
11221
- const amountToSend = +amount.toFixed(2) * 100;
11222
- console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
11135
+ console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment.payment_method, order.payment.amount, 'to refund with amount', amount);
11136
+ const amountInCents = currency__namespace(amount).multiply(100).value;
11137
+ console.warn('[PAGARME REFUND] Amount to send in cents', amountInCents);
11223
11138
  const { data } = await axios__default["default"]({
11224
11139
  method: 'DELETE',
11225
11140
  url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
@@ -11228,7 +11143,7 @@ class PagarmeV5BaseAxiosAdapter {
11228
11143
  'Content-Type': 'application/json',
11229
11144
  },
11230
11145
  data: {
11231
- amount: amountToSend,
11146
+ amount: amountInCents,
11232
11147
  },
11233
11148
  });
11234
11149
  console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
@@ -11941,16 +11856,13 @@ exports.Wishlist = Wishlist;
11941
11856
  exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
11942
11857
  exports.deserialize = deserialize;
11943
11858
  exports.getClass = getClass;
11944
- exports.groupRecurringLineItemsByCycle = groupRecurringLineItemsByCycle;
11945
11859
  exports.is = is;
11946
11860
  exports.isDebuggable = isDebuggable;
11947
11861
  exports.isUUID = isUUID;
11948
11862
  exports.parseDateTime = parseDateTime;
11949
11863
  exports.registerClass = registerClass;
11950
- exports.resolveCacheConfig = resolveCacheConfig;
11951
11864
  exports.resolveClass = resolveClass;
11952
11865
  exports.serialize = serialize;
11953
- exports.toLineItemRecurrence = toLineItemRecurrence;
11954
11866
  exports.withCreateFirestore = withCreateFirestore;
11955
11867
  exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
11956
11868
  exports.withCrudFirestore = withCrudFirestore;
package/index.esm.js CHANGED
@@ -16,6 +16,7 @@ import { Md5 } from 'ts-md5';
16
16
  import { mutation, query } from 'gql-query-builder';
17
17
  import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc, setDoc, deleteDoc, collection, limit, getDocs, query as query$1, where, orderBy, startAfter, addDoc } from 'firebase/firestore';
18
18
  import { ref, uploadBytes } from 'firebase/storage';
19
+ import * as currency from 'currency.js';
19
20
 
20
21
  var AntifraudProviders;
21
22
  (function (AntifraudProviders) {
@@ -151,51 +152,6 @@ class PaymentProviderFactory {
151
152
  }
152
153
  }
153
154
 
154
- function toLineItemRecurrence(item) {
155
- if (item.recurrenceCycle == null) {
156
- throw new Error(`Line item ${item.id ?? item.sku ?? 'unknown'} is missing recurrenceCycle`);
157
- }
158
- return {
159
- id: item.id,
160
- EAN: item.EAN,
161
- sku: item.sku,
162
- slug: item.slug,
163
- name: item.name,
164
- description: item.description,
165
- brand: item.brand,
166
- gender: item.gender,
167
- costPrice: item.costPrice,
168
- discount: item.discount,
169
- weight: item.weight,
170
- pricePaid: item.pricePaid,
171
- quantity: item.quantity,
172
- images: item.images,
173
- miniatures: item.miniatures,
174
- recurrenceCycle: item.recurrenceCycle,
175
- recurrenceDiscountPercentage: item.recurrenceDiscountPercentage,
176
- };
177
- }
178
- function groupRecurringLineItemsByCycle(items) {
179
- const groups = new Map();
180
- for (const item of items) {
181
- if (!item.recurrenceCartItem) {
182
- continue;
183
- }
184
- if (item.recurrenceCycle == null) {
185
- throw new Error(`Line item ${item.id ?? item.sku ?? 'unknown'} has recurrenceCartItem but is missing recurrenceCycle`);
186
- }
187
- const mapped = toLineItemRecurrence(item);
188
- const existing = groups.get(item.recurrenceCycle);
189
- if (existing) {
190
- existing.push(mapped);
191
- }
192
- else {
193
- groups.set(item.recurrenceCycle, [mapped]);
194
- }
195
- }
196
- return groups;
197
- }
198
-
199
155
  const registry = new Map();
200
156
  function registerClass(name, classConstructor) {
201
157
  registry.set(name, classConstructor);
@@ -2741,39 +2697,11 @@ class AdyenCardAxiosAdapter {
2741
2697
  }
2742
2698
  }
2743
2699
 
2744
- function resolveCacheConfig(cache) {
2745
- if (isNil(cache) || typeof cache !== 'object')
2746
- return undefined;
2747
- const candidate = cache;
2748
- const cacheAdapter = candidate.cacheAdapter;
2749
- if (!cacheAdapter)
2750
- return undefined;
2751
- if (!isCacheAdapter(cacheAdapter))
2752
- return undefined;
2753
- if (typeof cacheAdapter.isConfigured === 'function' && !cacheAdapter.isConfigured()) {
2754
- return undefined;
2755
- }
2756
- return {
2757
- cacheAdapter,
2758
- ttlDefault: candidate.ttlDefault,
2759
- };
2760
- }
2761
- function isCacheAdapter(adapter) {
2762
- return (typeof adapter.get === 'function' &&
2763
- typeof adapter.set === 'function' &&
2764
- typeof adapter.remove === 'function' &&
2765
- typeof adapter.clear === 'function');
2766
- }
2767
-
2768
2700
  class RestCacheAdapter {
2769
2701
  constructor(config) {
2770
- this.client = null;
2771
2702
  this.logger = new DebugHelper('RestCacheAdapter');
2772
- this.configured = this.isValidBaseURL(config.baseURL);
2773
- if (!this.configured)
2774
- return;
2775
2703
  this.client = axios.create({
2776
- baseURL: config.baseURL.trim(),
2704
+ baseURL: config.baseURL,
2777
2705
  headers: {
2778
2706
  'Content-Type': 'application/json',
2779
2707
  ...(isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
@@ -2781,12 +2709,7 @@ class RestCacheAdapter {
2781
2709
  },
2782
2710
  });
2783
2711
  }
2784
- isConfigured() {
2785
- return this.configured;
2786
- }
2787
2712
  async set(options) {
2788
- if (!this.client)
2789
- return false;
2790
2713
  try {
2791
2714
  const response = await this.client.post('/redis/set', {
2792
2715
  key: options.key,
@@ -2802,8 +2725,6 @@ class RestCacheAdapter {
2802
2725
  }
2803
2726
  }
2804
2727
  async get(key) {
2805
- if (!this.client)
2806
- return null;
2807
2728
  try {
2808
2729
  const response = await this.client.post('/redis/get', {
2809
2730
  key,
@@ -2820,8 +2741,6 @@ class RestCacheAdapter {
2820
2741
  }
2821
2742
  }
2822
2743
  async remove(key) {
2823
- if (!this.client)
2824
- return false;
2825
2744
  try {
2826
2745
  const response = await this.client.post('/redis/del', {
2827
2746
  key,
@@ -2835,8 +2754,6 @@ class RestCacheAdapter {
2835
2754
  }
2836
2755
  }
2837
2756
  async clear() {
2838
- if (!this.client)
2839
- return false;
2840
2757
  try {
2841
2758
  const response = await this.client.post('/redis/flushdb', {});
2842
2759
  return response.data.success;
@@ -2847,9 +2764,6 @@ class RestCacheAdapter {
2847
2764
  return false;
2848
2765
  }
2849
2766
  }
2850
- isValidBaseURL(baseURL) {
2851
- return isString(baseURL) && baseURL.trim().length > 0;
2852
- }
2853
2767
  }
2854
2768
 
2855
2769
  class AxiosAdapter {
@@ -6196,7 +6110,7 @@ function createHasuraGraphQLClass(MixinBase) {
6196
6110
  this.model = options.model;
6197
6111
  this.fields = options.fields || this.model.identifiersFields;
6198
6112
  this.logger = DebugHelper.from(this);
6199
- this.cache = resolveCacheConfig(options.cache);
6113
+ this.cache = options.cache;
6200
6114
  }
6201
6115
  get headers() {
6202
6116
  return HasuraAuthHelper.buildHeaders(this.authOptions);
@@ -11193,9 +11107,9 @@ class PagarmeV5BaseAxiosAdapter {
11193
11107
  }
11194
11108
  async refund(order, amount) {
11195
11109
  try {
11196
- console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
11197
- const amountToSend = +amount.toFixed(2) * 100;
11198
- console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
11110
+ console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment.payment_method, order.payment.amount, 'to refund with amount', amount);
11111
+ const amountInCents = currency(amount).multiply(100).value;
11112
+ console.warn('[PAGARME REFUND] Amount to send in cents', amountInCents);
11199
11113
  const { data } = await axios({
11200
11114
  method: 'DELETE',
11201
11115
  url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
@@ -11204,7 +11118,7 @@ class PagarmeV5BaseAxiosAdapter {
11204
11118
  'Content-Type': 'application/json',
11205
11119
  },
11206
11120
  data: {
11207
- amount: amountToSend,
11121
+ amount: amountInCents,
11208
11122
  },
11209
11123
  });
11210
11124
  console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
@@ -11607,4 +11521,4 @@ class ProductsVertexSearch {
11607
11521
  }
11608
11522
  }
11609
11523
 
11610
- 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, groupRecurringLineItemsByCycle, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveCacheConfig, resolveClass, serialize, toLineItemRecurrence, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
11524
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.7.6",
3
+ "version": "5.7.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -11,6 +11,7 @@
11
11
  "dependencies": {
12
12
  "axios": "^0.27.2",
13
13
  "class-transformer": "^0.5.1",
14
+ "currency.js": "2.0.4",
14
15
  "date-fns": "2.28.0",
15
16
  "date-fns-tz": "2.0.1",
16
17
  "debug": "^4.3.4",
@@ -1,7 +1,6 @@
1
1
  export * from './enums';
2
2
  export * from './factories';
3
3
  export * from './interfaces';
4
- export * from './mappers';
5
4
  export * from './models';
6
5
  export * from './repositories';
7
6
  export * from './services';
@@ -1,5 +1,4 @@
1
1
  import { Product } from '../../catalog/models/product';
2
- import { ShoppingRecurrenceCycle } from './enums';
3
2
  export declare class LineItem extends Product {
4
3
  parentId?: string;
5
4
  quantity: number;
@@ -8,8 +7,5 @@ export declare class LineItem extends Product {
8
7
  discount?: number;
9
8
  image?: string;
10
9
  refunded?: boolean;
11
- recurrenceCartItem?: boolean;
12
- recurrenceCycle?: ShoppingRecurrenceCycle;
13
- recurrenceDiscountPercentage?: number;
14
10
  get pricePaidWithDiscount(): number;
15
11
  }
@@ -18,7 +18,6 @@ export declare class Order extends Checkout {
18
18
  isReshipment?: boolean;
19
19
  isRecurrenceOrder?: boolean;
20
20
  recurrenceId?: string;
21
- recurrenceIds?: string[];
22
21
  recurrenceExecutionId?: string;
23
22
  metadata?: {
24
23
  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' | 'recurrenceCycle' | 'recurrenceDiscountPercentage'>;
2
+ export type LineItemRecurrence = Pick<LineItem, 'id' | 'EAN' | 'sku' | 'slug' | 'name' | 'description' | 'brand' | 'gender' | 'costPrice' | 'discount' | 'weight' | 'pricePaid' | 'quantity' | 'images' | 'miniatures'>;
@@ -1,6 +1,8 @@
1
+ import { ShoppingRecurrenceCycle } from '../models/enums/shopping-recurrence-cycle.enum';
1
2
  import { PaymentCardInfo } from './payment-card-info.type';
2
3
  export type CreateShoppingRecurrencyPayload = {
3
4
  shopId: string;
4
5
  cards?: PaymentCardInfo[];
5
6
  orderId: string;
7
+ recurrence: ShoppingRecurrenceCycle;
6
8
  };
@@ -18,4 +18,3 @@ 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';
@@ -1,2 +1 @@
1
- export * from './resolve-cache-config';
2
1
  export * from './restcache.adapter';
@@ -7,12 +7,9 @@ export interface RESTCacheConfig {
7
7
  export declare class RestCacheAdapter implements CacheAdapter {
8
8
  private client;
9
9
  private readonly logger;
10
- private readonly configured;
11
10
  constructor(config: RESTCacheConfig);
12
- isConfigured(): boolean;
13
11
  set(options: CacheOptions): Promise<boolean>;
14
12
  get<T = any>(key: string): Promise<T | null>;
15
13
  remove(key: string): Promise<boolean>;
16
14
  clear(): Promise<boolean>;
17
- private isValidBaseURL;
18
15
  }
@@ -1 +0,0 @@
1
- export * from './line-item-recurrence.mapper';
@@ -1,5 +0,0 @@
1
- import { ShoppingRecurrenceCycle } from '../models/enums/shopping-recurrence-cycle.enum';
2
- import { LineItem } from '../models/line-item';
3
- import { LineItemRecurrence } from '../models/types/line-item-recurrence.type';
4
- export declare function toLineItemRecurrence(item: LineItem): LineItemRecurrence;
5
- export declare function groupRecurringLineItemsByCycle(items: LineItem[]): Map<ShoppingRecurrenceCycle, LineItemRecurrence[]>;
@@ -1,35 +0,0 @@
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,2 +0,0 @@
1
- import { CacheConfig } from '../../domain/generic/repository/types/repository-cache-options.type';
2
- export declare function resolveCacheConfig(cache: unknown): CacheConfig | undefined;