@prismatic-io/components-gotowebinar 0.0.0-stage → 0.0.1
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/README.md +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +225 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +1993 -0
- package/npm-dist/index.d.cts +1411 -0
- package/package.json +54 -4
|
@@ -0,0 +1,1993 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
24
|
+
let json_bigint = require("json-bigint");
|
|
25
|
+
json_bigint = __toESM(json_bigint);
|
|
26
|
+
let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
|
|
27
|
+
//#region src/constants.ts
|
|
28
|
+
const GENERAL_DELETE_MESSAGE = { data: { message: "Action performed successfully." } };
|
|
29
|
+
const MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS = ["True", "False"].map((value) => ({
|
|
30
|
+
value: value.toLowerCase(),
|
|
31
|
+
label: value
|
|
32
|
+
}));
|
|
33
|
+
const WEBINAR_TYPE_MODEL = [
|
|
34
|
+
{
|
|
35
|
+
value: "single_session",
|
|
36
|
+
label: "Single Session"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "series",
|
|
40
|
+
label: "Series"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "sequence",
|
|
44
|
+
label: "Sequence"
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
const AVAILABLE_LOCALES_FOR_WEBINAR_MODEL = [
|
|
48
|
+
{
|
|
49
|
+
value: "en_US",
|
|
50
|
+
label: "English (United States)"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "fr_FR",
|
|
54
|
+
label: "French (France)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "de_DE",
|
|
58
|
+
label: "German (Germany)"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "es_ES",
|
|
62
|
+
label: "Spanish (Spain)"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "it_IT",
|
|
66
|
+
label: "Italian (Italy)"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: "zh_CN",
|
|
70
|
+
label: "Chinese (China)"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
const AVAILABLE_EXPERIENCES_MODEL = [
|
|
74
|
+
{
|
|
75
|
+
value: "CLASSIC",
|
|
76
|
+
label: "Classic"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: "SIMULIVE",
|
|
80
|
+
label: "Simulive"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: "BROADCAST",
|
|
84
|
+
label: "Broadcast"
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
const EVENT_NAMES_MODEL = [
|
|
88
|
+
{
|
|
89
|
+
value: "registrant.added",
|
|
90
|
+
label: "Registrant Added"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
value: "registrant.joined",
|
|
94
|
+
label: "Registrant Joined"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
value: "webinar.created",
|
|
98
|
+
label: "Webinar Created"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
value: "webinar.changed",
|
|
102
|
+
label: "Webinar Changed"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
const USER_SUBSCRIPTION_STATUS_MODEL = [{
|
|
106
|
+
value: "ACTIVE",
|
|
107
|
+
label: "Active"
|
|
108
|
+
}, {
|
|
109
|
+
value: "INACTIVE",
|
|
110
|
+
label: "Inactive"
|
|
111
|
+
}];
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/util/index.ts
|
|
114
|
+
const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
|
|
115
|
+
const toOptionalNumber = (value) => value ? _prismatic_io_spectral.util.types.toNumber(value) : void 0;
|
|
116
|
+
const toOptionalBoolean = (value) => {
|
|
117
|
+
const str = _prismatic_io_spectral.util.types.toString(value);
|
|
118
|
+
return str === "true" ? true : str === "false" ? false : void 0;
|
|
119
|
+
};
|
|
120
|
+
const toOptionalEmailSetting = (value) => {
|
|
121
|
+
const bool = toOptionalBoolean(value);
|
|
122
|
+
if (bool === void 0) return;
|
|
123
|
+
return { enabled: bool };
|
|
124
|
+
};
|
|
125
|
+
const toOptionalObject = (value) => {
|
|
126
|
+
if (!value) return;
|
|
127
|
+
return _prismatic_io_spectral.util.types.toObject(value);
|
|
128
|
+
};
|
|
129
|
+
const lookBackDateClean = (value) => {
|
|
130
|
+
const str = _prismatic_io_spectral.util.types.toString(value).trim();
|
|
131
|
+
if (!str) return "";
|
|
132
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(str)) throw new Error("Look-back Date must be in YYYY-MM-DD format.");
|
|
133
|
+
const [year, month, day] = str.split("-").map((part) => _prismatic_io_spectral.util.types.toNumber(part));
|
|
134
|
+
const parsed = new Date(year, month - 1, day);
|
|
135
|
+
if (parsed.getFullYear() !== year || parsed.getMonth() !== month - 1 || parsed.getDate() !== day) throw new Error(`Look-back Date "${str}" is not a valid calendar date.`);
|
|
136
|
+
if (parsed > /* @__PURE__ */ new Date()) throw new Error("Look-back Date cannot be a future date.");
|
|
137
|
+
return str;
|
|
138
|
+
};
|
|
139
|
+
const getT = async (client, url, key, params) => {
|
|
140
|
+
const { data: { _embedded } } = await client.get(url, { params });
|
|
141
|
+
if (!_embedded) return [];
|
|
142
|
+
return _embedded[key];
|
|
143
|
+
};
|
|
144
|
+
const filterAndMapByCallbackUrl = (callbackUrls, collection, keyToMapBy) => {
|
|
145
|
+
return collection.filter((o) => callbackUrls.includes(o.callbackUrl)).map((o) => o[keyToMapBy]);
|
|
146
|
+
};
|
|
147
|
+
const deleteByKeys = async (client, url, collectionKeys) => {
|
|
148
|
+
await client.delete(url, { data: collectionKeys });
|
|
149
|
+
};
|
|
150
|
+
const bigIntTransformerConfig = { transformResponse: [(data) => {
|
|
151
|
+
if (typeof data === "string") return json_bigint.default.parse(data);
|
|
152
|
+
return data;
|
|
153
|
+
}] };
|
|
154
|
+
const parseRegistrantKey = (registrantKey) => {
|
|
155
|
+
return registrantKey.reduce((acc, element) => {
|
|
156
|
+
return `${acc}${element}`;
|
|
157
|
+
}, "");
|
|
158
|
+
};
|
|
159
|
+
const deleteInstancedWebhooks = async (client, callbackUrls, params) => {
|
|
160
|
+
const NO_WEBHOOKS = 0;
|
|
161
|
+
const webhooks = await getT(client, "/webhooks", "webhooks", params);
|
|
162
|
+
if (webhooks.length === NO_WEBHOOKS) return;
|
|
163
|
+
const instanceWebhookKeys = filterAndMapByCallbackUrl(callbackUrls, webhooks, "webhookKey");
|
|
164
|
+
await deleteByKeys(client, "/webhooks", instanceWebhookKeys);
|
|
165
|
+
const userSubscriptions = await getT(client, "/userSubscriptions", "userSubscriptions", params);
|
|
166
|
+
const instanceUserSubscriptions = filterAndMapByCallbackUrl(callbackUrls, userSubscriptions, "userSubscriptionKey");
|
|
167
|
+
await deleteByKeys(client, "/userSubscriptions", instanceUserSubscriptions);
|
|
168
|
+
};
|
|
169
|
+
const getFromTime = () => {
|
|
170
|
+
const from = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
|
|
171
|
+
from.setMonth(from.getMonth() - 3);
|
|
172
|
+
from.setHours(0, 0, 0, 0);
|
|
173
|
+
return `${from.toISOString().slice(0, 19)}Z`;
|
|
174
|
+
};
|
|
175
|
+
const getEndTime = () => {
|
|
176
|
+
const end = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
|
|
177
|
+
end.setHours(23, 59, 59, 999);
|
|
178
|
+
return `${end.toISOString().slice(0, 19)}Z`;
|
|
179
|
+
};
|
|
180
|
+
const fetchAllResults = async (client, url, key, params) => {
|
|
181
|
+
const results = [];
|
|
182
|
+
const size = 5;
|
|
183
|
+
let pageNumber = 0;
|
|
184
|
+
let totalPages = 0;
|
|
185
|
+
do {
|
|
186
|
+
const { data: { page, _embedded } } = await client.get(url, { params: {
|
|
187
|
+
...params,
|
|
188
|
+
size,
|
|
189
|
+
page: pageNumber
|
|
190
|
+
} });
|
|
191
|
+
if (_embedded?.[key]) results.push(..._embedded[key]);
|
|
192
|
+
totalPages = page.totalPages;
|
|
193
|
+
pageNumber += 1;
|
|
194
|
+
} while (pageNumber <= totalPages);
|
|
195
|
+
return results;
|
|
196
|
+
};
|
|
197
|
+
const fetchAllRegistrants = async (client, organizerKey, webinarKey) => {
|
|
198
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
|
199
|
+
const all = [];
|
|
200
|
+
for (let page = 0; page < 50; page += 1) {
|
|
201
|
+
const { data } = await client.get(url, {
|
|
202
|
+
params: {
|
|
203
|
+
page,
|
|
204
|
+
limit: 200
|
|
205
|
+
},
|
|
206
|
+
transformResponse: bigIntTransformerConfig.transformResponse
|
|
207
|
+
});
|
|
208
|
+
if (!Array.isArray(data) || data.length === 0) break;
|
|
209
|
+
all.push(...data.map((registrant) => ({
|
|
210
|
+
...registrant,
|
|
211
|
+
registrantKey: parseRegistrantKey(registrant.registrantKey.c)
|
|
212
|
+
})));
|
|
213
|
+
if (data.length < 200) break;
|
|
214
|
+
}
|
|
215
|
+
return all;
|
|
216
|
+
};
|
|
217
|
+
const filterRegistrantsRegisteredAfter = (registrants, lastPolledAt) => {
|
|
218
|
+
const lastPolledAtMs = new Date(lastPolledAt).getTime();
|
|
219
|
+
return registrants.filter((registrant) => {
|
|
220
|
+
const registeredMs = registrant.registrationDate ? new Date(registrant.registrationDate).getTime() : NaN;
|
|
221
|
+
return !Number.isNaN(registeredMs) && registeredMs > lastPolledAtMs;
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const lookBackDateToCursor = (lookBackDate) => (/* @__PURE__ */ new Date(Date.parse(`${lookBackDate}T00:00:00.000Z`) - 1)).toISOString();
|
|
225
|
+
const resolvePollingRecordChanges = (data) => {
|
|
226
|
+
return [...((data ?? { created: [] }).created ?? []).map((record) => ({
|
|
227
|
+
changeType: "created",
|
|
228
|
+
record
|
|
229
|
+
}))];
|
|
230
|
+
};
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/inputs/common.ts
|
|
233
|
+
const connection = (0, _prismatic_io_spectral.input)({
|
|
234
|
+
label: "Connection",
|
|
235
|
+
type: "connection",
|
|
236
|
+
required: true
|
|
237
|
+
});
|
|
238
|
+
const pageNumber = (0, _prismatic_io_spectral.input)({
|
|
239
|
+
label: "Page Number",
|
|
240
|
+
comments: "The zero-based index of the page to return. The first page is 0.",
|
|
241
|
+
type: "string",
|
|
242
|
+
required: false,
|
|
243
|
+
example: "0",
|
|
244
|
+
placeholder: "Enter a page number",
|
|
245
|
+
clean: toOptionalNumber
|
|
246
|
+
});
|
|
247
|
+
const pageSize = (0, _prismatic_io_spectral.input)({
|
|
248
|
+
label: "Page Size",
|
|
249
|
+
comments: "The maximum number of results to return per page. The maximum value is 200.",
|
|
250
|
+
type: "string",
|
|
251
|
+
required: false,
|
|
252
|
+
example: "200",
|
|
253
|
+
placeholder: "Enter a page size",
|
|
254
|
+
clean: (value) => {
|
|
255
|
+
const size = toOptionalNumber(value);
|
|
256
|
+
if (!size) return size;
|
|
257
|
+
return size > 200 ? 200 : size;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
const fromTime = (0, _prismatic_io_spectral.input)({
|
|
261
|
+
label: "From Time",
|
|
262
|
+
comments: "The start of the date/time range to query, in ISO 8601 UTC format. Format: YYYY-MM-DDThh:mm:ssZ.",
|
|
263
|
+
type: "string",
|
|
264
|
+
required: true,
|
|
265
|
+
example: "2020-03-13T10:00:00Z",
|
|
266
|
+
placeholder: "Enter a start date/time",
|
|
267
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
268
|
+
});
|
|
269
|
+
const toTime = (0, _prismatic_io_spectral.input)({
|
|
270
|
+
label: "To Time",
|
|
271
|
+
comments: "The end of the date/time range to query, in ISO 8601 UTC format. Format: YYYY-MM-DDThh:mm:ssZ.",
|
|
272
|
+
type: "string",
|
|
273
|
+
required: true,
|
|
274
|
+
example: "2020-03-13T10:00:00Z",
|
|
275
|
+
placeholder: "Enter an end date/time",
|
|
276
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
277
|
+
});
|
|
278
|
+
const accountKey = (0, _prismatic_io_spectral.input)({
|
|
279
|
+
label: "Account Key",
|
|
280
|
+
comments: "The unique identifier for the account.",
|
|
281
|
+
type: "string",
|
|
282
|
+
required: true,
|
|
283
|
+
example: "1234567890",
|
|
284
|
+
placeholder: "Enter an account key",
|
|
285
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
286
|
+
});
|
|
287
|
+
const webinarKey = (0, _prismatic_io_spectral.input)({
|
|
288
|
+
label: "Webinar Key",
|
|
289
|
+
comments: "The unique identifier for the webinar.",
|
|
290
|
+
type: "string",
|
|
291
|
+
required: true,
|
|
292
|
+
example: "1234567890",
|
|
293
|
+
placeholder: "Enter a webinar key",
|
|
294
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
295
|
+
dataSource: "selectWebinar"
|
|
296
|
+
});
|
|
297
|
+
const timezone = (0, _prismatic_io_spectral.input)({
|
|
298
|
+
label: "Timezone",
|
|
299
|
+
comments: "The time zone where the webinar is taking place (must be a valid time zone ID). If this parameter is not passed, the timezone of the organizer's profile will be used.",
|
|
300
|
+
type: "string",
|
|
301
|
+
required: false,
|
|
302
|
+
example: "America/Chicago",
|
|
303
|
+
placeholder: "Enter a time zone ID",
|
|
304
|
+
clean: toOptionalString
|
|
305
|
+
});
|
|
306
|
+
const webinarType = (0, _prismatic_io_spectral.input)({
|
|
307
|
+
label: "Webinar Type",
|
|
308
|
+
comments: "The scheduling format for the webinar. Select 'Single Session' for a one-time event, 'Series' for multiple related sessions, or 'Sequence' for an ordered set of sessions.",
|
|
309
|
+
type: "string",
|
|
310
|
+
required: true,
|
|
311
|
+
model: WEBINAR_TYPE_MODEL,
|
|
312
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
313
|
+
});
|
|
314
|
+
const locale = (0, _prismatic_io_spectral.input)({
|
|
315
|
+
label: "Locale",
|
|
316
|
+
comments: "The language and region used for the webinar's display text.",
|
|
317
|
+
type: "string",
|
|
318
|
+
required: false,
|
|
319
|
+
model: AVAILABLE_LOCALES_FOR_WEBINAR_MODEL,
|
|
320
|
+
example: "en_US",
|
|
321
|
+
placeholder: "Enter a locale",
|
|
322
|
+
clean: toOptionalString
|
|
323
|
+
});
|
|
324
|
+
const registrantKey = (0, _prismatic_io_spectral.input)({
|
|
325
|
+
label: "Registrant Key",
|
|
326
|
+
comments: "The unique identifier for the registrant.",
|
|
327
|
+
type: "string",
|
|
328
|
+
required: true,
|
|
329
|
+
example: "1234567890",
|
|
330
|
+
placeholder: "Enter a registrant key",
|
|
331
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
332
|
+
dataSource: "selectRegistrant"
|
|
333
|
+
});
|
|
334
|
+
const sessionKey = (0, _prismatic_io_spectral.input)({
|
|
335
|
+
label: "Session Key",
|
|
336
|
+
comments: "The unique identifier for the webinar session.",
|
|
337
|
+
type: "string",
|
|
338
|
+
required: true,
|
|
339
|
+
example: "1234567890",
|
|
340
|
+
placeholder: "Enter a session key",
|
|
341
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
342
|
+
});
|
|
343
|
+
const userSubscriptionKey = (0, _prismatic_io_spectral.input)({
|
|
344
|
+
label: "User Subscription Key",
|
|
345
|
+
comments: "The unique identifier for the user subscription.",
|
|
346
|
+
type: "string",
|
|
347
|
+
required: true,
|
|
348
|
+
example: "1234567890",
|
|
349
|
+
placeholder: "Enter a user subscription key",
|
|
350
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
351
|
+
dataSource: "selectWebhook"
|
|
352
|
+
});
|
|
353
|
+
const fetchAll = (0, _prismatic_io_spectral.input)({
|
|
354
|
+
label: "Fetch All",
|
|
355
|
+
comments: "When true, automatically fetches all pages of results using pagination. When false, only the first page is fetched.",
|
|
356
|
+
type: "boolean",
|
|
357
|
+
required: false,
|
|
358
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
359
|
+
});
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/inputs/attendees.ts
|
|
362
|
+
const getAttendeeInputs = {
|
|
363
|
+
connection,
|
|
364
|
+
webinarKey,
|
|
365
|
+
sessionKey,
|
|
366
|
+
registrantKey
|
|
367
|
+
};
|
|
368
|
+
const listAllAttendeesInputs = {
|
|
369
|
+
connection,
|
|
370
|
+
webinarKey,
|
|
371
|
+
fetchAll
|
|
372
|
+
};
|
|
373
|
+
const listSessionAttendeesInputs = {
|
|
374
|
+
connection,
|
|
375
|
+
webinarKey,
|
|
376
|
+
sessionKey
|
|
377
|
+
};
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/inputs/registrants.ts
|
|
380
|
+
const firstName = (0, _prismatic_io_spectral.input)({
|
|
381
|
+
label: "First Name",
|
|
382
|
+
comments: "The first name of the registrant.",
|
|
383
|
+
type: "string",
|
|
384
|
+
required: true,
|
|
385
|
+
example: "John",
|
|
386
|
+
placeholder: "Enter a first name",
|
|
387
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
388
|
+
});
|
|
389
|
+
const lastName = (0, _prismatic_io_spectral.input)({
|
|
390
|
+
label: "Last Name",
|
|
391
|
+
comments: "The last name of the registrant.",
|
|
392
|
+
type: "string",
|
|
393
|
+
required: true,
|
|
394
|
+
example: "Doe",
|
|
395
|
+
placeholder: "Enter a last name",
|
|
396
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
397
|
+
});
|
|
398
|
+
const email = (0, _prismatic_io_spectral.input)({
|
|
399
|
+
label: "Email",
|
|
400
|
+
comments: "The email address of the registrant.",
|
|
401
|
+
type: "string",
|
|
402
|
+
required: true,
|
|
403
|
+
example: "johndoe@testemail.com",
|
|
404
|
+
placeholder: "Enter an email address",
|
|
405
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
406
|
+
});
|
|
407
|
+
const source = (0, _prismatic_io_spectral.input)({
|
|
408
|
+
label: "Source",
|
|
409
|
+
comments: "The source that led to the registration. This can be any string like 'Newsletter 123' or 'Marketing campaign ABC'.",
|
|
410
|
+
type: "string",
|
|
411
|
+
required: false,
|
|
412
|
+
example: "website",
|
|
413
|
+
placeholder: "Enter a registration source",
|
|
414
|
+
clean: toOptionalString
|
|
415
|
+
});
|
|
416
|
+
const address = (0, _prismatic_io_spectral.input)({
|
|
417
|
+
label: "Address",
|
|
418
|
+
comments: "The street address of the registrant.",
|
|
419
|
+
type: "string",
|
|
420
|
+
required: false,
|
|
421
|
+
example: "123 Main St",
|
|
422
|
+
placeholder: "Enter a street address",
|
|
423
|
+
clean: toOptionalString
|
|
424
|
+
});
|
|
425
|
+
const city = (0, _prismatic_io_spectral.input)({
|
|
426
|
+
label: "City",
|
|
427
|
+
comments: "The city of the registrant.",
|
|
428
|
+
type: "string",
|
|
429
|
+
required: false,
|
|
430
|
+
example: "Sioux Falls",
|
|
431
|
+
placeholder: "Enter a city",
|
|
432
|
+
clean: toOptionalString
|
|
433
|
+
});
|
|
434
|
+
const state = (0, _prismatic_io_spectral.input)({
|
|
435
|
+
label: "State",
|
|
436
|
+
comments: "The state or province of the registrant.",
|
|
437
|
+
type: "string",
|
|
438
|
+
required: false,
|
|
439
|
+
example: "South Dakota",
|
|
440
|
+
placeholder: "Enter a state",
|
|
441
|
+
clean: toOptionalString
|
|
442
|
+
});
|
|
443
|
+
const zipCode = (0, _prismatic_io_spectral.input)({
|
|
444
|
+
label: "Zip Code",
|
|
445
|
+
comments: "The postal code of the registrant.",
|
|
446
|
+
type: "string",
|
|
447
|
+
required: false,
|
|
448
|
+
example: "57104",
|
|
449
|
+
placeholder: "Enter a zip code",
|
|
450
|
+
clean: toOptionalString
|
|
451
|
+
});
|
|
452
|
+
const country = (0, _prismatic_io_spectral.input)({
|
|
453
|
+
label: "Country",
|
|
454
|
+
comments: "The country of the registrant.",
|
|
455
|
+
type: "string",
|
|
456
|
+
required: false,
|
|
457
|
+
example: "United States",
|
|
458
|
+
placeholder: "Enter a country",
|
|
459
|
+
clean: toOptionalString
|
|
460
|
+
});
|
|
461
|
+
const phone = (0, _prismatic_io_spectral.input)({
|
|
462
|
+
label: "Phone",
|
|
463
|
+
comments: "The phone number of the registrant.",
|
|
464
|
+
type: "string",
|
|
465
|
+
required: false,
|
|
466
|
+
example: "605-555-5555",
|
|
467
|
+
placeholder: "Enter a phone number",
|
|
468
|
+
clean: toOptionalString
|
|
469
|
+
});
|
|
470
|
+
const organization = (0, _prismatic_io_spectral.input)({
|
|
471
|
+
label: "Organization",
|
|
472
|
+
comments: "The organization the registrant belongs to.",
|
|
473
|
+
type: "string",
|
|
474
|
+
required: false,
|
|
475
|
+
example: "Acme Corp",
|
|
476
|
+
placeholder: "Enter an organization",
|
|
477
|
+
clean: toOptionalString
|
|
478
|
+
});
|
|
479
|
+
const jobTitle = (0, _prismatic_io_spectral.input)({
|
|
480
|
+
label: "Job Title",
|
|
481
|
+
comments: "The job title of the registrant.",
|
|
482
|
+
type: "string",
|
|
483
|
+
required: false,
|
|
484
|
+
example: "Software Engineer",
|
|
485
|
+
placeholder: "Enter a job title",
|
|
486
|
+
clean: toOptionalString
|
|
487
|
+
});
|
|
488
|
+
const questionAndComments = (0, _prismatic_io_spectral.input)({
|
|
489
|
+
label: "Questions and Comments",
|
|
490
|
+
comments: "Any questions or comments submitted by the registrant.",
|
|
491
|
+
type: "string",
|
|
492
|
+
required: false,
|
|
493
|
+
example: "I have a question about the webinar.",
|
|
494
|
+
placeholder: "Enter any questions or comments",
|
|
495
|
+
clean: toOptionalString
|
|
496
|
+
});
|
|
497
|
+
const industry = (0, _prismatic_io_spectral.input)({
|
|
498
|
+
label: "Industry",
|
|
499
|
+
comments: "The industry the registrant works in.",
|
|
500
|
+
type: "string",
|
|
501
|
+
required: false,
|
|
502
|
+
example: "IT",
|
|
503
|
+
placeholder: "Enter an industry",
|
|
504
|
+
clean: toOptionalString
|
|
505
|
+
});
|
|
506
|
+
const numberOfEmployees = (0, _prismatic_io_spectral.input)({
|
|
507
|
+
label: "Number of Employees",
|
|
508
|
+
comments: "The number of employees in the registrant's organization.",
|
|
509
|
+
type: "string",
|
|
510
|
+
required: false,
|
|
511
|
+
example: "100",
|
|
512
|
+
placeholder: "Enter a number of employees",
|
|
513
|
+
clean: toOptionalNumber
|
|
514
|
+
});
|
|
515
|
+
const purchasingTimeFrame = (0, _prismatic_io_spectral.input)({
|
|
516
|
+
label: "Purchasing Time Frame",
|
|
517
|
+
comments: "The time frame within which the product will be purchased.",
|
|
518
|
+
type: "string",
|
|
519
|
+
required: false,
|
|
520
|
+
example: "1-3 months",
|
|
521
|
+
placeholder: "Enter a purchasing time frame",
|
|
522
|
+
clean: toOptionalString
|
|
523
|
+
});
|
|
524
|
+
const purchasingRole = (0, _prismatic_io_spectral.input)({
|
|
525
|
+
label: "Purchasing Role",
|
|
526
|
+
comments: "The role of the registrant in the purchasing process.",
|
|
527
|
+
type: "string",
|
|
528
|
+
required: false,
|
|
529
|
+
example: "Decision Maker",
|
|
530
|
+
placeholder: "Enter a purchasing role",
|
|
531
|
+
clean: toOptionalString
|
|
532
|
+
});
|
|
533
|
+
const responses = (0, _prismatic_io_spectral.input)({
|
|
534
|
+
label: "Responses",
|
|
535
|
+
comments: "The answers to the webinar's custom registration questions. Provide a JSON array of question/response objects.",
|
|
536
|
+
type: "code",
|
|
537
|
+
language: "json",
|
|
538
|
+
required: false,
|
|
539
|
+
example: JSON.stringify([{
|
|
540
|
+
questionKey: "qkey",
|
|
541
|
+
responseText: "responseText",
|
|
542
|
+
answerKey: "akey"
|
|
543
|
+
}], null, 2),
|
|
544
|
+
clean: toOptionalObject
|
|
545
|
+
});
|
|
546
|
+
const createRegistrantInputs = {
|
|
547
|
+
connection,
|
|
548
|
+
firstName,
|
|
549
|
+
lastName,
|
|
550
|
+
webinarKey,
|
|
551
|
+
email,
|
|
552
|
+
phone,
|
|
553
|
+
source,
|
|
554
|
+
mailingAddress: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
555
|
+
label: "Address",
|
|
556
|
+
required: false,
|
|
557
|
+
comments: "Street address, city, state, zip code, and country.",
|
|
558
|
+
inputs: {
|
|
559
|
+
address,
|
|
560
|
+
city,
|
|
561
|
+
state,
|
|
562
|
+
zipCode,
|
|
563
|
+
country
|
|
564
|
+
}
|
|
565
|
+
}),
|
|
566
|
+
additionalFields: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
567
|
+
label: "Additional Fields",
|
|
568
|
+
required: false,
|
|
569
|
+
comments: "Additional optional fields: includes Organization, Job Title, Industry, Number of Employees, Purchasing Time Frame, Purchasing Role, Questions and Comments, and Responses.",
|
|
570
|
+
inputs: {
|
|
571
|
+
organization,
|
|
572
|
+
jobTitle,
|
|
573
|
+
industry,
|
|
574
|
+
numberOfEmployees,
|
|
575
|
+
purchasingTimeFrame,
|
|
576
|
+
purchasingRole,
|
|
577
|
+
questionAndComments,
|
|
578
|
+
responses
|
|
579
|
+
}
|
|
580
|
+
})
|
|
581
|
+
};
|
|
582
|
+
const getRegistrantInputs = {
|
|
583
|
+
connection,
|
|
584
|
+
webinarKey,
|
|
585
|
+
registrantKey
|
|
586
|
+
};
|
|
587
|
+
const deleteRegistrantInputs = getRegistrantInputs;
|
|
588
|
+
const listRegistrantsInputs = {
|
|
589
|
+
connection,
|
|
590
|
+
webinarKey,
|
|
591
|
+
pagination: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
592
|
+
label: "Pagination",
|
|
593
|
+
required: false,
|
|
594
|
+
comments: "Page number and page size for paginated results.",
|
|
595
|
+
inputs: {
|
|
596
|
+
page: pageNumber,
|
|
597
|
+
limit: pageSize
|
|
598
|
+
}
|
|
599
|
+
})
|
|
600
|
+
};
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/inputs/triggers.ts
|
|
603
|
+
const lookBackDate = (0, _prismatic_io_spectral.input)({
|
|
604
|
+
label: "Look-back Date",
|
|
605
|
+
placeholder: "Enter look-back date (YYYY-MM-DD)",
|
|
606
|
+
type: "string",
|
|
607
|
+
required: false,
|
|
608
|
+
comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each registrant who registered on or after this date once.",
|
|
609
|
+
example: "2026-01-01",
|
|
610
|
+
clean: lookBackDateClean
|
|
611
|
+
});
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/inputs/userSubscriptions.ts
|
|
614
|
+
const webhookUrl = (0, _prismatic_io_spectral.input)({
|
|
615
|
+
label: "Webhook URL",
|
|
616
|
+
comments: "The HTTPS URL that receives posted webhook events. The endpoint must return 200 OK for GET requests.",
|
|
617
|
+
type: "string",
|
|
618
|
+
required: true,
|
|
619
|
+
example: "https://example.com/webhook",
|
|
620
|
+
placeholder: "Enter a webhook URL",
|
|
621
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
622
|
+
});
|
|
623
|
+
const eventName = (0, _prismatic_io_spectral.input)({
|
|
624
|
+
label: "Event Name",
|
|
625
|
+
comments: "The event to subscribe to.",
|
|
626
|
+
type: "string",
|
|
627
|
+
required: true,
|
|
628
|
+
model: EVENT_NAMES_MODEL,
|
|
629
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
630
|
+
});
|
|
631
|
+
const eventVersion = (0, _prismatic_io_spectral.input)({
|
|
632
|
+
label: "Event Version",
|
|
633
|
+
comments: "The schema version of the event payload to receive.",
|
|
634
|
+
type: "string",
|
|
635
|
+
required: true,
|
|
636
|
+
default: "1.0.0",
|
|
637
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
638
|
+
});
|
|
639
|
+
const userSubscriptionKeys = (0, _prismatic_io_spectral.input)({
|
|
640
|
+
label: "User Subscription Keys",
|
|
641
|
+
comments: "The user subscription keys to act upon. Provide a JSON array of key strings.",
|
|
642
|
+
type: "code",
|
|
643
|
+
language: "json",
|
|
644
|
+
required: true,
|
|
645
|
+
example: JSON.stringify(["subscription_id1", "subscription_id2"], null, 2),
|
|
646
|
+
clean: (value) => {
|
|
647
|
+
return _prismatic_io_spectral.util.types.toObject(value).map((us) => {
|
|
648
|
+
return _prismatic_io_spectral.util.types.toString(us);
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
const deleteWebhook = (0, _prismatic_io_spectral.input)({
|
|
653
|
+
label: "Delete Webhooks",
|
|
654
|
+
comments: "When true, the affiliated webhook is deleted along with the user subscription. Note that deleting the webhook will also delete any other user subscriptions tied to the corresponding webhook key.",
|
|
655
|
+
type: "boolean",
|
|
656
|
+
required: true,
|
|
657
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
658
|
+
});
|
|
659
|
+
const webhookKey = (0, _prismatic_io_spectral.input)({
|
|
660
|
+
label: "Webhook Key",
|
|
661
|
+
comments: "The unique identifier for the webhook to update.",
|
|
662
|
+
type: "string",
|
|
663
|
+
required: true,
|
|
664
|
+
example: "webhookKey1",
|
|
665
|
+
placeholder: "Enter a webhook key",
|
|
666
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
667
|
+
});
|
|
668
|
+
const updateUserSubscriptionKey = (0, _prismatic_io_spectral.input)({
|
|
669
|
+
label: "User Subscription Key",
|
|
670
|
+
comments: "The unique identifier for the user subscription to update.",
|
|
671
|
+
type: "string",
|
|
672
|
+
required: true,
|
|
673
|
+
example: "userSubscriptionKey1",
|
|
674
|
+
placeholder: "Enter a user subscription key",
|
|
675
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
676
|
+
});
|
|
677
|
+
const userSubscriptionState = (0, _prismatic_io_spectral.input)({
|
|
678
|
+
label: "User Subscription State",
|
|
679
|
+
comments: "The status to apply to the user subscription.",
|
|
680
|
+
type: "string",
|
|
681
|
+
required: true,
|
|
682
|
+
example: "ACTIVE",
|
|
683
|
+
placeholder: "Enter a subscription state",
|
|
684
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
685
|
+
model: USER_SUBSCRIPTION_STATUS_MODEL
|
|
686
|
+
});
|
|
687
|
+
const getUserSubscriptionInputs = {
|
|
688
|
+
connection,
|
|
689
|
+
userSubscriptionKey
|
|
690
|
+
};
|
|
691
|
+
const listUserSubscriptionsInputs = { connection };
|
|
692
|
+
const createUserSubscriptionInputs = {
|
|
693
|
+
connection,
|
|
694
|
+
webhookUrl,
|
|
695
|
+
eventName,
|
|
696
|
+
eventVersion
|
|
697
|
+
};
|
|
698
|
+
const updateUserSubscriptionInputs = {
|
|
699
|
+
connection,
|
|
700
|
+
webhookKey,
|
|
701
|
+
userSubscriptionKey: updateUserSubscriptionKey,
|
|
702
|
+
userSubscriptionState,
|
|
703
|
+
callbackUrl: {
|
|
704
|
+
...webhookUrl,
|
|
705
|
+
required: false,
|
|
706
|
+
clean: toOptionalString
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
const deleteUserSubscriptionInputs = {
|
|
710
|
+
connection,
|
|
711
|
+
userSubscriptionKeys,
|
|
712
|
+
deleteWebhook
|
|
713
|
+
};
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/inputs/webhooks.ts
|
|
716
|
+
const deleteInstancedWebhooksInputs = { connection };
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/inputs/webinars.ts
|
|
719
|
+
const subject = (0, _prismatic_io_spectral.input)({
|
|
720
|
+
label: "Subject",
|
|
721
|
+
comments: "The title displayed for the webinar.",
|
|
722
|
+
type: "string",
|
|
723
|
+
required: true,
|
|
724
|
+
example: "How to Create a Webinar",
|
|
725
|
+
placeholder: "Enter a subject",
|
|
726
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
727
|
+
});
|
|
728
|
+
const description = (0, _prismatic_io_spectral.input)({
|
|
729
|
+
label: "Description",
|
|
730
|
+
comments: "A summary of what the webinar covers.",
|
|
731
|
+
type: "string",
|
|
732
|
+
required: false,
|
|
733
|
+
example: "Learn how to create a webinar from scratch",
|
|
734
|
+
placeholder: "Enter a description",
|
|
735
|
+
clean: toOptionalString
|
|
736
|
+
});
|
|
737
|
+
const times = (0, _prismatic_io_spectral.input)({
|
|
738
|
+
label: "Time Range for Webinar",
|
|
739
|
+
comments: "Time Range Array for the webinar. Please note that the examples provided describe the expected payload given all webinar types. Only one array should be used based on the webinar type.",
|
|
740
|
+
type: "code",
|
|
741
|
+
language: "json",
|
|
742
|
+
required: true,
|
|
743
|
+
example: JSON.stringify([
|
|
744
|
+
{ single_session_webinar_type_example: [{
|
|
745
|
+
startTime: "2020-03-13T10:00:00Z",
|
|
746
|
+
endTime: "2020-03-13T11:00:00Z"
|
|
747
|
+
}] },
|
|
748
|
+
{ series_webinar_type_example: [{
|
|
749
|
+
startTime: "2020-03-13T10:00:00Z",
|
|
750
|
+
endTime: "2020-03-13T11:00:00Z"
|
|
751
|
+
}, {
|
|
752
|
+
startTime: "2020-03-20T10:00:00Z",
|
|
753
|
+
endTime: "2020-03-20T11:00:00Z"
|
|
754
|
+
}] },
|
|
755
|
+
{ sequence_webinar_type_example: [{
|
|
756
|
+
startTime: "2020-03-13T10:00:00Z",
|
|
757
|
+
endTime: "2020-03-13T11:00:00Z"
|
|
758
|
+
}] }
|
|
759
|
+
]),
|
|
760
|
+
clean: _prismatic_io_spectral.util.types.toObject
|
|
761
|
+
});
|
|
762
|
+
const isPasswordProtected = (0, _prismatic_io_spectral.input)({
|
|
763
|
+
label: "Is Password Protected",
|
|
764
|
+
comments: "Indicates if the webinar is password protected.",
|
|
765
|
+
type: "string",
|
|
766
|
+
required: false,
|
|
767
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
768
|
+
default: "false",
|
|
769
|
+
clean: toOptionalBoolean
|
|
770
|
+
});
|
|
771
|
+
const recordingAssetKey = (0, _prismatic_io_spectral.input)({
|
|
772
|
+
label: "Recording Asset Key",
|
|
773
|
+
comments: "The recording asset with which the simulive webinar should be created from. In case the recordingasset was created as an online recording the simulive webinar settings, poll and surveys would be copied from the webinar whose session was recorded.",
|
|
774
|
+
type: "string",
|
|
775
|
+
required: false,
|
|
776
|
+
example: "your-recording-asset-key",
|
|
777
|
+
placeholder: "Enter a recording asset key",
|
|
778
|
+
clean: toOptionalString
|
|
779
|
+
});
|
|
780
|
+
const isOndemand = (0, _prismatic_io_spectral.input)({
|
|
781
|
+
label: "Is On Demand",
|
|
782
|
+
comments: "A boolean flag indicating if the webinar should be On-Demand.",
|
|
783
|
+
type: "string",
|
|
784
|
+
required: false,
|
|
785
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
786
|
+
default: "false",
|
|
787
|
+
clean: toOptionalBoolean
|
|
788
|
+
});
|
|
789
|
+
const isBreakout = (0, _prismatic_io_spectral.input)({
|
|
790
|
+
label: "Is Breakout",
|
|
791
|
+
comments: "A boolean flag indicating if the webinar should be breakout.",
|
|
792
|
+
type: "string",
|
|
793
|
+
required: false,
|
|
794
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
795
|
+
default: "false",
|
|
796
|
+
clean: toOptionalBoolean
|
|
797
|
+
});
|
|
798
|
+
const experienceType = (0, _prismatic_io_spectral.input)({
|
|
799
|
+
label: "Experience Type",
|
|
800
|
+
comments: "The experience type of the webinar.",
|
|
801
|
+
type: "string",
|
|
802
|
+
required: false,
|
|
803
|
+
default: AVAILABLE_EXPERIENCES_MODEL[0].value,
|
|
804
|
+
model: AVAILABLE_EXPERIENCES_MODEL,
|
|
805
|
+
clean: toOptionalString
|
|
806
|
+
});
|
|
807
|
+
const confirmationEmail = (0, _prismatic_io_spectral.input)({
|
|
808
|
+
label: "Should Send Confirmation Email",
|
|
809
|
+
comments: "Whether or not to send a confirmation email to the registrants.",
|
|
810
|
+
type: "string",
|
|
811
|
+
required: false,
|
|
812
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
813
|
+
clean: toOptionalEmailSetting
|
|
814
|
+
});
|
|
815
|
+
const reminderEmail = (0, _prismatic_io_spectral.input)({
|
|
816
|
+
label: "Should Send Reminder Email",
|
|
817
|
+
comments: "Whether or not to send a reminder email to the registrants.",
|
|
818
|
+
type: "string",
|
|
819
|
+
required: false,
|
|
820
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
821
|
+
clean: toOptionalEmailSetting
|
|
822
|
+
});
|
|
823
|
+
const absenteeFollowUpEmail = (0, _prismatic_io_spectral.input)({
|
|
824
|
+
label: "Should Send Absentee Follow Up Email",
|
|
825
|
+
comments: "Whether or not to send an absentee follow up email to the registrants.",
|
|
826
|
+
type: "string",
|
|
827
|
+
required: false,
|
|
828
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
829
|
+
clean: toOptionalEmailSetting
|
|
830
|
+
});
|
|
831
|
+
const attendeeFollowUpEmail = (0, _prismatic_io_spectral.input)({
|
|
832
|
+
label: "Should Send Attendee Follow Up Email",
|
|
833
|
+
comments: "Whether or not to send an attendee follow up email to the registrants.",
|
|
834
|
+
type: "string",
|
|
835
|
+
required: false,
|
|
836
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
837
|
+
clean: toOptionalEmailSetting
|
|
838
|
+
});
|
|
839
|
+
const sendCancellationEmail = (0, _prismatic_io_spectral.input)({
|
|
840
|
+
label: "Send Cancellation Email",
|
|
841
|
+
comments: "Indicates whether cancellation notice emails should be sent. Default behavior is false.",
|
|
842
|
+
type: "string",
|
|
843
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
844
|
+
required: false,
|
|
845
|
+
clean: toOptionalBoolean
|
|
846
|
+
});
|
|
847
|
+
const deleteAll = (0, _prismatic_io_spectral.input)({
|
|
848
|
+
label: "Delete All",
|
|
849
|
+
comments: "Specifies whether all scheduled sessions should be deleted if the webinar is part of a series. Default behavior is true.",
|
|
850
|
+
type: "string",
|
|
851
|
+
model: MODEL_FOR_OPTIONAL_BOOLEAN_INPUTS,
|
|
852
|
+
required: false,
|
|
853
|
+
default: "false",
|
|
854
|
+
clean: toOptionalBoolean
|
|
855
|
+
});
|
|
856
|
+
const notifyParticipants = (0, _prismatic_io_spectral.input)({
|
|
857
|
+
label: "Notify Participants",
|
|
858
|
+
comments: "Notify participants of the webinar.",
|
|
859
|
+
type: "boolean",
|
|
860
|
+
required: true,
|
|
861
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
862
|
+
});
|
|
863
|
+
const emailSettings = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
864
|
+
label: "Email Settings",
|
|
865
|
+
required: false,
|
|
866
|
+
comments: "Configure which automated emails are sent to registrants for the webinar.",
|
|
867
|
+
inputs: {
|
|
868
|
+
confirmationEmail,
|
|
869
|
+
reminderEmail,
|
|
870
|
+
absenteeFollowUpEmail,
|
|
871
|
+
attendeeFollowUpEmail
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
const createWebinarInputs = {
|
|
875
|
+
connection,
|
|
876
|
+
subject,
|
|
877
|
+
webinarType,
|
|
878
|
+
times,
|
|
879
|
+
description,
|
|
880
|
+
experienceType,
|
|
881
|
+
timeZone: timezone,
|
|
882
|
+
emailSettings,
|
|
883
|
+
additionalFields: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
884
|
+
label: "Additional Fields",
|
|
885
|
+
required: false,
|
|
886
|
+
comments: "Additional optional fields: includes Recording Asset Key, Is On Demand, Is Breakout, Is Password Protected, and Locale.",
|
|
887
|
+
inputs: {
|
|
888
|
+
recordingAssetKey,
|
|
889
|
+
isOndemand,
|
|
890
|
+
isBreakout,
|
|
891
|
+
isPasswordProtected,
|
|
892
|
+
locale
|
|
893
|
+
}
|
|
894
|
+
})
|
|
895
|
+
};
|
|
896
|
+
const pagination = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
897
|
+
label: "Pagination",
|
|
898
|
+
required: false,
|
|
899
|
+
comments: "Page number and page size for paginated results.",
|
|
900
|
+
inputs: {
|
|
901
|
+
page: pageNumber,
|
|
902
|
+
size: pageSize
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
const getWebinarInputs = {
|
|
906
|
+
connection,
|
|
907
|
+
fromTime,
|
|
908
|
+
toTime,
|
|
909
|
+
accountKey: {
|
|
910
|
+
...accountKey,
|
|
911
|
+
clean: toOptionalString,
|
|
912
|
+
required: false,
|
|
913
|
+
comments: "The key of the account. If using this input instead of the organizer key, the action will retrieve the webinars by Account Key"
|
|
914
|
+
},
|
|
915
|
+
fetchAll,
|
|
916
|
+
pagination
|
|
917
|
+
};
|
|
918
|
+
const updateWebinarInputs = {
|
|
919
|
+
connection,
|
|
920
|
+
webinarKey,
|
|
921
|
+
notifyParticipants,
|
|
922
|
+
subject: {
|
|
923
|
+
...subject,
|
|
924
|
+
required: false,
|
|
925
|
+
clean: toOptionalString
|
|
926
|
+
},
|
|
927
|
+
description,
|
|
928
|
+
times: {
|
|
929
|
+
...times,
|
|
930
|
+
required: false,
|
|
931
|
+
comments: "The time range of the webinar.",
|
|
932
|
+
clean: toOptionalObject,
|
|
933
|
+
example: JSON.stringify([{
|
|
934
|
+
startTime: "2020-03-13T10:00:00Z",
|
|
935
|
+
endTime: "2020-03-13T11:00:00Z"
|
|
936
|
+
}])
|
|
937
|
+
},
|
|
938
|
+
timeZone: timezone,
|
|
939
|
+
locale,
|
|
940
|
+
emailSettings
|
|
941
|
+
};
|
|
942
|
+
const deleteWebinarInputs = {
|
|
943
|
+
connection,
|
|
944
|
+
webinarKey,
|
|
945
|
+
sendCancellationEmail,
|
|
946
|
+
deleteAll
|
|
947
|
+
};
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/connections/index.ts
|
|
950
|
+
const gotoWebinarOAuth2Connection = (0, _prismatic_io_spectral.oauth2Connection)({
|
|
951
|
+
key: "gotoWebinarOAuth2Connection",
|
|
952
|
+
oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
|
|
953
|
+
display: {
|
|
954
|
+
label: "OAuth 2.0",
|
|
955
|
+
description: "Authenticate requests to GoTo Webinar using OAuth 2.0."
|
|
956
|
+
},
|
|
957
|
+
inputs: {
|
|
958
|
+
authorizeUrl: {
|
|
959
|
+
label: "Authorize URL",
|
|
960
|
+
comments: "The OAuth2 Authorize URL for GoTo Webinar.",
|
|
961
|
+
type: "string",
|
|
962
|
+
required: true,
|
|
963
|
+
shown: false,
|
|
964
|
+
default: "https://authentication.logmeininc.com/oauth/authorize"
|
|
965
|
+
},
|
|
966
|
+
tokenUrl: {
|
|
967
|
+
label: "Token URL",
|
|
968
|
+
comments: "The OAuth2 Token URL for GoTo Webinar",
|
|
969
|
+
type: "string",
|
|
970
|
+
required: true,
|
|
971
|
+
shown: false,
|
|
972
|
+
default: "https://authentication.logmeininc.com/oauth/token"
|
|
973
|
+
},
|
|
974
|
+
scopes: {
|
|
975
|
+
label: "Scopes",
|
|
976
|
+
comments: "Space separated list of OAuth2 scopes for GoTo Webinar.",
|
|
977
|
+
type: "string",
|
|
978
|
+
required: true,
|
|
979
|
+
shown: true,
|
|
980
|
+
default: "identity:scim.me collab:"
|
|
981
|
+
},
|
|
982
|
+
clientId: {
|
|
983
|
+
label: "Client ID",
|
|
984
|
+
comments: "The OAuth2 Client ID for GoTo Webinar.",
|
|
985
|
+
type: "string",
|
|
986
|
+
required: true,
|
|
987
|
+
shown: true
|
|
988
|
+
},
|
|
989
|
+
clientSecret: {
|
|
990
|
+
label: "Client Secret",
|
|
991
|
+
comments: "The OAuth2 Client Secret for GoTo Webinar.",
|
|
992
|
+
type: "password",
|
|
993
|
+
required: true,
|
|
994
|
+
shown: true
|
|
995
|
+
},
|
|
996
|
+
organizerKey: {
|
|
997
|
+
label: "Organizer Key",
|
|
998
|
+
comments: "The GoTo Webinar Organizer Key.",
|
|
999
|
+
type: "string",
|
|
1000
|
+
required: true,
|
|
1001
|
+
shown: true
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
var connections_default = [gotoWebinarOAuth2Connection];
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region src/client.ts
|
|
1008
|
+
const getAuthorizationHeaders = ({ connection }) => {
|
|
1009
|
+
switch (connection.key) {
|
|
1010
|
+
case gotoWebinarOAuth2Connection.key: {
|
|
1011
|
+
const token = _prismatic_io_spectral.util.types.toString(connection.token?.access_token);
|
|
1012
|
+
if (!token) throw new _prismatic_io_spectral.ConnectionError(connection, "No access token found in connection");
|
|
1013
|
+
return { Authorization: `Bearer ${token}` };
|
|
1014
|
+
}
|
|
1015
|
+
default: throw new _prismatic_io_spectral.ConnectionError(connection, "Unsupported Connection");
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
const getClientProps = (connection) => {
|
|
1019
|
+
const token = _prismatic_io_spectral.util.types.toString(connection.token?.access_token);
|
|
1020
|
+
const organizerKey = _prismatic_io_spectral.util.types.toString(connection.fields?.organizerKey);
|
|
1021
|
+
if (!token) throw new _prismatic_io_spectral.ConnectionError(connection, "No access token found in connection");
|
|
1022
|
+
if (!organizerKey) throw new _prismatic_io_spectral.ConnectionError(connection, "No organizer key found in connection");
|
|
1023
|
+
return {
|
|
1024
|
+
token,
|
|
1025
|
+
organizerKey,
|
|
1026
|
+
baseUrl: "https://api.getgo.com/G2W/rest/v2"
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
const createGotoWebinarClient = (connection, debug = false) => {
|
|
1030
|
+
const headers = getAuthorizationHeaders({ connection });
|
|
1031
|
+
const { baseUrl } = getClientProps(connection);
|
|
1032
|
+
return {
|
|
1033
|
+
organizerKey: _prismatic_io_spectral.util.types.toString(connection.fields?.organizerKey),
|
|
1034
|
+
client: (0, _prismatic_io_spectral_http.createClient)({
|
|
1035
|
+
baseUrl,
|
|
1036
|
+
headers: {
|
|
1037
|
+
...headers,
|
|
1038
|
+
"Content-Type": "application/json",
|
|
1039
|
+
Accept: "application/vnd.citrix.g2wapi-v1.1+json"
|
|
1040
|
+
},
|
|
1041
|
+
debug
|
|
1042
|
+
})
|
|
1043
|
+
};
|
|
1044
|
+
};
|
|
1045
|
+
//#endregion
|
|
1046
|
+
//#region src/examplePayloads/actions.ts
|
|
1047
|
+
const GET_WEBINARS_EXAMPLE_PAYLOAD = { data: {
|
|
1048
|
+
_embedded: { webinars: [{
|
|
1049
|
+
webinarKey: "8978964909939938573",
|
|
1050
|
+
webinarID: "204586973",
|
|
1051
|
+
organizerKey: "8456783923409587345",
|
|
1052
|
+
accountKey: "9384756102938475610",
|
|
1053
|
+
subject: "Q3 Product Launch Webinar",
|
|
1054
|
+
description: "Join us for a live walkthrough of our latest product features.",
|
|
1055
|
+
times: [{
|
|
1056
|
+
startTime: "2024-09-10T15:00:00Z",
|
|
1057
|
+
endTime: "2024-09-10T16:00:00Z"
|
|
1058
|
+
}],
|
|
1059
|
+
timeZone: "America/New_York",
|
|
1060
|
+
locale: "en_US",
|
|
1061
|
+
approvalType: "AUTOMATIC",
|
|
1062
|
+
registrationUrl: "https://attendee.gotowebinar.com/register/8978964909939938573",
|
|
1063
|
+
impromptu: false,
|
|
1064
|
+
isPasswordProtected: false,
|
|
1065
|
+
recurrenceType: "single_session",
|
|
1066
|
+
experienceType: "CLASSIC"
|
|
1067
|
+
}] },
|
|
1068
|
+
page: {
|
|
1069
|
+
size: 20,
|
|
1070
|
+
totalElements: 1,
|
|
1071
|
+
totalPages: 1,
|
|
1072
|
+
number: 0
|
|
1073
|
+
}
|
|
1074
|
+
} };
|
|
1075
|
+
const DELETE_WEBINAR_EXAMPLE_PAYLOAD = GENERAL_DELETE_MESSAGE;
|
|
1076
|
+
const CREATE_WEBINAR_EXAMPLE_PAYLOAD = { data: {
|
|
1077
|
+
webinarKey: "8978964909939938573",
|
|
1078
|
+
recurrenceKey: "5647382910564738291"
|
|
1079
|
+
} };
|
|
1080
|
+
const UPDATE_WEBINAR_EXAMPLE_PAYLOAD = GENERAL_DELETE_MESSAGE;
|
|
1081
|
+
const CREATE_REGISTRANT_EXAMPLE_PAYLOAD = { data: {
|
|
1082
|
+
registrantKey: "1234567890",
|
|
1083
|
+
joinUrl: "https://global.gotowebinar.com/join/8978964909939938573/1234567890"
|
|
1084
|
+
} };
|
|
1085
|
+
const GET_REGISTRANTS_EXAMPLE_PAYLOAD = { data: {
|
|
1086
|
+
lastName: "Doe",
|
|
1087
|
+
email: "jane.doe@example.com",
|
|
1088
|
+
firstName: "Jane",
|
|
1089
|
+
registrantKey: "1234567890",
|
|
1090
|
+
registrationDate: "2024-08-24T14:15:22Z",
|
|
1091
|
+
source: "Marketing Email",
|
|
1092
|
+
status: "APPROVED",
|
|
1093
|
+
joinUrl: "https://global.gotowebinar.com/join/8978964909939938573/1234567890",
|
|
1094
|
+
timeZone: "America/New_York",
|
|
1095
|
+
phone: "+1-555-123-4567",
|
|
1096
|
+
state: "New York",
|
|
1097
|
+
city: "New York",
|
|
1098
|
+
organization: "Acme Corporation",
|
|
1099
|
+
zipCode: "10001",
|
|
1100
|
+
numberOfEmployees: "201-500",
|
|
1101
|
+
industry: "Technology",
|
|
1102
|
+
jobTitle: "Engineering Manager",
|
|
1103
|
+
purchasingRole: "Decision Maker",
|
|
1104
|
+
implementationTimeFrame: "1-3 months",
|
|
1105
|
+
purchasingTimeFrame: "Within 6 months",
|
|
1106
|
+
questionsAndComments: "Looking forward to the demo.",
|
|
1107
|
+
employeeCount: "250",
|
|
1108
|
+
country: "United States",
|
|
1109
|
+
address: "123 Main Street",
|
|
1110
|
+
type: "LATE",
|
|
1111
|
+
unsubscribed: false,
|
|
1112
|
+
responses: [{
|
|
1113
|
+
answer: "Yes",
|
|
1114
|
+
question: "Are you currently evaluating webinar platforms?"
|
|
1115
|
+
}]
|
|
1116
|
+
} };
|
|
1117
|
+
const LIST_REGISTRANTS_EXAMPLE_PAYLOAD = { data: [{
|
|
1118
|
+
lastName: "Doe",
|
|
1119
|
+
email: "jane.doe@example.com",
|
|
1120
|
+
firstName: "Jane",
|
|
1121
|
+
registrantKey: "1234567890",
|
|
1122
|
+
registrationDate: "2024-08-24T14:15:22Z",
|
|
1123
|
+
status: "APPROVED",
|
|
1124
|
+
joinUrl: "https://global.gotowebinar.com/join/8978964909939938573/1234567890",
|
|
1125
|
+
timeZone: "America/New_York"
|
|
1126
|
+
}, {
|
|
1127
|
+
lastName: "Smith",
|
|
1128
|
+
email: "john.smith@example.com",
|
|
1129
|
+
firstName: "John",
|
|
1130
|
+
registrantKey: "9876543210",
|
|
1131
|
+
registrationDate: "2024-08-25T09:42:10Z",
|
|
1132
|
+
status: "WAITING",
|
|
1133
|
+
joinUrl: "https://global.gotowebinar.com/join/8978964909939938573/9876543210",
|
|
1134
|
+
timeZone: "America/Los_Angeles"
|
|
1135
|
+
}] };
|
|
1136
|
+
const LIST_ALL_ATTEENDEES_FOR_ALL_WEBINAR_SESSIONS_EXAMPLE_PAYLOAD = { data: {
|
|
1137
|
+
property1: {
|
|
1138
|
+
sessionInfo: {
|
|
1139
|
+
webinarName: "Q3 Product Launch Webinar",
|
|
1140
|
+
webinarId: "204586973",
|
|
1141
|
+
sessionKey: "111111111111111111",
|
|
1142
|
+
timeZone: "America/New_York",
|
|
1143
|
+
experienceType: "CLASSIC",
|
|
1144
|
+
recurrencePeriod: "SINGLE_SESSION",
|
|
1145
|
+
startTime: "2024-09-10T15:00:00Z",
|
|
1146
|
+
endTime: "2024-09-10T16:00:00Z",
|
|
1147
|
+
registrationEmailOpenedCount: "120",
|
|
1148
|
+
registrationLinkClickedCount: "95"
|
|
1149
|
+
},
|
|
1150
|
+
attendance: {
|
|
1151
|
+
registrantCount: 150,
|
|
1152
|
+
percentageAttendance: 72.5,
|
|
1153
|
+
averageInterestRating: 4.2,
|
|
1154
|
+
averageAttentiveness: .87,
|
|
1155
|
+
averageAttendanceTimeSeconds: 2640
|
|
1156
|
+
},
|
|
1157
|
+
pollsAndSurveys: {
|
|
1158
|
+
pollCount: 3,
|
|
1159
|
+
surveyCount: 1,
|
|
1160
|
+
questionsAsked: 12,
|
|
1161
|
+
percentagePollsCompleted: 68.4,
|
|
1162
|
+
percentageSurveysCompleted: 41.2
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
property2: {
|
|
1166
|
+
sessionInfo: {
|
|
1167
|
+
webinarName: "Q3 Product Launch Webinar",
|
|
1168
|
+
webinarId: "204586973",
|
|
1169
|
+
sessionKey: "222222222222222222",
|
|
1170
|
+
timeZone: "America/New_York",
|
|
1171
|
+
experienceType: "CLASSIC",
|
|
1172
|
+
recurrencePeriod: "SINGLE_SESSION",
|
|
1173
|
+
startTime: "2024-09-17T15:00:00Z",
|
|
1174
|
+
endTime: "2024-09-17T16:00:00Z",
|
|
1175
|
+
registrationEmailOpenedCount: "98",
|
|
1176
|
+
registrationLinkClickedCount: "80"
|
|
1177
|
+
},
|
|
1178
|
+
attendance: {
|
|
1179
|
+
registrantCount: 130,
|
|
1180
|
+
percentageAttendance: 65,
|
|
1181
|
+
averageInterestRating: 3.9,
|
|
1182
|
+
averageAttentiveness: .81,
|
|
1183
|
+
averageAttendanceTimeSeconds: 2400
|
|
1184
|
+
},
|
|
1185
|
+
pollsAndSurveys: {
|
|
1186
|
+
pollCount: 2,
|
|
1187
|
+
surveyCount: 1,
|
|
1188
|
+
questionsAsked: 8,
|
|
1189
|
+
percentagePollsCompleted: 55,
|
|
1190
|
+
percentageSurveysCompleted: 38.5
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
} };
|
|
1194
|
+
const LIST_SESSION_ATTENDEES_EXAMPLE_PAYLOAD = { data: [{
|
|
1195
|
+
registrantKey: 1234567890,
|
|
1196
|
+
firstName: "Jane",
|
|
1197
|
+
lastName: "Doe",
|
|
1198
|
+
email: "jane.doe@example.com",
|
|
1199
|
+
attendanceTimeInSeconds: 3540,
|
|
1200
|
+
sessionKey: 204586973,
|
|
1201
|
+
attendance: [{
|
|
1202
|
+
joinTime: "2024-09-10T15:01:30Z",
|
|
1203
|
+
leaveTime: "2024-09-10T16:00:30Z"
|
|
1204
|
+
}]
|
|
1205
|
+
}] };
|
|
1206
|
+
const GET_ATTENDEE_EXAMPLE_PAYLOAD = { data: {
|
|
1207
|
+
lastName: "Doe",
|
|
1208
|
+
email: "jane.doe@example.com",
|
|
1209
|
+
firstName: "Jane",
|
|
1210
|
+
registrantKey: 1234567890,
|
|
1211
|
+
registrationDate: "2024-08-24T14:15:22Z",
|
|
1212
|
+
status: "APPROVED",
|
|
1213
|
+
joinUrl: "https://global.gotowebinar.com/join/8978964909939938573/1234567890",
|
|
1214
|
+
timeZone: "America/New_York"
|
|
1215
|
+
} };
|
|
1216
|
+
const GET_USER_SUBSCRIPTION_EXAMPLE_PAYLOAD = { data: {
|
|
1217
|
+
callbackUrl: "https://hooks.example.com/gotowebinar/registrant-added",
|
|
1218
|
+
eventName: "registrant.added",
|
|
1219
|
+
eventVersion: "1.0.0",
|
|
1220
|
+
product: "g2w",
|
|
1221
|
+
webhookKey: "7766554433221100",
|
|
1222
|
+
userSubscriptionKey: "5544332211009988",
|
|
1223
|
+
userSubscriptionState: "ACTIVE",
|
|
1224
|
+
activationState: "ACTIVATED",
|
|
1225
|
+
createTime: "2024-08-20T10:30:00Z"
|
|
1226
|
+
} };
|
|
1227
|
+
const CREATE_USER_SUBSCRIPTION_EXAMPLE_PAYLOAD = { data: { _embedded: { userSubscriptions: [{
|
|
1228
|
+
callbackUrl: "https://hooks.example.com/gotowebinar/registrant-added",
|
|
1229
|
+
eventName: "registrant.added",
|
|
1230
|
+
eventVersion: "1.0.0",
|
|
1231
|
+
product: "g2w",
|
|
1232
|
+
webhookKey: "7766554433221100",
|
|
1233
|
+
userSubscriptionKey: "5544332211009988",
|
|
1234
|
+
userSubscriptionState: "ACTIVE",
|
|
1235
|
+
activationState: "ACTIVATED",
|
|
1236
|
+
createTime: "2024-08-20T10:30:00Z"
|
|
1237
|
+
}] } } };
|
|
1238
|
+
const LIST_USER_SUBSCRIPTIONS_EXAMPLE_PAYLOAD = { data: { _embedded: { userSubscriptions: [{
|
|
1239
|
+
callbackUrl: "https://hooks.example.com/gotowebinar/registrant-added",
|
|
1240
|
+
eventName: "registrant.added",
|
|
1241
|
+
eventVersion: "1.0.0",
|
|
1242
|
+
product: "g2w",
|
|
1243
|
+
webhookKey: "7766554433221100",
|
|
1244
|
+
userSubscriptionKey: "5544332211009988",
|
|
1245
|
+
userSubscriptionState: "ACTIVE",
|
|
1246
|
+
activationState: "ACTIVATED",
|
|
1247
|
+
createTime: "2024-08-20T10:30:00Z"
|
|
1248
|
+
}] } } };
|
|
1249
|
+
const pollChangesTriggerExamplePayload = { payload: {
|
|
1250
|
+
headers: {},
|
|
1251
|
+
queryParameters: {},
|
|
1252
|
+
rawBody: { data: null },
|
|
1253
|
+
body: { data: { created: [LIST_REGISTRANTS_EXAMPLE_PAYLOAD.data[0]] } },
|
|
1254
|
+
pathFragment: "",
|
|
1255
|
+
webhookUrls: {},
|
|
1256
|
+
webhookApiKeys: {},
|
|
1257
|
+
invokeUrl: "",
|
|
1258
|
+
executionId: "RXhhbXBsZUV4ZWN1dGlvblJlc3VsdElk",
|
|
1259
|
+
customer: {
|
|
1260
|
+
id: "testCustomerId",
|
|
1261
|
+
name: "Test Customer",
|
|
1262
|
+
externalId: "testExternalId"
|
|
1263
|
+
},
|
|
1264
|
+
instance: {
|
|
1265
|
+
id: "testInstanceId",
|
|
1266
|
+
name: "Test Instance"
|
|
1267
|
+
},
|
|
1268
|
+
user: {
|
|
1269
|
+
id: "testUserId",
|
|
1270
|
+
email: "user@example.com",
|
|
1271
|
+
name: "Test User",
|
|
1272
|
+
externalId: "testUserExternalId"
|
|
1273
|
+
},
|
|
1274
|
+
integration: {
|
|
1275
|
+
id: "testIntegrationId",
|
|
1276
|
+
name: "Test Integration",
|
|
1277
|
+
versionSequenceId: "1",
|
|
1278
|
+
externalVersion: ""
|
|
1279
|
+
},
|
|
1280
|
+
flow: {
|
|
1281
|
+
id: "testFlowId",
|
|
1282
|
+
name: "Test Flow",
|
|
1283
|
+
stableId: "testFlowStableId"
|
|
1284
|
+
},
|
|
1285
|
+
startedAt: "2024-01-15T00:00:00.000Z",
|
|
1286
|
+
globalDebug: false
|
|
1287
|
+
} };
|
|
1288
|
+
const userSubscriptionTriggerExamplePayload = { payload: {
|
|
1289
|
+
headers: { "Content-Type": "application/json" },
|
|
1290
|
+
queryParameters: {},
|
|
1291
|
+
rawBody: { data: null },
|
|
1292
|
+
body: { data: {
|
|
1293
|
+
accountKey: "9384756102938475610",
|
|
1294
|
+
organizerKey: "8456783923409587345",
|
|
1295
|
+
webinarKey: "8978964909939938573",
|
|
1296
|
+
eventKey: "registrant.added",
|
|
1297
|
+
eventName: "registrant.added",
|
|
1298
|
+
eventVersion: "1.0.0",
|
|
1299
|
+
registrantKey: "1234567890",
|
|
1300
|
+
timestamp: "2024-09-01T12:00:00Z"
|
|
1301
|
+
} },
|
|
1302
|
+
pathFragment: "",
|
|
1303
|
+
webhookUrls: {},
|
|
1304
|
+
webhookApiKeys: {},
|
|
1305
|
+
invokeUrl: "",
|
|
1306
|
+
executionId: "RXhhbXBsZUV4ZWN1dGlvblJlc3VsdElk",
|
|
1307
|
+
customer: {
|
|
1308
|
+
id: "testCustomerId",
|
|
1309
|
+
name: "Test Customer",
|
|
1310
|
+
externalId: "testExternalId"
|
|
1311
|
+
},
|
|
1312
|
+
instance: {
|
|
1313
|
+
id: "testInstanceId",
|
|
1314
|
+
name: "Test Instance"
|
|
1315
|
+
},
|
|
1316
|
+
user: {
|
|
1317
|
+
id: "testUserId",
|
|
1318
|
+
email: "user@example.com",
|
|
1319
|
+
name: "Test User",
|
|
1320
|
+
externalId: "testUserExternalId"
|
|
1321
|
+
},
|
|
1322
|
+
integration: {
|
|
1323
|
+
id: "testIntegrationId",
|
|
1324
|
+
name: "Test Integration",
|
|
1325
|
+
versionSequenceId: "1",
|
|
1326
|
+
externalVersion: ""
|
|
1327
|
+
},
|
|
1328
|
+
flow: {
|
|
1329
|
+
id: "testFlowId",
|
|
1330
|
+
name: "Test Flow",
|
|
1331
|
+
stableId: "testFlowStableId"
|
|
1332
|
+
},
|
|
1333
|
+
startedAt: "2024-01-15T00:00:00.000Z",
|
|
1334
|
+
globalDebug: false
|
|
1335
|
+
} };
|
|
1336
|
+
//#endregion
|
|
1337
|
+
//#region src/actions/webinars/index.ts
|
|
1338
|
+
var webinars_default = {
|
|
1339
|
+
getWebinars: (0, _prismatic_io_spectral.action)({
|
|
1340
|
+
display: {
|
|
1341
|
+
label: "Get Webinars",
|
|
1342
|
+
description: "Returns upcoming and past webinars for the currently authenticated organizer that are scheduled within the specified date/time range."
|
|
1343
|
+
},
|
|
1344
|
+
inputs: getWebinarInputs,
|
|
1345
|
+
examplePayload: GET_WEBINARS_EXAMPLE_PAYLOAD,
|
|
1346
|
+
perform: async ({ debug: { enabled: debug } }, { connection, pagination, accountKey, fromTime, toTime, fetchAll }) => {
|
|
1347
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1348
|
+
const url = accountKey ? `/accounts/${accountKey}/webinars` : `/organizers/${organizerKey}/webinars`;
|
|
1349
|
+
if (fetchAll) return { data: await fetchAllResults(client, url, "webinars", {
|
|
1350
|
+
fromTime,
|
|
1351
|
+
toTime
|
|
1352
|
+
}) };
|
|
1353
|
+
const params = {
|
|
1354
|
+
fromTime,
|
|
1355
|
+
toTime,
|
|
1356
|
+
size: pagination.size,
|
|
1357
|
+
page: pagination.page
|
|
1358
|
+
};
|
|
1359
|
+
const { data } = await client.get(url, { params });
|
|
1360
|
+
return { data };
|
|
1361
|
+
}
|
|
1362
|
+
}),
|
|
1363
|
+
cancelWebinar: (0, _prismatic_io_spectral.action)({
|
|
1364
|
+
display: {
|
|
1365
|
+
label: "Cancel Webinar",
|
|
1366
|
+
description: "Cancels a specific webinar."
|
|
1367
|
+
},
|
|
1368
|
+
inputs: deleteWebinarInputs,
|
|
1369
|
+
examplePayload: DELETE_WEBINAR_EXAMPLE_PAYLOAD,
|
|
1370
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, deleteAll, sendCancellationEmail }) => {
|
|
1371
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1372
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}`;
|
|
1373
|
+
const params = {
|
|
1374
|
+
sendCancellationEmail,
|
|
1375
|
+
deleteAll
|
|
1376
|
+
};
|
|
1377
|
+
await client.delete(url, { params });
|
|
1378
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1379
|
+
}
|
|
1380
|
+
}),
|
|
1381
|
+
createWebinar: (0, _prismatic_io_spectral.action)({
|
|
1382
|
+
display: {
|
|
1383
|
+
label: "Create Webinar",
|
|
1384
|
+
description: "Creates a single session webinar, a sequence of webinars, or a series of webinars."
|
|
1385
|
+
},
|
|
1386
|
+
inputs: createWebinarInputs,
|
|
1387
|
+
examplePayload: CREATE_WEBINAR_EXAMPLE_PAYLOAD,
|
|
1388
|
+
perform: async ({ debug: { enabled: debug } }, { connection, timeZone, times, experienceType, webinarType, emailSettings, additionalFields, subject, description }) => {
|
|
1389
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1390
|
+
const url = `/organizers/${organizerKey}/webinars`;
|
|
1391
|
+
const emailSettingsPayload = {
|
|
1392
|
+
confirmationEmail: emailSettings.confirmationEmail,
|
|
1393
|
+
reminderEmail: emailSettings.reminderEmail,
|
|
1394
|
+
absenteeFollowUpEmail: emailSettings.absenteeFollowUpEmail,
|
|
1395
|
+
attendeeFollowUpEmail: emailSettings.attendeeFollowUpEmail
|
|
1396
|
+
};
|
|
1397
|
+
const payload = {
|
|
1398
|
+
subject,
|
|
1399
|
+
description,
|
|
1400
|
+
times,
|
|
1401
|
+
timeZone,
|
|
1402
|
+
type: webinarType,
|
|
1403
|
+
locale: additionalFields.locale,
|
|
1404
|
+
isPasswordProtected: additionalFields.isPasswordProtected,
|
|
1405
|
+
recordingAssetKey: additionalFields.recordingAssetKey,
|
|
1406
|
+
isOndemand: additionalFields.isOndemand,
|
|
1407
|
+
isBreakout: additionalFields.isBreakout,
|
|
1408
|
+
experienceType,
|
|
1409
|
+
emailSettings: Object.keys(emailSettingsPayload).length > 0 ? emailSettingsPayload : void 0
|
|
1410
|
+
};
|
|
1411
|
+
const { data } = await client.post(url, payload);
|
|
1412
|
+
return { data };
|
|
1413
|
+
}
|
|
1414
|
+
}),
|
|
1415
|
+
updateWebinar: (0, _prismatic_io_spectral.action)({
|
|
1416
|
+
display: {
|
|
1417
|
+
label: "Update Webinar",
|
|
1418
|
+
description: "Updates a specific webinar."
|
|
1419
|
+
},
|
|
1420
|
+
inputs: updateWebinarInputs,
|
|
1421
|
+
examplePayload: UPDATE_WEBINAR_EXAMPLE_PAYLOAD,
|
|
1422
|
+
perform: async ({ debug: { enabled: debug } }, { subject, emailSettings, times, locale, description, connection, webinarKey, notifyParticipants }) => {
|
|
1423
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1424
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}`;
|
|
1425
|
+
const payload = {
|
|
1426
|
+
subject,
|
|
1427
|
+
description,
|
|
1428
|
+
times,
|
|
1429
|
+
locale,
|
|
1430
|
+
emailSettings: {
|
|
1431
|
+
confirmationEmail: emailSettings.confirmationEmail,
|
|
1432
|
+
reminderEmail: emailSettings.reminderEmail,
|
|
1433
|
+
absenteeFollowUpEmail: emailSettings.absenteeFollowUpEmail,
|
|
1434
|
+
attendeeFollowUpEmail: emailSettings.attendeeFollowUpEmail
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
const params = { notifyParticipants };
|
|
1438
|
+
await client.put(url, payload, { params });
|
|
1439
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1440
|
+
}
|
|
1441
|
+
})
|
|
1442
|
+
};
|
|
1443
|
+
//#endregion
|
|
1444
|
+
//#region src/actions/registrants/createRegistrant.ts
|
|
1445
|
+
const createRegistrant = (0, _prismatic_io_spectral.action)({
|
|
1446
|
+
display: {
|
|
1447
|
+
label: "Create Registrant",
|
|
1448
|
+
description: "Register an attendee for a scheduled webinar."
|
|
1449
|
+
},
|
|
1450
|
+
inputs: createRegistrantInputs,
|
|
1451
|
+
examplePayload: CREATE_REGISTRANT_EXAMPLE_PAYLOAD,
|
|
1452
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, firstName, lastName, email, phone, mailingAddress, additionalFields, source }) => {
|
|
1453
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1454
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
|
1455
|
+
const payload = {
|
|
1456
|
+
firstName,
|
|
1457
|
+
lastName,
|
|
1458
|
+
email,
|
|
1459
|
+
source,
|
|
1460
|
+
address: mailingAddress.address,
|
|
1461
|
+
city: mailingAddress.city,
|
|
1462
|
+
state: mailingAddress.state,
|
|
1463
|
+
zipCode: mailingAddress.zipCode,
|
|
1464
|
+
country: mailingAddress.country,
|
|
1465
|
+
phone,
|
|
1466
|
+
organization: additionalFields.organization,
|
|
1467
|
+
jobTitle: additionalFields.jobTitle,
|
|
1468
|
+
questionAndComments: additionalFields.questionAndComments,
|
|
1469
|
+
industry: additionalFields.industry,
|
|
1470
|
+
numberOfEmployees: additionalFields.numberOfEmployees,
|
|
1471
|
+
purchasingTimeFrame: additionalFields.purchasingTimeFrame,
|
|
1472
|
+
purchasingRole: additionalFields.purchasingRole,
|
|
1473
|
+
responses: additionalFields.responses
|
|
1474
|
+
};
|
|
1475
|
+
const { data: payloadWithoutParsing } = await client.post(url, payload, { transformResponse: bigIntTransformerConfig.transformResponse });
|
|
1476
|
+
return { data: {
|
|
1477
|
+
...payloadWithoutParsing,
|
|
1478
|
+
registrantKey: parseRegistrantKey(payloadWithoutParsing.registrantKey.c)
|
|
1479
|
+
} };
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region src/actions/registrants/index.ts
|
|
1484
|
+
var registrants_default = {
|
|
1485
|
+
getRegistrant: (0, _prismatic_io_spectral.action)({
|
|
1486
|
+
display: {
|
|
1487
|
+
label: "Get Registrant",
|
|
1488
|
+
description: "Retrieve registration details for a specific registrant."
|
|
1489
|
+
},
|
|
1490
|
+
inputs: getRegistrantInputs,
|
|
1491
|
+
examplePayload: GET_REGISTRANTS_EXAMPLE_PAYLOAD,
|
|
1492
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, registrantKey }) => {
|
|
1493
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1494
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
|
|
1495
|
+
const { data: payloadWithoutParsing } = await client.get(url, { transformResponse: bigIntTransformerConfig.transformResponse });
|
|
1496
|
+
const registrantKeyFromPayload = payloadWithoutParsing.registrantKey.c;
|
|
1497
|
+
return { data: {
|
|
1498
|
+
...payloadWithoutParsing,
|
|
1499
|
+
registrantKey: parseRegistrantKey(registrantKeyFromPayload)
|
|
1500
|
+
} };
|
|
1501
|
+
}
|
|
1502
|
+
}),
|
|
1503
|
+
createRegistrant,
|
|
1504
|
+
deleteRegistrant: (0, _prismatic_io_spectral.action)({
|
|
1505
|
+
display: {
|
|
1506
|
+
label: "Delete Registrant",
|
|
1507
|
+
description: "Removes a webinar registrant from current registrations for the specified webinar. The webinar must be a scheduled, future webinar."
|
|
1508
|
+
},
|
|
1509
|
+
inputs: deleteRegistrantInputs,
|
|
1510
|
+
examplePayload: GENERAL_DELETE_MESSAGE,
|
|
1511
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, registrantKey }) => {
|
|
1512
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1513
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
|
|
1514
|
+
await client.delete(url);
|
|
1515
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1516
|
+
}
|
|
1517
|
+
}),
|
|
1518
|
+
listRegistrants: (0, _prismatic_io_spectral.action)({
|
|
1519
|
+
display: {
|
|
1520
|
+
label: "List Registrants",
|
|
1521
|
+
description: "Retrieve registration details for all registrants of a specific webinar."
|
|
1522
|
+
},
|
|
1523
|
+
inputs: listRegistrantsInputs,
|
|
1524
|
+
examplePayload: LIST_REGISTRANTS_EXAMPLE_PAYLOAD,
|
|
1525
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, pagination }) => {
|
|
1526
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1527
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
|
1528
|
+
const params = {
|
|
1529
|
+
page: pagination.page,
|
|
1530
|
+
limit: pagination.limit
|
|
1531
|
+
};
|
|
1532
|
+
const { data } = await client.get(url, {
|
|
1533
|
+
params,
|
|
1534
|
+
transformResponse: bigIntTransformerConfig.transformResponse
|
|
1535
|
+
});
|
|
1536
|
+
return { data: data.map((registrant) => ({
|
|
1537
|
+
...registrant,
|
|
1538
|
+
registrantKey: parseRegistrantKey(registrant.registrantKey.c)
|
|
1539
|
+
})) };
|
|
1540
|
+
}
|
|
1541
|
+
})
|
|
1542
|
+
};
|
|
1543
|
+
//#endregion
|
|
1544
|
+
//#region src/actions/attendees/index.ts
|
|
1545
|
+
var attendees_default = {
|
|
1546
|
+
listSessionAttendees: (0, _prismatic_io_spectral.action)({
|
|
1547
|
+
display: {
|
|
1548
|
+
label: "List Session Attendees",
|
|
1549
|
+
description: "Retrieve details for all attendees of a specific webinar session."
|
|
1550
|
+
},
|
|
1551
|
+
inputs: listSessionAttendeesInputs,
|
|
1552
|
+
examplePayload: LIST_SESSION_ATTENDEES_EXAMPLE_PAYLOAD,
|
|
1553
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, sessionKey }) => {
|
|
1554
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1555
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees`;
|
|
1556
|
+
const { data } = await client.get(url);
|
|
1557
|
+
return { data };
|
|
1558
|
+
}
|
|
1559
|
+
}),
|
|
1560
|
+
listAttendees: (0, _prismatic_io_spectral.action)({
|
|
1561
|
+
display: {
|
|
1562
|
+
label: "List Attendees",
|
|
1563
|
+
description: "Retrieve all attendees for all sessions of the specified webinar."
|
|
1564
|
+
},
|
|
1565
|
+
inputs: listAllAttendeesInputs,
|
|
1566
|
+
examplePayload: LIST_ALL_ATTEENDEES_FOR_ALL_WEBINAR_SESSIONS_EXAMPLE_PAYLOAD,
|
|
1567
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey }) => {
|
|
1568
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1569
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/performance`;
|
|
1570
|
+
const { data } = await client.get(url);
|
|
1571
|
+
return { data };
|
|
1572
|
+
}
|
|
1573
|
+
}),
|
|
1574
|
+
getAttendee: (0, _prismatic_io_spectral.action)({
|
|
1575
|
+
display: {
|
|
1576
|
+
label: "Get Attendee",
|
|
1577
|
+
description: "Retrieve registration details for a particular attendee of a specific webinar session."
|
|
1578
|
+
},
|
|
1579
|
+
inputs: getAttendeeInputs,
|
|
1580
|
+
examplePayload: GET_ATTENDEE_EXAMPLE_PAYLOAD,
|
|
1581
|
+
perform: async ({ debug: { enabled: debug } }, { connection, webinarKey, sessionKey, registrantKey }) => {
|
|
1582
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, debug);
|
|
1583
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees/${registrantKey}`;
|
|
1584
|
+
const { data } = await client.get(url);
|
|
1585
|
+
return { data };
|
|
1586
|
+
}
|
|
1587
|
+
})
|
|
1588
|
+
};
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region src/actions/userSubscriptions/index.ts
|
|
1591
|
+
var userSubscriptions_default = {
|
|
1592
|
+
getUserSubscription: (0, _prismatic_io_spectral.action)({
|
|
1593
|
+
display: {
|
|
1594
|
+
label: "Get User Subscription",
|
|
1595
|
+
description: "Retrieve a user subscription by User Subscription Key."
|
|
1596
|
+
},
|
|
1597
|
+
inputs: getUserSubscriptionInputs,
|
|
1598
|
+
examplePayload: GET_USER_SUBSCRIPTION_EXAMPLE_PAYLOAD,
|
|
1599
|
+
perform: async ({ debug: { enabled: debug } }, { connection, userSubscriptionKey }) => {
|
|
1600
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1601
|
+
const url = `/userSubscriptions/${userSubscriptionKey}`;
|
|
1602
|
+
const { data } = await client.get(url);
|
|
1603
|
+
return { data };
|
|
1604
|
+
}
|
|
1605
|
+
}),
|
|
1606
|
+
deleteUserSubscription: (0, _prismatic_io_spectral.action)({
|
|
1607
|
+
display: {
|
|
1608
|
+
label: "Delete User Subscriptions",
|
|
1609
|
+
description: "Deletes one or more user subscriptions."
|
|
1610
|
+
},
|
|
1611
|
+
inputs: deleteUserSubscriptionInputs,
|
|
1612
|
+
examplePayload: GENERAL_DELETE_MESSAGE,
|
|
1613
|
+
perform: async ({ debug: { enabled: debug } }, { connection, deleteWebhook, userSubscriptionKeys }) => {
|
|
1614
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1615
|
+
if (!deleteWebhook) {
|
|
1616
|
+
await client.delete("/userSubscriptions", { data: userSubscriptionKeys });
|
|
1617
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1618
|
+
}
|
|
1619
|
+
const ids = [];
|
|
1620
|
+
for await (const userSubscriptionKey of userSubscriptionKeys) {
|
|
1621
|
+
const { data: userSubscription } = await client.get(`/userSubscriptions/${userSubscriptionKey}`);
|
|
1622
|
+
ids.push(userSubscription.webhookKey);
|
|
1623
|
+
}
|
|
1624
|
+
await client.delete("/webhooks", { data: ids });
|
|
1625
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1626
|
+
}
|
|
1627
|
+
}),
|
|
1628
|
+
createUserSubscription: (0, _prismatic_io_spectral.action)({
|
|
1629
|
+
display: {
|
|
1630
|
+
label: "Create User Subscription",
|
|
1631
|
+
description: "Create a new user subscription as a webhook."
|
|
1632
|
+
},
|
|
1633
|
+
inputs: createUserSubscriptionInputs,
|
|
1634
|
+
examplePayload: CREATE_USER_SUBSCRIPTION_EXAMPLE_PAYLOAD,
|
|
1635
|
+
perform: async ({ debug: { enabled: debug } }, { connection, eventVersion, eventName, webhookUrl }) => {
|
|
1636
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1637
|
+
const url = "/webhooks";
|
|
1638
|
+
const payload = [{
|
|
1639
|
+
eventVersion,
|
|
1640
|
+
eventName,
|
|
1641
|
+
callbackUrl: webhookUrl,
|
|
1642
|
+
product: "g2w"
|
|
1643
|
+
}];
|
|
1644
|
+
const { data: { _embedded: { webhooks } } } = await client.post(url, payload);
|
|
1645
|
+
const { webhookKey } = webhooks[0];
|
|
1646
|
+
const { data } = await client.post("/userSubscriptions", [{
|
|
1647
|
+
callbackUrl: webhookUrl,
|
|
1648
|
+
webhookKey,
|
|
1649
|
+
userSubscriptionState: "ACTIVE"
|
|
1650
|
+
}]);
|
|
1651
|
+
return { data };
|
|
1652
|
+
}
|
|
1653
|
+
}),
|
|
1654
|
+
listUserSubscriptions: (0, _prismatic_io_spectral.action)({
|
|
1655
|
+
display: {
|
|
1656
|
+
label: "List User Subscriptions",
|
|
1657
|
+
description: "Retrieve a list of user subscriptions."
|
|
1658
|
+
},
|
|
1659
|
+
inputs: listUserSubscriptionsInputs,
|
|
1660
|
+
examplePayload: LIST_USER_SUBSCRIPTIONS_EXAMPLE_PAYLOAD,
|
|
1661
|
+
perform: async ({ debug: { enabled: debug } }, { connection }) => {
|
|
1662
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1663
|
+
const { data } = await client.get("/userSubscriptions", { params: { product: "g2w" } });
|
|
1664
|
+
return { data };
|
|
1665
|
+
}
|
|
1666
|
+
}),
|
|
1667
|
+
updateUserSubscription: (0, _prismatic_io_spectral.action)({
|
|
1668
|
+
display: {
|
|
1669
|
+
label: "Update User Subscription",
|
|
1670
|
+
description: "Updates an existing user subscription."
|
|
1671
|
+
},
|
|
1672
|
+
inputs: updateUserSubscriptionInputs,
|
|
1673
|
+
examplePayload: GENERAL_DELETE_MESSAGE,
|
|
1674
|
+
perform: async ({ debug: { enabled: debug } }, { connection, userSubscriptionKey, userSubscriptionState, webhookKey, callbackUrl }) => {
|
|
1675
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1676
|
+
const url = "/userSubscriptions";
|
|
1677
|
+
const payload = [{
|
|
1678
|
+
callbackUrl,
|
|
1679
|
+
userSubscriptionKey,
|
|
1680
|
+
userSubscriptionState,
|
|
1681
|
+
webhookKey
|
|
1682
|
+
}];
|
|
1683
|
+
await client.put(url, payload);
|
|
1684
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1685
|
+
}
|
|
1686
|
+
})
|
|
1687
|
+
};
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/actions/webhooks/index.ts
|
|
1690
|
+
var webhooks_default = { deleteInstancedWebhooksAction: (0, _prismatic_io_spectral.action)({
|
|
1691
|
+
display: {
|
|
1692
|
+
label: "Delete Instanced Subscriptions",
|
|
1693
|
+
description: "Delete all subscriptions that point to a flow in this instance."
|
|
1694
|
+
},
|
|
1695
|
+
inputs: deleteInstancedWebhooksInputs,
|
|
1696
|
+
examplePayload: GENERAL_DELETE_MESSAGE,
|
|
1697
|
+
perform: async ({ debug: { enabled: debug }, webhookUrls }, { connection }) => {
|
|
1698
|
+
const { client } = createGotoWebinarClient(connection, debug);
|
|
1699
|
+
await deleteInstancedWebhooks(client, Object.values(webhookUrls).map((url) => _prismatic_io_spectral.util.types.toString(url)), { product: "g2w" });
|
|
1700
|
+
return GENERAL_DELETE_MESSAGE;
|
|
1701
|
+
}
|
|
1702
|
+
}) };
|
|
1703
|
+
//#endregion
|
|
1704
|
+
//#region src/actions/misc/rawRequest.ts
|
|
1705
|
+
const { debugRequest: _, ...rawRequestInputs } = _prismatic_io_spectral_http.inputs;
|
|
1706
|
+
//#endregion
|
|
1707
|
+
//#region src/actions/misc/index.ts
|
|
1708
|
+
var misc_default = { rawRequest: (0, _prismatic_io_spectral.action)({
|
|
1709
|
+
display: {
|
|
1710
|
+
label: "Raw Request",
|
|
1711
|
+
description: "Send a raw HTTP request to GoTo Webinar."
|
|
1712
|
+
},
|
|
1713
|
+
perform: async (context, { connection, ...rawRequestInputs }) => {
|
|
1714
|
+
const { baseUrl, token } = getClientProps(connection);
|
|
1715
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(baseUrl, {
|
|
1716
|
+
...rawRequestInputs,
|
|
1717
|
+
debugRequest: context.debug.enabled
|
|
1718
|
+
}, {
|
|
1719
|
+
Authorization: token,
|
|
1720
|
+
"Content-Type": "Application/JSON",
|
|
1721
|
+
Accept: "Application/JSON"
|
|
1722
|
+
});
|
|
1723
|
+
return { data: { data } };
|
|
1724
|
+
},
|
|
1725
|
+
inputs: {
|
|
1726
|
+
connection,
|
|
1727
|
+
...rawRequestInputs,
|
|
1728
|
+
url: {
|
|
1729
|
+
...rawRequestInputs.url,
|
|
1730
|
+
comments: "Input the path only (/organizers), The base URL is already included. For example, in order to send a webinar request, only /organizer/{organizerKey}/webinars is entered in this field.",
|
|
1731
|
+
example: "/organizers/{organizerKey}/webinars"
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}) };
|
|
1735
|
+
//#endregion
|
|
1736
|
+
//#region src/actions/index.ts
|
|
1737
|
+
var actions_default = {
|
|
1738
|
+
...webinars_default,
|
|
1739
|
+
...registrants_default,
|
|
1740
|
+
...attendees_default,
|
|
1741
|
+
...userSubscriptions_default,
|
|
1742
|
+
...webhooks_default,
|
|
1743
|
+
...misc_default
|
|
1744
|
+
};
|
|
1745
|
+
//#endregion
|
|
1746
|
+
//#region src/dataSources/index.ts
|
|
1747
|
+
var dataSources_default = {
|
|
1748
|
+
selectWebinar: (0, _prismatic_io_spectral.dataSource)({
|
|
1749
|
+
display: {
|
|
1750
|
+
label: "Select Webinar",
|
|
1751
|
+
description: "Select a webinar from the list of available webinars by your Account Key."
|
|
1752
|
+
},
|
|
1753
|
+
inputs: {
|
|
1754
|
+
connection,
|
|
1755
|
+
accountKey,
|
|
1756
|
+
fromTime: {
|
|
1757
|
+
...fromTime,
|
|
1758
|
+
required: false,
|
|
1759
|
+
default: getFromTime()
|
|
1760
|
+
},
|
|
1761
|
+
toTime: {
|
|
1762
|
+
...toTime,
|
|
1763
|
+
required: false,
|
|
1764
|
+
default: getEndTime()
|
|
1765
|
+
}
|
|
1766
|
+
},
|
|
1767
|
+
perform: async (context, { connection, accountKey, toTime, fromTime }) => {
|
|
1768
|
+
const { client } = createGotoWebinarClient(connection, false);
|
|
1769
|
+
const url = `/accounts/${accountKey}/webinars`;
|
|
1770
|
+
const params = {
|
|
1771
|
+
fromTime,
|
|
1772
|
+
toTime
|
|
1773
|
+
};
|
|
1774
|
+
const { data } = await client.get(url, { params });
|
|
1775
|
+
const webinars = data._embedded.webinars;
|
|
1776
|
+
if (!webinars) return { result: [] };
|
|
1777
|
+
return { result: webinars.map(({ subject, webinarKey }) => {
|
|
1778
|
+
return {
|
|
1779
|
+
key: webinarKey,
|
|
1780
|
+
label: subject
|
|
1781
|
+
};
|
|
1782
|
+
}) };
|
|
1783
|
+
},
|
|
1784
|
+
dataSourceType: "picklist"
|
|
1785
|
+
}),
|
|
1786
|
+
selectOrganizer: (0, _prismatic_io_spectral.dataSource)({
|
|
1787
|
+
display: {
|
|
1788
|
+
label: "Select Organizer",
|
|
1789
|
+
description: "Select an organizer from the list of available organizer keys."
|
|
1790
|
+
},
|
|
1791
|
+
inputs: {
|
|
1792
|
+
connection,
|
|
1793
|
+
accountKey,
|
|
1794
|
+
fromTime: {
|
|
1795
|
+
...fromTime,
|
|
1796
|
+
required: false,
|
|
1797
|
+
default: getFromTime()
|
|
1798
|
+
},
|
|
1799
|
+
toTime: {
|
|
1800
|
+
...toTime,
|
|
1801
|
+
required: false,
|
|
1802
|
+
default: getEndTime()
|
|
1803
|
+
}
|
|
1804
|
+
},
|
|
1805
|
+
perform: async (context, { connection, accountKey, fromTime, toTime }) => {
|
|
1806
|
+
const { client } = createGotoWebinarClient(connection, false);
|
|
1807
|
+
const url = `/accounts/${accountKey}/webinars`;
|
|
1808
|
+
const params = {
|
|
1809
|
+
fromTime,
|
|
1810
|
+
toTime
|
|
1811
|
+
};
|
|
1812
|
+
const { data } = await client.get(url, { params });
|
|
1813
|
+
const webinars = data._embedded.webinars;
|
|
1814
|
+
if (!webinars) return { result: [] };
|
|
1815
|
+
return { result: webinars.map(({ organizerKey, subject }) => {
|
|
1816
|
+
return {
|
|
1817
|
+
organizerKey,
|
|
1818
|
+
subject
|
|
1819
|
+
};
|
|
1820
|
+
}).filter((value, index, self) => self.indexOf(value) === index).map(({ organizerKey, subject }) => {
|
|
1821
|
+
return {
|
|
1822
|
+
key: organizerKey,
|
|
1823
|
+
label: `Organizer for ${subject}`
|
|
1824
|
+
};
|
|
1825
|
+
}) };
|
|
1826
|
+
},
|
|
1827
|
+
dataSourceType: "picklist"
|
|
1828
|
+
}),
|
|
1829
|
+
selectRegistrant: (0, _prismatic_io_spectral.dataSource)({
|
|
1830
|
+
display: {
|
|
1831
|
+
label: "Select Registrant",
|
|
1832
|
+
description: "Select a registrant from a list of registrants for a webinar."
|
|
1833
|
+
},
|
|
1834
|
+
inputs: {
|
|
1835
|
+
connection,
|
|
1836
|
+
webinarKey: {
|
|
1837
|
+
...webinarKey,
|
|
1838
|
+
dataSource: void 0
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
perform: async (context, { connection, webinarKey }) => {
|
|
1842
|
+
const { client, organizerKey } = createGotoWebinarClient(connection, false);
|
|
1843
|
+
const url = `/organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
|
1844
|
+
const { data } = await client.get(url, { transformResponse: bigIntTransformerConfig.transformResponse });
|
|
1845
|
+
if (!data || data.length === 0) return { result: [] };
|
|
1846
|
+
return { result: data.map((registrant) => ({
|
|
1847
|
+
key: parseRegistrantKey(registrant.registrantKey.c),
|
|
1848
|
+
label: `${registrant.firstName} ${registrant.lastName} (${registrant.email})`
|
|
1849
|
+
})).sort((a, b) => (a.label ?? "").localeCompare(b.label ?? "")) };
|
|
1850
|
+
},
|
|
1851
|
+
dataSourceType: "picklist"
|
|
1852
|
+
}),
|
|
1853
|
+
selectWebhook: (0, _prismatic_io_spectral.dataSource)({
|
|
1854
|
+
display: {
|
|
1855
|
+
label: "Select Webhook",
|
|
1856
|
+
description: "Select a webhook from a list of available webhooks."
|
|
1857
|
+
},
|
|
1858
|
+
inputs: { connection },
|
|
1859
|
+
perform: async (context, { connection }) => {
|
|
1860
|
+
const { client } = createGotoWebinarClient(connection, false);
|
|
1861
|
+
const { data } = await client.get("/userSubscriptions", { params: { product: "g2w" } });
|
|
1862
|
+
const userSubscriptions = data?._embedded?.userSubscriptions;
|
|
1863
|
+
if (!userSubscriptions) return { result: [] };
|
|
1864
|
+
return { result: userSubscriptions.map(({ eventName, webhookKey, userSubscriptionState }) => {
|
|
1865
|
+
return {
|
|
1866
|
+
key: webhookKey,
|
|
1867
|
+
label: `${webhookKey} - ${eventName} - ${userSubscriptionState}`
|
|
1868
|
+
};
|
|
1869
|
+
}) };
|
|
1870
|
+
},
|
|
1871
|
+
dataSourceType: "picklist"
|
|
1872
|
+
})
|
|
1873
|
+
};
|
|
1874
|
+
//#endregion
|
|
1875
|
+
//#region src/triggers/pollChangesTrigger.ts
|
|
1876
|
+
const pollChangesTrigger = (0, _prismatic_io_spectral.pollingTrigger)({
|
|
1877
|
+
display: {
|
|
1878
|
+
label: "New Registrants",
|
|
1879
|
+
description: "Retrieves existing and ongoing registrants for a specified GoTo Webinar webinar. Load history once, check for changes on a schedule, or both."
|
|
1880
|
+
},
|
|
1881
|
+
inputs: {
|
|
1882
|
+
connection,
|
|
1883
|
+
webinarKey,
|
|
1884
|
+
lookBackDate
|
|
1885
|
+
},
|
|
1886
|
+
examplePayload: pollChangesTriggerExamplePayload,
|
|
1887
|
+
triggerResolverSupport: "valid",
|
|
1888
|
+
batchConfig: { batchSize: 50 },
|
|
1889
|
+
triggerResolver: { resolveItems: (_context, { payload }) => resolvePollingRecordChanges(payload.body.data) },
|
|
1890
|
+
perform: async (context, payload, params) => {
|
|
1891
|
+
const pollState = context.polling.getState();
|
|
1892
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1893
|
+
const lastPolledAt = pollState?.lastPolledAt || (params.lookBackDate ? lookBackDateToCursor(params.lookBackDate) : "");
|
|
1894
|
+
if (!lastPolledAt) {
|
|
1895
|
+
context.polling.setState({ lastPolledAt: now });
|
|
1896
|
+
return {
|
|
1897
|
+
payload: {
|
|
1898
|
+
...payload,
|
|
1899
|
+
body: { data: { created: [] } }
|
|
1900
|
+
},
|
|
1901
|
+
polledNoChanges: true
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
const { client, organizerKey } = createGotoWebinarClient(params.connection, context.debug.enabled);
|
|
1905
|
+
const registrants = await fetchAllRegistrants(client, organizerKey, params.webinarKey);
|
|
1906
|
+
const newRegistrants = filterRegistrantsRegisteredAfter(registrants, lastPolledAt);
|
|
1907
|
+
context.polling.setState({ lastPolledAt: now });
|
|
1908
|
+
if (context.debug.enabled) context.logger.debug(`Polled GoToWebinar registrants (webinar ${params.webinarKey}): ${registrants.length} fetched, ${newRegistrants.length} new`);
|
|
1909
|
+
return {
|
|
1910
|
+
payload: {
|
|
1911
|
+
...payload,
|
|
1912
|
+
body: { data: { created: newRegistrants } }
|
|
1913
|
+
},
|
|
1914
|
+
polledNoChanges: newRegistrants.length === 0
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region src/triggers/index.ts
|
|
1920
|
+
var triggers_default = {
|
|
1921
|
+
userSubscriptionTrigger: (0, _prismatic_io_spectral.trigger)({
|
|
1922
|
+
display: {
|
|
1923
|
+
label: "User Subscription",
|
|
1924
|
+
description: "Receive event notifications from GoTo Webinar. Automatically creates and manages a webhook subscription for the selected event when the instance is deployed, and removes the subscription when the instance is deleted."
|
|
1925
|
+
},
|
|
1926
|
+
inputs: {
|
|
1927
|
+
connection,
|
|
1928
|
+
eventName,
|
|
1929
|
+
eventVersion
|
|
1930
|
+
},
|
|
1931
|
+
examplePayload: userSubscriptionTriggerExamplePayload,
|
|
1932
|
+
webhookLifecycleHandlers: {
|
|
1933
|
+
create: async (context, { connection, eventName, eventVersion }) => {
|
|
1934
|
+
const { client } = createGotoWebinarClient(connection, false);
|
|
1935
|
+
const flowName = context.flow.name;
|
|
1936
|
+
const callbackUrl = context.webhookUrls[flowName];
|
|
1937
|
+
const payload = [{
|
|
1938
|
+
eventVersion,
|
|
1939
|
+
eventName,
|
|
1940
|
+
callbackUrl,
|
|
1941
|
+
product: "g2w"
|
|
1942
|
+
}];
|
|
1943
|
+
const { data: { _embedded: { webhooks } } } = await client.post("/webhooks", payload);
|
|
1944
|
+
const { webhookKey } = webhooks[0];
|
|
1945
|
+
await client.post("/userSubscriptions", [{
|
|
1946
|
+
callbackUrl,
|
|
1947
|
+
webhookKey,
|
|
1948
|
+
userSubscriptionState: "ACTIVE"
|
|
1949
|
+
}]);
|
|
1950
|
+
},
|
|
1951
|
+
delete: async (context, { connection }) => {
|
|
1952
|
+
const { client } = createGotoWebinarClient(connection, false);
|
|
1953
|
+
await deleteInstancedWebhooks(client, Object.values(context.webhookUrls), { product: "g2w" });
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
perform: async (context, payload) => {
|
|
1957
|
+
return Promise.resolve({
|
|
1958
|
+
payload,
|
|
1959
|
+
response: {
|
|
1960
|
+
statusCode: 200,
|
|
1961
|
+
contentType: "application/json"
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
},
|
|
1965
|
+
synchronousResponseSupport: "invalid",
|
|
1966
|
+
allowsBranching: false,
|
|
1967
|
+
scheduleSupport: "invalid"
|
|
1968
|
+
}),
|
|
1969
|
+
pollChangesTrigger
|
|
1970
|
+
};
|
|
1971
|
+
//#endregion
|
|
1972
|
+
//#region src/index.ts
|
|
1973
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
1974
|
+
key: "gotowebinar",
|
|
1975
|
+
public: true,
|
|
1976
|
+
display: {
|
|
1977
|
+
label: "GoTo Webinar",
|
|
1978
|
+
category: "Application Connectors",
|
|
1979
|
+
description: "GoTo Webinar is a platform for hosting, managing, and attending live or pre-recorded webinars.",
|
|
1980
|
+
iconPath: "icon.png"
|
|
1981
|
+
},
|
|
1982
|
+
hooks: { error: _prismatic_io_spectral_http.handleErrors },
|
|
1983
|
+
documentationUrl: "https://prismatic.io/docs/components/gotowebinar/",
|
|
1984
|
+
actions: actions_default,
|
|
1985
|
+
dataSources: dataSources_default,
|
|
1986
|
+
connections: connections_default,
|
|
1987
|
+
triggers: triggers_default
|
|
1988
|
+
});
|
|
1989
|
+
//#endregion
|
|
1990
|
+
//#region npm-dist/.entry.ts
|
|
1991
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
1992
|
+
//#endregion
|
|
1993
|
+
module.exports = _entry_default;
|