@livechat/developer-studio-api 3.0.8 → 3.0.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/index.mjs CHANGED
@@ -65,6 +65,9 @@ var UnauthorizeApiError = class extends Error {
65
65
  this.kind = "unauthorized";
66
66
  this.code = 401;
67
67
  }
68
+ withCustomMessage(_message) {
69
+ return this;
70
+ }
68
71
  };
69
72
 
70
73
  // src/apis/integrations/github/instance.ts
@@ -531,6 +534,9 @@ var gitHubApi = {
531
534
  }
532
535
  };
533
536
 
537
+ // src/apis/integrations/netlify/account/api.ts
538
+ import { AxiosError as AxiosError2 } from "axios";
539
+
534
540
  // src/apis/integrations/netlify/instance.ts
535
541
  import axios3 from "axios";
536
542
  var netlifyClientInstance = axios3.create({
@@ -603,7 +609,7 @@ var netlifyAccountApi = {
603
609
  targetAccountId = yield this.getAccount(authorization);
604
610
  }
605
611
  if (!targetAccountId) {
606
- throw new Error("No account");
612
+ throw new AxiosError2("No account", "404");
607
613
  }
608
614
  const { data: envs } = yield netlifyClientInstance.get(
609
615
  `/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
@@ -621,7 +627,7 @@ var netlifyAccountApi = {
621
627
  targetAccountId = yield this.getAccount(authorization);
622
628
  }
623
629
  if (!targetAccountId) {
624
- throw new Error("No account");
630
+ throw new AxiosError2("No account", "404");
625
631
  }
626
632
  const { data: envs } = yield netlifyClientInstance.get(
627
633
  `/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
@@ -640,7 +646,7 @@ var netlifyAccountApi = {
640
646
  targetAccountId = yield this.getAccount(authorization);
641
647
  }
642
648
  if (!targetAccountId) {
643
- throw new Error("No account");
649
+ throw new AxiosError2("No account", "404");
644
650
  }
645
651
  if (!targetEnvs) {
646
652
  const response = yield netlifyClientInstance.get(
@@ -688,7 +694,7 @@ var netlifyAccountApi = {
688
694
  targetAccountId = yield this.getAccount(authorization);
689
695
  }
690
696
  if (!accountId) {
691
- throw new Error("No account");
697
+ throw new AxiosError2("No account", "404");
692
698
  }
693
699
  yield netlifyClientInstance.delete(
694
700
  `/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
@@ -3448,21 +3454,19 @@ var getAppAutoReviewPayload = (value) => {
3448
3454
  var platformDpsApplicationAutoReviewApi = {
3449
3455
  getAutoReview(appId, authorization) {
3450
3456
  return __async(this, null, function* () {
3451
- try {
3452
- const response = yield platformDpsClientInstance.get(
3453
- `/v2/applications/${appId}/auto-review`,
3454
- getPlatformDpsClientConfig(authorization)
3455
- );
3456
- if (response.status === 204) {
3457
+ return platformDpsClientInstance.get(
3458
+ `/v2/applications/${appId}/auto-review`,
3459
+ getPlatformDpsClientConfig(authorization)
3460
+ ).then(({ status, data }) => {
3461
+ if (status === 204) {
3457
3462
  return getEmptyAppAutoReview();
3458
3463
  }
3459
- return response.data;
3460
- } catch (error) {
3461
- if (error instanceof Error) {
3462
- throw new Error(`The review couldn\u2019t be completed. [${error.message}]`);
3463
- }
3464
- throw error;
3465
- }
3464
+ return data;
3465
+ }).catch((error) => {
3466
+ throw error.withCustomMessage(
3467
+ `The review couldn\u2019t be completed. [${error.message}]`
3468
+ );
3469
+ });
3466
3470
  });
3467
3471
  },
3468
3472
  submitAutoReview(appId, payload, authorization) {
@@ -4187,99 +4191,74 @@ var platformDpsApplicationApi = {
4187
4191
  },
4188
4192
  createApp(payload, authorization) {
4189
4193
  return __async(this, null, function* () {
4190
- try {
4191
- const response = yield platformDpsClientInstance.post(
4192
- `/v2/applications`,
4193
- payload,
4194
- getPlatformDpsClientConfig(authorization)
4194
+ return platformDpsClientInstance.post(
4195
+ `/v2/applications`,
4196
+ payload,
4197
+ getPlatformDpsClientConfig(authorization)
4198
+ ).then(({ data }) => data).catch((error) => {
4199
+ throw error.withCustomMessage(
4200
+ `App couldn't be created. [${error.message}]`
4195
4201
  );
4196
- return response.data;
4197
- } catch (error) {
4198
- if (error instanceof Error) {
4199
- throw new Error(`App couldn't be created. [${error.message}]`);
4200
- }
4201
- throw error;
4202
- }
4202
+ });
4203
4203
  });
