@agenus-io/pixel-backend-sdk 1.1.0 → 1.1.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/README.md CHANGED
@@ -207,9 +207,9 @@ type PurchaseSendType = "SALES_APPROVED" | "SALES_APPROVED_AND_PENDING";
207
207
  type PurchaseValueType = "SALE_VALUE" | "COMMISSION";
208
208
  ```
209
209
 
210
- ### `InitiateCheckoutDetection`
210
+ ### `PixelDetection`
211
211
  ```typescript
212
- type InitiateCheckoutDetection = "AUTOMATIC" | "CONTAINS_TEXT" | "CONTAINS_CSS" | "CONTAINS_URL";
212
+ type PixelDetection = "AUTOMATIC" | "CONTAINS_TEXT" | "CONTAINS_CSS" | "CONTAINS_URL";
213
213
  ```
214
214
 
215
215
  ### `SendIp`
@@ -1,5 +1,5 @@
1
1
  import type { AWSConfig, SendSaleParams } from "../config";
2
- import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO } from './interface';
2
+ import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO, IFunilSummaryDTO } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -29,4 +29,5 @@ export declare class PixelSDK implements IPixelSdk {
29
29
  GetOne({ id, workSpaceId }: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
30
30
  UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void>;
31
31
  Metrics({ workSpaceId, platform, productIds, offerIds, filter }: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
32
+ FunilSummary({ workSpaceId, startDate, endDate, campaigns }: IFunilSummaryDTO.Params): Promise<IFunilSummaryDTO.Result>;
32
33
  }
@@ -240,5 +240,28 @@ class PixelSDK {
240
240
  throw "Erro ao obter métricas";
241
241
  }
242
242
  }
243
+ async FunilSummary({ workSpaceId, startDate, endDate, campaigns }) {
244
+ try {
245
+ const token = {
246
+ appId: this.appId,
247
+ secretToken: this.appToken,
248
+ workSpaceId: workSpaceId,
249
+ };
250
+ const response = await axios_1.default.get(`${this.apiUrl}/pixels/metrics/funil/summary`, {
251
+ headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
252
+ params: { startDate, endDate, campaigns },
253
+ });
254
+ return response.data;
255
+ }
256
+ catch (error) {
257
+ if (error instanceof axios_1.AxiosError) {
258
+ console.log(error.response?.data);
259
+ }
260
+ else {
261
+ console.log(error);
262
+ }
263
+ throw "Erro ao obter resumo da funil";
264
+ }
265
+ }
243
266
  }
244
267
  exports.PixelSDK = PixelSDK;
@@ -1,4 +1,4 @@
1
- import { InitiateCheckoutDetection, MarketingPlatform, PurchaseSendType, PurchaseValueType, SendIp } from '../types';
1
+ import { PixelDetection, MarketingPlatform, PurchaseSendType, PurchaseValueType, SendIp } from '../types';
2
2
  interface CreatePixel {
3
3
  title: string;
4
4
  status: boolean;
@@ -6,8 +6,10 @@ interface CreatePixel {
6
6
  sendLeadText?: string;
7
7
  addToCart: boolean;
8
8
  addToCartText?: string;
9
+ addToCartDetection: PixelDetection;
10
+ sendLeadDetection: PixelDetection;
9
11
  initiateCheckout: boolean;
10
- initiateCheckoutDetection: InitiateCheckoutDetection;
12
+ initiateCheckoutDetection: PixelDetection;
11
13
  initiateCheckoutDetectionText?: string;
12
14
  purchaseSendType: PurchaseSendType;
13
15
  purchaseValueType: PurchaseValueType;
@@ -84,7 +86,7 @@ export declare namespace IGetPixelDTO {
84
86
  addToCart: boolean;
85
87
  addToCartText: string | null;
86
88
  initiateCheckout: boolean;
87
- initiateCheckoutDetection: InitiateCheckoutDetection;
89
+ initiateCheckoutDetection: PixelDetection;
88
90
  initiateCheckoutDetectionText: string | null;
89
91
  purchaseSendType: PurchaseSendType;
90
92
  purchaseValueType: PurchaseValueType;
@@ -142,7 +144,7 @@ export declare namespace IGetOnePixelDTO {
142
144
  addToCart: boolean;
143
145
  addToCartText: string | null;
144
146
  initiateCheckout: boolean;
145
- initiateCheckoutDetection: InitiateCheckoutDetection;
147
+ initiateCheckoutDetection: PixelDetection;
146
148
  initiateCheckoutDetectionText: string | null;
147
149
  purchaseSendType: PurchaseSendType;
148
150
  purchaseValueType: PurchaseValueType;
@@ -174,6 +176,20 @@ export declare namespace IMetricsDTO {
174
176
  };
175
177
  };
176
178
  }
179
+ export declare namespace IFunilSummaryDTO {
180
+ type Params = {
181
+ workSpaceId: string;
182
+ startDate?: Date;
183
+ endDate?: Date;
184
+ campaigns: string[];
185
+ };
186
+ type Result = {
187
+ data: {
188
+ type: string;
189
+ _count: number;
190
+ }[];
191
+ };
192
+ }
177
193
  export interface IPixelSdk {
178
194
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
179
195
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -182,5 +198,6 @@ export interface IPixelSdk {
182
198
  GetOne(params: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
183
199
  UpdateOffers(params: IUpdateOffersDTO.Params): Promise<void>;
184
200
  Metrics(params: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
201
+ FunilSummary(params: IFunilSummaryDTO.Params): Promise<IFunilSummaryDTO.Result>;
185
202
  }
186
203
  export {};
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  */
7
7
  export type { AWSConfig, SendSaleParams } from "./config";
8
8
  export { PixelSDK } from "./Class";
9
- export type { InitiateCheckoutDetection, MarketingPlatform, PurchaseEventType, PurchaseSendType, PurchaseValueType, SendIp, Order, } from "./types";
10
- export { InitiateCheckoutDetectionEnum, PurchaseValueTypeEnum, MarketingPlatformEnum, PurchaseEventTypeEnum, PurchaseSendTypeEnum, SendIpEnum, } from "./types";
9
+ export type { PixelDetection, MarketingPlatform, PurchaseEventType, PurchaseSendType, PurchaseValueType, SendIp, Order, } from "./types";
10
+ export { PixelDetectionEnum, PurchaseValueTypeEnum, MarketingPlatformEnum, PurchaseEventTypeEnum, PurchaseSendTypeEnum, SendIpEnum, } from "./types";
package/dist/index.js CHANGED
@@ -6,11 +6,11 @@
6
6
  * para o micro-serviço de pixels através de uma fila AWS SQS.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SendIpEnum = exports.PurchaseSendTypeEnum = exports.PurchaseEventTypeEnum = exports.MarketingPlatformEnum = exports.PurchaseValueTypeEnum = exports.InitiateCheckoutDetectionEnum = exports.PixelSDK = void 0;
9
+ exports.SendIpEnum = exports.PurchaseSendTypeEnum = exports.PurchaseEventTypeEnum = exports.MarketingPlatformEnum = exports.PurchaseValueTypeEnum = exports.PixelDetectionEnum = exports.PixelSDK = void 0;
10
10
  var Class_1 = require("./Class");
11
11
  Object.defineProperty(exports, "PixelSDK", { enumerable: true, get: function () { return Class_1.PixelSDK; } });
12
12
  var types_1 = require("./types");
13
- Object.defineProperty(exports, "InitiateCheckoutDetectionEnum", { enumerable: true, get: function () { return types_1.InitiateCheckoutDetectionEnum; } });
13
+ Object.defineProperty(exports, "PixelDetectionEnum", { enumerable: true, get: function () { return types_1.PixelDetectionEnum; } });
14
14
  Object.defineProperty(exports, "PurchaseValueTypeEnum", { enumerable: true, get: function () { return types_1.PurchaseValueTypeEnum; } });
15
15
  Object.defineProperty(exports, "MarketingPlatformEnum", { enumerable: true, get: function () { return types_1.MarketingPlatformEnum; } });
16
16
  Object.defineProperty(exports, "PurchaseEventTypeEnum", { enumerable: true, get: function () { return types_1.PurchaseEventTypeEnum; } });
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export type InitiateCheckoutDetection = "AUTOMATIC" | "CLASS" | "ID" | "ATTRIBUTE" | "DATA_ATTRIBUTE" | "TAG" | "URL" | "CUSTOM" | "TEXT";
1
+ export type PixelDetection = "AUTOMATIC" | "CLASS" | "ID" | "ATTRIBUTE" | "DATA_ATTRIBUTE" | "TAG" | "URL" | "CUSTOM" | "TEXT";
2
2
  export type PurchaseSendType = "SALES_APPROVED" | "SALES_APPROVED_AND_PENDING";
3
3
  export type PurchaseEventType = "PURCHASE_PENDING" | "PURCHASE_COMPLETED";
4
4
  export type SendIp = "IPV6_AND_IPV4" | "ONLY_IPV6" | "DONT_SEND";
5
5
  export type MarketingPlatform = "GOOGLE" | "META" | "TIKTOK";
6
6
  export type PurchaseValueType = "SALE_VALUE" | "COMMISSION";
7
- export declare const InitiateCheckoutDetectionEnum: Record<InitiateCheckoutDetection, InitiateCheckoutDetection>;
7
+ export declare const PixelDetectionEnum: Record<PixelDetection, PixelDetection>;
8
8
  export declare const PurchaseSendTypeEnum: Record<PurchaseSendType, PurchaseSendType>;
9
9
  export declare const PurchaseValueTypeEnum: Record<PurchaseValueType, PurchaseValueType>;
10
10
  export declare const SendIpEnum: Record<SendIp, SendIp>;
package/dist/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PurchaseEventTypeEnum = exports.MarketingPlatformEnum = exports.SendIpEnum = exports.PurchaseValueTypeEnum = exports.PurchaseSendTypeEnum = exports.InitiateCheckoutDetectionEnum = void 0;
4
- exports.InitiateCheckoutDetectionEnum = {
3
+ exports.PurchaseEventTypeEnum = exports.MarketingPlatformEnum = exports.SendIpEnum = exports.PurchaseValueTypeEnum = exports.PurchaseSendTypeEnum = exports.PixelDetectionEnum = void 0;
4
+ exports.PixelDetectionEnum = {
5
5
  AUTOMATIC: "AUTOMATIC",
6
6
  CLASS: "CLASS",
7
7
  ID: "ID",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "SDK para envio de vendas para fila AWS SQS do micro-serviço de pixels",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",