@awell-health/awell-extensions 1.0.115 → 1.0.116
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/extensions/iterable/v1/actions/index.d.ts +1 -0
- package/dist/extensions/iterable/v1/actions/index.js +3 -1
- package/dist/extensions/iterable/v1/actions/index.js.map +1 -1
- package/dist/extensions/iterable/v1/actions/sendEmail/sendEmail.test.js +1 -1
- package/dist/extensions/iterable/v1/actions/sendEmail/sendEmail.test.js.map +1 -1
- package/dist/extensions/iterable/v1/actions/trackEvent/config/fields.d.ts +58 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/config/fields.js +61 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/config/fields.js.map +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/config/index.d.ts +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/config/index.js +7 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/config/index.js.map +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/index.d.ts +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/index.js +6 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/index.js.map +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.d.ts +4 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.js +36 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.js.map +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.test.d.ts +1 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.test.js +29 -0
- package/dist/extensions/iterable/v1/actions/trackEvent/trackEvent.test.js.map +1 -0
- package/dist/extensions/iterable/v1/client/client.d.ts +9 -1
- package/dist/extensions/iterable/v1/client/client.js +14 -0
- package/dist/extensions/iterable/v1/client/client.js.map +1 -1
- package/dist/extensions/iterable/v1/client/types.d.ts +11 -0
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sendEmail = void 0;
|
3
|
+
exports.trackEvent = exports.sendEmail = void 0;
|
4
4
|
var sendEmail_1 = require("./sendEmail");
|
5
5
|
Object.defineProperty(exports, "sendEmail", { enumerable: true, get: function () { return sendEmail_1.sendEmail; } });
|
6
|
+
var trackEvent_1 = require("./trackEvent");
|
7
|
+
Object.defineProperty(exports, "trackEvent", { enumerable: true, get: function () { return trackEvent_1.trackEvent; } });
|
6
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/iterable/v1/actions/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAA9B,sGAAA,SAAS,OAAA"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/iterable/v1/actions/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAClB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
@@ -4,7 +4,7 @@ const __mocks__1 = require("../../client/__mocks__");
|
|
4
4
|
const __1 = require("..");
|
5
5
|
const tests_1 = require("../../../../../src/tests");
|
6
6
|
jest.mock('../../client');
|
7
|
-
describe('Send email', () => {
|
7
|
+
describe('Iterable - Send email', () => {
|
8
8
|
const onComplete = jest.fn();
|
9
9
|
const onError = jest.fn();
|
10
10
|
const basePayload = (0, tests_1.generateTestPayload)({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sendEmail.test.js","sourceRoot":"","sources":["../../../../../../extensions/iterable/v1/actions/sendEmail/sendEmail.test.ts"],"names":[],"mappings":";;AAAA,qDAG+B;AAC/B,0BAA8B;AAC9B,oDAA8D;AAE9D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AAEzB,QAAQ,CAAC,
|
1
|
+
{"version":3,"file":"send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;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { FieldType } from '@awell-health/extensions-core';
|
3
|
+
export declare const fields: {
|
4
|
+
email: {
|
5
|
+
id: string;
|
6
|
+
label: string;
|
7
|
+
type: FieldType.STRING;
|
8
|
+
required: false;
|
9
|
+
description: string;
|
10
|
+
};
|
11
|
+
userId: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
type: FieldType.STRING;
|
15
|
+
required: false;
|
16
|
+
description: string;
|
17
|
+
};
|
18
|
+
eventName: {
|
19
|
+
id: string;
|
20
|
+
label: string;
|
21
|
+
type: FieldType.STRING;
|
22
|
+
required: true;
|
23
|
+
description: string;
|
24
|
+
};
|
25
|
+
dataFields: {
|
26
|
+
label: string;
|
27
|
+
id: string;
|
28
|
+
type: FieldType.JSON;
|
29
|
+
required: false;
|
30
|
+
description: string;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
export declare const FieldsValidationSchema: z.ZodEffects<z.ZodObject<{
|
34
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
|
35
|
+
userId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
|
36
|
+
eventName: z.ZodString;
|
37
|
+
dataFields: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodString, Record<string, any>, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
39
|
+
eventName: string;
|
40
|
+
email?: string | undefined;
|
41
|
+
userId?: string | undefined;
|
42
|
+
dataFields?: Record<string, any> | undefined;
|
43
|
+
}, {
|
44
|
+
eventName: string;
|
45
|
+
email?: string | undefined;
|
46
|
+
userId?: string | undefined;
|
47
|
+
dataFields?: string | undefined;
|
48
|
+
}>, {
|
49
|
+
eventName: string;
|
50
|
+
email?: string | undefined;
|
51
|
+
userId?: string | undefined;
|
52
|
+
dataFields?: Record<string, any> | undefined;
|
53
|
+
}, {
|
54
|
+
eventName: string;
|
55
|
+
email?: string | undefined;
|
56
|
+
userId?: string | undefined;
|
57
|
+
dataFields?: string | undefined;
|
58
|
+
}>;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FieldsValidationSchema = exports.fields = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
|
+
const lodash_1 = require("lodash");
|
7
|
+
const validation_1 = require("../../../validation");
|
8
|
+
exports.fields = {
|
9
|
+
email: {
|
10
|
+
id: 'email',
|
11
|
+
label: 'Email',
|
12
|
+
type: extensions_core_1.FieldType.STRING,
|
13
|
+
required: false,
|
14
|
+
description: 'An email address that identifies a user profile in Iterable. Provide a recipient email or a recipient user ID, but not both, depending on how your project identifies users.',
|
15
|
+
},
|
16
|
+
userId: {
|
17
|
+
id: 'userId',
|
18
|
+
label: 'User ID',
|
19
|
+
type: extensions_core_1.FieldType.STRING,
|
20
|
+
required: false,
|
21
|
+
description: 'A user ID that identifies a user profile in Iterable. Provide a recipient email or a recipient user ID, but not both, depending on how your project identifies users.',
|
22
|
+
},
|
23
|
+
eventName: {
|
24
|
+
id: 'eventName',
|
25
|
+
label: 'Event name',
|
26
|
+
type: extensions_core_1.FieldType.STRING,
|
27
|
+
required: true,
|
28
|
+
description: '',
|
29
|
+
},
|
30
|
+
dataFields: {
|
31
|
+
label: 'Data fields',
|
32
|
+
id: 'dataFields',
|
33
|
+
type: extensions_core_1.FieldType.JSON,
|
34
|
+
required: false,
|
35
|
+
description: 'Additional data associated with event',
|
36
|
+
},
|
37
|
+
};
|
38
|
+
exports.FieldsValidationSchema = zod_1.z
|
39
|
+
.object({
|
40
|
+
email: (0, extensions_core_1.makeStringOptional)(zod_1.z.string().email()),
|
41
|
+
userId: (0, extensions_core_1.makeStringOptional)(zod_1.z.string()),
|
42
|
+
eventName: zod_1.z.string(),
|
43
|
+
dataFields: (0, extensions_core_1.makeStringOptional)(validation_1.StringTransformToJson),
|
44
|
+
})
|
45
|
+
.superRefine((value, context) => {
|
46
|
+
if ((0, lodash_1.isEmpty)(value.email) && (0, lodash_1.isEmpty)(value.userId)) {
|
47
|
+
context.addIssue({
|
48
|
+
code: zod_1.z.ZodIssueCode.custom,
|
49
|
+
fatal: true,
|
50
|
+
message: 'Both "email" and "user ID" are empty. Please provide one of them.',
|
51
|
+
});
|
52
|
+
}
|
53
|
+
if (!(0, lodash_1.isEmpty)(value.email) && !(0, lodash_1.isEmpty)(value.userId)) {
|
54
|
+
context.addIssue({
|
55
|
+
code: zod_1.z.ZodIssueCode.custom,
|
56
|
+
fatal: true,
|
57
|
+
message: 'Both "email" and "user ID" are provided. Please provide only one of them.',
|
58
|
+
});
|
59
|
+
}
|
60
|
+
});
|
61
|
+
//# sourceMappingURL=fields.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/iterable/v1/actions/trackEvent/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AACtC,mCAAgC;AAChC,oDAA2D;AAE9C,QAAA,MAAM,GAAG;IACpB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,8KAA8K;KACjL;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,uKAAuK;KAC1K;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;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ationSchema, fields } from './fields';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.fields = exports.FieldsValidationSchema = void 0;
|
4
|
+
var fields_1 = require("./fields");
|
5
|
+
Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
|
6
|
+
Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
|
7
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../extensions/iterable/v1/actions/trackEvent/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gHAAA,sBAAsB,OAAA;AAAE,gGAAA,MAAM,OAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { trackEvent } from './trackEvent';
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.trackEvent = void 0;
|
4
|
+
var trackEvent_1 = require("./trackEvent");
|
5
|
+
Object.defineProperty(exports, "trackEvent", { enumerable: true, get: function () { return trackEvent_1.trackEvent; } });
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/iterable/v1/actions/trackEvent/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.trackEvent = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
|
+
const settings_1 = require("../../../settings");
|
7
|
+
const config_1 = require("./config");
|
8
|
+
const client_1 = require("../../client");
|
9
|
+
exports.trackEvent = {
|
10
|
+
key: 'trackEvent',
|
11
|
+
title: 'Track event',
|
12
|
+
description: 'Track an event in Iterable',
|
13
|
+
category: extensions_core_1.Category.COMMUNICATION,
|
14
|
+
fields: config_1.fields,
|
15
|
+
previewable: false,
|
16
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
17
|
+
const { settings: { apiKey }, fields: { eventName, email, userId, dataFields }, } = (0, extensions_core_1.validate)({
|
18
|
+
schema: zod_1.z.object({
|
19
|
+
settings: settings_1.SettingsValidationSchema,
|
20
|
+
fields: config_1.FieldsValidationSchema,
|
21
|
+
}),
|
22
|
+
payload,
|
23
|
+
});
|
24
|
+
const client = new client_1.IterableClient({
|
25
|
+
apiKey,
|
26
|
+
});
|
27
|
+
await client.eventsApi.trackEvent({
|
28
|
+
eventName,
|
29
|
+
email,
|
30
|
+
userId,
|
31
|
+
dataFields,
|
32
|
+
});
|
33
|
+
await onComplete();
|
34
|
+
},
|
35
|
+
};
|
36
|
+
//# sourceMappingURL=trackEvent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"trackEvent.js","sourceRoot":"","sources":["../../../../../../extensions/iterable/v1/actions/trackEvent/trackEvent.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAGvB,mEAAkE;AAClE,gDAA4D;AAC5D,qCAAyD;AACzD,yCAA6C;AAEhC,QAAA,UAAU,GAA2C;IAChE,GAAG,EAAE,YAAY;IACjB,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,4BAA4B;IACzC,QAAQ,EAAE,0BAAQ,CAAC,aAAa;IAChC,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QACxD,MAAM,EACJ,QAAQ,EAAE,EAAE,MAAM,EAAE,EACpB,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GACjD,GAAG,IAAA,0BAAQ,EAAC;YACX,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,QAAQ,EAAE,mCAAwB;gBAClC,MAAM,EAAE,+BAAsB;aAC/B,CAAC;YACF,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,IAAI,uBAAc,CAAC;YAChC,MAAM;SACP,CAAC,CAAA;QAEF,MAAM,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC;YAChC,SAAS;YACT,KAAK;YACL,MAAM;YACN,UAAU;SACX,CAAC,CAAA;QAEF,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;CACF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const __mocks__1 = require("../../client/__mocks__");
|
4
|
+
const __1 = require("..");
|
5
|
+
const tests_1 = require("../../../../../src/tests");
|
6
|
+
jest.mock('../../client');
|
7
|
+
describe('Iterable - Track event', () => {
|
8
|
+
const onComplete = jest.fn();
|
9
|
+
const onError = jest.fn();
|
10
|
+
const basePayload = (0, tests_1.generateTestPayload)({
|
11
|
+
fields: {
|
12
|
+
...__mocks__1.mockTrackEventActionFields,
|
13
|
+
dataFields: JSON.stringify(__mocks__1.mockTrackEventActionFields.dataFields),
|
14
|
+
},
|
15
|
+
settings: {
|
16
|
+
apiKey: 'apiKey',
|
17
|
+
},
|
18
|
+
});
|
19
|
+
beforeEach(() => {
|
20
|
+
jest.clearAllMocks();
|
21
|
+
});
|
22
|
+
test('Should call the onComplete callback', async () => {
|
23
|
+
await __1.trackEvent.onActivityCreated(basePayload, onComplete, onError);
|
24
|
+
expect(__mocks__1.IterableClientMockImplementation.eventsApi.trackEvent).toHaveBeenCalledWith(__mocks__1.mockTrackEventActionFields);
|
25
|
+
expect(onComplete).toHaveBeenCalled();
|
26
|
+
expect(onError).not.toHaveBeenCalled();
|
27
|
+
});
|
28
|
+
});
|
29
|
+
//# sourceMappingURL=trackEvent.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"trackEvent.test.js","sourceRoot":"","sources":["../../../../../../extensions/iterable/v1/actions/trackEvent/trackEvent.test.ts"],"names":[],"mappings":";;AAAA,qDAG+B;AAC/B,0BAA+B;AAC/B,oDAA8D;AAE9D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AAEzB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,MAAM,WAAW,GAAG,IAAA,2BAAmB,EAAC;QACtC,MAAM,EAAE;YACN,GAAG,qCAA0B;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,qCAA0B,CAAC,UAAU,CAAC;SAClE;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ;SACjB;KACF,CAAC,CAAA;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,cAAU,CAAC,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAEpE,MAAM,CACJ,2CAAgC,CAAC,SAAS,CAAC,UAAU,CACtD,CAAC,oBAAoB,CAAC,qCAA0B,CAAC,CAAA;QAClD,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAA;QACrC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type AxiosResponse } from 'axios';
|
2
|
-
import { type ApiResponse, type SendEmailRequest } from './types';
|
2
|
+
import { type TrackEventRequest, type ApiResponse, type SendEmailRequest } from './types';
|
3
3
|
declare class IterableEmailAPI {
|
4
4
|
private readonly _baseApi;
|
5
5
|
constructor({ apiKey }: {
|
@@ -7,8 +7,16 @@ declare class IterableEmailAPI {
|
|
7
7
|
});
|
8
8
|
sendEmail: (body: SendEmailRequest) => Promise<AxiosResponse<ApiResponse>>;
|
9
9
|
}
|
10
|
+
declare class IterableEventsAPI {
|
11
|
+
private readonly _baseApi;
|
12
|
+
constructor({ apiKey }: {
|
13
|
+
apiKey: string;
|
14
|
+
});
|
15
|
+
trackEvent: (body: TrackEventRequest) => Promise<AxiosResponse<ApiResponse>>;
|
16
|
+
}
|
10
17
|
export declare class IterableClient {
|
11
18
|
readonly emailApi: IterableEmailAPI;
|
19
|
+
readonly eventsApi: IterableEventsAPI;
|
12
20
|
constructor({ apiKey }: {
|
13
21
|
apiKey: string;
|
14
22
|
});
|
@@ -53,9 +53,23 @@ class IterableEmailAPI {
|
|
53
53
|
});
|
54
54
|
}
|
55
55
|
}
|
56
|
+
class IterableEventsAPI {
|
57
|
+
constructor({ apiKey }) {
|
58
|
+
this.trackEvent = async (body) => {
|
59
|
+
return await this._baseApi.post('track', {
|
60
|
+
body,
|
61
|
+
});
|
62
|
+
};
|
63
|
+
this._baseApi = new IterableBaseAPI({
|
64
|
+
baseUrl: `https://api.iterable.com/api/events`,
|
65
|
+
apiKey,
|
66
|
+
});
|
67
|
+
}
|
68
|
+
}
|
56
69
|
class IterableClient {
|
57
70
|
constructor({ apiKey }) {
|
58
71
|
this.emailApi = new IterableEmailAPI({ apiKey });
|
72
|
+
this.eventsApi = new IterableEventsAPI({ apiKey });
|
59
73
|
}
|
60
74
|
}
|
61
75
|
exports.IterableClient = IterableClient;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../extensions/iterable/v1/client/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;
|
1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AQC"}
|
@@ -40,3 +40,14 @@ export interface SendEmailRequest {
|
|
40
40
|
allowRepeatMarketingSends?: boolean;
|
41
41
|
metadata?: Record<string, unknown>;
|
42
42
|
}
|
43
|
+
export interface TrackEventRequest {
|
44
|
+
eventName: string;
|
45
|
+
email?: string;
|
46
|
+
userId?: string;
|
47
|
+
id?: string;
|
48
|
+
dataFields?: Record<string, unknown>;
|
49
|
+
createdAt?: number;
|
50
|
+
campaignId?: number;
|
51
|
+
templateId?: number;
|
52
|
+
createNewFields?: boolean;
|
53
|
+
}
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"changelog": "# Hello world changelog"
|
49
49
|
},
|
50
50
|
"iterable": {
|
51
|
-
"readme": "---\ntitle: Iterable\ndescription: Iterable is an email marketing automation platform that allows creating, sending, and tracking personalized email campaigns.\n---\n\n# Iterable\n\nIterable is a marketing automation platform that provides tools and services for businesses to engage with their customers through email, SMS, in-app notifications, and other digital channels. It allows businesses to create and manage personalized marketing campaigns, track customer behavior, and analyze data to optimize their marketing strategies.\n\nIterable offers features such as email marketing, segmentation, A/B testing, workflow automation, and analytics to help businesses deliver the right message to the right audience at the right time.\n\n## Extension settings\n\nIn order to set up this extension, you will need an API key to authenticate with the Iterable API.\n\n## Custom Actions\n\n### Send email\n\nSend an email to a specific email address.\n\n**Important:** Provide a `recipientEmail` or a `recipientUserId` (but not both), depending on how your [project identifies users](https://support.iterable.com/hc/articles/204780579#identifying-users).\n",
|
51
|
+
"readme": "---\ntitle: Iterable\ndescription: Iterable is an email marketing automation platform that allows creating, sending, and tracking personalized email campaigns.\n---\n\n# Iterable\n\nIterable is a marketing automation platform that provides tools and services for businesses to engage with their customers through email, SMS, in-app notifications, and other digital channels. It allows businesses to create and manage personalized marketing campaigns, track customer behavior, and analyze data to optimize their marketing strategies.\n\nIterable offers features such as email marketing, segmentation, A/B testing, workflow automation, and analytics to help businesses deliver the right message to the right audience at the right time.\n\n## Extension settings\n\nIn order to set up this extension, you will need an API key to authenticate with the Iterable API.\n\n## Custom Actions\n\n### Send email\n\nSend an email to a specific email address.\n\n**Important:** Provide a `recipientEmail` or a `recipientUserId` (but not both), depending on how your [project identifies users](https://support.iterable.com/hc/articles/204780579#identifying-users).\n\n### Track Event\n\nTrack an event in Iterable.\n\n**Important:** Provide an `email` or a `userId` (but not both), depending on how your [project identifies users](https://support.iterable.com/hc/articles/204780579#identifying-users).\n",
|
52
52
|
"changelog": "# Iterable changelog\n"
|
53
53
|
},
|
54
54
|
"mailchimp": {
|