@livechat/developer-studio-api 3.1.3 → 3.1.5

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/index.js CHANGED
@@ -1448,15 +1448,17 @@ var import_axios8 = __toESM(require("axios"));
1448
1448
  var textClientInstance = import_axios8.default.create({
1449
1449
  baseURL: "https://api.labs.text.com"
1450
1450
  });
1451
- function getTextClientAuthorization(req) {
1451
+ function getTextClientAuthorization(req, usePlatformToken = true) {
1452
1452
  if (req.headers instanceof Headers) {
1453
1453
  return {
1454
- token: req.headers.get("x-adapter-text-token"),
1454
+ token: req.headers.get(
1455
+ usePlatformToken ? "x-adapter-platform-token" : "x-adapter-text-token"
1456
+ ),
1455
1457
  tokenType: "Bearer"
1456
1458
  };
1457
1459
  }
1458
1460
  return {
1459
- token: req.headers["x-adapter-text-token"],
1461
+ token: req.headers[usePlatformToken ? "x-adapter-platform-token" : "x-adapter-text-token"],
1460
1462
  tokenType: "Bearer"
1461
1463
  };
1462
1464
  }
@@ -1847,7 +1849,52 @@ var textPlatformDashboardApi = {
1847
1849
  }
1848
1850
  };
1849
1851
 
