@infrab4a/connect 5.8.0-alpha.0 → 5.8.0-alpha.2
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 +127 -27
- package/index.esm.js +124 -9
- package/package.json +5 -4
- package/src/domain/catalog/models/category.d.ts +12 -0
- package/src/domain/shopping/models/line-item.d.ts +5 -0
- package/src/domain/shopping/models/order.d.ts +1 -0
- package/src/domain/shopping/models/recurrence/index.d.ts +1 -0
- package/src/domain/shopping/models/recurrence/shopping-recurrence-error-log.d.ts +9 -0
- package/src/domain/shopping/models/types/line-item-recurrence.type.d.ts +1 -1
- package/src/domain/shopping/repositories/recurrence/index.d.ts +1 -0
- package/src/domain/shopping/repositories/recurrence/shopping-recurrence-error-log.repository.d.ts +4 -0
- package/src/domain/shopping/types/create-recurrency-payload.type.d.ts +0 -2
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/shopping-recurrence-update-payloads.type.d.ts +35 -0
- package/src/infra/cache/index.d.ts +1 -0
- package/src/infra/cache/resolve-cache-config.d.ts +2 -0
- package/src/infra/cache/restcache.adapter.d.ts +3 -0
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/shopping-recurrence-error-log-firestore.repository.d.ts +7 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/to-cents.d.ts +5 -0
package/index.cjs.js
CHANGED
|
@@ -16,25 +16,6 @@ var gqlQueryBuilder = require('gql-query-builder');
|
|
|
16
16
|
var firestore = require('firebase/firestore');
|
|
17
17
|
var storage = require('firebase/storage');
|
|
18
18
|
|
|
19
|
-
function _interopNamespaceDefault(e) {
|
|
20
|
-
var n = Object.create(null);
|
|
21
|
-
if (e) {
|
|
22
|
-
Object.keys(e).forEach(function (k) {
|
|
23
|
-
if (k !== 'default') {
|
|
24
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return e[k]; }
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
n.default = e;
|
|
33
|
-
return Object.freeze(n);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var serializeJavascript__namespace = /*#__PURE__*/_interopNamespaceDefault(serializeJavascript);
|
|
37
|
-
|
|
38
19
|
exports.AntifraudProviders = void 0;
|
|
39
20
|
(function (AntifraudProviders) {
|
|
40
21
|
AntifraudProviders["BANKSLIP"] = "bankSlip";
|
|
@@ -654,9 +635,22 @@ const deserialize = (data) => {
|
|
|
654
635
|
return eval('(' + data + ')');
|
|
655
636
|
};
|
|
656
637
|
const serialize = (data) => {
|
|
657
|
-
return
|
|
638
|
+
return serializeJavascript(data);
|
|
658
639
|
};
|
|
659
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Converts a BRL major-unit amount (e.g. 10.5) to integer cents (1050).
|
|
643
|
+
* Uses fixed 2-decimal normalization to avoid IEEE-754 artifacts like 19.99 * 100.
|
|
644
|
+
*/
|
|
645
|
+
function toCents(amount) {
|
|
646
|
+
if (!Number.isFinite(amount)) {
|
|
647
|
+
throw new Error(`Invalid amount: ${amount}`);
|
|
648
|
+
}
|
|
649
|
+
const sign = amount < 0 ? -1 : 1;
|
|
650
|
+
const [whole, fraction = '0'] = Math.abs(amount).toFixed(2).split('.');
|
|
651
|
+
return sign * (Number(whole) * 100 + Number(fraction));
|
|
652
|
+
}
|
|
653
|
+
|
|
660
654
|
class BaseModel {
|
|
661
655
|
get identifier() {
|
|
662
656
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -745,12 +739,36 @@ class Category extends BaseModel {
|
|
|
745
739
|
image: null,
|
|
746
740
|
};
|
|
747
741
|
}
|
|
742
|
+
get glamBeautyImages() {
|
|
743
|
+
return this.images?.[exports.Shops.GLAMBEAUTY]
|
|
744
|
+
? this.images[exports.Shops.GLAMBEAUTY]
|
|
745
|
+
: {
|
|
746
|
+
brandBanner: null,
|
|
747
|
+
brandBannerMobile: null,
|
|
748
|
+
image: null,
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
get ellaImages() {
|
|
752
|
+
return this.images?.[exports.Shops.ELLA]
|
|
753
|
+
? this.images[exports.Shops.ELLA]
|
|
754
|
+
: {
|
|
755
|
+
brandBanner: null,
|
|
756
|
+
brandBannerMobile: null,
|
|
757
|
+
image: null,
|
|
758
|
+
};
|
|
759
|
+
}
|
|
748
760
|
get glamMetadata() {
|
|
749
761
|
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
|
|
750
762
|
}
|
|
751
763
|
get mensMetadata() {
|
|
752
764
|
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
|
|
753
765
|
}
|
|
766
|
+
get glamBeautyMetadata() {
|
|
767
|
+
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMBEAUTY);
|
|
768
|
+
}
|
|
769
|
+
get ellaMetadata() {
|
|
770
|
+
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.ELLA);
|
|
771
|
+
}
|
|
754
772
|
getMostRelevantByShop(shop) {
|
|
755
773
|
return this.mostRelevants?.[shop] || [];
|
|
756
774
|
}
|
|
@@ -1764,6 +1782,12 @@ class ShoppingRecurrenceEdition extends BaseModel {
|
|
|
1764
1782
|
}
|
|
1765
1783
|
}
|
|
1766
1784
|
|
|
1785
|
+
class ShoppingRecurrenceErrorLog extends BaseModel {
|
|
1786
|
+
static get identifiersFields() {
|
|
1787
|
+
return ['id'];
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1767
1791
|
class CheckoutSubscription extends BaseModel {
|
|
1768
1792
|
static get identifiersFields() {
|
|
1769
1793
|
return ['id'];
|
|
@@ -2684,11 +2708,39 @@ class AdyenCardAxiosAdapter {
|
|
|
2684
2708
|
}
|
|
2685
2709
|
}
|
|
2686
2710
|
|
|
2711
|
+
function resolveCacheConfig(cache) {
|
|
2712
|
+
if (lodash.isNil(cache) || typeof cache !== 'object')
|
|
2713
|
+
return undefined;
|
|
2714
|
+
const candidate = cache;
|
|
2715
|
+
const cacheAdapter = candidate.cacheAdapter;
|
|
2716
|
+
if (!cacheAdapter)
|
|
2717
|
+
return undefined;
|
|
2718
|
+
if (!isCacheAdapter(cacheAdapter))
|
|
2719
|
+
return undefined;
|
|
2720
|
+
if (typeof cacheAdapter.isConfigured === 'function' && !cacheAdapter.isConfigured()) {
|
|
2721
|
+
return undefined;
|
|
2722
|
+
}
|
|
2723
|
+
return {
|
|
2724
|
+
cacheAdapter,
|
|
2725
|
+
ttlDefault: candidate.ttlDefault,
|
|
2726
|
+
};
|
|
2727
|
+
}
|
|
2728
|
+
function isCacheAdapter(adapter) {
|
|
2729
|
+
return (typeof adapter.get === 'function' &&
|
|
2730
|
+
typeof adapter.set === 'function' &&
|
|
2731
|
+
typeof adapter.remove === 'function' &&
|
|
2732
|
+
typeof adapter.clear === 'function');
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2687
2735
|
class RestCacheAdapter {
|
|
2688
2736
|
constructor(config) {
|
|
2737
|
+
this.client = null;
|
|
2689
2738
|
this.logger = new DebugHelper('RestCacheAdapter');
|
|
2739
|
+
this.configured = this.isValidBaseURL(config.baseURL);
|
|
2740
|
+
if (!this.configured)
|
|
2741
|
+
return;
|
|
2690
2742
|
this.client = axios.create({
|
|
2691
|
-
baseURL: config.baseURL,
|
|
2743
|
+
baseURL: config.baseURL.trim(),
|
|
2692
2744
|
headers: {
|
|
2693
2745
|
'Content-Type': 'application/json',
|
|
2694
2746
|
...(lodash.isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
|
|
@@ -2696,7 +2748,12 @@ class RestCacheAdapter {
|
|
|
2696
2748
|
},
|
|
2697
2749
|
});
|
|
2698
2750
|
}
|
|
2751
|
+
isConfigured() {
|
|
2752
|
+
return this.configured;
|
|
2753
|
+
}
|
|
2699
2754
|
async set(options) {
|
|
2755
|
+
if (!this.client)
|
|
2756
|
+
return false;
|
|
2700
2757
|
try {
|
|
2701
2758
|
const response = await this.client.post('/redis/set', {
|
|
2702
2759
|
key: options.key,
|
|
@@ -2712,6 +2769,8 @@ class RestCacheAdapter {
|
|
|
2712
2769
|
}
|
|
2713
2770
|
}
|
|
2714
2771
|
async get(key) {
|
|
2772
|
+
if (!this.client)
|
|
2773
|
+
return null;
|
|
2715
2774
|
try {
|
|
2716
2775
|
const response = await this.client.post('/redis/get', {
|
|
2717
2776
|
key,
|
|
@@ -2728,6 +2787,8 @@ class RestCacheAdapter {
|
|
|
2728
2787
|
}
|
|
2729
2788
|
}
|
|
2730
2789
|
async remove(key) {
|
|
2790
|
+
if (!this.client)
|
|
2791
|
+
return false;
|
|
2731
2792
|
try {
|
|
2732
2793
|
const response = await this.client.post('/redis/del', {
|
|
2733
2794
|
key,
|
|
@@ -2741,6 +2802,8 @@ class RestCacheAdapter {
|
|
|
2741
2802
|
}
|
|
2742
2803
|
}
|
|
2743
2804
|
async clear() {
|
|
2805
|
+
if (!this.client)
|
|
2806
|
+
return false;
|
|
2744
2807
|
try {
|
|
2745
2808
|
const response = await this.client.post('/redis/flushdb', {});
|
|
2746
2809
|
return response.data.success;
|
|
@@ -2751,6 +2814,9 @@ class RestCacheAdapter {
|
|
|
2751
2814
|
return false;
|
|
2752
2815
|
}
|
|
2753
2816
|
}
|
|
2817
|
+
isValidBaseURL(baseURL) {
|
|
2818
|
+
return lodash.isString(baseURL) && baseURL.trim().length > 0;
|
|
2819
|
+
}
|
|
2754
2820
|
}
|
|
2755
2821
|
|
|
2756
2822
|
class AxiosAdapter {
|
|
@@ -5576,6 +5642,18 @@ class ShoppingRecurrenceEditionFirestoreRepository extends withCrudFirestore(wit
|
|
|
5576
5642
|
}
|
|
5577
5643
|
}
|
|
5578
5644
|
|
|
5645
|
+
class ShoppingRecurrenceErrorLogFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5646
|
+
constructor({ firestore, interceptors, cache, }) {
|
|
5647
|
+
super({
|
|
5648
|
+
firestore,
|
|
5649
|
+
collectionName: 'shoppingRecurrenceErrorLogs',
|
|
5650
|
+
model: ShoppingRecurrenceErrorLog,
|
|
5651
|
+
interceptors,
|
|
5652
|
+
cache,
|
|
5653
|
+
});
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
|
|
5579
5657
|
class ShoppingRecurrenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5580
5658
|
constructor({ firestore, interceptors, cache, }) {
|
|
5581
5659
|
super({
|
|
@@ -6085,7 +6163,7 @@ function createHasuraGraphQLClass(MixinBase) {
|
|
|
6085
6163
|
this.model = options.model;
|
|
6086
6164
|
this.fields = options.fields || this.model.identifiersFields;
|
|
6087
6165
|
this.logger = DebugHelper.from(this);
|
|
6088
|
-
this.cache = options.cache;
|
|
6166
|
+
this.cache = resolveCacheConfig(options.cache);
|
|
6089
6167
|
}
|
|
6090
6168
|
get headers() {
|
|
6091
6169
|
return HasuraAuthHelper.buildHeaders(this.authOptions);
|
|
@@ -7112,6 +7190,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
7112
7190
|
mostRelevants: mostRelevants || {
|
|
7113
7191
|
[exports.Shops.GLAMSHOP]: null,
|
|
7114
7192
|
[exports.Shops.MENSMARKET]: null,
|
|
7193
|
+
[exports.Shops.GLAMBEAUTY]: null,
|
|
7194
|
+
[exports.Shops.ELLA]: null,
|
|
7115
7195
|
},
|
|
7116
7196
|
images: images || {
|
|
7117
7197
|
[exports.Shops.GLAMSHOP]: {
|
|
@@ -7124,6 +7204,16 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
7124
7204
|
brandBannerMobile: null,
|
|
7125
7205
|
image: null,
|
|
7126
7206
|
},
|
|
7207
|
+
[exports.Shops.GLAMBEAUTY]: {
|
|
7208
|
+
brandBanner: null,
|
|
7209
|
+
brandBannerMobile: null,
|
|
7210
|
+
image: null,
|
|
7211
|
+
},
|
|
7212
|
+
[exports.Shops.ELLA]: {
|
|
7213
|
+
brandBanner: null,
|
|
7214
|
+
brandBannerMobile: null,
|
|
7215
|
+
image: null,
|
|
7216
|
+
},
|
|
7127
7217
|
},
|
|
7128
7218
|
});
|
|
7129
7219
|
}
|
|
@@ -11071,9 +11161,9 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11071
11161
|
}
|
|
11072
11162
|
async refund(order, amount) {
|
|
11073
11163
|
try {
|
|
11074
|
-
console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
|
|
11075
|
-
const
|
|
11076
|
-
console.warn('[PAGARME REFUND] Amount to send in cents',
|
|
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);
|
|
11077
11167
|
const { data } = await axios({
|
|
11078
11168
|
method: 'DELETE',
|
|
11079
11169
|
url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
|
|
@@ -11082,7 +11172,7 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11082
11172
|
'Content-Type': 'application/json',
|
|
11083
11173
|
},
|
|
11084
11174
|
data: {
|
|
11085
|
-
amount:
|
|
11175
|
+
amount: amountInCents,
|
|
11086
11176
|
},
|
|
11087
11177
|
});
|
|
11088
11178
|
console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
|
|
@@ -11098,7 +11188,13 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11098
11188
|
});
|
|
11099
11189
|
return {
|
|
11100
11190
|
status: this.getRefundStatus(data.status),
|
|
11101
|
-
success: [
|
|
11191
|
+
success: [
|
|
11192
|
+
exports.PagarMeV5OrderStatus.Pago,
|
|
11193
|
+
exports.PagarMeV5OrderStatus.Cancelado,
|
|
11194
|
+
exports.PagarMeV5PaymentStatus['Em processamento'],
|
|
11195
|
+
].includes(data.status)
|
|
11196
|
+
? true
|
|
11197
|
+
: false,
|
|
11102
11198
|
};
|
|
11103
11199
|
}
|
|
11104
11200
|
catch (error) {
|
|
@@ -11757,6 +11853,8 @@ exports.ShopSettingsFirestoreRepository = ShopSettingsFirestoreRepository;
|
|
|
11757
11853
|
exports.ShoppingRecurrence = ShoppingRecurrence;
|
|
11758
11854
|
exports.ShoppingRecurrenceEdition = ShoppingRecurrenceEdition;
|
|
11759
11855
|
exports.ShoppingRecurrenceEditionFirestoreRepository = ShoppingRecurrenceEditionFirestoreRepository;
|
|
11856
|
+
exports.ShoppingRecurrenceErrorLog = ShoppingRecurrenceErrorLog;
|
|
11857
|
+
exports.ShoppingRecurrenceErrorLogFirestoreRepository = ShoppingRecurrenceErrorLogFirestoreRepository;
|
|
11760
11858
|
exports.ShoppingRecurrenceFirestoreRepository = ShoppingRecurrenceFirestoreRepository;
|
|
11761
11859
|
exports.SignOut = SignOut;
|
|
11762
11860
|
exports.StockLimitError = StockLimitError;
|
|
@@ -11798,8 +11896,10 @@ exports.isDebuggable = isDebuggable;
|
|
|
11798
11896
|
exports.isUUID = isUUID;
|
|
11799
11897
|
exports.parseDateTime = parseDateTime;
|
|
11800
11898
|
exports.registerClass = registerClass;
|
|
11899
|
+
exports.resolveCacheConfig = resolveCacheConfig;
|
|
11801
11900
|
exports.resolveClass = resolveClass;
|
|
11802
11901
|
exports.serialize = serialize;
|
|
11902
|
+
exports.toCents = toCents;
|
|
11803
11903
|
exports.withCreateFirestore = withCreateFirestore;
|
|
11804
11904
|
exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
|
|
11805
11905
|
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
|
|
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');
|
|
@@ -727,12 +740,36 @@ class Category extends BaseModel {
|
|
|
727
740
|
image: null,
|
|
728
741
|
};
|
|
729
742
|
}
|
|
743
|
+
get glamBeautyImages() {
|
|
744
|
+
return this.images?.[Shops.GLAMBEAUTY]
|
|
745
|
+
? this.images[Shops.GLAMBEAUTY]
|
|
746
|
+
: {
|
|
747
|
+
brandBanner: null,
|
|
748
|
+
brandBannerMobile: null,
|
|
749
|
+
image: null,
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
get ellaImages() {
|
|
753
|
+
return this.images?.[Shops.ELLA]
|
|
754
|
+
? this.images[Shops.ELLA]
|
|
755
|
+
: {
|
|
756
|
+
brandBanner: null,
|
|
757
|
+
brandBannerMobile: null,
|
|
758
|
+
image: null,
|
|
759
|
+
};
|
|
760
|
+
}
|
|
730
761
|
get glamMetadata() {
|
|
731
762
|
return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMSHOP);
|
|
732
763
|
}
|
|
733
764
|
get mensMetadata() {
|
|
734
765
|
return this.metadatas.find((metadata) => metadata.shop === Shops.MENSMARKET);
|
|
735
766
|
}
|
|
767
|
+
get glamBeautyMetadata() {
|
|
768
|
+
return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMBEAUTY);
|
|
769
|
+
}
|
|
770
|
+
get ellaMetadata() {
|
|
771
|
+
return this.metadatas.find((metadata) => metadata.shop === Shops.ELLA);
|
|
772
|
+
}
|
|
736
773
|
getMostRelevantByShop(shop) {
|
|
737
774
|
return this.mostRelevants?.[shop] || [];
|
|
738
775
|
}
|
|
@@ -1746,6 +1783,12 @@ class ShoppingRecurrenceEdition extends BaseModel {
|
|
|
1746
1783
|
}
|
|
1747
1784
|
}
|
|
1748
1785
|
|
|
1786
|
+
class ShoppingRecurrenceErrorLog extends BaseModel {
|
|
1787
|
+
static get identifiersFields() {
|
|
1788
|
+
return ['id'];
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1749
1792
|
class CheckoutSubscription extends BaseModel {
|
|
1750
1793
|
static get identifiersFields() {
|
|
1751
1794
|
return ['id'];
|
|
@@ -2666,11 +2709,39 @@ class AdyenCardAxiosAdapter {
|
|
|
2666
2709
|
}
|
|
2667
2710
|
}
|
|
2668
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
|
+
|
|
2669
2736
|
class RestCacheAdapter {
|
|
2670
2737
|
constructor(config) {
|
|
2738
|
+
this.client = null;
|
|
2671
2739
|
this.logger = new DebugHelper('RestCacheAdapter');
|
|
2740
|
+
this.configured = this.isValidBaseURL(config.baseURL);
|
|
2741
|
+
if (!this.configured)
|
|
2742
|
+
return;
|
|
2672
2743
|
this.client = axios.create({
|
|
2673
|
-
baseURL: config.baseURL,
|
|
2744
|
+
baseURL: config.baseURL.trim(),
|
|
2674
2745
|
headers: {
|
|
2675
2746
|
'Content-Type': 'application/json',
|
|
2676
2747
|
...(isNil(config.authToken) ? {} : { Authorization: `Bearer ${config.authToken}` }),
|
|
@@ -2678,7 +2749,12 @@ class RestCacheAdapter {
|
|
|
2678
2749
|
},
|
|
2679
2750
|
});
|
|
2680
2751
|
}
|
|
2752
|
+
isConfigured() {
|
|
2753
|
+
return this.configured;
|
|
2754
|
+
}
|
|
2681
2755
|
async set(options) {
|
|
2756
|
+
if (!this.client)
|
|
2757
|
+
return false;
|
|
2682
2758
|
try {
|
|
2683
2759
|
const response = await this.client.post('/redis/set', {
|
|
2684
2760
|
key: options.key,
|
|
@@ -2694,6 +2770,8 @@ class RestCacheAdapter {
|
|
|
2694
2770
|
}
|
|
2695
2771
|
}
|
|
2696
2772
|
async get(key) {
|
|
2773
|
+
if (!this.client)
|
|
2774
|
+
return null;
|
|
2697
2775
|
try {
|
|
2698
2776
|
const response = await this.client.post('/redis/get', {
|
|
2699
2777
|
key,
|
|
@@ -2710,6 +2788,8 @@ class RestCacheAdapter {
|
|
|
2710
2788
|
}
|
|
2711
2789
|
}
|
|
2712
2790
|
async remove(key) {
|
|
2791
|
+
if (!this.client)
|
|
2792
|
+
return false;
|
|
2713
2793
|
try {
|
|
2714
2794
|
const response = await this.client.post('/redis/del', {
|
|
2715
2795
|
key,
|
|
@@ -2723,6 +2803,8 @@ class RestCacheAdapter {
|
|
|
2723
2803
|
}
|
|
2724
2804
|
}
|
|
2725
2805
|
async clear() {
|
|
2806
|
+
if (!this.client)
|
|
2807
|
+
return false;
|
|
2726
2808
|
try {
|
|
2727
2809
|
const response = await this.client.post('/redis/flushdb', {});
|
|
2728
2810
|
return response.data.success;
|
|
@@ -2733,6 +2815,9 @@ class RestCacheAdapter {
|
|
|
2733
2815
|
return false;
|
|
2734
2816
|
}
|
|
2735
2817
|
}
|
|
2818
|
+
isValidBaseURL(baseURL) {
|
|
2819
|
+
return isString(baseURL) && baseURL.trim().length > 0;
|
|
2820
|
+
}
|
|
2736
2821
|
}
|
|
2737
2822
|
|
|
2738
2823
|
class AxiosAdapter {
|
|
@@ -5558,6 +5643,18 @@ class ShoppingRecurrenceEditionFirestoreRepository extends withCrudFirestore(wit
|
|
|
5558
5643
|
}
|
|
5559
5644
|
}
|
|
5560
5645
|
|
|
5646
|
+
class ShoppingRecurrenceErrorLogFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5647
|
+
constructor({ firestore, interceptors, cache, }) {
|
|
5648
|
+
super({
|
|
5649
|
+
firestore,
|
|
5650
|
+
collectionName: 'shoppingRecurrenceErrorLogs',
|
|
5651
|
+
model: ShoppingRecurrenceErrorLog,
|
|
5652
|
+
interceptors,
|
|
5653
|
+
cache,
|
|
5654
|
+
});
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
|
|
5561
5658
|
class ShoppingRecurrenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5562
5659
|
constructor({ firestore, interceptors, cache, }) {
|
|
5563
5660
|
super({
|
|
@@ -6067,7 +6164,7 @@ function createHasuraGraphQLClass(MixinBase) {
|
|
|
6067
6164
|
this.model = options.model;
|
|
6068
6165
|
this.fields = options.fields || this.model.identifiersFields;
|
|
6069
6166
|
this.logger = DebugHelper.from(this);
|
|
6070
|
-
this.cache = options.cache;
|
|
6167
|
+
this.cache = resolveCacheConfig(options.cache);
|
|
6071
6168
|
}
|
|
6072
6169
|
get headers() {
|
|
6073
6170
|
return HasuraAuthHelper.buildHeaders(this.authOptions);
|
|
@@ -7094,6 +7191,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
7094
7191
|
mostRelevants: mostRelevants || {
|
|
7095
7192
|
[Shops.GLAMSHOP]: null,
|
|
7096
7193
|
[Shops.MENSMARKET]: null,
|
|
7194
|
+
[Shops.GLAMBEAUTY]: null,
|
|
7195
|
+
[Shops.ELLA]: null,
|
|
7097
7196
|
},
|
|
7098
7197
|
images: images || {
|
|
7099
7198
|
[Shops.GLAMSHOP]: {
|
|
@@ -7106,6 +7205,16 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
7106
7205
|
brandBannerMobile: null,
|
|
7107
7206
|
image: null,
|
|
7108
7207
|
},
|
|
7208
|
+
[Shops.GLAMBEAUTY]: {
|
|
7209
|
+
brandBanner: null,
|
|
7210
|
+
brandBannerMobile: null,
|
|
7211
|
+
image: null,
|
|
7212
|
+
},
|
|
7213
|
+
[Shops.ELLA]: {
|
|
7214
|
+
brandBanner: null,
|
|
7215
|
+
brandBannerMobile: null,
|
|
7216
|
+
image: null,
|
|
7217
|
+
},
|
|
7109
7218
|
},
|
|
7110
7219
|
});
|
|
7111
7220
|
}
|
|
@@ -11053,9 +11162,9 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11053
11162
|
}
|
|
11054
11163
|
async refund(order, amount) {
|
|
11055
11164
|
try {
|
|
11056
|
-
console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
|
|
11057
|
-
const
|
|
11058
|
-
console.warn('[PAGARME REFUND] Amount to send in cents',
|
|
11165
|
+
console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment.payment_method, order.payment.amount, 'to refund with amount', amount);
|
|
11166
|
+
const amountInCents = toCents(amount);
|
|
11167
|
+
console.warn('[PAGARME REFUND] Amount to send in cents', amountInCents);
|
|
11059
11168
|
const { data } = await axios({
|
|
11060
11169
|
method: 'DELETE',
|
|
11061
11170
|
url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
|
|
@@ -11064,7 +11173,7 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11064
11173
|
'Content-Type': 'application/json',
|
|
11065
11174
|
},
|
|
11066
11175
|
data: {
|
|
11067
|
-
amount:
|
|
11176
|
+
amount: amountInCents,
|
|
11068
11177
|
},
|
|
11069
11178
|
});
|
|
11070
11179
|
console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
|
|
@@ -11080,7 +11189,13 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
11080
11189
|
});
|
|
11081
11190
|
return {
|
|
11082
11191
|
status: this.getRefundStatus(data.status),
|
|
11083
|
-
success: [
|
|
11192
|
+
success: [
|
|
11193
|
+
PagarMeV5OrderStatus.Pago,
|
|
11194
|
+
PagarMeV5OrderStatus.Cancelado,
|
|
11195
|
+
PagarMeV5PaymentStatus['Em processamento'],
|
|
11196
|
+
].includes(data.status)
|
|
11197
|
+
? true
|
|
11198
|
+
: false,
|
|
11084
11199
|
};
|
|
11085
11200
|
}
|
|
11086
11201
|
catch (error) {
|
|
@@ -11467,4 +11582,4 @@ class ProductsVertexSearch {
|
|
|
11467
11582
|
}
|
|
11468
11583
|
}
|
|
11469
11584
|
|
|
11470
|
-
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, 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 };
|
|
11585
|
+
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.8.0-alpha.
|
|
3
|
+
"version": "5.8.0-alpha.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
".": {
|
|
34
34
|
"module": "./index.esm.js",
|
|
35
35
|
"types": "./index.d.ts",
|
|
36
|
-
"import": "./index.
|
|
37
|
-
"default": "./index.
|
|
36
|
+
"import": "./index.esm.js",
|
|
37
|
+
"default": "./index.esm.js",
|
|
38
|
+
"require": "./index.cjs.js"
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
"module": "./index.esm.js",
|
|
41
42
|
"main": "./index.cjs.js",
|
|
42
43
|
"types": "./index.d.ts"
|
|
43
|
-
}
|
|
44
|
+
}
|
|
@@ -46,7 +46,19 @@ export declare class Category extends BaseModel<Category> {
|
|
|
46
46
|
brandBanner: string;
|
|
47
47
|
brandBannerMobile: string;
|
|
48
48
|
};
|
|
49
|
+
get glamBeautyImages(): {
|
|
50
|
+
image: string;
|
|
51
|
+
brandBanner: string;
|
|
52
|
+
brandBannerMobile: string;
|
|
53
|
+
};
|
|
54
|
+
get ellaImages(): {
|
|
55
|
+
image: string;
|
|
56
|
+
brandBanner: string;
|
|
57
|
+
brandBannerMobile: string;
|
|
58
|
+
};
|
|
49
59
|
get glamMetadata(): CategoryMetadata;
|
|
50
60
|
get mensMetadata(): CategoryMetadata;
|
|
61
|
+
get glamBeautyMetadata(): CategoryMetadata;
|
|
62
|
+
get ellaMetadata(): CategoryMetadata;
|
|
51
63
|
getMostRelevantByShop(shop: Shops): string[];
|
|
52
64
|
}
|
|
@@ -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;
|
|
@@ -6,5 +7,9 @@ export declare class LineItem extends Product {
|
|
|
6
7
|
pricePaid?: number;
|
|
7
8
|
discount?: number;
|
|
8
9
|
image?: string;
|
|
10
|
+
refunded?: boolean;
|
|
11
|
+
recurrenceCartItem?: boolean;
|
|
12
|
+
recurrenceCycle?: ShoppingRecurrenceCycle;
|
|
13
|
+
recurrenceDiscountPercentage?: number;
|
|
9
14
|
get pricePaidWithDiscount(): number;
|
|
10
15
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseModel, GenericIdentifier } from '../../../generic/model/base.model';
|
|
2
|
+
import { CreateShoppingRecurrencyPayload } from '../../types/create-recurrency-payload.type';
|
|
3
|
+
export declare class ShoppingRecurrenceErrorLog extends BaseModel<ShoppingRecurrenceErrorLog> {
|
|
4
|
+
id: string;
|
|
5
|
+
payload: CreateShoppingRecurrencyPayload;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
static get identifiersFields(): GenericIdentifier[];
|
|
9
|
+
}
|
|
@@ -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';
|
|
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
|
};
|
|
@@ -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
|
+
};
|
|
@@ -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
|
}
|
|
@@ -9,5 +9,6 @@ export * from './order-blocked-firestore.repository';
|
|
|
9
9
|
export * from './order-firestore.repository';
|
|
10
10
|
export * from './payment-firestore.repository';
|
|
11
11
|
export * from './shopping-recurrence-edition-firestore.repository';
|
|
12
|
+
export * from './shopping-recurrence-error-log-firestore.repository';
|
|
12
13
|
export * from './shopping-recurrence-firestore.repository';
|
|
13
14
|
export * from './subscription-plan-firestore.repository';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ShoppingRecurrenceErrorLog, ShoppingRecurrenceErrorLogRepository } from '../../../../../domain';
|
|
2
|
+
import { FirestoreConstructorParams } from '../../mixins';
|
|
3
|
+
declare const ShoppingRecurrenceErrorLogFirestoreRepository_base: import("../../../../..").MixinCtor<import("../..").FirestoreRepository<ShoppingRecurrenceErrorLog> & import("../../../../..").CrudRepository<ShoppingRecurrenceErrorLog, import("../../../../..").CrudParams<ShoppingRecurrenceErrorLog>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<ShoppingRecurrenceErrorLog>, ...any[]]>;
|
|
4
|
+
export declare class ShoppingRecurrenceErrorLogFirestoreRepository extends ShoppingRecurrenceErrorLogFirestoreRepository_base implements ShoppingRecurrenceErrorLogRepository {
|
|
5
|
+
constructor({ firestore, interceptors, cache, }: Pick<FirestoreConstructorParams<ShoppingRecurrenceErrorLog>, 'firestore' | 'interceptors' | 'cache'>);
|
|
6
|
+
}
|
|
7
|
+
export {};
|
package/src/utils/index.d.ts
CHANGED
|
@@ -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, };
|