@adtrackify/at-service-common 1.2.9 → 1.2.10

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.
Files changed (80) hide show
  1. package/dist/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
  2. package/dist/__tests__/helpers/subscription-helper.spec.js +27 -27
  3. package/dist/clients/generic/cognito-client.d.ts +19 -19
  4. package/dist/clients/generic/cognito-client.js +139 -139
  5. package/dist/clients/generic/dynamodb-client.d.ts +15 -15
  6. package/dist/clients/generic/dynamodb-client.js +122 -122
  7. package/dist/clients/generic/eventbridge-client.d.ts +14 -14
  8. package/dist/clients/generic/eventbridge-client.js +45 -45
  9. package/dist/clients/generic/http-client.d.ts +30 -30
  10. package/dist/clients/generic/http-client.js +28 -28
  11. package/dist/clients/generic/index.d.ts +6 -6
  12. package/dist/clients/generic/index.js +6 -6
  13. package/dist/clients/generic/s3-client.d.ts +6 -6
  14. package/dist/clients/generic/s3-client.js +24 -24
  15. package/dist/clients/generic/sqs-client.d.ts +14 -14
  16. package/dist/clients/generic/sqs-client.js +34 -34
  17. package/dist/clients/index.d.ts +3 -3
  18. package/dist/clients/index.js +3 -3
  19. package/dist/clients/internal-api/accounts-client.d.ts +82 -82
  20. package/dist/clients/internal-api/accounts-client.js +78 -78
  21. package/dist/clients/internal-api/destinations-client.d.ts +54 -54
  22. package/dist/clients/internal-api/destinations-client.js +36 -36
  23. package/dist/clients/internal-api/index.d.ts +4 -4
  24. package/dist/clients/internal-api/index.js +4 -4
  25. package/dist/clients/internal-api/shopify-app-install-client.d.ts +57 -57
  26. package/dist/clients/internal-api/shopify-app-install-client.js +42 -42
  27. package/dist/clients/internal-api/users-auth-client.d.ts +61 -61
  28. package/dist/clients/internal-api/users-auth-client.js +73 -73
  29. package/dist/clients/third-party/index.d.ts +1 -1
  30. package/dist/clients/third-party/index.js +1 -1
  31. package/dist/clients/third-party/shopify-client.d.ts +90 -90
  32. package/dist/clients/third-party/shopify-client.js +121 -121
  33. package/dist/helpers/index.d.ts +7 -5
  34. package/dist/helpers/index.js +7 -5
  35. package/dist/helpers/index.js.map +1 -1
  36. package/dist/helpers/input-validation-helper.d.ts +2 -2
  37. package/dist/helpers/input-validation-helper.js +18 -18
  38. package/dist/helpers/logging-helper.d.ts +1 -1
  39. package/dist/helpers/logging-helper.js +9 -9
  40. package/dist/helpers/response-helper.d.ts +36 -36
  41. package/dist/helpers/response-helper.js +35 -35
  42. package/dist/helpers/shopify-helper.d.ts +9 -9
  43. package/dist/helpers/shopify-helper.js +23 -23
  44. package/dist/helpers/subscription-helper.d.ts +8 -8
  45. package/dist/helpers/subscription-helper.js +181 -181
  46. package/dist/helpers/traits-helper.d.ts +2 -0
  47. package/dist/helpers/traits-helper.js +5 -0
  48. package/dist/helpers/traits-helper.js.map +1 -0
  49. package/dist/helpers/utils.d.ts +1 -0
  50. package/dist/helpers/utils.js +11 -0
  51. package/dist/helpers/utils.js.map +1 -0
  52. package/dist/index.d.ts +5 -5
  53. package/dist/index.esm.js +3111 -0
  54. package/dist/index.esm.js.map +4 -4
  55. package/dist/index.js +5 -5
  56. package/dist/libs/crypto.d.ts +1 -1
  57. package/dist/libs/crypto.js +5 -5
  58. package/dist/libs/dates.d.ts +3 -3
  59. package/dist/libs/dates.js +10 -10
  60. package/dist/libs/http-error.d.ts +21 -21
  61. package/dist/libs/http-error.js +55 -55
  62. package/dist/libs/http-status-codes.d.ts +58 -58
  63. package/dist/libs/http-status-codes.js +59 -59
  64. package/dist/libs/index.d.ts +6 -6
  65. package/dist/libs/index.js +6 -6
  66. package/dist/libs/url.d.ts +1 -1
  67. package/dist/libs/url.js +9 -9
  68. package/dist/services/eventbridge-integration-service.d.ts +9 -9
  69. package/dist/services/eventbridge-integration-service.js +24 -24
  70. package/dist/services/index.d.ts +1 -1
  71. package/dist/services/index.js +1 -1
  72. package/dist/types/api-response.d.ts +6 -6
  73. package/dist/types/api-response.js +1 -1
  74. package/dist/types/index.d.ts +1 -1
  75. package/dist/types/index.js +1 -1
  76. package/dist/types/internal-events/event-detail-types.d.ts +20 -20
  77. package/dist/types/internal-events/event-detail-types.js +24 -24
  78. package/dist/types/internal-events/index.d.ts +1 -1
  79. package/dist/types/internal-events/index.js +1 -1
  80. package/package.json +7 -3