1850
- // src/apis/integrations/text/platform/workflows/api.ts
1852
+ // src/apis/integrations/text/platform/workflow/credentials/api.ts
1853
+ var textPlatformWorkflowsCredentialsApi = {
1854
+ get(name, authorization) {
1855
+ return __async(this, null, function* () {
1856
+ return textClientInstance.get(
1857
+ `/workflow_platform/credentials/${name}`,
1858
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1859
+ ensureAuthorizationToken: true
1860
+ }))
1861
+ );
1862
+ });
1863
+ },
1864
+ getList(authorization) {
1865
+ return __async(this, null, function* () {
1866
+ return textClientInstance.get(
1867
+ `/workflow_platform/credentials`,
1868
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1869
+ ensureAuthorizationToken: true
1870
+ }))
1871
+ );
1872
+ });
1873
+ },
1874
+ create(payload, authorization) {
1875
+ return __async(this, null, function* () {
1876
+ yield textClientInstance.post(
1877
+ `/workflow_platform/credentials`,
1878
+ payload,
1879
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1880
+ ensureAuthorizationToken: true
1881
+ }))
1882
+ );
1883
+ });
1884
+ },
1885
+ delete(name, authorization) {
1886
+ return __async(this, null, function* () {
1887
+ yield textClientInstance.delete(
1888
+ `/workflow_platform/credentials/${name}`,
1889
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1890
+ ensureAuthorizationToken: true
1891
+ }))
1892
+ );
1893
+ });
1894
+ }
1895
+ };
1896
+
1897
+ // src/apis/integrations/text/platform/workflow/workflows/api.ts
1851
1898
  var textPlatformWorkflowsApi = {
1852
1899
  getWorkflows(authorization) {
1853
1900
  return __async(this, null, function* () {
@@ -1940,10 +1987,16 @@ var textPlatformWorkflowsApi = {
1940
1987
  }
1941
1988
  };
1942
1989
 
1990
+ // src/apis/integrations/text/platform/workflow/api.ts
1991
+ var textPlatformWorkflowApi = {
1992
+ workflows: textPlatformWorkflowsApi,
1993
+ credentials: textPlatformWorkflowsCredentialsApi
1994
+ };
1995
+
1943
1996
  // src/apis/integrations/text/platform/api.ts
1944
1997
  var textPlatformApi = {
1945
1998
  dashboard: textPlatformDashboardApi,
1946
- workflows: textPlatformWorkflowsApi
1999
+ workflow: textPlatformWorkflowApi
1947
2000
  };
1948
2001
 
1949
2002
  // src/apis/integrations/text/api.ts
@@ -6122,7 +6175,7 @@ var platformAdapterAppApi = {
6122
6175
  }
6123
6176
  };
6124
6177
 
6125
- // src/apis/integrations/text/platform/workflows/_contracts/dtos/workflows.ts
6178
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflows.ts
6126
6179
  var WorkflowDefinitionTaskType = {
6127
6180
  http: "HTTP",
6128
6181
  switch: "SWITCH",
@@ -6337,15 +6390,11 @@ var textLivechatEventsZods = {
6337
6390
  }),
6338
6391
  chatMessage: import_zod3.z.object({
6339
6392
  name: import_zod3.z.literal("chat_message" /* ChatMessage */),
6340
- params: import_zod3.z.object({
6341
- filter: import_zod3.z.string().optional()
6342
- }).optional()
6393
+ filter: import_zod3.z.string().optional()
6343
6394
  }),
6344
6395
  userAddedToChat: import_zod3.z.object({
6345
6396
  name: import_zod3.z.literal("user_added_to_chat" /* UserAddedToChat */),
6346
- params: import_zod3.z.object({
6347
- userType: import_zod3.z.enum(["agent", "customer"]).optional()
6348
- }).optional()
6397
+ userType: import_zod3.z.enum(["agent", "customer"]).optional()
6349
6398
  }),
6350
6399
  userRemovedFromChat: import_zod3.z.object({
6351
6400
  name: import_zod3.z.literal("user_removed_from_chat" /* UserRemovedFromChat */)
package/dist/index.mjs CHANGED
@@ -1318,15 +1318,17 @@ import axios6 from "axios";
1318
1318
  var textClientInstance = axios6.create({
1319
1319
  baseURL: "https://api.labs.text.com"
1320
1320
  });
1321
- function getTextClientAuthorization(req) {
1321
+ function getTextClientAuthorization(req, usePlatformToken = true) {
1322
1322
  if (req.headers instanceof Headers) {
1323
1323
  return {
1324
- token: req.headers.get("x-adapter-text-token"),
1324
+ token: req.headers.get(
1325
+ usePlatformToken ? "x-adapter-platform-token" : "x-adapter-text-token"
1326
+ ),
1325
1327
  tokenType: "Bearer"
1326
1328
  };
1327
1329
  }
1328
1330
  return {
1329
- token: req.headers["x-adapter-text-token"],
1331
+ token: req.headers[usePlatformToken ? "x-adapter-platform-token" : "x-adapter-text-token"],
1330
1332
  tokenType: "Bearer"
1331
1333
  };
1332
1334
  }
@@ -1717,7 +1719,52 @@ var textPlatformDashboardApi = {
1717
1719
  }
1718
1720
  };
1719
1721
 
1720
- // src/apis/integrations/text/platform/workflows/api.ts
1722
+ // src/apis/integrations/text/platform/workflow/credentials/api.ts
1723
+ var textPlatformWorkflowsCredentialsApi = {
1724
+ get(name, authorization) {
1725
+ return __async(this, null, function* () {
1726
+ return textClientInstance.get(
1727
+ `/workflow_platform/credentials/${name}`,
1728
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1729
+ ensureAuthorizationToken: true
1730
+ }))
1731
+ );
1732
+ });
1733
+ },
1734
+ getList(authorization) {
1735
+ return __async(this, null, function* () {
1736
+ return textClientInstance.get(
1737
+ `/workflow_platform/credentials`,
1738
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1739
+ ensureAuthorizationToken: true
1740
+ }))
1741
+ );
1742
+ });
1743
+ },
1744
+ create(payload, authorization) {
1745
+ return __async(this, null, function* () {
1746
+ yield textClientInstance.post(
1747
+ `/workflow_platform/credentials`,
1748
+ payload,
1749
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1750
+ ensureAuthorizationToken: true
1751
+ }))
1752
+ );
1753
+ });
1754
+ },
1755
+ delete(name, authorization) {
1756
+ return __async(this, null, function* () {
1757
+ yield textClientInstance.delete(
1758
+ `/workflow_platform/credentials/${name}`,
1759
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1760
+ ensureAuthorizationToken: true
1761
+ }))
1762
+ );
1763
+ });
1764
+ }
1765
+ };
1766
+
1767
+ // src/apis/integrations/text/platform/workflow/workflows/api.ts
1721
1768
  var textPlatformWorkflowsApi = {
1722
1769
  getWorkflows(authorization) {
1723
1770
  return __async(this, null, function* () {
@@ -1810,10 +1857,16 @@ var textPlatformWorkflowsApi = {
1810
1857
  }
1811
1858
  };
1812
1859
 
1860
+ // src/apis/integrations/text/platform/workflow/api.ts
1861
+ var textPlatformWorkflowApi = {
1862
+ workflows: textPlatformWorkflowsApi,
1863
+ credentials: textPlatformWorkflowsCredentialsApi
1864
+ };
1865
+
1813
1866
  // src/apis/integrations/text/platform/api.ts
1814
1867
  var textPlatformApi = {
1815
1868
  dashboard: textPlatformDashboardApi,
1816
- workflows: textPlatformWorkflowsApi
1869
+ workflow: textPlatformWorkflowApi
1817
1870
  };
1818
1871
 
1819
1872
  // src/apis/integrations/text/api.ts
@@ -5992,7 +6045,7 @@ var platformAdapterAppApi = {
5992
6045
  }
5993
6046
  };
5994
6047
 
5995
- // src/apis/integrations/text/platform/workflows/_contracts/dtos/workflows.ts
6048
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflows.ts
5996
6049
  var WorkflowDefinitionTaskType = {
5997
6050
  http: "HTTP",
5998
6051
  switch: "SWITCH",
@@ -6207,15 +6260,11 @@ var textLivechatEventsZods = {
6207
6260
  }),
6208
6261
  chatMessage: z3.object({
6209
6262
  name: z3.literal("chat_message" /* ChatMessage */),
6210
- params: z3.object({
6211
- filter: z3.string().optional()
6212
- }).optional()
6263
+ filter: z3.string().optional()
6213
6264
  }),
6214
6265
  userAddedToChat: z3.object({
6215
6266
  name: z3.literal("user_added_to_chat" /* UserAddedToChat */),
6216
- params: z3.object({
6217
- userType: z3.enum(["agent", "customer"]).optional()
6218
- }).optional()
6267
+ userType: z3.enum(["agent", "customer"]).optional()
6219
6268
  }),
6220
6269
  userRemovedFromChat: z3.object({
6221
6270
  name: z3.literal("user_removed_from_chat" /* UserRemovedFromChat */)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",