@adtrackify/at-service-common 1.0.26 → 1.0.28

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/index.d.ts CHANGED
@@ -77,22 +77,21 @@ declare module '@adtrackify/at-service-common/clients/index' {
77
77
  }
78
78
  declare module '@adtrackify/at-service-common/clients/internal-api/accounts-client' {
79
79
  import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
80
+ import { Destination } from '@adtrackify/at-service-common/types/db/destination';
80
81
  export interface IsAuthorizedUserResponseData {
81
82
  isAccountUser: boolean;
82
83
  [key: string]: any;
83
84
  }
85
+ export interface PixelConfigResponseData {
86
+ id: string;
87
+ destinations: Destination[];
88
+ [key: string]: any;
89
+ }
84
90
  export class AccountsClient {
85
91
  BASE_API_URL: string;
86
- ACCOUNTS_API_KEY: string;
87
- constructor(baseApiUrl: string, accountsApiKey: string);
88
- getConfig: () => {
89
- baseURL: string;
90
- headers: {
91
- common: {
92
- 'x-api-key': string;
93
- };
94
- };
95
- };
92
+ ACCOUNTS_API_KEY?: string;
93
+ constructor(baseApiUrl: string, accountsApiKey?: string);
94
+ getConfig: () => any;
96
95
  getClient: () => Promise<{
97
96
  instance: () => import("axios").AxiosInstance;
98
97
  get: (url: string, config?: any) => Promise<{
@@ -123,6 +122,7 @@ declare module '@adtrackify/at-service-common/clients/internal-api/accounts-clie
123
122
  setBaseUrl: (url: string) => boolean;
124
123
  }>;
125
124
  isAuthorizedUser: (userId: string, accountId: string, pixelId: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
125
+ getPixelConfigById: (pixelId: string) => Promise<ApiResponse<PixelConfigResponseData>>;
126
126
  }
127
127
 
128
128
  }
@@ -187,6 +187,83 @@ declare module '@adtrackify/at-service-common/clients/internal-api/index' {
187
187
  export * from '@adtrackify/at-service-common/clients/internal-api/destinations-client';
188
188
  export * from '@adtrackify/at-service-common/clients/internal-api/accounts-client';
189
189
 
190
+ }
191
+ declare module '@adtrackify/at-service-common/clients/third-party/shopify-client' {
192
+ export class ShopifyClient {
193
+ getConfig: (shopifyDomain: string, accessToken: string) => {
194
+ baseURL: string;
195
+ headers: {
196
+ common: {
197
+ 'X-Shopify-Access-Token': string;
198
+ };
199
+ };
200
+ };
201
+ getClient: (shopifyDomain: string, accessToken: string) => {
202
+ instance: () => import("axios").AxiosInstance;
203
+ get: (url: string, config?: any) => Promise<{
204
+ headers: any;
205
+ data: any;
206
+ status: any;
207
+ }>;
208
+ post: (url: string, data?: any, config?: any) => Promise<{
209
+ headers: any;
210
+ data: any;
211
+ status: any;
212
+ }>;
213
+ delete: (url: string, config?: any) => Promise<{
214
+ headers: any;
215
+ data: any;
216
+ status: any;
217
+ }>;
218
+ put: (url: string, data?: any, config?: any) => Promise<{
219
+ headers: any;
220
+ data: any;
221
+ status: any;
222
+ }>;
223
+ patch: (url: string, data?: any, config?: any) => Promise<{
224
+ headers: any;
225
+ data: any;
226
+ status: any;
227
+ }>;
228
+ setBaseUrl: (url: string) => boolean;
229
+ };
230
+ registerApp: (shop: string, code: string, appKey: string, appSecret: string) => Promise<{
231
+ headers: any;
232
+ data: any;
233
+ status: any;
234
+ }>;
235
+ registerWebhookTopic: (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => Promise<{
236
+ headers: any;
237
+ data: any;
238
+ status: any;
239
+ }>;
240
+ updateShopifyAppMetafield: (shop: string, accessToken: string, pixelId: string) => Promise<{
241
+ headers: any;
242
+ data: any;
243
+ status: any;
244
+ }>;
245
+ getShopifyStoreProperties: (shop: string, accessToken: string) => Promise<{
246
+ headers: any;
247
+ data: any;
248
+ status: any;
249
+ }>;
250
+ genericShopifyPost: (url: string, accessToken: string, payload: any) => Promise<{
251
+ headers: any;
252
+ data: any;
253
+ status: any;
254
+ }>;
255
+ genericShopifyGet: (url: string, accessToken: string) => Promise<{
256
+ headers: any;
257
+ data: any;
258
+ status: any;
259
+ }>;
260
+ genericShopifyPut: (url: string, accessToken: string, payload: any) => Promise<{
261
+ headers: any;
262
+ data: any;
263
+ status: any;
264
+ }>;
265
+ }
266
+
190
267
  }
191
268
  declare module '@adtrackify/at-service-common/helpers/index' {
192
269
  export * from '@adtrackify/at-service-common/helpers/input-validation-helper';
package/dist/index.js CHANGED
@@ -628166,14 +628166,17 @@ var AccountsClient = class {
628166
628166
  }
628167
628167
  getConfig = () => {
628168
628168
  const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;
628169
- return {
628170
- baseURL: SERVICE_API_ROOT_URL,
628171
- headers: {
628169
+ const params = {
628170
+ baseURL: SERVICE_API_ROOT_URL
628171
+ };
628172
+ if (this.ACCOUNTS_API_KEY) {
628173
+ params.headers = {
628172
628174
  common: {
628173
628175
  "x-api-key": this.ACCOUNTS_API_KEY
628174
628176
  }
628175
- }
628176
- };
628177
+ };
628178
+ }
628179
+ return params;
628177
628180
  };
628178
628181
  getClient = async () => {
628179
628182
  return axiosHttpService(this.getConfig());
@@ -628189,6 +628192,12 @@ var AccountsClient = class {
628189
628192
  log3.info("checkUserAuthorization", { response });
628190
628193
  return response;
628191
628194
  };
628195
+ getPixelConfigById = async (pixelId) => {
628196
+ const client2 = await this.getClient();
628197
+ const pixelResponse = await client2.get(`/px/${pixelId}/config`);
628198
+ log3.debug("pixelResponse", { pixelResponse });
628199
+ return pixelResponse;
628200
+ };
628192
628201
  };
628193
628202
 
628194
628203
  // src/libs/http-error.ts
@@ -628294,12 +628303,12 @@ var validateInput = (schema, input) => {
628294
628303
  // src/helpers/logging-helper.ts
628295
628304
  import * as log5 from "lambda-log";
628296
628305
  var stage = process?.env?.STAGE;
628297
- var configureLogger = (event, context, debug = true) => {
628306
+ var configureLogger = (event, context, debug2 = true) => {
628298
628307
  log5.options.meta.stage = stage;
628299
628308
  log5.options.meta.source_name = context?.functionName || "unknown";
628300
628309
  log5.options.meta.awsRequestId = context?.awsRequestId || "unknown";
628301
628310
  log5.options.meta.lambdaEvent = event;
628302
- log5.options.debug = debug;
628311
+ log5.options.debug = debug2;
628303
628312
  };
628304
628313
 
628305
628314
  // src/helpers/response-helper.ts