@agenus-io/webhook-centralizer 1.0.1 → 1.0.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/dist/Class/index.d.ts +20 -0
- package/dist/Class/index.js +158 -197
- package/dist/Class/interface.d.ts +99 -0
- package/dist/Class/interface.js +1 -187
- package/dist/index.d.ts +8 -0
- package/dist/index.js +10 -25
- package/dist/types.d.ts +6 -0
- package/dist/types.js +25 -77
- package/package.json +1 -1
package/dist/Class/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ICreatePlatformDTO, IDeletePlatformDTO, IGetPlatformDTO, IGetPlatformWebhooksDTO, IUpdatePlatformDTO, IWebhookCentralizeSDK } from './interface';
|
|
2
|
+
/**
|
|
3
|
+
* Classe responsável pela centralização de webhooks de plataformas de pagamento e envio de webhooks para o microserviço de webhooks
|
|
4
|
+
*/
|
|
5
|
+
export declare class WebhookCentralizerSDK implements IWebhookCentralizeSDK {
|
|
6
|
+
private appId;
|
|
7
|
+
private appToken;
|
|
8
|
+
private apiUrl;
|
|
9
|
+
/**
|
|
10
|
+
* Constrói uma instância do SDK com as credenciais da aplicação
|
|
11
|
+
* @param appId ID da aplicação
|
|
12
|
+
* @param appToken Token da aplicação
|
|
13
|
+
*/
|
|
14
|
+
constructor(appId: string, appToken: string, environment?: "production" | "develop");
|
|
15
|
+
Create({ workSpaceId, ...data }: ICreatePlatformDTO.Params): Promise<ICreatePlatformDTO.Result>;
|
|
16
|
+
Update({ id, workSpaceId, ...data }: IUpdatePlatformDTO.Params): Promise<void>;
|
|
17
|
+
Delete({ id, workSpaceId }: IDeletePlatformDTO.Params): Promise<void>;
|
|
18
|
+
Get({ page, pageSize, filter, workSpaceId }: IGetPlatformDTO.Params): Promise<IGetPlatformDTO.Result>;
|
|
19
|
+
GetWebhooks({ id, page, pageSize, filter, workSpaceId }: IGetPlatformWebhooksDTO.Params): Promise<IGetPlatformWebhooksDTO.Result>;
|
|
20
|
+
}
|
package/dist/Class/index.js
CHANGED
|
@@ -1,198 +1,159 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// async UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void> {
|
|
161
|
-
// try {
|
|
162
|
-
// const token = {
|
|
163
|
-
// appId: this.appId,
|
|
164
|
-
// secretToken: this.appToken,
|
|
165
|
-
// workSpaceId: workspaceId,
|
|
166
|
-
// };
|
|
167
|
-
// await axios.post(`${this.apiUrl}/pixels/${id}/offer`, { token, offerIds, type });
|
|
168
|
-
// } catch (error) {
|
|
169
|
-
// if (error instanceof AxiosError) {
|
|
170
|
-
// console.log(error.response?.data);
|
|
171
|
-
// } else {
|
|
172
|
-
// console.log(error);
|
|
173
|
-
// }
|
|
174
|
-
// throw "Erro ao criar pixel";
|
|
175
|
-
// }
|
|
176
|
-
// }
|
|
177
|
-
// async Metrics({ workSpaceId, platform, productIds, offerIds, filter }: IMetricsDTO.Params): Promise<IMetricsDTO.Result> {
|
|
178
|
-
// try {
|
|
179
|
-
// const token = {
|
|
180
|
-
// appId: this.appId,
|
|
181
|
-
// secretToken: this.appToken,
|
|
182
|
-
// workSpaceId: workSpaceId,
|
|
183
|
-
// };
|
|
184
|
-
// const response = await axios.get<IMetricsDTO.Result>(`${this.apiUrl}/pixels/metrics`, {
|
|
185
|
-
// headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
186
|
-
// params: { platform, productIds, offerIds, filter },
|
|
187
|
-
// });
|
|
188
|
-
// return response.data;
|
|
189
|
-
// } catch (error) {
|
|
190
|
-
// if (error instanceof AxiosError) {
|
|
191
|
-
// console.log(error.response?.data);
|
|
192
|
-
// } else {
|
|
193
|
-
// console.log(error);
|
|
194
|
-
// }
|
|
195
|
-
// throw "Erro ao obter métricas";
|
|
196
|
-
// }
|
|
197
|
-
// }
|
|
198
|
-
// }
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WebhookCentralizerSDK = void 0;
|
|
37
|
+
const axios_1 = __importStar(require("axios"));
|
|
38
|
+
/**
|
|
39
|
+
* Classe responsável pela centralização de webhooks de plataformas de pagamento e envio de webhooks para o microserviço de webhooks
|
|
40
|
+
*/
|
|
41
|
+
class WebhookCentralizerSDK {
|
|
42
|
+
/**
|
|
43
|
+
* Constrói uma instância do SDK com as credenciais da aplicação
|
|
44
|
+
* @param appId ID da aplicação
|
|
45
|
+
* @param appToken Token da aplicação
|
|
46
|
+
*/
|
|
47
|
+
constructor(appId, appToken, environment = "production") {
|
|
48
|
+
this.appId = appId;
|
|
49
|
+
this.appToken = appToken;
|
|
50
|
+
this.apiUrl = environment === "production" ? "http://localhost:3333" : "http://localhost:3333";
|
|
51
|
+
}
|
|
52
|
+
async Create({ workSpaceId, ...data }) {
|
|
53
|
+
try {
|
|
54
|
+
const token = {
|
|
55
|
+
appId: this.appId,
|
|
56
|
+
secretToken: this.appToken,
|
|
57
|
+
workSpaceId,
|
|
58
|
+
};
|
|
59
|
+
const response = await axios_1.default.post(`${this.apiUrl}/platform`, { token, ...data });
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error instanceof axios_1.AxiosError) {
|
|
64
|
+
console.log(error.response?.data);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.log(error);
|
|
68
|
+
}
|
|
69
|
+
throw "Erro ao criar pixel";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async Update({ id, workSpaceId, ...data }) {
|
|
73
|
+
try {
|
|
74
|
+
const token = {
|
|
75
|
+
appId: this.appId,
|
|
76
|
+
secretToken: this.appToken,
|
|
77
|
+
workSpaceId,
|
|
78
|
+
};
|
|
79
|
+
await axios_1.default.put(`${this.apiUrl}/platform/${id}`, { token, ...data });
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error instanceof axios_1.AxiosError) {
|
|
83
|
+
console.log(error.response?.data);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.log(error);
|
|
87
|
+
}
|
|
88
|
+
throw "Erro ao atualizar pixel";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async Delete({ id, workSpaceId }) {
|
|
92
|
+
try {
|
|
93
|
+
const token = {
|
|
94
|
+
appId: this.appId,
|
|
95
|
+
secretToken: this.appToken,
|
|
96
|
+
workSpaceId,
|
|
97
|
+
};
|
|
98
|
+
await axios_1.default.delete(`${this.apiUrl}/platform/${id}`, {
|
|
99
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof axios_1.AxiosError) {
|
|
104
|
+
console.log(error.response?.data);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log(error);
|
|
108
|
+
}
|
|
109
|
+
throw "Erro ao deletar pixel";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async Get({ page, pageSize, filter, workSpaceId }) {
|
|
113
|
+
try {
|
|
114
|
+
const token = {
|
|
115
|
+
appId: this.appId,
|
|
116
|
+
secretToken: this.appToken,
|
|
117
|
+
workSpaceId,
|
|
118
|
+
};
|
|
119
|
+
const response = await axios_1.default.get(`${this.apiUrl}/platform`, {
|
|
120
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
121
|
+
params: { page, pageSize, filter },
|
|
122
|
+
});
|
|
123
|
+
return response.data;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (error instanceof axios_1.AxiosError) {
|
|
127
|
+
console.log(error.response?.data);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
console.log(error);
|
|
131
|
+
}
|
|
132
|
+
throw "Erro ao listar pixel";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async GetWebhooks({ id, page, pageSize, filter, workSpaceId }) {
|
|
136
|
+
try {
|
|
137
|
+
const token = {
|
|
138
|
+
appId: this.appId,
|
|
139
|
+
secretToken: this.appToken,
|
|
140
|
+
workSpaceId,
|
|
141
|
+
};
|
|
142
|
+
const response = await axios_1.default.get(`${this.apiUrl}/platform/${id}/webhooks`, {
|
|
143
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
144
|
+
params: { page, pageSize, filter },
|
|
145
|
+
});
|
|
146
|
+
return response.data;
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (error instanceof axios_1.AxiosError) {
|
|
150
|
+
console.log(error.response?.data);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
console.log(error);
|
|
154
|
+
}
|
|
155
|
+
throw "Erro ao listar webhooks";
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.WebhookCentralizerSDK = WebhookCentralizerSDK;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { webhookCentralizerOrderStatus, webhookCentralizerPlatform } from './../types';
|
|
2
|
+
import { webhookCentralizerDispatchType } from '../types';
|
|
3
|
+
interface ICreatePlatformDTO {
|
|
4
|
+
title: string;
|
|
5
|
+
platformToken: string;
|
|
6
|
+
dispatchType: webhookCentralizerDispatchType;
|
|
7
|
+
type: webhookCentralizerPlatform;
|
|
8
|
+
apiToken?: string;
|
|
9
|
+
meta?: Record<string, any>;
|
|
10
|
+
slug?: string;
|
|
11
|
+
workSpaceId: string;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace ICreatePlatformDTO {
|
|
14
|
+
type Params = ICreatePlatformDTO;
|
|
15
|
+
type Result = {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare namespace IUpdatePlatformDTO {
|
|
20
|
+
type Params = {
|
|
21
|
+
id: string;
|
|
22
|
+
workSpaceId: string;
|
|
23
|
+
} & Partial<ICreatePlatformDTO>;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace IDeletePlatformDTO {
|
|
26
|
+
type Params = {
|
|
27
|
+
id: string;
|
|
28
|
+
workSpaceId: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare namespace IGetPlatformDTO {
|
|
32
|
+
type Params = {
|
|
33
|
+
page: number;
|
|
34
|
+
pageSize: number;
|
|
35
|
+
filter?: string;
|
|
36
|
+
workSpaceId: string;
|
|
37
|
+
};
|
|
38
|
+
type Result = {
|
|
39
|
+
data: {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
status: boolean;
|
|
43
|
+
dispatchType: webhookCentralizerDispatchType;
|
|
44
|
+
type: webhookCentralizerPlatform;
|
|
45
|
+
apiToken: string | null;
|
|
46
|
+
slug: string | null;
|
|
47
|
+
url: string;
|
|
48
|
+
meta: Record<string, any> | null;
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
updatedAt: Date;
|
|
51
|
+
icon: {
|
|
52
|
+
id: string;
|
|
53
|
+
url: string;
|
|
54
|
+
size: number;
|
|
55
|
+
mimeType: string;
|
|
56
|
+
} | null;
|
|
57
|
+
amountAccepted: number;
|
|
58
|
+
amountRejected: number;
|
|
59
|
+
}[];
|
|
60
|
+
meta: {
|
|
61
|
+
total: number;
|
|
62
|
+
totalPages: number;
|
|
63
|
+
page: number;
|
|
64
|
+
pageSize: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export declare namespace IGetPlatformWebhooksDTO {
|
|
69
|
+
type Params = {
|
|
70
|
+
id: string;
|
|
71
|
+
page: number;
|
|
72
|
+
pageSize: number;
|
|
73
|
+
filter?: string;
|
|
74
|
+
workSpaceId: string;
|
|
75
|
+
};
|
|
76
|
+
type Result = {
|
|
77
|
+
data: {
|
|
78
|
+
id: string;
|
|
79
|
+
status: webhookCentralizerOrderStatus;
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
updatedAt: Date;
|
|
82
|
+
data: any;
|
|
83
|
+
};
|
|
84
|
+
meta: {
|
|
85
|
+
total: number;
|
|
86
|
+
totalPages: number;
|
|
87
|
+
page: number;
|
|
88
|
+
pageSize: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface IWebhookCentralizeSDK {
|
|
93
|
+
Create: (params: ICreatePlatformDTO.Params) => Promise<ICreatePlatformDTO.Result>;
|
|
94
|
+
Update: (params: IUpdatePlatformDTO.Params) => Promise<void>;
|
|
95
|
+
Delete: (params: IDeletePlatformDTO.Params) => Promise<void>;
|
|
96
|
+
Get: (params: IGetPlatformDTO.Params) => Promise<IGetPlatformDTO.Result>;
|
|
97
|
+
GetWebhooks: (params: IGetPlatformWebhooksDTO.Params) => Promise<IGetPlatformWebhooksDTO.Result>;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
package/dist/Class/interface.js
CHANGED
|
@@ -1,188 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
// interface CreatePixel {
|
|
4
|
-
// title: string;
|
|
5
|
-
// status: boolean;
|
|
6
|
-
// sendLead: boolean;
|
|
7
|
-
// sendLeadText?: string;
|
|
8
|
-
// addToCart: boolean;
|
|
9
|
-
// addToCartText?: string;
|
|
10
|
-
// addToCartDetection: PixelDetection;
|
|
11
|
-
// sendLeadDetection: PixelDetection;
|
|
12
|
-
// initiateCheckout: boolean;
|
|
13
|
-
// initiateCheckoutDetection: PixelDetection;
|
|
14
|
-
// initiateCheckoutDetectionText?: string;
|
|
15
|
-
// purchaseSendType: PurchaseSendType;
|
|
16
|
-
// purchaseValueType: PurchaseValueType;
|
|
17
|
-
// type: MarketingPlatform;
|
|
18
|
-
// productIds: string[];
|
|
19
|
-
// offerIds: string[];
|
|
20
|
-
// sendIp: SendIp;
|
|
21
|
-
// pixelMeta?: {
|
|
22
|
-
// id: string;
|
|
23
|
-
// title?: string;
|
|
24
|
-
// token: string;
|
|
25
|
-
// }[];
|
|
26
|
-
// pixelTikTok?: {
|
|
27
|
-
// id: string;
|
|
28
|
-
// title?: string;
|
|
29
|
-
// token: string;
|
|
30
|
-
// }[];
|
|
31
|
-
// pixelGoogle?: {
|
|
32
|
-
// id: string;
|
|
33
|
-
// title?: string;
|
|
34
|
-
// token: string;
|
|
35
|
-
// customerId: string;
|
|
36
|
-
// }[];
|
|
37
|
-
// pixelGoogleTags?: {
|
|
38
|
-
// id: string;
|
|
39
|
-
// title?: string;
|
|
40
|
-
// token: string;
|
|
41
|
-
// }[]
|
|
42
|
-
// }
|
|
43
|
-
// export namespace ICreatePixelDTO {
|
|
44
|
-
// export type Params = {
|
|
45
|
-
// workspaceId: string;
|
|
46
|
-
// data: CreatePixel;
|
|
47
|
-
// };
|
|
48
|
-
// export type Result = {
|
|
49
|
-
// id: string;
|
|
50
|
-
// };
|
|
51
|
-
// }
|
|
52
|
-
// export namespace IUpdatePixelDTO {
|
|
53
|
-
// export type Params = {
|
|
54
|
-
// id: string;
|
|
55
|
-
// workspaceId: string;
|
|
56
|
-
// data: Partial<CreatePixel>;
|
|
57
|
-
// };
|
|
58
|
-
// }
|
|
59
|
-
// export namespace IDeletePixelDTO {
|
|
60
|
-
// export type Params = {
|
|
61
|
-
// id: string;
|
|
62
|
-
// workspaceId: string;
|
|
63
|
-
// };
|
|
64
|
-
// }
|
|
65
|
-
// export namespace IGetPixelDTO {
|
|
66
|
-
// export type Params = {
|
|
67
|
-
// workSpaceId: string;
|
|
68
|
-
// page: number;
|
|
69
|
-
// pageSize: number;
|
|
70
|
-
// filter?: string;
|
|
71
|
-
// platform?: MarketingPlatform;
|
|
72
|
-
// productIds?: string[];
|
|
73
|
-
// offerIds?: string[];
|
|
74
|
-
// };
|
|
75
|
-
// export type Result = {
|
|
76
|
-
// data: {
|
|
77
|
-
// offerIds: string[];
|
|
78
|
-
// productIds: string[];
|
|
79
|
-
// id: string;
|
|
80
|
-
// code: string;
|
|
81
|
-
// title: string;
|
|
82
|
-
// createdAt: Date;
|
|
83
|
-
// status: boolean;
|
|
84
|
-
// type: MarketingPlatform;
|
|
85
|
-
// sendLead: boolean;
|
|
86
|
-
// sendLeadText: string | null;
|
|
87
|
-
// addToCart: boolean;
|
|
88
|
-
// addToCartText: string | null;
|
|
89
|
-
// initiateCheckout: boolean;
|
|
90
|
-
// initiateCheckoutDetection: PixelDetection;
|
|
91
|
-
// initiateCheckoutDetectionText: string | null;
|
|
92
|
-
// purchaseSendType: PurchaseSendType;
|
|
93
|
-
// purchaseValueType: PurchaseValueType;
|
|
94
|
-
// sendIp: SendIp;
|
|
95
|
-
// }[];
|
|
96
|
-
// meta: {
|
|
97
|
-
// total: number;
|
|
98
|
-
// totalPages: number;
|
|
99
|
-
// page: number;
|
|
100
|
-
// pageSize: number;
|
|
101
|
-
// };
|
|
102
|
-
// };
|
|
103
|
-
// }
|
|
104
|
-
// export namespace IGetOnePixelDTO {
|
|
105
|
-
// export type Params = {
|
|
106
|
-
// id: string;
|
|
107
|
-
// workSpaceId: string;
|
|
108
|
-
// };
|
|
109
|
-
// export type Result = {
|
|
110
|
-
// data: {
|
|
111
|
-
// productIds: string[];
|
|
112
|
-
// offerIds: string[];
|
|
113
|
-
// pixelGoogleTags: {
|
|
114
|
-
// id: string;
|
|
115
|
-
// title?: string;
|
|
116
|
-
// token: string;
|
|
117
|
-
// }[];
|
|
118
|
-
// pixelTikTok: {
|
|
119
|
-
// id: string;
|
|
120
|
-
// title?: string;
|
|
121
|
-
// token: string;
|
|
122
|
-
// externalId: string;
|
|
123
|
-
// }[];
|
|
124
|
-
// pixelGoogle: {
|
|
125
|
-
// id: true;
|
|
126
|
-
// title?: string;
|
|
127
|
-
// token: true;
|
|
128
|
-
// customerId: true;
|
|
129
|
-
// resourceName: true;
|
|
130
|
-
// }[];
|
|
131
|
-
// pixelMeta: {
|
|
132
|
-
// id: string;
|
|
133
|
-
// title?: string;
|
|
134
|
-
// token: string;
|
|
135
|
-
// externalId: string;
|
|
136
|
-
// }[];
|
|
137
|
-
// id: string;
|
|
138
|
-
// code: string;
|
|
139
|
-
// title: string;
|
|
140
|
-
// createdAt: Date;
|
|
141
|
-
// status: boolean;
|
|
142
|
-
// type: MarketingPlatform;
|
|
143
|
-
// sendLead: boolean;
|
|
144
|
-
// sendLeadText: string | null;
|
|
145
|
-
// addToCart: boolean;
|
|
146
|
-
// addToCartText: string | null;
|
|
147
|
-
// initiateCheckout: boolean;
|
|
148
|
-
// initiateCheckoutDetection: PixelDetection;
|
|
149
|
-
// initiateCheckoutDetectionText: string | null;
|
|
150
|
-
// purchaseSendType: PurchaseSendType;
|
|
151
|
-
// purchaseValueType: PurchaseValueType;
|
|
152
|
-
// sendIp: SendIp;
|
|
153
|
-
// } | null;
|
|
154
|
-
// };
|
|
155
|
-
// }
|
|
156
|
-
// export namespace IUpdateOffersDTO {
|
|
157
|
-
// export type Params = {
|
|
158
|
-
// id: string;
|
|
159
|
-
// type: "ADD" | "REMOVE";
|
|
160
|
-
// workspaceId: string;
|
|
161
|
-
// offerIds: string[];
|
|
162
|
-
// };
|
|
163
|
-
// }
|
|
164
|
-
// export namespace IMetricsDTO {
|
|
165
|
-
// export type Params = {
|
|
166
|
-
// workSpaceId: string;
|
|
167
|
-
// platform?: MarketingPlatform;
|
|
168
|
-
// productIds?: string[];
|
|
169
|
-
// offerIds?: string[];
|
|
170
|
-
// filter?: string;
|
|
171
|
-
// };
|
|
172
|
-
// export type Result = {
|
|
173
|
-
// metrics: {
|
|
174
|
-
// total: number;
|
|
175
|
-
// active: number;
|
|
176
|
-
// sendedEvents: number;
|
|
177
|
-
// };
|
|
178
|
-
// };
|
|
179
|
-
// }
|
|
180
|
-
// export interface IWebhookCentralizerSdk {
|
|
181
|
-
// Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
|
|
182
|
-
// Update(params: IUpdatePixelDTO.Params): Promise<void>;
|
|
183
|
-
// Delete(params: IDeletePixelDTO.Params): Promise<void>;
|
|
184
|
-
// Get(params: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
|
|
185
|
-
// GetOne(params: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
|
|
186
|
-
// UpdateOffers(params: IUpdateOffersDTO.Params): Promise<void>;
|
|
187
|
-
// Metrics(params: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
|
|
188
|
-
// }
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK para centralização de webhooks focado atualmente em plataformas de pagamentos
|
|
3
|
+
*
|
|
4
|
+
* Este pacote permite que aplicações clientes centralizem e processem
|
|
5
|
+
* webhooks de plataformas de pagamento através de uma fila AWS SQS.
|
|
6
|
+
*/
|
|
7
|
+
export { WebhookCentralizerSDK } from "./Class";
|
|
8
|
+
export type { webhookCentralizerDispatchType, webhookCentralizerPlatform, webhookCentralizerOrderStatus, WebhookCentralizerDispatchTypeEnum, WebhookCentralizerPlatformEnum, WebhookCentralizerStatusEnum, } from "./types";
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// MarketingPlatform,
|
|
13
|
-
// PurchaseEventType,
|
|
14
|
-
// PurchaseSendType,
|
|
15
|
-
// PurchaseValueType,
|
|
16
|
-
// SendIp,
|
|
17
|
-
// Order,
|
|
18
|
-
// } from "./types";
|
|
19
|
-
// export {
|
|
20
|
-
// PixelDetectionEnum,
|
|
21
|
-
// PurchaseValueTypeEnum,
|
|
22
|
-
// MarketingPlatformEnum,
|
|
23
|
-
// PurchaseEventTypeEnum,
|
|
24
|
-
// PurchaseSendTypeEnum,
|
|
25
|
-
// SendIpEnum,
|
|
26
|
-
// } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* SDK para centralização de webhooks focado atualmente em plataformas de pagamentos
|
|
4
|
+
*
|
|
5
|
+
* Este pacote permite que aplicações clientes centralizem e processem
|
|
6
|
+
* webhooks de plataformas de pagamento através de uma fila AWS SQS.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WebhookCentralizerSDK = void 0;
|
|
10
|
+
var Class_1 = require("./Class");
|
|
11
|
+
Object.defineProperty(exports, "WebhookCentralizerSDK", { enumerable: true, get: function () { return Class_1.WebhookCentralizerSDK; } });
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type webhookCentralizerDispatchType = "WEBHOOK" | "POST_BACK";
|
|
2
|
+
export type webhookCentralizerPlatform = "BEMONY" | "B4YOU" | "BRAIP" | "CARTPANDA" | "NUTRALINK" | "HOTMART" | "KIRVANO" | "KIWIFY" | "LAST_LINK" | "PAYT" | "DIGISTORE";
|
|
3
|
+
export type webhookCentralizerOrderStatus = "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED";
|
|
4
|
+
export declare const WebhookCentralizerDispatchTypeEnum: Record<webhookCentralizerDispatchType, webhookCentralizerDispatchType>;
|
|
5
|
+
export declare const WebhookCentralizerPlatformEnum: Record<webhookCentralizerPlatform, webhookCentralizerPlatform>;
|
|
6
|
+
export declare const WebhookCentralizerStatusEnum: Record<webhookCentralizerOrderStatus, webhookCentralizerOrderStatus>;
|
package/dist/types.js
CHANGED
|
@@ -1,78 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// export const SendIpEnum: Record<SendIp, SendIp> = {
|
|
28
|
-
// IPV6_AND_IPV4: "IPV6_AND_IPV4",
|
|
29
|
-
// ONLY_IPV6: "ONLY_IPV6",
|
|
30
|
-
// DONT_SEND: "DONT_SEND",
|
|
31
|
-
// } as const;
|
|
32
|
-
// export const MarketingPlatformEnum: Record<MarketingPlatform, MarketingPlatform> = {
|
|
33
|
-
// META: "META",
|
|
34
|
-
// GOOGLE: "GOOGLE",
|
|
35
|
-
// TIKTOK: "TIKTOK",
|
|
36
|
-
// } as const;
|
|
37
|
-
// export const PurchaseEventTypeEnum: Record<PurchaseEventType, PurchaseEventType> = {
|
|
38
|
-
// PURCHASE_PENDING: "PURCHASE_PENDING",
|
|
39
|
-
// PURCHASE_COMPLETED: "PURCHASE_COMPLETED",
|
|
40
|
-
// } as const;
|
|
41
|
-
// export interface CustomerData {
|
|
42
|
-
// email: string;
|
|
43
|
-
// externalId?: string;
|
|
44
|
-
// firstName: string;
|
|
45
|
-
// lastName: string;
|
|
46
|
-
// phone?: string;
|
|
47
|
-
// city?: string;
|
|
48
|
-
// state?: string;
|
|
49
|
-
// zipCode?: string;
|
|
50
|
-
// country?: string;
|
|
51
|
-
// ip?: string;
|
|
52
|
-
// userAgent?: string;
|
|
53
|
-
// }
|
|
54
|
-
// export interface ProductData {
|
|
55
|
-
// id: string;
|
|
56
|
-
// title: string;
|
|
57
|
-
// externalId: string;
|
|
58
|
-
// quantity: number;
|
|
59
|
-
// }
|
|
60
|
-
// export interface Order {
|
|
61
|
-
// dispatch: MarketingPlatform;
|
|
62
|
-
// event: PurchaseEventType;
|
|
63
|
-
// checkout: string;
|
|
64
|
-
// orderId: string;
|
|
65
|
-
// subscriptionId?: string;
|
|
66
|
-
// fbc?: string;
|
|
67
|
-
// fbp?: string;
|
|
68
|
-
// fbclid?: string;
|
|
69
|
-
// gclid?: string;
|
|
70
|
-
// gbraid?: string;
|
|
71
|
-
// wbraid?: string;
|
|
72
|
-
// currency: string;
|
|
73
|
-
// valueGross: number;
|
|
74
|
-
// valueNet: number;
|
|
75
|
-
// createdAt: Date;
|
|
76
|
-
// customer: CustomerData;
|
|
77
|
-
// products: ProductData[];
|
|
78
|
-
// }
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookCentralizerStatusEnum = exports.WebhookCentralizerPlatformEnum = exports.WebhookCentralizerDispatchTypeEnum = void 0;
|
|
4
|
+
exports.WebhookCentralizerDispatchTypeEnum = {
|
|
5
|
+
WEBHOOK: "WEBHOOK",
|
|
6
|
+
POST_BACK: "POST_BACK",
|
|
7
|
+
};
|
|
8
|
+
exports.WebhookCentralizerPlatformEnum = {
|
|
9
|
+
BEMONY: "BEMONY",
|
|
10
|
+
B4YOU: "B4YOU",
|
|
11
|
+
BRAIP: "BRAIP",
|
|
12
|
+
CARTPANDA: "CARTPANDA",
|
|
13
|
+
NUTRALINK: "NUTRALINK",
|
|
14
|
+
HOTMART: "HOTMART",
|
|
15
|
+
KIRVANO: "KIRVANO",
|
|
16
|
+
KIWIFY: "KIWIFY",
|
|
17
|
+
LAST_LINK: "LAST_LINK",
|
|
18
|
+
PAYT: "PAYT",
|
|
19
|
+
DIGISTORE: "DIGISTORE",
|
|
20
|
+
};
|
|
21
|
+
exports.WebhookCentralizerStatusEnum = {
|
|
22
|
+
PENDING: "PENDING",
|
|
23
|
+
PROCESSING: "PROCESSING",
|
|
24
|
+
COMPLETED: "COMPLETED",
|
|
25
|
+
FAILED: "FAILED",
|
|
26
|
+
};
|
package/package.json
CHANGED