@@ -1,14 +1,14 @@
1
- import { EventBridgeClient as EventBridge } from '@aws-sdk/client-eventbridge';
2
- export declare class EventBridgeClient {
3
- eventBridge: EventBridge;
4
- EVENT_BUS_NAME: string;
5
- constructor(eventBusName: string);
6
- buildAndSendEvent: (eventSource: string, eventType: string, eventData: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
7
- buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
- eventId: string;
9
- eventType: string;
10
- eventTime: string;
11
- eventData: any;
12
- };
13
- putEvent: (source: string, detailType: string, data: any, headers?: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
14
- }
1
+ import { EventBridgeClient as EventBridge } from '@aws-sdk/client-eventbridge';
2
+ export declare class EventBridgeClient {
3
+ eventBridge: EventBridge;
4
+ EVENT_BUS_NAME: string;
5
+ constructor(eventBusName: string);
6
+ buildAndSendEvent: (eventSource: string, eventType: string, eventData: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
7
+ buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
+ eventId: string;
9
+ eventType: string;
10
+ eventTime: string;
11
+ eventData: any;
12
+ };
13
+ putEvent: (source: string, detailType: string, data: any, headers?: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
14
+ }
@@ -1,46 +1,46 @@
1
- import { EventBridgeClient as EventBridge, PutEventsCommand } from '@aws-sdk/client-eventbridge';
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { getCurrentTimestamp } from '../../libs/dates.js';
4
- import * as log from 'lambda-log';
5
- export class EventBridgeClient {
6
- eventBridge;
7
- EVENT_BUS_NAME;
8
- constructor(eventBusName) {
9
- this.eventBridge = new EventBridge({});
10
- this.EVENT_BUS_NAME = eventBusName;
11
- }
12
- buildAndSendEvent = async (eventSource, eventType, eventData) => {
13
- const event = this.buildEvent(eventType, eventData);
14
- return await this.putEvent(eventSource, eventType, event);
15
- };
16
- buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
- return {
18
- eventId,
19
- eventType,
20
- eventTime,
21
- eventData
22
- };
23
- };
24
- putEvent = async (source, detailType, data, headers = null) => {
25
- const params = {
26
- Entries: [{
27
- Detail: JSON.stringify({ headers, data }),
28
- DetailType: detailType,
29
- EventBusName: this.EVENT_BUS_NAME,
30
- Source: source,
31
- Time: new Date(),
32
- }],
33
- };
34
- const putEventscommand = new PutEventsCommand(params);
35
- const response = await this.eventBridge.send(putEventscommand);
36
- log.debug('EventBus Event Published', {
37
- eventBusName: this.EVENT_BUS_NAME,
38
- eventSource: source,
39
- eventType: detailType,
40
- event: data,
41
- response
42
- });
43
- return response;
44
- };
45
- }
1
+ import { EventBridgeClient as EventBridge, PutEventsCommand } from '@aws-sdk/client-eventbridge';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { getCurrentTimestamp } from '../../libs/dates.js';
4
+ import * as log from 'lambda-log';
5
+ export class EventBridgeClient {
6
+ eventBridge;
7
+ EVENT_BUS_NAME;
8
+ constructor(eventBusName) {
9
+ this.eventBridge = new EventBridge({});
10
+ this.EVENT_BUS_NAME = eventBusName;
11
+ }
12
+ buildAndSendEvent = async (eventSource, eventType, eventData) => {
13
+ const event = this.buildEvent(eventType, eventData);
14
+ return await this.putEvent(eventSource, eventType, event);
15
+ };
16
+ buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
+ return {
18
+ eventId,
19
+ eventType,
20
+ eventTime,
21
+ eventData
22
+ };
23
+ };
24
+ putEvent = async (source, detailType, data, headers = null) => {
25
+ const params = {
26
+ Entries: [{
27
+ Detail: JSON.stringify({ headers, data }),
28
+ DetailType: detailType,
29
+ EventBusName: this.EVENT_BUS_NAME,
30
+ Source: source,
31
+ Time: new Date(),
32
+ }],
33
+ };
34
+ const putEventscommand = new PutEventsCommand(params);
35
+ const response = await this.eventBridge.send(putEventscommand);
36
+ log.debug('EventBus Event Published', {
37
+ eventBusName: this.EVENT_BUS_NAME,
38
+ eventSource: source,
39
+ eventType: detailType,
40
+ event: data,
41
+ response
42
+ });
43
+ return response;
44
+ };
45
+ }
46
46
  //# sourceMappingURL=eventbridge-client.js.map