4204
4204
  },
4205
4205
  fork(appId, authorization) {
4206
4206
  return __async(this, null, function* () {
4207
- try {
4208
- return yield platformDpsClientInstance.post(
4209
- `/v2/applications/${appId}/fork`,
4210
- {},
4211
- getPlatformDpsClientConfig(authorization)
4207
+ return platformDpsClientInstance.post(
4208
+ `/v2/applications/${appId}/fork`,
4209
+ {},
4210
+ getPlatformDpsClientConfig(authorization)
4211
+ ).catch((error) => {
4212
+ throw error.withCustomMessage(
4213
+ `App couldn't be forked. [${error.message}]`
4212
4214
  );
4213
- } catch (error) {
4214
- if (error instanceof Error) {
4215
- throw new Error(`App couldn't be forked. [${error.message}]`);
4216
- }
4217
- throw error;
4218
- }
4215
+ });
4219
4216
  });
4220
4217
  },
4221
4218
  publish(appId, authorization) {
4222
4219
  return __async(this, null, function* () {
4223
- try {
4224
- return yield platformDpsClientInstance.put(
4225
- `/v2/applications/${appId}/publish`,
4226
- {},
4227
- getPlatformDpsClientConfig(authorization)
4220
+ return platformDpsClientInstance.put(
4221
+ `/v2/applications/${appId}/publish`,
4222
+ {},
4223
+ getPlatformDpsClientConfig(authorization)
4224
+ ).catch((error) => {
4225
+ throw error.withCustomMessage(
4226
+ `App couldn't be published. [${error.message}]`
4228
4227
  );
4229
- } catch (error) {
4230
- if (error instanceof Error) {
4231
- throw new Error(`App couldn't be published. [${error.message}]`);
4232
- }
4233
- throw error;
4234
- }
4228
+ });
4235
4229
  });
4236
4230
  },
4237
4231
  updateQL(appId) {
4238
4232
  return __async(this, null, function* () {
4239
- try {
4240
- yield platformDpsClientInstance.patch(
4241
- `/v2/applications/${appId}/qualified-lead`
4233
+ yield platformDpsClientInstance.patch(`/v2/applications/${appId}/qualified-lead`).catch((error) => {
4234
+ throw error.withCustomMessage(
4235
+ `QL couldn't be updated. [${error.message}]`
4242
4236
  );
4243
- } catch (error) {
4244
- if (error instanceof Error) {
4245
- throw new Error(`QL couldn't be updated. [${error.message}]`);
4246
- }
4247
- throw error;
4248
- }
4237
+ });
4249
4238
  });
4250
4239
  },
4251
4240
  deleteApp(appId, authorization) {
4252
4241
  return __async(this, null, function* () {
4253
- try {
4254
- yield platformDpsClientInstance.delete(
4255
- `/v2/applications/${appId}`,
4256
- getPlatformDpsClientConfig(authorization)
4242
+ yield platformDpsClientInstance.delete(
4243
+ `/v2/applications/${appId}`,
4244
+ getPlatformDpsClientConfig(authorization)
4245
+ ).catch((error) => {
4246
+ throw error.withCustomMessage(
4247
+ `App couldn't be created. [${error.message}]`
4257
4248
  );
4258
- } catch (error) {
4259
- if (error instanceof Error) {
4260
- throw new Error(`App couldn't be created. [${error.message}]`);
4261
- }
4262
- throw error;
4263
- }
4249
+ });
4264
4250
  });
4265
4251
  },
4266
4252
  createAiContent(appId, appName, appSummary) {
4267
4253
  return __async(this, null, function* () {
4268
- try {
4269
- const response = yield platformDpsClientInstance.post(
4270
- `/v2/ai/application/${appId}/content`,
4271
- {
4272
- name: appName,
4273
- summary: appSummary
4274
- }
4254
+ return platformDpsClientInstance.post(`/v2/ai/application/${appId}/content`, {
4255
+ name: appName,
4256
+ summary: appSummary
4257
+ }).catch((error) => {
4258
+ throw error.withCustomMessage(
4259
+ `AI content couldn't be created. [${error.message}]`
4275
4260
  );
4276
- return response;
4277
- } catch (error) {
4278
- if (error instanceof Error) {
4279
- throw new Error(`AI content couldn't be created. [${error.message}]`);
4280
- }
4281
- throw error;
4282
- }
4261
+ });
4283
4262
  });
4284
4263
  }
4285
4264
  };
@@ -4314,43 +4293,35 @@ var platformDpsApplicationsPurchasesApi = {
4314
4293
  },
4315
4294
  getSummaryPurchases(apps, options, authorization) {
4316
4295
  return __async(this, null, function* () {
4317
- try {
4318
- const { from, to, duration } = options;
4319
- const clientIds = apps.map((app) => app.clientId);
4320
- const params = `applications=${clientIds.join(",")}${from ? `&from=${from}` : ""}${to ? `&to=${to}` : ""}&duration=${duration}&by=supplier`;
4321
- const response = yield platformDpsClientInstance.get(
4322
- `/v2/applications/purchases?${params}`,
4323
- getPlatformDpsClientConfig(authorization)
4296
+ const { from, to, duration } = options;
4297
+ const clientIds = apps.map((app) => app.clientId);
4298
+ const params = `applications=${clientIds.join(",")}${from ? `&from=${from}` : ""}${to ? `&to=${to}` : ""}&duration=${duration}&by=supplier`;
4299
+ return platformDpsClientInstance.get(
4300
+ `/v2/applications/purchases?${params}`,
4301
+ getPlatformDpsClientConfig(authorization)
4302
+ ).then(({ data }) => {
4303
+ return [{ data, appId: "All apps" }];
4304
+ }).catch((error) => {
4305
+ throw error.withCustomMessage(
4306
+ `App summary purchases couldn't be fetched. [${error.message}]`
4324
4307
  );
4325
- return [{ data: response.data, appId: "All apps" }];
4326
- } catch (error) {
4327
- if (error instanceof Error) {
4328
- throw new Error(
4329
- `App summary purchases couldn't be fetched. [${error.message}]`
4330
- );
4331
- }
4332
- throw error;
4333
- }
4308
+ });
4334
4309
  });
4335
4310
  },
4336
4311
  getSummaryPurchasesHistory(apps, options, authorization) {
4337
4312
  return __async(this, null, function* () {
4338
- try {
4339
- const { from, to, duration } = options;
4340
- const params = `applications=${apps.join(",")}${from ? `&from=${from}` : ""}${to ? `&to=${to}` : ""}&duration=${duration}`;
4341
- const response = yield platformDpsClientInstance.get(
4342
- `/v2/applications/purchases/history?${params}`,
4343
- getPlatformDpsClientConfig(authorization)
4313
+ const { from, to, duration } = options;
4314
+ const params = `applications=${apps.join(",")}${from ? `&from=${from}` : ""}${to ? `&to=${to}` : ""}&duration=${duration}`;
4315
+ return platformDpsClientInstance.get(
4316
+ `/v2/applications/purchases/history?${params}`,
4317
+ getPlatformDpsClientConfig(authorization)
4318
+ ).then(({ data }) => {
4319
+ return [{ data, appId: "All apps" }];
4320
+ }).catch((error) => {
4321
+ throw error.withCustomMessage(
4322
+ `App summary purchases history couldn't be fetched. [${error.message}]`
4344
4323
  );
4345
- return [{ data: response.data, appId: "All apps" }];
4346
- } catch (error) {
4347
- if (error instanceof Error) {
4348
- throw new Error(
4349
- `App summary purchases history couldn't be fetched. [${error.message}]`
4350
- );
4351
- }
4352
- throw error;
4353
- }
4324
+ });
4354
4325
  });
4355
4326
  }
4356
4327
  };
@@ -4391,16 +4362,12 @@ var platformDpsApplicationsApi = {
4391
4362
  purchases: platformDpsApplicationsPurchasesApi,
4392
4363
  getApps() {
4393
4364
  return __async(this, arguments, function* ({ filter = "licensed" } = {}) {
4394
- try {
4395
- const params = `filter=${filter}`;
4396
- const response = yield platformDpsClientInstance.get(`/v2/applications?${params}`);
4397
- return response.data;
4398
- } catch (error) {
4399
- if (error instanceof Error) {
4400
- throw new Error(`Apps couldn't be fetched. [${error.message}]`);
4401
- }
4402
- throw error;
4403
- }
4365
+ const params = `filter=${filter}`;
4366
+ return platformDpsClientInstance.get(`/v2/applications?${params}`).then(({ data }) => data).catch((error) => {
4367
+ throw error.withCustomMessage(
4368
+ `Apps couldn't be fetched. [${error.message}]`
4369
+ );
4370
+ });
4404
4371
  });
4405
4372
  }
4406
4373
  };
@@ -4409,18 +4376,14 @@ var platformDpsApplicationsApi = {
4409
4376
  var platformDpsCategoriesApi = {
4410
4377
  getCategories(authorization) {
4411
4378
  return __async(this, null, function* () {
4412
- try {
4413
- const response = yield platformDpsClientInstance.get(
4414
- `/v2/categories`,
4415
- getPlatformDpsClientConfig(authorization)
4379
+ return platformDpsClientInstance.get(
4380
+ `/v2/categories`,
4381
+ getPlatformDpsClientConfig(authorization)
4382
+ ).then(({ data }) => data).catch((error) => {
4383
+ throw error.withCustomMessage(
4384
+ `Categories couldn't be fetched. [${error.message}]`
4416
4385
  );
4417
- return response.data;
4418
- } catch (error) {
4419
- if (error instanceof Error) {
4420
- throw new Error(`Categories couldn't be fetched. [${error.message}]`);
4421
- }
4422
- throw error;
4423
- }
4386
+ });
4424
4387
  });
4425
4388
  }
4426
4389
  };
@@ -4429,32 +4392,28 @@ var platformDpsCategoriesApi = {
4429
4392
  var platformDpsDeveloperApi = {
4430
4393
  getLedger(userId, options, authorization) {
4431
4394
  return __async(this, null, function* () {
4432
- try {
4433
- const { startAt, endAt, size, page } = options;
4434
- const withRange = Boolean(startAt && endAt);
4435
- const withPagination = Boolean(size && typeof page === "number");
4436
- let params = withRange || withPagination ? `?` : "";
4395
+ const { startAt, endAt, size, page } = options;
4396
+ const withRange = Boolean(startAt && endAt);
4397
+ const withPagination = Boolean(size && typeof page === "number");
4398
+ let params = withRange || withPagination ? `?` : "";
4399
+ if (withRange) {
4400
+ params += `from=${startAt}&to=${endAt}`;
4401
+ }
4402
+ if (withPagination) {
4437
4403
  if (withRange) {
4438
- params += `from=${startAt}&to=${endAt}`;
4439
- }
4440
- if (withPagination) {
4441
- if (withRange) {
4442
- params += `&size=${size}&page=${page}`;
4443
- } else {
4444
- params += `size=${size}&page=${page}`;
4445
- }
4446
- }
4447
- const response = yield platformDpsClientInstance.get(
4448
- `/v2/developers/${userId}/account/ledger${params}`,
4449
- getPlatformDpsClientConfig(authorization)
4450
- );
4451
- return response.data;
4452
- } catch (error) {
4453
- if (error instanceof Error) {
4454
- throw new Error(`Ledger couldn't be fetched. [${error.message}]`);
4404
+ params += `&size=${size}&page=${page}`;
4405
+ } else {
4406
+ params += `size=${size}&page=${page}`;
4455
4407
  }
4456
- throw error;
4457
4408
  }
4409
+ return platformDpsClientInstance.get(
4410
+ `/v2/developers/${userId}/account/ledger${params}`,
4411
+ getPlatformDpsClientConfig(authorization)
4412
+ ).then(({ data }) => data).catch((error) => {
4413
+ throw error.withCustomMessage(
4414
+ `Ledger couldn't be fetched. [${error.message}]`
4415
+ );
4416
+ });
4458
4417
  });
4459
4418
  },
4460
4419
  requestWithdrawal(_0, _1) {
@@ -4463,19 +4422,15 @@ var platformDpsDeveloperApi = {
4463
4422
  note,
4464
4423
  userId
4465
4424
  }, authorization) {
4466
- try {
4467
- const response = yield platformDpsClientInstance.patch(
4468
- `/v2/developers/${userId}/account/withdrawal/request`,
4469
- { amount, note },
4470
- getPlatformDpsClientConfig(authorization)
4425
+ return platformDpsClientInstance.patch(
4426
+ `/v2/developers/${userId}/account/withdrawal/request`,
4427
+ { amount, note },
4428
+ getPlatformDpsClientConfig(authorization)
4429
+ ).then(({ data }) => data).catch((error) => {
4430
+ throw error.withCustomMessage(
4431
+ `Withdrawal couldn't be requested. [${error.message}]`
4471
4432
  );
4472
- return response.data;
4473
- } catch (error) {
4474
- if (error instanceof Error) {
4475
- throw new Error(`Withdrawal couldn't be requested. [${error.message}]`);
4476
- }
4477
- throw error;
4478
- }
4433
+ });
4479
4434
  });
4480
4435
  }
4481
4436
  };
@@ -4489,18 +4444,15 @@ var platformDpsDevelopersApi = {
4489
4444
  var platformDpsLinksApi = {
4490
4445
  updateShortcuts(links, authorization) {
4491
4446
  return __async(this, null, function* () {
4492
- try {
4493
- yield platformDpsClientInstance.put(
4494
- `/v2/links`,
4495
- links,
4496
- getPlatformDpsClientConfig(authorization)
4447
+ yield platformDpsClientInstance.put(
4448
+ `/v2/links`,
4449
+ links,
4450
+ getPlatformDpsClientConfig(authorization)
4451
+ ).catch((error) => {
4452
+ throw error.withCustomMessage(
4453
+ `Shortcuts couldn't be updated. [${error.message}]`
4497
4454
  );
4498
- } catch (error) {
4499
- if (error instanceof Error) {
4500
- throw new Error(`Shortcuts couldn't be updated. [${error.message}]`);
4501
- }
4502
- throw error;
4503
- }
4455
+ });
4504
4456
  });
4505
4457
  }
4506
4458
  };
@@ -4509,56 +4461,38 @@ var platformDpsLinksApi = {
4509
4461
  var dpsResearchCustomerApi = {
4510
4462
  getResearchCustomersLicenses(authorization) {
4511
4463
  return __async(this, null, function* () {
4512
- try {
4513
- const response = yield platformDpsClientInstance.get(
4514
- `/v2/research/customers/licenses`,
4515
- getPlatformDpsClientConfig(authorization)
4464
+ return platformDpsClientInstance.get(
4465
+ `/v2/research/customers/licenses`,
4466
+ getPlatformDpsClientConfig(authorization)
4467
+ ).then(({ data }) => data).catch((error) => {
4468
+ throw error.withCustomMessage(
4469
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4516
4470
  );
4517
- return response.data;
4518
- } catch (error) {
4519
- if (error instanceof Error) {
4520
- throw new Error(
4521
- `We couldn't fetch the research toolkit data. [${error.message}]`
4522
- );
4523
- }
4524
- throw error;
4525
- }
4471
+ });
4526
4472
  });
4527
4473
  },
4528
4474
  getResearchCustomersBusiness(authorization) {
4529
4475
  return __async(this, null, function* () {
4530
- try {
4531
- const response = yield platformDpsClientInstance.get(
4532
- `/v2/research/customers/business`,
4533
- getPlatformDpsClientConfig(authorization)
4476
+ return platformDpsClientInstance.get(
4477
+ `/v2/research/customers/business`,
4478
+ getPlatformDpsClientConfig(authorization)
4479
+ ).then(({ data }) => data).catch((error) => {
4480
+ throw error.withCustomMessage(
4481
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4534
4482
  );
4535
- return response.data;
4536
- } catch (error) {
4537
- if (error instanceof Error) {
4538
- throw new Error(
4539
- `We couldn't fetch the research toolkit data. [${error.message}]`
4540
- );
4541
- }
4542
- throw error;
4543
- }
4483
+ });
4544
4484
  });
4545
4485
  },
4546
4486
  getResearchCustomersLocation(authorization) {
4547
4487
  return __async(this, null, function* () {
4548
- try {
4549
- const response = yield platformDpsClientInstance.get(
4550
- `/v2/research/customers/location`,
4551
- getPlatformDpsClientConfig(authorization)
4488
+ return platformDpsClientInstance.get(
4489
+ `/v2/research/customers/location`,
4490
+ getPlatformDpsClientConfig(authorization)
4491
+ ).then(({ data }) => data).catch((error) => {
4492
+ throw error.withCustomMessage(
4493
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4552
4494
  );
4553
- return response.data;
4554
- } catch (error) {
4555
- if (error instanceof Error) {
4556
- throw new Error(
4557
- `We couldn't fetch the research toolkit data. [${error.message}]`
4558
- );
4559
- }
4560
- throw error;
4561
- }
4495
+ });
4562
4496
  });
4563
4497
  }
4564
4498
  };
@@ -4567,21 +4501,15 @@ var dpsResearchCustomerApi = {
4567
4501
  var dpsResearchDictionaryApi = {
4568
4502
  getResearchDictionary() {
4569
4503
  return __async(this, arguments, function* (options = {}, authorization) {
4570
- try {
4571
- const params = new URLSearchParams(options);
4572
- const response = yield platformDpsClientInstance.get(
4573
- `/v2/research/dictionary?${params.toString()}`,
4574
- getPlatformDpsClientConfig(authorization)
4504
+ const params = new URLSearchParams(options);
4505
+ return platformDpsClientInstance.get(
4506
+ `/v2/research/dictionary?${params.toString()}`,
4507
+ getPlatformDpsClientConfig(authorization)
4508
+ ).then(({ data }) => data).catch((error) => {
4509
+ throw error.withCustomMessage(
4510
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4575
4511
  );
4576
- return response.data;
4577
- } catch (error) {
4578
- if (error instanceof Error) {
4579
- throw new Error(
4580
- `We couldn't fetch the research toolkit data. [${error.message}]`
4581
- );
4582
- }
4583
- throw error;
4584
- }
4512
+ });
4585
4513
  });
4586
4514
  }
4587
4515
  };
@@ -4590,40 +4518,28 @@ var dpsResearchDictionaryApi = {
4590
4518
  var dpsResearchMarketplaceApi = {
4591
4519
  getResearchMarketplaceApps() {
4592
4520
  return __async(this, arguments, function* (options = {}, authorization) {
4593
- try {
4594
- const params = new URLSearchParams(options);
4595
- const response = yield platformDpsClientInstance.get(
4596
- `/v2/research/marketplace/apps?${params.toString()}`,
4597
- getPlatformDpsClientConfig(authorization)
4521
+ const params = new URLSearchParams(options);
4522
+ return platformDpsClientInstance.get(
4523
+ `/v2/research/marketplace/apps?${params.toString()}`,
4524
+ getPlatformDpsClientConfig(authorization)
4525
+ ).then(({ data }) => data).catch((error) => {
4526
+ throw error.withCustomMessage(
4527
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4598
4528
  );
4599
- return response.data;
4600
- } catch (error) {
4601
- if (error instanceof Error) {
4602
- throw new Error(
4603
- `We couldn't fetch the research toolkit data. [${error.message}]`
4604
- );
4605
- }
4606
- throw error;
4607
- }
4529
+ });
4608
4530
  });
4609
4531
  },
4610
4532
  getResearchMarketplaceViews() {
4611
4533
  return __async(this, arguments, function* (options = {}, authorization) {
4612
- try {
4613
- const params = new URLSearchParams(options);
4614
- const response = yield platformDpsClientInstance.get(
4615
- `/v2/research/marketplace/views?${params.toString()}`,
4616
- getPlatformDpsClientConfig(authorization)
4534
+ const params = new URLSearchParams(options);
4535
+ return platformDpsClientInstance.get(
4536
+ `/v2/research/marketplace/views?${params.toString()}`,
4537
+ getPlatformDpsClientConfig(authorization)
4538
+ ).then(({ data }) => data).catch((error) => {
4539
+ throw error.withCustomMessage(
4540
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4617
4541
  );
4618
- return response.data;
4619
- } catch (error) {
4620
- if (error instanceof Error) {
4621
- throw new Error(
4622
- `We couldn't fetch the research toolkit data. [${error.message}]`
4623
- );
4624
- }
4625
- throw error;
4626
- }
4542
+ });
4627
4543
  });
4628
4544
  }
4629
4545
  };
@@ -4632,40 +4548,28 @@ var dpsResearchMarketplaceApi = {
4632
4548
  var dpsResearchTrafficApi = {
4633
4549
  getResearchTrafficAgents() {
4634
4550
  return __async(this, arguments, function* (options = {}, authorization) {
4635
- try {
4636
- const params = new URLSearchParams(options);
4637
- const response = yield platformDpsClientInstance.get(
4638
- `/v2/research/traffic/agents?${params.toString()}`,
4639
- getPlatformDpsClientConfig(authorization)
4551
+ const params = new URLSearchParams(options);
4552
+ return platformDpsClientInstance.get(
4553
+ `/v2/research/traffic/agents?${params.toString()}`,
4554
+ getPlatformDpsClientConfig(authorization)
4555
+ ).then(({ data }) => data).catch((error) => {
4556
+ throw error.withCustomMessage(
4557
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4640
4558
  );
4641
- return response.data;
4642
- } catch (error) {
4643
- if (error instanceof Error) {
4644
- throw new Error(
4645
- `We couldn't fetch the research toolkit data. [${error.message}]`
4646
- );
4647
- }
4648
- throw error;
4649
- }
4559
+ });
4650
4560
  });
4651
4561
  },
4652
4562
  getResearchTrafficChats() {
4653
4563
  return __async(this, arguments, function* (options = {}, authorization) {
4654
- try {
4655
- const params = new URLSearchParams(options);
4656
- const response = yield platformDpsClientInstance.get(
4657
- `/v2/research/traffic/chats?${params.toString()}`,
4658
- getPlatformDpsClientConfig(authorization)
4564
+ const params = new URLSearchParams(options);
4565
+ return platformDpsClientInstance.get(
4566
+ `/v2/research/traffic/chats?${params.toString()}`,
4567
+ getPlatformDpsClientConfig(authorization)
4568
+ ).then(({ data }) => data).catch((error) => {
4569
+ throw error.withCustomMessage(
4570
+ `We couldn't fetch the research toolkit data. [${error.message}]`
4659
4571
  );
4660
- return response.data;
4661
- } catch (error) {
4662
- if (error instanceof Error) {
4663
- throw new Error(
4664
- `We couldn't fetch the research toolkit data. [${error.message}]`
4665
- );
4666
- }
4667
- throw error;
4668
- }
4572
+ });
4669
4573
  });
4670
4574
  }
4671
4575
  };
@@ -5633,6 +5537,28 @@ function initApi(config, tokens) {
5633
5537
  initPlanetScaleClientInstance((_w = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _w.token);
5634
5538
  api.isInitialized = true;
5635
5539
  }
5540
+
5541
+ // ../../private/utils/src/serializers/base64.ts
5542
+ var serializerBase64 = {
5543
+ serialize(state) {
5544
+ return btoa(escape(JSON.stringify(state)));
5545
+ },
5546
+ deserialize(message) {
5547
+ try {
5548
+ return message ? JSON.parse(unescape(atob(unescape(message)))) : void 0;
5549
+ } catch (e) {
5550
+ }
5551
+ }
5552
+ };
5553
+
5554
+ // src/utils/integrations/getIntegrationFlowUrl.ts
5555
+ function getIntegrationFlowUrl(provider, flow, data, context, config) {
5556
+ const serializedFlowState = serializerBase64.serialize(data);
5557
+ const serializedContext = serializerBase64.serialize(__spreadProps(__spreadValues({}, context), {
5558
+ state: serializedFlowState
5559
+ }));
5560
+ return `${config.adapterUrl}/integrations/${provider}/flow?flow=${flow}&context=${serializedContext}`;
5561
+ }
5636
5562
  export {
5637
5563
  API_NOTIFICATIONS,
5638
5564
  AccountsApiError,
@@ -5651,6 +5577,7 @@ export {
5651
5577
  getEmptyAppAutoReview,
5652
5578
  getGitHubClientAuthorization,
5653
5579
  getGithubClientRequestConfig,
5580
+ getIntegrationFlowUrl,
5654
5581
  getLiveChatClientAuthorization,
5655
5582
  getLiveChatClientConfig,
5656
5583
  getNeonClientAuthorization,