@livechat/developer-studio-api 5.2.0-generator-beta-v1.0 → 5.3.0-beta.v1

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.
@@ -0,0 +1,2277 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __async = (__this, __arguments, generator) => {
47
+ return new Promise((resolve, reject) => {
48
+ var fulfilled = (value) => {
49
+ try {
50
+ step(generator.next(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ };
55
+ var rejected = (value) => {
56
+ try {
57
+ step(generator.throw(value));
58
+ } catch (e) {
59
+ reject(e);
60
+ }
61
+ };
62
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
+ step((generator = generator.apply(__this, __arguments)).next());
64
+ });
65
+ };
66
+
67
+ // src/apis/integrations/text/platform/workflow/contracts.ts
68
+ var contracts_exports = {};
69
+ __export(contracts_exports, {
70
+ CredentialStatus: () => CredentialStatus,
71
+ CredentialType: () => CredentialType,
72
+ CredentialTypeDisplayNameMapping: () => CredentialTypeDisplayNameMapping,
73
+ OauthCredentialGrantType: () => OauthCredentialGrantType,
74
+ SortBy: () => SortBy,
75
+ SortOrder: () => SortOrder,
76
+ TRIGGER_REFERENCE_NAME: () => TRIGGER_REFERENCE_NAME,
77
+ WorkflowConditionTaskFieldType: () => WorkflowConditionTaskFieldType,
78
+ WorkflowConditionTaskLogic: () => WorkflowConditionTaskLogic,
79
+ WorkflowConditionTaskOperator: () => WorkflowConditionTaskOperator,
80
+ WorkflowConditionTaskOperatorGroup: () => WorkflowConditionTaskOperatorGroup,
81
+ WorkflowConditionTaskOperatorValueType: () => WorkflowConditionTaskOperatorValueType,
82
+ WorkflowCustomTaskName: () => WorkflowCustomTaskName,
83
+ WorkflowExecutionDefinitionStatus: () => WorkflowExecutionDefinitionStatus,
84
+ WorkflowExecutionStatus: () => WorkflowExecutionStatus,
85
+ WorkflowExecutionTaskStatus: () => WorkflowExecutionTaskStatus,
86
+ WorkflowItemKind: () => WorkflowItemKind,
87
+ WorkflowTaskType: () => WorkflowTaskType,
88
+ WorkflowTemplateCategory: () => WorkflowTemplateCategory,
89
+ WorkflowTriggerType: () => WorkflowTriggerType,
90
+ getWorkflowApiCrmConfig: () => getWorkflowApiCrmConfig,
91
+ isFilter: () => isFilter,
92
+ isFilterGroup: () => isFilterGroup,
93
+ serializeFilters: () => serializeFilters
94
+ });
95
+ module.exports = __toCommonJS(contracts_exports);
96
+
97
+ // src/apis/integrations/text/platform/workflow/_contracts/filters/helpers.ts
98
+ var isFilterGroup = (filter) => {
99
+ return "filters" in filter && "operator" in filter;
100
+ };
101
+ var isFilter = (filter) => {
102
+ return "field" in filter && "operator" in filter && "value" in filter;
103
+ };
104
+
105
+ // src/apis/integrations/text/platform/workflow/_contracts/filters/serialize.ts
106
+ var convertValueToString = (value) => {
107
+ if (typeof value === "string") {
108
+ return `"${value}"`;
109
+ }
110
+ if (value === null) {
111
+ return "null";
112
+ }
113
+ return value.toString();
114
+ };
115
+ var filterToString = (filter) => {
116
+ if (isFilterGroup(filter)) {
117
+ return `(${serializeFilters([filter])})`;
118
+ } else if (isFilter(filter)) {
119
+ return `${filter.field} ${filter.operator} ${convertValueToString(filter.value)}`;
120
+ }
121
+ return "";
122
+ };
123
+ var serializeFilters = (filters) => {
124
+ if (filters.length === 0) {
125
+ return "";
126
+ }
127
+ if (filters.length === 1 && filters[0] && isFilterGroup(filters[0])) {
128
+ const group = filters[0];
129
+ return group.filters.map(filterToString).filter(Boolean).join(` ${group.operator} `);
130
+ }
131
+ return filters.map(filterToString).filter(Boolean).join(" and ");
132
+ };
133
+
134
+ // src/apis/integrations/text/platform/workflow/_contracts/sorting/types.ts
135
+ var SortOrder = {
136
+ Ascending: "asc",
137
+ Descending: "desc"
138
+ };
139
+ var SortBy = {
140
+ Name: "name",
141
+ CreatedOn: "created_at",
142
+ CreatedBy: "created_by",
143
+ Runs: "executions.completed",
144
+ Status: "active"
145
+ };
146
+
147
+ // src/apis/integrations/text/platform/workflow/credentials/_contracts/dtos/credential.ts
148
+ var CredentialStatus = /* @__PURE__ */ ((CredentialStatus2) => {
149
+ CredentialStatus2["Connected"] = "connected";
150
+ CredentialStatus2["Disconnected"] = "disconnected";
151
+ CredentialStatus2["Stale"] = "stale";
152
+ return CredentialStatus2;
153
+ })(CredentialStatus || {});
154
+ var CredentialType = /* @__PURE__ */ ((CredentialType2) => {
155
+ CredentialType2["General"] = "general";
156
+ CredentialType2["ApiKey"] = "api_key";
157
+ CredentialType2["BasicAuth"] = "basic_auth";
158
+ CredentialType2["OAuth2"] = "oauth2";
159
+ CredentialType2["TextAuth"] = "text_auth";
160
+ return CredentialType2;
161
+ })(CredentialType || {});
162
+ var CredentialTypeDisplayNameMapping = {
163
+ ["general" /* General */]: "General",
164
+ ["api_key" /* ApiKey */]: "API Key",
165
+ ["basic_auth" /* BasicAuth */]: "Basic Auth",
166
+ ["oauth2" /* OAuth2 */]: "OAuth2",
167
+ ["text_auth" /* TextAuth */]: "Text"
168
+ };
169
+ var OauthCredentialGrantType = /* @__PURE__ */ ((OauthCredentialGrantType2) => {
170
+ OauthCredentialGrantType2["AuthorizationCode"] = "authorization_code";
171
+ OauthCredentialGrantType2["Implicit"] = "implicit";
172
+ OauthCredentialGrantType2["PKCE"] = "pkce";
173
+ OauthCredentialGrantType2["ClientCredentials"] = "client_credentials";
174
+ return OauthCredentialGrantType2;
175
+ })(OauthCredentialGrantType || {});
176
+
177
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/base.ts
178
+ var WorkflowTaskType = {
179
+ http: "HTTP",
180
+ switch: "SWITCH",
181
+ forkJoin: "FORK_JOIN",
182
+ terminate: "TERMINATE",
183
+ join: "JOIN",
184
+ wait: "WAIT",
185
+ simple: "SIMPLE",
186
+ doWhile: "DO_WHILE",
187
+ inline: "INLINE",
188
+ transform: "JSON_JQ_TRANSFORM"
189
+ };
190
+ var WorkflowCustomTaskName = {
191
+ // SWITCH
192
+ condition: `${WorkflowTaskType.switch}_IF`,
193
+ switchCase: `${WorkflowTaskType.switch}_CASE`,
194
+ // SIMPLE
195
+ action: "action",
196
+ awaitAgent: "await",
197
+ notifyAgent: "notify_ai_agent",
198
+ reasoning: "reasoning",
199
+ // DO WHILE
200
+ loop: `${WorkflowTaskType.doWhile}_LOOP`,
201
+ forEach: `${WorkflowTaskType.doWhile}_FOR_EACH`,
202
+ // INLINE
203
+ script: `${WorkflowTaskType.inline}_SCRIPT`,
204
+ // JQ TRANSFORM
205
+ convert: `${WorkflowTaskType.transform}_CONVERT`,
206
+ construct: `${WorkflowTaskType.transform}_CONSTRUCT`
207
+ };
208
+ var WorkflowExecutionTaskStatus = /* @__PURE__ */ ((WorkflowExecutionTaskStatus2) => {
209
+ WorkflowExecutionTaskStatus2["Completed"] = "COMPLETED";
210
+ WorkflowExecutionTaskStatus2["CompletedWithError"] = "COMPLETED_WITH_ERRORS";
211
+ WorkflowExecutionTaskStatus2["Failed"] = "FAILED";
212
+ WorkflowExecutionTaskStatus2["FailedWithTerminalErrors"] = "FAILED_WITH_TERMINAL_ERROR";
213
+ WorkflowExecutionTaskStatus2["Scheduled"] = "SCHEDULED";
214
+ WorkflowExecutionTaskStatus2["TimedOut"] = "TIMED_OUT";
215
+ WorkflowExecutionTaskStatus2["InProgress"] = "IN_PROGRESS";
216
+ WorkflowExecutionTaskStatus2["Skipped"] = "SKIPPED";
217
+ WorkflowExecutionTaskStatus2["Canceled"] = "CANCELED";
218
+ WorkflowExecutionTaskStatus2["NotExecuted"] = "NOT_EXECUTED";
219
+ return WorkflowExecutionTaskStatus2;
220
+ })(WorkflowExecutionTaskStatus || {});
221
+
222
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/switch/variants/condition.ts
223
+ var WorkflowConditionTaskLogic = /* @__PURE__ */ ((WorkflowConditionTaskLogic2) => {
224
+ WorkflowConditionTaskLogic2["AND"] = "AND";
225
+ WorkflowConditionTaskLogic2["OR"] = "OR";
226
+ return WorkflowConditionTaskLogic2;
227
+ })(WorkflowConditionTaskLogic || {});
228
+ var WorkflowConditionTaskOperator = /* @__PURE__ */ ((WorkflowConditionTaskOperator2) => {
229
+ WorkflowConditionTaskOperator2["GeneralEmpty"] = "g_empty";
230
+ WorkflowConditionTaskOperator2["GeneralNotEmpty"] = "g_nempty";
231
+ WorkflowConditionTaskOperator2["NumberEqual"] = "n_eq";
232
+ WorkflowConditionTaskOperator2["NumberNotEqual"] = "n_neq";
233
+ WorkflowConditionTaskOperator2["NumberIn"] = "n_in";
234
+ WorkflowConditionTaskOperator2["NumberNotIn"] = "n_nin";
235
+ WorkflowConditionTaskOperator2["NumberGreaterThan"] = "n_gt";
236
+ WorkflowConditionTaskOperator2["NumberGreaterOrEqual"] = "n_gte";
237
+ WorkflowConditionTaskOperator2["NumberLessThan"] = "n_lt";
238
+ WorkflowConditionTaskOperator2["NumberLessOrEqual"] = "n_lte";
239
+ WorkflowConditionTaskOperator2["StringEqual"] = "s_eq";
240
+ WorkflowConditionTaskOperator2["StringNotEqual"] = "s_neq";
241
+ WorkflowConditionTaskOperator2["StringIn"] = "s_in";
242
+ WorkflowConditionTaskOperator2["StringNotIn"] = "s_nin";
243
+ WorkflowConditionTaskOperator2["StringContains"] = "s_contains";
244
+ WorkflowConditionTaskOperator2["StringNotContains"] = "s_not_contains";
245
+ WorkflowConditionTaskOperator2["StringStartsWith"] = "s_starts_with";
246
+ WorkflowConditionTaskOperator2["StringEndsWith"] = "s_ends_with";
247
+ WorkflowConditionTaskOperator2["StringRegex"] = "s_regex";
248
+ WorkflowConditionTaskOperator2["StringLengthEqual"] = "s_length_eq";
249
+ WorkflowConditionTaskOperator2["StringLengthGreaterThan"] = "s_length_gt";
250
+ WorkflowConditionTaskOperator2["StringLengthLessThan"] = "s_length_lt";
251
+ WorkflowConditionTaskOperator2["DateTimeEqual"] = "dt_eq";
252
+ WorkflowConditionTaskOperator2["DateTimeNotEqual"] = "dt_neq";
253
+ WorkflowConditionTaskOperator2["DateTimeBefore"] = "dt_before";
254
+ WorkflowConditionTaskOperator2["DateTimeAfter"] = "dt_after";
255
+ WorkflowConditionTaskOperator2["BooleanEqual"] = "b_eq";
256
+ WorkflowConditionTaskOperator2["BooleanNotEqual"] = "b_neq";
257
+ WorkflowConditionTaskOperator2["ArrayContains"] = "a_contains";
258
+ WorkflowConditionTaskOperator2["ArrayNotContains"] = "a_not_contains";
259
+ WorkflowConditionTaskOperator2["ArrayLengthEqual"] = "a_length_eq";
260
+ WorkflowConditionTaskOperator2["ArrayLengthGreaterThan"] = "a_length_gt";
261
+ WorkflowConditionTaskOperator2["ArrayLengthLessThan"] = "a_length_lt";
262
+ WorkflowConditionTaskOperator2["ArrayLengthGreaterOrEqual"] = "a_length_gte";
263
+ WorkflowConditionTaskOperator2["ArrayLengthLessOrEqual"] = "a_length_lte";
264
+ return WorkflowConditionTaskOperator2;
265
+ })(WorkflowConditionTaskOperator || {});
266
+ var WorkflowConditionTaskOperatorValueType = /* @__PURE__ */ ((WorkflowConditionTaskOperatorValueType2) => {
267
+ WorkflowConditionTaskOperatorValueType2["Null"] = "null";
268
+ WorkflowConditionTaskOperatorValueType2["String"] = "string";
269
+ WorkflowConditionTaskOperatorValueType2["Number"] = "number";
270
+ WorkflowConditionTaskOperatorValueType2["Boolean"] = "boolean";
271
+ WorkflowConditionTaskOperatorValueType2["Datetime"] = "datetime";
272
+ WorkflowConditionTaskOperatorValueType2["ArrayString"] = "array-string";
273
+ WorkflowConditionTaskOperatorValueType2["ArrayNumber"] = "array-number";
274
+ WorkflowConditionTaskOperatorValueType2["ArrayItem"] = "array-item";
275
+ return WorkflowConditionTaskOperatorValueType2;
276
+ })(WorkflowConditionTaskOperatorValueType || {});
277
+ var WorkflowConditionTaskOperatorGroup = /* @__PURE__ */ ((WorkflowConditionTaskOperatorGroup2) => {
278
+ WorkflowConditionTaskOperatorGroup2["General"] = "general";
279
+ WorkflowConditionTaskOperatorGroup2["String"] = "string";
280
+ WorkflowConditionTaskOperatorGroup2["Number"] = "number";
281
+ WorkflowConditionTaskOperatorGroup2["Boolean"] = "boolean";
282
+ WorkflowConditionTaskOperatorGroup2["Datetime"] = "datetime";
283
+ WorkflowConditionTaskOperatorGroup2["Array"] = "array";
284
+ return WorkflowConditionTaskOperatorGroup2;
285
+ })(WorkflowConditionTaskOperatorGroup || {});
286
+ var WorkflowConditionTaskFieldType = /* @__PURE__ */ ((WorkflowConditionTaskFieldType2) => {
287
+ WorkflowConditionTaskFieldType2["String"] = "string";
288
+ WorkflowConditionTaskFieldType2["Number"] = "number";
289
+ WorkflowConditionTaskFieldType2["Integer"] = "integer";
290
+ WorkflowConditionTaskFieldType2["Boolean"] = "boolean";
291
+ WorkflowConditionTaskFieldType2["Array"] = "array";
292
+ return WorkflowConditionTaskFieldType2;
293
+ })(WorkflowConditionTaskFieldType || {});
294
+
295
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/base.ts
296
+ var WorkflowTriggerType = {
297
+ manual: "manual_only",
298
+ agent: "ai_agent",
299
+ recurring: "recurring",
300
+ oneTime: "one_time",
301
+ webhook: "webhook",
302
+ webhookManual: "webhook_manual"
303
+ };
304
+
305
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowElement.ts
306
+ var TRIGGER_REFERENCE_NAME = "trigger";
307
+
308
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowExecution.ts
309
+ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
310
+ WorkflowExecutionStatus2["Succeeded"] = "succeeded";
311
+ WorkflowExecutionStatus2["Failed"] = "failed";
312
+ WorkflowExecutionStatus2["Pending"] = "pending";
313
+ return WorkflowExecutionStatus2;
314
+ })(WorkflowExecutionStatus || {});
315
+ var WorkflowExecutionDefinitionStatus = /* @__PURE__ */ ((WorkflowExecutionDefinitionStatus2) => {
316
+ WorkflowExecutionDefinitionStatus2["Completed"] = "COMPLETED";
317
+ WorkflowExecutionDefinitionStatus2["Failed"] = "FAILED";
318
+ WorkflowExecutionDefinitionStatus2["Running"] = "RUNNING";
319
+ return WorkflowExecutionDefinitionStatus2;
320
+ })(WorkflowExecutionDefinitionStatus || {});
321
+
322
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowItem.ts
323
+ var WorkflowItemKind = /* @__PURE__ */ ((WorkflowItemKind2) => {
324
+ WorkflowItemKind2["Task"] = "task";
325
+ WorkflowItemKind2["Trigger"] = "trigger";
326
+ return WorkflowItemKind2;
327
+ })(WorkflowItemKind || {});
328
+
329
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowTemplate.ts
330
+ var WorkflowTemplateCategory = /* @__PURE__ */ ((WorkflowTemplateCategory2) => {
331
+ WorkflowTemplateCategory2["NotificationAndAlerts"] = "Notifications & alerts";
332
+ WorkflowTemplateCategory2["SalesManagement"] = "Sales management";
333
+ WorkflowTemplateCategory2["LeadCollection"] = "Lead collection";
334
+ WorkflowTemplateCategory2["ChatManagement"] = "Chat management";
335
+ WorkflowTemplateCategory2["CustomerExperience"] = "Customer experience";
336
+ return WorkflowTemplateCategory2;
337
+ })(WorkflowTemplateCategory || {});
338
+
339
+ // src/constants/app/templates/repository.ts
340
+ var appRepositoryTemplates = {
341
+ nextjs: {
342
+ id: "nextjs",
343
+ description: "Uses the most popular and versatile features from our SDKs:",
344
+ tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
345
+ name: "Fullstack Next.js template",
346
+ repository: {
347
+ name: "livechat/developer-app-template-nextjs",
348
+ target: "nextjs"
349
+ }
350
+ },
351
+ vite: {
352
+ id: "vite",
353
+ name: "Vite template",
354
+ description: "Implements the same base functionalities as the Next.js template except for webhooks:",
355
+ tags: ["Auth", "Agent App SDK", "Moments"],
356
+ repository: {
357
+ name: "livechat/developer-app-template-vite",
358
+ target: "browser"
359
+ }
360
+ },
361
+ saas: {
362
+ id: "saas",
363
+ name: "Nextjs SaaS boilerplate",
364
+ description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
365
+ tags: [],
366
+ repository: {
367
+ name: "livechat/developer-app-template-saas",
368
+ target: "nextjs"
369
+ }
370
+ }
371
+ };
372
+
373
+ // src/constants/app/templates/app.ts
374
+ var appBaseTemplates = {
375
+ "tag-master": {
376
+ id: "tag-master",
377
+ name: "Tag Master",
378
+ category: { name: "Agent App Widget" },
379
+ description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
380
+ tags: ["Accounts SDK", "NextJS", "Configuration API"],
381
+ link: "https://github.com/bstopyra/tag-master-template",
382
+ icons: {},
383
+ repository: {
384
+ name: "bstopyra/tag-master-template",
385
+ target: "node"
386
+ }
387
+ },
388
+ progress: {
389
+ id: "progress",
390
+ name: "Progress",
391
+ category: { name: "Agent App Widget" },
392
+ description: "Creates reports based on data from chats: ratings, chatting time, response time.",
393
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
394
+ link: "https://github.com/livechat/progress-app",
395
+ icons: {},
396
+ repository: {
397
+ name: "livechat/progress-app",
398
+ target: "node"
399
+ }
400
+ },
401
+ supervisor: {
402
+ id: "supervisor",
403
+ name: "Supervisor",
404
+ category: { name: "Agent App Widget" },
405
+ description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
406
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
407
+ link: "https://github.com/livechat/supervisor-app",
408
+ icons: {},
409
+ repository: {
410
+ name: "livechat/supervisor-app",
411
+ target: "node"
412
+ }
413
+ },
414
+ popup: {
415
+ id: "popup",
416
+ name: "Popup app",
417
+ category: { name: "Agent App Widget" },
418
+ description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
419
+ tags: ["Accounts SDK", "Popup flow", "Widget"],
420
+ link: "https://github.com/livechat/sample-app-popup-auth",
421
+ icons: {},
422
+ repository: {
423
+ name: "livechat/sample-app-popup-auth",
424
+ target: "node"
425
+ }
426
+ },
427
+ redirect: {
428
+ id: "redirect",
429
+ name: "Redirect app",
430
+ category: { name: "Agent App Widget" },
431
+ description: "See how to implement the redirect authorization flow from the Accounts SDK.",
432
+ tags: ["Accounts SDK", "Redirect flow", "Widget"],
433
+ link: "https://github.com/livechat/sample-app-redirect-auth",
434
+ icons: {},
435
+ repository: {
436
+ name: "livechat/sample-app-redirect-auth",
437
+ target: "node"
438
+ }
439
+ }
440
+ };
441
+ var appTemplates = {
442
+ saas: {
443
+ id: "saas",
444
+ name: "Nextjs SaaS boilerplate",
445
+ category: { name: "Agent App Widget" },
446
+ description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
447
+ tags: ["UI", "Auth", "Payments", "Analytics"],
448
+ template: true,
449
+ manifest: {
450
+ name: "Nextjs SaaS boilerplate",
451
+ product: "livechat",
452
+ blocks: {
453
+ repository: {
454
+ provider: "github",
455
+ name: "livechat/developer-app-template-saas",
456
+ branch: "main",
457
+ target: "nextjs"
458
+ },
459
+ deployment: {
460
+ provider: "vercel",
461
+ url: ""
462
+ },
463
+ authorization: {
464
+ type: "javascript_app",
465
+ redirectUri: ""
466
+ },
467
+ widgets: {
468
+ "chat-details": {
469
+ placement: "plugin",
470
+ url: "/livechat/details"
471
+ },
472
+ fullscreen: {
473
+ placement: "fullscreen",
474
+ url: "/livechat/fullscreen"
475
+ }
476
+ },
477
+ monetization: {
478
+ frequency: "monthly",
479
+ charge: "organization",
480
+ price: 500,
481
+ trialDays: 7
482
+ }
483
+ }
484
+ }
485
+ }
486
+ };
487
+ var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
488
+
489
+ // src/constants/auth/headers.ts
490
+ var PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization";
491
+ var ACCOUNT_ID_HEADER = "X-Account-ID";
492
+ var ORGANIZATION_ID_HEADER = "X-Organization-ID";
493
+
494
+ // src/apis/integrations/text/instance.ts
495
+ var import_axios31 = __toESM(require("axios"));
496
+
497
+ // src/types/api/client.ts
498
+ var ApiClient = class {
499
+ constructor(config, authorization) {
500
+ this.config = config;
501
+ this.authorization = authorization;
502
+ }
503
+ updateConfig(config) {
504
+ this.config = __spreadValues(__spreadValues({}, this.config), config);
505
+ }
506
+ updateAuthorization(authorization) {
507
+ this.authorization = __spreadValues(__spreadValues({}, this.authorization), authorization);
508
+ }
509
+ fetch(url, customConfig, customOptions) {
510
+ return __async(this, null, function* () {
511
+ var _a, _b, _c;
512
+ const authorization = (_a = customConfig == null ? void 0 : customConfig.authorization) != null ? _a : this.authorization;
513
+ if ((customConfig == null ? void 0 : customConfig.ensureAuthorization) && !authorization) {
514
+ throw new this.UnauthorizedError();
515
+ }
516
+ const options = __spreadValues(__spreadValues({}, this.options), customOptions);
517
+ const response = yield fetch(`${this.config.baseURL}${url}`, __spreadProps(__spreadValues({}, options), {
518
+ headers: __spreadValues(__spreadValues({}, options.headers), authorization ? {
519
+ Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
520
+ } : void 0)
521
+ }));
522
+ const responseText = yield response.text();
523
+ if (!response.ok) {
524
+ const errorData = responseText ? JSON.parse(responseText) : {};
525
+ const error = new this.Error(
526
+ (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
527
+ errorData,
528
+ response.status
529
+ );
530
+ if (response.status === 401) {
531
+ throw new this.UnauthorizedError();
532
+ }
533
+ throw error;
534
+ }
535
+ const data = responseText ? JSON.parse(responseText) : {};
536
+ return __spreadProps(__spreadValues({}, response), {
537
+ data
538
+ });
539
+ });
540
+ }
541
+ get(url, config, options) {
542
+ return __async(this, null, function* () {
543
+ return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
544
+ method: "GET"
545
+ }));
546
+ });
547
+ }
548
+ post(url, body, customConfig, customOptions) {
549
+ return __async(this, null, function* () {
550
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
551
+ method: "POST",
552
+ body: body instanceof URLSearchParams ? body : JSON.stringify(body)
553
+ }));
554
+ });
555
+ }
556
+ patch(url, body, customConfig, customOptions) {
557
+ return __async(this, null, function* () {
558
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
559
+ method: "PATCH",
560
+ body: body instanceof URLSearchParams ? body : JSON.stringify(body)
561
+ }));
562
+ });
563
+ }
564
+ put(url, body, customConfig, customOptions) {
565
+ return __async(this, null, function* () {
566
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
567
+ method: "PUT",
568
+ body: body instanceof URLSearchParams ? body : JSON.stringify(body)
569
+ }));
570
+ });
571
+ }
572
+ delete(url, body, config, options) {
573
+ return __async(this, null, function* () {
574
+ return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
575
+ method: "DELETE",
576
+ body: body instanceof URLSearchParams ? body : JSON.stringify(body)
577
+ }));
578
+ });
579
+ }
580
+ };
581
+
582
+ // src/types/api/errors.ts
583
+ var ApiErrorBase = class extends Error {
584
+ constructor(message, data, code) {
585
+ super(message);
586
+ this.message = message;
587
+ this.data = data;
588
+ this.code = code;
589
+ this.kind = "error";
590
+ }
591
+ withCustomMessage(message) {
592
+ return new this.constructor(message, this.data, this.code);
593
+ }
594
+ };
595
+ var UnauthorizeApiError = class extends Error {
596
+ constructor(source, message = "Unauthorized API call") {
597
+ super(message);
598
+ this.source = source;
599
+ this.message = message;
600
+ this.kind = "unauthorized";
601
+ this.code = 401;
602
+ }
603
+ withCustomMessage(_message) {
604
+ return this;
605
+ }
606
+ };
607
+
608
+ // src/utils/integrations/getIntegrationFlowUrl.ts
609
+ var import_uuid = require("uuid");
610
+
611
+ // src/apis/integrations/bigcommerce/api.ts
612
+ var import_axios2 = __toESM(require("axios"));
613
+
614
+ // src/apis/integrations/bigcommerce/instance.ts
615
+ var import_axios = __toESM(require("axios"));
616
+ var BigCommerceApiError = class extends ApiErrorBase {
617
+ constructor() {
618
+ super(...arguments);
619
+ this.name = "bigcommerce";
620
+ }
621
+ };
622
+ var bigCommerceClientInstance = import_axios.default.create();
623
+ bigCommerceClientInstance.interceptors.response.use(
624
+ (r) => r,
625
+ (error) => {
626
+ var _a, _b, _c, _d;
627
+ if (import_axios.default.isAxiosError(error)) {
628
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
629
+ throw new UnauthorizeApiError("bigcommerce");
630
+ }
631
+ }
632
+ return Promise.reject(
633
+ new BigCommerceApiError(
634
+ error.message,
635
+ (_b = error.response) == null ? void 0 : _b.data,
636
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
637
+ )
638
+ );
639
+ }
640
+ );
641
+
642
+ // src/apis/integrations/github/api.ts
643
+ var import_axios5 = __toESM(require("axios"));
644
+
645
+ // src/apis/integrations/github/instance.ts
646
+ var import_axios3 = __toESM(require("axios"));
647
+ var githubClientInstance = import_axios3.default.create({
648
+ baseURL: "https://api.github.com",
649
+ headers: {
650
+ Accept: "application/vnd.github+json",
651
+ "Content-Type": "application/json"
652
+ }
653
+ });
654
+ githubClientInstance.interceptors.response.use(
655
+ (r) => r,
656
+ (error) => {
657
+ var _a;
658
+ if (import_axios3.default.isAxiosError(error)) {
659
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
660
+ throw new UnauthorizeApiError("github");
661
+ }
662
+ }
663
+ throw error;
664
+ }
665
+ );
666
+
667
+ // src/apis/integrations/github/repository/api.ts
668
+ var import_axios4 = require("axios");
669
+
670
+ // src/apis/integrations/hubspot/instance.ts
671
+ var import_axios6 = __toESM(require("axios"));
672
+ var HubspotApiError = class extends ApiErrorBase {
673
+ constructor() {
674
+ super(...arguments);
675
+ this.name = "hubspot";
676
+ }
677
+ };
678
+ var hubspotClientInstance = import_axios6.default.create({
679
+ baseURL: "https://api.hubapi.com",
680
+ headers: {
681
+ "Content-Type": "application/json"
682
+ }
683
+ });
684
+ hubspotClientInstance.interceptors.response.use(
685
+ (r) => r,
686
+ (error) => {
687
+ var _a, _b, _c, _d;
688
+ if (import_axios6.default.isAxiosError(error)) {
689
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
690
+ throw new UnauthorizeApiError("hubspot");
691
+ }
692
+ }
693
+ return Promise.reject(
694
+ new HubspotApiError(
695
+ error.message,
696
+ (_b = error.response) == null ? void 0 : _b.data,
697
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
698
+ )
699
+ );
700
+ }
701
+ );
702
+
703
+ // src/apis/integrations/klaviyo/api.ts
704
+ var import_axios7 = __toESM(require("axios"));
705
+
706
+ // src/apis/integrations/mailchimp/api.ts
707
+ var import_axios9 = __toESM(require("axios"));
708
+
709
+ // src/apis/integrations/mailchimp/instance.ts
710
+ var import_axios8 = __toESM(require("axios"));
711
+ var MailchimpApiError = class extends ApiErrorBase {
712
+ constructor() {
713
+ super(...arguments);
714
+ this.name = "mailchimp";
715
+ }
716
+ };
717
+ var mailchimpClientInstance = import_axios8.default.create({
718
+ headers: {
719
+ "Content-Type": "application/json"
720
+ }
721
+ });
722
+ mailchimpClientInstance.interceptors.response.use(
723
+ (r) => r,
724
+ (error) => {
725
+ var _a, _b, _c, _d;
726
+ if (import_axios8.default.isAxiosError(error)) {
727
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
728
+ throw new UnauthorizeApiError("mailchimp");
729
+ }
730
+ }
731
+ return Promise.reject(
732
+ new MailchimpApiError(
733
+ error.message,
734
+ (_b = error.response) == null ? void 0 : _b.data,
735
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
736
+ )
737
+ );
738
+ }
739
+ );
740
+
741
+ // src/apis/integrations/neon/api.ts
742
+ var import_axios11 = __toESM(require("axios"));
743
+
744
+ // src/apis/integrations/neon/instance.ts
745
+ var import_axios10 = __toESM(require("axios"));
746
+ var neonClientInstance = import_axios10.default.create({
747
+ baseURL: "https://console.neon.tech/api/v2",
748
+ headers: {
749
+ "Content-Type": "application/json"
750
+ }
751
+ });
752
+ neonClientInstance.interceptors.response.use(
753
+ (r) => r,
754
+ (error) => {
755
+ var _a;
756
+ if (import_axios10.default.isAxiosError(error)) {
757
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
758
+ throw new UnauthorizeApiError("neon");
759
+ }
760
+ }
761
+ throw error;
762
+ }
763
+ );
764
+
765
+ // src/apis/integrations/netlify/api.ts
766
+ var import_axios14 = __toESM(require("axios"));
767
+
768
+ // src/apis/integrations/netlify/account/api.ts
769
+ var import_axios13 = require("axios");
770
+
771
+ // src/apis/integrations/netlify/instance.ts
772
+ var import_axios12 = __toESM(require("axios"));
773
+ var netlifyClientInstance = import_axios12.default.create({
774
+ baseURL: "https://api.netlify.com/api/v1",
775
+ headers: {
776
+ "Content-Type": "application/json"
777
+ }
778
+ });
779
+ netlifyClientInstance.interceptors.response.use(
780
+ (r) => r,
781
+ (error) => {
782
+ var _a;
783
+ if (import_axios12.default.isAxiosError(error)) {
784
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
785
+ throw new UnauthorizeApiError("netlify");
786
+ }
787
+ }
788
+ throw error;
789
+ }
790
+ );
791
+
792
+ // src/apis/integrations/openai/api.ts
793
+ var import_axios15 = __toESM(require("axios"));
794
+
795
+ // src/apis/integrations/planetscale/api.ts
796
+ var import_axios17 = __toESM(require("axios"));
797
+
798
+ // src/apis/integrations/planetscale/instance.ts
799
+ var import_axios16 = __toESM(require("axios"));
800
+ var planetScaleClientInstance = import_axios16.default.create({
801
+ baseURL: "https://api.planetscale.com",
802
+ headers: {
803
+ "Content-Type": "application/json"
804
+ }
805
+ });
806
+ planetScaleClientInstance.interceptors.response.use(
807
+ (r) => r,
808
+ (error) => {
809
+ var _a;
810
+ if (import_axios16.default.isAxiosError(error)) {
811
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
812
+ throw new UnauthorizeApiError("planetscale");
813
+ }
814
+ }
815
+ throw error;
816
+ }
817
+ );
818
+
819
+ // src/apis/integrations/salesforce/api.ts
820
+ var import_axios18 = __toESM(require("axios"));
821
+
822
+ // src/apis/integrations/shopify/api.ts
823
+ var import_axios20 = __toESM(require("axios"));
824
+
825
+ // src/apis/integrations/shopify/instance.ts
826
+ var import_axios19 = __toESM(require("axios"));
827
+ var ShopifyApiError = class extends ApiErrorBase {
828
+ constructor() {
829
+ super(...arguments);
830
+ this.name = "shopify";
831
+ }
832
+ };
833
+ var shopifyClientInstance = import_axios19.default.create();
834
+ shopifyClientInstance.interceptors.response.use(
835
+ (r) => r,
836
+ (error) => {
837
+ var _a, _b, _c, _d;
838
+ if (import_axios19.default.isAxiosError(error)) {
839
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
840
+ throw new UnauthorizeApiError("shopify");
841
+ }
842
+ }
843
+ return Promise.reject(
844
+ new ShopifyApiError(
845
+ error.message,
846
+ (_b = error.response) == null ? void 0 : _b.data,
847
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
848
+ )
849
+ );
850
+ }
851
+ );
852
+
853
+ // src/apis/integrations/slack/instance.ts
854
+ var import_axios21 = __toESM(require("axios"));
855
+ var SlackApiError = class extends ApiErrorBase {
856
+ constructor() {
857
+ super(...arguments);
858
+ this.name = "slack";
859
+ }
860
+ };
861
+ var slackClientInstance = import_axios21.default.create({
862
+ baseURL: "https://slack.com/api",
863
+ headers: {
864
+ "Content-Type": "application/json"
865
+ }
866
+ });
867
+ slackClientInstance.interceptors.response.use(
868
+ (r) => {
869
+ if (!r.data.ok) {
870
+ throw new SlackApiError(
871
+ `Slack API Error ${r.data.error}`,
872
+ r.data,
873
+ r.status
874
+ );
875
+ }
876
+ return r;
877
+ },
878
+ (error) => {
879
+ var _a, _b, _c, _d;
880
+ if (import_axios21.default.isAxiosError(error)) {
881
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
882
+ throw new UnauthorizeApiError("slack");
883
+ }
884
+ }
885
+ return Promise.reject(
886
+ new SlackApiError(
887
+ error.message,
888
+ (_b = error.response) == null ? void 0 : _b.data,
889
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
890
+ )
891
+ );
892
+ }
893
+ );
894
+
895
+ // src/utils/misc/url/build.ts
896
+ var buildUrlFromSegments = (segments, basePath, baseUrl = "") => segments.length ? `${baseUrl}${basePath}/${segments.map(encodeURIComponent).join("/")}` : basePath;
897
+
898
+ // src/apis/integrations/vercel/instance.ts
899
+ var import_axios22 = __toESM(require("axios"));
900
+ var vercelClientInstance = import_axios22.default.create({
901
+ baseURL: "https://api.vercel.com"
902
+ });
903
+ vercelClientInstance.interceptors.response.use(
904
+ (r) => r,
905
+ (error) => {
906
+ var _a, _b;
907
+ if (import_axios22.default.isAxiosError(error)) {
908
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
909
+ throw new UnauthorizeApiError("vercel");
910
+ }
911
+ }
912
+ throw error;
913
+ }
914
+ );
915
+
916
+ // src/apis/platform/accounts/instance.ts
917
+ var AccountsApiError = class extends ApiErrorBase {
918
+ constructor() {
919
+ super(...arguments);
920
+ this.name = "accounts";
921
+ }
922
+ };
923
+ var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
924
+ constructor(message) {
925
+ super("accounts", message);
926
+ }
927
+ };
928
+ var AccountApiClient = class extends ApiClient {
929
+ constructor() {
930
+ super(...arguments);
931
+ this.UnauthorizedError = UnauthorizeAccountsApiError;
932
+ this.Error = AccountsApiError;
933
+ this.options = {
934
+ headers: {
935
+ "Content-Type": "application/json"
936
+ }
937
+ };
938
+ }
939
+ };
940
+ var platformAccountsClientInstance = new AccountApiClient({
941
+ baseURL: "https://accounts.labs.livechatinc.com"
942
+ });
943
+
944
+ // src/apis/platform/billing/instance.ts
945
+ var import_axios23 = __toESM(require("axios"));
946
+ var billingClientInstance = import_axios23.default.create({
947
+ baseURL: "https://billing.labs.livechatinc.com"
948
+ });
949
+
950
+ // src/apis/platform/cdp/events/_contracts/payloads/events.ts
951
+ var import_zod = require("zod");
952
+ var customerMetadataZod = import_zod.z.object({
953
+ organization_id: import_zod.z.string(),
954
+ customer_id: import_zod.z.string(),
955
+ master_id: import_zod.z.string()
956
+ });
957
+ var cdpCustomerEventMessageZod = import_zod.z.discriminatedUnion("type", [
958
+ import_zod.z.object({
959
+ id: import_zod.z.string(),
960
+ type: import_zod.z.literal("customer_email_set" /* EmailSet */),
961
+ data: customerMetadataZod.extend({
962
+ email: import_zod.z.string()
963
+ }).passthrough()
964
+ }),
965
+ import_zod.z.object({
966
+ id: import_zod.z.string(),
967
+ type: import_zod.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
968
+ data: customerMetadataZod.extend({
969
+ customer_properties: import_zod.z.record(
970
+ import_zod.z.object({
971
+ value: import_zod.z.unknown(),
972
+ last_updated_at: import_zod.z.string(),
973
+ last_updated_agent_account_id: import_zod.z.string().optional(),
974
+ last_updated_agent_client_id: import_zod.z.string().optional()
975
+ }).passthrough()
976
+ )
977
+ }).passthrough()
978
+ })
979
+ ]);
980
+
981
+ // src/apis/platform/console/instance.ts
982
+ var import_axios24 = __toESM(require("axios"));
983
+ var REGION = {
984
+ FRA: "fra",
985
+ DAL: "dal",
986
+ FRA_A: "fra-a",
987
+ FRA_B: "fra-b"
988
+ };
989
+ var supportedRegions = Object.values(REGION);
990
+ var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
991
+ constructor() {
992
+ super(...arguments);
993
+ this.name = "console";
994
+ }
995
+ static notFound(message) {
996
+ return new _ConsoleApiError(
997
+ message != null ? message : "Not found",
998
+ {
999
+ errorCode: "not_found",
1000
+ errorMessage: "Not found"
1001
+ },
1002
+ 404
1003
+ );
1004
+ }
1005
+ };
1006
+ var consoleClientInstance = import_axios24.default.create({
1007
+ baseURL: "https://platform.labs.text.com/console/api",
1008
+ headers: {
1009
+ "Content-Type": "application/json"
1010
+ }
1011
+ });
1012
+ consoleClientInstance.interceptors.response.use(
1013
+ (response) => response,
1014
+ (error) => {
1015
+ var _a, _b;
1016
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
1017
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
1018
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
1019
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
1020
+ const data = (_b = error.response) == null ? void 0 : _b.data;
1021
+ return Promise.reject(
1022
+ new ConsoleApiError(data.message, data.data, data.code)
1023
+ );
1024
+ }
1025
+ return Promise.reject(error);
1026
+ }
1027
+ );
1028
+
1029
+ // src/apis/platform/dps/instance.ts
1030
+ var import_axios25 = __toESM(require("axios"));
1031
+ var DpsApiError = class extends ApiErrorBase {
1032
+ constructor() {
1033
+ super(...arguments);
1034
+ this.name = "dps";
1035
+ }
1036
+ };
1037
+ var dpsClientInstance = import_axios25.default.create({
1038
+ baseURL: "https://dev-platform.labs.livechatinc.com"
1039
+ });
1040
+ dpsClientInstance.interceptors.response.use(
1041
+ (response) => response,
1042
+ (error) => {
1043
+ var _a, _b, _c, _d;
1044
+ if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
1045
+ return Promise.reject(new UnauthorizeApiError("accounts"));
1046
+ }
1047
+ return Promise.reject(
1048
+ new DpsApiError(
1049
+ error.message,
1050
+ (_b = error.response) == null ? void 0 : _b.data,
1051
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1052
+ )
1053
+ );
1054
+ }
1055
+ );
1056
+
1057
+ // src/apis/products/helpdesk/_contracts/dtos/ticket.ts
1058
+ var TicketStatus = /* @__PURE__ */ ((TicketStatus2) => {
1059
+ TicketStatus2["Open"] = "open";
1060
+ TicketStatus2["Pending"] = "pending";
1061
+ TicketStatus2["OnHold"] = "onhold";
1062
+ TicketStatus2["Solved"] = "solved";
1063
+ TicketStatus2["Closed"] = "closed";
1064
+ return TicketStatus2;
1065
+ })(TicketStatus || {});
1066
+ var TicketPriority = /* @__PURE__ */ ((TicketPriority2) => {
1067
+ TicketPriority2[TicketPriority2["Low"] = -10] = "Low";
1068
+ TicketPriority2[TicketPriority2["Medium"] = 0] = "Medium";
1069
+ TicketPriority2[TicketPriority2["High"] = 10] = "High";
1070
+ TicketPriority2[TicketPriority2["Urgent"] = 20] = "Urgent";
1071
+ return TicketPriority2;
1072
+ })(TicketPriority || {});
1073
+
1074
+ // src/apis/products/helpdesk/instance.ts
1075
+ var import_axios26 = __toESM(require("axios"));
1076
+ var HelpDeskApiError = class extends ApiErrorBase {
1077
+ constructor() {
1078
+ super(...arguments);
1079
+ this.name = "helpdesk";
1080
+ }
1081
+ };
1082
+ var helpdeskClientInstance = import_axios26.default.create({
1083
+ baseURL: "https://api.labs.helpdesk.com"
1084
+ });
1085
+ helpdeskClientInstance.interceptors.response.use(
1086
+ (response) => response,
1087
+ (error) => {
1088
+ var _a, _b, _c, _d;
1089
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1090
+ return Promise.reject(new UnauthorizeApiError("accounts"));
1091
+ }
1092
+ return Promise.reject(
1093
+ new HelpDeskApiError(
1094
+ error.message,
1095
+ (_b = error.response) == null ? void 0 : _b.data,
1096
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1097
+ )
1098
+ );
1099
+ }
1100
+ );
1101
+
1102
+ // src/apis/products/livechat/instance.ts
1103
+ var import_axios27 = __toESM(require("axios"));
1104
+ var REGION2 = {
1105
+ FRA: "fra",
1106
+ DAL: "dal",
1107
+ FRA_A: "fra-a",
1108
+ FRA_B: "fra-b"
1109
+ };
1110
+ var supportedRegions2 = Object.values(REGION2);
1111
+ var LivechatApiError = class extends ApiErrorBase {
1112
+ constructor() {
1113
+ super(...arguments);
1114
+ this.name = "livechat";
1115
+ }
1116
+ };
1117
+ var livechatClientInstance = import_axios27.default.create({
1118
+ baseURL: "https://api.labs.livechatinc.com"
1119
+ });
1120
+ livechatClientInstance.interceptors.response.use(
1121
+ (response) => response,
1122
+ (error) => {
1123
+ var _a, _b, _c, _d;
1124
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1125
+ return Promise.reject(new UnauthorizeApiError("accounts"));
1126
+ }
1127
+ return Promise.reject(
1128
+ new LivechatApiError(
1129
+ error.message,
1130
+ (_b = error.response) == null ? void 0 : _b.data,
1131
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1132
+ )
1133
+ );
1134
+ }
1135
+ );
1136
+
1137
+ // src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/dtos/notification.ts
1138
+ var import_zod2 = require("zod");
1139
+ var integrationNotificationZods = {
1140
+ notification: import_zod2.z.object({
1141
+ id: import_zod2.z.string(),
1142
+ jobId: import_zod2.z.string().nullable(),
1143
+ subscription_id: import_zod2.z.string(),
1144
+ organization_id: import_zod2.z.string(),
1145
+ user_id: import_zod2.z.string().nullable(),
1146
+ source: import_zod2.z.string().nullable(),
1147
+ sourceKey: import_zod2.z.string().nullable(),
1148
+ target: import_zod2.z.string(),
1149
+ targetKey: import_zod2.z.string(),
1150
+ eventName: import_zod2.z.string(),
1151
+ callback: import_zod2.z.string(),
1152
+ status: import_zod2.z.string(),
1153
+ statusCode: import_zod2.z.number().nullable(),
1154
+ attempts: import_zod2.z.number(),
1155
+ error: import_zod2.z.string().nullable(),
1156
+ enqueuedAt: import_zod2.z.string(),
1157
+ completedAt: import_zod2.z.string()
1158
+ })
1159
+ };
1160
+
1161
+ // src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/requests/notifications.ts
1162
+ var import_zod3 = require("zod");
1163
+ var integrationNotificationRequestZods = {
1164
+ getNotifications: import_zod3.z.object({
1165
+ target: import_zod3.z.string().optional(),
1166
+ status: import_zod3.z.string().optional(),
1167
+ eventName: import_zod3.z.string().optional(),
1168
+ search: import_zod3.z.string().optional(),
1169
+ page: import_zod3.z.number().optional(),
1170
+ size: import_zod3.z.number().optional(),
1171
+ order_by: import_zod3.z.enum([
1172
+ "id",
1173
+ "status",
1174
+ "target",
1175
+ "eventName",
1176
+ "completedAt",
1177
+ "organization_id",
1178
+ "user_id"
1179
+ ]).optional(),
1180
+ order: import_zod3.z.enum(["asc", "desc"]).optional()
1181
+ })
1182
+ };
1183
+
1184
+ // src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/dtos/subscription.ts
1185
+ var import_zod4 = require("zod");
1186
+ var integrationSubscriptionZods = {
1187
+ subscription: import_zod4.z.object({
1188
+ id: import_zod4.z.string(),
1189
+ organization_id: import_zod4.z.string(),
1190
+ user_id: import_zod4.z.string(),
1191
+ callback: import_zod4.z.string(),
1192
+ source: import_zod4.z.string(),
1193
+ sourceKey: import_zod4.z.string(),
1194
+ target: import_zod4.z.string(),
1195
+ targets: import_zod4.z.array(
1196
+ import_zod4.z.object({
1197
+ id: import_zod4.z.string(),
1198
+ target: import_zod4.z.string(),
1199
+ targetKey: import_zod4.z.string()
1200
+ })
1201
+ ).optional(),
1202
+ event: import_zod4.z.unknown(),
1203
+ orphaned_at: import_zod4.z.string().datetime().nullable(),
1204
+ orphaned_reason: import_zod4.z.string().nullable(),
1205
+ orphaned_last_hit: import_zod4.z.string().datetime().nullable(),
1206
+ orphaned_hit_count: import_zod4.z.number()
1207
+ }),
1208
+ stats: import_zod4.z.object({
1209
+ totalSubscriptions: import_zod4.z.number(),
1210
+ uniqueOrganizations: import_zod4.z.number(),
1211
+ uniqueUsers: import_zod4.z.number(),
1212
+ byTarget: import_zod4.z.array(import_zod4.z.object({ target: import_zod4.z.string(), count: import_zod4.z.number() })),
1213
+ bySource: import_zod4.z.array(import_zod4.z.object({ source: import_zod4.z.string(), count: import_zod4.z.number() })),
1214
+ topOrganizations: import_zod4.z.array(
1215
+ import_zod4.z.object({ organizationId: import_zod4.z.string(), count: import_zod4.z.number() })
1216
+ ),
1217
+ topCallbackDomains: import_zod4.z.array(
1218
+ import_zod4.z.object({ domain: import_zod4.z.string(), count: import_zod4.z.number() })
1219
+ )
1220
+ })
1221
+ };
1222
+
1223
+ // src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/requests/subscriptions.ts
1224
+ var import_zod5 = require("zod");
1225
+ var integrationSubscriptionRequestZods = {
1226
+ getSubscriptions: import_zod5.z.object({
1227
+ target: import_zod5.z.string().optional(),
1228
+ source: import_zod5.z.string().optional(),
1229
+ search: import_zod5.z.string().optional(),
1230
+ orphaned: import_zod5.z.boolean().optional(),
1231
+ page: import_zod5.z.number().optional(),
1232
+ size: import_zod5.z.number().optional(),
1233
+ order_by: import_zod5.z.enum([
1234
+ "id",
1235
+ "source",
1236
+ "target",
1237
+ "organization_id",
1238
+ "user_id",
1239
+ "orphaned_at"
1240
+ ]).optional(),
1241
+ order: import_zod5.z.enum(["asc", "desc"]).optional()
1242
+ })
1243
+ };
1244
+
1245
+ // src/apis/text-intelligence/workflows/adapter/instance.ts
1246
+ var import_axios28 = __toESM(require("axios"));
1247
+ var REGION3 = {
1248
+ FRA: "fra",
1249
+ DAL: "dal",
1250
+ FRA_A: "fra-a",
1251
+ FRA_B: "fra-b"
1252
+ };
1253
+ var supportedRegions3 = Object.values(REGION3);
1254
+ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
1255
+ constructor() {
1256
+ super(...arguments);
1257
+ this.name = "adapter";
1258
+ }
1259
+ static notFound(message) {
1260
+ return new _AdapterApiError(
1261
+ message != null ? message : "Not found",
1262
+ {
1263
+ errorCode: "not_found",
1264
+ errorMessage: "Not found"
1265
+ },
1266
+ 404
1267
+ );
1268
+ }
1269
+ };
1270
+ var adapterClientInstance = import_axios28.default.create({
1271
+ baseURL: "https://platform.labs.text.com/console-adapter/api",
1272
+ headers: {
1273
+ "Content-Type": "application/json"
1274
+ }
1275
+ });
1276
+ adapterClientInstance.interceptors.response.use(
1277
+ (response) => response,
1278
+ (error) => {
1279
+ var _a, _b;
1280
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
1281
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
1282
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
1283
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
1284
+ const data = (_b = error.response) == null ? void 0 : _b.data;
1285
+ return Promise.reject(
1286
+ new AdapterApiError(data.message, data.data, data.code)
1287
+ );
1288
+ }
1289
+ return Promise.reject(error);
1290
+ }
1291
+ );
1292
+
1293
+ // src/apis/text-intelligence/workflows/adapter/integrations/_contracts/dtos/names.ts
1294
+ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
1295
+ IntegrationNames2["Accounts"] = "accounts";
1296
+ IntegrationNames2["GitHub"] = "github";
1297
+ IntegrationNames2["Netlify"] = "netlify";
1298
+ IntegrationNames2["Vercel"] = "vercel";
1299
+ IntegrationNames2["PlanetScale"] = "planetscale";
1300
+ IntegrationNames2["Neon"] = "neon";
1301
+ IntegrationNames2["Mailchimp"] = "mailchimp";
1302
+ IntegrationNames2["Shopify"] = "shopify";
1303
+ IntegrationNames2["HubSpot"] = "hubspot";
1304
+ IntegrationNames2["BigCommerce"] = "bigcommerce";
1305
+ IntegrationNames2["OpenAI"] = "openai";
1306
+ IntegrationNames2["Text"] = "text";
1307
+ IntegrationNames2["LiveChat"] = "text-livechat";
1308
+ IntegrationNames2["HelpDesk"] = "text-helpdesk";
1309
+ IntegrationNames2["Slack"] = "slack";
1310
+ IntegrationNames2["Salesforce"] = "salesforce";
1311
+ IntegrationNames2["Klaviyo"] = "klaviyo";
1312
+ return IntegrationNames2;
1313
+ })(IntegrationNames || {});
1314
+ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
1315
+ IntegrationDisplayNames2["Accounts"] = "Accounts";
1316
+ IntegrationDisplayNames2["GitHub"] = "Github";
1317
+ IntegrationDisplayNames2["Netlify"] = "Netlify";
1318
+ IntegrationDisplayNames2["Vercel"] = "Vercel";
1319
+ IntegrationDisplayNames2["PlanetScale"] = "Planetscale";
1320
+ IntegrationDisplayNames2["Neon"] = "Neon";
1321
+ IntegrationDisplayNames2["Mailchimp"] = "Mailchimp";
1322
+ IntegrationDisplayNames2["Shopify"] = "Shopify";
1323
+ IntegrationDisplayNames2["HubSpot"] = "Hubspot";
1324
+ IntegrationDisplayNames2["BigCommerce"] = "BigCommerce";
1325
+ IntegrationDisplayNames2["OpenAI"] = "OpenAI";
1326
+ IntegrationDisplayNames2["Text"] = "Text";
1327
+ IntegrationDisplayNames2["LiveChat"] = "LiveChat";
1328
+ IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
1329
+ IntegrationDisplayNames2["Slack"] = "Slack";
1330
+ IntegrationDisplayNames2["Salesforce"] = "Salesforce";
1331
+ IntegrationDisplayNames2["Klaviyo"] = "Klaviyo";
1332
+ return IntegrationDisplayNames2;
1333
+ })(IntegrationDisplayNames || {});
1334
+ var IntegrationDisplayNameToNameMap = Object.keys(IntegrationNames).reduce(
1335
+ (acc, key) => {
1336
+ acc[IntegrationDisplayNames[key]] = IntegrationNames[key];
1337
+ return acc;
1338
+ },
1339
+ {}
1340
+ );
1341
+ var IntegrationNameToDisplayMap = Object.keys(IntegrationNames).reduce(
1342
+ (acc, key) => {
1343
+ acc[IntegrationNames[key]] = IntegrationDisplayNames[key];
1344
+ return acc;
1345
+ },
1346
+ {}
1347
+ );
1348
+
1349
+ // src/apis/text-intelligence/workflows/adapter/integrations/_contracts/requests/events.ts
1350
+ var import_zod16 = require("zod");
1351
+
1352
+ // src/apis/text-intelligence/workflows/adapter/integrations/bigcommerce/_contracts/requests/events.ts
1353
+ var import_zod7 = require("zod");
1354
+
1355
+ // src/apis/text-intelligence/workflows/adapter/integrations/common/events/_contracts/requests/events.ts
1356
+ var import_zod6 = require("zod");
1357
+ var integrationEventBase = import_zod6.z.object({
1358
+ version: import_zod6.z.string().optional()
1359
+ });
1360
+ var integrationEventsCoreZods = {
1361
+ sourceName: import_zod6.z.enum(["apps", "workflows"]),
1362
+ get source() {
1363
+ return import_zod6.z.object({
1364
+ sourceName: this.sourceName,
1365
+ sourceKey: import_zod6.z.string()
1366
+ });
1367
+ },
1368
+ get authorization() {
1369
+ return import_zod6.z.object({
1370
+ headers: import_zod6.z.record(import_zod6.z.string()).optional(),
1371
+ query_params: import_zod6.z.record(import_zod6.z.string()).optional(),
1372
+ data: import_zod6.z.record(import_zod6.z.string()).optional()
1373
+ });
1374
+ },
1375
+ withCore(schema) {
1376
+ return this.source.and(schema).and(
1377
+ import_zod6.z.object({
1378
+ authorization: this.authorization.optional()
1379
+ })
1380
+ );
1381
+ }
1382
+ };
1383
+
1384
+ // src/apis/text-intelligence/workflows/adapter/integrations/bigcommerce/_contracts/requests/events.ts
1385
+ var BigCommerceEventNames = /* @__PURE__ */ ((BigCommerceEventNames2) => {
1386
+ BigCommerceEventNames2["CartCreated"] = "cart_created";
1387
+ BigCommerceEventNames2["CartUpdated"] = "cart_updated";
1388
+ BigCommerceEventNames2["OrderCreated"] = "order_created";
1389
+ BigCommerceEventNames2["OrderUpdated"] = "order_updated";
1390
+ BigCommerceEventNames2["ProductCreated"] = "product_created";
1391
+ BigCommerceEventNames2["ProductUpdated"] = "product_updated";
1392
+ return BigCommerceEventNames2;
1393
+ })(BigCommerceEventNames || {});
1394
+ var bigcommerceEventsZods = {
1395
+ provider: import_zod7.z.literal("bigcommerce" /* BigCommerce */),
1396
+ eventName: import_zod7.z.nativeEnum(BigCommerceEventNames),
1397
+ events: {
1398
+ cartCreated: integrationEventBase.extend({
1399
+ name: import_zod7.z.literal("cart_created" /* CartCreated */)
1400
+ }),
1401
+ cartUpdated: integrationEventBase.extend({
1402
+ name: import_zod7.z.literal("cart_updated" /* CartUpdated */)
1403
+ }),
1404
+ orderCreated: integrationEventBase.extend({
1405
+ name: import_zod7.z.literal("order_created" /* OrderCreated */)
1406
+ }),
1407
+ orderUpdated: integrationEventBase.extend({
1408
+ name: import_zod7.z.literal("order_updated" /* OrderUpdated */)
1409
+ }),
1410
+ productCreated: integrationEventBase.extend({
1411
+ name: import_zod7.z.literal("product_created" /* ProductCreated */)
1412
+ }),
1413
+ productUpdated: integrationEventBase.extend({
1414
+ name: import_zod7.z.literal("product_updated" /* ProductUpdated */)
1415
+ })
1416
+ },
1417
+ get event() {
1418
+ return import_zod7.z.discriminatedUnion("name", [
1419
+ this.events.cartCreated,
1420
+ this.events.cartUpdated,
1421
+ this.events.orderCreated,
1422
+ this.events.orderUpdated,
1423
+ this.events.productCreated,
1424
+ this.events.productUpdated
1425
+ ]);
1426
+ },
1427
+ get subscribe() {
1428
+ return integrationEventsCoreZods.withCore(
1429
+ import_zod7.z.object({
1430
+ event: this.event,
1431
+ callback: import_zod7.z.string()
1432
+ })
1433
+ );
1434
+ },
1435
+ get subscribeContent() {
1436
+ return import_zod7.z.object({
1437
+ provider: this.provider,
1438
+ event: this.event,
1439
+ callback: import_zod7.z.string()
1440
+ });
1441
+ },
1442
+ get unsubscribe() {
1443
+ return integrationEventsCoreZods.withCore(
1444
+ import_zod7.z.object({
1445
+ event: this.event
1446
+ })
1447
+ );
1448
+ },
1449
+ get unsubscribeContent() {
1450
+ return import_zod7.z.object({
1451
+ provider: this.provider,
1452
+ event: this.event
1453
+ });
1454
+ }
1455
+ };
1456
+
1457
+ // src/apis/text-intelligence/workflows/adapter/integrations/hubspot/_contracts/requests/events.ts
1458
+ var import_zod8 = require("zod");
1459
+ var HubspotEventNames = /* @__PURE__ */ ((HubspotEventNames2) => {
1460
+ HubspotEventNames2["ContactCreated"] = "contact_created";
1461
+ HubspotEventNames2["ContactDeleted"] = "contact_deleted";
1462
+ return HubspotEventNames2;
1463
+ })(HubspotEventNames || {});
1464
+ var hubspotEventsZods = {
1465
+ provider: import_zod8.z.literal("hubspot" /* HubSpot */),
1466
+ eventName: import_zod8.z.nativeEnum(HubspotEventNames),
1467
+ events: {
1468
+ contactCreated: integrationEventBase.extend({
1469
+ name: import_zod8.z.literal("contact_created" /* ContactCreated */)
1470
+ }),
1471
+ contactDeleted: integrationEventBase.extend({
1472
+ name: import_zod8.z.literal("contact_deleted" /* ContactDeleted */)
1473
+ })
1474
+ },
1475
+ get event() {
1476
+ return import_zod8.z.discriminatedUnion("name", [
1477
+ this.events.contactCreated,
1478
+ this.events.contactDeleted
1479
+ ]);
1480
+ },
1481
+ get subscribe() {
1482
+ return integrationEventsCoreZods.withCore(
1483
+ import_zod8.z.object({
1484
+ event: this.event,
1485
+ callback: import_zod8.z.string()
1486
+ })
1487
+ );
1488
+ },
1489
+ get subscribeContent() {
1490
+ return import_zod8.z.object({
1491
+ provider: this.provider,
1492
+ event: this.event,
1493
+ callback: import_zod8.z.string()
1494
+ });
1495
+ },
1496
+ get unsubscribe() {
1497
+ return integrationEventsCoreZods.withCore(
1498
+ import_zod8.z.object({
1499
+ event: this.event
1500
+ })
1501
+ );
1502
+ },
1503
+ get unsubscribeContent() {
1504
+ return import_zod8.z.object({
1505
+ provider: this.provider,
1506
+ event: this.event
1507
+ });
1508
+ }
1509
+ };
1510
+
1511
+ // src/apis/text-intelligence/workflows/adapter/integrations/mailchimp/_contracts/requests/events.ts
1512
+ var import_zod9 = require("zod");
1513
+ var MailchimpEventNames = /* @__PURE__ */ ((MailchimpEventNames2) => {
1514
+ MailchimpEventNames2["Subscribed"] = "subscribed";
1515
+ MailchimpEventNames2["Unsubscribed"] = "unsubscribed";
1516
+ return MailchimpEventNames2;
1517
+ })(MailchimpEventNames || {});
1518
+ var mailchimpEventsZods = {
1519
+ provider: import_zod9.z.literal("mailchimp" /* Mailchimp */),
1520
+ eventName: import_zod9.z.nativeEnum(MailchimpEventNames),
1521
+ events: {
1522
+ subscribed: integrationEventBase.extend({
1523
+ listId: import_zod9.z.string(),
1524
+ name: import_zod9.z.literal("subscribed" /* Subscribed */)
1525
+ }),
1526
+ unsubscribed: integrationEventBase.extend({
1527
+ listId: import_zod9.z.string(),
1528
+ name: import_zod9.z.literal("unsubscribed" /* Unsubscribed */)
1529
+ })
1530
+ },
1531
+ get event() {
1532
+ return import_zod9.z.discriminatedUnion("name", [
1533
+ this.events.subscribed,
1534
+ this.events.unsubscribed
1535
+ ]);
1536
+ },
1537
+ get subscribe() {
1538
+ return integrationEventsCoreZods.withCore(
1539
+ import_zod9.z.object({
1540
+ event: this.event,
1541
+ callback: import_zod9.z.string()
1542
+ })
1543
+ );
1544
+ },
1545
+ get subscribeContent() {
1546
+ return import_zod9.z.object({
1547
+ provider: this.provider,
1548
+ event: this.event,
1549
+ callback: import_zod9.z.string()
1550
+ });
1551
+ },
1552
+ get unsubscribe() {
1553
+ return integrationEventsCoreZods.withCore(
1554
+ import_zod9.z.object({
1555
+ event: import_zod9.z.object({
1556
+ listId: import_zod9.z.string(),
1557
+ name: this.eventName
1558
+ })
1559
+ })
1560
+ );
1561
+ },
1562
+ get unsubscribeContent() {
1563
+ return import_zod9.z.object({
1564
+ provider: this.provider,
1565
+ event: this.event
1566
+ });
1567
+ }
1568
+ };
1569
+
1570
+ // src/apis/text-intelligence/workflows/adapter/integrations/shopify/_contracts/requests/events.ts
1571
+ var import_zod10 = require("zod");
1572
+ var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
1573
+ ShopifyEventNames2["OrderCreated"] = "order_created";
1574
+ return ShopifyEventNames2;
1575
+ })(ShopifyEventNames || {});
1576
+ var shopifyEventsZods = {
1577
+ provider: import_zod10.z.literal("shopify" /* Shopify */),
1578
+ eventName: import_zod10.z.nativeEnum(ShopifyEventNames),
1579
+ events: {
1580
+ orderCreated: integrationEventBase.extend({
1581
+ name: import_zod10.z.literal("order_created" /* OrderCreated */)
1582
+ })
1583
+ },
1584
+ get event() {
1585
+ return import_zod10.z.discriminatedUnion("name", [this.events.orderCreated]);
1586
+ },
1587
+ get subscribe() {
1588
+ return integrationEventsCoreZods.withCore(
1589
+ import_zod10.z.object({
1590
+ event: this.event,
1591
+ callback: import_zod10.z.string()
1592
+ })
1593
+ );
1594
+ },
1595
+ get subscribeContent() {
1596
+ return import_zod10.z.object({
1597
+ provider: this.provider,
1598
+ event: this.event,
1599
+ callback: import_zod10.z.string()
1600
+ });
1601
+ },
1602
+ get unsubscribe() {
1603
+ return integrationEventsCoreZods.withCore(
1604
+ import_zod10.z.object({
1605
+ event: import_zod10.z.object({
1606
+ name: this.eventName
1607
+ })
1608
+ })
1609
+ );
1610
+ },
1611
+ get unsubscribeContent() {
1612
+ return import_zod10.z.object({
1613
+ provider: this.provider,
1614
+ event: this.event
1615
+ });
1616
+ }
1617
+ };
1618
+
1619
+ // src/apis/text-intelligence/workflows/adapter/integrations/slack/_contracts/requests/events.ts
1620
+ var import_zod11 = require("zod");
1621
+ var SlackEventNames = /* @__PURE__ */ ((SlackEventNames2) => {
1622
+ SlackEventNames2["ChannelNewMessagePosted"] = "channel_new_message_posted";
1623
+ SlackEventNames2["MemberNewMention"] = "member_new_mention";
1624
+ SlackEventNames2["ReactionAdded"] = "reaction_added";
1625
+ return SlackEventNames2;
1626
+ })(SlackEventNames || {});
1627
+ var slackEventsZods = {
1628
+ provider: import_zod11.z.literal("slack" /* Slack */),
1629
+ eventName: import_zod11.z.nativeEnum(SlackEventNames),
1630
+ events: {
1631
+ channelNewMessagePosted: integrationEventBase.extend({
1632
+ name: import_zod11.z.literal("channel_new_message_posted" /* ChannelNewMessagePosted */),
1633
+ channelId: import_zod11.z.string(),
1634
+ userId: import_zod11.z.string().optional()
1635
+ }),
1636
+ memberNewMention: integrationEventBase.extend({
1637
+ name: import_zod11.z.literal("member_new_mention" /* MemberNewMention */),
1638
+ userId: import_zod11.z.string()
1639
+ }),
1640
+ reactionAdded: integrationEventBase.extend({
1641
+ name: import_zod11.z.literal("reaction_added" /* ReactionAdded */),
1642
+ userId: import_zod11.z.string().optional(),
1643
+ channelId: import_zod11.z.string().optional(),
1644
+ reaction: import_zod11.z.string().optional(),
1645
+ messageAuthorId: import_zod11.z.string().optional()
1646
+ })
1647
+ },
1648
+ get event() {
1649
+ return import_zod11.z.discriminatedUnion("name", [
1650
+ this.events.channelNewMessagePosted,
1651
+ this.events.memberNewMention,
1652
+ this.events.reactionAdded
1653
+ ]);
1654
+ },
1655
+ get subscribe() {
1656
+ return integrationEventsCoreZods.withCore(
1657
+ import_zod11.z.object({
1658
+ event: this.event,
1659
+ callback: import_zod11.z.string()
1660
+ })
1661
+ );
1662
+ },
1663
+ get subscribeContent() {
1664
+ return import_zod11.z.object({
1665
+ provider: this.provider,
1666
+ event: this.event,
1667
+ callback: import_zod11.z.string()
1668
+ });
1669
+ },
1670
+ get unsubscribe() {
1671
+ return integrationEventsCoreZods.withCore(
1672
+ import_zod11.z.object({
1673
+ event: import_zod11.z.object({
1674
+ name: this.eventName
1675
+ })
1676
+ })
1677
+ );
1678
+ },
1679
+ get unsubscribeContent() {
1680
+ return import_zod11.z.object({
1681
+ provider: this.provider,
1682
+ event: this.event
1683
+ });
1684
+ }
1685
+ };
1686
+
1687
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/domains/customer.ts
1688
+ var import_zod12 = require("zod");
1689
+ var TextCustomerEventNames = /* @__PURE__ */ ((TextCustomerEventNames2) => {
1690
+ TextCustomerEventNames2["EmailSet"] = "customer_email_set";
1691
+ TextCustomerEventNames2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
1692
+ return TextCustomerEventNames2;
1693
+ })(TextCustomerEventNames || {});
1694
+ var textCustomerEventsZods = {
1695
+ eventName: import_zod12.z.nativeEnum(TextCustomerEventNames),
1696
+ events: {
1697
+ emailSet: integrationEventBase.extend({
1698
+ name: import_zod12.z.literal("customer_email_set" /* EmailSet */),
1699
+ filters: import_zod12.z.array(import_zod12.z.string().min(1)).min(1).optional()
1700
+ }),
1701
+ propertiesValuesUpdated: integrationEventBase.extend({
1702
+ name: import_zod12.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
1703
+ properties: import_zod12.z.array(
1704
+ import_zod12.z.object({
1705
+ id: import_zod12.z.string().min(1),
1706
+ to: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number(), import_zod12.z.boolean()]).nullish()
1707
+ })
1708
+ ).optional()
1709
+ })
1710
+ },
1711
+ get event() {
1712
+ return import_zod12.z.discriminatedUnion("name", [
1713
+ this.events.emailSet,
1714
+ this.events.propertiesValuesUpdated
1715
+ ]);
1716
+ },
1717
+ get subscribe() {
1718
+ return integrationEventsCoreZods.withCore(
1719
+ import_zod12.z.object({
1720
+ event: this.event,
1721
+ callback: import_zod12.z.string()
1722
+ })
1723
+ );
1724
+ },
1725
+ get unsubscribe() {
1726
+ return integrationEventsCoreZods.withCore(
1727
+ import_zod12.z.object({
1728
+ event: import_zod12.z.object({
1729
+ name: this.eventName
1730
+ })
1731
+ })
1732
+ );
1733
+ }
1734
+ };
1735
+
1736
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/helpdesk.ts
1737
+ var import_zod13 = require("zod");
1738
+ var TextHelpDeskEventNames = /* @__PURE__ */ ((TextHelpDeskEventNames2) => {
1739
+ TextHelpDeskEventNames2["TicketCreated"] = "ticket_created";
1740
+ TextHelpDeskEventNames2["TicketUpdated"] = "ticket_updated";
1741
+ TextHelpDeskEventNames2["TicketStatusChanged"] = "ticket_status_changed";
1742
+ TextHelpDeskEventNames2["TicketPriorityChanged"] = "ticket_priority_changed";
1743
+ TextHelpDeskEventNames2["TicketTagsChanged"] = "ticket_tags_added";
1744
+ TextHelpDeskEventNames2["TicketFollowersChanged"] = "ticket_followers_added";
1745
+ TextHelpDeskEventNames2["TicketAssignmentChanged"] = "ticket_assignment_added";
1746
+ TextHelpDeskEventNames2["TicketCustomFieldsChanged"] = "ticket_custom_fields_changed";
1747
+ TextHelpDeskEventNames2["TicketMessageAdded"] = "ticket_message_added";
1748
+ return TextHelpDeskEventNames2;
1749
+ })(TextHelpDeskEventNames || {});
1750
+ var assignmentZod = import_zod13.z.object({
1751
+ agent: import_zod13.z.string().optional(),
1752
+ team: import_zod13.z.string().optional()
1753
+ });
1754
+ var baseFiltersZod = import_zod13.z.object({
1755
+ assignment: assignmentZod.optional(),
1756
+ mailbox: import_zod13.z.string().optional()
1757
+ });
1758
+ var textHelpDeskEventsZods = {
1759
+ provider: import_zod13.z.literal("text-helpdesk" /* HelpDesk */),
1760
+ eventName: import_zod13.z.nativeEnum(TextHelpDeskEventNames),
1761
+ events: {
1762
+ ticketCreated: integrationEventBase.extend({
1763
+ name: import_zod13.z.literal("ticket_created" /* TicketCreated */)
1764
+ }).extend(baseFiltersZod.shape),
1765
+ ticketUpdated: integrationEventBase.extend({
1766
+ name: import_zod13.z.literal("ticket_updated" /* TicketUpdated */)
1767
+ }).extend(baseFiltersZod.shape),
1768
+ ticketStatusChanged: integrationEventBase.extend({
1769
+ name: import_zod13.z.literal("ticket_status_changed" /* TicketStatusChanged */),
1770
+ status: import_zod13.z.object({
1771
+ from: import_zod13.z.array(import_zod13.z.nativeEnum(TicketStatus)).optional(),
1772
+ to: import_zod13.z.array(import_zod13.z.nativeEnum(TicketStatus)).optional()
1773
+ }).optional()
1774
+ }).extend(baseFiltersZod.shape),
1775
+ ticketPriorityChanged: integrationEventBase.extend({
1776
+ name: import_zod13.z.literal("ticket_priority_changed" /* TicketPriorityChanged */),
1777
+ priority: import_zod13.z.object({
1778
+ from: import_zod13.z.array(import_zod13.z.nativeEnum(TicketPriority)).optional(),
1779
+ to: import_zod13.z.array(import_zod13.z.nativeEnum(TicketPriority)).optional()
1780
+ }).optional()
1781
+ }).extend(baseFiltersZod.shape),
1782
+ ticketTagsChanged: integrationEventBase.extend({
1783
+ name: import_zod13.z.literal("ticket_tags_added" /* TicketTagsChanged */),
1784
+ tags: import_zod13.z.object({
1785
+ from: import_zod13.z.array(import_zod13.z.string()).optional(),
1786
+ to: import_zod13.z.array(import_zod13.z.string()).optional()
1787
+ }).optional()
1788
+ }).extend(baseFiltersZod.shape),
1789
+ ticketFollowersChanged: integrationEventBase.extend({
1790
+ name: import_zod13.z.literal("ticket_followers_added" /* TicketFollowersChanged */),
1791
+ from: import_zod13.z.array(import_zod13.z.string()).optional(),
1792
+ to: import_zod13.z.array(import_zod13.z.string()).optional()
1793
+ }).extend(baseFiltersZod.shape),
1794
+ ticketAssignmentChanged: integrationEventBase.extend({
1795
+ name: import_zod13.z.literal("ticket_assignment_added" /* TicketAssignmentChanged */),
1796
+ from: import_zod13.z.array(assignmentZod).optional(),
1797
+ to: import_zod13.z.array(assignmentZod).optional()
1798
+ }).extend(baseFiltersZod.shape),
1799
+ ticketCustomFieldsChanged: integrationEventBase.extend({
1800
+ name: import_zod13.z.literal("ticket_custom_fields_changed" /* TicketCustomFieldsChanged */),
1801
+ customFields: import_zod13.z.array(
1802
+ import_zod13.z.object({
1803
+ id: import_zod13.z.string().min(1),
1804
+ from: import_zod13.z.string().min(1).nullish(),
1805
+ to: import_zod13.z.string().min(1).nullish()
1806
+ })
1807
+ ).optional()
1808
+ }).extend(baseFiltersZod.shape),
1809
+ ticketMessageAdded: import_zod13.z.discriminatedUnion("version", [
1810
+ import_zod13.z.object({
1811
+ name: import_zod13.z.literal("ticket_message_added" /* TicketMessageAdded */),
1812
+ version: import_zod13.z.undefined()
1813
+ }).extend(baseFiltersZod.shape),
1814
+ import_zod13.z.object({
1815
+ name: import_zod13.z.literal("ticket_message_added" /* TicketMessageAdded */),
1816
+ version: import_zod13.z.literal("v1"),
1817
+ from: import_zod13.z.enum(["anyone", "agent", "requester"]).optional(),
1818
+ privacy: import_zod13.z.enum(["any", "public", "private"]).optional(),
1819
+ filters: import_zod13.z.array(import_zod13.z.string()).optional(),
1820
+ caseInsensitive: import_zod13.z.boolean().optional(),
1821
+ matchWholeWords: import_zod13.z.boolean().optional()
1822
+ }).extend(baseFiltersZod.shape)
1823
+ ])
1824
+ },
1825
+ get event() {
1826
+ return import_zod13.z.union([
1827
+ this.events.ticketCreated,
1828
+ this.events.ticketUpdated,
1829
+ this.events.ticketStatusChanged,
1830
+ this.events.ticketPriorityChanged,
1831
+ this.events.ticketTagsChanged,
1832
+ this.events.ticketFollowersChanged,
1833
+ this.events.ticketAssignmentChanged,
1834
+ this.events.ticketMessageAdded,
1835
+ this.events.ticketCustomFieldsChanged
1836
+ ]);
1837
+ },
1838
+ get subscribe() {
1839
+ return integrationEventsCoreZods.withCore(
1840
+ import_zod13.z.object({
1841
+ event: this.event,
1842
+ callback: import_zod13.z.string()
1843
+ })
1844
+ );
1845
+ },
1846
+ get subscribeContent() {
1847
+ return import_zod13.z.object({
1848
+ provider: this.provider,
1849
+ event: this.event,
1850
+ callback: import_zod13.z.string()
1851
+ });
1852
+ },
1853
+ get unsubscribe() {
1854
+ return integrationEventsCoreZods.withCore(
1855
+ import_zod13.z.object({
1856
+ event: this.event
1857
+ })
1858
+ );
1859
+ },
1860
+ get unsubscribeContent() {
1861
+ return import_zod13.z.object({
1862
+ provider: this.provider,
1863
+ event: this.event
1864
+ });
1865
+ }
1866
+ };
1867
+
1868
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/livechat.ts
1869
+ var import_zod14 = require("zod");
1870
+ var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
1871
+ TextLivechatEventNames2["ChatStarted"] = "chat_started";
1872
+ TextLivechatEventNames2["ChatEnded"] = "chat_ended";
1873
+ TextLivechatEventNames2["ChatTransferred"] = "chat_transferred";
1874
+ TextLivechatEventNames2["ChatTagged"] = "chat_tagged";
1875
+ TextLivechatEventNames2["ChatRated"] = "chat_rated";
1876
+ TextLivechatEventNames2["ChatCommented"] = "chat_commented";
1877
+ TextLivechatEventNames2["ChatMessage"] = "chat_message";
1878
+ TextLivechatEventNames2["UserAddedToChat"] = "user_added_to_chat";
1879
+ TextLivechatEventNames2["UserRemovedFromChat"] = "user_removed_from_chat";
1880
+ TextLivechatEventNames2["CustomerLeftChat"] = "customer_left_chat";
1881
+ TextLivechatEventNames2["ChatIdle"] = "chat_idle";
1882
+ TextLivechatEventNames2["ProductCardEvent"] = "product_card_event";
1883
+ return TextLivechatEventNames2;
1884
+ })(TextLivechatEventNames || {});
1885
+ var CustomerLeftChatReason = /* @__PURE__ */ ((CustomerLeftChatReason2) => {
1886
+ CustomerLeftChatReason2["Manual"] = "manual";
1887
+ CustomerLeftChatReason2["Disconnected"] = "disconnected";
1888
+ CustomerLeftChatReason2["Inactive"] = "inactive";
1889
+ return CustomerLeftChatReason2;
1890
+ })(CustomerLeftChatReason || {});
1891
+ var TextLivechatProductCardEventType = /* @__PURE__ */ ((TextLivechatProductCardEventType2) => {
1892
+ TextLivechatProductCardEventType2["ViewProduct"] = "view_product";
1893
+ TextLivechatProductCardEventType2["AddToCart"] = "add_to_cart";
1894
+ return TextLivechatProductCardEventType2;
1895
+ })(TextLivechatProductCardEventType || {});
1896
+ var textLivechatEventsZods = {
1897
+ provider: import_zod14.z.literal("text-livechat" /* LiveChat */),
1898
+ eventName: import_zod14.z.nativeEnum(TextLivechatEventNames),
1899
+ events: {
1900
+ chatStarted: integrationEventBase.extend({
1901
+ name: import_zod14.z.literal("chat_started" /* ChatStarted */),
1902
+ targetAgentId: import_zod14.z.string().optional()
1903
+ }),
1904
+ chatEnded: integrationEventBase.extend({
1905
+ name: import_zod14.z.literal("chat_ended" /* ChatEnded */)
1906
+ }),
1907
+ chatTransferred: integrationEventBase.extend({
1908
+ name: import_zod14.z.literal("chat_transferred" /* ChatTransferred */),
1909
+ targetGroups: import_zod14.z.array(import_zod14.z.number()).optional(),
1910
+ targetAgents: import_zod14.z.array(import_zod14.z.string()).optional()
1911
+ }),
1912
+ chatTagged: integrationEventBase.extend({
1913
+ name: import_zod14.z.literal("chat_tagged" /* ChatTagged */),
1914
+ tag: import_zod14.z.string().optional(),
1915
+ exact: import_zod14.z.boolean().optional()
1916
+ }),
1917
+ chatRated: integrationEventBase.extend({
1918
+ name: import_zod14.z.literal("chat_rated" /* ChatRated */),
1919
+ rating: import_zod14.z.enum(["good", "bad", "all"]).optional()
1920
+ }),
1921
+ chatCommented: integrationEventBase.extend({
1922
+ name: import_zod14.z.literal("chat_commented" /* ChatCommented */)
1923
+ }),
1924
+ chatMessage: import_zod14.z.discriminatedUnion("version", [
1925
+ import_zod14.z.object({
1926
+ name: import_zod14.z.literal("chat_message" /* ChatMessage */),
1927
+ version: import_zod14.z.undefined(),
1928
+ filter: import_zod14.z.string().optional(),
1929
+ caseInsensitive: import_zod14.z.boolean().optional(),
1930
+ matchWholeWords: import_zod14.z.boolean().optional()
1931
+ }),
1932
+ import_zod14.z.object({
1933
+ name: import_zod14.z.literal("chat_message" /* ChatMessage */),
1934
+ version: import_zod14.z.literal("v1"),
1935
+ filters: import_zod14.z.array(import_zod14.z.string()),
1936
+ caseInsensitive: import_zod14.z.boolean().optional(),
1937
+ matchWholeWords: import_zod14.z.boolean().optional()
1938
+ })
1939
+ ]),
1940
+ userAddedToChat: integrationEventBase.extend({
1941
+ name: import_zod14.z.literal("user_added_to_chat" /* UserAddedToChat */),
1942
+ userType: import_zod14.z.enum(["agent", "customer"]).optional(),
1943
+ targetAgentId: import_zod14.z.string().optional()
1944
+ }),
1945
+ userRemovedFromChat: integrationEventBase.extend({
1946
+ name: import_zod14.z.literal("user_removed_from_chat" /* UserRemovedFromChat */)
1947
+ }),
1948
+ customerLeftChat: integrationEventBase.extend({
1949
+ name: import_zod14.z.literal("customer_left_chat" /* CustomerLeftChat */),
1950
+ reasons: import_zod14.z.array(import_zod14.z.nativeEnum(CustomerLeftChatReason)).optional()
1951
+ }),
1952
+ chatIdle: integrationEventBase.extend({
1953
+ name: import_zod14.z.literal("chat_idle" /* ChatIdle */)
1954
+ }),
1955
+ productCardEvent: integrationEventBase.extend({
1956
+ name: import_zod14.z.literal("product_card_event" /* ProductCardEvent */),
1957
+ type: import_zod14.z.nativeEnum(TextLivechatProductCardEventType),
1958
+ product_id: import_zod14.z.string().optional()
1959
+ })
1960
+ },
1961
+ get event() {
1962
+ return import_zod14.z.union([
1963
+ this.events.chatStarted,
1964
+ this.events.chatEnded,
1965
+ this.events.chatTransferred,
1966
+ this.events.chatTagged,
1967
+ this.events.chatRated,
1968
+ this.events.chatCommented,
1969
+ this.events.chatMessage,
1970
+ this.events.userAddedToChat,
1971
+ this.events.userRemovedFromChat,
1972
+ this.events.customerLeftChat,
1973
+ this.events.chatIdle,
1974
+ this.events.productCardEvent
1975
+ ]);
1976
+ },
1977
+ get subscribe() {
1978
+ return integrationEventsCoreZods.withCore(
1979
+ import_zod14.z.object({
1980
+ event: this.event,
1981
+ callback: import_zod14.z.string()
1982
+ })
1983
+ );
1984
+ },
1985
+ get subscribeContent() {
1986
+ return import_zod14.z.object({
1987
+ provider: this.provider,
1988
+ event: this.event,
1989
+ callback: import_zod14.z.string()
1990
+ });
1991
+ },
1992
+ get unsubscribe() {
1993
+ return integrationEventsCoreZods.withCore(
1994
+ import_zod14.z.object({
1995
+ event: this.event
1996
+ })
1997
+ );
1998
+ },
1999
+ get unsubscribeContent() {
2000
+ return import_zod14.z.object({
2001
+ provider: this.provider,
2002
+ event: this.event
2003
+ });
2004
+ }
2005
+ };
2006
+
2007
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/text.ts
2008
+ var import_zod15 = require("zod");
2009
+ var textEventsZods = {
2010
+ provider: import_zod15.z.literal("text" /* Text */),
2011
+ get event() {
2012
+ return textCustomerEventsZods.event;
2013
+ },
2014
+ get subscribe() {
2015
+ return integrationEventsCoreZods.withCore(
2016
+ import_zod15.z.object({
2017
+ event: this.event,
2018
+ callback: import_zod15.z.string()
2019
+ })
2020
+ );
2021
+ },
2022
+ get subscribeContent() {
2023
+ return import_zod15.z.object({
2024
+ provider: this.provider,
2025
+ event: this.event,
2026
+ callback: import_zod15.z.string()
2027
+ });
2028
+ },
2029
+ get unsubscribe() {
2030
+ return integrationEventsCoreZods.withCore(
2031
+ import_zod15.z.object({
2032
+ event: this.event
2033
+ })
2034
+ );
2035
+ },
2036
+ get unsubscribeContent() {
2037
+ return import_zod15.z.object({
2038
+ provider: this.provider,
2039
+ event: this.event
2040
+ });
2041
+ }
2042
+ };
2043
+
2044
+ // src/apis/text-intelligence/workflows/adapter/integrations/_contracts/requests/events.ts
2045
+ var integrationEventsZods = {
2046
+ providerName: import_zod16.z.enum([
2047
+ "text" /* Text */,
2048
+ "text-livechat" /* LiveChat */,
2049
+ "text-helpdesk" /* HelpDesk */,
2050
+ "mailchimp" /* Mailchimp */,
2051
+ "shopify" /* Shopify */,
2052
+ "hubspot" /* HubSpot */,
2053
+ "slack" /* Slack */,
2054
+ "bigcommerce" /* BigCommerce */
2055
+ ]),
2056
+ get event() {
2057
+ return textEventsZods.event.or(textLivechatEventsZods.event).or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event).or(slackEventsZods.event);
2058
+ },
2059
+ get subscribe() {
2060
+ return integrationEventsCoreZods.withCore(
2061
+ import_zod16.z.discriminatedUnion("provider", [
2062
+ textEventsZods.subscribeContent,
2063
+ textLivechatEventsZods.subscribeContent,
2064
+ textHelpDeskEventsZods.subscribeContent,
2065
+ shopifyEventsZods.subscribeContent,
2066
+ mailchimpEventsZods.subscribeContent,
2067
+ hubspotEventsZods.subscribeContent,
2068
+ slackEventsZods.subscribeContent,
2069
+ bigcommerceEventsZods.subscribeContent
2070
+ ])
2071
+ );
2072
+ },
2073
+ get unsubscribe() {
2074
+ return integrationEventsCoreZods.withCore(
2075
+ import_zod16.z.discriminatedUnion("provider", [
2076
+ textEventsZods.unsubscribeContent,
2077
+ textLivechatEventsZods.unsubscribeContent,
2078
+ textHelpDeskEventsZods.unsubscribeContent,
2079
+ shopifyEventsZods.unsubscribeContent,
2080
+ mailchimpEventsZods.unsubscribeContent,
2081
+ hubspotEventsZods.unsubscribeContent,
2082
+ slackEventsZods.unsubscribeContent,
2083
+ bigcommerceEventsZods.unsubscribeContent
2084
+ ])
2085
+ );
2086
+ }
2087
+ };
2088
+
2089
+ // src/apis/text-intelligence/workflows/workflow/instance.ts
2090
+ var import_axios29 = __toESM(require("axios"));
2091
+ var REGION4 = {
2092
+ FRA: "fra",
2093
+ DAL: "dal",
2094
+ FRA_A: "fra-a",
2095
+ FRA_B: "fra-b"
2096
+ };
2097
+ var supportedRegions4 = Object.values(REGION4);
2098
+ var WorkflowsApiError = class _WorkflowsApiError extends ApiErrorBase {
2099
+ constructor() {
2100
+ super(...arguments);
2101
+ this.name = "workflows";
2102
+ }
2103
+ static notFound(message) {
2104
+ return new _WorkflowsApiError(
2105
+ message != null ? message : "Not found",
2106
+ {
2107
+ errorCode: "not_found",
2108
+ errorMessage: "Not found"
2109
+ },
2110
+ 404
2111
+ );
2112
+ }
2113
+ };
2114
+ var workflowsClientInstance = import_axios29.default.create({
2115
+ baseURL: "https://platform.labs.text.com/workflows/api",
2116
+ headers: {
2117
+ "Content-Type": "application/json"
2118
+ }
2119
+ });
2120
+ workflowsClientInstance.interceptors.response.use(
2121
+ (response) => response,
2122
+ (error) => {
2123
+ var _a, _b;
2124
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
2125
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
2126
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
2127
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
2128
+ const data = (_b = error.response) == null ? void 0 : _b.data;
2129
+ return Promise.reject(
2130
+ new WorkflowsApiError(data.message, data.data, data.code)
2131
+ );
2132
+ }
2133
+ return Promise.reject(error);
2134
+ }
2135
+ );
2136
+
2137
+ // src/apis/integrations/text/platform/workflow/resources/api.ts
2138
+ var integrationNameToProduct = {
2139
+ ["text-helpdesk" /* HelpDesk */]: "helpdesk",
2140
+ ["text-livechat" /* LiveChat */]: "livechat"
2141
+ };
2142
+
2143
+ // src/apis/integrations/vercel/api.ts
2144
+ var import_axios30 = __toESM(require("axios"));
2145
+
2146
+ // src/apis/platform/accounts/accounts/api.ts
2147
+ var urls = (withBaseUrl = false) => {
2148
+ const getUrl = (segments = []) => buildUrlFromSegments(
2149
+ segments,
2150
+ "/v2/accounts",
2151
+ withBaseUrl ? platformAccountsClientInstance.config.baseURL : void 0
2152
+ );
2153
+ return {
2154
+ getAccounts: () => getUrl(),
2155
+ getAccount: (id) => getUrl([id]),
2156
+ getMeAccount: () => getUrl(["me"])
2157
+ };
2158
+ };
2159
+ var api = {
2160
+ getAccounts(authorization) {
2161
+ return __async(this, null, function* () {
2162
+ return platformAccountsClientInstance.get(
2163
+ urls().getAccounts(),
2164
+ {
2165
+ authorization,
2166
+ customErrorMessage: "Accounts couldn't be fetched."
2167
+ }
2168
+ );
2169
+ });
2170
+ },
2171
+ getAccount(accountId, authorization) {
2172
+ return __async(this, null, function* () {
2173
+ return platformAccountsClientInstance.get(
2174
+ urls().getAccount(accountId),
2175
+ {
2176
+ authorization,
2177
+ customErrorMessage: "Account couldn't be fetched."
2178
+ }
2179
+ );
2180
+ });
2181
+ },
2182
+ getMeAccount(authorization) {
2183
+ return __async(this, null, function* () {
2184
+ return platformAccountsClientInstance.get(
2185
+ "/v2/accounts/me",
2186
+ {
2187
+ authorization,
2188
+ customErrorMessage: "Me account couldn't be fetched."
2189
+ }
2190
+ );
2191
+ });
2192
+ }
2193
+ };
2194
+ var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api), {
2195
+ meta: {
2196
+ urls
2197
+ }
2198
+ });
2199
+
2200
+ // src/apis/integrations/text/instance.ts
2201
+ var TextApiError = class extends ApiErrorBase {
2202
+ constructor() {
2203
+ super(...arguments);
2204
+ this.name = "text";
2205
+ }
2206
+ };
2207
+ var textClientInstance = import_axios31.default.create({
2208
+ baseURL: "https://api.labs.text.com"
2209
+ });
2210
+ textClientInstance.interceptors.response.use(
2211
+ (r) => r,
2212
+ (error) => {
2213
+ var _a, _b, _c, _d;
2214
+ if (import_axios31.default.isAxiosError(error)) {
2215
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2216
+ throw new UnauthorizeApiError("text");
2217
+ }
2218
+ }
2219
+ return Promise.reject(
2220
+ new TextApiError(
2221
+ error.message,
2222
+ (_b = error.response) == null ? void 0 : _b.data,
2223
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2224
+ )
2225
+ );
2226
+ }
2227
+ );
2228
+ function getTextClientConfig(options = {}) {
2229
+ var _a;
2230
+ const currentHeaders = textClientInstance.defaults.headers;
2231
+ const config = {
2232
+ authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
2233
+ };
2234
+ return __spreadProps(__spreadValues({}, options.baseUrl ? { baseURL: options.baseUrl } : {}), {
2235
+ headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
2236
+ });
2237
+ }
2238
+
2239
+ // src/apis/integrations/text/platform/workflow/workflows/internal/crm/instance.ts
2240
+ function getWorkflowApiCrmConfig(authorization) {
2241
+ var _a, _b, _c, _d;
2242
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
2243
+ ensureAuthorizationToken: true
2244
+ }));
2245
+ return __spreadProps(__spreadValues({}, config), {
2246
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (_a = config.headers) != null ? _a : {}), ((_b = authorization == null ? void 0 : authorization.internal) == null ? void 0 : _b.token) ? {
2247
+ [PROXY_AUTHORIZATION_HEADER]: `Bearer ${authorization.internal.token}`
2248
+ } : {}), ((_c = authorization == null ? void 0 : authorization.internal) == null ? void 0 : _c.organizationId) ? { [ORGANIZATION_ID_HEADER]: authorization.internal.organizationId } : {}), ((_d = authorization == null ? void 0 : authorization.internal) == null ? void 0 : _d.accountId) ? { [ACCOUNT_ID_HEADER]: authorization.internal.accountId } : {})
2249
+ });
2250
+ }
2251
+ // Annotate the CommonJS export names for ESM import in node:
2252
+ 0 && (module.exports = {
2253
+ CredentialStatus,
2254
+ CredentialType,
2255
+ CredentialTypeDisplayNameMapping,
2256
+ OauthCredentialGrantType,
2257
+ SortBy,
2258
+ SortOrder,
2259
+ TRIGGER_REFERENCE_NAME,
2260
+ WorkflowConditionTaskFieldType,
2261
+ WorkflowConditionTaskLogic,
2262
+ WorkflowConditionTaskOperator,
2263
+ WorkflowConditionTaskOperatorGroup,
2264
+ WorkflowConditionTaskOperatorValueType,
2265
+ WorkflowCustomTaskName,
2266
+ WorkflowExecutionDefinitionStatus,
2267
+ WorkflowExecutionStatus,
2268
+ WorkflowExecutionTaskStatus,
2269
+ WorkflowItemKind,
2270
+ WorkflowTaskType,
2271
+ WorkflowTemplateCategory,
2272
+ WorkflowTriggerType,
2273
+ getWorkflowApiCrmConfig,
2274
+ isFilter,
2275
+ isFilterGroup,
2276
+ serializeFilters
2277
+ });