@@ -1,30 +1,30 @@
1
- import { CreateAxiosDefaults } from 'axios';
2
- export declare const axiosHttpService: (config?: CreateAxiosDefaults) => {
3
- instance: () => import("axios").AxiosInstance;
4
- get: (url: string, config?: any) => Promise<{
5
- headers: any;
6
- data: any;
7
- status: any;
8
- }>;
9
- post: (url: string, data?: any, config?: any) => Promise<{
10
- headers: any;
11
- data: any;
12
- status: any;
13
- }>;
14
- delete: (url: string, config?: any) => Promise<{
15
- headers: any;
16
- data: any;
17
- status: any;
18
- }>;
19
- put: (url: string, data?: any, config?: any) => Promise<{
20
- headers: any;
21
- data: any;
22
- status: any;
23
- }>;
24
- patch: (url: string, data?: any, config?: any) => Promise<{
25
- headers: any;
26
- data: any;
27
- status: any;
28
- }>;
29
- setBaseUrl: (url: string) => boolean;
30
- };
1
+ import { CreateAxiosDefaults } from 'axios';
2
+ export declare const axiosHttpService: (config?: CreateAxiosDefaults) => {
3
+ instance: () => import("axios").AxiosInstance;
4
+ get: (url: string, config?: any) => Promise<{
5
+ headers: any;
6
+ data: any;
7
+ status: any;
8
+ }>;
9
+ post: (url: string, data?: any, config?: any) => Promise<{
10
+ headers: any;
11
+ data: any;
12
+ status: any;
13
+ }>;
14
+ delete: (url: string, config?: any) => Promise<{
15
+ headers: any;
16
+ data: any;
17
+ status: any;
18
+ }>;
19
+ put: (url: string, data?: any, config?: any) => Promise<{
20
+ headers: any;
21
+ data: any;
22
+ status: any;
23
+ }>;
24
+ patch: (url: string, data?: any, config?: any) => Promise<{
25
+ headers: any;
26
+ data: any;
27
+ status: any;
28
+ }>;
29
+ setBaseUrl: (url: string) => boolean;
30
+ };
@@ -1,29 +1,29 @@
1
- import axios from 'axios';
2
- import https from 'https';
3
- const httpResponse = (res = {}) => {
4
- return {
5
- headers: res?.header || {},
6
- data: res?.data || {},
7
- status: res?.status || 0,
8
- };
9
- };
10
- const handleAxiosError = (error) => {
11
- if (!error?.response && !error?.request)
12
- throw error;
13
- return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });
14
- };
15
- export const axiosHttpService = (config = {}) => {
16
- config.adapter = 'http';
17
- config.httpsAgent = new https.Agent({ keepAlive: true });
18
- const axiosService = axios.create(config);
19
- return {
20
- instance: () => axiosService,
21
- get: (url, config) => axiosService.get(url, config).then(httpResponse, handleAxiosError),
22
- post: (url, data, config) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),
23
- delete: (url, config) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),
24
- put: (url, data, config) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),
25
- patch: (url, data, config) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),
26
- setBaseUrl: (url) => !!(axiosService.defaults.baseURL = url)
27
- };
28
- };
1
+ import axios from 'axios';
2
+ import https from 'https';
3
+ const httpResponse = (res = {}) => {
4
+ return {
5
+ headers: res?.header || {},
6
+ data: res?.data || {},
7
+ status: res?.status || 0,
8
+ };
9
+ };
10
+ const handleAxiosError = (error) => {
11
+ if (!error?.response && !error?.request)
12
+ throw error;
13
+ return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });
14
+ };
15
+ export const axiosHttpService = (config = {}) => {
16
+ config.adapter = 'http';
17
+ config.httpsAgent = new https.Agent({ keepAlive: true });
18
+ const axiosService = axios.create(config);
19
+ return {
20
+ instance: () => axiosService,
21
+ get: (url, config) => axiosService.get(url, config).then(httpResponse, handleAxiosError),
22
+ post: (url, data, config) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),
23
+ delete: (url, config) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),
24
+ put: (url, data, config) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),
25
+ patch: (url, data, config) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),
26
+ setBaseUrl: (url) => !!(axiosService.defaults.baseURL = url)
27
+ };
28
+ };
29
29
  //# sourceMappingURL=http-client.js.map
