@infrab4a/connect 5.3.0-beta.30 → 5.3.0-beta.32
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 +333 -92
- package/index.esm.js +324 -74
- package/package.json +1 -1
- package/src/domain/shop-settings/models/shop-configs.d.ts +3 -12
- package/src/domain/shop-settings/models/types/antifraud-config.type.d.ts +21 -0
- package/src/domain/shop-settings/models/types/index.d.ts +1 -0
- package/src/domain/shop-settings/models/types/limit-orders.type.d.ts +3 -2
- package/src/domain/shopping/helpers/antifraud-enabled.helper.d.ts +8 -0
- package/src/domain/shopping/helpers/antifraud-volume-limits.helper.d.ts +6 -0
- package/src/domain/shopping/helpers/index.d.ts +2 -0
- package/src/domain/shopping/index.d.ts +1 -0
- package/src/domain/shopping/models/campaign-hashtag-posts.d.ts +23 -0
- package/src/domain/shopping/models/campaign-hashtag.d.ts +12 -10
- package/src/domain/shopping/models/checkout.d.ts +2 -0
- package/src/domain/shopping/models/coupons/coupon.d.ts +1 -0
- package/src/domain/shopping/models/index.d.ts +1 -0
- package/src/domain/shopping/models/line-item.d.ts +4 -0
- package/src/domain/shopping/models/order.d.ts +1 -0
- package/src/domain/shopping/models/shipping-method.d.ts +1 -0
- package/src/domain/shopping/models/types/line-item-recurrence.type.d.ts +1 -1
- package/src/domain/shopping/repositories/campaign-hashtag-posts.repository.d.ts +4 -0
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/services/antifraud-bankslip.service.d.ts +3 -1
- package/src/domain/shopping/services/antifraud-card.service.d.ts +6 -6
- package/src/domain/shopping/services/antifraud-glampoints.service.d.ts +4 -2
- package/src/domain/shopping/services/antifraud-pix.service.d.ts +4 -2
- package/src/domain/shopping/types/antifraud-card-validation.type.d.ts +40 -0
- package/src/domain/shopping/types/antifraud-volume-limits.type.d.ts +24 -0
- package/src/domain/shopping/types/create-recurrency-payload.type.d.ts +0 -2
- package/src/domain/shopping/types/index.d.ts +3 -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/campaign-hashtag-posts-firestore.repository.d.ts +8 -0
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/to-cents.d.ts +5 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ShopConfigsRepository } from '../../shop-settings';
|
|
2
|
+
export declare const ANTIFRAUD_CONFIG_CACHE_TTL_SECONDS = 60;
|
|
3
|
+
/**
|
|
4
|
+
* Lê `shopConfigs.antifraude.enabled`.
|
|
5
|
+
* - `false` explícito → antifraude desligado
|
|
6
|
+
* - ausente / erro / inválido → `true` (mantém comportamento histórico)
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAntifraudEnabled(shopConfigsRepository?: ShopConfigsRepository): Promise<boolean>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ShopAntifraudConfig } from '../../shop-settings/models/types';
|
|
2
|
+
import { ResolvedAntifraudVolumeLimits } from '../types/antifraud-volume-limits.type';
|
|
3
|
+
/** Defaults de runtime (week.zip = Infinity). Usados só como fallback no checkout. */
|
|
4
|
+
export declare const DEFAULT_ANTIFRAUD_VOLUME_LIMITS: ResolvedAntifraudVolumeLimits;
|
|
5
|
+
/** Config inválida/ausente → fallback (comportamento histórico). */
|
|
6
|
+
export declare function resolveAntifraudVolumeLimits(antifraude: ShopAntifraudConfig | undefined | null): ResolvedAntifraudVolumeLimits;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseModel, GenericIdentifier } from '../../generic';
|
|
2
|
+
export declare class CampaignHashtagPosts extends BaseModel<CampaignHashtagPosts> {
|
|
3
|
+
id: string;
|
|
4
|
+
campaignId: string;
|
|
5
|
+
postUrl: string;
|
|
6
|
+
status: string;
|
|
7
|
+
approved: boolean;
|
|
8
|
+
rating: number;
|
|
9
|
+
personId: number;
|
|
10
|
+
personAccount: string;
|
|
11
|
+
postAnalysis: string;
|
|
12
|
+
postEvaluationDate?: Date;
|
|
13
|
+
consent?: boolean;
|
|
14
|
+
consentDate?: Date;
|
|
15
|
+
metadata: {
|
|
16
|
+
IPAddress: string;
|
|
17
|
+
UserAgent: string;
|
|
18
|
+
Platform: string;
|
|
19
|
+
};
|
|
20
|
+
createdAt?: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
static get identifiersFields(): GenericIdentifier[];
|
|
23
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier } from '../../generic';
|
|
2
2
|
export declare class CampaignHashtag extends BaseModel<CampaignHashtag> {
|
|
3
3
|
id: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
campaignReferCode?: string;
|
|
12
|
-
campaignDescription?: string;
|
|
4
|
+
active: boolean;
|
|
5
|
+
title: string;
|
|
6
|
+
hashtagCode: string;
|
|
7
|
+
image?: string;
|
|
8
|
+
minimumGlampoints: number;
|
|
9
|
+
maximumGlampoints: number;
|
|
10
|
+
description?: string;
|
|
13
11
|
startDate?: Date;
|
|
14
12
|
endDate?: Date;
|
|
15
|
-
|
|
13
|
+
steps?: string[];
|
|
16
14
|
rules?: string[];
|
|
15
|
+
postsToShowInHome?: number;
|
|
16
|
+
topPosts?: string[];
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
updatedAt?: Date;
|
|
17
19
|
static get identifiersFields(): GenericIdentifier[];
|
|
18
20
|
}
|
|
@@ -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
|
}
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
export * from './buy-2-win.repository';
|
|
2
2
|
export * from './campaign-dashboard.repository';
|
|
3
3
|
export * from './campaign-hashtag.repository';
|
|
4
|
+
export * from './campaign-hashtag-posts.repository';
|
|
4
5
|
export * from './checkout.repository';
|
|
5
6
|
export * from './coupon.repository';
|
|
6
7
|
export * from './legacy-order.repository';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { ShopConfigsRepository } from '../../shop-settings';
|
|
1
2
|
import { AntifraudProvider } from '../interfaces';
|
|
2
3
|
import { Checkout } from '../models';
|
|
3
4
|
import { OrderBlockedRepository } from '../repositories';
|
|
4
5
|
export declare class AntifraudBankSlipService implements AntifraudProvider {
|
|
5
6
|
private orderBlockedRepository;
|
|
7
|
+
private readonly shopConfigsRepository?;
|
|
6
8
|
private MAX_ORDER_VALUE;
|
|
7
|
-
constructor(orderBlockedRepository: OrderBlockedRepository);
|
|
9
|
+
constructor(orderBlockedRepository: OrderBlockedRepository, shopConfigsRepository?: ShopConfigsRepository);
|
|
8
10
|
validate(checkout: Checkout): Promise<Boolean>;
|
|
9
11
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { ShopConfigsRepository } from '../../shop-settings';
|
|
2
|
+
import { DEFAULT_ANTIFRAUD_VOLUME_LIMITS, resolveAntifraudVolumeLimits } from '../helpers';
|
|
1
3
|
import { AntifraudProvider } from '../interfaces';
|
|
2
4
|
import { Checkout } from '../models';
|
|
3
5
|
import { OrderBlockedRepository, OrderRepository } from '../repositories';
|
|
4
6
|
import { PaymentCardInfo } from '../types';
|
|
7
|
+
export { DEFAULT_ANTIFRAUD_VOLUME_LIMITS, resolveAntifraudVolumeLimits };
|
|
5
8
|
export declare class AntifraudCardService implements AntifraudProvider {
|
|
6
9
|
private readonly orderRepository;
|
|
7
10
|
private readonly orderBlockedRepository;
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
private LIMIT_BLOCKED_ORDERS_DAY;
|
|
11
|
-
constructor(orderRepository: OrderRepository, orderBlockedRepository: OrderBlockedRepository);
|
|
11
|
+
private readonly shopConfigsRepository?;
|
|
12
|
+
constructor(orderRepository: OrderRepository, orderBlockedRepository: OrderBlockedRepository, shopConfigsRepository?: ShopConfigsRepository);
|
|
12
13
|
validate(checkout: Checkout, card: PaymentCardInfo): Promise<Boolean>;
|
|
13
|
-
private
|
|
14
|
-
private getLimitsByUserType;
|
|
14
|
+
private loadResolvedLimits;
|
|
15
15
|
private validateBlockedOrderAttempts;
|
|
16
16
|
private validateDayAndWeekOrderLimits;
|
|
17
17
|
private verifyBlockedOrderAttempts;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ShopConfigsRepository } from '../../shop-settings';
|
|
1
2
|
import { AntifraudProvider } from '../interfaces';
|
|
2
3
|
import { Checkout } from '../models';
|
|
3
4
|
export declare class AntifraudGlampointsService implements AntifraudProvider {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
private readonly shopConfigsRepository?;
|
|
6
|
+
constructor(shopConfigsRepository?: ShopConfigsRepository);
|
|
7
|
+
validate(checkout: Checkout): Promise<Boolean>;
|
|
6
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ShopConfigsRepository } from '../../shop-settings';
|
|
1
2
|
import { AntifraudProvider } from '../interfaces';
|
|
2
3
|
import { Checkout } from '../models';
|
|
3
4
|
export declare class AntifraudPixService implements AntifraudProvider {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
private readonly shopConfigsRepository?;
|
|
6
|
+
constructor(shopConfigsRepository?: ShopConfigsRepository);
|
|
7
|
+
validate(checkout: Checkout): Promise<boolean>;
|
|
6
8
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Checkout } from '../models';
|
|
2
|
+
import { PaymentCardInfo } from './payment-card-info.type';
|
|
3
|
+
import { AntifraudRuntimeLimitOrders } from './antifraud-volume-limits.type';
|
|
4
|
+
export type AntifraudValidationParams = {
|
|
5
|
+
cpf: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone: string;
|
|
8
|
+
zip: string;
|
|
9
|
+
card: PaymentCardInfo;
|
|
10
|
+
};
|
|
11
|
+
export type AntifraudDateRange = {
|
|
12
|
+
firstDate: number;
|
|
13
|
+
lastDate: number;
|
|
14
|
+
};
|
|
15
|
+
export type AntifraudOrderCounts = {
|
|
16
|
+
cpf: number;
|
|
17
|
+
email: number;
|
|
18
|
+
phone: number;
|
|
19
|
+
zip: number;
|
|
20
|
+
card?: number;
|
|
21
|
+
};
|
|
22
|
+
export type AntifraudBlockedOrderRecordParams = {
|
|
23
|
+
checkout: Checkout;
|
|
24
|
+
card: PaymentCardInfo | null;
|
|
25
|
+
reason: string;
|
|
26
|
+
key: string;
|
|
27
|
+
period: string;
|
|
28
|
+
};
|
|
29
|
+
export type AntifraudOrderLimitCheckParams = {
|
|
30
|
+
checkout: Checkout;
|
|
31
|
+
orderCounts: AntifraudOrderCounts;
|
|
32
|
+
limit: AntifraudRuntimeLimitOrders;
|
|
33
|
+
period: string;
|
|
34
|
+
};
|
|
35
|
+
export type AntifraudOrderFieldQueryParams = {
|
|
36
|
+
property: string;
|
|
37
|
+
field: string;
|
|
38
|
+
value: unknown;
|
|
39
|
+
range: AntifraudDateRange;
|
|
40
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Limites resolvidos em runtime (zip semanal pode ser Infinity). */
|
|
2
|
+
export type AntifraudRuntimeLimitOrders = {
|
|
3
|
+
cpf: number;
|
|
4
|
+
email: number;
|
|
5
|
+
phone: number;
|
|
6
|
+
zip: number;
|
|
7
|
+
card: number;
|
|
8
|
+
};
|
|
9
|
+
export type ResolvedAntifraudVolumeLimits = {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
source: 'config' | 'fallback';
|
|
12
|
+
day: {
|
|
13
|
+
subscriber: AntifraudRuntimeLimitOrders;
|
|
14
|
+
nonSubscriber: AntifraudRuntimeLimitOrders;
|
|
15
|
+
};
|
|
16
|
+
week: {
|
|
17
|
+
subscriber: AntifraudRuntimeLimitOrders;
|
|
18
|
+
nonSubscriber: AntifraudRuntimeLimitOrders;
|
|
19
|
+
};
|
|
20
|
+
blockedAttemptsDay: {
|
|
21
|
+
subscriber: number;
|
|
22
|
+
nonSubscriber: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './adyen-card.type';
|
|
2
2
|
export * from './adyen-credentials.type';
|
|
3
|
+
export * from './antifraud-card-validation.type';
|
|
3
4
|
export * from './antifraud-provider.type';
|
|
5
|
+
export * from './antifraud-volume-limits.type';
|
|
4
6
|
export * from './card-info.type';
|
|
5
7
|
export * from './checkout-paylod-request.type';
|
|
6
8
|
export * from './checkout-response.type';
|
|
@@ -18,3 +20,4 @@ export * from './payment-method.type';
|
|
|
18
20
|
export * from './payment-provider.type';
|
|
19
21
|
export * from './shipping-method-response.type';
|
|
20
22
|
export * from './shipping-product-request.type';
|
|
23
|
+
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
|
+
};
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CampaignHashtagPosts } from '../../../../../domain/shopping/models/campaign-hashtag-posts';
|
|
2
|
+
import { CampaignHashtagPostsRepository } from '../../../../../domain/shopping/repositories/campaign-hashtag-posts.repository';
|
|
3
|
+
import { FirestoreConstructorParams } from '../../mixins';
|
|
4
|
+
declare const CampaignHashtagPostsFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<CampaignHashtagPosts> & import("../../../../..").CrudRepository<CampaignHashtagPosts, import("../../../../..").CrudParams<CampaignHashtagPosts>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<CampaignHashtagPosts>, ...any[]]>;
|
|
5
|
+
export declare class CampaignHashtagPostsFirestoreRepository extends CampaignHashtagPostsFirestoreRepository_base implements CampaignHashtagPostsRepository {
|
|
6
|
+
constructor({ firestore, interceptors, cache, }: Pick<FirestoreConstructorParams<CampaignHashtagPosts>, 'firestore' | 'interceptors' | 'cache'>);
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './buy-2-win-firestore.repository';
|
|
2
2
|
export * from './campaign-dashboard-firestore.repository';
|
|
3
3
|
export * from './campaign-hashtag-firestore.repository';
|
|
4
|
+
export * from './campaign-hashtag-posts-firestore.repository';
|
|
4
5
|
export * from './checkout-firestore.repository';
|
|
5
6
|
export * from './checkout-subscription-firestore.repository';
|
|
6
7
|
export * from './coupon-firestore.repository';
|
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, };
|