@agenus-io/pixel-backend-sdk 1.0.19 → 1.0.20

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.
@@ -1,5 +1,5 @@
1
1
  import type { AWSConfig, SendSaleParams } from "../config";
2
- import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk } from './interface';
2
+ import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -27,4 +27,5 @@ export declare class PixelSDK implements IPixelSdk {
27
27
  Delete({ id, workspaceId }: IDeletePixelDTO.Params): Promise<void>;
28
28
  Get({ page, pageSize, filter, workSpaceId }: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
29
29
  GetOne({ id, workSpaceId }: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
30
+ UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void>;
30
31
  }
@@ -197,5 +197,24 @@ class PixelSDK {
197
197
  throw "Erro ao deletar pixel";
198
198
  }
199
199
  }
200
+ async UpdateOffers({ id, workspaceId, offerIds, type }) {
201
+ try {
202
+ const token = {
203
+ appId: this.appId,
204
+ secretToken: this.appToken,
205
+ workSpaceId: workspaceId,
206
+ };
207
+ await axios_1.default.post(`${this.apiUrl}/pixels/${id}/offer`, { token, offerIds, type });
208
+ }
209
+ catch (error) {
210
+ if (error instanceof axios_1.AxiosError) {
211
+ console.log(error.response?.data);
212
+ }
213
+ else {
214
+ console.log(error);
215
+ }
216
+ throw "Erro ao criar pixel";
217
+ }
218
+ }
200
219
  }
201
220
  exports.PixelSDK = PixelSDK;
@@ -13,6 +13,7 @@ interface CreatePixel {
13
13
  purchaseValueType: PurchaseValueType;
14
14
  type: MarketingPlatform;
15
15
  productIds: string[];
16
+ offerIds: string[];
16
17
  sendIp: SendIp;
17
18
  pixelMeta?: {
18
19
  id: string;
@@ -59,6 +60,7 @@ export declare namespace IGetPixelDTO {
59
60
  };
60
61
  type Result = {
61
62
  data: {
63
+ offerIds: string[];
62
64
  productIds: string[];
63
65
  id: string;
64
66
  code: string;
@@ -93,6 +95,7 @@ export declare namespace IGetOnePixelDTO {
93
95
  type Result = {
94
96
  data: {
95
97
  productIds: string[];
98
+ offerIds: string[];
96
99
  pixelTikTok: {
97
100
  id: string;
98
101
  title?: string;
@@ -133,11 +136,20 @@ export declare namespace IGetOnePixelDTO {
133
136
  } | null;
134
137
  };
135
138
  }
139
+ export declare namespace IUpdateOffersDTO {
140
+ type Params = {
141
+ id: string;
142
+ type: "ADD" | "REMOVE";
143
+ workspaceId: string;
144
+ offerIds: string[];
145
+ };
146
+ }
136
147
  export interface IPixelSdk {
137
148
  Create(params: ICreatePixelDTO.Params): Promise<void>;
138
149
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
139
150
  Delete(params: IDeletePixelDTO.Params): Promise<void>;
140
151
  Get(params: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
141
152
  GetOne(params: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
153
+ UpdateOffers(params: IUpdateOffersDTO.Params): Promise<void>;
142
154
  }
143
155
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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",