@segment/action-destinations 3.234.0 → 3.235.0

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 (118) hide show
  1. package/dist/destinations/display-video-360/addToAudience/generated-types.d.ts +1 -1
  2. package/dist/destinations/display-video-360/addToAudience/index.js +5 -2
  3. package/dist/destinations/display-video-360/addToAudience/index.js.map +1 -1
  4. package/dist/destinations/display-video-360/errors.d.ts +2 -1
  5. package/dist/destinations/display-video-360/errors.js +7 -4
  6. package/dist/destinations/display-video-360/errors.js.map +1 -1
  7. package/dist/destinations/display-video-360/index.js +19 -12
  8. package/dist/destinations/display-video-360/index.js.map +1 -1
  9. package/dist/destinations/display-video-360/listManagement.d.ts +9 -0
  10. package/dist/destinations/display-video-360/listManagement.js +16 -0
  11. package/dist/destinations/display-video-360/listManagement.js.map +1 -0
  12. package/dist/destinations/display-video-360/properties.d.ts +1 -1
  13. package/dist/destinations/display-video-360/properties.js +14 -17
  14. package/dist/destinations/display-video-360/properties.js.map +1 -1
  15. package/dist/destinations/display-video-360/removeFromAudience/generated-types.d.ts +1 -1
  16. package/dist/destinations/display-video-360/removeFromAudience/index.js +5 -2
  17. package/dist/destinations/display-video-360/removeFromAudience/index.js.map +1 -1
  18. package/dist/destinations/display-video-360/shared.d.ts +8 -1
  19. package/dist/destinations/display-video-360/shared.js +29 -8
  20. package/dist/destinations/display-video-360/shared.js.map +1 -1
  21. package/dist/destinations/engage/sendgrid/Profile.d.ts +6 -0
  22. package/dist/destinations/engage/sendgrid/Profile.js +3 -0
  23. package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
  24. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +21 -0
  25. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +174 -0
  26. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
  27. package/dist/destinations/engage/utils/track.d.ts +17 -17
  28. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
  29. package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
  30. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
  31. package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
  32. package/dist/destinations/movable-ink/categoryView/index.js +43 -0
  33. package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
  34. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
  35. package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
  36. package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
  37. package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
  38. package/dist/destinations/movable-ink/conversion/index.js +45 -0
  39. package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
  40. package/dist/destinations/movable-ink/fields.d.ts +21 -0
  41. package/dist/destinations/movable-ink/fields.js +236 -0
  42. package/dist/destinations/movable-ink/fields.js.map +1 -0
  43. package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
  44. package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
  45. package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
  46. package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
  47. package/dist/destinations/movable-ink/identify/index.js +32 -0
  48. package/dist/destinations/movable-ink/identify/index.js.map +1 -0
  49. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
  50. package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
  51. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
  52. package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
  53. package/dist/destinations/movable-ink/productAdded/index.js +43 -0
  54. package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
  55. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
  56. package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
  57. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
  58. package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
  59. package/dist/destinations/movable-ink/productViewed/index.js +43 -0
  60. package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
  61. package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
  62. package/dist/destinations/movable-ink/search/generated-types.js +3 -0
  63. package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
  64. package/dist/destinations/movable-ink/search/index.d.ts +5 -0
  65. package/dist/destinations/movable-ink/search/index.js +43 -0
  66. package/dist/destinations/movable-ink/search/index.js.map +1 -0
  67. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
  68. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
  69. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
  70. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
  71. package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
  72. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
  73. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
  74. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +3 -0
  75. package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
  76. package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
  77. package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
  78. package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
  79. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
  80. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
  81. package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
  82. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
  83. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
  84. package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
  85. package/dist/destinations/responsys/generated-types.d.ts +5 -0
  86. package/dist/destinations/responsys/generated-types.js +3 -0
  87. package/dist/destinations/responsys/generated-types.js.map +1 -0
  88. package/dist/destinations/responsys/index.d.ts +4 -0
  89. package/dist/destinations/responsys/index.js +62 -0
  90. package/dist/destinations/responsys/index.js.map +1 -0
  91. package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
  92. package/dist/destinations/responsys/rsp-operations.js +33 -0
  93. package/dist/destinations/responsys/rsp-operations.js.map +1 -0
  94. package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
  95. package/dist/destinations/responsys/rsp-properties.js +27 -0
  96. package/dist/destinations/responsys/rsp-properties.js.map +1 -0
  97. package/dist/destinations/responsys/types.d.ts +37 -0
  98. package/dist/destinations/responsys/types.js +3 -0
  99. package/dist/destinations/responsys/types.js.map +1 -0
  100. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
  101. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
  102. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
  103. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/generated-types.d.ts +33 -0
  104. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/generated-types.js +3 -0
  105. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/generated-types.js.map +1 -0
  106. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/index.d.ts +5 -0
  107. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/index.js +317 -0
  108. package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/index.js.map +1 -0
  109. package/dist/destinations/trackey/group.types.d.ts +11 -0
  110. package/dist/destinations/trackey/group.types.js +3 -0
  111. package/dist/destinations/trackey/group.types.js.map +1 -0
  112. package/dist/destinations/trackey/identify.types.d.ts +11 -0
  113. package/dist/destinations/trackey/identify.types.js +3 -0
  114. package/dist/destinations/trackey/identify.types.js.map +1 -0
  115. package/dist/destinations/trackey/track.types.d.ts +12 -0
  116. package/dist/destinations/trackey/track.types.js +3 -0
  117. package/dist/destinations/trackey/track.types.js.map +1 -0
  118. package/package.json +2 -2
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const actions_core_1 = require("@segment/actions-core");
6
+ const liquidjs_1 = require("liquidjs");
7
+ const Liquid = new liquidjs_1.Liquid();
8
+ const maxResponseSizeBytes = 1000000;
9
+ const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
10
+ let renderedUrl;
11
+ let renderedBody;
12
+ try {
13
+ renderedUrl = await Liquid.parseAndRender(url, { profile });
14
+ }
15
+ catch (error) {
16
+ logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
17
+ datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
18
+ throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
19
+ }
20
+ try {
21
+ renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
22
+ }
23
+ catch (error) {
24
+ logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
25
+ datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
26
+ throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
27
+ }
28
+ return {
29
+ renderedUrl,
30
+ renderedBody
31
+ };
32
+ };
33
+ const getRequestId = ({ method, url, body, headers }) => {
34
+ const requestHash = crypto_1.createHash('sha256');
35
+ requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
36
+ const requestId = requestHash.digest('hex');
37
+ return requestId;
38
+ };
39
+ exports.getRequestId = getRequestId;
40
+ const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
41
+ const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
42
+ if (!cachedResponse) {
43
+ datafeedTags.push('cache_hit:false');
44
+ return;
45
+ }
46
+ datafeedTags.push('cache_hit:true');
47
+ if (responseType === 'json') {
48
+ return JSON.parse(cachedResponse);
49
+ }
50
+ return cachedResponse;
51
+ };
52
+ exports.getCachedResponse = getCachedResponse;
53
+ const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
54
+ const { id, method, headers, cacheTtl, name } = apiLookupConfig;
55
+ const datafeedTags = [
56
+ ...tags,
57
+ `datafeed_id:${id}`,
58
+ `datafeed_name:${name}`,
59
+ `space_id:${settings.spaceId}`,
60
+ `cache_ttl_greater_than_0:${cacheTtl > 0}`
61
+ ];
62
+ try {
63
+ const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
64
+ const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
65
+ if (cacheTtl > 0 && dataFeedCache) {
66
+ const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
67
+ if (cachedResponse) {
68
+ datafeedTags.push('error:false');
69
+ return cachedResponse;
70
+ }
71
+ }
72
+ let data;
73
+ try {
74
+ const res = await request(renderedUrl, {
75
+ headers: headers ?? undefined,
76
+ timeout: 3000,
77
+ method: method,
78
+ body: renderedBody,
79
+ skipResponseCloning: true
80
+ });
81
+ data = await res.data;
82
+ }
83
+ catch (error) {
84
+ const respError = error.response;
85
+ logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
86
+ datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
87
+ throw error;
88
+ }
89
+ const dataString = JSON.stringify(data);
90
+ const size = Buffer.byteLength(dataString, 'utf-8');
91
+ datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
92
+ if (cacheTtl > 0) {
93
+ if (size <= maxResponseSizeBytes) {
94
+ try {
95
+ await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
96
+ datafeedTags.push('cache_set:true');
97
+ }
98
+ catch (err) {
99
+ logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
100
+ datafeedTags.push('cache_set:false');
101
+ datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
102
+ throw err;
103
+ }
104
+ }
105
+ else {
106
+ datafeedTags.push('cache_set:false');
107
+ }
108
+ }
109
+ return data;
110
+ }
111
+ catch (error) {
112
+ const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
113
+ if (!isErrorCapturedInTags) {
114
+ datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
115
+ }
116
+ tags.push('reason:datafeed_failure');
117
+ logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
118
+ throw error;
119
+ }
120
+ finally {
121
+ statsClient?.incr('datafeed-execution', 1, datafeedTags);
122
+ }
123
+ };
124
+ exports.performApiLookup = performApiLookup;
125
+ exports.apiLookupActionFields = {
126
+ id: {
127
+ label: 'ID',
128
+ description: 'The id of the API lookup for use in logging & observability',
129
+ type: 'string'
130
+ },
131
+ name: {
132
+ label: 'Name',
133
+ description: 'The name of the API lookup referenced in liquid syntax',
134
+ type: 'string',
135
+ required: true
136
+ },
137
+ url: {
138
+ label: 'URL',
139
+ description: 'The URL endpoint to call',
140
+ type: 'string',
141
+ required: true
142
+ },
143
+ method: {
144
+ label: 'Request Method',
145
+ description: 'The request method, e.g. GET/POST/etc.',
146
+ type: 'string',
147
+ required: true
148
+ },
149
+ cacheTtl: {
150
+ label: 'Cache TTL',
151
+ description: 'The cache TTL in ms',
152
+ type: 'integer',
153
+ required: true
154
+ },
155
+ body: {
156
+ label: 'Request Body',
157
+ description: 'The request body for use with POST/PUT/PATCH requests',
158
+ type: 'string'
159
+ },
160
+ headers: {
161
+ label: 'Request Headers',
162
+ description: 'Headers in JSON to be sent with the request',
163
+ type: 'object'
164
+ },
165
+ responseType: {
166
+ label: 'Response Type',
167
+ description: 'The response type of the request. Currently only supporting JSON.',
168
+ type: 'string',
169
+ required: true
170
+ }
171
+ };
172
+ exports.apiLookupLiquidKey = 'lookups';
173
+ exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
174
+ //# sourceMappingURL=api-lookups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC,MAAM,kBAAkB,GAAG,KAAK,EAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAgD,EAC/D,OAAgB,EAChB,YAAsB,EACtB,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,mEAAmE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC3G,CAAA;QACD,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,iBAAiB,KAAK,EAAE,OAAO,EAAE,EAAE,0BAA0B,EAAE,eAAe,CAAC,CAAA;QAC/G,MAAM,IAAI,+BAAgB,CAAC,sC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QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAE9B,QAAA,sBAAsB,GAAG,sBAAsB,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { ContextFromDecorator } from './operationTracking';
2
2
  export declare const track: ((decoratorArgs?: ({
3
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
4
+ } & {
3
5
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
4
- } & import("./operationTracking").OperationLoggerDecoratorArgs & {
6
+ } & {
5
7
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
6
8
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
7
- } & {
8
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
9
- } & {
9
+ } & import("./operationTracking").OperationLoggerDecoratorArgs & {
10
10
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
11
11
  }) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
12
12
  getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
@@ -15,8 +15,13 @@ export declare const track: ((decoratorArgs?: ({
15
15
  }) | undefined;
16
16
  } & {
17
17
  _contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
18
- start?: number | undefined;
19
- duration?: number | undefined;
18
+ tags: string[];
19
+ sharedContext: {
20
+ tags: string[];
21
+ };
22
+ decoratorArgs?: {
23
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
24
+ } | undefined;
20
25
  } & {
21
26
  decoratorArgs?: {
22
27
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
@@ -25,10 +30,8 @@ export declare const track: ((decoratorArgs?: ({
25
30
  parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
26
31
  sharedContext: {};
27
32
  } & {
28
- logs: string[];
29
- logMetadata?: Record<string, unknown> | undefined;
30
- decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
31
- sharedContext: import("./operationTracking").OperationLoggerSharedContext;
33
+ start?: number | undefined;
34
+ duration?: number | undefined;
32
35
  } & {
33
36
  onFinally: (() => void)[];
34
37
  decoratorArgs?: {
@@ -36,13 +39,10 @@ export declare const track: ((decoratorArgs?: ({
36
39
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
37
40
  } | undefined;
38
41
  } & {
39
- tags: string[];
40
- sharedContext: {
41
- tags: string[];
42
- };
43
- decoratorArgs?: {
44
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
45
- } | undefined;
42
+ logs: string[];
43
+ logMetadata?: Record<string, unknown> | undefined;
44
+ decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
45
+ sharedContext: import("./operationTracking").OperationLoggerSharedContext;
46
46
  } & {
47
47
  decoratorArgs?: {
48
48
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
@@ -0,0 +1,22 @@
1
+ export interface Payload {
2
+ movable_ink_url?: string;
3
+ user_id?: string;
4
+ anonymous_id?: string;
5
+ timestamp: string | number;
6
+ timezone?: string;
7
+ products_required_false?: {
8
+ id: string;
9
+ title?: string;
10
+ price?: number;
11
+ url?: string;
12
+ quantity?: number;
13
+ [k: string]: unknown;
14
+ }[];
15
+ categories: {
16
+ id: string;
17
+ url?: string;
18
+ }[];
19
+ meta?: {
20
+ [k: string]: unknown;
21
+ };
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/movable-ink/categoryView/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const actions_core_1 = require("@segment/actions-core");
7
+ const fields_1 = require("../fields");
8
+ const omit_1 = __importDefault(require("lodash/omit"));
9
+ const action = {
10
+ title: 'Category View',
11
+ description: 'Send a "Category View" event to Movable Ink',
12
+ defaultSubscription: 'type = "track" and event = "Category Viewed"',
13
+ fields: {
14
+ movable_ink_url: fields_1.movable_ink_url,
15
+ user_id: fields_1.user_id,
16
+ anonymous_id: fields_1.anonymous_id,
17
+ timestamp: fields_1.timestamp,
18
+ timezone: fields_1.timezone,
19
+ products_required_false: fields_1.products_required_false,
20
+ categories: fields_1.categories,
21
+ meta: fields_1.meta
22
+ },
23
+ perform: (request, { settings, payload }) => {
24
+ const url = payload?.movable_ink_url ?? settings?.movable_ink_url;
25
+ if (!url)
26
+ throw new actions_core_1.IntegrationError('"Movable Ink URL" setting or "Movable Ink URL" field must be populated', 'MISSING_DESTINATION_URL', 400);
27
+ return request(url, {
28
+ method: 'POST',
29
+ json: {
30
+ event_name: 'Category View',
31
+ user_id: payload.user_id,
32
+ anonymous_id: payload.anonymous_id,
33
+ timestamp: payload.timestamp,
34
+ timezone: payload.timezone,
35
+ product: payload.products_required_false,
36
+ categories: payload.categories,
37
+ metadata: { ...omit_1.default(payload.meta, ['products_required_false', 'categories']) }
38
+ }
39
+ });
40
+ }
41
+ };
42
+ exports.default = action;
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/movable-ink/categoryView/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0E;AAG1E,sCASkB;AAClB,uDAA8B;AAE9B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,6CAA6C;IAC1D,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,eAAe,EAAf,wBAAe;QACf,OAAO,EAAP,gBAAO;QACP,YAAY,EAAZ,qBAAY;QACZ,SAAS,EAAT,kBAAS;QACT,QAAQ,EAAR,iBAAQ;QACR,uBAAuB,EAAvB,gCAAuB;QACvB,UAAU,EAAV,mBAAU;QACV,IAAI,EAAJ,aAAI;KACL;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,GAAG,GAAG,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,eAAe,CAAA;QACjE,IAAI,CAAC,GAAG;YACN,MAAM,IAAI,+BAAgB,CACxB,wEAAwE,EACxE,yBAAyB,EACzB,GAAG,CACJ,CAAA;QAEH,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,eAAe;gBAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,uBAAuB;gBACxC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,QAAQ,EAAE,EAAE,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC,EAAE;aAC/E;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,20 @@
1
+ export interface Payload {
2
+ movable_ink_url?: string;
3
+ user_id?: string;
4
+ anonymous_id?: string;
5
+ timestamp: string | number;
6
+ timezone?: string;
7
+ products: {
8
+ id: string;
9
+ title?: string;
10
+ price?: number;
11
+ url?: string;
12
+ quantity?: number;
13
+ [k: string]: unknown;
14
+ }[];
15
+ order_id: string;
16
+ revenue: number;
17
+ meta?: {
18
+ [k: string]: unknown;
19
+ };
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/movable-ink/conversion/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const actions_core_1 = require("@segment/actions-core");
7
+ const fields_1 = require("../fields");
8
+ const omit_1 = __importDefault(require("lodash/omit"));
9
+ const action = {
10
+ title: 'Conversion',
11
+ description: 'Send a Conversion event Movable Ink',
12
+ defaultSubscription: 'type = "track" and event = "Order Completed"',
13
+ fields: {
14
+ movable_ink_url: fields_1.movable_ink_url,
15
+ user_id: fields_1.user_id,
16
+ anonymous_id: fields_1.anonymous_id,
17
+ timestamp: fields_1.timestamp,
18
+ timezone: fields_1.timezone,
19
+ products: fields_1.products,
20
+ order_id: fields_1.order_id,
21
+ revenue: fields_1.revenue,
22
+ meta: fields_1.meta
23
+ },
24
+ perform: (request, { settings, payload }) => {
25
+ const url = payload?.movable_ink_url ?? settings?.movable_ink_url;
26
+ if (!url)
27
+ throw new actions_core_1.IntegrationError('"Movable Ink URL" setting or "Movable Ink URL" field must be populated', 'MISSING_DESTINATION_URL', 400);
28
+ return request(url, {
29
+ method: 'POST',
30
+ json: {
31
+ event_name: 'Conversion',
32
+ user_id: payload.user_id,
33
+ anonymous_id: payload.anonymous_id,
34
+ timestamp: payload.timestamp,
35
+ timezone: payload.timezone,
36
+ products: payload.products,
37
+ order_id: payload.order_id,
38
+ revenue: payload.revenue,
39
+ metadata: { ...omit_1.default(payload.meta, ['products', 'order_id', 'revenue']) }
40
+ }
41
+ });
42
+ }
43
+ };
44
+ exports.default = action;
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/movable-ink/conversion/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0E;AAG1E,sCAUkB;AAClB,uDAA8B;AAE9B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE;QACN,eAAe,EAAf,wBAAe;QACf,OAAO,EAAP,gBAAO;QACP,YAAY,EAAZ,qBAAY;QACZ,SAAS,EAAT,kBAAS;QACT,QAAQ,EAAR,iBAAQ;QACR,QAAQ,EAAR,iBAAQ;QACR,QAAQ,EAAR,iBAAQ;QACR,OAAO,EAAP,gBAAO;QACP,IAAI,EAAJ,aAAI;KACL;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,GAAG,GAAG,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,eAAe,CAAA;QACjE,IAAI,CAAC,GAAG;YACN,MAAM,IAAI,+BAAgB,CACxB,wEAAwE,EACxE,yBAAyB,EACzB,GAAG,CACJ,CAAA;QAEH,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,YAAY;gBACxB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,QAAQ,EAAE,EAAE,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,EAAE;aACzE;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { InputField } from '@segment/actions-core/destination-kit/types';
2
+ export declare const movable_ink_url: InputField;
3
+ export declare const timestamp: InputField;
4
+ export declare const timezone: InputField;
5
+ export declare const event_name: InputField;
6
+ export declare const user_id: InputField;
7
+ export declare const anonymous_id: InputField;
8
+ export declare const meta: InputField;
9
+ export declare const query_url: InputField;
10
+ export declare const revenue: InputField;
11
+ export declare const revenue_required_false: InputField;
12
+ export declare const query: InputField;
13
+ export declare const order_id: InputField;
14
+ export declare const order_id_required_false: InputField;
15
+ export declare const product_quantity: InputField;
16
+ export declare const product: InputField;
17
+ export declare const product_with_quantity: InputField;
18
+ export declare const products: InputField;
19
+ export declare const products_required_false: InputField;
20
+ export declare const categories: InputField;
21
+ export declare const categories_required_false: InputField;