@livechat/developer-studio-api 5.3.1-beta.generator.v5 → 5.3.5-beta.generator.9
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-WXTWJG7Z.mjs → chunk-LY5BBKGO.mjs} +25 -14
- package/dist/{events-D6Wj4603.d.mts → events-Bp2V0TTp.d.mts} +23 -10
- package/dist/{events-D6Wj4603.d.ts → events-Bp2V0TTp.d.ts} +23 -10
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +580 -568
- package/dist/index.mjs +5 -3
- package/dist/workflow-contracts.d.mts +1 -1
- package/dist/workflow-contracts.d.ts +1 -1
- package/dist/workflow-contracts.js +13 -27
- package/dist/workflow-contracts.mjs +5 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -133,6 +133,8 @@ __export(src_exports, {
|
|
|
133
133
|
WorkflowExecutionStatus: () => WorkflowExecutionStatus,
|
|
134
134
|
WorkflowExecutionTaskStatus: () => WorkflowExecutionTaskStatus,
|
|
135
135
|
WorkflowItemKind: () => WorkflowItemKind,
|
|
136
|
+
WorkflowManualTriggerSubType: () => WorkflowManualTriggerSubType,
|
|
137
|
+
WorkflowManualTriggerSubTypeName: () => WorkflowManualTriggerSubTypeName,
|
|
136
138
|
WorkflowTaskType: () => WorkflowTaskType,
|
|
137
139
|
WorkflowTemplateCategory: () => WorkflowTemplateCategory,
|
|
138
140
|
WorkflowTriggerType: () => WorkflowTriggerType,
|
|
@@ -152,7 +154,6 @@ __export(src_exports, {
|
|
|
152
154
|
cdpCustomerEventMessageZod: () => cdpCustomerEventMessageZod,
|
|
153
155
|
consoleClientInstance: () => consoleClientInstance,
|
|
154
156
|
dpsClientInstance: () => dpsClientInstance,
|
|
155
|
-
enrichWorkflowTrigger: () => enrichWorkflowTrigger,
|
|
156
157
|
extractTokenFromAuthorizationHeader: () => extractTokenFromAuthorizationHeader,
|
|
157
158
|
getAdapterClientConfig: () => getAdapterClientConfig,
|
|
158
159
|
getAdapterClientDefaultConfig: () => getAdapterClientDefaultConfig,
|
|
@@ -4396,7 +4397,7 @@ var isFilter = (filter) => {
|
|
|
4396
4397
|
// src/apis/integrations/text/platform/workflow/_contracts/filters/serialize.ts
|
|
4397
4398
|
var convertValueToString = (value) => {
|
|
4398
4399
|
if (typeof value === "string") {
|
|
4399
|
-
return `"${value}"`;
|
|
4400
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
4400
4401
|
}
|
|
4401
4402
|
if (value === null) {
|
|
4402
4403
|
return "null";
|
|
@@ -4598,6 +4599,14 @@ var WorkflowTriggerType = {
|
|
|
4598
4599
|
webhookManual: "webhook_manual"
|
|
4599
4600
|
};
|
|
4600
4601
|
|
|
4602
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/triggers/manual.ts
|
|
4603
|
+
var WorkflowManualTriggerSubType = {
|
|
4604
|
+
forSelectedChat: "for_selected_chat"
|
|
4605
|
+
};
|
|
4606
|
+
var WorkflowManualTriggerSubTypeName = {
|
|
4607
|
+
[WorkflowManualTriggerSubType.forSelectedChat]: "text-livechat-manual"
|
|
4608
|
+
};
|
|
4609
|
+
|
|
4601
4610
|
// src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowElement.ts
|
|
4602
4611
|
var TRIGGER_REFERENCE_NAME = "trigger";
|
|
4603
4612
|
|
|
@@ -4826,493 +4835,180 @@ function getWorkflowApiCrmConfig(authorization) {
|
|
|
4826
4835
|
});
|
|
4827
4836
|
}
|
|
4828
4837
|
|
|
4829
|
-
// src/apis/integrations/
|
|
4830
|
-
var
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4852
|
-
);
|
|
4853
|
-
return organizations;
|
|
4854
|
-
});
|
|
4855
|
-
},
|
|
4856
|
-
getOrganization(organizationId, authorization) {
|
|
4857
|
-
return __async(this, null, function* () {
|
|
4858
|
-
const { data: organization } = yield textClientInstance.get(
|
|
4859
|
-
urls4.getOrganization(organizationId),
|
|
4860
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4861
|
-
);
|
|
4862
|
-
return organization;
|
|
4863
|
-
});
|
|
4864
|
-
},
|
|
4865
|
-
getWorkflows(queryParams, authorization) {
|
|
4866
|
-
return __async(this, null, function* () {
|
|
4867
|
-
const { data: workflows } = yield textClientInstance.get(urls4.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
|
|
4868
|
-
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
4869
|
-
return workflows;
|
|
4870
|
-
});
|
|
4871
|
-
},
|
|
4872
|
-
getWorkflow(workflowId, authorization) {
|
|
4873
|
-
return __async(this, null, function* () {
|
|
4874
|
-
const searchParams = new URLSearchParams();
|
|
4875
|
-
const query = searchParams.toString();
|
|
4876
|
-
const { data: workflow } = yield textClientInstance.get(
|
|
4877
|
-
`${urls4.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
4878
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4879
|
-
);
|
|
4880
|
-
return enrichWorkflowTrigger(workflow);
|
|
4881
|
-
});
|
|
4882
|
-
},
|
|
4883
|
-
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
4884
|
-
return __async(this, null, function* () {
|
|
4885
|
-
const { data: executions } = yield textClientInstance.get(
|
|
4886
|
-
urls4.getWorkflowExecutions(workflowId, queryParams),
|
|
4887
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4888
|
-
);
|
|
4889
|
-
return executions;
|
|
4890
|
-
});
|
|
4891
|
-
},
|
|
4892
|
-
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
4893
|
-
return __async(this, null, function* () {
|
|
4894
|
-
const { data: execution } = yield textClientInstance.get(
|
|
4895
|
-
urls4.getWorkflowExecution(workflowId, executionId),
|
|
4896
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4897
|
-
);
|
|
4898
|
-
return execution;
|
|
4899
|
-
});
|
|
4900
|
-
},
|
|
4901
|
-
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
4902
|
-
return __async(this, null, function* () {
|
|
4903
|
-
const searchParams = new URLSearchParams();
|
|
4904
|
-
if (version) {
|
|
4905
|
-
searchParams.append("version", `${version}`);
|
|
4838
|
+
// src/apis/integrations/vercel/instance.ts
|
|
4839
|
+
var import_axios23 = __toESM(require("axios"));
|
|
4840
|
+
function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
|
|
4841
|
+
if (req.headers instanceof Headers) {
|
|
4842
|
+
return {
|
|
4843
|
+
token: req.headers.get(`${headerPrefix}-token`)
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
return {
|
|
4847
|
+
token: req.headers[`${headerPrefix}-token`]
|
|
4848
|
+
};
|
|
4849
|
+
}
|
|
4850
|
+
var vercelClientInstance = import_axios23.default.create({
|
|
4851
|
+
baseURL: "https://api.vercel.com"
|
|
4852
|
+
});
|
|
4853
|
+
vercelClientInstance.interceptors.response.use(
|
|
4854
|
+
(r) => r,
|
|
4855
|
+
(error) => {
|
|
4856
|
+
var _a, _b;
|
|
4857
|
+
if (import_axios23.default.isAxiosError(error)) {
|
|
4858
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
|
|
4859
|
+
throw new UnauthorizeApiError("vercel");
|
|
4906
4860
|
}
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
`${urls4.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
4910
|
-
getWorkflowApiCrmConfig(authorization)
|
|
4911
|
-
);
|
|
4912
|
-
return {
|
|
4913
|
-
tasks: introspection
|
|
4914
|
-
};
|
|
4915
|
-
});
|
|
4861
|
+
}
|
|
4862
|
+
throw error;
|
|
4916
4863
|
}
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
}
|
|
4864
|
+
);
|
|
4865
|
+
function getVercelClientConfig(options = {}) {
|
|
4866
|
+
var _a;
|
|
4867
|
+
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
4868
|
+
const config = {
|
|
4869
|
+
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
|
|
4870
|
+
};
|
|
4871
|
+
if (options.ensureAuthorizationToken && !config.authorization) {
|
|
4872
|
+
throw new UnauthorizeApiError("vercel");
|
|
4873
|
+
}
|
|
4874
|
+
return {
|
|
4875
|
+
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
4876
|
+
};
|
|
4877
|
+
}
|
|
4878
|
+
function initVercelClient(token) {
|
|
4879
|
+
if (token) {
|
|
4880
|
+
updateVercelClient(token);
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
function updateVercelClient(token) {
|
|
4884
|
+
const headers = vercelClientInstance.defaults.headers;
|
|
4885
|
+
if (token) {
|
|
4886
|
+
headers.Authorization = `Bearer ${token}`;
|
|
4887
|
+
} else {
|
|
4888
|
+
delete headers.Authorization;
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4923
4891
|
|
|
4924
|
-
// src/apis/
|
|
4925
|
-
var
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4892
|
+
// src/apis/platform/accounts/instance.ts
|
|
4893
|
+
var AccountsApiError = class extends ApiErrorBase {
|
|
4894
|
+
constructor() {
|
|
4895
|
+
super(...arguments);
|
|
4896
|
+
this.name = "accounts";
|
|
4929
4897
|
}
|
|
4930
|
-
|
|
4931
|
-
|
|
4898
|
+
};
|
|
4899
|
+
var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
|
|
4900
|
+
constructor(message) {
|
|
4901
|
+
super("accounts", message);
|
|
4932
4902
|
}
|
|
4933
|
-
|
|
4934
|
-
|
|
4903
|
+
};
|
|
4904
|
+
var AccountApiClient = class extends ApiClient {
|
|
4905
|
+
constructor() {
|
|
4906
|
+
super(...arguments);
|
|
4907
|
+
this.UnauthorizedError = UnauthorizeAccountsApiError;
|
|
4908
|
+
this.Error = AccountsApiError;
|
|
4909
|
+
this.options = {
|
|
4910
|
+
headers: {
|
|
4911
|
+
"Content-Type": "application/json"
|
|
4912
|
+
}
|
|
4913
|
+
};
|
|
4935
4914
|
}
|
|
4936
|
-
|
|
4937
|
-
|
|
4915
|
+
};
|
|
4916
|
+
var platformAccountsClientInstance = new AccountApiClient({
|
|
4917
|
+
baseURL: "https://accounts.labs.livechatinc.com"
|
|
4918
|
+
});
|
|
4919
|
+
function initPlatformAccountsClient(baseUrl, token) {
|
|
4920
|
+
if (baseUrl) {
|
|
4921
|
+
platformAccountsClientInstance.updateConfig({
|
|
4922
|
+
baseURL: baseUrl
|
|
4923
|
+
});
|
|
4938
4924
|
}
|
|
4939
|
-
|
|
4940
|
-
|
|
4925
|
+
platformAccountsClientInstance.updateAuthorization({
|
|
4926
|
+
token
|
|
4927
|
+
});
|
|
4928
|
+
}
|
|
4929
|
+
|
|
4930
|
+
// src/apis/platform/billing/instance.ts
|
|
4931
|
+
var import_axios24 = __toESM(require("axios"));
|
|
4932
|
+
var billingClientInstance = import_axios24.default.create({
|
|
4933
|
+
baseURL: "https://billing.labs.livechatinc.com"
|
|
4934
|
+
});
|
|
4935
|
+
function getBillingClientConfig(options = {}) {
|
|
4936
|
+
var _a;
|
|
4937
|
+
const defaultAuthorization = billingClientInstance.defaults.headers.Authorization;
|
|
4938
|
+
const headers = {
|
|
4939
|
+
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
|
|
4940
|
+
};
|
|
4941
|
+
return {
|
|
4942
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
4943
|
+
};
|
|
4944
|
+
}
|
|
4945
|
+
function initBillingClient(baseUrl, token) {
|
|
4946
|
+
if (baseUrl) {
|
|
4947
|
+
billingClientInstance.interceptors.request.use(
|
|
4948
|
+
(config) => {
|
|
4949
|
+
config.baseURL = baseUrl;
|
|
4950
|
+
return config;
|
|
4951
|
+
},
|
|
4952
|
+
(error) => Promise.reject(error)
|
|
4953
|
+
);
|
|
4941
4954
|
}
|
|
4942
|
-
if (
|
|
4943
|
-
|
|
4955
|
+
if (token) {
|
|
4956
|
+
billingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
4957
|
+
} else {
|
|
4958
|
+
delete billingClientInstance.defaults.headers.Authorization;
|
|
4944
4959
|
}
|
|
4945
|
-
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4962
|
+
// src/apis/platform/cdp/events/_contracts/payloads/events.ts
|
|
4963
|
+
var import_zod12 = require("zod");
|
|
4964
|
+
var CdpCustomerEventType = /* @__PURE__ */ ((CdpCustomerEventType2) => {
|
|
4965
|
+
CdpCustomerEventType2["EmailSet"] = "customer_email_set";
|
|
4966
|
+
CdpCustomerEventType2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
|
|
4967
|
+
return CdpCustomerEventType2;
|
|
4968
|
+
})(CdpCustomerEventType || {});
|
|
4969
|
+
var customerMetadataZod = import_zod12.z.object({
|
|
4970
|
+
organization_id: import_zod12.z.string(),
|
|
4971
|
+
customer_id: import_zod12.z.string(),
|
|
4972
|
+
master_id: import_zod12.z.string()
|
|
4973
|
+
});
|
|
4974
|
+
var cdpCustomerEventMessageZod = import_zod12.z.discriminatedUnion("type", [
|
|
4975
|
+
import_zod12.z.object({
|
|
4976
|
+
id: import_zod12.z.string(),
|
|
4977
|
+
type: import_zod12.z.literal("customer_email_set" /* EmailSet */),
|
|
4978
|
+
data: customerMetadataZod.extend({
|
|
4979
|
+
email: import_zod12.z.string()
|
|
4980
|
+
}).passthrough()
|
|
4981
|
+
}),
|
|
4982
|
+
import_zod12.z.object({
|
|
4983
|
+
id: import_zod12.z.string(),
|
|
4984
|
+
type: import_zod12.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
|
|
4985
|
+
data: customerMetadataZod.extend({
|
|
4986
|
+
customer_properties: import_zod12.z.record(
|
|
4987
|
+
import_zod12.z.object({
|
|
4988
|
+
value: import_zod12.z.unknown(),
|
|
4989
|
+
last_updated_at: import_zod12.z.string(),
|
|
4990
|
+
last_updated_agent_account_id: import_zod12.z.string().optional(),
|
|
4991
|
+
last_updated_agent_client_id: import_zod12.z.string().optional()
|
|
4992
|
+
}).passthrough()
|
|
4993
|
+
)
|
|
4994
|
+
}).passthrough()
|
|
4995
|
+
})
|
|
4996
|
+
]);
|
|
4997
|
+
|
|
4998
|
+
// src/apis/platform/console/instance.ts
|
|
4999
|
+
var import_axios25 = __toESM(require("axios"));
|
|
5000
|
+
var REGION = {
|
|
5001
|
+
FRA: "fra",
|
|
5002
|
+
DAL: "dal",
|
|
5003
|
+
FRA_A: "fra-a",
|
|
5004
|
+
FRA_B: "fra-b"
|
|
4946
5005
|
};
|
|
4947
|
-
var
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
)
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
createWorkflow: () => getUrl4(),
|
|
4954
|
-
getWorkflow: (id) => getUrl4([id], "v1.0" /* V1 */),
|
|
4955
|
-
updateWorkflow: (id) => getUrl4([id]),
|
|
4956
|
-
deleteWorkflow: (id) => getUrl4([id]),
|
|
4957
|
-
createWorkflowDraft: (id) => getUrl4([id, "draft"]),
|
|
4958
|
-
publishWorkflowDraft: (id) => getUrl4([id, "publish"]),
|
|
4959
|
-
toggleWorkflowActivation: (id) => getUrl4([id, "activation"]),
|
|
4960
|
-
executeWorkflow: (id) => getUrl4([id, "executions"]),
|
|
4961
|
-
getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
|
|
4962
|
-
getUrl4([id, "executions"], "v1.0" /* V1 */),
|
|
4963
|
-
queryParams
|
|
4964
|
-
),
|
|
4965
|
-
getWorkflowExecution: (id, executionId) => getUrl4([id, "executions", executionId], "v1.0" /* V1 */),
|
|
4966
|
-
getWorkflowIntrospection: (id) => getUrl4([id, "metadata"], "v1.0" /* V1 */),
|
|
4967
|
-
introspectWorkflowTask: (id) => getUrl4([id, "run_task"], "v1.0" /* V1 */)
|
|
4968
|
-
};
|
|
4969
|
-
var textPlatformWorkflowsApi = {
|
|
4970
|
-
internal: textPlatformWorkflowsInternalApi,
|
|
4971
|
-
meta: {
|
|
4972
|
-
urls: urls5
|
|
4973
|
-
},
|
|
4974
|
-
getWorkflows(queryParams, authorization) {
|
|
4975
|
-
return __async(this, null, function* () {
|
|
4976
|
-
const { data: workflows } = yield textClientInstance.get(
|
|
4977
|
-
urls5.getWorkflows(queryParams),
|
|
4978
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4979
|
-
ensureAuthorizationToken: true
|
|
4980
|
-
}))
|
|
4981
|
-
);
|
|
4982
|
-
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
4983
|
-
return workflows;
|
|
4984
|
-
});
|
|
4985
|
-
},
|
|
4986
|
-
getWorkflow(workflowId, version, authorization) {
|
|
4987
|
-
return __async(this, null, function* () {
|
|
4988
|
-
const searchParams = new URLSearchParams();
|
|
4989
|
-
if (version) {
|
|
4990
|
-
searchParams.append("version", `${version}`);
|
|
4991
|
-
}
|
|
4992
|
-
const query = searchParams.toString();
|
|
4993
|
-
const { data: workflow } = yield textClientInstance.get(
|
|
4994
|
-
`${urls5.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
4995
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
4996
|
-
ensureAuthorizationToken: true
|
|
4997
|
-
}))
|
|
4998
|
-
);
|
|
4999
|
-
return enrichWorkflowTrigger(workflow);
|
|
5000
|
-
});
|
|
5001
|
-
},
|
|
5002
|
-
createWorkflow(payload, authorization) {
|
|
5003
|
-
return __async(this, null, function* () {
|
|
5004
|
-
return textClientInstance.post(
|
|
5005
|
-
urls5.createWorkflow(),
|
|
5006
|
-
__spreadProps(__spreadValues({}, payload), {
|
|
5007
|
-
trigger: payload.trigger || {}
|
|
5008
|
-
}),
|
|
5009
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5010
|
-
ensureAuthorizationToken: true
|
|
5011
|
-
}))
|
|
5012
|
-
);
|
|
5013
|
-
});
|
|
5014
|
-
},
|
|
5015
|
-
updateWorkflow(workflowId, payload, authorization) {
|
|
5016
|
-
return __async(this, null, function* () {
|
|
5017
|
-
return textClientInstance.put(
|
|
5018
|
-
urls5.updateWorkflow(workflowId),
|
|
5019
|
-
__spreadProps(__spreadValues({}, payload), {
|
|
5020
|
-
trigger: payload.trigger || {}
|
|
5021
|
-
}),
|
|
5022
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5023
|
-
ensureAuthorizationToken: true
|
|
5024
|
-
}))
|
|
5025
|
-
);
|
|
5026
|
-
});
|
|
5027
|
-
},
|
|
5028
|
-
deleteWorkflow(workflowId, authorization) {
|
|
5029
|
-
return __async(this, null, function* () {
|
|
5030
|
-
return textClientInstance.delete(urls5.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5031
|
-
ensureAuthorizationToken: true
|
|
5032
|
-
}))));
|
|
5033
|
-
});
|
|
5034
|
-
},
|
|
5035
|
-
createWorkflowDraft(workflowId, payload, authorization) {
|
|
5036
|
-
return __async(this, null, function* () {
|
|
5037
|
-
return textClientInstance.post(
|
|
5038
|
-
urls5.createWorkflowDraft(workflowId),
|
|
5039
|
-
__spreadProps(__spreadValues({}, payload), {
|
|
5040
|
-
trigger: payload.trigger || {}
|
|
5041
|
-
}),
|
|
5042
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5043
|
-
ensureAuthorizationToken: true
|
|
5044
|
-
}))
|
|
5045
|
-
);
|
|
5046
|
-
});
|
|
5047
|
-
},
|
|
5048
|
-
publishWorkflowDraft(workflowId, authorization) {
|
|
5049
|
-
return __async(this, null, function* () {
|
|
5050
|
-
return textClientInstance.post(
|
|
5051
|
-
urls5.publishWorkflowDraft(workflowId),
|
|
5052
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5053
|
-
ensureAuthorizationToken: true
|
|
5054
|
-
}))
|
|
5055
|
-
);
|
|
5056
|
-
});
|
|
5057
|
-
},
|
|
5058
|
-
toggleWorkflowActivation(workflowId, isActive, authorization) {
|
|
5059
|
-
return __async(this, null, function* () {
|
|
5060
|
-
return textClientInstance.put(
|
|
5061
|
-
urls5.toggleWorkflowActivation(workflowId),
|
|
5062
|
-
{
|
|
5063
|
-
active: isActive
|
|
5064
|
-
},
|
|
5065
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5066
|
-
ensureAuthorizationToken: true
|
|
5067
|
-
}))
|
|
5068
|
-
);
|
|
5069
|
-
});
|
|
5070
|
-
},
|
|
5071
|
-
executeWorkflow(workflowId, input, authorization) {
|
|
5072
|
-
return __async(this, null, function* () {
|
|
5073
|
-
const { data: execution } = yield textClientInstance.post(
|
|
5074
|
-
urls5.executeWorkflow(workflowId),
|
|
5075
|
-
{
|
|
5076
|
-
input
|
|
5077
|
-
},
|
|
5078
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5079
|
-
ensureAuthorizationToken: true
|
|
5080
|
-
}))
|
|
5081
|
-
);
|
|
5082
|
-
return execution;
|
|
5083
|
-
});
|
|
5084
|
-
},
|
|
5085
|
-
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
5086
|
-
return __async(this, null, function* () {
|
|
5087
|
-
const { data: executions } = yield textClientInstance.get(
|
|
5088
|
-
urls5.getWorkflowExecutions(workflowId, queryParams),
|
|
5089
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5090
|
-
ensureAuthorizationToken: true
|
|
5091
|
-
}))
|
|
5092
|
-
);
|
|
5093
|
-
return executions;
|
|
5094
|
-
});
|
|
5095
|
-
},
|
|
5096
|
-
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
5097
|
-
return __async(this, null, function* () {
|
|
5098
|
-
const { data: execution } = yield textClientInstance.get(
|
|
5099
|
-
urls5.getWorkflowExecution(workflowId, executionId),
|
|
5100
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5101
|
-
ensureAuthorizationToken: true
|
|
5102
|
-
}))
|
|
5103
|
-
);
|
|
5104
|
-
return execution;
|
|
5105
|
-
});
|
|
5106
|
-
},
|
|
5107
|
-
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
5108
|
-
return __async(this, null, function* () {
|
|
5109
|
-
const searchParams = new URLSearchParams();
|
|
5110
|
-
if (version) {
|
|
5111
|
-
searchParams.append("version", `${version}`);
|
|
5112
|
-
}
|
|
5113
|
-
const query = searchParams.toString();
|
|
5114
|
-
const { data: introspection } = yield textClientInstance.get(
|
|
5115
|
-
`${urls5.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
5116
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5117
|
-
ensureAuthorizationToken: true
|
|
5118
|
-
}))
|
|
5119
|
-
);
|
|
5120
|
-
return {
|
|
5121
|
-
tasks: introspection
|
|
5122
|
-
};
|
|
5123
|
-
});
|
|
5124
|
-
},
|
|
5125
|
-
introspectWorkflowTask(workflowId, payload, authorization) {
|
|
5126
|
-
return __async(this, null, function* () {
|
|
5127
|
-
const response = yield textClientInstance.post(
|
|
5128
|
-
urls5.introspectWorkflowTask(workflowId),
|
|
5129
|
-
{
|
|
5130
|
-
task_reference_name: payload.taskReferenceName,
|
|
5131
|
-
input_parameters: payload.inputParameters
|
|
5132
|
-
},
|
|
5133
|
-
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5134
|
-
ensureAuthorizationToken: true
|
|
5135
|
-
}))
|
|
5136
|
-
);
|
|
5137
|
-
return response.data;
|
|
5138
|
-
});
|
|
5139
|
-
}
|
|
5140
|
-
};
|
|
5141
|
-
|
|
5142
|
-
// src/apis/integrations/vercel/instance.ts
|
|
5143
|
-
var import_axios23 = __toESM(require("axios"));
|
|
5144
|
-
function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
|
|
5145
|
-
if (req.headers instanceof Headers) {
|
|
5146
|
-
return {
|
|
5147
|
-
token: req.headers.get(`${headerPrefix}-token`)
|
|
5148
|
-
};
|
|
5149
|
-
}
|
|
5150
|
-
return {
|
|
5151
|
-
token: req.headers[`${headerPrefix}-token`]
|
|
5152
|
-
};
|
|
5153
|
-
}
|
|
5154
|
-
var vercelClientInstance = import_axios23.default.create({
|
|
5155
|
-
baseURL: "https://api.vercel.com"
|
|
5156
|
-
});
|
|
5157
|
-
vercelClientInstance.interceptors.response.use(
|
|
5158
|
-
(r) => r,
|
|
5159
|
-
(error) => {
|
|
5160
|
-
var _a, _b;
|
|
5161
|
-
if (import_axios23.default.isAxiosError(error)) {
|
|
5162
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
|
|
5163
|
-
throw new UnauthorizeApiError("vercel");
|
|
5164
|
-
}
|
|
5165
|
-
}
|
|
5166
|
-
throw error;
|
|
5167
|
-
}
|
|
5168
|
-
);
|
|
5169
|
-
function getVercelClientConfig(options = {}) {
|
|
5170
|
-
var _a;
|
|
5171
|
-
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
5172
|
-
const config = {
|
|
5173
|
-
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
|
|
5174
|
-
};
|
|
5175
|
-
if (options.ensureAuthorizationToken && !config.authorization) {
|
|
5176
|
-
throw new UnauthorizeApiError("vercel");
|
|
5177
|
-
}
|
|
5178
|
-
return {
|
|
5179
|
-
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
5180
|
-
};
|
|
5181
|
-
}
|
|
5182
|
-
function initVercelClient(token) {
|
|
5183
|
-
if (token) {
|
|
5184
|
-
updateVercelClient(token);
|
|
5185
|
-
}
|
|
5186
|
-
}
|
|
5187
|
-
function updateVercelClient(token) {
|
|
5188
|
-
const headers = vercelClientInstance.defaults.headers;
|
|
5189
|
-
if (token) {
|
|
5190
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5191
|
-
} else {
|
|
5192
|
-
delete headers.Authorization;
|
|
5193
|
-
}
|
|
5194
|
-
}
|
|
5195
|
-
|
|
5196
|
-
// src/apis/platform/accounts/instance.ts
|
|
5197
|
-
var AccountsApiError = class extends ApiErrorBase {
|
|
5198
|
-
constructor() {
|
|
5199
|
-
super(...arguments);
|
|
5200
|
-
this.name = "accounts";
|
|
5201
|
-
}
|
|
5202
|
-
};
|
|
5203
|
-
var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
|
|
5204
|
-
constructor(message) {
|
|
5205
|
-
super("accounts", message);
|
|
5206
|
-
}
|
|
5207
|
-
};
|
|
5208
|
-
var AccountApiClient = class extends ApiClient {
|
|
5209
|
-
constructor() {
|
|
5210
|
-
super(...arguments);
|
|
5211
|
-
this.UnauthorizedError = UnauthorizeAccountsApiError;
|
|
5212
|
-
this.Error = AccountsApiError;
|
|
5213
|
-
this.options = {
|
|
5214
|
-
headers: {
|
|
5215
|
-
"Content-Type": "application/json"
|
|
5216
|
-
}
|
|
5217
|
-
};
|
|
5218
|
-
}
|
|
5219
|
-
};
|
|
5220
|
-
var platformAccountsClientInstance = new AccountApiClient({
|
|
5221
|
-
baseURL: "https://accounts.labs.livechatinc.com"
|
|
5222
|
-
});
|
|
5223
|
-
function initPlatformAccountsClient(baseUrl, token) {
|
|
5224
|
-
if (baseUrl) {
|
|
5225
|
-
platformAccountsClientInstance.updateConfig({
|
|
5226
|
-
baseURL: baseUrl
|
|
5227
|
-
});
|
|
5228
|
-
}
|
|
5229
|
-
platformAccountsClientInstance.updateAuthorization({
|
|
5230
|
-
token
|
|
5231
|
-
});
|
|
5232
|
-
}
|
|
5233
|
-
|
|
5234
|
-
// src/apis/platform/billing/instance.ts
|
|
5235
|
-
var import_axios24 = __toESM(require("axios"));
|
|
5236
|
-
var billingClientInstance = import_axios24.default.create({
|
|
5237
|
-
baseURL: "https://billing.labs.livechatinc.com"
|
|
5238
|
-
});
|
|
5239
|
-
function getBillingClientConfig(options = {}) {
|
|
5240
|
-
var _a;
|
|
5241
|
-
const defaultAuthorization = billingClientInstance.defaults.headers.Authorization;
|
|
5242
|
-
const headers = {
|
|
5243
|
-
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
|
|
5244
|
-
};
|
|
5245
|
-
return {
|
|
5246
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5247
|
-
};
|
|
5248
|
-
}
|
|
5249
|
-
function initBillingClient(baseUrl, token) {
|
|
5250
|
-
if (baseUrl) {
|
|
5251
|
-
billingClientInstance.interceptors.request.use(
|
|
5252
|
-
(config) => {
|
|
5253
|
-
config.baseURL = baseUrl;
|
|
5254
|
-
return config;
|
|
5255
|
-
},
|
|
5256
|
-
(error) => Promise.reject(error)
|
|
5257
|
-
);
|
|
5258
|
-
}
|
|
5259
|
-
if (token) {
|
|
5260
|
-
billingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
5261
|
-
} else {
|
|
5262
|
-
delete billingClientInstance.defaults.headers.Authorization;
|
|
5263
|
-
}
|
|
5264
|
-
}
|
|
5265
|
-
|
|
5266
|
-
// src/apis/platform/cdp/events/_contracts/payloads/events.ts
|
|
5267
|
-
var import_zod12 = require("zod");
|
|
5268
|
-
var CdpCustomerEventType = /* @__PURE__ */ ((CdpCustomerEventType2) => {
|
|
5269
|
-
CdpCustomerEventType2["EmailSet"] = "customer_email_set";
|
|
5270
|
-
CdpCustomerEventType2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
|
|
5271
|
-
return CdpCustomerEventType2;
|
|
5272
|
-
})(CdpCustomerEventType || {});
|
|
5273
|
-
var customerMetadataZod = import_zod12.z.object({
|
|
5274
|
-
organization_id: import_zod12.z.string(),
|
|
5275
|
-
customer_id: import_zod12.z.string(),
|
|
5276
|
-
master_id: import_zod12.z.string()
|
|
5277
|
-
});
|
|
5278
|
-
var cdpCustomerEventMessageZod = import_zod12.z.discriminatedUnion("type", [
|
|
5279
|
-
import_zod12.z.object({
|
|
5280
|
-
id: import_zod12.z.string(),
|
|
5281
|
-
type: import_zod12.z.literal("customer_email_set" /* EmailSet */),
|
|
5282
|
-
data: customerMetadataZod.extend({
|
|
5283
|
-
email: import_zod12.z.string()
|
|
5284
|
-
}).passthrough()
|
|
5285
|
-
}),
|
|
5286
|
-
import_zod12.z.object({
|
|
5287
|
-
id: import_zod12.z.string(),
|
|
5288
|
-
type: import_zod12.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
|
|
5289
|
-
data: customerMetadataZod.extend({
|
|
5290
|
-
customer_properties: import_zod12.z.record(
|
|
5291
|
-
import_zod12.z.object({
|
|
5292
|
-
value: import_zod12.z.unknown(),
|
|
5293
|
-
last_updated_at: import_zod12.z.string(),
|
|
5294
|
-
last_updated_agent_account_id: import_zod12.z.string().optional(),
|
|
5295
|
-
last_updated_agent_client_id: import_zod12.z.string().optional()
|
|
5296
|
-
}).passthrough()
|
|
5297
|
-
)
|
|
5298
|
-
}).passthrough()
|
|
5299
|
-
})
|
|
5300
|
-
]);
|
|
5301
|
-
|
|
5302
|
-
// src/apis/platform/console/instance.ts
|
|
5303
|
-
var import_axios25 = __toESM(require("axios"));
|
|
5304
|
-
var REGION = {
|
|
5305
|
-
FRA: "fra",
|
|
5306
|
-
DAL: "dal",
|
|
5307
|
-
FRA_A: "fra-a",
|
|
5308
|
-
FRA_B: "fra-b"
|
|
5309
|
-
};
|
|
5310
|
-
var supportedRegions = Object.values(REGION);
|
|
5311
|
-
var getRegion = (token) => {
|
|
5312
|
-
const region = token.split(":")[0];
|
|
5313
|
-
if (supportedRegions.includes(region)) {
|
|
5314
|
-
return region;
|
|
5315
|
-
}
|
|
5006
|
+
var supportedRegions = Object.values(REGION);
|
|
5007
|
+
var getRegion = (token) => {
|
|
5008
|
+
const region = token.split(":")[0];
|
|
5009
|
+
if (supportedRegions.includes(region)) {
|
|
5010
|
+
return region;
|
|
5011
|
+
}
|
|
5316
5012
|
};
|
|
5317
5013
|
var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
|
|
5318
5014
|
constructor() {
|
|
@@ -6110,119 +5806,434 @@ function getWorkflowsClientConfig(options = {}) {
|
|
|
6110
5806
|
if (currentHeaders.Authorization) {
|
|
6111
5807
|
currentHeaders["X-Region"] = (_d = getRegion4(currentHeaders.Authorization)) != null ? _d : void 0;
|
|
6112
5808
|
}
|
|
6113
|
-
if (((_e = options.ensureAuthorizationToken) == null ? void 0 : _e.platform) && !headers.platform.token) {
|
|
6114
|
-
throw new UnauthorizeApiError("accounts");
|
|
5809
|
+
if (((_e = options.ensureAuthorizationToken) == null ? void 0 : _e.platform) && !headers.platform.token) {
|
|
5810
|
+
throw new UnauthorizeApiError("accounts");
|
|
5811
|
+
}
|
|
5812
|
+
return {
|
|
5813
|
+
headers: __spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {})
|
|
5814
|
+
};
|
|
5815
|
+
}
|
|
5816
|
+
var getWorkflowsClientDefaultConfig = (authorization) => getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5817
|
+
ensureAuthorizationToken: {
|
|
5818
|
+
platform: true
|
|
5819
|
+
}
|
|
5820
|
+
}));
|
|
5821
|
+
function initWorkflowsClient(baseUrl, tokens) {
|
|
5822
|
+
if (baseUrl) {
|
|
5823
|
+
workflowsClientInstance.interceptors.request.use(
|
|
5824
|
+
(config) => {
|
|
5825
|
+
config.baseURL = baseUrl;
|
|
5826
|
+
return config;
|
|
5827
|
+
},
|
|
5828
|
+
(error) => Promise.reject(error)
|
|
5829
|
+
);
|
|
5830
|
+
}
|
|
5831
|
+
if (tokens) {
|
|
5832
|
+
updateWorkflowsClient(tokens);
|
|
5833
|
+
}
|
|
5834
|
+
}
|
|
5835
|
+
function updateWorkflowsClient(tokens) {
|
|
5836
|
+
var _a, _b;
|
|
5837
|
+
const headers = workflowsClientInstance.defaults.headers;
|
|
5838
|
+
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5839
|
+
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
|
|
5843
|
+
// src/apis/integrations/text/platform/workflow/resources/api.ts
|
|
5844
|
+
var integrationNameToProduct = {
|
|
5845
|
+
["text-helpdesk" /* HelpDesk */]: "helpdesk",
|
|
5846
|
+
["text-livechat" /* LiveChat */]: "livechat"
|
|
5847
|
+
};
|
|
5848
|
+
var textPlatformWorkflowsResourcesApi = {
|
|
5849
|
+
get(resource, params, authorization) {
|
|
5850
|
+
return __async(this, null, function* () {
|
|
5851
|
+
var _a;
|
|
5852
|
+
const baseProvider = (_a = integrationNameToProduct[resource.provider]) != null ? _a : resource.provider;
|
|
5853
|
+
const provider = resource.product ? `${baseProvider}-${resource.product}` : baseProvider;
|
|
5854
|
+
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5855
|
+
ensureAuthorizationToken: true
|
|
5856
|
+
}));
|
|
5857
|
+
return textClientInstance.get(
|
|
5858
|
+
`/workflow_platform/external_resources/${encodeURIComponent(provider)}/${encodeURIComponent(resource.name)}`,
|
|
5859
|
+
__spreadProps(__spreadValues({}, config), {
|
|
5860
|
+
params,
|
|
5861
|
+
headers: __spreadProps(__spreadValues({}, config.headers), {
|
|
5862
|
+
"X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
|
|
5863
|
+
})
|
|
5864
|
+
})
|
|
5865
|
+
).catch((error) => {
|
|
5866
|
+
if (error instanceof TextApiError) {
|
|
5867
|
+
throw error.withCustomMessage(
|
|
5868
|
+
`Couldn't get external resources. [${error.message}]`
|
|
5869
|
+
);
|
|
5870
|
+
}
|
|
5871
|
+
throw error;
|
|
5872
|
+
});
|
|
5873
|
+
});
|
|
5874
|
+
}
|
|
5875
|
+
};
|
|
5876
|
+
|
|
5877
|
+
// src/apis/integrations/text/platform/workflow/templates/api.ts
|
|
5878
|
+
var getUrl3 = (segments = [], version) => buildUrlFromSegments(
|
|
5879
|
+
segments,
|
|
5880
|
+
`/workflow_platform/${version ? `${version}/` : ""}workflows/templates`
|
|
5881
|
+
);
|
|
5882
|
+
var urls4 = {
|
|
5883
|
+
getList: (queryParams) => enrichUrlWithQueryParams(getUrl3([], "v1.0" /* V1 */), queryParams),
|
|
5884
|
+
get: (templateId) => getUrl3([templateId], "v1.0" /* V1 */)
|
|
5885
|
+
};
|
|
5886
|
+
var textPlatformWorkflowsTemplatesApi = {
|
|
5887
|
+
meta: {
|
|
5888
|
+
urls: urls4
|
|
5889
|
+
},
|
|
5890
|
+
getList(queryParams, authorization) {
|
|
5891
|
+
return __async(this, null, function* () {
|
|
5892
|
+
return textClientInstance.get(
|
|
5893
|
+
urls4.getList(queryParams),
|
|
5894
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5895
|
+
ensureAuthorizationToken: true
|
|
5896
|
+
}))
|
|
5897
|
+
).catch((error) => {
|
|
5898
|
+
if (error instanceof TextApiError) {
|
|
5899
|
+
throw error.withCustomMessage(
|
|
5900
|
+
`Couldn't get workflow templates. [${error.message}]`
|
|
5901
|
+
);
|
|
5902
|
+
}
|
|
5903
|
+
throw error;
|
|
5904
|
+
});
|
|
5905
|
+
});
|
|
5906
|
+
},
|
|
5907
|
+
get(templateId, authorization) {
|
|
5908
|
+
return __async(this, null, function* () {
|
|
5909
|
+
return textClientInstance.get(
|
|
5910
|
+
urls4.get(templateId),
|
|
5911
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
5912
|
+
ensureAuthorizationToken: true
|
|
5913
|
+
}))
|
|
5914
|
+
).catch((error) => {
|
|
5915
|
+
if (error instanceof TextApiError) {
|
|
5916
|
+
throw error.withCustomMessage(
|
|
5917
|
+
`Couldn't get workflow template. [${error.message}]`
|
|
5918
|
+
);
|
|
5919
|
+
}
|
|
5920
|
+
throw error;
|
|
5921
|
+
});
|
|
5922
|
+
});
|
|
5923
|
+
}
|
|
5924
|
+
};
|
|
5925
|
+
|
|
5926
|
+
// src/apis/integrations/text/platform/workflow/workflows/internal/crm/api.ts
|
|
5927
|
+
var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/internal/crm");
|
|
5928
|
+
var urls5 = {
|
|
5929
|
+
getOrganizations: (queryParams) => enrichUrlWithQueryParams(getUrl4(["stats"]), queryParams),
|
|
5930
|
+
getOrganization: (organizationId) => getUrl4(["stats", organizationId]),
|
|
5931
|
+
getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl4(["workflows"]), queryParams),
|
|
5932
|
+
getWorkflow: (id) => getUrl4(["workflows", id]),
|
|
5933
|
+
getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
|
|
5934
|
+
getUrl4(["workflows", id, "executions"]),
|
|
5935
|
+
queryParams
|
|
5936
|
+
),
|
|
5937
|
+
getWorkflowExecution: (id, executionId) => getUrl4(["workflows", id, "executions", executionId]),
|
|
5938
|
+
getWorkflowIntrospection: (id) => getUrl4(["workflows", id, "metadata"])
|
|
5939
|
+
};
|
|
5940
|
+
var textPlatformWorkflowsInternalCrmApi = {
|
|
5941
|
+
meta: {
|
|
5942
|
+
urls: urls5
|
|
5943
|
+
},
|
|
5944
|
+
getOrganizations(queryParams, authorization) {
|
|
5945
|
+
return __async(this, null, function* () {
|
|
5946
|
+
const { data: organizations } = yield textClientInstance.get(
|
|
5947
|
+
urls5.getOrganizations(queryParams),
|
|
5948
|
+
getWorkflowApiCrmConfig(authorization)
|
|
5949
|
+
);
|
|
5950
|
+
return organizations;
|
|
5951
|
+
});
|
|
5952
|
+
},
|
|
5953
|
+
getOrganization(organizationId, authorization) {
|
|
5954
|
+
return __async(this, null, function* () {
|
|
5955
|
+
const { data: organization } = yield textClientInstance.get(
|
|
5956
|
+
urls5.getOrganization(organizationId),
|
|
5957
|
+
getWorkflowApiCrmConfig(authorization)
|
|
5958
|
+
);
|
|
5959
|
+
return organization;
|
|
5960
|
+
});
|
|
5961
|
+
},
|
|
5962
|
+
getWorkflows(queryParams, authorization) {
|
|
5963
|
+
return __async(this, null, function* () {
|
|
5964
|
+
const { data: workflows } = yield textClientInstance.get(urls5.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
|
|
5965
|
+
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
5966
|
+
return workflows;
|
|
5967
|
+
});
|
|
5968
|
+
},
|
|
5969
|
+
getWorkflow(workflowId, authorization) {
|
|
5970
|
+
return __async(this, null, function* () {
|
|
5971
|
+
const searchParams = new URLSearchParams();
|
|
5972
|
+
const query = searchParams.toString();
|
|
5973
|
+
const { data: workflow } = yield textClientInstance.get(
|
|
5974
|
+
`${urls5.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
5975
|
+
getWorkflowApiCrmConfig(authorization)
|
|
5976
|
+
);
|
|
5977
|
+
return enrichWorkflowTrigger(workflow);
|
|
5978
|
+
});
|
|
5979
|
+
},
|
|
5980
|
+
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
5981
|
+
return __async(this, null, function* () {
|
|
5982
|
+
const { data: executions } = yield textClientInstance.get(
|
|
5983
|
+
urls5.getWorkflowExecutions(workflowId, queryParams),
|
|
5984
|
+
getWorkflowApiCrmConfig(authorization)
|
|
5985
|
+
);
|
|
5986
|
+
return executions;
|
|
5987
|
+
});
|
|
5988
|
+
},
|
|
5989
|
+
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
5990
|
+
return __async(this, null, function* () {
|
|
5991
|
+
const { data: execution } = yield textClientInstance.get(
|
|
5992
|
+
urls5.getWorkflowExecution(workflowId, executionId),
|
|
5993
|
+
getWorkflowApiCrmConfig(authorization)
|
|
5994
|
+
);
|
|
5995
|
+
return execution;
|
|
5996
|
+
});
|
|
5997
|
+
},
|
|
5998
|
+
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
5999
|
+
return __async(this, null, function* () {
|
|
6000
|
+
const searchParams = new URLSearchParams();
|
|
6001
|
+
if (version) {
|
|
6002
|
+
searchParams.append("version", `${version}`);
|
|
6003
|
+
}
|
|
6004
|
+
const query = searchParams.toString();
|
|
6005
|
+
const { data: introspection } = yield textClientInstance.get(
|
|
6006
|
+
`${urls5.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
6007
|
+
getWorkflowApiCrmConfig(authorization)
|
|
6008
|
+
);
|
|
6009
|
+
return {
|
|
6010
|
+
tasks: introspection
|
|
6011
|
+
};
|
|
6012
|
+
});
|
|
6013
|
+
}
|
|
6014
|
+
};
|
|
6015
|
+
|
|
6016
|
+
// src/apis/integrations/text/platform/workflow/workflows/internal/api.ts
|
|
6017
|
+
var textPlatformWorkflowsInternalApi = {
|
|
6018
|
+
crm: textPlatformWorkflowsInternalCrmApi
|
|
6019
|
+
};
|
|
6020
|
+
|
|
6021
|
+
// src/apis/integrations/text/platform/workflow/workflows/api.ts
|
|
6022
|
+
var enrichWorkflowTrigger = (workflow) => {
|
|
6023
|
+
var _a, _b, _c;
|
|
6024
|
+
const trigger = workflow.trigger;
|
|
6025
|
+
if ((trigger == null ? void 0 : trigger.type) === WorkflowTriggerType.webhook && "webhook" in trigger) {
|
|
6026
|
+
const webhookTrigger = trigger;
|
|
6027
|
+
webhookTrigger.name = (_b = webhookTrigger.sub_type) != null ? _b : `${webhookTrigger.webhook.source}-${(_a = webhookTrigger.webhook.event) == null ? void 0 : _a.name}`;
|
|
6115
6028
|
}
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
};
|
|
6119
|
-
}
|
|
6120
|
-
var getWorkflowsClientDefaultConfig = (authorization) => getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6121
|
-
ensureAuthorizationToken: {
|
|
6122
|
-
platform: true
|
|
6029
|
+
if ((trigger == null ? void 0 : trigger.type) === WorkflowTriggerType.webhookManual) {
|
|
6030
|
+
trigger.name = "webhook_manual";
|
|
6123
6031
|
}
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
if (baseUrl) {
|
|
6127
|
-
workflowsClientInstance.interceptors.request.use(
|
|
6128
|
-
(config) => {
|
|
6129
|
-
config.baseURL = baseUrl;
|
|
6130
|
-
return config;
|
|
6131
|
-
},
|
|
6132
|
-
(error) => Promise.reject(error)
|
|
6133
|
-
);
|
|
6032
|
+
if ((trigger == null ? void 0 : trigger.type) === WorkflowTriggerType.manual) {
|
|
6033
|
+
trigger.name = trigger.sub_type === WorkflowManualTriggerSubType.forSelectedChat ? WorkflowManualTriggerSubTypeName[WorkflowManualTriggerSubType.forSelectedChat] : "manual";
|
|
6134
6034
|
}
|
|
6135
|
-
if (
|
|
6136
|
-
|
|
6035
|
+
if ((trigger == null ? void 0 : trigger.type) === WorkflowTriggerType.agent) {
|
|
6036
|
+
trigger.name = "ai_agent";
|
|
6137
6037
|
}
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
var _a, _b;
|
|
6141
|
-
const headers = workflowsClientInstance.defaults.headers;
|
|
6142
|
-
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
6143
|
-
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
6038
|
+
if ((trigger == null ? void 0 : trigger.type) === WorkflowTriggerType.recurring) {
|
|
6039
|
+
trigger.name = "scheduled";
|
|
6144
6040
|
}
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
// src/apis/integrations/text/platform/workflow/resources/api.ts
|
|
6148
|
-
var integrationNameToProduct = {
|
|
6149
|
-
["text-helpdesk" /* HelpDesk */]: "helpdesk",
|
|
6150
|
-
["text-livechat" /* LiveChat */]: "livechat"
|
|
6151
|
-
};
|
|
6152
|
-
var textPlatformWorkflowsResourcesApi = {
|
|
6153
|
-
get(resource, params, authorization) {
|
|
6154
|
-
return __async(this, null, function* () {
|
|
6155
|
-
var _a;
|
|
6156
|
-
const baseProvider = (_a = integrationNameToProduct[resource.provider]) != null ? _a : resource.provider;
|
|
6157
|
-
const provider = resource.product ? `${baseProvider}-${resource.product}` : baseProvider;
|
|
6158
|
-
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6159
|
-
ensureAuthorizationToken: true
|
|
6160
|
-
}));
|
|
6161
|
-
return textClientInstance.get(
|
|
6162
|
-
`/workflow_platform/external_resources/${encodeURIComponent(provider)}/${encodeURIComponent(resource.name)}`,
|
|
6163
|
-
__spreadProps(__spreadValues({}, config), {
|
|
6164
|
-
params,
|
|
6165
|
-
headers: __spreadProps(__spreadValues({}, config.headers), {
|
|
6166
|
-
"X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
|
|
6167
|
-
})
|
|
6168
|
-
})
|
|
6169
|
-
).catch((error) => {
|
|
6170
|
-
if (error instanceof TextApiError) {
|
|
6171
|
-
throw error.withCustomMessage(
|
|
6172
|
-
`Couldn't get external resources. [${error.message}]`
|
|
6173
|
-
);
|
|
6174
|
-
}
|
|
6175
|
-
throw error;
|
|
6176
|
-
});
|
|
6177
|
-
});
|
|
6041
|
+
if (((_c = workflow.trigger) == null ? void 0 : _c.type) === WorkflowTriggerType.oneTime) {
|
|
6042
|
+
workflow.trigger.name = "one_time";
|
|
6178
6043
|
}
|
|
6044
|
+
return workflow;
|
|
6179
6045
|
};
|
|
6180
|
-
|
|
6181
|
-
// src/apis/integrations/text/platform/workflow/templates/api.ts
|
|
6182
6046
|
var getUrl5 = (segments = [], version) => buildUrlFromSegments(
|
|
6183
6047
|
segments,
|
|
6184
|
-
`/workflow_platform/${version ? `${version}/` : ""}workflows
|
|
6048
|
+
`/workflow_platform/${version ? `${version}/` : ""}workflows`
|
|
6185
6049
|
);
|
|
6186
6050
|
var urls6 = {
|
|
6187
|
-
|
|
6188
|
-
|
|
6051
|
+
getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl5([], "v1.0" /* V1 */), queryParams),
|
|
6052
|
+
createWorkflow: () => getUrl5(),
|
|
6053
|
+
getWorkflow: (id) => getUrl5([id], "v1.0" /* V1 */),
|
|
6054
|
+
updateWorkflow: (id) => getUrl5([id]),
|
|
6055
|
+
deleteWorkflow: (id) => getUrl5([id]),
|
|
6056
|
+
createWorkflowDraft: (id) => getUrl5([id, "draft"]),
|
|
6057
|
+
publishWorkflowDraft: (id) => getUrl5([id, "publish"]),
|
|
6058
|
+
toggleWorkflowActivation: (id) => getUrl5([id, "activation"]),
|
|
6059
|
+
executeWorkflow: (id) => getUrl5([id, "executions"]),
|
|
6060
|
+
getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
|
|
6061
|
+
getUrl5([id, "executions"], "v1.0" /* V1 */),
|
|
6062
|
+
queryParams
|
|
6063
|
+
),
|
|
6064
|
+
getWorkflowExecution: (id, executionId) => getUrl5([id, "executions", executionId], "v1.0" /* V1 */),
|
|
6065
|
+
getWorkflowIntrospection: (id) => getUrl5([id, "metadata"], "v1.0" /* V1 */),
|
|
6066
|
+
introspectWorkflowTask: (id) => getUrl5([id, "run_task"], "v1.0" /* V1 */)
|
|
6189
6067
|
};
|
|
6190
|
-
var
|
|
6068
|
+
var textPlatformWorkflowsApi = {
|
|
6069
|
+
internal: textPlatformWorkflowsInternalApi,
|
|
6191
6070
|
meta: {
|
|
6192
6071
|
urls: urls6
|
|
6193
6072
|
},
|
|
6194
|
-
|
|
6073
|
+
getWorkflows(queryParams, authorization) {
|
|
6195
6074
|
return __async(this, null, function* () {
|
|
6196
|
-
|
|
6197
|
-
urls6.
|
|
6075
|
+
const { data: workflows } = yield textClientInstance.get(
|
|
6076
|
+
urls6.getWorkflows(queryParams),
|
|
6198
6077
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6199
6078
|
ensureAuthorizationToken: true
|
|
6200
6079
|
}))
|
|
6201
|
-
)
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
`Couldn't get workflow templates. [${error.message}]`
|
|
6205
|
-
);
|
|
6206
|
-
}
|
|
6207
|
-
throw error;
|
|
6208
|
-
});
|
|
6080
|
+
);
|
|
6081
|
+
workflows.data = workflows.data.map(enrichWorkflowTrigger);
|
|
6082
|
+
return workflows;
|
|
6209
6083
|
});
|
|
6210
6084
|
},
|
|
6211
|
-
|
|
6085
|
+
getWorkflow(workflowId, version, authorization) {
|
|
6212
6086
|
return __async(this, null, function* () {
|
|
6213
|
-
|
|
6214
|
-
|
|
6087
|
+
const searchParams = new URLSearchParams();
|
|
6088
|
+
if (version) {
|
|
6089
|
+
searchParams.append("version", `${version}`);
|
|
6090
|
+
}
|
|
6091
|
+
const query = searchParams.toString();
|
|
6092
|
+
const { data: workflow } = yield textClientInstance.get(
|
|
6093
|
+
`${urls6.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
|
|
6215
6094
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6216
6095
|
ensureAuthorizationToken: true
|
|
6217
6096
|
}))
|
|
6218
|
-
)
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6097
|
+
);
|
|
6098
|
+
return enrichWorkflowTrigger(workflow);
|
|
6099
|
+
});
|
|
6100
|
+
},
|
|
6101
|
+
createWorkflow(payload, authorization) {
|
|
6102
|
+
return __async(this, null, function* () {
|
|
6103
|
+
return textClientInstance.post(
|
|
6104
|
+
urls6.createWorkflow(),
|
|
6105
|
+
__spreadProps(__spreadValues({}, payload), {
|
|
6106
|
+
trigger: payload.trigger || {}
|
|
6107
|
+
}),
|
|
6108
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6109
|
+
ensureAuthorizationToken: true
|
|
6110
|
+
}))
|
|
6111
|
+
);
|
|
6112
|
+
});
|
|
6113
|
+
},
|
|
6114
|
+
updateWorkflow(workflowId, payload, authorization) {
|
|
6115
|
+
return __async(this, null, function* () {
|
|
6116
|
+
return textClientInstance.put(
|
|
6117
|
+
urls6.updateWorkflow(workflowId),
|
|
6118
|
+
__spreadProps(__spreadValues({}, payload), {
|
|
6119
|
+
trigger: payload.trigger || {}
|
|
6120
|
+
}),
|
|
6121
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6122
|
+
ensureAuthorizationToken: true
|
|
6123
|
+
}))
|
|
6124
|
+
);
|
|
6125
|
+
});
|
|
6126
|
+
},
|
|
6127
|
+
deleteWorkflow(workflowId, authorization) {
|
|
6128
|
+
return __async(this, null, function* () {
|
|
6129
|
+
return textClientInstance.delete(urls6.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6130
|
+
ensureAuthorizationToken: true
|
|
6131
|
+
}))));
|
|
6132
|
+
});
|
|
6133
|
+
},
|
|
6134
|
+
createWorkflowDraft(workflowId, payload, authorization) {
|
|
6135
|
+
return __async(this, null, function* () {
|
|
6136
|
+
return textClientInstance.post(
|
|
6137
|
+
urls6.createWorkflowDraft(workflowId),
|
|
6138
|
+
__spreadProps(__spreadValues({}, payload), {
|
|
6139
|
+
trigger: payload.trigger || {}
|
|
6140
|
+
}),
|
|
6141
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6142
|
+
ensureAuthorizationToken: true
|
|
6143
|
+
}))
|
|
6144
|
+
);
|
|
6145
|
+
});
|
|
6146
|
+
},
|
|
6147
|
+
publishWorkflowDraft(workflowId, authorization) {
|
|
6148
|
+
return __async(this, null, function* () {
|
|
6149
|
+
return textClientInstance.post(
|
|
6150
|
+
urls6.publishWorkflowDraft(workflowId),
|
|
6151
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6152
|
+
ensureAuthorizationToken: true
|
|
6153
|
+
}))
|
|
6154
|
+
);
|
|
6155
|
+
});
|
|
6156
|
+
},
|
|
6157
|
+
toggleWorkflowActivation(workflowId, isActive, authorization) {
|
|
6158
|
+
return __async(this, null, function* () {
|
|
6159
|
+
return textClientInstance.put(
|
|
6160
|
+
urls6.toggleWorkflowActivation(workflowId),
|
|
6161
|
+
{
|
|
6162
|
+
active: isActive
|
|
6163
|
+
},
|
|
6164
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6165
|
+
ensureAuthorizationToken: true
|
|
6166
|
+
}))
|
|
6167
|
+
);
|
|
6168
|
+
});
|
|
6169
|
+
},
|
|
6170
|
+
executeWorkflow(workflowId, input, authorization) {
|
|
6171
|
+
return __async(this, null, function* () {
|
|
6172
|
+
const { data: execution } = yield textClientInstance.post(
|
|
6173
|
+
urls6.executeWorkflow(workflowId),
|
|
6174
|
+
{
|
|
6175
|
+
input
|
|
6176
|
+
},
|
|
6177
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6178
|
+
ensureAuthorizationToken: true
|
|
6179
|
+
}))
|
|
6180
|
+
);
|
|
6181
|
+
return execution;
|
|
6182
|
+
});
|
|
6183
|
+
},
|
|
6184
|
+
getWorkflowExecutions(workflowId, queryParams, authorization) {
|
|
6185
|
+
return __async(this, null, function* () {
|
|
6186
|
+
const { data: executions } = yield textClientInstance.get(
|
|
6187
|
+
urls6.getWorkflowExecutions(workflowId, queryParams),
|
|
6188
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6189
|
+
ensureAuthorizationToken: true
|
|
6190
|
+
}))
|
|
6191
|
+
);
|
|
6192
|
+
return executions;
|
|
6193
|
+
});
|
|
6194
|
+
},
|
|
6195
|
+
getWorkflowExecution(workflowId, executionId, authorization) {
|
|
6196
|
+
return __async(this, null, function* () {
|
|
6197
|
+
const { data: execution } = yield textClientInstance.get(
|
|
6198
|
+
urls6.getWorkflowExecution(workflowId, executionId),
|
|
6199
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6200
|
+
ensureAuthorizationToken: true
|
|
6201
|
+
}))
|
|
6202
|
+
);
|
|
6203
|
+
return execution;
|
|
6204
|
+
});
|
|
6205
|
+
},
|
|
6206
|
+
getWorkflowIntrospection(workflowId, version, authorization) {
|
|
6207
|
+
return __async(this, null, function* () {
|
|
6208
|
+
const searchParams = new URLSearchParams();
|
|
6209
|
+
if (version) {
|
|
6210
|
+
searchParams.append("version", `${version}`);
|
|
6211
|
+
}
|
|
6212
|
+
const query = searchParams.toString();
|
|
6213
|
+
const { data: introspection } = yield textClientInstance.get(
|
|
6214
|
+
`${urls6.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
|
|
6215
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6216
|
+
ensureAuthorizationToken: true
|
|
6217
|
+
}))
|
|
6218
|
+
);
|
|
6219
|
+
return {
|
|
6220
|
+
tasks: introspection
|
|
6221
|
+
};
|
|
6222
|
+
});
|
|
6223
|
+
},
|
|
6224
|
+
introspectWorkflowTask(workflowId, payload, authorization) {
|
|
6225
|
+
return __async(this, null, function* () {
|
|
6226
|
+
const response = yield textClientInstance.post(
|
|
6227
|
+
urls6.introspectWorkflowTask(workflowId),
|
|
6228
|
+
{
|
|
6229
|
+
task_reference_name: payload.taskReferenceName,
|
|
6230
|
+
input_parameters: payload.inputParameters
|
|
6231
|
+
},
|
|
6232
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
6233
|
+
ensureAuthorizationToken: true
|
|
6234
|
+
}))
|
|
6235
|
+
);
|
|
6236
|
+
return response.data;
|
|
6226
6237
|
});
|
|
6227
6238
|
}
|
|
6228
6239
|
};
|
|
@@ -9941,6 +9952,8 @@ function initApi(config, tokens) {
|
|
|
9941
9952
|
WorkflowExecutionStatus,
|
|
9942
9953
|
WorkflowExecutionTaskStatus,
|
|
9943
9954
|
WorkflowItemKind,
|
|
9955
|
+
WorkflowManualTriggerSubType,
|
|
9956
|
+
WorkflowManualTriggerSubTypeName,
|
|
9944
9957
|
WorkflowTaskType,
|
|
9945
9958
|
WorkflowTemplateCategory,
|
|
9946
9959
|
WorkflowTriggerType,
|
|
@@ -9960,7 +9973,6 @@ function initApi(config, tokens) {
|
|
|
9960
9973
|
cdpCustomerEventMessageZod,
|
|
9961
9974
|
consoleClientInstance,
|
|
9962
9975
|
dpsClientInstance,
|
|
9963
|
-
enrichWorkflowTrigger,
|
|
9964
9976
|
extractTokenFromAuthorizationHeader,
|
|
9965
9977
|
getAdapterClientConfig,
|
|
9966
9978
|
getAdapterClientDefaultConfig,
|