@livechat/developer-studio-api 3.3.9 → 3.3.11

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.d.mts CHANGED
@@ -2068,8 +2068,6 @@ declare enum IntegrationModes {
2068
2068
  Modal = "modal"
2069
2069
  }
2070
2070
  type IntegrationFlowContext = {
2071
- userId: string;
2072
- userToken: string;
2073
2071
  state: string;
2074
2072
  } & ({
2075
2073
  mode: IntegrationModes.Modal;
@@ -6600,8 +6598,8 @@ declare const api: {
6600
6598
  id: string;
6601
6599
  title: string;
6602
6600
  }[]>;
6603
- createSiteByInstallationId(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, installationId: string, branch?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6604
- createSiteByDeployKey(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, deployKeyId: string, branch?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6601
+ createSiteByInstallationId(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, installationId: string, branch?: string | undefined, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6602
+ createSiteByDeployKey(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, deployKeyId: string, branch?: string | undefined, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6605
6603
  removeSite(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6606
6604
  triggerSiteBuild(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6607
6605
  addGitHubInstallationToSite(siteId: string, installationId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
@@ -6610,7 +6608,7 @@ declare const api: {
6610
6608
  createDeployKey(authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifyDeployKey>;
6611
6609
  };
6612
6610
  hook: {
6613
- addBuildHooks(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6611
+ addBuildHooks(siteId: string, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6614
6612
  };
6615
6613
  getToken(code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
6616
6614
  token: string;
@@ -6977,10 +6975,6 @@ declare function getIntegrationFlowUrl<TFlowContext, TFlowResult, TState>(name:
6977
6975
  } | {
6978
6976
  mode: IntegrationModes.Modal;
6979
6977
  }, context: TFlowContext, state: TState | string, config: {
6980
- user: {
6981
- id: string;
6982
- token: string;
6983
- };
6984
6978
  urls: {
6985
6979
  adapterUrl: string;
6986
6980
  };
package/dist/index.d.ts CHANGED
@@ -2068,8 +2068,6 @@ declare enum IntegrationModes {
2068
2068
  Modal = "modal"
2069
2069
  }
2070
2070
  type IntegrationFlowContext = {
2071
- userId: string;
2072
- userToken: string;
2073
2071
  state: string;
2074
2072
  } & ({
2075
2073
  mode: IntegrationModes.Modal;
@@ -6600,8 +6598,8 @@ declare const api: {
6600
6598
  id: string;
6601
6599
  title: string;
6602
6600
  }[]>;
6603
- createSiteByInstallationId(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, installationId: string, branch?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6604
- createSiteByDeployKey(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, deployKeyId: string, branch?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6601
+ createSiteByInstallationId(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, installationId: string, branch?: string | undefined, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6602
+ createSiteByDeployKey(name: string, repositoryFullName: string, target: AppRepositoryTarget | undefined, deployKeyId: string, branch?: string | undefined, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifySite>;
6605
6603
  removeSite(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6606
6604
  triggerSiteBuild(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6607
6605
  addGitHubInstallationToSite(siteId: string, installationId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
@@ -6610,7 +6608,7 @@ declare const api: {
6610
6608
  createDeployKey(authorization?: NetlifyClientAuthorization | undefined): Promise<NetlifyDeployKey>;
6611
6609
  };
6612
6610
  hook: {
6613
- addBuildHooks(siteId: string, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6611
+ addBuildHooks(siteId: string, adapterUrl?: string | undefined, authorization?: NetlifyClientAuthorization | undefined): Promise<void>;
6614
6612
  };
6615
6613
  getToken(code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
6616
6614
  token: string;
@@ -6977,10 +6975,6 @@ declare function getIntegrationFlowUrl<TFlowContext, TFlowResult, TState>(name:
6977
6975
  } | {
6978
6976
  mode: IntegrationModes.Modal;
6979
6977
  }, context: TFlowContext, state: TState | string, config: {
6980
- user: {
6981
- id: string;
6982
- token: string;
6983
- };
6984
6978
  urls: {
6985
6979
  adapterUrl: string;
6986
6980
  };
package/dist/index.js CHANGED
@@ -966,7 +966,7 @@ var netlifyAccountApi = {
966
966
 
967
967
  // src/apis/integrations/netlify/hook/api.ts
968
968
  var netlifyHookApi = {
969
- addBuildHooks(siteId, authorization) {
969
+ addBuildHooks(siteId, adapterUrl, authorization) {
970
970
  return __async(this, null, function* () {
971
971
  try {
972
972
  yield netlifyClientInstance.post(
@@ -976,7 +976,7 @@ var netlifyHookApi = {
976
976
  event: "deploy_created",
977
977
  type: "url",
978
978
  data: {
979
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
979
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
980
980
  }
981
981
  },
982
982
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -993,7 +993,7 @@ var netlifyHookApi = {
993
993
  event: "deploy_failed",
994
994
  type: "url",
995
995
  data: {
996
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
996
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
997
997
  }
998
998
  },
999
999
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -1010,7 +1010,7 @@ var netlifyHookApi = {
1010
1010
  event: "deploy_building",
1011
1011
  type: "url",
1012
1012
  data: {
1013
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
1013
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
1014
1014
  }
1015
1015
  },
1016
1016
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -1106,7 +1106,7 @@ var netlifySiteApi = {
1106
1106
  return snippets;
1107
1107
  });
1108
1108
  },
1109
- createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
1109
+ createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, adapterUrl, authorization) {
1110
1110
  return __async(this, null, function* () {
1111
1111
  const config = target === "nextjs" ? {
1112
1112
  plugins: ["@netlify/plugin-nextjs"],
@@ -1146,11 +1146,15 @@ var netlifySiteApi = {
1146
1146
  ensureAuthorizationToken: true
1147
1147
  }))
1148
1148
  );
1149
- yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
1149
+ yield netlifyHookApi.addBuildHooks(
1150
+ response.data.id,
1151
+ adapterUrl,
1152
+ authorization
1153
+ );
1150
1154
  return response.data;
1151
1155
  });
1152
1156
  },
1153
- createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
1157
+ createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, adapterUrl, authorization) {
1154
1158
  return __async(this, null, function* () {
1155
1159
  const config = target === "nextjs" ? {
1156
1160
  packages: [{ package: "@netlify/plugin-nextjs" }],
@@ -1187,7 +1191,11 @@ var netlifySiteApi = {
1187
1191
  ensureAuthorizationToken: true
1188
1192
  }))
1189
1193
  );
1190
- yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
1194
+ yield netlifyHookApi.addBuildHooks(
1195
+ response.data.id,
1196
+ adapterUrl,
1197
+ authorization
1198
+ );
1191
1199
  return response.data;
1192
1200
  });
1193
1201
  },
@@ -8095,11 +8103,9 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8095
8103
  return __async(this, null, function* () {
8096
8104
  const serializedState = typeof state === "string" ? state : serializerBase64.serialize(state);
8097
8105
  const serializedContext = serializerBase64.serialize(__spreadValues(__spreadValues({
8098
- state: serializedState,
8099
- userId: config.user.id,
8100
- userToken: config.user.token
8106
+ state: serializedState
8101
8107
  }, trigger), context));
8102
- const url = `${config.urls.adapterUrl}/integrations/${name}/flow?flow=${flow}&context=${serializedContext}`;
8108
+ const url = `${config.urls.adapterUrl}/integrations/${name}/flows/${flow}/flow?context=${serializedContext}`;
8103
8109
  if (trigger.mode === "modal" /* Modal */) {
8104
8110
  const newWindow = window.open(
8105
8111
  url,
@@ -8119,7 +8125,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8119
8125
  "message",
8120
8126
  (event) => {
8121
8127
  var _a;
8122
- if (((_a = event.data) == null ? void 0 : _a.type) === "adapter" && event.data.output) {
8128
+ if (((_a = event.data) == null ? void 0 : _a.type) === "internal" && event.data.output) {
8123
8129
  newWindow == null ? void 0 : newWindow.close();
8124
8130
  clearInterval(observer);
8125
8131
  resolve(event.data.output);
package/dist/index.mjs CHANGED
@@ -811,7 +811,7 @@ var netlifyAccountApi = {
811
811
 
812
812
  // src/apis/integrations/netlify/hook/api.ts
813
813
  var netlifyHookApi = {
814
- addBuildHooks(siteId, authorization) {
814
+ addBuildHooks(siteId, adapterUrl, authorization) {
815
815
  return __async(this, null, function* () {
816
816
  try {
817
817
  yield netlifyClientInstance.post(
@@ -821,7 +821,7 @@ var netlifyHookApi = {
821
821
  event: "deploy_created",
822
822
  type: "url",
823
823
  data: {
824
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
824
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
825
825
  }
826
826
  },
827
827
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -838,7 +838,7 @@ var netlifyHookApi = {
838
838
  event: "deploy_failed",
839
839
  type: "url",
840
840
  data: {
841
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
841
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
842
842
  }
843
843
  },
844
844
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -855,7 +855,7 @@ var netlifyHookApi = {
855
855
  event: "deploy_building",
856
856
  type: "url",
857
857
  data: {
858
- url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}/api/integrations/netlify/webhook`
858
+ url: `${adapterUrl}/api/integrations/netlify/webhook`
859
859
  }
860
860
  },
861
861
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -951,7 +951,7 @@ var netlifySiteApi = {
951
951
  return snippets;
952
952
  });
953
953
  },
954
- createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
954
+ createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, adapterUrl, authorization) {
955
955
  return __async(this, null, function* () {
956
956
  const config = target === "nextjs" ? {
957
957
  plugins: ["@netlify/plugin-nextjs"],
@@ -991,11 +991,15 @@ var netlifySiteApi = {
991
991
  ensureAuthorizationToken: true
992
992
  }))
993
993
  );
994
- yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
994
+ yield netlifyHookApi.addBuildHooks(
995
+ response.data.id,
996
+ adapterUrl,
997
+ authorization
998
+ );
995
999
  return response.data;
996
1000
  });
997
1001
  },
998
- createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
1002
+ createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, adapterUrl, authorization) {
999
1003
  return __async(this, null, function* () {
1000
1004
  const config = target === "nextjs" ? {
1001
1005
  packages: [{ package: "@netlify/plugin-nextjs" }],
@@ -1032,7 +1036,11 @@ var netlifySiteApi = {
1032
1036
  ensureAuthorizationToken: true
1033
1037
  }))
1034
1038
  );
1035
- yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
1039
+ yield netlifyHookApi.addBuildHooks(
1040
+ response.data.id,
1041
+ adapterUrl,
1042
+ authorization
1043
+ );
1036
1044
  return response.data;
1037
1045
  });
1038
1046
  },
@@ -7940,11 +7948,9 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7940
7948
  return __async(this, null, function* () {
7941
7949
  const serializedState = typeof state === "string" ? state : serializerBase64.serialize(state);
7942
7950
  const serializedContext = serializerBase64.serialize(__spreadValues(__spreadValues({
7943
- state: serializedState,
7944
- userId: config.user.id,
7945
- userToken: config.user.token
7951
+ state: serializedState
7946
7952
  }, trigger), context));
7947
- const url = `${config.urls.adapterUrl}/integrations/${name}/flow?flow=${flow}&context=${serializedContext}`;
7953
+ const url = `${config.urls.adapterUrl}/integrations/${name}/flows/${flow}/flow?context=${serializedContext}`;
7948
7954
  if (trigger.mode === "modal" /* Modal */) {
7949
7955
  const newWindow = window.open(
7950
7956
  url,
@@ -7964,7 +7970,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7964
7970
  "message",
7965
7971
  (event) => {
7966
7972
  var _a;
7967
- if (((_a = event.data) == null ? void 0 : _a.type) === "adapter" && event.data.output) {
7973
+ if (((_a = event.data) == null ? void 0 : _a.type) === "internal" && event.data.output) {
7968
7974
  newWindow == null ? void 0 : newWindow.close();
7969
7975
  clearInterval(observer);
7970
7976
  resolve(event.data.output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.3.9",
3
+ "version": "3.3.11",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",