@@ -1,6 +1,6 @@
1
- export * from './dynamodb-client.js';
2
- export * from './eventbridge-client.js';
3
- export * from './http-client.js';
4
- export * from './s3-client.js';
5
- export * from './cognito-client.js';
6
- export * from './sqs-client.js';
1
+ export * from './dynamodb-client.js';
2
+ export * from './eventbridge-client.js';
3
+ export * from './http-client.js';
4
+ export * from './s3-client.js';
5
+ export * from './cognito-client.js';
6
+ export * from './sqs-client.js';
@@ -1,7 +1,7 @@
1
- export * from './dynamodb-client.js';
2
- export * from './eventbridge-client.js';
3
- export * from './http-client.js';
4
- export * from './s3-client.js';
5
- export * from './cognito-client.js';
6
- export * from './sqs-client.js';
1
+ export * from './dynamodb-client.js';
2
+ export * from './eventbridge-client.js';
3
+ export * from './http-client.js';
4
+ export * from './s3-client.js';
5
+ export * from './cognito-client.js';
6
+ export * from './sqs-client.js';
7
7
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
- export declare class S3Client {
3
- s3: S3;
4
- constructor(region?: string);
5
- uploadJson(path: string, bucket: string, jsonData: any, ACL?: ObjectCannedACL | string): Promise<unknown>;
6
- }
1
+ import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
+ export declare class S3Client {
3
+ s3: S3;
4
+ constructor(region?: string);
5
+ uploadJson(path: string, bucket: string, jsonData: any, ACL?: ObjectCannedACL | string): Promise<unknown>;
6
+ }
@@ -1,25 +1,25 @@
1
- import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
- import * as log from 'lambda-log';
3
- export class S3Client {
4
- s3;
5
- constructor(region = 'us-west-2') {
6
- this.s3 = new S3({ region });
7
- }
8
- async uploadJson(path, bucket, jsonData, ACL = ObjectCannedACL.private) {
9
- try {
10
- const res = await this.s3.putObject({
11
- ACL,
12
- Bucket: bucket,
13
- ContentType: 'application/json; charset=utf-8',
14
- Body: JSON.stringify(jsonData),
15
- Key: path
16
- });
17
- return res;
18
- }
19
- catch (error) {
20
- log.error('Error in s3 upload json', { error });
21
- return error;
22
- }
23
- }
24
- }
1
+ import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
+ import * as log from 'lambda-log';
3
+ export class S3Client {
4
+ s3;
5
+ constructor(region = 'us-west-2') {
6
+ this.s3 = new S3({ region });
7
+ }
8
+ async uploadJson(path, bucket, jsonData, ACL = ObjectCannedACL.private) {
9
+ try {
10
+ const res = await this.s3.putObject({
11
+ ACL,
12
+ Bucket: bucket,
13
+ ContentType: 'application/json; charset=utf-8',
14
+ Body: JSON.stringify(jsonData),
15
+ Key: path
16
+ });
17
+ return res;
18
+ }
19
+ catch (error) {
20
+ log.error('Error in s3 upload json', { error });
21
+ return error;
22
+ }
23
+ }
24
+ }
25
25
  //# sourceMappingURL=s3-client.js.map
