@livechat/developer-studio-api 5.5.0-beta.generator.29 → 5.6.0-beta.generator.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AVPZPHAU.mjs → chunk-GND2D76F.mjs} +4881 -4925
- package/dist/{events-BD4wWUnu.d.mts → events-CQtoMVf0.d.mts} +1 -30
- package/dist/{events-BD4wWUnu.d.ts → events-CQtoMVf0.d.ts} +1 -30
- package/dist/index.d.mts +3 -8
- package/dist/index.d.ts +3 -8
- package/dist/index.js +1889 -1933
- package/dist/index.mjs +1 -1
- package/dist/workflow-contracts.d.mts +1 -1
- package/dist/workflow-contracts.d.ts +1 -1
- package/dist/workflow-contracts.js +211 -217
- package/dist/workflow-contracts.mjs +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4434,1568 +4434,47 @@ var textPlatformWorkflowsFunctionsApi = {
|
|
|
4434
4434
|
}
|
|
4435
4435
|
};
|
|
4436
4436
|
|
|
4437
|
-
// src/apis/integrations/
|
|
4438
|
-
var
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
BigCommerceWebhookScopes2["OrderCreated"] = "store/order/created";
|
|
4442
|
-
BigCommerceWebhookScopes2["OrderUpdated"] = "store/order/updated";
|
|
4443
|
-
BigCommerceWebhookScopes2["ProductCreated"] = "store/product/created";
|
|
4444
|
-
BigCommerceWebhookScopes2["ProductUpdated"] = "store/product/updated";
|
|
4445
|
-
return BigCommerceWebhookScopes2;
|
|
4446
|
-
})(BigCommerceWebhookScopes || {});
|
|
4447
|
-
|
|
4448
|
-
// src/apis/integrations/github/webhooks/_contracts/dtos/webhooks.ts
|
|
4449
|
-
var GitHubWebhookActions = /* @__PURE__ */ ((GitHubWebhookActions2) => {
|
|
4450
|
-
GitHubWebhookActions2["Unknown"] = "unknown";
|
|
4451
|
-
GitHubWebhookActions2["Deleted"] = "deleted";
|
|
4452
|
-
return GitHubWebhookActions2;
|
|
4453
|
-
})(GitHubWebhookActions || {});
|
|
4454
|
-
|
|
4455
|
-
// src/apis/integrations/hubspot/webhooks/_contracts/dtos/webhooks.ts
|
|
4456
|
-
var HubSpotWebhookEventTypes = /* @__PURE__ */ ((HubSpotWebhookEventTypes2) => {
|
|
4457
|
-
HubSpotWebhookEventTypes2["ContactCreation"] = "contact.creation";
|
|
4458
|
-
HubSpotWebhookEventTypes2["ContactDeletion"] = "contact.deletion";
|
|
4459
|
-
return HubSpotWebhookEventTypes2;
|
|
4460
|
-
})(HubSpotWebhookEventTypes || {});
|
|
4461
|
-
|
|
4462
|
-
// src/apis/integrations/slack/_contracts/webhooks/dtos/webhooks.ts
|
|
4463
|
-
var SlackEventTypes = /* @__PURE__ */ ((SlackEventTypes2) => {
|
|
4464
|
-
SlackEventTypes2["MessagePosted"] = "message";
|
|
4465
|
-
SlackEventTypes2["ReactionAdded"] = "reaction_added";
|
|
4466
|
-
SlackEventTypes2["File"] = "file";
|
|
4467
|
-
return SlackEventTypes2;
|
|
4468
|
-
})(SlackEventTypes || {});
|
|
4469
|
-
var SlackMessageEventSubTypes = /* @__PURE__ */ ((SlackMessageEventSubTypes2) => {
|
|
4470
|
-
SlackMessageEventSubTypes2["AssistantAppThread"] = "assistant_app_thread";
|
|
4471
|
-
SlackMessageEventSubTypes2["BotMessage"] = "bot_message";
|
|
4472
|
-
SlackMessageEventSubTypes2["ChannelArchive"] = "channel_archive";
|
|
4473
|
-
SlackMessageEventSubTypes2["ChannelConvertToPrivate"] = "channel_convert_to_private";
|
|
4474
|
-
SlackMessageEventSubTypes2["ChannelConvertToPublic"] = "channel_convert_to_public";
|
|
4475
|
-
SlackMessageEventSubTypes2["ChannelJoin"] = "channel_join";
|
|
4476
|
-
SlackMessageEventSubTypes2["ChannelLeave"] = "channel_leave";
|
|
4477
|
-
SlackMessageEventSubTypes2["ChannelName"] = "channel_name";
|
|
4478
|
-
SlackMessageEventSubTypes2["ChannelPostingPermissions"] = "channel_posting_permissions";
|
|
4479
|
-
SlackMessageEventSubTypes2["ChannelPurpose"] = "channel_purpose";
|
|
4480
|
-
SlackMessageEventSubTypes2["ChannelTopic"] = "channel_topic";
|
|
4481
|
-
SlackMessageEventSubTypes2["ChannelUnarchive"] = "channel_unarchive";
|
|
4482
|
-
SlackMessageEventSubTypes2["DocumentMention"] = "document_mention";
|
|
4483
|
-
SlackMessageEventSubTypes2["EkmAccessDenied"] = "ekm_access_denied";
|
|
4484
|
-
SlackMessageEventSubTypes2["FileComment"] = "file_comment";
|
|
4485
|
-
SlackMessageEventSubTypes2["FileMention"] = "file_mention";
|
|
4486
|
-
SlackMessageEventSubTypes2["FileShare"] = "file_share";
|
|
4487
|
-
SlackMessageEventSubTypes2["GroupArchive"] = "group_archive";
|
|
4488
|
-
SlackMessageEventSubTypes2["GroupJoin"] = "group_join";
|
|
4489
|
-
SlackMessageEventSubTypes2["GroupLeave"] = "group_leave";
|
|
4490
|
-
SlackMessageEventSubTypes2["GroupName"] = "group_name";
|
|
4491
|
-
SlackMessageEventSubTypes2["GroupPurpose"] = "group_purpose";
|
|
4492
|
-
SlackMessageEventSubTypes2["GroupTopic"] = "group_topic";
|
|
4493
|
-
SlackMessageEventSubTypes2["GroupUnarchive"] = "group_unarchive";
|
|
4494
|
-
SlackMessageEventSubTypes2["MessageChanged"] = "message_changed";
|
|
4495
|
-
SlackMessageEventSubTypes2["MessageDeleted"] = "message_deleted";
|
|
4496
|
-
SlackMessageEventSubTypes2["MeMessage"] = "me_message";
|
|
4497
|
-
SlackMessageEventSubTypes2["MessageReplied"] = "message_replied";
|
|
4498
|
-
SlackMessageEventSubTypes2["PinnedItem"] = "pinned_item";
|
|
4499
|
-
SlackMessageEventSubTypes2["ReminderAdd"] = "reminder_add";
|
|
4500
|
-
SlackMessageEventSubTypes2["ReplyBroadcast"] = "reply_broadcast";
|
|
4501
|
-
SlackMessageEventSubTypes2["ThreadBroadcast"] = "thread_broadcast";
|
|
4502
|
-
SlackMessageEventSubTypes2["UnpinnedItem"] = "unpinned_item";
|
|
4503
|
-
return SlackMessageEventSubTypes2;
|
|
4504
|
-
})(SlackMessageEventSubTypes || {});
|
|
4505
|
-
|
|
4506
|
-
// src/apis/integrations/text/platform/workflow/_contracts/filters/helpers.ts
|
|
4507
|
-
var isFilterGroup = (filter) => {
|
|
4508
|
-
return "filters" in filter && "operator" in filter;
|
|
4509
|
-
};
|
|
4510
|
-
var isFilter = (filter) => {
|
|
4511
|
-
return "field" in filter && "operator" in filter && "value" in filter;
|
|
4512
|
-
};
|
|
4513
|
-
|
|
4514
|
-
// src/apis/integrations/text/platform/workflow/_contracts/filters/serialize.ts
|
|
4515
|
-
var convertValueToString = (value) => {
|
|
4516
|
-
if (typeof value === "string") {
|
|
4517
|
-
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
4518
|
-
}
|
|
4519
|
-
if (value === null) {
|
|
4520
|
-
return "null";
|
|
4521
|
-
}
|
|
4522
|
-
return value.toString();
|
|
4523
|
-
};
|
|
4524
|
-
var filterToString = (filter) => {
|
|
4525
|
-
if (isFilterGroup(filter)) {
|
|
4526
|
-
return `(${serializeFilters([filter])})`;
|
|
4527
|
-
} else if (isFilter(filter)) {
|
|
4528
|
-
return `${filter.field} ${filter.operator} ${convertValueToString(filter.value)}`;
|
|
4529
|
-
}
|
|
4530
|
-
return "";
|
|
4531
|
-
};
|
|
4532
|
-
var serializeFilters = (filters) => {
|
|
4533
|
-
if (filters.length === 0) {
|
|
4534
|
-
return "";
|
|
4535
|
-
}
|
|
4536
|
-
if (filters.length === 1 && filters[0] && isFilterGroup(filters[0])) {
|
|
4537
|
-
const group = filters[0];
|
|
4538
|
-
return group.filters.map(filterToString).filter(Boolean).join(` ${group.operator} `);
|
|
4539
|
-
}
|
|
4540
|
-
return filters.map(filterToString).filter(Boolean).join(" and ");
|
|
4541
|
-
};
|
|
4542
|
-
|
|
4543
|
-
// src/apis/integrations/text/platform/workflow/_contracts/sorting/types.ts
|
|
4544
|
-
var SortOrder = {
|
|
4545
|
-
Ascending: "asc",
|
|
4546
|
-
Descending: "desc"
|
|
4547
|
-
};
|
|
4548
|
-
var SortBy = {
|
|
4549
|
-
Name: "name",
|
|
4550
|
-
CreatedOn: "created_at",
|
|
4551
|
-
CreatedBy: "created_by",
|
|
4552
|
-
Runs: "executions.completed",
|
|
4553
|
-
Status: "active"
|
|
4554
|
-
};
|
|
4555
|
-
|
|
4556
|
-
// src/apis/integrations/text/platform/workflow/credentials/_contracts/dtos/credential.ts
|
|
4557
|
-
var CredentialStatus = /* @__PURE__ */ ((CredentialStatus2) => {
|
|
4558
|
-
CredentialStatus2["Connected"] = "connected";
|
|
4559
|
-
CredentialStatus2["Disconnected"] = "disconnected";
|
|
4560
|
-
CredentialStatus2["Stale"] = "stale";
|
|
4561
|
-
return CredentialStatus2;
|
|
4562
|
-
})(CredentialStatus || {});
|
|
4563
|
-
var CredentialType = /* @__PURE__ */ ((CredentialType2) => {
|
|
4564
|
-
CredentialType2["General"] = "general";
|
|
4565
|
-
CredentialType2["ApiKey"] = "api_key";
|
|
4566
|
-
CredentialType2["BasicAuth"] = "basic_auth";
|
|
4567
|
-
CredentialType2["OAuth2"] = "oauth2";
|
|
4568
|
-
CredentialType2["TextAuth"] = "text_auth";
|
|
4569
|
-
return CredentialType2;
|
|
4570
|
-
})(CredentialType || {});
|
|
4571
|
-
var CredentialTypeDisplayNameMapping = {
|
|
4572
|
-
["general" /* General */]: "General",
|
|
4573
|
-
["api_key" /* ApiKey */]: "API Key",
|
|
4574
|
-
["basic_auth" /* BasicAuth */]: "Basic Auth",
|
|
4575
|
-
["oauth2" /* OAuth2 */]: "OAuth2",
|
|
4576
|
-
["text_auth" /* TextAuth */]: "Text"
|
|
4577
|
-
};
|
|
4578
|
-
var OauthCredentialGrantType = /* @__PURE__ */ ((OauthCredentialGrantType2) => {
|
|
4579
|
-
OauthCredentialGrantType2["AuthorizationCode"] = "authorization_code";
|
|
4580
|
-
OauthCredentialGrantType2["Implicit"] = "implicit";
|
|
4581
|
-
OauthCredentialGrantType2["PKCE"] = "pkce";
|
|
4582
|
-
OauthCredentialGrantType2["ClientCredentials"] = "client_credentials";
|
|
4583
|
-
return OauthCredentialGrantType2;
|
|
4584
|
-
})(OauthCredentialGrantType || {});
|
|
4585
|
-
|
|
4586
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/base.ts
|
|
4587
|
-
var WorkflowTaskType = {
|
|
4588
|
-
http: "HTTP",
|
|
4589
|
-
switch: "SWITCH",
|
|
4590
|
-
forkJoin: "FORK_JOIN",
|
|
4591
|
-
terminate: "TERMINATE",
|
|
4592
|
-
join: "JOIN",
|
|
4593
|
-
wait: "WAIT",
|
|
4594
|
-
simple: "SIMPLE",
|
|
4595
|
-
doWhile: "DO_WHILE",
|
|
4596
|
-
inline: "INLINE",
|
|
4597
|
-
transform: "JSON_JQ_TRANSFORM"
|
|
4598
|
-
};
|
|
4599
|
-
var WorkflowCustomTaskName = {
|
|
4600
|
-
// SWITCH
|
|
4601
|
-
condition: `${WorkflowTaskType.switch}_IF`,
|
|
4602
|
-
switchCase: `${WorkflowTaskType.switch}_CASE`,
|
|
4603
|
-
// SIMPLE
|
|
4604
|
-
action: "action",
|
|
4605
|
-
awaitAgent: "await",
|
|
4606
|
-
notifyAgent: "notify_ai_agent",
|
|
4607
|
-
reasoning: "reasoning",
|
|
4608
|
-
// DO WHILE
|
|
4609
|
-
loop: `${WorkflowTaskType.doWhile}_LOOP`,
|
|
4610
|
-
forEach: `${WorkflowTaskType.doWhile}_FOR_EACH`,
|
|
4611
|
-
// INLINE
|
|
4612
|
-
script: `${WorkflowTaskType.inline}_SCRIPT`,
|
|
4613
|
-
// JQ TRANSFORM
|
|
4614
|
-
convert: `${WorkflowTaskType.transform}_CONVERT`,
|
|
4615
|
-
construct: `${WorkflowTaskType.transform}_CONSTRUCT`
|
|
4616
|
-
};
|
|
4617
|
-
var WorkflowExecutionTaskStatus = /* @__PURE__ */ ((WorkflowExecutionTaskStatus2) => {
|
|
4618
|
-
WorkflowExecutionTaskStatus2["Completed"] = "COMPLETED";
|
|
4619
|
-
WorkflowExecutionTaskStatus2["CompletedWithError"] = "COMPLETED_WITH_ERRORS";
|
|
4620
|
-
WorkflowExecutionTaskStatus2["Failed"] = "FAILED";
|
|
4621
|
-
WorkflowExecutionTaskStatus2["FailedWithTerminalErrors"] = "FAILED_WITH_TERMINAL_ERROR";
|
|
4622
|
-
WorkflowExecutionTaskStatus2["Scheduled"] = "SCHEDULED";
|
|
4623
|
-
WorkflowExecutionTaskStatus2["TimedOut"] = "TIMED_OUT";
|
|
4624
|
-
WorkflowExecutionTaskStatus2["InProgress"] = "IN_PROGRESS";
|
|
4625
|
-
WorkflowExecutionTaskStatus2["Skipped"] = "SKIPPED";
|
|
4626
|
-
WorkflowExecutionTaskStatus2["Canceled"] = "CANCELED";
|
|
4627
|
-
WorkflowExecutionTaskStatus2["NotExecuted"] = "NOT_EXECUTED";
|
|
4628
|
-
return WorkflowExecutionTaskStatus2;
|
|
4629
|
-
})(WorkflowExecutionTaskStatus || {});
|
|
4630
|
-
|
|
4631
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/http.ts
|
|
4632
|
-
function isWorkflowBaseHttpTaskCore(task) {
|
|
4633
|
-
return task.name === WorkflowTaskType.http;
|
|
4634
|
-
}
|
|
4635
|
-
|
|
4636
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/switch/variants/condition.ts
|
|
4637
|
-
var WorkflowConditionTaskLogic = /* @__PURE__ */ ((WorkflowConditionTaskLogic2) => {
|
|
4638
|
-
WorkflowConditionTaskLogic2["AND"] = "AND";
|
|
4639
|
-
WorkflowConditionTaskLogic2["OR"] = "OR";
|
|
4640
|
-
return WorkflowConditionTaskLogic2;
|
|
4641
|
-
})(WorkflowConditionTaskLogic || {});
|
|
4642
|
-
var WorkflowConditionTaskOperator = /* @__PURE__ */ ((WorkflowConditionTaskOperator2) => {
|
|
4643
|
-
WorkflowConditionTaskOperator2["GeneralEmpty"] = "g_empty";
|
|
4644
|
-
WorkflowConditionTaskOperator2["GeneralNotEmpty"] = "g_nempty";
|
|
4645
|
-
WorkflowConditionTaskOperator2["NumberEqual"] = "n_eq";
|
|
4646
|
-
WorkflowConditionTaskOperator2["NumberNotEqual"] = "n_neq";
|
|
4647
|
-
WorkflowConditionTaskOperator2["NumberIn"] = "n_in";
|
|
4648
|
-
WorkflowConditionTaskOperator2["NumberNotIn"] = "n_nin";
|
|
4649
|
-
WorkflowConditionTaskOperator2["NumberGreaterThan"] = "n_gt";
|
|
4650
|
-
WorkflowConditionTaskOperator2["NumberGreaterOrEqual"] = "n_gte";
|
|
4651
|
-
WorkflowConditionTaskOperator2["NumberLessThan"] = "n_lt";
|
|
4652
|
-
WorkflowConditionTaskOperator2["NumberLessOrEqual"] = "n_lte";
|
|
4653
|
-
WorkflowConditionTaskOperator2["StringEqual"] = "s_eq";
|
|
4654
|
-
WorkflowConditionTaskOperator2["StringNotEqual"] = "s_neq";
|
|
4655
|
-
WorkflowConditionTaskOperator2["StringIn"] = "s_in";
|
|
4656
|
-
WorkflowConditionTaskOperator2["StringNotIn"] = "s_nin";
|
|
4657
|
-
WorkflowConditionTaskOperator2["StringContains"] = "s_contains";
|
|
4658
|
-
WorkflowConditionTaskOperator2["StringNotContains"] = "s_not_contains";
|
|
4659
|
-
WorkflowConditionTaskOperator2["StringStartsWith"] = "s_starts_with";
|
|
4660
|
-
WorkflowConditionTaskOperator2["StringEndsWith"] = "s_ends_with";
|
|
4661
|
-
WorkflowConditionTaskOperator2["StringRegex"] = "s_regex";
|
|
4662
|
-
WorkflowConditionTaskOperator2["StringLengthEqual"] = "s_length_eq";
|
|
4663
|
-
WorkflowConditionTaskOperator2["StringLengthGreaterThan"] = "s_length_gt";
|
|
4664
|
-
WorkflowConditionTaskOperator2["StringLengthLessThan"] = "s_length_lt";
|
|
4665
|
-
WorkflowConditionTaskOperator2["DateTimeEqual"] = "dt_eq";
|
|
4666
|
-
WorkflowConditionTaskOperator2["DateTimeNotEqual"] = "dt_neq";
|
|
4667
|
-
WorkflowConditionTaskOperator2["DateTimeBefore"] = "dt_before";
|
|
4668
|
-
WorkflowConditionTaskOperator2["DateTimeAfter"] = "dt_after";
|
|
4669
|
-
WorkflowConditionTaskOperator2["BooleanEqual"] = "b_eq";
|
|
4670
|
-
WorkflowConditionTaskOperator2["BooleanNotEqual"] = "b_neq";
|
|
4671
|
-
WorkflowConditionTaskOperator2["ArrayContains"] = "a_contains";
|
|
4672
|
-
WorkflowConditionTaskOperator2["ArrayNotContains"] = "a_not_contains";
|
|
4673
|
-
WorkflowConditionTaskOperator2["ArrayLengthEqual"] = "a_length_eq";
|
|
4674
|
-
WorkflowConditionTaskOperator2["ArrayLengthGreaterThan"] = "a_length_gt";
|
|
4675
|
-
WorkflowConditionTaskOperator2["ArrayLengthLessThan"] = "a_length_lt";
|
|
4676
|
-
WorkflowConditionTaskOperator2["ArrayLengthGreaterOrEqual"] = "a_length_gte";
|
|
4677
|
-
WorkflowConditionTaskOperator2["ArrayLengthLessOrEqual"] = "a_length_lte";
|
|
4678
|
-
return WorkflowConditionTaskOperator2;
|
|
4679
|
-
})(WorkflowConditionTaskOperator || {});
|
|
4680
|
-
var WorkflowConditionTaskOperatorValueType = /* @__PURE__ */ ((WorkflowConditionTaskOperatorValueType2) => {
|
|
4681
|
-
WorkflowConditionTaskOperatorValueType2["Null"] = "null";
|
|
4682
|
-
WorkflowConditionTaskOperatorValueType2["String"] = "string";
|
|
4683
|
-
WorkflowConditionTaskOperatorValueType2["Number"] = "number";
|
|
4684
|
-
WorkflowConditionTaskOperatorValueType2["Boolean"] = "boolean";
|
|
4685
|
-
WorkflowConditionTaskOperatorValueType2["Datetime"] = "datetime";
|
|
4686
|
-
WorkflowConditionTaskOperatorValueType2["ArrayString"] = "array-string";
|
|
4687
|
-
WorkflowConditionTaskOperatorValueType2["ArrayNumber"] = "array-number";
|
|
4688
|
-
WorkflowConditionTaskOperatorValueType2["ArrayItem"] = "array-item";
|
|
4689
|
-
return WorkflowConditionTaskOperatorValueType2;
|
|
4690
|
-
})(WorkflowConditionTaskOperatorValueType || {});
|
|
4691
|
-
var WorkflowConditionTaskOperatorGroup = /* @__PURE__ */ ((WorkflowConditionTaskOperatorGroup2) => {
|
|
4692
|
-
WorkflowConditionTaskOperatorGroup2["General"] = "general";
|
|
4693
|
-
WorkflowConditionTaskOperatorGroup2["String"] = "string";
|
|
4694
|
-
WorkflowConditionTaskOperatorGroup2["Number"] = "number";
|
|
4695
|
-
WorkflowConditionTaskOperatorGroup2["Boolean"] = "boolean";
|
|
4696
|
-
WorkflowConditionTaskOperatorGroup2["Datetime"] = "datetime";
|
|
4697
|
-
WorkflowConditionTaskOperatorGroup2["Array"] = "array";
|
|
4698
|
-
return WorkflowConditionTaskOperatorGroup2;
|
|
4699
|
-
})(WorkflowConditionTaskOperatorGroup || {});
|
|
4700
|
-
var WorkflowConditionTaskFieldType = /* @__PURE__ */ ((WorkflowConditionTaskFieldType2) => {
|
|
4701
|
-
WorkflowConditionTaskFieldType2["String"] = "string";
|
|
4702
|
-
WorkflowConditionTaskFieldType2["Number"] = "number";
|
|
4703
|
-
WorkflowConditionTaskFieldType2["Integer"] = "integer";
|
|
4704
|
-
WorkflowConditionTaskFieldType2["Boolean"] = "boolean";
|
|
4705
|
-
WorkflowConditionTaskFieldType2["Array"] = "array";
|
|
4706
|
-
return WorkflowConditionTaskFieldType2;
|
|
4707
|
-
})(WorkflowConditionTaskFieldType || {});
|
|
4708
|
-
|
|
4709
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/agent.ts
|
|
4710
|
-
var WorkflowAgentTriggerSubType = {
|
|
4711
|
-
chat: "chat"
|
|
4712
|
-
};
|
|
4713
|
-
var WorkflowExecutionType = {
|
|
4714
|
-
conversational: "conversational",
|
|
4715
|
-
background: "background",
|
|
4716
|
-
hybrid: "hybrid"
|
|
4717
|
-
};
|
|
4718
|
-
|
|
4719
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/base.ts
|
|
4720
|
-
var WorkflowTriggerType = {
|
|
4721
|
-
manual: "manual_only",
|
|
4722
|
-
agent: "ai_agent",
|
|
4723
|
-
recurring: "recurring",
|
|
4724
|
-
oneTime: "one_time",
|
|
4725
|
-
webhook: "webhook",
|
|
4726
|
-
webhookManual: "webhook_manual"
|
|
4727
|
-
};
|
|
4728
|
-
|
|
4729
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/manual.ts
|
|
4730
|
-
var WorkflowManualTriggerSubType = {
|
|
4731
|
-
forSelectedChat: "for_selected_chat",
|
|
4732
|
-
forSelectedTicket: "for_selected_ticket"
|
|
4733
|
-
};
|
|
4734
|
-
var WorkflowManualTriggerSubTypeName = {
|
|
4735
|
-
[WorkflowManualTriggerSubType.forSelectedChat]: "text-livechat-manual",
|
|
4736
|
-
[WorkflowManualTriggerSubType.forSelectedTicket]: "text-helpdesk-manual"
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowElement.ts
|
|
4740
|
-
var TRIGGER_REFERENCE_NAME = "trigger";
|
|
4741
|
-
|
|
4742
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowExecution.ts
|
|
4743
|
-
var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
|
|
4744
|
-
WorkflowExecutionStatus2["Succeeded"] = "succeeded";
|
|
4745
|
-
WorkflowExecutionStatus2["Failed"] = "failed";
|
|
4746
|
-
WorkflowExecutionStatus2["Pending"] = "pending";
|
|
4747
|
-
return WorkflowExecutionStatus2;
|
|
4748
|
-
})(WorkflowExecutionStatus || {});
|
|
4749
|
-
var WorkflowExecutionDefinitionStatus = /* @__PURE__ */ ((WorkflowExecutionDefinitionStatus2) => {
|
|
4750
|
-
WorkflowExecutionDefinitionStatus2["Completed"] = "COMPLETED";
|
|
4751
|
-
WorkflowExecutionDefinitionStatus2["Failed"] = "FAILED";
|
|
4752
|
-
WorkflowExecutionDefinitionStatus2["Running"] = "RUNNING";
|
|
4753
|
-
return WorkflowExecutionDefinitionStatus2;
|
|
4754
|
-
})(WorkflowExecutionDefinitionStatus || {});
|
|
4755
|
-
|
|
4756
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowItem.ts
|
|
4757
|
-
var WorkflowItemKind = /* @__PURE__ */ ((WorkflowItemKind2) => {
|
|
4758
|
-
WorkflowItemKind2["Task"] = "task";
|
|
4759
|
-
WorkflowItemKind2["Trigger"] = "trigger";
|
|
4760
|
-
return WorkflowItemKind2;
|
|
4761
|
-
})(WorkflowItemKind || {});
|
|
4762
|
-
|
|
4763
|
-
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowTemplate.ts
|
|
4764
|
-
var WorkflowTemplateCategory = /* @__PURE__ */ ((WorkflowTemplateCategory2) => {
|
|
4765
|
-
WorkflowTemplateCategory2["NotificationAndAlerts"] = "Notifications & alerts";
|
|
4766
|
-
WorkflowTemplateCategory2["SalesManagement"] = "Sales management";
|
|
4767
|
-
WorkflowTemplateCategory2["LeadCollection"] = "Lead collection";
|
|
4768
|
-
WorkflowTemplateCategory2["ChatManagement"] = "Chat management";
|
|
4769
|
-
WorkflowTemplateCategory2["CustomerExperience"] = "Customer experience";
|
|
4770
|
-
WorkflowTemplateCategory2["TicketManagement"] = "Ticket management";
|
|
4771
|
-
return WorkflowTemplateCategory2;
|
|
4772
|
-
})(WorkflowTemplateCategory || {});
|
|
4773
|
-
|
|
4774
|
-
// src/constants/app/templates/repository.ts
|
|
4775
|
-
var appRepositoryTemplatesMap = {
|
|
4776
|
-
"livechat/developer-app-template-nextjs": "nextjs",
|
|
4777
|
-
"livechat/developer-app-template-vite": "vite",
|
|
4778
|
-
"livechat/developer-app-template-saas": "saas"
|
|
4779
|
-
};
|
|
4780
|
-
var appRepositoryTemplates = {
|
|
4781
|
-
nextjs: {
|
|
4782
|
-
id: "nextjs",
|
|
4783
|
-
description: "Uses the most popular and versatile features from our SDKs:",
|
|
4784
|
-
tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
|
|
4785
|
-
name: "Fullstack Next.js template",
|
|
4786
|
-
repository: {
|
|
4787
|
-
name: "livechat/developer-app-template-nextjs",
|
|
4788
|
-
target: "nextjs"
|
|
4789
|
-
}
|
|
4790
|
-
},
|
|
4791
|
-
vite: {
|
|
4792
|
-
id: "vite",
|
|
4793
|
-
name: "Vite template",
|
|
4794
|
-
description: "Implements the same base functionalities as the Next.js template except for webhooks:",
|
|
4795
|
-
tags: ["Auth", "Agent App SDK", "Moments"],
|
|
4796
|
-
repository: {
|
|
4797
|
-
name: "livechat/developer-app-template-vite",
|
|
4798
|
-
target: "browser"
|
|
4799
|
-
}
|
|
4800
|
-
},
|
|
4801
|
-
saas: {
|
|
4802
|
-
id: "saas",
|
|
4803
|
-
name: "Nextjs SaaS boilerplate",
|
|
4804
|
-
description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
|
|
4805
|
-
tags: [],
|
|
4806
|
-
repository: {
|
|
4807
|
-
name: "livechat/developer-app-template-saas",
|
|
4808
|
-
target: "nextjs"
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
};
|
|
4812
|
-
|
|
4813
|
-
// src/constants/app/templates/app.ts
|
|
4814
|
-
var appTemplatesMap = {
|
|
4815
|
-
"livechat/developer-app-template-saas": "saas"
|
|
4816
|
-
};
|
|
4817
|
-
var appBaseTemplates = {
|
|
4818
|
-
"tag-master": {
|
|
4819
|
-
id: "tag-master",
|
|
4820
|
-
name: "Tag Master",
|
|
4821
|
-
category: { name: "Agent App Widget" },
|
|
4822
|
-
description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
|
|
4823
|
-
tags: ["Accounts SDK", "NextJS", "Configuration API"],
|
|
4824
|
-
link: "https://github.com/bstopyra/tag-master-template",
|
|
4825
|
-
icons: {},
|
|
4826
|
-
repository: {
|
|
4827
|
-
name: "bstopyra/tag-master-template",
|
|
4828
|
-
target: "node"
|
|
4829
|
-
}
|
|
4830
|
-
},
|
|
4831
|
-
progress: {
|
|
4832
|
-
id: "progress",
|
|
4833
|
-
name: "Progress",
|
|
4834
|
-
category: { name: "Agent App Widget" },
|
|
4835
|
-
description: "Creates reports based on data from chats: ratings, chatting time, response time.",
|
|
4836
|
-
tags: ["Accounts SDK", "NextJS", "Reports API"],
|
|
4837
|
-
link: "https://github.com/livechat/progress-app",
|
|
4838
|
-
icons: {},
|
|
4839
|
-
repository: {
|
|
4840
|
-
name: "livechat/progress-app",
|
|
4841
|
-
target: "node"
|
|
4842
|
-
}
|
|
4843
|
-
},
|
|
4844
|
-
supervisor: {
|
|
4845
|
-
id: "supervisor",
|
|
4846
|
-
name: "Supervisor",
|
|
4847
|
-
category: { name: "Agent App Widget" },
|
|
4848
|
-
description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
|
|
4849
|
-
tags: ["Accounts SDK", "NextJS", "Reports API"],
|
|
4850
|
-
link: "https://github.com/livechat/supervisor-app",
|
|
4851
|
-
icons: {},
|
|
4852
|
-
repository: {
|
|
4853
|
-
name: "livechat/supervisor-app",
|
|
4854
|
-
target: "node"
|
|
4855
|
-
}
|
|
4856
|
-
},
|
|
4857
|
-
popup: {
|
|
4858
|
-
id: "popup",
|
|
4859
|
-
name: "Popup app",
|
|
4860
|
-
category: { name: "Agent App Widget" },
|
|
4861
|
-
description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
|
|
4862
|
-
tags: ["Accounts SDK", "Popup flow", "Widget"],
|
|
4863
|
-
link: "https://github.com/livechat/sample-app-popup-auth",
|
|
4864
|
-
icons: {},
|
|
4865
|
-
repository: {
|
|
4866
|
-
name: "livechat/sample-app-popup-auth",
|
|
4867
|
-
target: "node"
|
|
4868
|
-
}
|
|
4869
|
-
},
|
|
4870
|
-
redirect: {
|
|
4871
|
-
id: "redirect",
|
|
4872
|
-
name: "Redirect app",
|
|
4873
|
-
category: { name: "Agent App Widget" },
|
|
4874
|
-
description: "See how to implement the redirect authorization flow from the Accounts SDK.",
|
|
4875
|
-
tags: ["Accounts SDK", "Redirect flow", "Widget"],
|
|
4876
|
-
link: "https://github.com/livechat/sample-app-redirect-auth",
|
|
4877
|
-
icons: {},
|
|
4878
|
-
repository: {
|
|
4879
|
-
name: "livechat/sample-app-redirect-auth",
|
|
4880
|
-
target: "node"
|
|
4881
|
-
}
|
|
4882
|
-
}
|
|
4883
|
-
};
|
|
4884
|
-
var appTemplates = {
|
|
4885
|
-
saas: {
|
|
4886
|
-
id: "saas",
|
|
4887
|
-
name: "Nextjs SaaS boilerplate",
|
|
4888
|
-
category: { name: "Agent App Widget" },
|
|
4889
|
-
description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
|
|
4890
|
-
tags: ["UI", "Auth", "Payments", "Analytics"],
|
|
4891
|
-
template: true,
|
|
4892
|
-
manifest: {
|
|
4893
|
-
name: "Nextjs SaaS boilerplate",
|
|
4894
|
-
product: "livechat",
|
|
4895
|
-
blocks: {
|
|
4896
|
-
repository: {
|
|
4897
|
-
provider: "github",
|
|
4898
|
-
name: "livechat/developer-app-template-saas",
|
|
4899
|
-
branch: "main",
|
|
4900
|
-
target: "nextjs"
|
|
4901
|
-
},
|
|
4902
|
-
deployment: {
|
|
4903
|
-
provider: "vercel",
|
|
4904
|
-
url: ""
|
|
4905
|
-
},
|
|
4906
|
-
authorization: {
|
|
4907
|
-
type: "javascript_app",
|
|
4908
|
-
redirectUri: ""
|
|
4909
|
-
},
|
|
4910
|
-
widgets: {
|
|
4911
|
-
"chat-details": {
|
|
4912
|
-
placement: "plugin",
|
|
4913
|
-
url: "/livechat/details"
|
|
4914
|
-
},
|
|
4915
|
-
fullscreen: {
|
|
4916
|
-
placement: "fullscreen",
|
|
4917
|
-
url: "/livechat/fullscreen"
|
|
4918
|
-
}
|
|
4919
|
-
},
|
|
4920
|
-
monetization: {
|
|
4921
|
-
frequency: "monthly",
|
|
4922
|
-
charge: "organization",
|
|
4923
|
-
price: 500,
|
|
4924
|
-
trialDays: 7
|
|
4925
|
-
}
|
|
4926
|
-
}
|
|
4927
|
-
}
|
|
4928
|
-
}
|
|
4929
|
-
};
|
|
4930
|
-
var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
|
|
4931
|
-
|
|
4932
|
-
// src/constants/auth/headers.ts
|
|
4933
|
-
var PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization";
|
|
4934
|
-
var ACCOUNT_ID_HEADER = "X-Account-ID";
|
|
4935
|
-
var ORGANIZATION_ID_HEADER = "X-Organization-ID";
|
|
4936
|
-
var SERVICE_ACCOUNT_ID_HEADER = "X-Service-Account-ID";
|
|
4937
|
-
var SERVICE_ORGANIZATION_ID_HEADER = "X-Service-Organization-ID";
|
|
4938
|
-
|
|
4939
|
-
// src/constants/notifications.ts
|
|
4940
|
-
var API_NOTIFICATIONS = {
|
|
4941
|
-
BUILDING_BLOCKS: {
|
|
4942
|
-
SUCCESS: {
|
|
4943
|
-
CREATED: "Building block created successfully.",
|
|
4944
|
-
UPDATED: "Building block updated successfully.",
|
|
4945
|
-
DELETED: "Building block deleted successfully."
|
|
4946
|
-
},
|
|
4947
|
-
FAILURE: {
|
|
4948
|
-
CREATED: "Building block couldn't be created.",
|
|
4949
|
-
UPDATED: "Building block couldn't be updated.",
|
|
4950
|
-
DELETED: "Building block couldn't be deleted."
|
|
4951
|
-
}
|
|
4952
|
-
}
|
|
4953
|
-
};
|
|
4954
|
-
|
|
4955
|
-
// src/apis/integrations/text/platform/workflow/workflows/internal/crm/instance.ts
|
|
4956
|
-
function getWorkflowApiCrmConfig(authorization) {
|
|
4957
|
-
var _a, _b, _c, _d;
|
|
4958
|
-
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4959
|
-
ensureAuthorizationToken: true
|
|
4960
|
-
}));
|
|
4961
|
-
return __spreadProps(__spreadValues({}, config), {
|
|
4962
|
-
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (_a = config.headers) != null ? _a : {}), ((_b = authorization == null ? void 0 : authorization.internal) == null ? void 0 : _b.token) ? {
|
|
4963
|
-
[PROXY_AUTHORIZATION_HEADER]: `Bearer ${authorization.internal.token}`
|
|
4964
|
-
} : {}), ((_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 } : {})
|
|
4965
|
-
});
|
|
4966
|
-
}
|
|
4967
|
-
|
|
4968
|
-
// src/apis/integrations/vercel/instance.ts
|
|
4969
|
-
var import_axios23 = __toESM(require("axios"));
|
|
4970
|
-
function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
|
|
4971
|
-
if (req.headers instanceof Headers) {
|
|
4972
|
-
return {
|
|
4973
|
-
token: req.headers.get(`${headerPrefix}-token`)
|
|
4974
|
-
};
|
|
4975
|
-
}
|
|
4976
|
-
return {
|
|
4977
|
-
token: req.headers[`${headerPrefix}-token`]
|
|
4978
|
-
};
|
|
4979
|
-
}
|
|
4980
|
-
var vercelClientInstance = import_axios23.default.create({
|
|
4981
|
-
baseURL: "https://api.vercel.com"
|
|
4982
|
-
});
|
|
4983
|
-
vercelClientInstance.interceptors.response.use(
|
|
4984
|
-
(r) => r,
|
|
4985
|
-
(error) => {
|
|
4986
|
-
var _a, _b;
|
|
4987
|
-
if (import_axios23.default.isAxiosError(error)) {
|
|
4988
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
|
|
4989
|
-
throw new UnauthorizeApiError("vercel");
|
|
4990
|
-
}
|
|
4991
|
-
}
|
|
4992
|
-
throw error;
|
|
4993
|
-
}
|
|
4994
|
-
);
|
|
4995
|
-
function getVercelClientConfig(options = {}) {
|
|
4996
|
-
var _a;
|
|
4997
|
-
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
4998
|
-
const config = {
|
|
4999
|
-
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
|
|
5000
|
-
};
|
|
5001
|
-
if (options.ensureAuthorizationToken && !config.authorization) {
|
|
5002
|
-
throw new UnauthorizeApiError("vercel");
|
|
5003
|
-
}
|
|
5004
|
-
return {
|
|
5005
|
-
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
5006
|
-
};
|
|
5007
|
-
}
|
|
5008
|
-
function initVercelClient(token) {
|
|
5009
|
-
if (token) {
|
|
5010
|
-
updateVercelClient(token);
|
|
5011
|
-
}
|
|
5012
|
-
}
|
|
5013
|
-
function updateVercelClient(token) {
|
|
5014
|
-
const headers = vercelClientInstance.defaults.headers;
|
|
5015
|
-
if (token) {
|
|
5016
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5017
|
-
} else {
|
|
5018
|
-
delete headers.Authorization;
|
|
5019
|
-
}
|
|
5020
|
-
}
|
|
5021
|
-
|
|
5022
|
-
// src/apis/platform/accounts/instance.ts
|
|
5023
|
-
var AccountsApiError = class extends ApiErrorBase {
|
|
5024
|
-
constructor() {
|
|
5025
|
-
super(...arguments);
|
|
5026
|
-
this.name = "accounts";
|
|
5027
|
-
}
|
|
5028
|
-
};
|
|
5029
|
-
var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
|
|
5030
|
-
constructor(message) {
|
|
5031
|
-
super("accounts", message);
|
|
5032
|
-
}
|
|
5033
|
-
};
|
|
5034
|
-
var AccountApiClient = class extends ApiClient {
|
|
5035
|
-
constructor() {
|
|
5036
|
-
super(...arguments);
|
|
5037
|
-
this.UnauthorizedError = UnauthorizeAccountsApiError;
|
|
5038
|
-
this.Error = AccountsApiError;
|
|
5039
|
-
this.options = {
|
|
5040
|
-
headers: {
|
|
5041
|
-
"Content-Type": "application/json"
|
|
5042
|
-
}
|
|
5043
|
-
};
|
|
5044
|
-
}
|
|
5045
|
-
};
|
|
5046
|
-
var platformAccountsClientInstance = new AccountApiClient({
|
|
5047
|
-
baseURL: "https://accounts.labs.livechatinc.com"
|
|
5048
|
-
});
|
|
5049
|
-
function initPlatformAccountsClient(baseUrl, token) {
|
|
5050
|
-
if (baseUrl) {
|
|
5051
|
-
platformAccountsClientInstance.updateConfig({
|
|
5052
|
-
baseURL: baseUrl
|
|
5053
|
-
});
|
|
5054
|
-
}
|
|
5055
|
-
platformAccountsClientInstance.updateAuthorization({
|
|
5056
|
-
token
|
|
5057
|
-
});
|
|
5058
|
-
}
|
|
5059
|
-
|
|
5060
|
-
// src/apis/platform/billing/instance.ts
|
|
5061
|
-
var import_axios24 = __toESM(require("axios"));
|
|
5062
|
-
var billingClientInstance = import_axios24.default.create({
|
|
5063
|
-
baseURL: "https://billing.labs.livechatinc.com"
|
|
5064
|
-
});
|
|
5065
|
-
function getBillingClientConfig(options = {}) {
|
|
5066
|
-
var _a;
|
|
5067
|
-
const defaultAuthorization = billingClientInstance.defaults.headers.Authorization;
|
|
5068
|
-
const headers = {
|
|
5069
|
-
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
|
|
5070
|
-
};
|
|
5071
|
-
return {
|
|
5072
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5073
|
-
};
|
|
5074
|
-
}
|
|
5075
|
-
function initBillingClient(baseUrl, token) {
|
|
5076
|
-
if (baseUrl) {
|
|
5077
|
-
billingClientInstance.interceptors.request.use(
|
|
5078
|
-
(config) => {
|
|
5079
|
-
config.baseURL = baseUrl;
|
|
5080
|
-
return config;
|
|
5081
|
-
},
|
|
5082
|
-
(error) => Promise.reject(error)
|
|
5083
|
-
);
|
|
5084
|
-
}
|
|
5085
|
-
if (token) {
|
|
5086
|
-
billingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
5087
|
-
} else {
|
|
5088
|
-
delete billingClientInstance.defaults.headers.Authorization;
|
|
5089
|
-
}
|
|
5090
|
-
}
|
|
5091
|
-
|
|
5092
|
-
// src/apis/platform/cdp/events/_contracts/payloads/events.ts
|
|
5093
|
-
var import_zod12 = require("zod");
|
|
5094
|
-
var CdpCustomerEventType = /* @__PURE__ */ ((CdpCustomerEventType2) => {
|
|
5095
|
-
CdpCustomerEventType2["EmailSet"] = "customer_email_set";
|
|
5096
|
-
CdpCustomerEventType2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
|
|
5097
|
-
return CdpCustomerEventType2;
|
|
5098
|
-
})(CdpCustomerEventType || {});
|
|
5099
|
-
var customerMetadataZod = import_zod12.z.object({
|
|
5100
|
-
organization_id: import_zod12.z.string(),
|
|
5101
|
-
customer_id: import_zod12.z.string(),
|
|
5102
|
-
master_id: import_zod12.z.string()
|
|
5103
|
-
});
|
|
5104
|
-
var cdpCustomerEventMessageZod = import_zod12.z.discriminatedUnion("type", [
|
|
5105
|
-
import_zod12.z.object({
|
|
5106
|
-
id: import_zod12.z.string(),
|
|
5107
|
-
type: import_zod12.z.literal("customer_email_set" /* EmailSet */),
|
|
5108
|
-
data: customerMetadataZod.extend({
|
|
5109
|
-
email: import_zod12.z.string()
|
|
5110
|
-
}).passthrough()
|
|
5111
|
-
}),
|
|
5112
|
-
import_zod12.z.object({
|
|
5113
|
-
id: import_zod12.z.string(),
|
|
5114
|
-
type: import_zod12.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
|
|
5115
|
-
data: customerMetadataZod.extend({
|
|
5116
|
-
customer_properties: import_zod12.z.record(
|
|
5117
|
-
import_zod12.z.object({
|
|
5118
|
-
value: import_zod12.z.unknown(),
|
|
5119
|
-
last_updated_at: import_zod12.z.string(),
|
|
5120
|
-
last_updated_agent_account_id: import_zod12.z.string().optional(),
|
|
5121
|
-
last_updated_agent_client_id: import_zod12.z.string().optional()
|
|
5122
|
-
}).passthrough()
|
|
5123
|
-
)
|
|
5124
|
-
}).passthrough()
|
|
5125
|
-
})
|
|
5126
|
-
]);
|
|
5127
|
-
|
|
5128
|
-
// src/apis/platform/console/instance.ts
|
|
5129
|
-
var import_axios25 = __toESM(require("axios"));
|
|
5130
|
-
var REGION = {
|
|
5131
|
-
FRA: "fra",
|
|
5132
|
-
DAL: "dal",
|
|
5133
|
-
FRA_A: "fra-a",
|
|
5134
|
-
FRA_B: "fra-b"
|
|
5135
|
-
};
|
|
5136
|
-
var supportedRegions = Object.values(REGION);
|
|
5137
|
-
var getRegion = (token) => {
|
|
5138
|
-
const region = token.split(":")[0];
|
|
5139
|
-
if (supportedRegions.includes(region)) {
|
|
5140
|
-
return region;
|
|
5141
|
-
}
|
|
5142
|
-
};
|
|
5143
|
-
var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
|
|
5144
|
-
constructor() {
|
|
5145
|
-
super(...arguments);
|
|
5146
|
-
this.name = "console";
|
|
5147
|
-
}
|
|
5148
|
-
static notFound(message) {
|
|
5149
|
-
return new _ConsoleApiError(
|
|
5150
|
-
message != null ? message : "Not found",
|
|
5151
|
-
{
|
|
5152
|
-
errorCode: "not_found",
|
|
5153
|
-
errorMessage: "Not found"
|
|
5154
|
-
},
|
|
5155
|
-
404
|
|
5156
|
-
);
|
|
5157
|
-
}
|
|
5158
|
-
};
|
|
5159
|
-
var consoleClientInstance = import_axios25.default.create({
|
|
5160
|
-
baseURL: "https://platform.labs.text.com/console/api",
|
|
5161
|
-
headers: {
|
|
5162
|
-
"Content-Type": "application/json"
|
|
5163
|
-
}
|
|
5164
|
-
});
|
|
5165
|
-
consoleClientInstance.interceptors.response.use(
|
|
5166
|
-
(response) => response,
|
|
5167
|
-
(error) => {
|
|
5168
|
-
var _a, _b;
|
|
5169
|
-
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
5170
|
-
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
5171
|
-
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
5172
|
-
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
5173
|
-
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
5174
|
-
return Promise.reject(
|
|
5175
|
-
new ConsoleApiError(data.message, data.data, data.code)
|
|
5176
|
-
);
|
|
5177
|
-
}
|
|
5178
|
-
return Promise.reject(error);
|
|
5179
|
-
}
|
|
5180
|
-
);
|
|
5181
|
-
function getConsoleClientConfig(options = {}) {
|
|
5182
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
5183
|
-
const currentHeaders = consoleClientInstance.defaults.headers;
|
|
5184
|
-
const headers = {
|
|
5185
|
-
platform: {
|
|
5186
|
-
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
5187
|
-
},
|
|
5188
|
-
integrations: {
|
|
5189
|
-
github: {
|
|
5190
|
-
app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
|
|
5191
|
-
oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
|
|
5192
|
-
},
|
|
5193
|
-
netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
|
|
5194
|
-
vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
|
|
5195
|
-
planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
|
|
5196
|
-
neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
|
|
5197
|
-
}
|
|
5198
|
-
};
|
|
5199
|
-
if (currentHeaders.Authorization) {
|
|
5200
|
-
currentHeaders["X-Region"] = (_p = getRegion(currentHeaders.Authorization)) != null ? _p : void 0;
|
|
5201
|
-
}
|
|
5202
|
-
if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
|
|
5203
|
-
throw new UnauthorizeApiError("accounts");
|
|
5204
|
-
}
|
|
5205
|
-
if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
5206
|
-
throw new UnauthorizeApiError("github");
|
|
5207
|
-
}
|
|
5208
|
-
if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
|
|
5209
|
-
throw new UnauthorizeApiError("vercel");
|
|
5210
|
-
}
|
|
5211
|
-
if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
|
|
5212
|
-
throw new UnauthorizeApiError("netlify");
|
|
5213
|
-
}
|
|
5214
|
-
if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
|
|
5215
|
-
throw new UnauthorizeApiError("planetscale");
|
|
5216
|
-
}
|
|
5217
|
-
if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
|
|
5218
|
-
throw new UnauthorizeApiError("neon");
|
|
5219
|
-
}
|
|
5220
|
-
return {
|
|
5221
|
-
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {})
|
|
5222
|
-
};
|
|
5223
|
-
}
|
|
5224
|
-
var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5225
|
-
ensureAuthorizationToken: {
|
|
5226
|
-
platform: true
|
|
5227
|
-
}
|
|
5228
|
-
}));
|
|
5229
|
-
function initConsoleClient(baseUrl, tokens) {
|
|
5230
|
-
if (baseUrl) {
|
|
5231
|
-
consoleClientInstance.interceptors.request.use(
|
|
5232
|
-
(config) => {
|
|
5233
|
-
config.baseURL = baseUrl;
|
|
5234
|
-
return config;
|
|
5235
|
-
},
|
|
5236
|
-
(error) => Promise.reject(error)
|
|
5237
|
-
);
|
|
5238
|
-
}
|
|
5239
|
-
if (tokens) {
|
|
5240
|
-
updateConsoleClient(tokens);
|
|
5241
|
-
}
|
|
5242
|
-
}
|
|
5243
|
-
function updateConsoleClient(tokens) {
|
|
5244
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5245
|
-
const headers = consoleClientInstance.defaults.headers;
|
|
5246
|
-
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5247
|
-
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
5248
|
-
}
|
|
5249
|
-
if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
|
|
5250
|
-
headers["x-adapter-github-app-token"] = tokens.github.appToken;
|
|
5251
|
-
}
|
|
5252
|
-
if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
|
|
5253
|
-
headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
|
|
5254
|
-
}
|
|
5255
|
-
if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
|
|
5256
|
-
headers["x-adapter-netlify-token"] = tokens.netlify.token;
|
|
5257
|
-
}
|
|
5258
|
-
if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
|
|
5259
|
-
headers["x-adapter-vercel-token"] = tokens.vercel.token;
|
|
5260
|
-
}
|
|
5261
|
-
if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
|
|
5262
|
-
headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
|
|
5263
|
-
}
|
|
5264
|
-
if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
|
|
5265
|
-
headers["x-adapter-neon-token"] = tokens.neon.token;
|
|
5266
|
-
}
|
|
5267
|
-
}
|
|
5268
|
-
|
|
5269
|
-
// src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
|
|
5270
|
-
var getEmptyAppAutoReview = () => ({
|
|
5271
|
-
isReviewed: false,
|
|
5272
|
-
recommendations: {
|
|
5273
|
-
listingDetails: {
|
|
5274
|
-
appName: "",
|
|
5275
|
-
shortDescription: "",
|
|
5276
|
-
longDescription: "",
|
|
5277
|
-
features: "",
|
|
5278
|
-
benefits: ""
|
|
5279
|
-
},
|
|
5280
|
-
auth: {
|
|
5281
|
-
hasZeroScopes: false
|
|
5282
|
-
}
|
|
5283
|
-
},
|
|
5284
|
-
errors: {
|
|
5285
|
-
listingDetails: {
|
|
5286
|
-
appName: "",
|
|
5287
|
-
shortDescription: "",
|
|
5288
|
-
longDescription: "",
|
|
5289
|
-
features: "",
|
|
5290
|
-
benefits: ""
|
|
5291
|
-
},
|
|
5292
|
-
auth: {
|
|
5293
|
-
hasAllScopes: false,
|
|
5294
|
-
isRedirectUriSafe: false
|
|
5295
|
-
},
|
|
5296
|
-
links: {
|
|
5297
|
-
tutorial: {
|
|
5298
|
-
returns200: false,
|
|
5299
|
-
isValid: false
|
|
5300
|
-
},
|
|
5301
|
-
privacyPolicy: {
|
|
5302
|
-
returns200: false,
|
|
5303
|
-
isValid: false
|
|
5304
|
-
}
|
|
5305
|
-
},
|
|
5306
|
-
images: {
|
|
5307
|
-
icon: {
|
|
5308
|
-
isNsfw: false,
|
|
5309
|
-
isRatioValid: false
|
|
5310
|
-
},
|
|
5311
|
-
screenshots: {
|
|
5312
|
-
areEmpty: false,
|
|
5313
|
-
areNsfw: false,
|
|
5314
|
-
areRatiosValid: false
|
|
5315
|
-
}
|
|
5316
|
-
}
|
|
5317
|
-
}
|
|
5318
|
-
});
|
|
5319
|
-
|
|
5320
|
-
// src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
|
|
5321
|
-
var getAppAutoReviewPayload = (value) => {
|
|
5322
|
-
return {
|
|
5323
|
-
appName: value,
|
|
5324
|
-
shortDescription: value,
|
|
5325
|
-
longDescription: value,
|
|
5326
|
-
features: value,
|
|
5327
|
-
benefits: value,
|
|
5328
|
-
scopes: value,
|
|
5329
|
-
redirect: value,
|
|
5330
|
-
tutorial: value,
|
|
5331
|
-
privacyPolicy: value,
|
|
5332
|
-
icons: value,
|
|
5333
|
-
screenshots: value
|
|
5334
|
-
};
|
|
5335
|
-
};
|
|
5336
|
-
|
|
5337
|
-
// src/apis/platform/dps/instance.ts
|
|
5338
|
-
var import_axios26 = __toESM(require("axios"));
|
|
5339
|
-
var DpsApiError = class extends ApiErrorBase {
|
|
5340
|
-
constructor() {
|
|
5341
|
-
super(...arguments);
|
|
5342
|
-
this.name = "dps";
|
|
5343
|
-
}
|
|
5344
|
-
};
|
|
5345
|
-
var dpsClientInstance = import_axios26.default.create({
|
|
5346
|
-
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
5347
|
-
});
|
|
5348
|
-
dpsClientInstance.interceptors.response.use(
|
|
5349
|
-
(response) => response,
|
|
5350
|
-
(error) => {
|
|
5351
|
-
var _a, _b, _c, _d;
|
|
5352
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
|
|
5353
|
-
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
5354
|
-
}
|
|
5355
|
-
return Promise.reject(
|
|
5356
|
-
new DpsApiError(
|
|
5357
|
-
error.message,
|
|
5358
|
-
(_b = error.response) == null ? void 0 : _b.data,
|
|
5359
|
-
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
5360
|
-
)
|
|
5361
|
-
);
|
|
5362
|
-
}
|
|
5363
|
-
);
|
|
5364
|
-
function getDpsClientConfig(options = {}) {
|
|
5365
|
-
var _a, _b;
|
|
5366
|
-
const currentHeaders = dpsClientInstance.defaults.headers;
|
|
5367
|
-
const defaultAuthorization = currentHeaders.Authorization;
|
|
5368
|
-
const headers = {
|
|
5369
|
-
authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization
|
|
5370
|
-
};
|
|
5371
|
-
return {
|
|
5372
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5373
|
-
};
|
|
5374
|
-
}
|
|
5375
|
-
function initDpsClient(baseUrl, token) {
|
|
5376
|
-
const headers = dpsClientInstance.defaults.headers;
|
|
5377
|
-
if (baseUrl) {
|
|
5378
|
-
dpsClientInstance.interceptors.request.use(
|
|
5379
|
-
(config) => {
|
|
5380
|
-
config.baseURL = baseUrl;
|
|
5381
|
-
return config;
|
|
5382
|
-
},
|
|
5383
|
-
(error) => Promise.reject(error)
|
|
5384
|
-
);
|
|
5385
|
-
}
|
|
5386
|
-
if (token) {
|
|
5387
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5388
|
-
} else {
|
|
5389
|
-
delete headers.Authorization;
|
|
5390
|
-
}
|
|
5391
|
-
}
|
|
5392
|
-
|
|
5393
|
-
// src/apis/products/helpdesk/instance.ts
|
|
5394
|
-
var import_axios27 = __toESM(require("axios"));
|
|
5395
|
-
var HelpDeskApiError = class extends ApiErrorBase {
|
|
5396
|
-
constructor() {
|
|
5397
|
-
super(...arguments);
|
|
5398
|
-
this.name = "helpdesk";
|
|
5399
|
-
}
|
|
5400
|
-
};
|
|
5401
|
-
var helpdeskClientInstance = import_axios27.default.create({
|
|
5402
|
-
baseURL: "https://api.labs.helpdesk.com"
|
|
5403
|
-
});
|
|
5404
|
-
helpdeskClientInstance.interceptors.response.use(
|
|
5405
|
-
(response) => response,
|
|
5406
|
-
(error) => {
|
|
5407
|
-
var _a, _b, _c, _d;
|
|
5408
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
5409
|
-
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
5410
|
-
}
|
|
5411
|
-
return Promise.reject(
|
|
5412
|
-
new HelpDeskApiError(
|
|
5413
|
-
error.message,
|
|
5414
|
-
(_b = error.response) == null ? void 0 : _b.data,
|
|
5415
|
-
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
5416
|
-
)
|
|
5417
|
-
);
|
|
5418
|
-
}
|
|
5419
|
-
);
|
|
5420
|
-
function getHelpDeskClientConfig(options = {}) {
|
|
5421
|
-
var _a, _b;
|
|
5422
|
-
const currentHeaders = helpdeskClientInstance.defaults.headers;
|
|
5423
|
-
const defaultAuthorization = currentHeaders.Authorization;
|
|
5424
|
-
const headers = {
|
|
5425
|
-
authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization
|
|
5426
|
-
};
|
|
5427
|
-
return {
|
|
5428
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5429
|
-
};
|
|
5430
|
-
}
|
|
5431
|
-
function initHelpDeskClient(baseUrl, token) {
|
|
5432
|
-
const headers = helpdeskClientInstance.defaults.headers;
|
|
5433
|
-
if (baseUrl) {
|
|
5434
|
-
helpdeskClientInstance.interceptors.request.use(
|
|
5435
|
-
(config) => {
|
|
5436
|
-
config.baseURL = baseUrl;
|
|
5437
|
-
return config;
|
|
5438
|
-
},
|
|
5439
|
-
(error) => Promise.reject(error)
|
|
5440
|
-
);
|
|
5441
|
-
}
|
|
5442
|
-
if (token) {
|
|
5443
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5444
|
-
} else {
|
|
5445
|
-
delete headers.Authorization;
|
|
5446
|
-
}
|
|
5447
|
-
}
|
|
5448
|
-
|
|
5449
|
-
// src/apis/products/helpdesk/webhooks/_contracts/dtos/webhook.ts
|
|
5450
|
-
var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
|
|
5451
|
-
HelpDeskWebhookEventType2["TicketCreated"] = "tickets.create";
|
|
5452
|
-
HelpDeskWebhookEventType2["TicketUpdated"] = "tickets.update";
|
|
5453
|
-
HelpDeskWebhookEventType2["TicketStatusChanged"] = "tickets.events.status";
|
|
5454
|
-
HelpDeskWebhookEventType2["TicketPriorityChanged"] = "tickets.events.priority";
|
|
5455
|
-
HelpDeskWebhookEventType2["TicketTagsChanged"] = "tickets.events.tags";
|
|
5456
|
-
HelpDeskWebhookEventType2["TicketFollowersChanged"] = "tickets.events.followers";
|
|
5457
|
-
HelpDeskWebhookEventType2["TicketAssignmentChanged"] = "tickets.events.assignment";
|
|
5458
|
-
HelpDeskWebhookEventType2["TicketCustomFieldsChanged"] = "tickets.events.customFields";
|
|
5459
|
-
HelpDeskWebhookEventType2["TicketMessageAdded"] = "tickets.events.message";
|
|
5460
|
-
return HelpDeskWebhookEventType2;
|
|
5461
|
-
})(HelpDeskWebhookEventType || {});
|
|
5462
|
-
|
|
5463
|
-
// src/apis/products/livechat/configuration/webhooks/_contracts/dtos/webhook.ts
|
|
5464
|
-
var LivechatWebhookActions = /* @__PURE__ */ ((LivechatWebhookActions2) => {
|
|
5465
|
-
LivechatWebhookActions2["IncomingChat"] = "incoming_chat";
|
|
5466
|
-
LivechatWebhookActions2["ChatDeactivated"] = "chat_deactivated";
|
|
5467
|
-
LivechatWebhookActions2["ChatAccessUpdated"] = "chat_access_updated";
|
|
5468
|
-
LivechatWebhookActions2["ChatTransferred"] = "chat_transferred";
|
|
5469
|
-
LivechatWebhookActions2["UserAddedToChat"] = "user_added_to_chat";
|
|
5470
|
-
LivechatWebhookActions2["UserRemovedFromChat"] = "user_removed_from_chat";
|
|
5471
|
-
LivechatWebhookActions2["IncomingEvent"] = "incoming_event";
|
|
5472
|
-
LivechatWebhookActions2["IncomingRichMessagePostback"] = "incoming_rich_message_postback";
|
|
5473
|
-
LivechatWebhookActions2["ThreadTagged"] = "thread_tagged";
|
|
5474
|
-
LivechatWebhookActions2["ThreadUntagged"] = "thread_untagged";
|
|
5475
|
-
LivechatWebhookActions2["IncomingCustomer"] = "incoming_customer";
|
|
5476
|
-
return LivechatWebhookActions2;
|
|
5477
|
-
})(LivechatWebhookActions || {});
|
|
5478
|
-
var LivechatWebhookEvents = /* @__PURE__ */ ((LivechatWebhookEvents2) => {
|
|
5479
|
-
LivechatWebhookEvents2["Message"] = "message";
|
|
5480
|
-
LivechatWebhookEvents2["File"] = "file";
|
|
5481
|
-
LivechatWebhookEvents2["RichMessage"] = "rich_message";
|
|
5482
|
-
LivechatWebhookEvents2["Form"] = "form";
|
|
5483
|
-
LivechatWebhookEvents2["FilledForm"] = "filled_form";
|
|
5484
|
-
LivechatWebhookEvents2["Custom"] = "custom";
|
|
5485
|
-
LivechatWebhookEvents2["SystemMessage"] = "system_message";
|
|
5486
|
-
LivechatWebhookEvents2["System"] = "system";
|
|
5487
|
-
return LivechatWebhookEvents2;
|
|
5488
|
-
})(LivechatWebhookEvents || {});
|
|
5489
|
-
var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessages2) => {
|
|
5490
|
-
LivechatWebhookSystemMessages2["ChatRated"] = "rating.chat_rated";
|
|
5491
|
-
LivechatWebhookSystemMessages2["ChatCommented"] = "rating.chat_commented";
|
|
5492
|
-
LivechatWebhookSystemMessages2["ChatArchivedCustomerManual"] = "manual_archived_customer";
|
|
5493
|
-
LivechatWebhookSystemMessages2["ChatArchivedCustomerDisconnected"] = "archived_customer_disconnected";
|
|
5494
|
-
LivechatWebhookSystemMessages2["ChatArchivedInactive"] = "routing.archived_inactive";
|
|
5495
|
-
LivechatWebhookSystemMessages2["ChatIdle"] = "routing.idle";
|
|
5496
|
-
return LivechatWebhookSystemMessages2;
|
|
5497
|
-
})(LivechatWebhookSystemMessages || {});
|
|
5498
|
-
|
|
5499
|
-
// src/apis/products/livechat/instance.ts
|
|
5500
|
-
var import_axios28 = __toESM(require("axios"));
|
|
5501
|
-
var REGION2 = {
|
|
5502
|
-
FRA: "fra",
|
|
5503
|
-
DAL: "dal",
|
|
5504
|
-
FRA_A: "fra-a",
|
|
5505
|
-
FRA_B: "fra-b"
|
|
5506
|
-
};
|
|
5507
|
-
var supportedRegions2 = Object.values(REGION2);
|
|
5508
|
-
var getRegion2 = (token) => {
|
|
5509
|
-
const region = token.split(":")[0];
|
|
5510
|
-
if (supportedRegions2.includes(region)) {
|
|
5511
|
-
return region;
|
|
5512
|
-
}
|
|
5513
|
-
};
|
|
5514
|
-
var LivechatApiError = class extends ApiErrorBase {
|
|
5515
|
-
constructor() {
|
|
5516
|
-
super(...arguments);
|
|
5517
|
-
this.name = "livechat";
|
|
5518
|
-
}
|
|
5519
|
-
};
|
|
5520
|
-
var livechatClientInstance = import_axios28.default.create({
|
|
5521
|
-
baseURL: "https://api.labs.livechatinc.com"
|
|
5522
|
-
});
|
|
5523
|
-
livechatClientInstance.interceptors.response.use(
|
|
5524
|
-
(response) => response,
|
|
5525
|
-
(error) => {
|
|
5526
|
-
var _a, _b, _c, _d;
|
|
5527
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
5528
|
-
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
5529
|
-
}
|
|
5530
|
-
return Promise.reject(
|
|
5531
|
-
new LivechatApiError(
|
|
5532
|
-
error.message,
|
|
5533
|
-
(_b = error.response) == null ? void 0 : _b.data,
|
|
5534
|
-
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
5535
|
-
)
|
|
5536
|
-
);
|
|
5537
|
-
}
|
|
5538
|
-
);
|
|
5539
|
-
function getLiveChatClientConfig(options = {}) {
|
|
5540
|
-
var _a, _b, _c;
|
|
5541
|
-
const currentHeaders = livechatClientInstance.defaults.headers;
|
|
5542
|
-
const defaultAuthorization = currentHeaders.Authorization;
|
|
5543
|
-
const defaultRegion = currentHeaders["X-Region"];
|
|
5544
|
-
const headers = {
|
|
5545
|
-
Authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization,
|
|
5546
|
-
"X-Region": (_c = options.region) != null ? _c : defaultRegion
|
|
5547
|
-
};
|
|
5548
|
-
return {
|
|
5549
|
-
headers: __spreadValues(__spreadValues({}, headers.Authorization ? { Authorization: headers.Authorization } : {}), headers["X-Region"] ? {
|
|
5550
|
-
"X-Region": headers["X-Region"]
|
|
5551
|
-
} : {})
|
|
5552
|
-
};
|
|
5553
|
-
}
|
|
5554
|
-
function initLiveChatClient(baseUrl, token) {
|
|
5555
|
-
const region = token ? getRegion2(token) : void 0;
|
|
5556
|
-
const headers = livechatClientInstance.defaults.headers;
|
|
5557
|
-
if (baseUrl) {
|
|
5558
|
-
livechatClientInstance.interceptors.request.use(
|
|
5559
|
-
(config) => {
|
|
5560
|
-
config.baseURL = baseUrl;
|
|
5561
|
-
return config;
|
|
5562
|
-
},
|
|
5563
|
-
(error) => Promise.reject(error)
|
|
5564
|
-
);
|
|
5565
|
-
}
|
|
5566
|
-
if (region) {
|
|
5567
|
-
headers["X-Region"] = region;
|
|
5568
|
-
}
|
|
5569
|
-
if (token) {
|
|
5570
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5571
|
-
} else {
|
|
5572
|
-
delete headers.Authorization;
|
|
5573
|
-
}
|
|
5574
|
-
}
|
|
5575
|
-
|
|
5576
|
-
// src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/dtos/notification.ts
|
|
5577
|
-
var import_zod13 = require("zod");
|
|
5578
|
-
var integrationNotificationZods = {
|
|
5579
|
-
notification: import_zod13.z.object({
|
|
5580
|
-
id: import_zod13.z.string(),
|
|
5581
|
-
jobId: import_zod13.z.string().nullable(),
|
|
5582
|
-
subscription_id: import_zod13.z.string(),
|
|
5583
|
-
organization_id: import_zod13.z.string(),
|
|
5584
|
-
user_id: import_zod13.z.string().nullable(),
|
|
5585
|
-
source: import_zod13.z.string().nullable(),
|
|
5586
|
-
sourceKey: import_zod13.z.string().nullable(),
|
|
5587
|
-
target: import_zod13.z.string(),
|
|
5588
|
-
targetKey: import_zod13.z.string(),
|
|
5589
|
-
eventName: import_zod13.z.string(),
|
|
5590
|
-
callback: import_zod13.z.string(),
|
|
5591
|
-
status: import_zod13.z.string(),
|
|
5592
|
-
statusCode: import_zod13.z.number().nullable(),
|
|
5593
|
-
attempts: import_zod13.z.number(),
|
|
5594
|
-
error: import_zod13.z.string().nullable(),
|
|
5595
|
-
enqueuedAt: import_zod13.z.string(),
|
|
5596
|
-
completedAt: import_zod13.z.string()
|
|
5597
|
-
})
|
|
5598
|
-
};
|
|
5599
|
-
|
|
5600
|
-
// src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/requests/notifications.ts
|
|
5601
|
-
var import_zod14 = require("zod");
|
|
5602
|
-
var integrationNotificationRequestZods = {
|
|
5603
|
-
getNotifications: import_zod14.z.object({
|
|
5604
|
-
target: import_zod14.z.string().optional(),
|
|
5605
|
-
status: import_zod14.z.string().optional(),
|
|
5606
|
-
eventName: import_zod14.z.string().optional(),
|
|
5607
|
-
search: import_zod14.z.string().optional(),
|
|
5608
|
-
page: import_zod14.z.number().optional(),
|
|
5609
|
-
size: import_zod14.z.number().optional(),
|
|
5610
|
-
order_by: import_zod14.z.enum([
|
|
5611
|
-
"id",
|
|
5612
|
-
"status",
|
|
5613
|
-
"target",
|
|
5614
|
-
"eventName",
|
|
5615
|
-
"completedAt",
|
|
5616
|
-
"organization_id",
|
|
5617
|
-
"user_id"
|
|
5618
|
-
]).optional(),
|
|
5619
|
-
order: import_zod14.z.enum(["asc", "desc"]).optional()
|
|
5620
|
-
})
|
|
5621
|
-
};
|
|
5622
|
-
|
|
5623
|
-
// src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/dtos/subscription.ts
|
|
5624
|
-
var import_zod15 = require("zod");
|
|
5625
|
-
var integrationSubscriptionZods = {
|
|
5626
|
-
subscription: import_zod15.z.object({
|
|
5627
|
-
id: import_zod15.z.string(),
|
|
5628
|
-
organization_id: import_zod15.z.string(),
|
|
5629
|
-
user_id: import_zod15.z.string(),
|
|
5630
|
-
callback: import_zod15.z.string(),
|
|
5631
|
-
source: import_zod15.z.string(),
|
|
5632
|
-
sourceKey: import_zod15.z.string(),
|
|
5633
|
-
target: import_zod15.z.string(),
|
|
5634
|
-
targets: import_zod15.z.array(
|
|
5635
|
-
import_zod15.z.object({
|
|
5636
|
-
id: import_zod15.z.string(),
|
|
5637
|
-
target: import_zod15.z.string(),
|
|
5638
|
-
targetKey: import_zod15.z.string()
|
|
5639
|
-
})
|
|
5640
|
-
).optional(),
|
|
5641
|
-
event: import_zod15.z.unknown(),
|
|
5642
|
-
orphaned_at: import_zod15.z.string().datetime().nullable(),
|
|
5643
|
-
orphaned_reason: import_zod15.z.string().nullable(),
|
|
5644
|
-
orphaned_last_hit: import_zod15.z.string().datetime().nullable(),
|
|
5645
|
-
orphaned_hit_count: import_zod15.z.number()
|
|
5646
|
-
}),
|
|
5647
|
-
stats: import_zod15.z.object({
|
|
5648
|
-
totalSubscriptions: import_zod15.z.number(),
|
|
5649
|
-
uniqueOrganizations: import_zod15.z.number(),
|
|
5650
|
-
uniqueUsers: import_zod15.z.number(),
|
|
5651
|
-
byTarget: import_zod15.z.array(import_zod15.z.object({ target: import_zod15.z.string(), count: import_zod15.z.number() })),
|
|
5652
|
-
bySource: import_zod15.z.array(import_zod15.z.object({ source: import_zod15.z.string(), count: import_zod15.z.number() })),
|
|
5653
|
-
topOrganizations: import_zod15.z.array(
|
|
5654
|
-
import_zod15.z.object({ organizationId: import_zod15.z.string(), count: import_zod15.z.number() })
|
|
5655
|
-
),
|
|
5656
|
-
topCallbackDomains: import_zod15.z.array(
|
|
5657
|
-
import_zod15.z.object({ domain: import_zod15.z.string(), count: import_zod15.z.number() })
|
|
5658
|
-
)
|
|
5659
|
-
})
|
|
5660
|
-
};
|
|
5661
|
-
|
|
5662
|
-
// src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/requests/subscriptions.ts
|
|
5663
|
-
var import_zod16 = require("zod");
|
|
5664
|
-
var integrationSubscriptionRequestZods = {
|
|
5665
|
-
getSubscriptions: import_zod16.z.object({
|
|
5666
|
-
target: import_zod16.z.string().optional(),
|
|
5667
|
-
source: import_zod16.z.string().optional(),
|
|
5668
|
-
search: import_zod16.z.string().optional(),
|
|
5669
|
-
orphaned: import_zod16.z.boolean().optional(),
|
|
5670
|
-
page: import_zod16.z.number().optional(),
|
|
5671
|
-
size: import_zod16.z.number().optional(),
|
|
5672
|
-
order_by: import_zod16.z.enum([
|
|
5673
|
-
"id",
|
|
5674
|
-
"source",
|
|
5675
|
-
"target",
|
|
5676
|
-
"organization_id",
|
|
5677
|
-
"user_id",
|
|
5678
|
-
"orphaned_at"
|
|
5679
|
-
]).optional(),
|
|
5680
|
-
order: import_zod16.z.enum(["asc", "desc"]).optional()
|
|
5681
|
-
})
|
|
5682
|
-
};
|
|
5683
|
-
|
|
5684
|
-
// src/apis/text-intelligence/workflows/adapter/instance.ts
|
|
5685
|
-
var import_axios29 = __toESM(require("axios"));
|
|
5686
|
-
var REGION3 = {
|
|
5687
|
-
FRA: "fra",
|
|
5688
|
-
DAL: "dal",
|
|
5689
|
-
FRA_A: "fra-a",
|
|
5690
|
-
FRA_B: "fra-b"
|
|
5691
|
-
};
|
|
5692
|
-
var supportedRegions3 = Object.values(REGION3);
|
|
5693
|
-
var getRegion3 = (token) => {
|
|
5694
|
-
const region = token.split(":")[0];
|
|
5695
|
-
if (supportedRegions3.includes(region)) {
|
|
5696
|
-
return region;
|
|
5697
|
-
}
|
|
5698
|
-
};
|
|
5699
|
-
var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
|
|
5700
|
-
constructor() {
|
|
5701
|
-
super(...arguments);
|
|
5702
|
-
this.name = "adapter";
|
|
5703
|
-
}
|
|
5704
|
-
static notFound(message) {
|
|
5705
|
-
return new _AdapterApiError(
|
|
5706
|
-
message != null ? message : "Not found",
|
|
5707
|
-
{
|
|
5708
|
-
errorCode: "not_found",
|
|
5709
|
-
errorMessage: "Not found"
|
|
5710
|
-
},
|
|
5711
|
-
404
|
|
5712
|
-
);
|
|
5713
|
-
}
|
|
5714
|
-
};
|
|
5715
|
-
var adapterClientInstance = import_axios29.default.create({
|
|
5716
|
-
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
5717
|
-
headers: {
|
|
5718
|
-
"Content-Type": "application/json"
|
|
5719
|
-
}
|
|
5720
|
-
});
|
|
5721
|
-
adapterClientInstance.interceptors.response.use(
|
|
5722
|
-
(response) => response,
|
|
5723
|
-
(error) => {
|
|
5724
|
-
var _a, _b;
|
|
5725
|
-
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
5726
|
-
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
5727
|
-
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
5728
|
-
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
5729
|
-
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
5730
|
-
return Promise.reject(
|
|
5731
|
-
new AdapterApiError(data.message, data.data, data.code)
|
|
5732
|
-
);
|
|
5733
|
-
}
|
|
5734
|
-
return Promise.reject(error);
|
|
5735
|
-
}
|
|
5736
|
-
);
|
|
5737
|
-
function getAdapterClientConfig(options = {}) {
|
|
5738
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W;
|
|
5739
|
-
const currentHeaders = adapterClientInstance.defaults.headers;
|
|
5740
|
-
const headers = {
|
|
5741
|
-
platform: {
|
|
5742
|
-
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
5743
|
-
},
|
|
5744
|
-
integrations: {
|
|
5745
|
-
github: {
|
|
5746
|
-
app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
|
|
5747
|
-
oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
|
|
5748
|
-
},
|
|
5749
|
-
netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
|
|
5750
|
-
vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
|
|
5751
|
-
planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
|
|
5752
|
-
neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token,
|
|
5753
|
-
mailchimp: (_q = currentHeaders["x-adapter-mailchimp-token"]) != null ? _q : (_p = options.mailchimp) == null ? void 0 : _p.token,
|
|
5754
|
-
mailchimpServer: (_s = currentHeaders["x-adapter-mailchimp-server"]) != null ? _s : (_r = options.mailchimp) == null ? void 0 : _r.server,
|
|
5755
|
-
shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
|
|
5756
|
-
shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
|
|
5757
|
-
hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
|
|
5758
|
-
slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
|
|
5759
|
-
bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
|
|
5760
|
-
bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
|
|
5761
|
-
text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
|
|
5762
|
-
}
|
|
5763
|
-
};
|
|
5764
|
-
if (currentHeaders.Authorization) {
|
|
5765
|
-
currentHeaders["X-Region"] = (_H = getRegion3(currentHeaders.Authorization)) != null ? _H : void 0;
|
|
5766
|
-
}
|
|
5767
|
-
if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
|
|
5768
|
-
throw new UnauthorizeApiError("accounts");
|
|
5769
|
-
}
|
|
5770
|
-
if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
5771
|
-
throw new UnauthorizeApiError("github");
|
|
5772
|
-
}
|
|
5773
|
-
if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
|
|
5774
|
-
throw new UnauthorizeApiError("vercel");
|
|
5775
|
-
}
|
|
5776
|
-
if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
|
|
5777
|
-
throw new UnauthorizeApiError("netlify");
|
|
5778
|
-
}
|
|
5779
|
-
if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
|
|
5780
|
-
throw new UnauthorizeApiError("planetscale");
|
|
5781
|
-
}
|
|
5782
|
-
if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
|
|
5783
|
-
throw new UnauthorizeApiError("neon");
|
|
5784
|
-
}
|
|
5785
|
-
if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
5786
|
-
throw new UnauthorizeApiError("mailchimp");
|
|
5787
|
-
}
|
|
5788
|
-
if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
5789
|
-
throw new UnauthorizeApiError("shopify");
|
|
5790
|
-
}
|
|
5791
|
-
if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
|
|
5792
|
-
throw new UnauthorizeApiError("hubspot");
|
|
5793
|
-
}
|
|
5794
|
-
if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
|
|
5795
|
-
throw new UnauthorizeApiError("slack");
|
|
5796
|
-
}
|
|
5797
|
-
if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
|
|
5798
|
-
throw new UnauthorizeApiError("bigcommerce");
|
|
5799
|
-
}
|
|
5800
|
-
if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
|
|
5801
|
-
throw new UnauthorizeApiError("text");
|
|
5802
|
-
}
|
|
5803
|
-
return __spreadProps(__spreadValues({}, options.baseUrl ? { baseURL: options.baseUrl } : {}), {
|
|
5804
|
-
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), ((_U = options.internal) == null ? void 0 : _U.token) ? {
|
|
5805
|
-
[PROXY_AUTHORIZATION_HEADER]: `Bearer ${options.internal.token}`
|
|
5806
|
-
} : {}), ((_V = options.internal) == null ? void 0 : _V.organizationId) ? { [SERVICE_ORGANIZATION_ID_HEADER]: options.internal.organizationId } : {}), ((_W = options.internal) == null ? void 0 : _W.accountId) ? { [SERVICE_ACCOUNT_ID_HEADER]: options.internal.accountId } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.slack ? { "x-adapter-slack-token": headers.integrations.slack } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
|
|
5807
|
-
});
|
|
5808
|
-
}
|
|
5809
|
-
var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5810
|
-
ensureAuthorizationToken: {
|
|
5811
|
-
platform: true
|
|
5812
|
-
}
|
|
5813
|
-
}));
|
|
5814
|
-
function initAdapterClient(baseUrl, tokens) {
|
|
5815
|
-
if (baseUrl) {
|
|
5816
|
-
adapterClientInstance.defaults.baseURL = baseUrl;
|
|
5817
|
-
}
|
|
5818
|
-
if (tokens) {
|
|
5819
|
-
updateAdapterClient(tokens);
|
|
5820
|
-
}
|
|
5821
|
-
}
|
|
5822
|
-
function updateAdapterClient(tokens) {
|
|
5823
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
5824
|
-
const headers = adapterClientInstance.defaults.headers;
|
|
5825
|
-
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5826
|
-
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
5827
|
-
}
|
|
5828
|
-
if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
|
|
5829
|
-
headers["x-adapter-github-app-token"] = tokens.github.appToken;
|
|
5830
|
-
}
|
|
5831
|
-
if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
|
|
5832
|
-
headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
|
|
5833
|
-
}
|
|
5834
|
-
if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
|
|
5835
|
-
headers["x-adapter-netlify-token"] = tokens.netlify.token;
|
|
5836
|
-
}
|
|
5837
|
-
if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
|
|
5838
|
-
headers["x-adapter-vercel-token"] = tokens.vercel.token;
|
|
5839
|
-
}
|
|
5840
|
-
if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
|
|
5841
|
-
headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
|
|
5842
|
-
}
|
|
5843
|
-
if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
|
|
5844
|
-
headers["x-adapter-neon-token"] = tokens.neon.token;
|
|
5845
|
-
}
|
|
5846
|
-
if ((_i = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _i.server) {
|
|
5847
|
-
headers["x-adapter-mailchimp-server"] = tokens.mailchimp.server;
|
|
5848
|
-
}
|
|
5849
|
-
if ((_j = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _j.token) {
|
|
5850
|
-
headers["x-adapter-mailchimp-token"] = tokens.mailchimp.token;
|
|
5851
|
-
}
|
|
5852
|
-
if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.shop) {
|
|
5853
|
-
headers["x-adapter-shopify-shop"] = tokens.shopify.shop;
|
|
5854
|
-
}
|
|
5855
|
-
if ((_l = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _l.token) {
|
|
5856
|
-
headers["x-adapter-shopify-token"] = tokens.shopify.token;
|
|
5857
|
-
}
|
|
5858
|
-
if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
|
|
5859
|
-
headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
|
|
5860
|
-
}
|
|
5861
|
-
if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
|
|
5862
|
-
headers["x-adapter-slack-token"] = tokens.slack.token;
|
|
5863
|
-
}
|
|
5864
|
-
if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
|
|
5865
|
-
headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
|
|
5866
|
-
}
|
|
5867
|
-
if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
|
|
5868
|
-
headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
|
|
5869
|
-
}
|
|
5870
|
-
if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
|
|
5871
|
-
headers["x-adapter-text-token"] = tokens.text.token;
|
|
5872
|
-
}
|
|
5873
|
-
}
|
|
5874
|
-
|
|
5875
|
-
// src/apis/text-intelligence/workflows/workflow/instance.ts
|
|
5876
|
-
var import_axios30 = __toESM(require("axios"));
|
|
5877
|
-
var REGION4 = {
|
|
5878
|
-
FRA: "fra",
|
|
5879
|
-
DAL: "dal",
|
|
5880
|
-
FRA_A: "fra-a",
|
|
5881
|
-
FRA_B: "fra-b"
|
|
5882
|
-
};
|
|
5883
|
-
var supportedRegions4 = Object.values(REGION4);
|
|
5884
|
-
var getRegion4 = (token) => {
|
|
5885
|
-
const region = token.split(":")[0];
|
|
5886
|
-
if (supportedRegions4.includes(region)) {
|
|
5887
|
-
return region;
|
|
5888
|
-
}
|
|
5889
|
-
};
|
|
5890
|
-
var WorkflowsApiError = class _WorkflowsApiError extends ApiErrorBase {
|
|
5891
|
-
constructor() {
|
|
5892
|
-
super(...arguments);
|
|
5893
|
-
this.name = "workflows";
|
|
5894
|
-
}
|
|
5895
|
-
static notFound(message) {
|
|
5896
|
-
return new _WorkflowsApiError(
|
|
5897
|
-
message != null ? message : "Not found",
|
|
5898
|
-
{
|
|
5899
|
-
errorCode: "not_found",
|
|
5900
|
-
errorMessage: "Not found"
|
|
5901
|
-
},
|
|
5902
|
-
404
|
|
5903
|
-
);
|
|
5904
|
-
}
|
|
5905
|
-
};
|
|
5906
|
-
var workflowsClientInstance = import_axios30.default.create({
|
|
5907
|
-
baseURL: "https://platform.labs.text.com/workflows/api",
|
|
5908
|
-
headers: {
|
|
5909
|
-
"Content-Type": "application/json"
|
|
5910
|
-
}
|
|
5911
|
-
});
|
|
5912
|
-
workflowsClientInstance.interceptors.response.use(
|
|
5913
|
-
(response) => response,
|
|
5914
|
-
(error) => {
|
|
5915
|
-
var _a, _b;
|
|
5916
|
-
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
5917
|
-
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
5918
|
-
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
5919
|
-
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
5920
|
-
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
5921
|
-
return Promise.reject(
|
|
5922
|
-
new WorkflowsApiError(data.message, data.data, data.code)
|
|
5923
|
-
);
|
|
5924
|
-
}
|
|
5925
|
-
return Promise.reject(error);
|
|
5926
|
-
}
|
|
4437
|
+
// src/apis/integrations/text/platform/workflow/templates/api.ts
|
|
4438
|
+
var getUrl3 = (segments = [], version) => buildUrlFromSegments(
|
|
4439
|
+
segments,
|
|
4440
|
+
`/workflow_platform/${version ? `${version}/` : ""}workflows/templates`
|
|
5927
4441
|
);
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
const headers = {
|
|
5932
|
-
platform: {
|
|
5933
|
-
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
5934
|
-
}
|
|
5935
|
-
};
|
|
5936
|
-
if (currentHeaders.Authorization) {
|
|
5937
|
-
currentHeaders["X-Region"] = (_d = getRegion4(currentHeaders.Authorization)) != null ? _d : void 0;
|
|
5938
|
-
}
|
|
5939
|
-
if (((_e = options.ensureAuthorizationToken) == null ? void 0 : _e.platform) && !headers.platform.token) {
|
|
5940
|
-
throw new UnauthorizeApiError("accounts");
|
|
5941
|
-
}
|
|
5942
|
-
return {
|
|
5943
|
-
headers: __spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {})
|
|
5944
|
-
};
|
|
5945
|
-
}
|
|
5946
|
-
var getWorkflowsClientDefaultConfig = (authorization) => getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5947
|
-
ensureAuthorizationToken: {
|
|
5948
|
-
platform: true
|
|
5949
|
-
}
|
|
5950
|
-
}));
|
|
5951
|
-
function initWorkflowsClient(baseUrl, tokens) {
|
|
5952
|
-
if (baseUrl) {
|
|
5953
|
-
workflowsClientInstance.interceptors.request.use(
|
|
5954
|
-
(config) => {
|
|
5955
|
-
config.baseURL = baseUrl;
|
|
5956
|
-
return config;
|
|
5957
|
-
},
|
|
5958
|
-
(error) => Promise.reject(error)
|
|
5959
|
-
);
|
|
5960
|
-
}
|
|
5961
|
-
if (tokens) {
|
|
5962
|
-
updateWorkflowsClient(tokens);
|
|
5963
|
-
}
|
|
5964
|
-
}
|
|
5965
|
-
function updateWorkflowsClient(tokens) {
|
|
5966
|
-
var _a, _b;
|
|
5967
|
-
const headers = workflowsClientInstance.defaults.headers;
|
|
5968
|
-
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5969
|
-
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
5970
|
-
}
|
|
5971
|
-
}
|
|
5972
|
-
|
|
5973
|
-
// src/apis/integrations/text/platform/workflow/resources/api.ts
|
|
5974
|
-
var integrationNameToProduct = {
|
|
5975
|
-
["text-helpdesk" /* HelpDesk */]: "helpdesk",
|
|
5976
|
-
["text-livechat" /* LiveChat */]: "livechat"
|
|
4442
|
+
var urls5 = {
|
|
4443
|
+
getList: (queryParams) => enrichUrlWithQueryParams(getUrl3([], "v1.0" /* V1 */), queryParams),
|
|
4444
|
+
get: (templateId) => getUrl3([templateId], "v1.0" /* V1 */)
|
|
5977
4445
|
};
|
|
5978
|
-
var
|
|
5979
|
-
|
|
4446
|
+
var textPlatformWorkflowsTemplatesApi = {
|
|
4447
|
+
meta: {
|
|
4448
|
+
urls: urls5
|
|
4449
|
+
},
|
|
4450
|
+
getList(queryParams, authorization) {
|
|
5980
4451
|
return __async(this, null, function* () {
|
|
5981
|
-
var _a;
|
|
5982
|
-
const baseProvider = (_a = integrationNameToProduct[resource.provider]) != null ? _a : resource.provider;
|
|
5983
|
-
const provider = resource.product ? `${baseProvider}-${resource.product}` : baseProvider;
|
|
5984
|
-
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5985
|
-
ensureAuthorizationToken: true
|
|
5986
|
-
}));
|
|
5987
4452
|
return textClientInstance.get(
|
|
5988
|
-
|
|
5989
|
-
__spreadProps(__spreadValues({},
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
4453
|
+
urls5.getList(queryParams),
|
|
4454
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4455
|
+
ensureAuthorizationToken: true
|
|
4456
|
+
}))
|
|
4457
|
+
).catch((error) => {
|
|
4458
|
+
if (error instanceof TextApiError) {
|
|
4459
|
+
throw error.withCustomMessage(
|
|
4460
|
+
`Couldn't get workflow templates. [${error.message}]`
|
|
4461
|
+
);
|
|
4462
|
+
}
|
|
4463
|
+
throw error;
|
|
4464
|
+
});
|
|
4465
|
+
});
|
|
4466
|
+
},
|
|
4467
|
+
get(templateId, authorization) {
|
|
4468
|
+
return __async(this, null, function* () {
|
|
4469
|
+
return textClientInstance.get(
|
|
4470
|
+
urls5.get(templateId),
|
|
4471
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4472
|
+
ensureAuthorizationToken: true
|
|
4473
|
+
}))
|
|
5995
4474
|
).catch((error) => {
|
|
5996
4475
|
if (error instanceof TextApiError) {
|
|
5997
4476
|
throw error.withCustomMessage(
|
|
5998
|
-
`Couldn't get
|
|
4477
|
+
`Couldn't get workflow template. [${error.message}]`
|
|
5999
4478
|
);
|
|
6000
4479
|
}
|
|
6001
4480
|
throw error;
|
|
@@ -6004,149 +4483,482 @@ var textPlatformWorkflowsResourcesApi = {
|
|
|
6004
4483
|
}
|
|
6005
4484
|
};
|
|
6006
4485
|
|
|
6007
|
-
// src/
|
|
6008
|
-
var
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
4486
|
+
// src/constants/app/templates/repository.ts
|
|
4487
|
+
var appRepositoryTemplatesMap = {
|
|
4488
|
+
"livechat/developer-app-template-nextjs": "nextjs",
|
|
4489
|
+
"livechat/developer-app-template-vite": "vite",
|
|
4490
|
+
"livechat/developer-app-template-saas": "saas"
|
|
4491
|
+
};
|
|
4492
|
+
var appRepositoryTemplates = {
|
|
4493
|
+
nextjs: {
|
|
4494
|
+
id: "nextjs",
|
|
4495
|
+
description: "Uses the most popular and versatile features from our SDKs:",
|
|
4496
|
+
tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
|
|
4497
|
+
name: "Fullstack Next.js template",
|
|
4498
|
+
repository: {
|
|
4499
|
+
name: "livechat/developer-app-template-nextjs",
|
|
4500
|
+
target: "nextjs"
|
|
4501
|
+
}
|
|
4502
|
+
},
|
|
4503
|
+
vite: {
|
|
4504
|
+
id: "vite",
|
|
4505
|
+
name: "Vite template",
|
|
4506
|
+
description: "Implements the same base functionalities as the Next.js template except for webhooks:",
|
|
4507
|
+
tags: ["Auth", "Agent App SDK", "Moments"],
|
|
4508
|
+
repository: {
|
|
4509
|
+
name: "livechat/developer-app-template-vite",
|
|
4510
|
+
target: "browser"
|
|
4511
|
+
}
|
|
4512
|
+
},
|
|
4513
|
+
saas: {
|
|
4514
|
+
id: "saas",
|
|
4515
|
+
name: "Nextjs SaaS boilerplate",
|
|
4516
|
+
description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
|
|
4517
|
+
tags: [],
|
|
4518
|
+
repository: {
|
|
4519
|
+
name: "livechat/developer-app-template-saas",
|
|
4520
|
+
target: "nextjs"
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
};
|
|
4524
|
+
|
|
4525
|
+
// src/constants/app/templates/app.ts
|
|
4526
|
+
var appTemplatesMap = {
|
|
4527
|
+
"livechat/developer-app-template-saas": "saas"
|
|
4528
|
+
};
|
|
4529
|
+
var appBaseTemplates = {
|
|
4530
|
+
"tag-master": {
|
|
4531
|
+
id: "tag-master",
|
|
4532
|
+
name: "Tag Master",
|
|
4533
|
+
category: { name: "Agent App Widget" },
|
|
4534
|
+
description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
|
|
4535
|
+
tags: ["Accounts SDK", "NextJS", "Configuration API"],
|
|
4536
|
+
link: "https://github.com/bstopyra/tag-master-template",
|
|
4537
|
+
icons: {},
|
|
4538
|
+
repository: {
|
|
4539
|
+
name: "bstopyra/tag-master-template",
|
|
4540
|
+
target: "node"
|
|
4541
|
+
}
|
|
4542
|
+
},
|
|
4543
|
+
progress: {
|
|
4544
|
+
id: "progress",
|
|
4545
|
+
name: "Progress",
|
|
4546
|
+
category: { name: "Agent App Widget" },
|
|
4547
|
+
description: "Creates reports based on data from chats: ratings, chatting time, response time.",
|
|
4548
|
+
tags: ["Accounts SDK", "NextJS", "Reports API"],
|
|
4549
|
+
link: "https://github.com/livechat/progress-app",
|
|
4550
|
+
icons: {},
|
|
4551
|
+
repository: {
|
|
4552
|
+
name: "livechat/progress-app",
|
|
4553
|
+
target: "node"
|
|
4554
|
+
}
|
|
4555
|
+
},
|
|
4556
|
+
supervisor: {
|
|
4557
|
+
id: "supervisor",
|
|
4558
|
+
name: "Supervisor",
|
|
4559
|
+
category: { name: "Agent App Widget" },
|
|
4560
|
+
description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
|
|
4561
|
+
tags: ["Accounts SDK", "NextJS", "Reports API"],
|
|
4562
|
+
link: "https://github.com/livechat/supervisor-app",
|
|
4563
|
+
icons: {},
|
|
4564
|
+
repository: {
|
|
4565
|
+
name: "livechat/supervisor-app",
|
|
4566
|
+
target: "node"
|
|
4567
|
+
}
|
|
4568
|
+
},
|
|
4569
|
+
popup: {
|
|
4570
|
+
id: "popup",
|
|
4571
|
+
name: "Popup app",
|
|
4572
|
+
category: { name: "Agent App Widget" },
|
|
4573
|
+
description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
|
|
4574
|
+
tags: ["Accounts SDK", "Popup flow", "Widget"],
|
|
4575
|
+
link: "https://github.com/livechat/sample-app-popup-auth",
|
|
4576
|
+
icons: {},
|
|
4577
|
+
repository: {
|
|
4578
|
+
name: "livechat/sample-app-popup-auth",
|
|
4579
|
+
target: "node"
|
|
4580
|
+
}
|
|
4581
|
+
},
|
|
4582
|
+
redirect: {
|
|
4583
|
+
id: "redirect",
|
|
4584
|
+
name: "Redirect app",
|
|
4585
|
+
category: { name: "Agent App Widget" },
|
|
4586
|
+
description: "See how to implement the redirect authorization flow from the Accounts SDK.",
|
|
4587
|
+
tags: ["Accounts SDK", "Redirect flow", "Widget"],
|
|
4588
|
+
link: "https://github.com/livechat/sample-app-redirect-auth",
|
|
4589
|
+
icons: {},
|
|
4590
|
+
repository: {
|
|
4591
|
+
name: "livechat/sample-app-redirect-auth",
|
|
4592
|
+
target: "node"
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
};
|
|
4596
|
+
var appTemplates = {
|
|
4597
|
+
saas: {
|
|
4598
|
+
id: "saas",
|
|
4599
|
+
name: "Nextjs SaaS boilerplate",
|
|
4600
|
+
category: { name: "Agent App Widget" },
|
|
4601
|
+
description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
|
|
4602
|
+
tags: ["UI", "Auth", "Payments", "Analytics"],
|
|
4603
|
+
template: true,
|
|
4604
|
+
manifest: {
|
|
4605
|
+
name: "Nextjs SaaS boilerplate",
|
|
4606
|
+
product: "livechat",
|
|
4607
|
+
blocks: {
|
|
4608
|
+
repository: {
|
|
4609
|
+
provider: "github",
|
|
4610
|
+
name: "livechat/developer-app-template-saas",
|
|
4611
|
+
branch: "main",
|
|
4612
|
+
target: "nextjs"
|
|
4613
|
+
},
|
|
4614
|
+
deployment: {
|
|
4615
|
+
provider: "vercel",
|
|
4616
|
+
url: ""
|
|
4617
|
+
},
|
|
4618
|
+
authorization: {
|
|
4619
|
+
type: "javascript_app",
|
|
4620
|
+
redirectUri: ""
|
|
4621
|
+
},
|
|
4622
|
+
widgets: {
|
|
4623
|
+
"chat-details": {
|
|
4624
|
+
placement: "plugin",
|
|
4625
|
+
url: "/livechat/details"
|
|
4626
|
+
},
|
|
4627
|
+
fullscreen: {
|
|
4628
|
+
placement: "fullscreen",
|
|
4629
|
+
url: "/livechat/fullscreen"
|
|
4630
|
+
}
|
|
4631
|
+
},
|
|
4632
|
+
monetization: {
|
|
4633
|
+
frequency: "monthly",
|
|
4634
|
+
charge: "organization",
|
|
4635
|
+
price: 500,
|
|
4636
|
+
trialDays: 7
|
|
4637
|
+
}
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
};
|
|
4642
|
+
var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
|
|
4643
|
+
|
|
4644
|
+
// src/constants/auth/headers.ts
|
|
4645
|
+
var PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization";
|
|
4646
|
+
var ACCOUNT_ID_HEADER = "X-Account-ID";
|
|
4647
|
+
var ORGANIZATION_ID_HEADER = "X-Organization-ID";
|
|
4648
|
+
var SERVICE_ACCOUNT_ID_HEADER = "X-Service-Account-ID";
|
|
4649
|
+
var SERVICE_ORGANIZATION_ID_HEADER = "X-Service-Organization-ID";
|
|
4650
|
+
|
|
4651
|
+
// src/constants/notifications.ts
|
|
4652
|
+
var API_NOTIFICATIONS = {
|
|
4653
|
+
BUILDING_BLOCKS: {
|
|
4654
|
+
SUCCESS: {
|
|
4655
|
+
CREATED: "Building block created successfully.",
|
|
4656
|
+
UPDATED: "Building block updated successfully.",
|
|
4657
|
+
DELETED: "Building block deleted successfully."
|
|
4658
|
+
},
|
|
4659
|
+
FAILURE: {
|
|
4660
|
+
CREATED: "Building block couldn't be created.",
|
|
4661
|
+
UPDATED: "Building block couldn't be updated.",
|
|
4662
|
+
DELETED: "Building block couldn't be deleted."
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
};
|
|
4666
|
+
|
|
4667
|
+
// src/apis/integrations/text/platform/workflow/workflows/internal/crm/instance.ts
|
|
4668
|
+
function getWorkflowApiCrmConfig(authorization) {
|
|
4669
|
+
var _a, _b, _c, _d;
|
|
4670
|
+
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4671
|
+
ensureAuthorizationToken: true
|
|
4672
|
+
}));
|
|
4673
|
+
return __spreadProps(__spreadValues({}, config), {
|
|
4674
|
+
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (_a = config.headers) != null ? _a : {}), ((_b = authorization == null ? void 0 : authorization.internal) == null ? void 0 : _b.token) ? {
|
|
4675
|
+
[PROXY_AUTHORIZATION_HEADER]: `Bearer ${authorization.internal.token}`
|
|
4676
|
+
} : {}), ((_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 } : {})
|
|
4677
|
+
});
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
// src/apis/integrations/text/platform/workflow/workflows/internal/crm/api.ts
|
|
4681
|
+
var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/internal/crm");
|
|
4682
|
+
var urls6 = {
|
|
4683
|
+
getOrganizations: (queryParams) => enrichUrlWithQueryParams(getUrl4(["stats"]), queryParams),
|
|
4684
|
+
getOrganization: (organizationId) => getUrl4(["stats", organizationId]),
|
|
4685
|
+
getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl4(["workflows"]), queryParams),
|
|
4686
|
+
getWorkflow: (id) => getUrl4(["workflows", id]),
|
|
4687
|
+
getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
|
|
4688
|
+
getUrl4(["workflows", id, "executions"]),
|
|
4689
|
+
queryParams
|
|
4690
|
+
),
|
|
4691
|
+
getWorkflowExecution: (id, executionId) => getUrl4(["workflows", id, "executions", executionId]),
|
|
4692
|
+
getWorkflowIntrospection: (id) => getUrl4(["workflows", id, "metadata"])
|
|
6015
4693
|
};
|
|
6016
|
-
var
|
|
4694
|
+
var textPlatformWorkflowsInternalCrmApi = {
|
|
6017
4695
|
meta: {
|
|
6018
|
-
urls:
|
|
4696
|
+
urls: urls6
|
|
6019
4697
|
},
|
|
6020
|
-
|
|
4698
|
+
getOrganizations(queryParams, authorization) {
|
|
6021
4699
|
return __async(this, null, function* () {
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
).catch((error) => {
|
|
6028
|
-
if (error instanceof TextApiError) {
|
|
6029
|
-
throw error.withCustomMessage(
|
|
6030
|
-
`Couldn't get workflow templates. [${error.message}]`
|
|
6031
|
-
);
|
|
6032
|
-
}
|
|
6033
|
-
throw error;
|
|
6034
|
-
});
|
|
4700
|
+
const { data: organizations } = yield textClientInstance.get(
|
|
4701
|
+
urls6.getOrganizations(queryParams),
|
|
4702
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4703
|
+
);
|
|
4704
|
+
return organizations;
|
|
6035
4705
|
});
|
|
6036
4706
|
},
|
|
6037
|
-
|
|
4707
|
+
getOrganization(organizationId, authorization) {
|
|
6038
4708
|
return __async(this, null, function* () {
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
4709
|
+
const { data: organization } = yield textClientInstance.get(
|
|
4710
|
+
urls6.getOrganization(organizationId),
|
|
4711
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4712
|
+
);
|
|
4713
|
+
return organization;
|
|
4714
|
+
});
|
|
4715
|
+
},
|
|
4716
|
+
getWorkflows(queryParams, authorization) {
|
|
4717
|
+
return __async(this, null, function* () {
|
|
4718
|
+
const { data: workflows } = yield textClientInstance.get(urls6.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
|
|
4719
|
+
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
4720
|
+
return workflows;
|
|
4721
|
+
});
|
|
4722
|
+
},
|
|
4723
|
+
getWorkflow(workflowId, authorization) {
|
|
4724
|
+
return __async(this, null, function* () {
|
|
4725
|
+
const searchParams = new URLSearchParams();
|
|
4726
|
+
const query = searchParams.toString();
|
|
4727
|
+
const { data: workflow } = yield textClientInstance.get(
|
|
4728
|
+
`${urls6.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
4729
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4730
|
+
);
|
|
4731
|
+
return enrichWorkflowTrigger(workflow);
|
|
4732
|
+
});
|
|
4733
|
+
},
|
|
4734
|
+
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
4735
|
+
return __async(this, null, function* () {
|
|
4736
|
+
const { data: executions } = yield textClientInstance.get(
|
|
4737
|
+
urls6.getWorkflowExecutions(workflowId, queryParams),
|
|
4738
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4739
|
+
);
|
|
4740
|
+
return executions;
|
|
4741
|
+
});
|
|
4742
|
+
},
|
|
4743
|
+
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
4744
|
+
return __async(this, null, function* () {
|
|
4745
|
+
const { data: execution } = yield textClientInstance.get(
|
|
4746
|
+
urls6.getWorkflowExecution(workflowId, executionId),
|
|
4747
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4748
|
+
);
|
|
4749
|
+
return execution;
|
|
4750
|
+
});
|
|
4751
|
+
},
|
|
4752
|
+
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
4753
|
+
return __async(this, null, function* () {
|
|
4754
|
+
const searchParams = new URLSearchParams();
|
|
4755
|
+
if (version) {
|
|
4756
|
+
searchParams.append("version", `${version}`);
|
|
4757
|
+
}
|
|
4758
|
+
const query = searchParams.toString();
|
|
4759
|
+
const { data: introspection } = yield textClientInstance.get(
|
|
4760
|
+
`${urls6.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
4761
|
+
getWorkflowApiCrmConfig(authorization)
|
|
4762
|
+
);
|
|
4763
|
+
return {
|
|
4764
|
+
tasks: introspection
|
|
4765
|
+
};
|
|
6052
4766
|
});
|
|
6053
4767
|
}
|
|
6054
4768
|
};
|
|
6055
4769
|
|
|
6056
|
-
// src/apis/integrations/text/platform/workflow/workflows/internal/
|
|
6057
|
-
var
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
4770
|
+
// src/apis/integrations/text/platform/workflow/workflows/internal/api.ts
|
|
4771
|
+
var textPlatformWorkflowsInternalApi = {
|
|
4772
|
+
crm: textPlatformWorkflowsInternalCrmApi
|
|
4773
|
+
};
|
|
4774
|
+
|
|
4775
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/base.ts
|
|
4776
|
+
var WorkflowTaskType = {
|
|
4777
|
+
http: "HTTP",
|
|
4778
|
+
switch: "SWITCH",
|
|
4779
|
+
forkJoin: "FORK_JOIN",
|
|
4780
|
+
terminate: "TERMINATE",
|
|
4781
|
+
join: "JOIN",
|
|
4782
|
+
wait: "WAIT",
|
|
4783
|
+
simple: "SIMPLE",
|
|
4784
|
+
doWhile: "DO_WHILE",
|
|
4785
|
+
inline: "INLINE",
|
|
4786
|
+
transform: "JSON_JQ_TRANSFORM"
|
|
4787
|
+
};
|
|
4788
|
+
var WorkflowCustomTaskName = {
|
|
4789
|
+
// SWITCH
|
|
4790
|
+
condition: `${WorkflowTaskType.switch}_IF`,
|
|
4791
|
+
switchCase: `${WorkflowTaskType.switch}_CASE`,
|
|
4792
|
+
// SIMPLE
|
|
4793
|
+
action: "action",
|
|
4794
|
+
awaitAgent: "await",
|
|
4795
|
+
notifyAgent: "notify_ai_agent",
|
|
4796
|
+
reasoning: "reasoning",
|
|
4797
|
+
// DO WHILE
|
|
4798
|
+
loop: `${WorkflowTaskType.doWhile}_LOOP`,
|
|
4799
|
+
forEach: `${WorkflowTaskType.doWhile}_FOR_EACH`,
|
|
4800
|
+
// INLINE
|
|
4801
|
+
script: `${WorkflowTaskType.inline}_SCRIPT`,
|
|
4802
|
+
// JQ TRANSFORM
|
|
4803
|
+
convert: `${WorkflowTaskType.transform}_CONVERT`,
|
|
4804
|
+
construct: `${WorkflowTaskType.transform}_CONSTRUCT`
|
|
4805
|
+
};
|
|
4806
|
+
var WorkflowExecutionTaskStatus = /* @__PURE__ */ ((WorkflowExecutionTaskStatus2) => {
|
|
4807
|
+
WorkflowExecutionTaskStatus2["Completed"] = "COMPLETED";
|
|
4808
|
+
WorkflowExecutionTaskStatus2["CompletedWithError"] = "COMPLETED_WITH_ERRORS";
|
|
4809
|
+
WorkflowExecutionTaskStatus2["Failed"] = "FAILED";
|
|
4810
|
+
WorkflowExecutionTaskStatus2["FailedWithTerminalErrors"] = "FAILED_WITH_TERMINAL_ERROR";
|
|
4811
|
+
WorkflowExecutionTaskStatus2["Scheduled"] = "SCHEDULED";
|
|
4812
|
+
WorkflowExecutionTaskStatus2["TimedOut"] = "TIMED_OUT";
|
|
4813
|
+
WorkflowExecutionTaskStatus2["InProgress"] = "IN_PROGRESS";
|
|
4814
|
+
WorkflowExecutionTaskStatus2["Skipped"] = "SKIPPED";
|
|
4815
|
+
WorkflowExecutionTaskStatus2["Canceled"] = "CANCELED";
|
|
4816
|
+
WorkflowExecutionTaskStatus2["NotExecuted"] = "NOT_EXECUTED";
|
|
4817
|
+
return WorkflowExecutionTaskStatus2;
|
|
4818
|
+
})(WorkflowExecutionTaskStatus || {});
|
|
4819
|
+
|
|
4820
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/http.ts
|
|
4821
|
+
function isWorkflowBaseHttpTaskCore(task) {
|
|
4822
|
+
return task.name === WorkflowTaskType.http;
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/switch/variants/condition.ts
|
|
4826
|
+
var WorkflowConditionTaskLogic = /* @__PURE__ */ ((WorkflowConditionTaskLogic2) => {
|
|
4827
|
+
WorkflowConditionTaskLogic2["AND"] = "AND";
|
|
4828
|
+
WorkflowConditionTaskLogic2["OR"] = "OR";
|
|
4829
|
+
return WorkflowConditionTaskLogic2;
|
|
4830
|
+
})(WorkflowConditionTaskLogic || {});
|
|
4831
|
+
var WorkflowConditionTaskOperator = /* @__PURE__ */ ((WorkflowConditionTaskOperator2) => {
|
|
4832
|
+
WorkflowConditionTaskOperator2["GeneralEmpty"] = "g_empty";
|
|
4833
|
+
WorkflowConditionTaskOperator2["GeneralNotEmpty"] = "g_nempty";
|
|
4834
|
+
WorkflowConditionTaskOperator2["NumberEqual"] = "n_eq";
|
|
4835
|
+
WorkflowConditionTaskOperator2["NumberNotEqual"] = "n_neq";
|
|
4836
|
+
WorkflowConditionTaskOperator2["NumberIn"] = "n_in";
|
|
4837
|
+
WorkflowConditionTaskOperator2["NumberNotIn"] = "n_nin";
|
|
4838
|
+
WorkflowConditionTaskOperator2["NumberGreaterThan"] = "n_gt";
|
|
4839
|
+
WorkflowConditionTaskOperator2["NumberGreaterOrEqual"] = "n_gte";
|
|
4840
|
+
WorkflowConditionTaskOperator2["NumberLessThan"] = "n_lt";
|
|
4841
|
+
WorkflowConditionTaskOperator2["NumberLessOrEqual"] = "n_lte";
|
|
4842
|
+
WorkflowConditionTaskOperator2["StringEqual"] = "s_eq";
|
|
4843
|
+
WorkflowConditionTaskOperator2["StringNotEqual"] = "s_neq";
|
|
4844
|
+
WorkflowConditionTaskOperator2["StringIn"] = "s_in";
|
|
4845
|
+
WorkflowConditionTaskOperator2["StringNotIn"] = "s_nin";
|
|
4846
|
+
WorkflowConditionTaskOperator2["StringContains"] = "s_contains";
|
|
4847
|
+
WorkflowConditionTaskOperator2["StringNotContains"] = "s_not_contains";
|
|
4848
|
+
WorkflowConditionTaskOperator2["StringStartsWith"] = "s_starts_with";
|
|
4849
|
+
WorkflowConditionTaskOperator2["StringEndsWith"] = "s_ends_with";
|
|
4850
|
+
WorkflowConditionTaskOperator2["StringRegex"] = "s_regex";
|
|
4851
|
+
WorkflowConditionTaskOperator2["StringLengthEqual"] = "s_length_eq";
|
|
4852
|
+
WorkflowConditionTaskOperator2["StringLengthGreaterThan"] = "s_length_gt";
|
|
4853
|
+
WorkflowConditionTaskOperator2["StringLengthLessThan"] = "s_length_lt";
|
|
4854
|
+
WorkflowConditionTaskOperator2["DateTimeEqual"] = "dt_eq";
|
|
4855
|
+
WorkflowConditionTaskOperator2["DateTimeNotEqual"] = "dt_neq";
|
|
4856
|
+
WorkflowConditionTaskOperator2["DateTimeBefore"] = "dt_before";
|
|
4857
|
+
WorkflowConditionTaskOperator2["DateTimeAfter"] = "dt_after";
|
|
4858
|
+
WorkflowConditionTaskOperator2["BooleanEqual"] = "b_eq";
|
|
4859
|
+
WorkflowConditionTaskOperator2["BooleanNotEqual"] = "b_neq";
|
|
4860
|
+
WorkflowConditionTaskOperator2["ArrayContains"] = "a_contains";
|
|
4861
|
+
WorkflowConditionTaskOperator2["ArrayNotContains"] = "a_not_contains";
|
|
4862
|
+
WorkflowConditionTaskOperator2["ArrayLengthEqual"] = "a_length_eq";
|
|
4863
|
+
WorkflowConditionTaskOperator2["ArrayLengthGreaterThan"] = "a_length_gt";
|
|
4864
|
+
WorkflowConditionTaskOperator2["ArrayLengthLessThan"] = "a_length_lt";
|
|
4865
|
+
WorkflowConditionTaskOperator2["ArrayLengthGreaterOrEqual"] = "a_length_gte";
|
|
4866
|
+
WorkflowConditionTaskOperator2["ArrayLengthLessOrEqual"] = "a_length_lte";
|
|
4867
|
+
return WorkflowConditionTaskOperator2;
|
|
4868
|
+
})(WorkflowConditionTaskOperator || {});
|
|
4869
|
+
var WorkflowConditionTaskOperatorValueType = /* @__PURE__ */ ((WorkflowConditionTaskOperatorValueType2) => {
|
|
4870
|
+
WorkflowConditionTaskOperatorValueType2["Null"] = "null";
|
|
4871
|
+
WorkflowConditionTaskOperatorValueType2["String"] = "string";
|
|
4872
|
+
WorkflowConditionTaskOperatorValueType2["Number"] = "number";
|
|
4873
|
+
WorkflowConditionTaskOperatorValueType2["Boolean"] = "boolean";
|
|
4874
|
+
WorkflowConditionTaskOperatorValueType2["Datetime"] = "datetime";
|
|
4875
|
+
WorkflowConditionTaskOperatorValueType2["ArrayString"] = "array-string";
|
|
4876
|
+
WorkflowConditionTaskOperatorValueType2["ArrayNumber"] = "array-number";
|
|
4877
|
+
WorkflowConditionTaskOperatorValueType2["ArrayItem"] = "array-item";
|
|
4878
|
+
return WorkflowConditionTaskOperatorValueType2;
|
|
4879
|
+
})(WorkflowConditionTaskOperatorValueType || {});
|
|
4880
|
+
var WorkflowConditionTaskOperatorGroup = /* @__PURE__ */ ((WorkflowConditionTaskOperatorGroup2) => {
|
|
4881
|
+
WorkflowConditionTaskOperatorGroup2["General"] = "general";
|
|
4882
|
+
WorkflowConditionTaskOperatorGroup2["String"] = "string";
|
|
4883
|
+
WorkflowConditionTaskOperatorGroup2["Number"] = "number";
|
|
4884
|
+
WorkflowConditionTaskOperatorGroup2["Boolean"] = "boolean";
|
|
4885
|
+
WorkflowConditionTaskOperatorGroup2["Datetime"] = "datetime";
|
|
4886
|
+
WorkflowConditionTaskOperatorGroup2["Array"] = "array";
|
|
4887
|
+
return WorkflowConditionTaskOperatorGroup2;
|
|
4888
|
+
})(WorkflowConditionTaskOperatorGroup || {});
|
|
4889
|
+
var WorkflowConditionTaskFieldType = /* @__PURE__ */ ((WorkflowConditionTaskFieldType2) => {
|
|
4890
|
+
WorkflowConditionTaskFieldType2["String"] = "string";
|
|
4891
|
+
WorkflowConditionTaskFieldType2["Number"] = "number";
|
|
4892
|
+
WorkflowConditionTaskFieldType2["Integer"] = "integer";
|
|
4893
|
+
WorkflowConditionTaskFieldType2["Boolean"] = "boolean";
|
|
4894
|
+
WorkflowConditionTaskFieldType2["Array"] = "array";
|
|
4895
|
+
return WorkflowConditionTaskFieldType2;
|
|
4896
|
+
})(WorkflowConditionTaskFieldType || {});
|
|
4897
|
+
|
|
4898
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/agent.ts
|
|
4899
|
+
var WorkflowAgentTriggerSubType = {
|
|
4900
|
+
chat: "chat"
|
|
6069
4901
|
};
|
|
6070
|
-
var
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
getOrganizations(queryParams, authorization) {
|
|
6075
|
-
return __async(this, null, function* () {
|
|
6076
|
-
const { data: organizations } = yield textClientInstance.get(
|
|
6077
|
-
urls6.getOrganizations(queryParams),
|
|
6078
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6079
|
-
);
|
|
6080
|
-
return organizations;
|
|
6081
|
-
});
|
|
6082
|
-
},
|
|
6083
|
-
getOrganization(organizationId, authorization) {
|
|
6084
|
-
return __async(this, null, function* () {
|
|
6085
|
-
const { data: organization } = yield textClientInstance.get(
|
|
6086
|
-
urls6.getOrganization(organizationId),
|
|
6087
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6088
|
-
);
|
|
6089
|
-
return organization;
|
|
6090
|
-
});
|
|
6091
|
-
},
|
|
6092
|
-
getWorkflows(queryParams, authorization) {
|
|
6093
|
-
return __async(this, null, function* () {
|
|
6094
|
-
const { data: workflows } = yield textClientInstance.get(urls6.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
|
|
6095
|
-
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
6096
|
-
return workflows;
|
|
6097
|
-
});
|
|
6098
|
-
},
|
|
6099
|
-
getWorkflow(workflowId, authorization) {
|
|
6100
|
-
return __async(this, null, function* () {
|
|
6101
|
-
const searchParams = new URLSearchParams();
|
|
6102
|
-
const query = searchParams.toString();
|
|
6103
|
-
const { data: workflow } = yield textClientInstance.get(
|
|
6104
|
-
`${urls6.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
6105
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6106
|
-
);
|
|
6107
|
-
return enrichWorkflowTrigger(workflow);
|
|
6108
|
-
});
|
|
6109
|
-
},
|
|
6110
|
-
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
6111
|
-
return __async(this, null, function* () {
|
|
6112
|
-
const { data: executions } = yield textClientInstance.get(
|
|
6113
|
-
urls6.getWorkflowExecutions(workflowId, queryParams),
|
|
6114
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6115
|
-
);
|
|
6116
|
-
return executions;
|
|
6117
|
-
});
|
|
6118
|
-
},
|
|
6119
|
-
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
6120
|
-
return __async(this, null, function* () {
|
|
6121
|
-
const { data: execution } = yield textClientInstance.get(
|
|
6122
|
-
urls6.getWorkflowExecution(workflowId, executionId),
|
|
6123
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6124
|
-
);
|
|
6125
|
-
return execution;
|
|
6126
|
-
});
|
|
6127
|
-
},
|
|
6128
|
-
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
6129
|
-
return __async(this, null, function* () {
|
|
6130
|
-
const searchParams = new URLSearchParams();
|
|
6131
|
-
if (version) {
|
|
6132
|
-
searchParams.append("version", `${version}`);
|
|
6133
|
-
}
|
|
6134
|
-
const query = searchParams.toString();
|
|
6135
|
-
const { data: introspection } = yield textClientInstance.get(
|
|
6136
|
-
`${urls6.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
6137
|
-
getWorkflowApiCrmConfig(authorization)
|
|
6138
|
-
);
|
|
6139
|
-
return {
|
|
6140
|
-
tasks: introspection
|
|
6141
|
-
};
|
|
6142
|
-
});
|
|
6143
|
-
}
|
|
4902
|
+
var WorkflowExecutionType = {
|
|
4903
|
+
conversational: "conversational",
|
|
4904
|
+
background: "background",
|
|
4905
|
+
hybrid: "hybrid"
|
|
6144
4906
|
};
|
|
6145
4907
|
|
|
6146
|
-
// src/apis/integrations/text/platform/workflow/workflows/
|
|
6147
|
-
var
|
|
6148
|
-
|
|
4908
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/base.ts
|
|
4909
|
+
var WorkflowTriggerType = {
|
|
4910
|
+
manual: "manual_only",
|
|
4911
|
+
agent: "ai_agent",
|
|
4912
|
+
recurring: "recurring",
|
|
4913
|
+
oneTime: "one_time",
|
|
4914
|
+
webhook: "webhook",
|
|
4915
|
+
webhookManual: "webhook_manual"
|
|
4916
|
+
};
|
|
4917
|
+
|
|
4918
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/manual.ts
|
|
4919
|
+
var WorkflowManualTriggerSubType = {
|
|
4920
|
+
forSelectedChat: "for_selected_chat",
|
|
4921
|
+
forSelectedTicket: "for_selected_ticket"
|
|
6149
4922
|
};
|
|
4923
|
+
var WorkflowManualTriggerSubTypeName = {
|
|
4924
|
+
[WorkflowManualTriggerSubType.forSelectedChat]: "text-livechat-manual",
|
|
4925
|
+
[WorkflowManualTriggerSubType.forSelectedTicket]: "text-helpdesk-manual"
|
|
4926
|
+
};
|
|
4927
|
+
|
|
4928
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowElement.ts
|
|
4929
|
+
var TRIGGER_REFERENCE_NAME = "trigger";
|
|
4930
|
+
|
|
4931
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowExecution.ts
|
|
4932
|
+
var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
|
|
4933
|
+
WorkflowExecutionStatus2["Succeeded"] = "succeeded";
|
|
4934
|
+
WorkflowExecutionStatus2["Failed"] = "failed";
|
|
4935
|
+
WorkflowExecutionStatus2["Pending"] = "pending";
|
|
4936
|
+
return WorkflowExecutionStatus2;
|
|
4937
|
+
})(WorkflowExecutionStatus || {});
|
|
4938
|
+
var WorkflowExecutionDefinitionStatus = /* @__PURE__ */ ((WorkflowExecutionDefinitionStatus2) => {
|
|
4939
|
+
WorkflowExecutionDefinitionStatus2["Completed"] = "COMPLETED";
|
|
4940
|
+
WorkflowExecutionDefinitionStatus2["Failed"] = "FAILED";
|
|
4941
|
+
WorkflowExecutionDefinitionStatus2["Running"] = "RUNNING";
|
|
4942
|
+
return WorkflowExecutionDefinitionStatus2;
|
|
4943
|
+
})(WorkflowExecutionDefinitionStatus || {});
|
|
4944
|
+
|
|
4945
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowItem.ts
|
|
4946
|
+
var WorkflowItemKind = /* @__PURE__ */ ((WorkflowItemKind2) => {
|
|
4947
|
+
WorkflowItemKind2["Task"] = "task";
|
|
4948
|
+
WorkflowItemKind2["Trigger"] = "trigger";
|
|
4949
|
+
return WorkflowItemKind2;
|
|
4950
|
+
})(WorkflowItemKind || {});
|
|
4951
|
+
|
|
4952
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowTemplate.ts
|
|
4953
|
+
var WorkflowTemplateCategory = /* @__PURE__ */ ((WorkflowTemplateCategory2) => {
|
|
4954
|
+
WorkflowTemplateCategory2["NotificationAndAlerts"] = "Notifications & alerts";
|
|
4955
|
+
WorkflowTemplateCategory2["SalesManagement"] = "Sales management";
|
|
4956
|
+
WorkflowTemplateCategory2["LeadCollection"] = "Lead collection";
|
|
4957
|
+
WorkflowTemplateCategory2["ChatManagement"] = "Chat management";
|
|
4958
|
+
WorkflowTemplateCategory2["CustomerExperience"] = "Customer experience";
|
|
4959
|
+
WorkflowTemplateCategory2["TicketManagement"] = "Ticket management";
|
|
4960
|
+
return WorkflowTemplateCategory2;
|
|
4961
|
+
})(WorkflowTemplateCategory || {});
|
|
6150
4962
|
|
|
6151
4963
|
// src/apis/integrations/text/platform/workflow/workflows/api.ts
|
|
6152
4964
|
var enrichWorkflowTrigger = (workflow) => {
|
|
@@ -6373,7 +5185,6 @@ var textPlatformWorkflowApi = {
|
|
|
6373
5185
|
workflows: textPlatformWorkflowsApi,
|
|
6374
5186
|
credentials: textPlatformWorkflowsCredentialsApi,
|
|
6375
5187
|
functions: textPlatformWorkflowsFunctionsApi,
|
|
6376
|
-
resources: textPlatformWorkflowsResourcesApi,
|
|
6377
5188
|
templates: textPlatformWorkflowsTemplatesApi
|
|
6378
5189
|
};
|
|
6379
5190
|
|
|
@@ -6384,19 +5195,10 @@ var textPlatformApi = {
|
|
|
6384
5195
|
};
|
|
6385
5196
|
|
|
6386
5197
|
// src/apis/integrations/text/resourcer/api.ts
|
|
6387
|
-
var buildResourcePath = ({ provider, domain, name }) => {
|
|
6388
|
-
let targetProvider = provider;
|
|
6389
|
-
if (["text-livechat" /* LiveChat */, "text-helpdesk" /* HelpDesk */].includes(
|
|
6390
|
-
provider
|
|
6391
|
-
)) {
|
|
6392
|
-
targetProvider = "text" /* Text */;
|
|
6393
|
-
}
|
|
6394
|
-
return [targetProvider, domain, name].filter(notEmpty).join("/");
|
|
6395
|
-
};
|
|
6396
5198
|
var urls8 = {
|
|
6397
5199
|
listSchema: () => "/workflow_resources/schema",
|
|
6398
5200
|
getSchema: (provider) => `/workflow_resources/schema/${provider}`,
|
|
6399
|
-
getResource: (resource) => `/workflow_resources/resources/${
|
|
5201
|
+
getResource: (resource) => `/workflow_resources/resources/${[resource.provider, resource.domain, resource.name].filter(notEmpty).join("/")}`
|
|
6400
5202
|
};
|
|
6401
5203
|
var textResourcerApi = {
|
|
6402
5204
|
getResource(resource, credentialId, authorization) {
|
|
@@ -6468,7 +5270,61 @@ var textApi = {
|
|
|
6468
5270
|
};
|
|
6469
5271
|
|
|
6470
5272
|
// src/apis/integrations/vercel/api.ts
|
|
6471
|
-
var
|
|
5273
|
+
var import_axios24 = __toESM(require("axios"));
|
|
5274
|
+
|
|
5275
|
+
// src/apis/integrations/vercel/instance.ts
|
|
5276
|
+
var import_axios23 = __toESM(require("axios"));
|
|
5277
|
+
function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
|
|
5278
|
+
if (req.headers instanceof Headers) {
|
|
5279
|
+
return {
|
|
5280
|
+
token: req.headers.get(`${headerPrefix}-token`)
|
|
5281
|
+
};
|
|
5282
|
+
}
|
|
5283
|
+
return {
|
|
5284
|
+
token: req.headers[`${headerPrefix}-token`]
|
|
5285
|
+
};
|
|
5286
|
+
}
|
|
5287
|
+
var vercelClientInstance = import_axios23.default.create({
|
|
5288
|
+
baseURL: "https://api.vercel.com"
|
|
5289
|
+
});
|
|
5290
|
+
vercelClientInstance.interceptors.response.use(
|
|
5291
|
+
(r) => r,
|
|
5292
|
+
(error) => {
|
|
5293
|
+
var _a, _b;
|
|
5294
|
+
if (import_axios23.default.isAxiosError(error)) {
|
|
5295
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
|
|
5296
|
+
throw new UnauthorizeApiError("vercel");
|
|
5297
|
+
}
|
|
5298
|
+
}
|
|
5299
|
+
throw error;
|
|
5300
|
+
}
|
|
5301
|
+
);
|
|
5302
|
+
function getVercelClientConfig(options = {}) {
|
|
5303
|
+
var _a;
|
|
5304
|
+
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
5305
|
+
const config = {
|
|
5306
|
+
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
|
|
5307
|
+
};
|
|
5308
|
+
if (options.ensureAuthorizationToken && !config.authorization) {
|
|
5309
|
+
throw new UnauthorizeApiError("vercel");
|
|
5310
|
+
}
|
|
5311
|
+
return {
|
|
5312
|
+
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
5313
|
+
};
|
|
5314
|
+
}
|
|
5315
|
+
function initVercelClient(token) {
|
|
5316
|
+
if (token) {
|
|
5317
|
+
updateVercelClient(token);
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
function updateVercelClient(token) {
|
|
5321
|
+
const headers = vercelClientInstance.defaults.headers;
|
|
5322
|
+
if (token) {
|
|
5323
|
+
headers.Authorization = `Bearer ${token}`;
|
|
5324
|
+
} else {
|
|
5325
|
+
delete headers.Authorization;
|
|
5326
|
+
}
|
|
5327
|
+
}
|
|
6472
5328
|
|
|
6473
5329
|
// src/apis/integrations/vercel/deploy/api.ts
|
|
6474
5330
|
var vercelDeployApi = {
|
|
@@ -6732,7 +5588,7 @@ var vercelApi = {
|
|
|
6732
5588
|
client_secret: clientSecret,
|
|
6733
5589
|
redirect_uri: redirectUrl
|
|
6734
5590
|
});
|
|
6735
|
-
const response = yield
|
|
5591
|
+
const response = yield import_axios24.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
|
|
6736
5592
|
headers: {
|
|
6737
5593
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
6738
5594
|
}
|
|
@@ -6765,6 +5621,44 @@ var integrationsApi = {
|
|
|
6765
5621
|
klaviyo: klaviyoApi
|
|
6766
5622
|
};
|
|
6767
5623
|
|
|
5624
|
+
// src/apis/platform/accounts/instance.ts
|
|
5625
|
+
var AccountsApiError = class extends ApiErrorBase {
|
|
5626
|
+
constructor() {
|
|
5627
|
+
super(...arguments);
|
|
5628
|
+
this.name = "accounts";
|
|
5629
|
+
}
|
|
5630
|
+
};
|
|
5631
|
+
var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
|
|
5632
|
+
constructor(message) {
|
|
5633
|
+
super("accounts", message);
|
|
5634
|
+
}
|
|
5635
|
+
};
|
|
5636
|
+
var AccountApiClient = class extends ApiClient {
|
|
5637
|
+
constructor() {
|
|
5638
|
+
super(...arguments);
|
|
5639
|
+
this.UnauthorizedError = UnauthorizeAccountsApiError;
|
|
5640
|
+
this.Error = AccountsApiError;
|
|
5641
|
+
this.options = {
|
|
5642
|
+
headers: {
|
|
5643
|
+
"Content-Type": "application/json"
|
|
5644
|
+
}
|
|
5645
|
+
};
|
|
5646
|
+
}
|
|
5647
|
+
};
|
|
5648
|
+
var platformAccountsClientInstance = new AccountApiClient({
|
|
5649
|
+
baseURL: "https://accounts.labs.livechatinc.com"
|
|
5650
|
+
});
|
|
5651
|
+
function initPlatformAccountsClient(baseUrl, token) {
|
|
5652
|
+
if (baseUrl) {
|
|
5653
|
+
platformAccountsClientInstance.updateConfig({
|
|
5654
|
+
baseURL: baseUrl
|
|
5655
|
+
});
|
|
5656
|
+
}
|
|
5657
|
+
platformAccountsClientInstance.updateAuthorization({
|
|
5658
|
+
token
|
|
5659
|
+
});
|
|
5660
|
+
}
|
|
5661
|
+
|
|
6768
5662
|
// src/apis/platform/accounts/accounts/api.ts
|
|
6769
5663
|
var urls9 = (withBaseUrl = false) => {
|
|
6770
5664
|
const getUrl7 = (segments = []) => buildUrlFromSegments(
|
|
@@ -7075,6 +5969,38 @@ var platformAccountsApi = {
|
|
|
7075
5969
|
token: platformAccountsTokenApi
|
|
7076
5970
|
};
|
|
7077
5971
|
|
|
5972
|
+
// src/apis/platform/billing/instance.ts
|
|
5973
|
+
var import_axios25 = __toESM(require("axios"));
|
|
5974
|
+
var billingClientInstance = import_axios25.default.create({
|
|
5975
|
+
baseURL: "https://billing.labs.livechatinc.com"
|
|
5976
|
+
});
|
|
5977
|
+
function getBillingClientConfig(options = {}) {
|
|
5978
|
+
var _a;
|
|
5979
|
+
const defaultAuthorization = billingClientInstance.defaults.headers.Authorization;
|
|
5980
|
+
const headers = {
|
|
5981
|
+
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
|
|
5982
|
+
};
|
|
5983
|
+
return {
|
|
5984
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5985
|
+
};
|
|
5986
|
+
}
|
|
5987
|
+
function initBillingClient(baseUrl, token) {
|
|
5988
|
+
if (baseUrl) {
|
|
5989
|
+
billingClientInstance.interceptors.request.use(
|
|
5990
|
+
(config) => {
|
|
5991
|
+
config.baseURL = baseUrl;
|
|
5992
|
+
return config;
|
|
5993
|
+
},
|
|
5994
|
+
(error) => Promise.reject(error)
|
|
5995
|
+
);
|
|
5996
|
+
}
|
|
5997
|
+
if (token) {
|
|
5998
|
+
billingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
5999
|
+
} else {
|
|
6000
|
+
delete billingClientInstance.defaults.headers.Authorization;
|
|
6001
|
+
}
|
|
6002
|
+
}
|
|
6003
|
+
|
|
7078
6004
|
// src/apis/platform/billing/account/api.ts
|
|
7079
6005
|
var platformBillingAccountApi = {
|
|
7080
6006
|
getAccount(authorization) {
|
|
@@ -7206,6 +6132,147 @@ var platformBillingApi = {
|
|
|
7206
6132
|
invoices: platformBillingInvoicesApi
|
|
7207
6133
|
};
|
|
7208
6134
|
|
|
6135
|
+
// src/apis/platform/console/instance.ts
|
|
6136
|
+
var import_axios26 = __toESM(require("axios"));
|
|
6137
|
+
var REGION = {
|
|
6138
|
+
FRA: "fra",
|
|
6139
|
+
DAL: "dal",
|
|
6140
|
+
FRA_A: "fra-a",
|
|
6141
|
+
FRA_B: "fra-b"
|
|
6142
|
+
};
|
|
6143
|
+
var supportedRegions = Object.values(REGION);
|
|
6144
|
+
var getRegion = (token) => {
|
|
6145
|
+
const region = token.split(":")[0];
|
|
6146
|
+
if (supportedRegions.includes(region)) {
|
|
6147
|
+
return region;
|
|
6148
|
+
}
|
|
6149
|
+
};
|
|
6150
|
+
var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
|
|
6151
|
+
constructor() {
|
|
6152
|
+
super(...arguments);
|
|
6153
|
+
this.name = "console";
|
|
6154
|
+
}
|
|
6155
|
+
static notFound(message) {
|
|
6156
|
+
return new _ConsoleApiError(
|
|
6157
|
+
message != null ? message : "Not found",
|
|
6158
|
+
{
|
|
6159
|
+
errorCode: "not_found",
|
|
6160
|
+
errorMessage: "Not found"
|
|
6161
|
+
},
|
|
6162
|
+
404
|
|
6163
|
+
);
|
|
6164
|
+
}
|
|
6165
|
+
};
|
|
6166
|
+
var consoleClientInstance = import_axios26.default.create({
|
|
6167
|
+
baseURL: "https://platform.labs.text.com/console/api",
|
|
6168
|
+
headers: {
|
|
6169
|
+
"Content-Type": "application/json"
|
|
6170
|
+
}
|
|
6171
|
+
});
|
|
6172
|
+
consoleClientInstance.interceptors.response.use(
|
|
6173
|
+
(response) => response,
|
|
6174
|
+
(error) => {
|
|
6175
|
+
var _a, _b;
|
|
6176
|
+
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
6177
|
+
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
6178
|
+
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
6179
|
+
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
6180
|
+
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
6181
|
+
return Promise.reject(
|
|
6182
|
+
new ConsoleApiError(data.message, data.data, data.code)
|
|
6183
|
+
);
|
|
6184
|
+
}
|
|
6185
|
+
return Promise.reject(error);
|
|
6186
|
+
}
|
|
6187
|
+
);
|
|
6188
|
+
function getConsoleClientConfig(options = {}) {
|
|
6189
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
6190
|
+
const currentHeaders = consoleClientInstance.defaults.headers;
|
|
6191
|
+
const headers = {
|
|
6192
|
+
platform: {
|
|
6193
|
+
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
6194
|
+
},
|
|
6195
|
+
integrations: {
|
|
6196
|
+
github: {
|
|
6197
|
+
app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
|
|
6198
|
+
oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
|
|
6199
|
+
},
|
|
6200
|
+
netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
|
|
6201
|
+
vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
|
|
6202
|
+
planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
|
|
6203
|
+
neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
|
|
6204
|
+
}
|
|
6205
|
+
};
|
|
6206
|
+
if (currentHeaders.Authorization) {
|
|
6207
|
+
currentHeaders["X-Region"] = (_p = getRegion(currentHeaders.Authorization)) != null ? _p : void 0;
|
|
6208
|
+
}
|
|
6209
|
+
if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
|
|
6210
|
+
throw new UnauthorizeApiError("accounts");
|
|
6211
|
+
}
|
|
6212
|
+
if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
6213
|
+
throw new UnauthorizeApiError("github");
|
|
6214
|
+
}
|
|
6215
|
+
if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
|
|
6216
|
+
throw new UnauthorizeApiError("vercel");
|
|
6217
|
+
}
|
|
6218
|
+
if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
|
|
6219
|
+
throw new UnauthorizeApiError("netlify");
|
|
6220
|
+
}
|
|
6221
|
+
if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
|
|
6222
|
+
throw new UnauthorizeApiError("planetscale");
|
|
6223
|
+
}
|
|
6224
|
+
if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
|
|
6225
|
+
throw new UnauthorizeApiError("neon");
|
|
6226
|
+
}
|
|
6227
|
+
return {
|
|
6228
|
+
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {})
|
|
6229
|
+
};
|
|
6230
|
+
}
|
|
6231
|
+
var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6232
|
+
ensureAuthorizationToken: {
|
|
6233
|
+
platform: true
|
|
6234
|
+
}
|
|
6235
|
+
}));
|
|
6236
|
+
function initConsoleClient(baseUrl, tokens) {
|
|
6237
|
+
if (baseUrl) {
|
|
6238
|
+
consoleClientInstance.interceptors.request.use(
|
|
6239
|
+
(config) => {
|
|
6240
|
+
config.baseURL = baseUrl;
|
|
6241
|
+
return config;
|
|
6242
|
+
},
|
|
6243
|
+
(error) => Promise.reject(error)
|
|
6244
|
+
);
|
|
6245
|
+
}
|
|
6246
|
+
if (tokens) {
|
|
6247
|
+
updateConsoleClient(tokens);
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
function updateConsoleClient(tokens) {
|
|
6251
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6252
|
+
const headers = consoleClientInstance.defaults.headers;
|
|
6253
|
+
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
6254
|
+
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
6255
|
+
}
|
|
6256
|
+
if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
|
|
6257
|
+
headers["x-adapter-github-app-token"] = tokens.github.appToken;
|
|
6258
|
+
}
|
|
6259
|
+
if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
|
|
6260
|
+
headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
|
|
6261
|
+
}
|
|
6262
|
+
if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
|
|
6263
|
+
headers["x-adapter-netlify-token"] = tokens.netlify.token;
|
|
6264
|
+
}
|
|
6265
|
+
if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
|
|
6266
|
+
headers["x-adapter-vercel-token"] = tokens.vercel.token;
|
|
6267
|
+
}
|
|
6268
|
+
if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
|
|
6269
|
+
headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
|
|
6270
|
+
}
|
|
6271
|
+
if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
|
|
6272
|
+
headers["x-adapter-neon-token"] = tokens.neon.token;
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
|
|
7209
6276
|
// src/apis/platform/console/app/blocks/authorization/api.ts
|
|
7210
6277
|
var platformConsoleAppAuthorizationApi = {
|
|
7211
6278
|
get(appId, authorization) {
|
|
@@ -7716,6 +6783,62 @@ var platformConsoleApi = {
|
|
|
7716
6783
|
}
|
|
7717
6784
|
};
|
|
7718
6785
|
|
|
6786
|
+
// src/apis/platform/dps/instance.ts
|
|
6787
|
+
var import_axios27 = __toESM(require("axios"));
|
|
6788
|
+
var DpsApiError = class extends ApiErrorBase {
|
|
6789
|
+
constructor() {
|
|
6790
|
+
super(...arguments);
|
|
6791
|
+
this.name = "dps";
|
|
6792
|
+
}
|
|
6793
|
+
};
|
|
6794
|
+
var dpsClientInstance = import_axios27.default.create({
|
|
6795
|
+
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
6796
|
+
});
|
|
6797
|
+
dpsClientInstance.interceptors.response.use(
|
|
6798
|
+
(response) => response,
|
|
6799
|
+
(error) => {
|
|
6800
|
+
var _a, _b, _c, _d;
|
|
6801
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
|
|
6802
|
+
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
6803
|
+
}
|
|
6804
|
+
return Promise.reject(
|
|
6805
|
+
new DpsApiError(
|
|
6806
|
+
error.message,
|
|
6807
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
6808
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
6809
|
+
)
|
|
6810
|
+
);
|
|
6811
|
+
}
|
|
6812
|
+
);
|
|
6813
|
+
function getDpsClientConfig(options = {}) {
|
|
6814
|
+
var _a, _b;
|
|
6815
|
+
const currentHeaders = dpsClientInstance.defaults.headers;
|
|
6816
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
6817
|
+
const headers = {
|
|
6818
|
+
authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization
|
|
6819
|
+
};
|
|
6820
|
+
return {
|
|
6821
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
6822
|
+
};
|
|
6823
|
+
}
|
|
6824
|
+
function initDpsClient(baseUrl, token) {
|
|
6825
|
+
const headers = dpsClientInstance.defaults.headers;
|
|
6826
|
+
if (baseUrl) {
|
|
6827
|
+
dpsClientInstance.interceptors.request.use(
|
|
6828
|
+
(config) => {
|
|
6829
|
+
config.baseURL = baseUrl;
|
|
6830
|
+
return config;
|
|
6831
|
+
},
|
|
6832
|
+
(error) => Promise.reject(error)
|
|
6833
|
+
);
|
|
6834
|
+
}
|
|
6835
|
+
if (token) {
|
|
6836
|
+
headers.Authorization = `Bearer ${token}`;
|
|
6837
|
+
} else {
|
|
6838
|
+
delete headers.Authorization;
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
|
|
7719
6842
|
// src/apis/platform/dps/applications/application/authorization/api.ts
|
|
7720
6843
|
var platformDpsApplicationAuthorizationApi = {
|
|
7721
6844
|
createAuth(appId, payload, authorization) {
|
|
@@ -7731,18 +6854,86 @@ var platformDpsApplicationAuthorizationApi = {
|
|
|
7731
6854
|
});
|
|
7732
6855
|
});
|
|
7733
6856
|
},
|
|
7734
|
-
deleteAuth(appId, authorization) {
|
|
7735
|
-
return __async(this, null, function* () {
|
|
7736
|
-
yield dpsClientInstance.delete(
|
|
7737
|
-
`/v2/applications/${encodeURIComponent(appId)}/authorization`,
|
|
7738
|
-
getDpsClientConfig(authorization)
|
|
7739
|
-
).catch((error) => {
|
|
7740
|
-
throw error.withCustomMessage(
|
|
7741
|
-
`${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.DELETED} [${error.message}]`
|
|
7742
|
-
);
|
|
7743
|
-
});
|
|
7744
|
-
});
|
|
6857
|
+
deleteAuth(appId, authorization) {
|
|
6858
|
+
return __async(this, null, function* () {
|
|
6859
|
+
yield dpsClientInstance.delete(
|
|
6860
|
+
`/v2/applications/${encodeURIComponent(appId)}/authorization`,
|
|
6861
|
+
getDpsClientConfig(authorization)
|
|
6862
|
+
).catch((error) => {
|
|
6863
|
+
throw error.withCustomMessage(
|
|
6864
|
+
`${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.DELETED} [${error.message}]`
|
|
6865
|
+
);
|
|
6866
|
+
});
|
|
6867
|
+
});
|
|
6868
|
+
}
|
|
6869
|
+
};
|
|
6870
|
+
|
|
6871
|
+
// src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
|
|
6872
|
+
var getEmptyAppAutoReview = () => ({
|
|
6873
|
+
isReviewed: false,
|
|
6874
|
+
recommendations: {
|
|
6875
|
+
listingDetails: {
|
|
6876
|
+
appName: "",
|
|
6877
|
+
shortDescription: "",
|
|
6878
|
+
longDescription: "",
|
|
6879
|
+
features: "",
|
|
6880
|
+
benefits: ""
|
|
6881
|
+
},
|
|
6882
|
+
auth: {
|
|
6883
|
+
hasZeroScopes: false
|
|
6884
|
+
}
|
|
6885
|
+
},
|
|
6886
|
+
errors: {
|
|
6887
|
+
listingDetails: {
|
|
6888
|
+
appName: "",
|
|
6889
|
+
shortDescription: "",
|
|
6890
|
+
longDescription: "",
|
|
6891
|
+
features: "",
|
|
6892
|
+
benefits: ""
|
|
6893
|
+
},
|
|
6894
|
+
auth: {
|
|
6895
|
+
hasAllScopes: false,
|
|
6896
|
+
isRedirectUriSafe: false
|
|
6897
|
+
},
|
|
6898
|
+
links: {
|
|
6899
|
+
tutorial: {
|
|
6900
|
+
returns200: false,
|
|
6901
|
+
isValid: false
|
|
6902
|
+
},
|
|
6903
|
+
privacyPolicy: {
|
|
6904
|
+
returns200: false,
|
|
6905
|
+
isValid: false
|
|
6906
|
+
}
|
|
6907
|
+
},
|
|
6908
|
+
images: {
|
|
6909
|
+
icon: {
|
|
6910
|
+
isNsfw: false,
|
|
6911
|
+
isRatioValid: false
|
|
6912
|
+
},
|
|
6913
|
+
screenshots: {
|
|
6914
|
+
areEmpty: false,
|
|
6915
|
+
areNsfw: false,
|
|
6916
|
+
areRatiosValid: false
|
|
6917
|
+
}
|
|
6918
|
+
}
|
|
7745
6919
|
}
|
|
6920
|
+
});
|
|
6921
|
+
|
|
6922
|
+
// src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
|
|
6923
|
+
var getAppAutoReviewPayload = (value) => {
|
|
6924
|
+
return {
|
|
6925
|
+
appName: value,
|
|
6926
|
+
shortDescription: value,
|
|
6927
|
+
longDescription: value,
|
|
6928
|
+
features: value,
|
|
6929
|
+
benefits: value,
|
|
6930
|
+
scopes: value,
|
|
6931
|
+
redirect: value,
|
|
6932
|
+
tutorial: value,
|
|
6933
|
+
privacyPolicy: value,
|
|
6934
|
+
icons: value,
|
|
6935
|
+
screenshots: value
|
|
6936
|
+
};
|
|
7746
6937
|
};
|
|
7747
6938
|
|
|
7748
6939
|
// src/apis/platform/dps/applications/application/autoReview/api.ts
|
|
@@ -9079,6 +8270,62 @@ var platformApi = {
|
|
|
9079
8270
|
dps: platformDpsApi
|
|
9080
8271
|
};
|
|
9081
8272
|
|
|
8273
|
+
// src/apis/products/helpdesk/instance.ts
|
|
8274
|
+
var import_axios28 = __toESM(require("axios"));
|
|
8275
|
+
var HelpDeskApiError = class extends ApiErrorBase {
|
|
8276
|
+
constructor() {
|
|
8277
|
+
super(...arguments);
|
|
8278
|
+
this.name = "helpdesk";
|
|
8279
|
+
}
|
|
8280
|
+
};
|
|
8281
|
+
var helpdeskClientInstance = import_axios28.default.create({
|
|
8282
|
+
baseURL: "https://api.labs.helpdesk.com"
|
|
8283
|
+
});
|
|
8284
|
+
helpdeskClientInstance.interceptors.response.use(
|
|
8285
|
+
(response) => response,
|
|
8286
|
+
(error) => {
|
|
8287
|
+
var _a, _b, _c, _d;
|
|
8288
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
8289
|
+
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
8290
|
+
}
|
|
8291
|
+
return Promise.reject(
|
|
8292
|
+
new HelpDeskApiError(
|
|
8293
|
+
error.message,
|
|
8294
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
8295
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
8296
|
+
)
|
|
8297
|
+
);
|
|
8298
|
+
}
|
|
8299
|
+
);
|
|
8300
|
+
function getHelpDeskClientConfig(options = {}) {
|
|
8301
|
+
var _a, _b;
|
|
8302
|
+
const currentHeaders = helpdeskClientInstance.defaults.headers;
|
|
8303
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
8304
|
+
const headers = {
|
|
8305
|
+
authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization
|
|
8306
|
+
};
|
|
8307
|
+
return {
|
|
8308
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
8309
|
+
};
|
|
8310
|
+
}
|
|
8311
|
+
function initHelpDeskClient(baseUrl, token) {
|
|
8312
|
+
const headers = helpdeskClientInstance.defaults.headers;
|
|
8313
|
+
if (baseUrl) {
|
|
8314
|
+
helpdeskClientInstance.interceptors.request.use(
|
|
8315
|
+
(config) => {
|
|
8316
|
+
config.baseURL = baseUrl;
|
|
8317
|
+
return config;
|
|
8318
|
+
},
|
|
8319
|
+
(error) => Promise.reject(error)
|
|
8320
|
+
);
|
|
8321
|
+
}
|
|
8322
|
+
if (token) {
|
|
8323
|
+
headers.Authorization = `Bearer ${token}`;
|
|
8324
|
+
} else {
|
|
8325
|
+
delete headers.Authorization;
|
|
8326
|
+
}
|
|
8327
|
+
}
|
|
8328
|
+
|
|
9082
8329
|
// src/apis/products/helpdesk/webhooks/api.ts
|
|
9083
8330
|
var helpdeskWebhooksApi = {
|
|
9084
8331
|
list(authorization) {
|
|
@@ -9135,6 +8382,83 @@ var helpdeskApi = {
|
|
|
9135
8382
|
webhooks: helpdeskWebhooksApi
|
|
9136
8383
|
};
|
|
9137
8384
|
|
|
8385
|
+
// src/apis/products/livechat/instance.ts
|
|
8386
|
+
var import_axios29 = __toESM(require("axios"));
|
|
8387
|
+
var REGION2 = {
|
|
8388
|
+
FRA: "fra",
|
|
8389
|
+
DAL: "dal",
|
|
8390
|
+
FRA_A: "fra-a",
|
|
8391
|
+
FRA_B: "fra-b"
|
|
8392
|
+
};
|
|
8393
|
+
var supportedRegions2 = Object.values(REGION2);
|
|
8394
|
+
var getRegion2 = (token) => {
|
|
8395
|
+
const region = token.split(":")[0];
|
|
8396
|
+
if (supportedRegions2.includes(region)) {
|
|
8397
|
+
return region;
|
|
8398
|
+
}
|
|
8399
|
+
};
|
|
8400
|
+
var LivechatApiError = class extends ApiErrorBase {
|
|
8401
|
+
constructor() {
|
|
8402
|
+
super(...arguments);
|
|
8403
|
+
this.name = "livechat";
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
var livechatClientInstance = import_axios29.default.create({
|
|
8407
|
+
baseURL: "https://api.labs.livechatinc.com"
|
|
8408
|
+
});
|
|
8409
|
+
livechatClientInstance.interceptors.response.use(
|
|
8410
|
+
(response) => response,
|
|
8411
|
+
(error) => {
|
|
8412
|
+
var _a, _b, _c, _d;
|
|
8413
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
8414
|
+
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
8415
|
+
}
|
|
8416
|
+
return Promise.reject(
|
|
8417
|
+
new LivechatApiError(
|
|
8418
|
+
error.message,
|
|
8419
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
8420
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
8421
|
+
)
|
|
8422
|
+
);
|
|
8423
|
+
}
|
|
8424
|
+
);
|
|
8425
|
+
function getLiveChatClientConfig(options = {}) {
|
|
8426
|
+
var _a, _b, _c;
|
|
8427
|
+
const currentHeaders = livechatClientInstance.defaults.headers;
|
|
8428
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
8429
|
+
const defaultRegion = currentHeaders["X-Region"];
|
|
8430
|
+
const headers = {
|
|
8431
|
+
Authorization: (_b = options.token ? `${(_a = options.tokenType) != null ? _a : "Bearer"} ${options.token}` : void 0) != null ? _b : defaultAuthorization,
|
|
8432
|
+
"X-Region": (_c = options.region) != null ? _c : defaultRegion
|
|
8433
|
+
};
|
|
8434
|
+
return {
|
|
8435
|
+
headers: __spreadValues(__spreadValues({}, headers.Authorization ? { Authorization: headers.Authorization } : {}), headers["X-Region"] ? {
|
|
8436
|
+
"X-Region": headers["X-Region"]
|
|
8437
|
+
} : {})
|
|
8438
|
+
};
|
|
8439
|
+
}
|
|
8440
|
+
function initLiveChatClient(baseUrl, token) {
|
|
8441
|
+
const region = token ? getRegion2(token) : void 0;
|
|
8442
|
+
const headers = livechatClientInstance.defaults.headers;
|
|
8443
|
+
if (baseUrl) {
|
|
8444
|
+
livechatClientInstance.interceptors.request.use(
|
|
8445
|
+
(config) => {
|
|
8446
|
+
config.baseURL = baseUrl;
|
|
8447
|
+
return config;
|
|
8448
|
+
},
|
|
8449
|
+
(error) => Promise.reject(error)
|
|
8450
|
+
);
|
|
8451
|
+
}
|
|
8452
|
+
if (region) {
|
|
8453
|
+
headers["X-Region"] = region;
|
|
8454
|
+
}
|
|
8455
|
+
if (token) {
|
|
8456
|
+
headers.Authorization = `Bearer ${token}`;
|
|
8457
|
+
} else {
|
|
8458
|
+
delete headers.Authorization;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
|
|
9138
8462
|
// src/apis/products/livechat/agents/api.ts
|
|
9139
8463
|
var livechatAgentApi = {
|
|
9140
8464
|
getUser() {
|
|
@@ -9649,309 +8973,941 @@ var livechatWebhookApi = {
|
|
|
9649
8973
|
});
|
|
9650
8974
|
});
|
|
9651
8975
|
},
|
|
9652
|
-
registerWebhooks(webhooks, authorization) {
|
|
8976
|
+
registerWebhooks(webhooks, authorization) {
|
|
8977
|
+
return __async(this, null, function* () {
|
|
8978
|
+
try {
|
|
8979
|
+
yield this.unregisterWebhooks(webhooks[0].owner_client_id, authorization);
|
|
8980
|
+
yield Promise.all(
|
|
8981
|
+
webhooks.map((webhook) => __async(this, null, function* () {
|
|
8982
|
+
return livechatClientInstance.post(
|
|
8983
|
+
`/v${webhook.api_version || "3.6"}/configuration/action/register_webhook`,
|
|
8984
|
+
{
|
|
8985
|
+
url: webhook.url,
|
|
8986
|
+
action: webhook.action,
|
|
8987
|
+
secret_key: webhook.secret_key,
|
|
8988
|
+
owner_client_id: webhook.owner_client_id,
|
|
8989
|
+
type: webhook.type,
|
|
8990
|
+
description: webhook.description,
|
|
8991
|
+
filters: webhook.filters,
|
|
8992
|
+
additional_data: webhook.additional_data
|
|
8993
|
+
},
|
|
8994
|
+
getLiveChatClientConfig(authorization)
|
|
8995
|
+
);
|
|
8996
|
+
}))
|
|
8997
|
+
);
|
|
8998
|
+
} catch (error) {
|
|
8999
|
+
if (error instanceof LivechatApiError) {
|
|
9000
|
+
throw error.withCustomMessage(
|
|
9001
|
+
`${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
|
|
9002
|
+
);
|
|
9003
|
+
} else {
|
|
9004
|
+
throw error;
|
|
9005
|
+
}
|
|
9006
|
+
}
|
|
9007
|
+
});
|
|
9008
|
+
},
|
|
9009
|
+
getLicenseWebhooksList(isAgent, authorization) {
|
|
9010
|
+
return __async(this, null, function* () {
|
|
9011
|
+
if (isAgent) {
|
|
9012
|
+
return {
|
|
9013
|
+
data: []
|
|
9014
|
+
};
|
|
9015
|
+
}
|
|
9016
|
+
try {
|
|
9017
|
+
const response = yield livechatClientInstance.post(
|
|
9018
|
+
"/v3.2/configuration/action/list_registered_webhooks",
|
|
9019
|
+
{},
|
|
9020
|
+
getLiveChatClientConfig(authorization)
|
|
9021
|
+
);
|
|
9022
|
+
return response;
|
|
9023
|
+
} catch (error) {
|
|
9024
|
+
if (error instanceof LivechatApiError) {
|
|
9025
|
+
throw error.withCustomMessage(
|
|
9026
|
+
`Registered Webhooks couldn't be fetched. [${error.message}]`
|
|
9027
|
+
);
|
|
9028
|
+
} else {
|
|
9029
|
+
throw error;
|
|
9030
|
+
}
|
|
9031
|
+
}
|
|
9032
|
+
});
|
|
9033
|
+
},
|
|
9034
|
+
deleteLicenseWebhook(id, authorization) {
|
|
9653
9035
|
return __async(this, null, function* () {
|
|
9654
9036
|
try {
|
|
9655
|
-
yield
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
`/v${webhook.api_version || "3.6"}/configuration/action/register_webhook`,
|
|
9660
|
-
{
|
|
9661
|
-
url: webhook.url,
|
|
9662
|
-
action: webhook.action,
|
|
9663
|
-
secret_key: webhook.secret_key,
|
|
9664
|
-
owner_client_id: webhook.owner_client_id,
|
|
9665
|
-
type: webhook.type,
|
|
9666
|
-
description: webhook.description,
|
|
9667
|
-
filters: webhook.filters,
|
|
9668
|
-
additional_data: webhook.additional_data
|
|
9669
|
-
},
|
|
9670
|
-
getLiveChatClientConfig(authorization)
|
|
9671
|
-
);
|
|
9672
|
-
}))
|
|
9037
|
+
const response = yield livechatClientInstance.post(
|
|
9038
|
+
"/v3.2/configuration/action/unregister_webhook",
|
|
9039
|
+
{ webhook_id: id },
|
|
9040
|
+
getLiveChatClientConfig(authorization)
|
|
9673
9041
|
);
|
|
9042
|
+
return response;
|
|
9674
9043
|
} catch (error) {
|
|
9675
9044
|
if (error instanceof LivechatApiError) {
|
|
9676
9045
|
throw error.withCustomMessage(
|
|
9677
|
-
|
|
9046
|
+
`Registered Webhooks couldn't be deleted. [${error.message}]`
|
|
9047
|
+
);
|
|
9048
|
+
} else {
|
|
9049
|
+
throw error;
|
|
9050
|
+
}
|
|
9051
|
+
}
|
|
9052
|
+
});
|
|
9053
|
+
},
|
|
9054
|
+
getWebhookNamesList(version, authorization) {
|
|
9055
|
+
return __async(this, null, function* () {
|
|
9056
|
+
try {
|
|
9057
|
+
const response = yield livechatClientInstance.post(
|
|
9058
|
+
"/v3.5/configuration/action/list_webhook_names",
|
|
9059
|
+
{ version },
|
|
9060
|
+
getLiveChatClientConfig(authorization)
|
|
9061
|
+
);
|
|
9062
|
+
return response;
|
|
9063
|
+
} catch (error) {
|
|
9064
|
+
if (error instanceof Error) {
|
|
9065
|
+
throw new Error(
|
|
9066
|
+
`Webhook names list couldn't be fetched. [${error.message}]`
|
|
9678
9067
|
);
|
|
9679
9068
|
} else {
|
|
9680
9069
|
throw error;
|
|
9681
9070
|
}
|
|
9682
9071
|
}
|
|
9683
9072
|
});
|
|
9073
|
+
}
|
|
9074
|
+
};
|
|
9075
|
+
|
|
9076
|
+
// src/apis/products/livechat/configuration/api.ts
|
|
9077
|
+
var livechatConfigurationApi = {
|
|
9078
|
+
agents: livechatAgentsApi,
|
|
9079
|
+
bots: livechatBotsTemplatesApi,
|
|
9080
|
+
property: livechatPropertyApi,
|
|
9081
|
+
webhook: livechatWebhookApi
|
|
9082
|
+
};
|
|
9083
|
+
|
|
9084
|
+
// src/apis/products/livechat/api.ts
|
|
9085
|
+
var livechatApi = {
|
|
9086
|
+
agent: livechatAgentApi,
|
|
9087
|
+
configuration: livechatConfigurationApi
|
|
9088
|
+
};
|
|
9089
|
+
|
|
9090
|
+
// src/apis/products/api.ts
|
|
9091
|
+
var productsApi = {
|
|
9092
|
+
livechat: livechatApi,
|
|
9093
|
+
helpdesk: helpdeskApi
|
|
9094
|
+
};
|
|
9095
|
+
|
|
9096
|
+
// src/apis/text-intelligence/workflows/adapter/instance.ts
|
|
9097
|
+
var import_axios30 = __toESM(require("axios"));
|
|
9098
|
+
var REGION3 = {
|
|
9099
|
+
FRA: "fra",
|
|
9100
|
+
DAL: "dal",
|
|
9101
|
+
FRA_A: "fra-a",
|
|
9102
|
+
FRA_B: "fra-b"
|
|
9103
|
+
};
|
|
9104
|
+
var supportedRegions3 = Object.values(REGION3);
|
|
9105
|
+
var getRegion3 = (token) => {
|
|
9106
|
+
const region = token.split(":")[0];
|
|
9107
|
+
if (supportedRegions3.includes(region)) {
|
|
9108
|
+
return region;
|
|
9109
|
+
}
|
|
9110
|
+
};
|
|
9111
|
+
var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
|
|
9112
|
+
constructor() {
|
|
9113
|
+
super(...arguments);
|
|
9114
|
+
this.name = "adapter";
|
|
9115
|
+
}
|
|
9116
|
+
static notFound(message) {
|
|
9117
|
+
return new _AdapterApiError(
|
|
9118
|
+
message != null ? message : "Not found",
|
|
9119
|
+
{
|
|
9120
|
+
errorCode: "not_found",
|
|
9121
|
+
errorMessage: "Not found"
|
|
9122
|
+
},
|
|
9123
|
+
404
|
|
9124
|
+
);
|
|
9125
|
+
}
|
|
9126
|
+
};
|
|
9127
|
+
var adapterClientInstance = import_axios30.default.create({
|
|
9128
|
+
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
9129
|
+
headers: {
|
|
9130
|
+
"Content-Type": "application/json"
|
|
9131
|
+
}
|
|
9132
|
+
});
|
|
9133
|
+
adapterClientInstance.interceptors.response.use(
|
|
9134
|
+
(response) => response,
|
|
9135
|
+
(error) => {
|
|
9136
|
+
var _a, _b;
|
|
9137
|
+
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
9138
|
+
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
9139
|
+
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
9140
|
+
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
9141
|
+
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
9142
|
+
return Promise.reject(
|
|
9143
|
+
new AdapterApiError(data.message, data.data, data.code)
|
|
9144
|
+
);
|
|
9145
|
+
}
|
|
9146
|
+
return Promise.reject(error);
|
|
9147
|
+
}
|
|
9148
|
+
);
|
|
9149
|
+
function getAdapterClientConfig(options = {}) {
|
|
9150
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W;
|
|
9151
|
+
const currentHeaders = adapterClientInstance.defaults.headers;
|
|
9152
|
+
const headers = {
|
|
9153
|
+
platform: {
|
|
9154
|
+
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
9155
|
+
},
|
|
9156
|
+
integrations: {
|
|
9157
|
+
github: {
|
|
9158
|
+
app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
|
|
9159
|
+
oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
|
|
9160
|
+
},
|
|
9161
|
+
netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
|
|
9162
|
+
vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
|
|
9163
|
+
planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
|
|
9164
|
+
neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token,
|
|
9165
|
+
mailchimp: (_q = currentHeaders["x-adapter-mailchimp-token"]) != null ? _q : (_p = options.mailchimp) == null ? void 0 : _p.token,
|
|
9166
|
+
mailchimpServer: (_s = currentHeaders["x-adapter-mailchimp-server"]) != null ? _s : (_r = options.mailchimp) == null ? void 0 : _r.server,
|
|
9167
|
+
shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
|
|
9168
|
+
shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
|
|
9169
|
+
hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
|
|
9170
|
+
slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
|
|
9171
|
+
bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
|
|
9172
|
+
bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
|
|
9173
|
+
text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
|
|
9174
|
+
}
|
|
9175
|
+
};
|
|
9176
|
+
if (currentHeaders.Authorization) {
|
|
9177
|
+
currentHeaders["X-Region"] = (_H = getRegion3(currentHeaders.Authorization)) != null ? _H : void 0;
|
|
9178
|
+
}
|
|
9179
|
+
if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
|
|
9180
|
+
throw new UnauthorizeApiError("accounts");
|
|
9181
|
+
}
|
|
9182
|
+
if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
9183
|
+
throw new UnauthorizeApiError("github");
|
|
9184
|
+
}
|
|
9185
|
+
if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
|
|
9186
|
+
throw new UnauthorizeApiError("vercel");
|
|
9187
|
+
}
|
|
9188
|
+
if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
|
|
9189
|
+
throw new UnauthorizeApiError("netlify");
|
|
9190
|
+
}
|
|
9191
|
+
if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
|
|
9192
|
+
throw new UnauthorizeApiError("planetscale");
|
|
9193
|
+
}
|
|
9194
|
+
if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
|
|
9195
|
+
throw new UnauthorizeApiError("neon");
|
|
9196
|
+
}
|
|
9197
|
+
if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
9198
|
+
throw new UnauthorizeApiError("mailchimp");
|
|
9199
|
+
}
|
|
9200
|
+
if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
9201
|
+
throw new UnauthorizeApiError("shopify");
|
|
9202
|
+
}
|
|
9203
|
+
if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
|
|
9204
|
+
throw new UnauthorizeApiError("hubspot");
|
|
9205
|
+
}
|
|
9206
|
+
if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
|
|
9207
|
+
throw new UnauthorizeApiError("slack");
|
|
9208
|
+
}
|
|
9209
|
+
if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
|
|
9210
|
+
throw new UnauthorizeApiError("bigcommerce");
|
|
9211
|
+
}
|
|
9212
|
+
if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
|
|
9213
|
+
throw new UnauthorizeApiError("text");
|
|
9214
|
+
}
|
|
9215
|
+
return __spreadProps(__spreadValues({}, options.baseUrl ? { baseURL: options.baseUrl } : {}), {
|
|
9216
|
+
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), ((_U = options.internal) == null ? void 0 : _U.token) ? {
|
|
9217
|
+
[PROXY_AUTHORIZATION_HEADER]: `Bearer ${options.internal.token}`
|
|
9218
|
+
} : {}), ((_V = options.internal) == null ? void 0 : _V.organizationId) ? { [SERVICE_ORGANIZATION_ID_HEADER]: options.internal.organizationId } : {}), ((_W = options.internal) == null ? void 0 : _W.accountId) ? { [SERVICE_ACCOUNT_ID_HEADER]: options.internal.accountId } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.slack ? { "x-adapter-slack-token": headers.integrations.slack } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
|
|
9219
|
+
});
|
|
9220
|
+
}
|
|
9221
|
+
var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
9222
|
+
ensureAuthorizationToken: {
|
|
9223
|
+
platform: true
|
|
9224
|
+
}
|
|
9225
|
+
}));
|
|
9226
|
+
function initAdapterClient(baseUrl, tokens) {
|
|
9227
|
+
if (baseUrl) {
|
|
9228
|
+
adapterClientInstance.defaults.baseURL = baseUrl;
|
|
9229
|
+
}
|
|
9230
|
+
if (tokens) {
|
|
9231
|
+
updateAdapterClient(tokens);
|
|
9232
|
+
}
|
|
9233
|
+
}
|
|
9234
|
+
function updateAdapterClient(tokens) {
|
|
9235
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
9236
|
+
const headers = adapterClientInstance.defaults.headers;
|
|
9237
|
+
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
9238
|
+
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
9239
|
+
}
|
|
9240
|
+
if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
|
|
9241
|
+
headers["x-adapter-github-app-token"] = tokens.github.appToken;
|
|
9242
|
+
}
|
|
9243
|
+
if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
|
|
9244
|
+
headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
|
|
9245
|
+
}
|
|
9246
|
+
if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
|
|
9247
|
+
headers["x-adapter-netlify-token"] = tokens.netlify.token;
|
|
9248
|
+
}
|
|
9249
|
+
if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
|
|
9250
|
+
headers["x-adapter-vercel-token"] = tokens.vercel.token;
|
|
9251
|
+
}
|
|
9252
|
+
if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
|
|
9253
|
+
headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
|
|
9254
|
+
}
|
|
9255
|
+
if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
|
|
9256
|
+
headers["x-adapter-neon-token"] = tokens.neon.token;
|
|
9257
|
+
}
|
|
9258
|
+
if ((_i = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _i.server) {
|
|
9259
|
+
headers["x-adapter-mailchimp-server"] = tokens.mailchimp.server;
|
|
9260
|
+
}
|
|
9261
|
+
if ((_j = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _j.token) {
|
|
9262
|
+
headers["x-adapter-mailchimp-token"] = tokens.mailchimp.token;
|
|
9263
|
+
}
|
|
9264
|
+
if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.shop) {
|
|
9265
|
+
headers["x-adapter-shopify-shop"] = tokens.shopify.shop;
|
|
9266
|
+
}
|
|
9267
|
+
if ((_l = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _l.token) {
|
|
9268
|
+
headers["x-adapter-shopify-token"] = tokens.shopify.token;
|
|
9269
|
+
}
|
|
9270
|
+
if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
|
|
9271
|
+
headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
|
|
9272
|
+
}
|
|
9273
|
+
if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
|
|
9274
|
+
headers["x-adapter-slack-token"] = tokens.slack.token;
|
|
9275
|
+
}
|
|
9276
|
+
if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
|
|
9277
|
+
headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
|
|
9278
|
+
}
|
|
9279
|
+
if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
|
|
9280
|
+
headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
|
|
9281
|
+
}
|
|
9282
|
+
if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
|
|
9283
|
+
headers["x-adapter-text-token"] = tokens.text.token;
|
|
9284
|
+
}
|
|
9285
|
+
}
|
|
9286
|
+
|
|
9287
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/notifications/api.ts
|
|
9288
|
+
var workflowsAdapterEventNotificationsApi = {
|
|
9289
|
+
getNotifications(payload, authorization) {
|
|
9290
|
+
return __async(this, null, function* () {
|
|
9291
|
+
const response = yield adapterClientInstance.get(
|
|
9292
|
+
"/admin/events/notifications",
|
|
9293
|
+
__spreadProps(__spreadValues({}, getAdapterClientConfig(authorization)), {
|
|
9294
|
+
params: payload
|
|
9295
|
+
})
|
|
9296
|
+
);
|
|
9297
|
+
return response.data;
|
|
9298
|
+
});
|
|
9684
9299
|
},
|
|
9685
|
-
|
|
9300
|
+
getNotificationById(id, authorization) {
|
|
9686
9301
|
return __async(this, null, function* () {
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
}
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
}
|
|
9302
|
+
const response = yield adapterClientInstance.get(
|
|
9303
|
+
`/admin/events/notifications/${id}`,
|
|
9304
|
+
getAdapterClientConfig(authorization)
|
|
9305
|
+
);
|
|
9306
|
+
return response.data;
|
|
9307
|
+
});
|
|
9308
|
+
}
|
|
9309
|
+
};
|
|
9310
|
+
|
|
9311
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/api.ts
|
|
9312
|
+
var workflowsAdapterEventSubscriptionsApi = {
|
|
9313
|
+
getSubscriptions(payload, authorization) {
|
|
9314
|
+
return __async(this, null, function* () {
|
|
9315
|
+
const response = yield adapterClientInstance.get(
|
|
9316
|
+
"/admin/events/subscriptions",
|
|
9317
|
+
__spreadProps(__spreadValues({}, getAdapterClientConfig(authorization)), {
|
|
9318
|
+
params: payload
|
|
9319
|
+
})
|
|
9320
|
+
);
|
|
9321
|
+
return response.data;
|
|
9708
9322
|
});
|
|
9709
9323
|
},
|
|
9710
|
-
|
|
9324
|
+
getSubscriptionById(id, authorization) {
|
|
9711
9325
|
return __async(this, null, function* () {
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
);
|
|
9718
|
-
return response;
|
|
9719
|
-
} catch (error) {
|
|
9720
|
-
if (error instanceof LivechatApiError) {
|
|
9721
|
-
throw error.withCustomMessage(
|
|
9722
|
-
`Registered Webhooks couldn't be deleted. [${error.message}]`
|
|
9723
|
-
);
|
|
9724
|
-
} else {
|
|
9725
|
-
throw error;
|
|
9726
|
-
}
|
|
9727
|
-
}
|
|
9326
|
+
const response = yield adapterClientInstance.get(
|
|
9327
|
+
`/admin/events/subscriptions/${id}`,
|
|
9328
|
+
getAdapterClientConfig(authorization)
|
|
9329
|
+
);
|
|
9330
|
+
return response.data;
|
|
9728
9331
|
});
|
|
9729
9332
|
},
|
|
9730
|
-
|
|
9333
|
+
getSubscriptionStats(authorization) {
|
|
9731
9334
|
return __async(this, null, function* () {
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
);
|
|
9738
|
-
return response;
|
|
9739
|
-
} catch (error) {
|
|
9740
|
-
if (error instanceof Error) {
|
|
9741
|
-
throw new Error(
|
|
9742
|
-
`Webhook names list couldn't be fetched. [${error.message}]`
|
|
9743
|
-
);
|
|
9744
|
-
} else {
|
|
9745
|
-
throw error;
|
|
9746
|
-
}
|
|
9747
|
-
}
|
|
9335
|
+
const response = yield adapterClientInstance.get(
|
|
9336
|
+
"/admin/events/subscriptions/stats",
|
|
9337
|
+
getAdapterClientConfig(authorization)
|
|
9338
|
+
);
|
|
9339
|
+
return response.data;
|
|
9748
9340
|
});
|
|
9749
9341
|
}
|
|
9750
9342
|
};
|
|
9751
9343
|
|
|
9752
|
-
// src/apis/
|
|
9753
|
-
var
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
property: livechatPropertyApi,
|
|
9757
|
-
webhook: livechatWebhookApi
|
|
9344
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/api.ts
|
|
9345
|
+
var workflowsAdapterAdminEventsApi = {
|
|
9346
|
+
notifications: workflowsAdapterEventNotificationsApi,
|
|
9347
|
+
subscriptions: workflowsAdapterEventSubscriptionsApi
|
|
9758
9348
|
};
|
|
9759
9349
|
|
|
9760
|
-
// src/apis/
|
|
9761
|
-
var
|
|
9762
|
-
|
|
9763
|
-
configuration: livechatConfigurationApi
|
|
9350
|
+
// src/apis/text-intelligence/workflows/adapter/admin/api.ts
|
|
9351
|
+
var workflowsAdapterAdminApi = {
|
|
9352
|
+
events: workflowsAdapterAdminEventsApi
|
|
9764
9353
|
};
|
|
9765
9354
|
|
|
9766
|
-
// src/apis/
|
|
9767
|
-
var
|
|
9768
|
-
|
|
9769
|
-
|
|
9355
|
+
// src/apis/text-intelligence/workflows/adapter/auth/api.ts
|
|
9356
|
+
var workflowsAdapterAuthApi = {
|
|
9357
|
+
sync(authorization) {
|
|
9358
|
+
return __async(this, null, function* () {
|
|
9359
|
+
yield adapterClientInstance.post(
|
|
9360
|
+
"/auth/token",
|
|
9361
|
+
{},
|
|
9362
|
+
getAdapterClientConfig(authorization)
|
|
9363
|
+
);
|
|
9364
|
+
});
|
|
9365
|
+
}
|
|
9770
9366
|
};
|
|
9771
9367
|
|
|
9772
|
-
// src/apis/text-intelligence/workflows/adapter/
|
|
9773
|
-
var
|
|
9774
|
-
|
|
9368
|
+
// src/apis/text-intelligence/workflows/adapter/integrations/common/events/api.ts
|
|
9369
|
+
var platformAdapterEventsApi = {
|
|
9370
|
+
subscribe(payload, authorization) {
|
|
9775
9371
|
return __async(this, null, function* () {
|
|
9776
|
-
|
|
9777
|
-
"/
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9372
|
+
yield adapterClientInstance.post(
|
|
9373
|
+
"/integrations/events/subscribe",
|
|
9374
|
+
payload,
|
|
9375
|
+
getAdapterClientConfig(authorization)
|
|
9376
|
+
);
|
|
9377
|
+
});
|
|
9378
|
+
},
|
|
9379
|
+
unsubscribe(payload, authorization) {
|
|
9380
|
+
return __async(this, null, function* () {
|
|
9381
|
+
yield adapterClientInstance.post(
|
|
9382
|
+
"/integrations/events/unsubscribe",
|
|
9383
|
+
payload,
|
|
9384
|
+
getAdapterClientConfig(authorization)
|
|
9385
|
+
);
|
|
9386
|
+
});
|
|
9387
|
+
}
|
|
9388
|
+
};
|
|
9389
|
+
|
|
9390
|
+
// src/apis/text-intelligence/workflows/adapter/integrations/common/flows/api.ts
|
|
9391
|
+
var platformAdapterFlowsApi = {
|
|
9392
|
+
createToken(authorization) {
|
|
9393
|
+
return __async(this, null, function* () {
|
|
9394
|
+
const response = yield adapterClientInstance.post(
|
|
9395
|
+
"/integrations/flows/token",
|
|
9396
|
+
{},
|
|
9397
|
+
getAdapterClientConfig(authorization)
|
|
9781
9398
|
);
|
|
9782
9399
|
return response.data;
|
|
9783
9400
|
});
|
|
9784
9401
|
},
|
|
9785
|
-
|
|
9402
|
+
updateStatus(payload, authorization) {
|
|
9786
9403
|
return __async(this, null, function* () {
|
|
9787
|
-
const response = yield adapterClientInstance.
|
|
9788
|
-
|
|
9404
|
+
const response = yield adapterClientInstance.post(
|
|
9405
|
+
"/integrations/flows/status",
|
|
9406
|
+
payload,
|
|
9789
9407
|
getAdapterClientConfig(authorization)
|
|
9790
9408
|
);
|
|
9791
9409
|
return response.data;
|
|
9792
9410
|
});
|
|
9793
9411
|
}
|
|
9794
|
-
};
|
|
9412
|
+
};
|
|
9413
|
+
|
|
9414
|
+
// src/apis/text-intelligence/workflows/adapter/integrations/api.ts
|
|
9415
|
+
var workflowsAdapterIntegrationsApi = {
|
|
9416
|
+
events: platformAdapterEventsApi,
|
|
9417
|
+
flows: platformAdapterFlowsApi
|
|
9418
|
+
};
|
|
9419
|
+
|
|
9420
|
+
// src/apis/text-intelligence/workflows/adapter/api.ts
|
|
9421
|
+
var workflowsAdapterApi = {
|
|
9422
|
+
auth: workflowsAdapterAuthApi,
|
|
9423
|
+
admin: workflowsAdapterAdminApi,
|
|
9424
|
+
integrations: workflowsAdapterIntegrationsApi
|
|
9425
|
+
};
|
|
9426
|
+
|
|
9427
|
+
// src/apis/text-intelligence/workflows/workflow/instance.ts
|
|
9428
|
+
var import_axios31 = __toESM(require("axios"));
|
|
9429
|
+
var REGION4 = {
|
|
9430
|
+
FRA: "fra",
|
|
9431
|
+
DAL: "dal",
|
|
9432
|
+
FRA_A: "fra-a",
|
|
9433
|
+
FRA_B: "fra-b"
|
|
9434
|
+
};
|
|
9435
|
+
var supportedRegions4 = Object.values(REGION4);
|
|
9436
|
+
var getRegion4 = (token) => {
|
|
9437
|
+
const region = token.split(":")[0];
|
|
9438
|
+
if (supportedRegions4.includes(region)) {
|
|
9439
|
+
return region;
|
|
9440
|
+
}
|
|
9441
|
+
};
|
|
9442
|
+
var WorkflowsApiError = class _WorkflowsApiError extends ApiErrorBase {
|
|
9443
|
+
constructor() {
|
|
9444
|
+
super(...arguments);
|
|
9445
|
+
this.name = "workflows";
|
|
9446
|
+
}
|
|
9447
|
+
static notFound(message) {
|
|
9448
|
+
return new _WorkflowsApiError(
|
|
9449
|
+
message != null ? message : "Not found",
|
|
9450
|
+
{
|
|
9451
|
+
errorCode: "not_found",
|
|
9452
|
+
errorMessage: "Not found"
|
|
9453
|
+
},
|
|
9454
|
+
404
|
|
9455
|
+
);
|
|
9456
|
+
}
|
|
9457
|
+
};
|
|
9458
|
+
var workflowsClientInstance = import_axios31.default.create({
|
|
9459
|
+
baseURL: "https://platform.labs.text.com/workflows/api",
|
|
9460
|
+
headers: {
|
|
9461
|
+
"Content-Type": "application/json"
|
|
9462
|
+
}
|
|
9463
|
+
});
|
|
9464
|
+
workflowsClientInstance.interceptors.response.use(
|
|
9465
|
+
(response) => response,
|
|
9466
|
+
(error) => {
|
|
9467
|
+
var _a, _b;
|
|
9468
|
+
const apiError = (_a = error.response) == null ? void 0 : _a.data;
|
|
9469
|
+
if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
|
|
9470
|
+
return Promise.reject(new UnauthorizeApiError(apiError.source));
|
|
9471
|
+
} else if ((apiError == null ? void 0 : apiError.kind) === "error") {
|
|
9472
|
+
const data = (_b = error.response) == null ? void 0 : _b.data;
|
|
9473
|
+
return Promise.reject(
|
|
9474
|
+
new WorkflowsApiError(data.message, data.data, data.code)
|
|
9475
|
+
);
|
|
9476
|
+
}
|
|
9477
|
+
return Promise.reject(error);
|
|
9478
|
+
}
|
|
9479
|
+
);
|
|
9480
|
+
function getWorkflowsClientConfig(options = {}) {
|
|
9481
|
+
var _a, _b, _c, _d, _e;
|
|
9482
|
+
const currentHeaders = workflowsClientInstance.defaults.headers;
|
|
9483
|
+
const headers = {
|
|
9484
|
+
platform: {
|
|
9485
|
+
token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
|
|
9486
|
+
}
|
|
9487
|
+
};
|
|
9488
|
+
if (currentHeaders.Authorization) {
|
|
9489
|
+
currentHeaders["X-Region"] = (_d = getRegion4(currentHeaders.Authorization)) != null ? _d : void 0;
|
|
9490
|
+
}
|
|
9491
|
+
if (((_e = options.ensureAuthorizationToken) == null ? void 0 : _e.platform) && !headers.platform.token) {
|
|
9492
|
+
throw new UnauthorizeApiError("accounts");
|
|
9493
|
+
}
|
|
9494
|
+
return {
|
|
9495
|
+
headers: __spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {})
|
|
9496
|
+
};
|
|
9497
|
+
}
|
|
9498
|
+
var getWorkflowsClientDefaultConfig = (authorization) => getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
9499
|
+
ensureAuthorizationToken: {
|
|
9500
|
+
platform: true
|
|
9501
|
+
}
|
|
9502
|
+
}));
|
|
9503
|
+
function initWorkflowsClient(baseUrl, tokens) {
|
|
9504
|
+
if (baseUrl) {
|
|
9505
|
+
workflowsClientInstance.interceptors.request.use(
|
|
9506
|
+
(config) => {
|
|
9507
|
+
config.baseURL = baseUrl;
|
|
9508
|
+
return config;
|
|
9509
|
+
},
|
|
9510
|
+
(error) => Promise.reject(error)
|
|
9511
|
+
);
|
|
9512
|
+
}
|
|
9513
|
+
if (tokens) {
|
|
9514
|
+
updateWorkflowsClient(tokens);
|
|
9515
|
+
}
|
|
9516
|
+
}
|
|
9517
|
+
function updateWorkflowsClient(tokens) {
|
|
9518
|
+
var _a, _b;
|
|
9519
|
+
const headers = workflowsClientInstance.defaults.headers;
|
|
9520
|
+
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
9521
|
+
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
9522
|
+
}
|
|
9523
|
+
}
|
|
9795
9524
|
|
|
9796
|
-
// src/apis/text-intelligence/workflows/
|
|
9797
|
-
var
|
|
9798
|
-
|
|
9525
|
+
// src/apis/text-intelligence/workflows/workflow/api.ts
|
|
9526
|
+
var workflowsWorkflowApi = {
|
|
9527
|
+
validate(payload, authorization) {
|
|
9799
9528
|
return __async(this, null, function* () {
|
|
9800
|
-
const response = yield
|
|
9801
|
-
"/
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
})
|
|
9529
|
+
const response = yield workflowsClientInstance.post(
|
|
9530
|
+
"/workflows/validate",
|
|
9531
|
+
payload,
|
|
9532
|
+
getWorkflowsClientConfig(authorization)
|
|
9805
9533
|
);
|
|
9806
9534
|
return response.data;
|
|
9807
9535
|
});
|
|
9808
9536
|
},
|
|
9809
|
-
|
|
9537
|
+
generate(payload, authorization) {
|
|
9810
9538
|
return __async(this, null, function* () {
|
|
9811
|
-
const response = yield
|
|
9812
|
-
|
|
9813
|
-
|
|
9539
|
+
const response = yield workflowsClientInstance.post(
|
|
9540
|
+
"/workflows/generate",
|
|
9541
|
+
payload,
|
|
9542
|
+
getWorkflowsClientConfig(authorization)
|
|
9814
9543
|
);
|
|
9815
9544
|
return response.data;
|
|
9816
9545
|
});
|
|
9817
9546
|
},
|
|
9818
|
-
|
|
9547
|
+
build(payload, authorization) {
|
|
9819
9548
|
return __async(this, null, function* () {
|
|
9820
|
-
const response = yield
|
|
9821
|
-
"/
|
|
9822
|
-
|
|
9549
|
+
const response = yield workflowsClientInstance.post(
|
|
9550
|
+
"/workflows/build",
|
|
9551
|
+
payload,
|
|
9552
|
+
getWorkflowsClientConfig(authorization)
|
|
9823
9553
|
);
|
|
9824
9554
|
return response.data;
|
|
9825
9555
|
});
|
|
9826
9556
|
}
|
|
9827
9557
|
};
|
|
9828
9558
|
|
|
9829
|
-
// src/apis/text-intelligence/workflows/
|
|
9830
|
-
var
|
|
9831
|
-
|
|
9832
|
-
|
|
9559
|
+
// src/apis/text-intelligence/workflows/api.ts
|
|
9560
|
+
var workflowsApi = {
|
|
9561
|
+
adapter: workflowsAdapterApi,
|
|
9562
|
+
workflow: workflowsWorkflowApi
|
|
9833
9563
|
};
|
|
9834
9564
|
|
|
9835
|
-
// src/apis/text-intelligence/
|
|
9836
|
-
var
|
|
9837
|
-
|
|
9565
|
+
// src/apis/text-intelligence/api.ts
|
|
9566
|
+
var textIntelligenceApi = {
|
|
9567
|
+
workflows: workflowsApi
|
|
9838
9568
|
};
|
|
9839
9569
|
|
|
9840
|
-
// src/apis/
|
|
9841
|
-
var
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9570
|
+
// src/apis/integrations/bigcommerce/webhooks/_contracts/dtos/webhooks.ts
|
|
9571
|
+
var BigCommerceWebhookScopes = /* @__PURE__ */ ((BigCommerceWebhookScopes2) => {
|
|
9572
|
+
BigCommerceWebhookScopes2["CartCreated"] = "store/cart/created";
|
|
9573
|
+
BigCommerceWebhookScopes2["CartUpdated"] = "store/cart/updated";
|
|
9574
|
+
BigCommerceWebhookScopes2["OrderCreated"] = "store/order/created";
|
|
9575
|
+
BigCommerceWebhookScopes2["OrderUpdated"] = "store/order/updated";
|
|
9576
|
+
BigCommerceWebhookScopes2["ProductCreated"] = "store/product/created";
|
|
9577
|
+
BigCommerceWebhookScopes2["ProductUpdated"] = "store/product/updated";
|
|
9578
|
+
return BigCommerceWebhookScopes2;
|
|
9579
|
+
})(BigCommerceWebhookScopes || {});
|
|
9580
|
+
|
|
9581
|
+
// src/apis/integrations/github/webhooks/_contracts/dtos/webhooks.ts
|
|
9582
|
+
var GitHubWebhookActions = /* @__PURE__ */ ((GitHubWebhookActions2) => {
|
|
9583
|
+
GitHubWebhookActions2["Unknown"] = "unknown";
|
|
9584
|
+
GitHubWebhookActions2["Deleted"] = "deleted";
|
|
9585
|
+
return GitHubWebhookActions2;
|
|
9586
|
+
})(GitHubWebhookActions || {});
|
|
9587
|
+
|
|
9588
|
+
// src/apis/integrations/hubspot/webhooks/_contracts/dtos/webhooks.ts
|
|
9589
|
+
var HubSpotWebhookEventTypes = /* @__PURE__ */ ((HubSpotWebhookEventTypes2) => {
|
|
9590
|
+
HubSpotWebhookEventTypes2["ContactCreation"] = "contact.creation";
|
|
9591
|
+
HubSpotWebhookEventTypes2["ContactDeletion"] = "contact.deletion";
|
|
9592
|
+
return HubSpotWebhookEventTypes2;
|
|
9593
|
+
})(HubSpotWebhookEventTypes || {});
|
|
9594
|
+
|
|
9595
|
+
// src/apis/integrations/slack/_contracts/webhooks/dtos/webhooks.ts
|
|
9596
|
+
var SlackEventTypes = /* @__PURE__ */ ((SlackEventTypes2) => {
|
|
9597
|
+
SlackEventTypes2["MessagePosted"] = "message";
|
|
9598
|
+
SlackEventTypes2["ReactionAdded"] = "reaction_added";
|
|
9599
|
+
SlackEventTypes2["File"] = "file";
|
|
9600
|
+
return SlackEventTypes2;
|
|
9601
|
+
})(SlackEventTypes || {});
|
|
9602
|
+
var SlackMessageEventSubTypes = /* @__PURE__ */ ((SlackMessageEventSubTypes2) => {
|
|
9603
|
+
SlackMessageEventSubTypes2["AssistantAppThread"] = "assistant_app_thread";
|
|
9604
|
+
SlackMessageEventSubTypes2["BotMessage"] = "bot_message";
|
|
9605
|
+
SlackMessageEventSubTypes2["ChannelArchive"] = "channel_archive";
|
|
9606
|
+
SlackMessageEventSubTypes2["ChannelConvertToPrivate"] = "channel_convert_to_private";
|
|
9607
|
+
SlackMessageEventSubTypes2["ChannelConvertToPublic"] = "channel_convert_to_public";
|
|
9608
|
+
SlackMessageEventSubTypes2["ChannelJoin"] = "channel_join";
|
|
9609
|
+
SlackMessageEventSubTypes2["ChannelLeave"] = "channel_leave";
|
|
9610
|
+
SlackMessageEventSubTypes2["ChannelName"] = "channel_name";
|
|
9611
|
+
SlackMessageEventSubTypes2["ChannelPostingPermissions"] = "channel_posting_permissions";
|
|
9612
|
+
SlackMessageEventSubTypes2["ChannelPurpose"] = "channel_purpose";
|
|
9613
|
+
SlackMessageEventSubTypes2["ChannelTopic"] = "channel_topic";
|
|
9614
|
+
SlackMessageEventSubTypes2["ChannelUnarchive"] = "channel_unarchive";
|
|
9615
|
+
SlackMessageEventSubTypes2["DocumentMention"] = "document_mention";
|
|
9616
|
+
SlackMessageEventSubTypes2["EkmAccessDenied"] = "ekm_access_denied";
|
|
9617
|
+
SlackMessageEventSubTypes2["FileComment"] = "file_comment";
|
|
9618
|
+
SlackMessageEventSubTypes2["FileMention"] = "file_mention";
|
|
9619
|
+
SlackMessageEventSubTypes2["FileShare"] = "file_share";
|
|
9620
|
+
SlackMessageEventSubTypes2["GroupArchive"] = "group_archive";
|
|
9621
|
+
SlackMessageEventSubTypes2["GroupJoin"] = "group_join";
|
|
9622
|
+
SlackMessageEventSubTypes2["GroupLeave"] = "group_leave";
|
|
9623
|
+
SlackMessageEventSubTypes2["GroupName"] = "group_name";
|
|
9624
|
+
SlackMessageEventSubTypes2["GroupPurpose"] = "group_purpose";
|
|
9625
|
+
SlackMessageEventSubTypes2["GroupTopic"] = "group_topic";
|
|
9626
|
+
SlackMessageEventSubTypes2["GroupUnarchive"] = "group_unarchive";
|
|
9627
|
+
SlackMessageEventSubTypes2["MessageChanged"] = "message_changed";
|
|
9628
|
+
SlackMessageEventSubTypes2["MessageDeleted"] = "message_deleted";
|
|
9629
|
+
SlackMessageEventSubTypes2["MeMessage"] = "me_message";
|
|
9630
|
+
SlackMessageEventSubTypes2["MessageReplied"] = "message_replied";
|
|
9631
|
+
SlackMessageEventSubTypes2["PinnedItem"] = "pinned_item";
|
|
9632
|
+
SlackMessageEventSubTypes2["ReminderAdd"] = "reminder_add";
|
|
9633
|
+
SlackMessageEventSubTypes2["ReplyBroadcast"] = "reply_broadcast";
|
|
9634
|
+
SlackMessageEventSubTypes2["ThreadBroadcast"] = "thread_broadcast";
|
|
9635
|
+
SlackMessageEventSubTypes2["UnpinnedItem"] = "unpinned_item";
|
|
9636
|
+
return SlackMessageEventSubTypes2;
|
|
9637
|
+
})(SlackMessageEventSubTypes || {});
|
|
9638
|
+
|
|
9639
|
+
// src/apis/integrations/text/platform/workflow/_contracts/filters/helpers.ts
|
|
9640
|
+
var isFilterGroup = (filter) => {
|
|
9641
|
+
return "filters" in filter && "operator" in filter;
|
|
9642
|
+
};
|
|
9643
|
+
var isFilter = (filter) => {
|
|
9644
|
+
return "field" in filter && "operator" in filter && "value" in filter;
|
|
9851
9645
|
};
|
|
9852
9646
|
|
|
9853
|
-
// src/apis/text
|
|
9854
|
-
var
|
|
9855
|
-
|
|
9856
|
-
return
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
getAdapterClientConfig(authorization)
|
|
9861
|
-
);
|
|
9862
|
-
});
|
|
9863
|
-
},
|
|
9864
|
-
unsubscribe(payload, authorization) {
|
|
9865
|
-
return __async(this, null, function* () {
|
|
9866
|
-
yield adapterClientInstance.post(
|
|
9867
|
-
"/integrations/events/unsubscribe",
|
|
9868
|
-
payload,
|
|
9869
|
-
getAdapterClientConfig(authorization)
|
|
9870
|
-
);
|
|
9871
|
-
});
|
|
9647
|
+
// src/apis/integrations/text/platform/workflow/_contracts/filters/serialize.ts
|
|
9648
|
+
var convertValueToString = (value) => {
|
|
9649
|
+
if (typeof value === "string") {
|
|
9650
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
9651
|
+
}
|
|
9652
|
+
if (value === null) {
|
|
9653
|
+
return "null";
|
|
9872
9654
|
}
|
|
9655
|
+
return value.toString();
|
|
9873
9656
|
};
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
return
|
|
9879
|
-
const response = yield adapterClientInstance.post(
|
|
9880
|
-
"/integrations/flows/token",
|
|
9881
|
-
{},
|
|
9882
|
-
getAdapterClientConfig(authorization)
|
|
9883
|
-
);
|
|
9884
|
-
return response.data;
|
|
9885
|
-
});
|
|
9886
|
-
},
|
|
9887
|
-
updateStatus(payload, authorization) {
|
|
9888
|
-
return __async(this, null, function* () {
|
|
9889
|
-
const response = yield adapterClientInstance.post(
|
|
9890
|
-
"/integrations/flows/status",
|
|
9891
|
-
payload,
|
|
9892
|
-
getAdapterClientConfig(authorization)
|
|
9893
|
-
);
|
|
9894
|
-
return response.data;
|
|
9895
|
-
});
|
|
9657
|
+
var filterToString = (filter) => {
|
|
9658
|
+
if (isFilterGroup(filter)) {
|
|
9659
|
+
return `(${serializeFilters([filter])})`;
|
|
9660
|
+
} else if (isFilter(filter)) {
|
|
9661
|
+
return `${filter.field} ${filter.operator} ${convertValueToString(filter.value)}`;
|
|
9896
9662
|
}
|
|
9663
|
+
return "";
|
|
9664
|
+
};
|
|
9665
|
+
var serializeFilters = (filters) => {
|
|
9666
|
+
if (filters.length === 0) {
|
|
9667
|
+
return "";
|
|
9668
|
+
}
|
|
9669
|
+
if (filters.length === 1 && filters[0] && isFilterGroup(filters[0])) {
|
|
9670
|
+
const group = filters[0];
|
|
9671
|
+
return group.filters.map(filterToString).filter(Boolean).join(` ${group.operator} `);
|
|
9672
|
+
}
|
|
9673
|
+
return filters.map(filterToString).filter(Boolean).join(" and ");
|
|
9674
|
+
};
|
|
9675
|
+
|
|
9676
|
+
// src/apis/integrations/text/platform/workflow/_contracts/sorting/types.ts
|
|
9677
|
+
var SortOrder = {
|
|
9678
|
+
Ascending: "asc",
|
|
9679
|
+
Descending: "desc"
|
|
9680
|
+
};
|
|
9681
|
+
var SortBy = {
|
|
9682
|
+
Name: "name",
|
|
9683
|
+
CreatedOn: "created_at",
|
|
9684
|
+
CreatedBy: "created_by",
|
|
9685
|
+
Runs: "executions.completed",
|
|
9686
|
+
Status: "active"
|
|
9687
|
+
};
|
|
9688
|
+
|
|
9689
|
+
// src/apis/integrations/text/platform/workflow/credentials/_contracts/dtos/credential.ts
|
|
9690
|
+
var CredentialStatus = /* @__PURE__ */ ((CredentialStatus2) => {
|
|
9691
|
+
CredentialStatus2["Connected"] = "connected";
|
|
9692
|
+
CredentialStatus2["Disconnected"] = "disconnected";
|
|
9693
|
+
CredentialStatus2["Stale"] = "stale";
|
|
9694
|
+
return CredentialStatus2;
|
|
9695
|
+
})(CredentialStatus || {});
|
|
9696
|
+
var CredentialType = /* @__PURE__ */ ((CredentialType2) => {
|
|
9697
|
+
CredentialType2["General"] = "general";
|
|
9698
|
+
CredentialType2["ApiKey"] = "api_key";
|
|
9699
|
+
CredentialType2["BasicAuth"] = "basic_auth";
|
|
9700
|
+
CredentialType2["OAuth2"] = "oauth2";
|
|
9701
|
+
CredentialType2["TextAuth"] = "text_auth";
|
|
9702
|
+
return CredentialType2;
|
|
9703
|
+
})(CredentialType || {});
|
|
9704
|
+
var CredentialTypeDisplayNameMapping = {
|
|
9705
|
+
["general" /* General */]: "General",
|
|
9706
|
+
["api_key" /* ApiKey */]: "API Key",
|
|
9707
|
+
["basic_auth" /* BasicAuth */]: "Basic Auth",
|
|
9708
|
+
["oauth2" /* OAuth2 */]: "OAuth2",
|
|
9709
|
+
["text_auth" /* TextAuth */]: "Text"
|
|
9897
9710
|
};
|
|
9711
|
+
var OauthCredentialGrantType = /* @__PURE__ */ ((OauthCredentialGrantType2) => {
|
|
9712
|
+
OauthCredentialGrantType2["AuthorizationCode"] = "authorization_code";
|
|
9713
|
+
OauthCredentialGrantType2["Implicit"] = "implicit";
|
|
9714
|
+
OauthCredentialGrantType2["PKCE"] = "pkce";
|
|
9715
|
+
OauthCredentialGrantType2["ClientCredentials"] = "client_credentials";
|
|
9716
|
+
return OauthCredentialGrantType2;
|
|
9717
|
+
})(OauthCredentialGrantType || {});
|
|
9898
9718
|
|
|
9899
|
-
// src/apis/
|
|
9900
|
-
var
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9719
|
+
// src/apis/platform/cdp/events/_contracts/payloads/events.ts
|
|
9720
|
+
var import_zod12 = require("zod");
|
|
9721
|
+
var CdpCustomerEventType = /* @__PURE__ */ ((CdpCustomerEventType2) => {
|
|
9722
|
+
CdpCustomerEventType2["EmailSet"] = "customer_email_set";
|
|
9723
|
+
CdpCustomerEventType2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
|
|
9724
|
+
return CdpCustomerEventType2;
|
|
9725
|
+
})(CdpCustomerEventType || {});
|
|
9726
|
+
var customerMetadataZod = import_zod12.z.object({
|
|
9727
|
+
organization_id: import_zod12.z.string(),
|
|
9728
|
+
customer_id: import_zod12.z.string(),
|
|
9729
|
+
master_id: import_zod12.z.string()
|
|
9730
|
+
});
|
|
9731
|
+
var cdpCustomerEventMessageZod = import_zod12.z.discriminatedUnion("type", [
|
|
9732
|
+
import_zod12.z.object({
|
|
9733
|
+
id: import_zod12.z.string(),
|
|
9734
|
+
type: import_zod12.z.literal("customer_email_set" /* EmailSet */),
|
|
9735
|
+
data: customerMetadataZod.extend({
|
|
9736
|
+
email: import_zod12.z.string()
|
|
9737
|
+
}).passthrough()
|
|
9738
|
+
}),
|
|
9739
|
+
import_zod12.z.object({
|
|
9740
|
+
id: import_zod12.z.string(),
|
|
9741
|
+
type: import_zod12.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
|
|
9742
|
+
data: customerMetadataZod.extend({
|
|
9743
|
+
customer_properties: import_zod12.z.record(
|
|
9744
|
+
import_zod12.z.object({
|
|
9745
|
+
value: import_zod12.z.unknown(),
|
|
9746
|
+
last_updated_at: import_zod12.z.string(),
|
|
9747
|
+
last_updated_agent_account_id: import_zod12.z.string().optional(),
|
|
9748
|
+
last_updated_agent_client_id: import_zod12.z.string().optional()
|
|
9749
|
+
}).passthrough()
|
|
9750
|
+
)
|
|
9751
|
+
}).passthrough()
|
|
9752
|
+
})
|
|
9753
|
+
]);
|
|
9904
9754
|
|
|
9905
|
-
// src/apis/
|
|
9906
|
-
var
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9755
|
+
// src/apis/products/helpdesk/webhooks/_contracts/dtos/webhook.ts
|
|
9756
|
+
var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
|
|
9757
|
+
HelpDeskWebhookEventType2["TicketCreated"] = "tickets.create";
|
|
9758
|
+
HelpDeskWebhookEventType2["TicketUpdated"] = "tickets.update";
|
|
9759
|
+
HelpDeskWebhookEventType2["TicketStatusChanged"] = "tickets.events.status";
|
|
9760
|
+
HelpDeskWebhookEventType2["TicketPriorityChanged"] = "tickets.events.priority";
|
|
9761
|
+
HelpDeskWebhookEventType2["TicketTagsChanged"] = "tickets.events.tags";
|
|
9762
|
+
HelpDeskWebhookEventType2["TicketFollowersChanged"] = "tickets.events.followers";
|
|
9763
|
+
HelpDeskWebhookEventType2["TicketAssignmentChanged"] = "tickets.events.assignment";
|
|
9764
|
+
HelpDeskWebhookEventType2["TicketCustomFieldsChanged"] = "tickets.events.customFields";
|
|
9765
|
+
HelpDeskWebhookEventType2["TicketMessageAdded"] = "tickets.events.message";
|
|
9766
|
+
return HelpDeskWebhookEventType2;
|
|
9767
|
+
})(HelpDeskWebhookEventType || {});
|
|
9768
|
+
|
|
9769
|
+
// src/apis/products/livechat/configuration/webhooks/_contracts/dtos/webhook.ts
|
|
9770
|
+
var LivechatWebhookActions = /* @__PURE__ */ ((LivechatWebhookActions2) => {
|
|
9771
|
+
LivechatWebhookActions2["IncomingChat"] = "incoming_chat";
|
|
9772
|
+
LivechatWebhookActions2["ChatDeactivated"] = "chat_deactivated";
|
|
9773
|
+
LivechatWebhookActions2["ChatAccessUpdated"] = "chat_access_updated";
|
|
9774
|
+
LivechatWebhookActions2["ChatTransferred"] = "chat_transferred";
|
|
9775
|
+
LivechatWebhookActions2["UserAddedToChat"] = "user_added_to_chat";
|
|
9776
|
+
LivechatWebhookActions2["UserRemovedFromChat"] = "user_removed_from_chat";
|
|
9777
|
+
LivechatWebhookActions2["IncomingEvent"] = "incoming_event";
|
|
9778
|
+
LivechatWebhookActions2["IncomingRichMessagePostback"] = "incoming_rich_message_postback";
|
|
9779
|
+
LivechatWebhookActions2["ThreadTagged"] = "thread_tagged";
|
|
9780
|
+
LivechatWebhookActions2["ThreadUntagged"] = "thread_untagged";
|
|
9781
|
+
LivechatWebhookActions2["IncomingCustomer"] = "incoming_customer";
|
|
9782
|
+
return LivechatWebhookActions2;
|
|
9783
|
+
})(LivechatWebhookActions || {});
|
|
9784
|
+
var LivechatWebhookEvents = /* @__PURE__ */ ((LivechatWebhookEvents2) => {
|
|
9785
|
+
LivechatWebhookEvents2["Message"] = "message";
|
|
9786
|
+
LivechatWebhookEvents2["File"] = "file";
|
|
9787
|
+
LivechatWebhookEvents2["RichMessage"] = "rich_message";
|
|
9788
|
+
LivechatWebhookEvents2["Form"] = "form";
|
|
9789
|
+
LivechatWebhookEvents2["FilledForm"] = "filled_form";
|
|
9790
|
+
LivechatWebhookEvents2["Custom"] = "custom";
|
|
9791
|
+
LivechatWebhookEvents2["SystemMessage"] = "system_message";
|
|
9792
|
+
LivechatWebhookEvents2["System"] = "system";
|
|
9793
|
+
return LivechatWebhookEvents2;
|
|
9794
|
+
})(LivechatWebhookEvents || {});
|
|
9795
|
+
var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessages2) => {
|
|
9796
|
+
LivechatWebhookSystemMessages2["ChatRated"] = "rating.chat_rated";
|
|
9797
|
+
LivechatWebhookSystemMessages2["ChatCommented"] = "rating.chat_commented";
|
|
9798
|
+
LivechatWebhookSystemMessages2["ChatArchivedCustomerManual"] = "manual_archived_customer";
|
|
9799
|
+
LivechatWebhookSystemMessages2["ChatArchivedCustomerDisconnected"] = "archived_customer_disconnected";
|
|
9800
|
+
LivechatWebhookSystemMessages2["ChatArchivedInactive"] = "routing.archived_inactive";
|
|
9801
|
+
LivechatWebhookSystemMessages2["ChatIdle"] = "routing.idle";
|
|
9802
|
+
return LivechatWebhookSystemMessages2;
|
|
9803
|
+
})(LivechatWebhookSystemMessages || {});
|
|
9804
|
+
|
|
9805
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/dtos/notification.ts
|
|
9806
|
+
var import_zod13 = require("zod");
|
|
9807
|
+
var integrationNotificationZods = {
|
|
9808
|
+
notification: import_zod13.z.object({
|
|
9809
|
+
id: import_zod13.z.string(),
|
|
9810
|
+
jobId: import_zod13.z.string().nullable(),
|
|
9811
|
+
subscription_id: import_zod13.z.string(),
|
|
9812
|
+
organization_id: import_zod13.z.string(),
|
|
9813
|
+
user_id: import_zod13.z.string().nullable(),
|
|
9814
|
+
source: import_zod13.z.string().nullable(),
|
|
9815
|
+
sourceKey: import_zod13.z.string().nullable(),
|
|
9816
|
+
target: import_zod13.z.string(),
|
|
9817
|
+
targetKey: import_zod13.z.string(),
|
|
9818
|
+
eventName: import_zod13.z.string(),
|
|
9819
|
+
callback: import_zod13.z.string(),
|
|
9820
|
+
status: import_zod13.z.string(),
|
|
9821
|
+
statusCode: import_zod13.z.number().nullable(),
|
|
9822
|
+
attempts: import_zod13.z.number(),
|
|
9823
|
+
error: import_zod13.z.string().nullable(),
|
|
9824
|
+
enqueuedAt: import_zod13.z.string(),
|
|
9825
|
+
completedAt: import_zod13.z.string()
|
|
9826
|
+
})
|
|
9910
9827
|
};
|
|
9911
9828
|
|
|
9912
|
-
// src/apis/text-intelligence/workflows/
|
|
9913
|
-
var
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
},
|
|
9934
|
-
build(payload, authorization) {
|
|
9935
|
-
return __async(this, null, function* () {
|
|
9936
|
-
const response = yield workflowsClientInstance.post(
|
|
9937
|
-
"/workflows/build",
|
|
9938
|
-
payload,
|
|
9939
|
-
getWorkflowsClientConfig(authorization)
|
|
9940
|
-
);
|
|
9941
|
-
return response.data;
|
|
9942
|
-
});
|
|
9943
|
-
}
|
|
9829
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/requests/notifications.ts
|
|
9830
|
+
var import_zod14 = require("zod");
|
|
9831
|
+
var integrationNotificationRequestZods = {
|
|
9832
|
+
getNotifications: import_zod14.z.object({
|
|
9833
|
+
target: import_zod14.z.string().optional(),
|
|
9834
|
+
status: import_zod14.z.string().optional(),
|
|
9835
|
+
eventName: import_zod14.z.string().optional(),
|
|
9836
|
+
search: import_zod14.z.string().optional(),
|
|
9837
|
+
page: import_zod14.z.number().optional(),
|
|
9838
|
+
size: import_zod14.z.number().optional(),
|
|
9839
|
+
order_by: import_zod14.z.enum([
|
|
9840
|
+
"id",
|
|
9841
|
+
"status",
|
|
9842
|
+
"target",
|
|
9843
|
+
"eventName",
|
|
9844
|
+
"completedAt",
|
|
9845
|
+
"organization_id",
|
|
9846
|
+
"user_id"
|
|
9847
|
+
]).optional(),
|
|
9848
|
+
order: import_zod14.z.enum(["asc", "desc"]).optional()
|
|
9849
|
+
})
|
|
9944
9850
|
};
|
|
9945
9851
|
|
|
9946
|
-
// src/apis/text-intelligence/workflows/
|
|
9947
|
-
var
|
|
9948
|
-
|
|
9949
|
-
|
|
9852
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/dtos/subscription.ts
|
|
9853
|
+
var import_zod15 = require("zod");
|
|
9854
|
+
var integrationSubscriptionZods = {
|
|
9855
|
+
subscription: import_zod15.z.object({
|
|
9856
|
+
id: import_zod15.z.string(),
|
|
9857
|
+
organization_id: import_zod15.z.string(),
|
|
9858
|
+
user_id: import_zod15.z.string(),
|
|
9859
|
+
callback: import_zod15.z.string(),
|
|
9860
|
+
source: import_zod15.z.string(),
|
|
9861
|
+
sourceKey: import_zod15.z.string(),
|
|
9862
|
+
target: import_zod15.z.string(),
|
|
9863
|
+
targets: import_zod15.z.array(
|
|
9864
|
+
import_zod15.z.object({
|
|
9865
|
+
id: import_zod15.z.string(),
|
|
9866
|
+
target: import_zod15.z.string(),
|
|
9867
|
+
targetKey: import_zod15.z.string()
|
|
9868
|
+
})
|
|
9869
|
+
).optional(),
|
|
9870
|
+
event: import_zod15.z.unknown(),
|
|
9871
|
+
orphaned_at: import_zod15.z.string().datetime().nullable(),
|
|
9872
|
+
orphaned_reason: import_zod15.z.string().nullable(),
|
|
9873
|
+
orphaned_last_hit: import_zod15.z.string().datetime().nullable(),
|
|
9874
|
+
orphaned_hit_count: import_zod15.z.number()
|
|
9875
|
+
}),
|
|
9876
|
+
stats: import_zod15.z.object({
|
|
9877
|
+
totalSubscriptions: import_zod15.z.number(),
|
|
9878
|
+
uniqueOrganizations: import_zod15.z.number(),
|
|
9879
|
+
uniqueUsers: import_zod15.z.number(),
|
|
9880
|
+
byTarget: import_zod15.z.array(import_zod15.z.object({ target: import_zod15.z.string(), count: import_zod15.z.number() })),
|
|
9881
|
+
bySource: import_zod15.z.array(import_zod15.z.object({ source: import_zod15.z.string(), count: import_zod15.z.number() })),
|
|
9882
|
+
topOrganizations: import_zod15.z.array(
|
|
9883
|
+
import_zod15.z.object({ organizationId: import_zod15.z.string(), count: import_zod15.z.number() })
|
|
9884
|
+
),
|
|
9885
|
+
topCallbackDomains: import_zod15.z.array(
|
|
9886
|
+
import_zod15.z.object({ domain: import_zod15.z.string(), count: import_zod15.z.number() })
|
|
9887
|
+
)
|
|
9888
|
+
})
|
|
9950
9889
|
};
|
|
9951
9890
|
|
|
9952
|
-
// src/apis/text-intelligence/
|
|
9953
|
-
var
|
|
9954
|
-
|
|
9891
|
+
// src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/requests/subscriptions.ts
|
|
9892
|
+
var import_zod16 = require("zod");
|
|
9893
|
+
var integrationSubscriptionRequestZods = {
|
|
9894
|
+
getSubscriptions: import_zod16.z.object({
|
|
9895
|
+
target: import_zod16.z.string().optional(),
|
|
9896
|
+
source: import_zod16.z.string().optional(),
|
|
9897
|
+
search: import_zod16.z.string().optional(),
|
|
9898
|
+
orphaned: import_zod16.z.boolean().optional(),
|
|
9899
|
+
page: import_zod16.z.number().optional(),
|
|
9900
|
+
size: import_zod16.z.number().optional(),
|
|
9901
|
+
order_by: import_zod16.z.enum([
|
|
9902
|
+
"id",
|
|
9903
|
+
"source",
|
|
9904
|
+
"target",
|
|
9905
|
+
"organization_id",
|
|
9906
|
+
"user_id",
|
|
9907
|
+
"orphaned_at"
|
|
9908
|
+
]).optional(),
|
|
9909
|
+
order: import_zod16.z.enum(["asc", "desc"]).optional()
|
|
9910
|
+
})
|
|
9955
9911
|
};
|
|
9956
9912
|
|
|
9957
9913
|
// src/apis/api.ts
|