@agenus-io/webhook-centralizer 1.0.12 → 1.0.13
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/dist/Class/index.js
CHANGED
|
@@ -47,7 +47,7 @@ class WebhookCentralizerSDK {
|
|
|
47
47
|
constructor(appId, appToken, environment = "production") {
|
|
48
48
|
this.appId = appId;
|
|
49
49
|
this.appToken = appToken;
|
|
50
|
-
this.apiUrl = environment === "production" ? "
|
|
50
|
+
this.apiUrl = environment === "production" ? "https://service-webhook-develop.up.railway.app" : "https://service-webhook-develop.up.railway.app";
|
|
51
51
|
}
|
|
52
52
|
async Create({ workSpaceId, ...data }) {
|
|
53
53
|
try {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { webhookCentralizerPlatform } from '../types';
|
|
2
|
+
import type { ICentralizedSale, ICentralizedProduct, ICentralizedAffiliate, ICentralizedCoproducer, ICentralizedCustomer, ICentralizedUTM, ICentralizedSubscription, ICentralizedCommission, ICentralizedPlan, ICentralizedInterval, ICentralizeSubscriptionEvent } from "./schemas";
|
|
3
|
+
export declare const centralizeConfiguredPlatforms: webhookCentralizerPlatform[];
|
|
4
|
+
export declare const centralizeOrderLinkedUpsell: webhookCentralizerPlatform[];
|
|
5
|
+
export type ICentralizedEvents = "SALE" | "ABANDONED_CART" | "SUBSCRIPTION";
|
|
6
|
+
export interface ICentralizedSaleDTO {
|
|
7
|
+
sale: ICentralizedSale;
|
|
8
|
+
country?: string;
|
|
9
|
+
products: ICentralizedProduct[];
|
|
10
|
+
affiliate?: ICentralizedAffiliate;
|
|
11
|
+
coproducer?: ICentralizedCoproducer[];
|
|
12
|
+
commissions: ICentralizedCommission[];
|
|
13
|
+
customer: ICentralizedCustomer;
|
|
14
|
+
utm?: ICentralizedUTM;
|
|
15
|
+
subscription?: ICentralizedSubscription[];
|
|
16
|
+
}
|
|
17
|
+
export interface ICentralizedAbandonedCartDTO {
|
|
18
|
+
products: ICentralizedProduct[];
|
|
19
|
+
value?: number;
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
country?: string;
|
|
22
|
+
customer: ICentralizedCustomer;
|
|
23
|
+
affiliate?: ICentralizedAffiliate;
|
|
24
|
+
utm?: ICentralizedUTM;
|
|
25
|
+
}
|
|
26
|
+
export interface ICentralizedSubscriptionDTO {
|
|
27
|
+
status: ICentralizeSubscriptionEvent;
|
|
28
|
+
externalId: string;
|
|
29
|
+
cycle?: number;
|
|
30
|
+
isRenewal?: boolean;
|
|
31
|
+
startAt?: Date;
|
|
32
|
+
endAt?: Date;
|
|
33
|
+
plan: ICentralizedPlan;
|
|
34
|
+
interval?: ICentralizedInterval;
|
|
35
|
+
intervalCount?: number;
|
|
36
|
+
products: ICentralizedProduct[];
|
|
37
|
+
customer: ICentralizedCustomer;
|
|
38
|
+
utm?: ICentralizedUTM;
|
|
39
|
+
canceledAt?: Date;
|
|
40
|
+
}
|
|
41
|
+
export type webhookCentralizerBody = ICentralizedSaleDTO[] | ICentralizedSubscriptionDTO | ICentralizedAbandonedCartDTO;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.centralizeOrderLinkedUpsell = exports.centralizeConfiguredPlatforms = void 0;
|
|
4
|
+
exports.centralizeConfiguredPlatforms = ["DIGISTORE"];
|
|
5
|
+
exports.centralizeOrderLinkedUpsell = ["CARTPANDA"];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type ICentralizedCurrency = "BRL" | "EUR" | "USD" | "MXN" | "ZAR" | "AUD" | "CAD" | "NZD" | "COP";
|
|
2
|
+
export type ICentralizedSaleType = "RECURRENT" | "UNIQUE";
|
|
3
|
+
export type ICentralizedOrderStatus = "PENDING" | "PAID" | "CANCELED" | "EXPIRED" | "REFUNDED" | "CHARGEBACK" | "SUBSCRIPTION_INITIATED" | "SUBSCRIPTION_RENEWED" | "SUBSCRIPTION_CANCELED";
|
|
4
|
+
export type ICentralizedSaleStatus = "PENDING" | "PAID" | "CANCELED" | "EXPIRED" | "REFUNDED" | "CHARGEBACK";
|
|
5
|
+
export type ICentralizeSubscriptionEvent = "PAID" | "PENDING" | "SUBSCRIPTION_INITIATED" | "SUBSCRIPTION_RENEWED" | "SUBSCRIPTION_PENDING" | "SUBSCRIPTION_RENEWAL_CANCELLED" | "SUBSCRIPTION_RENEWAL_RESUMED" | "SUBSCRIPTION_EXPIRED";
|
|
6
|
+
export type ICentralizedPaymentMethod = "PIX" | "CREDIT_CARD" | "BOLETO" | "CASH_ON_DELIVERY" | "CASH_PAYMENT" | "PAY_PAL" | "DIRECT_BANK_TRANSFER" | "DIRECT_DEBIT" | "FREE" | "GOOGLE_PAY" | "HOT_CARD" | "HYBRID" | "MANUAL_TRANSFER" | "PIC_PAY" | "SAMSUNG_PAY" | "FINANCED_BILLET" | "FINANCED_INSTALLMENT" | "WALLET" | "APPLE_PAY" | "OTHER";
|
|
7
|
+
export type ICentralizedCommissionRole = "OWNER" | "AFFILIATE" | "COPRODUCER" | "MARKETPLACE" | "OTHER";
|
|
8
|
+
export type ICentralizedInterval = "DAY" | "WEEK" | "MONTH" | "YEAR";
|
|
9
|
+
export type ICentralizedSale = {
|
|
10
|
+
parentSale?: string;
|
|
11
|
+
orderId: string;
|
|
12
|
+
isUpsell: boolean;
|
|
13
|
+
totalValue: number;
|
|
14
|
+
valueReceived: number;
|
|
15
|
+
valueReceivedCalculated: boolean;
|
|
16
|
+
postBackAffiliateValue?: number;
|
|
17
|
+
currency: ICentralizedCurrency;
|
|
18
|
+
checkoutUrl?: string | null;
|
|
19
|
+
installments: number;
|
|
20
|
+
type: ICentralizedSaleType;
|
|
21
|
+
status: ICentralizedOrderStatus;
|
|
22
|
+
paymentMethod: ICentralizedPaymentMethod;
|
|
23
|
+
paymentId?: string;
|
|
24
|
+
cardBrand?: string;
|
|
25
|
+
cardFirstSixDigits?: string;
|
|
26
|
+
cardLastFourDigits?: string;
|
|
27
|
+
paidAt?: Date;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
userDeviceInfo?: {
|
|
30
|
+
ip?: string | null;
|
|
31
|
+
userAgent?: string | null;
|
|
32
|
+
} | null;
|
|
33
|
+
urlUpsell?: string;
|
|
34
|
+
trackingCode?: string;
|
|
35
|
+
tenant?: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type ICentralizedCommission = {
|
|
41
|
+
role: ICentralizedCommissionRole;
|
|
42
|
+
value: number;
|
|
43
|
+
};
|
|
44
|
+
export type ICentralizedCustomer = {
|
|
45
|
+
externalId?: string;
|
|
46
|
+
name?: string | null;
|
|
47
|
+
email?: string | null;
|
|
48
|
+
phone?: string | null;
|
|
49
|
+
document?: string | null;
|
|
50
|
+
address?: {
|
|
51
|
+
number?: string | number | null;
|
|
52
|
+
complement?: string | null;
|
|
53
|
+
district?: string | null;
|
|
54
|
+
city?: string | null;
|
|
55
|
+
state?: string | null;
|
|
56
|
+
country?: string | null;
|
|
57
|
+
zip?: string | null;
|
|
58
|
+
street?: string | null;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export type ICentralizedProduct = {
|
|
62
|
+
externalId: string;
|
|
63
|
+
name: string;
|
|
64
|
+
variations?: {
|
|
65
|
+
externalId: string;
|
|
66
|
+
name: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
export type ICentralizedAffiliate = {
|
|
70
|
+
id?: string;
|
|
71
|
+
name: string;
|
|
72
|
+
email?: string | null;
|
|
73
|
+
value?: number;
|
|
74
|
+
};
|
|
75
|
+
export type ICentralizedCoproducer = {
|
|
76
|
+
id?: string;
|
|
77
|
+
name: string;
|
|
78
|
+
email?: string | null;
|
|
79
|
+
value: number;
|
|
80
|
+
};
|
|
81
|
+
export type ICentralizedPlan = {
|
|
82
|
+
name: string;
|
|
83
|
+
value: number;
|
|
84
|
+
externalId?: string;
|
|
85
|
+
};
|
|
86
|
+
export type ICentralizedUTM = {
|
|
87
|
+
source?: string | null;
|
|
88
|
+
medium?: string | null;
|
|
89
|
+
campaign?: string | null;
|
|
90
|
+
content?: string | null;
|
|
91
|
+
term?: string | null;
|
|
92
|
+
cid?: string | null;
|
|
93
|
+
fbclid?: string | null;
|
|
94
|
+
fbc?: string | null;
|
|
95
|
+
fbp?: string | null;
|
|
96
|
+
gclid?: string | null;
|
|
97
|
+
};
|
|
98
|
+
export type ICentralizedSubscription = {
|
|
99
|
+
externalId: string;
|
|
100
|
+
isRenewal?: boolean;
|
|
101
|
+
cycle?: number;
|
|
102
|
+
startAt?: Date;
|
|
103
|
+
endAt?: Date;
|
|
104
|
+
plan?: ICentralizedPlan;
|
|
105
|
+
interval?: ICentralizedInterval;
|
|
106
|
+
intervalCount?: number;
|
|
107
|
+
isTest?: boolean;
|
|
108
|
+
productId?: string;
|
|
109
|
+
variationId?: string;
|
|
110
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@
|
|
|
7
7
|
export { WebhookCentralizerSDK } from "./Class";
|
|
8
8
|
export type { webhookCentralizerDispatchType, webhookCentralizerOrderStatus, webhookCentralizerPlatform, webhookCentralizerEvent, WebhookCentralizerEventEnum, WebhookCentralizerStatusEnum, WebhookCentralizerPlatformEnum, WebhookCentralizerDispatchTypeEnum, } from "./types";
|
|
9
9
|
export { WebhookCentralizerGetPlatformsSchema, WebhookCentralizerUpdatePlatformSchema, WebhookCentralizerCreatePlatformSchema, WebhookCentralizerGetPlatformWebhooksSchema, } from "./Schema";
|
|
10
|
+
export type { webhookCentralizerBody, ICentralizedSaleDTO, ICentralizedSubscriptionDTO, ICentralizedAbandonedCartDTO } from "./WebhookTypes";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { webhookCentralizerBody } from './WebhookTypes';
|
|
1
2
|
export type webhookCentralizerDispatchType = "WEBHOOK" | "POST_BACK";
|
|
2
3
|
export type webhookCentralizerPlatform = "BEMONY" | "B4YOU" | "BRAIP" | "CARTPANDA" | "NUTRALINK" | "HOTMART" | "KIRVANO" | "KIWIFY" | "LAST_LINK" | "PAYT" | "DIGISTORE";
|
|
3
4
|
export type webhookCentralizerOrderStatus = "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED";
|
|
@@ -6,3 +7,14 @@ export declare const WebhookCentralizerDispatchTypeEnum: Record<webhookCentraliz
|
|
|
6
7
|
export declare const WebhookCentralizerPlatformEnum: Record<webhookCentralizerPlatform, webhookCentralizerPlatform>;
|
|
7
8
|
export declare const WebhookCentralizerStatusEnum: Record<webhookCentralizerOrderStatus, webhookCentralizerOrderStatus>;
|
|
8
9
|
export declare const WebhookCentralizerEventEnum: Record<webhookCentralizerEvent, webhookCentralizerEvent>;
|
|
10
|
+
export type WebhookBody = {
|
|
11
|
+
type: "CENTRALIZER";
|
|
12
|
+
idExternal: string;
|
|
13
|
+
platformId: string;
|
|
14
|
+
platform: webhookCentralizerPlatform;
|
|
15
|
+
isPostBack: boolean;
|
|
16
|
+
event: webhookCentralizerEvent;
|
|
17
|
+
data: webhookCentralizerBody;
|
|
18
|
+
dispatchType: webhookCentralizerDispatchType;
|
|
19
|
+
workSpaceId: string;
|
|
20
|
+
};
|
package/package.json
CHANGED