@@ -1,14 +1,14 @@
1
- import { SQS } from '@aws-sdk/client-sqs';
2
- export declare class SQSClient {
3
- sqs: SQS;
4
- queueUrl: string;
5
- constructor(region: string, accountId: string, queueName: string);
6
- buildAndSendEvent: (eventType: string, eventData: any, deplaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
7
- buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
- eventId: string;
9
- eventType: string;
10
- eventTime: string;
11
- eventData: any;
12
- };
13
- putEvent: (data: any, delaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
14
- }
1
+ import { SQS } from '@aws-sdk/client-sqs';
2
+ export declare class SQSClient {
3
+ sqs: SQS;
4
+ queueUrl: string;
5
+ constructor(region: string, accountId: string, queueName: string);
6
+ buildAndSendEvent: (eventType: string, eventData: any, deplaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
7
+ buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
+ eventId: string;
9
+ eventType: string;
10
+ eventTime: string;
11
+ eventData: any;
12
+ };
13
+ putEvent: (data: any, delaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
14
+ }
@@ -1,35 +1,35 @@
1
- import { SQS } from '@aws-sdk/client-sqs';
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { getCurrentTimestamp } from '../../libs/dates.js';
4
- import * as log from 'lambda-log';
5
- export class SQSClient {
6
- sqs;
7
- queueUrl;
8
- constructor(region, accountId, queueName) {
9
- this.sqs = new SQS({ region });
10
- this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
11
- }
12
- buildAndSendEvent = async (eventType, eventData, deplaySeconds = 0) => {
13
- const event = this.buildEvent(eventType, eventData);
14
- return await this.putEvent(event, deplaySeconds);
15
- };
16
- buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
- return {
18
- eventId,
19
- eventType,
20
- eventTime,
21
- eventData
22
- };
23
- };
24
- putEvent = async (data, delaySeconds = 0) => {
25
- const params = {
26
- QueueUrl: this.queueUrl,
27
- DelaySeconds: delaySeconds,
28
- MessageBody: JSON.stringify(data)
29
- };
30
- const response = await this.sqs.sendMessage(params);
31
- log.debug('SQS Event Published', { queueUrl: this.queueUrl, event: data });
32
- return response;
33
- };
34
- }
1
+ import { SQS } from '@aws-sdk/client-sqs';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { getCurrentTimestamp } from '../../libs/dates.js';
4
+ import * as log from 'lambda-log';
5
+ export class SQSClient {
6
+ sqs;
7
+ queueUrl;
8
+ constructor(region, accountId, queueName) {
9
+ this.sqs = new SQS({ region });
10
+ this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
11
+ }
12
+ buildAndSendEvent = async (eventType, eventData, deplaySeconds = 0) => {
13
+ const event = this.buildEvent(eventType, eventData);
14
+ return await this.putEvent(event, deplaySeconds);
15
+ };
16
+ buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
+ return {
18
+ eventId,
19
+ eventType,
20
+ eventTime,
21
+ eventData
22
+ };
23
+ };
24
+ putEvent = async (data, delaySeconds = 0) => {
25
+ const params = {
26
+ QueueUrl: this.queueUrl,
27
+ DelaySeconds: delaySeconds,
28
+ MessageBody: JSON.stringify(data)
29
+ };
30
+ const response = await this.sqs.sendMessage(params);
31
+ log.debug('SQS Event Published', { queueUrl: this.queueUrl, event: data });
32
+ return response;
33
+ };
34
+ }
35
35
  //# sourceMappingURL=sqs-client.js.map
@@ -1,3 +1,3 @@
1
- export * from './generic/index.js';
2
- export * from './internal-api/index.js';
3
- export * from './third-party/index.js';
1
+ export * from './generic/index.js';
2
+ export * from './internal-api/index.js';
3
+ export * from './third-party/index.js';
@@ -1,4 +1,4 @@
1
- export * from './generic/index.js';
2
- export * from './internal-api/index.js';
3
- export * from './third-party/index.js';
1
+ export * from './generic/index.js';
2
+ export * from './internal-api/index.js';
3
+ export * from './third-party/index.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1,82 +1,82 @@
1
- import { ApiResponse } from '../../types/api-response.js';
2
- import { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';
3
- export interface AccountResponseData {
4
- account: Account;
5
- [key: string]: any;
6
- }
7
- export interface IsAuthorizedUserResponseData {
8
- isAccountUser: boolean;
9
- [key: string]: any;
10
- }
11
- export interface PixelConfigResponseData {
12
- id: string;
13
- destinations: Destination[];
14
- [key: string]: any;
15
- }
16
- export interface AddUserToAccountResponseData {
17
- userId: string;
18
- accountId: string;
19
- }
20
- export interface UpdateAccountRequest {
21
- accountName?: string;
22
- companyName?: string;
23
- primaryEmail?: string;
24
- ownerId?: string;
25
- subscriptionId?: string;
26
- accountStatus?: ACCOUNT_STATUS;
27
- }
28
- export declare class AccountsClient {
29
- BASE_API_URL: string;
30
- ACCOUNTS_API_KEY?: string;
31
- constructor(baseApiUrl: string, accountsApiKey?: string);
32
- getConfig: () => any;
33
- getClient: () => Promise<{
34
- instance: () => import("axios").AxiosInstance;
35
- get: (url: string, config?: any) => Promise<{
36
- headers: any;
37
- data: any;
38
- status: any;
39
- }>;
40
- post: (url: string, data?: any, config?: any) => Promise<{
41
- headers: any;
42
- data: any;
43
- status: any;
44
- }>;
45
- delete: (url: string, config?: any) => Promise<{
46
- headers: any;
47
- data: any;
48
- status: any;
49
- }>;
50
- put: (url: string, data?: any, config?: any) => Promise<{
51
- headers: any;
52
- data: any;
53
- status: any;
54
- }>;
55
- patch: (url: string, data?: any, config?: any) => Promise<{
56
- headers: any;
57
- data: any;
58
- status: any;
59
- }>;
60
- setBaseUrl: (url: string) => boolean;
61
- }>;
62
- createAccount: (createAccountRequest: any) => Promise<{
63
- headers: any;
64
- data: any;
65
- status: any;
66
- }>;
67
- updateAccount: (accountId: string, body: any) => Promise<ApiResponse<AccountResponseData>>;
68
- addOwner: (accountId: string, userId: string) => Promise<{
69
- headers: any;
70
- data: any;
71
- status: any;
72
- }>;
73
- isAuthorizedUser: (userId: string, accountId: string, pixelId?: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
74
- adminDeleteAccount: (accountId: string) => Promise<{
75
- headers: any;
76
- data: any;
77
- status: any;
78
- }>;
79
- getPixelConfigById: (pixelId: string) => Promise<ApiResponse<PixelConfigResponseData>>;
80
- getAccount: (accountId: string) => Promise<ApiResponse<AccountResponseData>>;
81
- addUserToAccount: (accountId: string, userId: string) => Promise<ApiResponse<AddUserToAccountResponseData>>;
82
- }
1
+ import { ApiResponse } from '../../types/api-response.js';
2
+ import { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';
3
+ export interface AccountResponseData {
4
+ account: Account;
5
+ [key: string]: any;
6
+ }
7
+ export interface IsAuthorizedUserResponseData {
8
+ isAccountUser: boolean;
9
+ [key: string]: any;
10
+ }
11
+ export interface PixelConfigResponseData {
12
+ id: string;
13
+ destinations: Destination[];
14
+ [key: string]: any;
15
+ }
16
+ export interface AddUserToAccountResponseData {
17
+ userId: string;
18
+ accountId: string;
19
+ }
20
+ export interface UpdateAccountRequest {
21
+ accountName?: string;
22
+ companyName?: string;
23
+ primaryEmail?: string;
24
+ ownerId?: string;
25
+ subscriptionId?: string;
26
+ accountStatus?: ACCOUNT_STATUS;
27
+ }
28
+ export declare class AccountsClient {
29
+ BASE_API_URL: string;
30
+ ACCOUNTS_API_KEY?: string;
31
+ constructor(baseApiUrl: string, accountsApiKey?: string);
32
+ getConfig: () => any;
33
+ getClient: () => Promise<{
34
+ instance: () => import("axios").AxiosInstance;
35
+ get: (url: string, config?: any) => Promise<{
36
+ headers: any;
37
+ data: any;
38
+ status: any;
39
+ }>;
40
+ post: (url: string, data?: any, config?: any) => Promise<{
41
+ headers: any;
42
+ data: any;
43
+ status: any;
44
+ }>;
45
+ delete: (url: string, config?: any) => Promise<{
46
+ headers: any;
47
+ data: any;
48
+ status: any;
49
+ }>;
50
+ put: (url: string, data?: any, config?: any) => Promise<{
51
+ headers: any;
52
+ data: any;
53
+ status: any;
54
+ }>;
55
+ patch: (url: string, data?: any, config?: any) => Promise<{
56
+ headers: any;
57
+ data: any;
58
+ status: any;
59
+ }>;
60
+ setBaseUrl: (url: string) => boolean;
61
+ }>;
62
+ createAccount: (createAccountRequest: any) => Promise<{
63
+ headers: any;
64
+ data: any;
65
+ status: any;
66
+ }>;
67
+ updateAccount: (accountId: string, body: any) => Promise<ApiResponse<AccountResponseData>>;
68
+ addOwner: (accountId: string, userId: string) => Promise<{
69
+ headers: any;
70
+ data: any;
71
+ status: any;
72
+ }>;
73
+ isAuthorizedUser: (userId: string, accountId: string, pixelId?: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
74
+ adminDeleteAccount: (accountId: string) => Promise<{
75
+ headers: any;
76
+ data: any;
77
+ status: any;
78
+ }>;
79
+ getPixelConfigById: (pixelId: string) => Promise<ApiResponse<PixelConfigResponseData>>;
80
+ getAccount: (accountId: string) => Promise<ApiResponse<AccountResponseData>>;
81
+ addUserToAccount: (accountId: string, userId: string) => Promise<ApiResponse<AddUserToAccountResponseData>>;
82
+ }