@livechat/developer-studio-api 2.3.54 → 2.3.56

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
@@ -2368,444 +2368,52 @@ var vercelApi = {
2368
2368
  };
2369
2369
 
2370
2370
  // src/apis/integrations/neon/api.ts
2371
- import axios16 from "axios";
2372
-
2373
- // src/apis/integrations/neon/instance.ts
2374
- import axios10 from "axios";
2375
- var neonClientInstance = axios10.create({
2376
- baseURL: "https://console.neon.tech/api/v2/"
2377
- });
2378
- neonClientInstance.interceptors.response.use(
2379
- (r) => r,
2380
- (error) => {
2381
- var _a;
2382
- if (axios10.isAxiosError(error)) {
2383
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2384
- throw new UnauthorizeApiError("neon");
2385
- }
2386
- }
2387
- throw error;
2388
- }
2389
- );
2390
- function getNeonClientAuthorization(req) {
2391
- return {
2392
- token: req.headers["neon-token"]
2393
- };
2394
- }
2395
- function getNeonClientConfig(options = {}) {
2396
- const currentHeaders = neonClientInstance.defaults.headers;
2397
- const defaultAuthorization = currentHeaders.Authorization;
2398
- const headers = {
2399
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2400
- };
2401
- if (options.ensureAuthorizationToken && !headers.authorization) {
2402
- throw new UnauthorizeApiError("neon");
2403
- }
2404
- return {
2405
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2406
- };
2407
- }
2408
- function initNeonClientInstance(token) {
2409
- if (token) {
2410
- updateNeonClientInstance(token);
2411
- }
2412
- }
2413
- function updateNeonClientInstance(token) {
2414
- const headers = neonClientInstance.defaults.headers;
2415
- if (token) {
2416
- headers.Authorization = `${token}`;
2417
- } else {
2418
- delete headers.Authorization;
2419
- }
2420
- }
2421
-
2422
- // src/apis/platform/accounts/instance.ts
2423
- import axios11 from "axios";
2424
- var platformAccountsClientInstance = axios11.create({
2425
- baseURL: "https://accounts.labs.livechatinc.com"
2426
- });
2427
- function getPlatformAccountsClientAuthorization(req) {
2428
- return {
2429
- token: req.headers["platform-accounts-token"]
2430
- };
2431
- }
2432
- function getPlatformAccountsClientConfig(options = {}) {
2433
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2434
- const headers = {
2435
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2436
- };
2437
- return {
2438
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2439
- };
2440
- }
2441
- function initPlatformAccountsClientInstance(baseUrl, token) {
2442
- if (baseUrl) {
2443
- platformAccountsClientInstance.interceptors.request.use(
2444
- (config) => __async(this, null, function* () {
2445
- config.baseURL = baseUrl;
2446
- return config;
2447
- }),
2448
- (error) => Promise.reject(error)
2449
- );
2450
- }
2451
- if (token) {
2452
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2453
- } else {
2454
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
2455
- }
2456
- }
2457
-
2458
- // src/apis/platform/billing/instance.ts
2459
- import axios12 from "axios";
2460
- var platformBillingClientInstance = axios12.create({
2461
- baseURL: "https://billing.labs.livechatinc.com"
2462
- });
2463
- function getPlatformBillingClientAuthorization(req) {
2464
- return {
2465
- token: req.headers["platform-token"]
2466
- };
2467
- }
2468
- function getPlatformBillingClientConfig(options = {}) {
2469
- const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
2470
- const headers = {
2471
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2472
- };
2473
- return {
2474
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2475
- };
2476
- }
2477
- function initPlatformBillingClientInstance(baseUrl, token) {
2478
- if (baseUrl) {
2479
- platformBillingClientInstance.interceptors.request.use(
2480
- (config) => __async(this, null, function* () {
2481
- config.baseURL = baseUrl;
2482
- return config;
2483
- }),
2484
- (error) => Promise.reject(error)
2485
- );
2486
- }
2487
- if (token) {
2488
- platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
2489
- } else {
2490
- delete platformBillingClientInstance.defaults.headers.Authorization;
2491
- }
2492
- }
2493
-
2494
- // src/apis/platform/adapter/instance.ts
2495
- import axios13 from "axios";
2496
- var REGION = {
2497
- FRA: "fra",
2498
- DAL: "dal",
2499
- FRA_A: "fra-a",
2500
- FRA_B: "fra-b"
2501
- };
2502
- var supportedRegions = Object.values(REGION);
2503
- var getRegion = (token) => {
2504
- const region = token.split(":")[0];
2505
- if (supportedRegions.includes(region)) {
2506
- return region;
2507
- }
2508
- };
2509
- function getPlatformAdapterClientAuthorization(req) {
2510
- return {
2511
- platform: {
2512
- dps: req.headers["platform-dps-token"]
2513
- },
2514
- github: {
2515
- app: req.headers["github-app-token"],
2516
- oauth: req.headers["github-oauth-token"]
2517
- },
2518
- netlify: req.headers["netlify-token"],
2519
- vercel: req.headers["vercel-token"],
2520
- planetscale: req.headers["planetscale-token"],
2521
- neon: req.headers["neon-token"],
2522
- sentry: req.headers["sentry-token"],
2523
- openai: req.headers["openai-token"]
2524
- };
2525
- }
2526
- var platformAdapterClientInstance = axios13.create({
2527
- baseURL: "https://platform.labs.text.com/console-adapter/api",
2528
- headers: {
2529
- "Content-Type": "application/json"
2530
- }
2531
- });
2532
- platformAdapterClientInstance.interceptors.response.use(
2533
- (r) => r,
2534
- (error) => {
2535
- var _a;
2536
- if (axios13.isAxiosError(error)) {
2537
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2538
- const source = error.response.data.error.source;
2539
- if (source) {
2540
- throw new UnauthorizeApiError(source);
2541
- }
2542
- }
2543
- }
2544
- throw error;
2545
- }
2546
- );
2547
- function getPlatformAdapterClientConfig(options = {}) {
2548
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2549
- const currentHeaders = platformAdapterClientInstance.defaults.headers;
2550
- const headers = {
2551
- platform: {
2552
- dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
2553
- },
2554
- integrations: {
2555
- github: {
2556
- app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
2557
- oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
2558
- },
2559
- netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
2560
- vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
2561
- planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
2562
- neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
2563
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
2564
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
2565
- }
2566
- };
2567
- if (currentHeaders["platform-dps-token"]) {
2568
- currentHeaders["X-Region"] = (_m = getRegion(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
2569
- }
2570
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
2571
- throw new UnauthorizeApiError("dps");
2572
- }
2573
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2574
- throw new UnauthorizeApiError("github");
2575
- }
2576
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
2577
- throw new UnauthorizeApiError("vercel");
2578
- }
2579
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
2580
- throw new UnauthorizeApiError("netlify");
2581
- }
2582
- if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
2583
- throw new UnauthorizeApiError("planetscale");
2584
- }
2585
- if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
2586
- throw new UnauthorizeApiError("neon");
2587
- }
2588
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
2589
- throw new UnauthorizeApiError("sentry");
2590
- }
2591
- if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
2592
- throw new UnauthorizeApiError("openai");
2593
- }
2594
- return {
2595
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
2596
- };
2597
- }
2598
- function initPlatformAdapterClientInstance(baseUrl, tokens) {
2599
- if (baseUrl) {
2600
- platformAdapterClientInstance.interceptors.request.use(
2601
- (config) => {
2602
- config.baseURL = baseUrl;
2603
- return config;
2604
- },
2605
- (error) => Promise.reject(error)
2606
- );
2607
- }
2608
- if (tokens) {
2609
- updatePlatformAdapterClientInstance(tokens);
2610
- }
2611
- }
2612
- function updatePlatformAdapterClientInstance(tokens) {
2613
- var _a, _b, _c;
2614
- const headers = platformAdapterClientInstance.defaults.headers;
2615
- if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
2616
- headers["platform-dps-token"] = tokens.platform.dps;
2617
- }
2618
- if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
2619
- headers["github-app-token"] = tokens.github.app;
2620
- }
2621
- if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
2622
- headers["github-oauth-token"] = tokens.github.oauth;
2623
- }
2624
- if (tokens == null ? void 0 : tokens.netlify) {
2625
- headers["netlify-token"] = tokens.netlify;
2626
- }
2627
- if (tokens == null ? void 0 : tokens.vercel) {
2628
- headers["vercel-token"] = tokens.vercel;
2629
- }
2630
- if (tokens == null ? void 0 : tokens.planetscale) {
2631
- headers["planetscale-token"] = tokens.planetscale;
2632
- }
2633
- if (tokens == null ? void 0 : tokens.neon) {
2634
- headers["neon-token"] = tokens.neon;
2635
- }
2636
- if (tokens == null ? void 0 : tokens.sentry) {
2637
- headers["sentry-token"] = tokens.sentry;
2638
- }
2639
- if (tokens == null ? void 0 : tokens.openai) {
2640
- headers["openai-token"] = tokens.openai;
2641
- }
2642
- }
2643
-
2644
- // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
2645
- var getEmptyAppAutoReview = () => ({
2646
- isReviewed: false,
2647
- recommendations: {
2648
- listingDetails: {
2649
- appName: "",
2650
- shortDescription: "",
2651
- longDescription: "",
2652
- features: "",
2653
- benefits: ""
2654
- },
2655
- auth: {
2656
- hasZeroScopes: false
2657
- }
2658
- },
2659
- errors: {
2660
- listingDetails: {
2661
- appName: "",
2662
- shortDescription: "",
2663
- longDescription: "",
2664
- features: "",
2665
- benefits: ""
2666
- },
2667
- auth: {
2668
- hasAllScopes: false,
2669
- isRedirectUriSafe: false
2670
- },
2671
- links: {
2672
- tutorial: {
2673
- returns200: false,
2674
- isValid: false
2675
- },
2676
- privacyPolicy: {
2677
- returns200: false,
2678
- isValid: false
2679
- }
2680
- },
2681
- images: {
2682
- icon: {
2683
- isNsfw: false,
2684
- isRatioValid: false
2685
- },
2686
- screenshots: {
2687
- areNsfw: false,
2688
- areRatiosValid: false
2689
- }
2690
- }
2691
- }
2692
- });
2693
-
2694
- // src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
2695
- var getAppAutoReviewPayload = (value) => {
2696
- return {
2697
- appName: value,
2698
- shortDescription: value,
2699
- longDescription: value,
2700
- features: value,
2701
- benefits: value,
2702
- scopes: value,
2703
- redirect: value,
2704
- tutorial: value,
2705
- privacyPolicy: value,
2706
- icons: value,
2707
- screenshots: value
2708
- };
2709
- };
2710
-
2711
- // src/apis/platform/dps/instance.ts
2712
- import axios14 from "axios";
2713
- var platformDpsClientInstance = axios14.create({
2714
- baseURL: "https://dev-platform.labs.livechatinc.com"
2715
- });
2716
- function getPlatformDpsClientAuthorization(req) {
2717
- var _a;
2718
- return {
2719
- token: (_a = req.headers["platform-dps-token"]) != null ? _a : req.headers["platform-token"],
2720
- tokenType: "Bearer"
2721
- };
2722
- }
2723
- function getPlatformDpsAdminClientAuthorization() {
2724
- var _a, _b;
2725
- const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
2726
- return {
2727
- token: btoa(`apps@livechatinc.com:${token}`),
2728
- tokenType: "Basic"
2729
- };
2730
- }
2731
- function getPlatformDpsClientConfig(options = {}) {
2732
- const currentHeaders = platformDpsClientInstance.defaults.headers;
2733
- const defaultAuthorization = currentHeaders.Authorization;
2734
- const headers = {
2735
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2736
- };
2737
- return {
2738
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2739
- };
2740
- }
2741
- function initPlatformDpsClientInstance(baseUrl, token) {
2742
- const headers = platformDpsClientInstance.defaults.headers;
2743
- if (baseUrl) {
2744
- platformDpsClientInstance.interceptors.request.use(
2745
- (config) => {
2746
- config.baseURL = baseUrl;
2747
- return config;
2748
- },
2749
- (error) => Promise.reject(error)
2750
- );
2751
- }
2752
- if (token) {
2753
- headers.Authorization = `Bearer ${token}`;
2754
- } else {
2755
- delete headers.Authorization;
2756
- }
2757
- }
2758
-
2759
- // src/apis/products/livechat/instance.ts
2760
- import axios15 from "axios";
2761
- var REGION2 = {
2762
- FRA: "fra",
2763
- DAL: "dal",
2764
- FRA_A: "fra-a",
2765
- FRA_B: "fra-b"
2766
- };
2767
- var supportedRegions2 = Object.values(REGION2);
2768
- var getRegion2 = (token) => {
2769
- const region = token.split(":")[0];
2770
- if (supportedRegions2.includes(region)) {
2771
- return region;
2772
- }
2773
- };
2774
- var livechatClientInstance = axios15.create({
2775
- baseURL: "https://api.labs.livechatinc.com"
2371
+ import axios11 from "axios";
2372
+
2373
+ // src/apis/integrations/neon/instance.ts
2374
+ import axios10 from "axios";
2375
+ var neonClientInstance = axios10.create({
2376
+ baseURL: "https://console.neon.tech/api/v2/"
2776
2377
  });
2777
- function getLiveChatClientAuthorization(req) {
2378
+ neonClientInstance.interceptors.response.use(
2379
+ (r) => r,
2380
+ (error) => {
2381
+ var _a;
2382
+ if (axios10.isAxiosError(error)) {
2383
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2384
+ throw new UnauthorizeApiError("neon");
2385
+ }
2386
+ }
2387
+ throw error;
2388
+ }
2389
+ );
2390
+ function getNeonClientAuthorization(req) {
2778
2391
  return {
2779
- token: req.headers["livechat-token"]
2392
+ token: req.headers["neon-token"]
2780
2393
  };
2781
2394
  }
2782
- function getLiveChatClientConfig(options = {}) {
2783
- const currentHeaders = livechatClientInstance.defaults.headers;
2395
+ function getNeonClientConfig(options = {}) {
2396
+ const currentHeaders = neonClientInstance.defaults.headers;
2784
2397
  const defaultAuthorization = currentHeaders.Authorization;
2785
2398
  const headers = {
2786
2399
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2787
2400
  };
2401
+ if (options.ensureAuthorizationToken && !headers.authorization) {
2402
+ throw new UnauthorizeApiError("neon");
2403
+ }
2788
2404
  return {
2789
2405
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2790
2406
  };
2791
2407
  }
2792
- function initLiveChatClientInstance(baseUrl, token) {
2793
- const region = token ? getRegion2(token) : void 0;
2794
- const headers = livechatClientInstance.defaults.headers;
2795
- if (baseUrl) {
2796
- livechatClientInstance.interceptors.request.use(
2797
- (config) => {
2798
- config.baseURL = baseUrl;
2799
- return config;
2800
- },
2801
- (error) => Promise.reject(error)
2802
- );
2803
- }
2804
- if (region) {
2805
- headers["X-Region"] = region;
2408
+ function initNeonClientInstance(token) {
2409
+ if (token) {
2410
+ updateNeonClientInstance(token);
2806
2411
  }
2412
+ }
2413
+ function updateNeonClientInstance(token) {
2414
+ const headers = neonClientInstance.defaults.headers;
2807
2415
  if (token) {
2808
- headers.Authorization = `Bearer ${token}`;
2416
+ headers.Authorization = `${token}`;
2809
2417
  } else {
2810
2418
  delete headers.Authorization;
2811
2419
  }
@@ -2852,10 +2460,10 @@ var neonProjectBranchApi = {
2852
2460
  return response.data;
2853
2461
  });
2854
2462
  },
2855
- getDatabases(projectId, branchId, authorization) {
2463
+ getDatabase(projectId, branchId, databaseName, authorization) {
2856
2464
  return __async(this, null, function* () {
2857
2465
  const response = yield neonClientInstance.get(
2858
- `projects/${projectId}/branches/${branchId}/databases`,
2466
+ `projects/${projectId}/branches/${branchId}/databases/${databaseName}`,
2859
2467
  getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2860
2468
  ensureAuthorizationToken: true
2861
2469
  }))
@@ -2863,13 +2471,10 @@ var neonProjectBranchApi = {
2863
2471
  return response.data;
2864
2472
  });
2865
2473
  },
2866
- getNeonDatabases(projectId, authorization) {
2474
+ getDatabases(projectId, branchId, authorization) {
2867
2475
  return __async(this, null, function* () {
2868
- const response = yield platformAdapterClientInstance.post(
2869
- `integrations/neon/databases`,
2870
- {
2871
- projectId
2872
- },
2476
+ const response = yield neonClientInstance.get(
2477
+ `projects/${projectId}/branches/${branchId}/databases`,
2873
2478
  getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2874
2479
  ensureAuthorizationToken: true
2875
2480
  }))
@@ -2955,17 +2560,6 @@ var neonProjectApi = {
2955
2560
  );
2956
2561
  return response.data;
2957
2562
  });
2958
- },
2959
- getNeonProjects(authorization) {
2960
- return __async(this, null, function* () {
2961
- const response = yield platformAdapterClientInstance.get(
2962
- "/integrations/neon/projects",
2963
- getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2964
- ensureAuthorizationToken: true
2965
- }))
2966
- );
2967
- return response.data;
2968
- });
2969
2563
  }
2970
2564
  };
2971
2565
 
@@ -2981,17 +2575,6 @@ var neonUserApi = {
2981
2575
  );
2982
2576
  return response.data;
2983
2577
  });
2984
- },
2985
- getNeonUser(authorization) {
2986
- return __async(this, null, function* () {
2987
- const response = yield platformAdapterClientInstance.get(
2988
- "/integrations/neon/user",
2989
- getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2990
- ensureAuthorizationToken: true
2991
- }))
2992
- );
2993
- return response.data;
2994
- });
2995
2578
  }
2996
2579
  };
2997
2580
 
@@ -3009,7 +2592,7 @@ var neonApi = {
3009
2592
  redirect_uri: redirectUri,
3010
2593
  grant_type: "authorization_code"
3011
2594
  });
3012
- const response = yield axios16.post(
2595
+ const response = yield axios11.post(
3013
2596
  "https://oauth2.neon.tech/oauth2/token",
3014
2597
  data,
3015
2598
  {
@@ -3024,6 +2607,27 @@ var neonApi = {
3024
2607
  refreshToken: (_b = params.get("refresh_token")) != null ? _b : ""
3025
2608
  };
3026
2609
  });
2610
+ },
2611
+ refreshToken(refreshToken, clientId, clientSecret) {
2612
+ return __async(this, null, function* () {
2613
+ var _a, _b;
2614
+ const data = new URLSearchParams({
2615
+ refresh_token: refreshToken,
2616
+ client_id: clientId,
2617
+ client_secret: clientSecret,
2618
+ grant_type: "refresh_token"
2619
+ });
2620
+ const response = yield axios11.post("https://oauth2.neon.tech/oauth2/token", data, {
2621
+ headers: {
2622
+ "Content-Type": "application/x-www-form-urlencoded"
2623
+ }
2624
+ });
2625
+ const params = new URLSearchParams(response.data);
2626
+ return {
2627
+ token: (_a = params.get("access_token")) != null ? _a : "",
2628
+ refreshToken: (_b = params.get("refresh_token")) != null ? _b : ""
2629
+ };
2630
+ });
3027
2631
  }
3028
2632
  };
3029
2633
 
@@ -3038,6 +2642,61 @@ var integrationsApi = {
3038
2642
  text: textApi
3039
2643
  };
3040
2644
 
2645
+ // src/apis/products/livechat/instance.ts
2646
+ import axios12 from "axios";
2647
+ var REGION = {
2648
+ FRA: "fra",
2649
+ DAL: "dal",
2650
+ FRA_A: "fra-a",
2651
+ FRA_B: "fra-b"
2652
+ };
2653
+ var supportedRegions = Object.values(REGION);
2654
+ var getRegion = (token) => {
2655
+ const region = token.split(":")[0];
2656
+ if (supportedRegions.includes(region)) {
2657
+ return region;
2658
+ }
2659
+ };
2660
+ var livechatClientInstance = axios12.create({
2661
+ baseURL: "https://api.labs.livechatinc.com"
2662
+ });
2663
+ function getLiveChatClientAuthorization(req) {
2664
+ return {
2665
+ token: req.headers["livechat-token"]
2666
+ };
2667
+ }
2668
+ function getLiveChatClientConfig(options = {}) {
2669
+ const currentHeaders = livechatClientInstance.defaults.headers;
2670
+ const defaultAuthorization = currentHeaders.Authorization;
2671
+ const headers = {
2672
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2673
+ };
2674
+ return {
2675
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2676
+ };
2677
+ }
2678
+ function initLiveChatClientInstance(baseUrl, token) {
2679
+ const region = token ? getRegion(token) : void 0;
2680
+ const headers = livechatClientInstance.defaults.headers;
2681
+ if (baseUrl) {
2682
+ livechatClientInstance.interceptors.request.use(
2683
+ (config) => {
2684
+ config.baseURL = baseUrl;
2685
+ return config;
2686
+ },
2687
+ (error) => Promise.reject(error)
2688
+ );
2689
+ }
2690
+ if (region) {
2691
+ headers["X-Region"] = region;
2692
+ }
2693
+ if (token) {
2694
+ headers.Authorization = `Bearer ${token}`;
2695
+ } else {
2696
+ delete headers.Authorization;
2697
+ }
2698
+ }
2699
+
3041
2700
  // src/apis/products/livechat/agents/api.ts
3042
2701
  var livechatAgentApi = {
3043
2702
  getUser() {
@@ -3480,6 +3139,42 @@ var productsApi = {
3480
3139
  livechat: livechatApi
3481
3140
  };
3482
3141
 
3142
+ // src/apis/platform/accounts/instance.ts
3143
+ import axios13 from "axios";
3144
+ var platformAccountsClientInstance = axios13.create({
3145
+ baseURL: "https://accounts.labs.livechatinc.com"
3146
+ });
3147
+ function getPlatformAccountsClientAuthorization(req) {
3148
+ return {
3149
+ token: req.headers["platform-accounts-token"]
3150
+ };
3151
+ }
3152
+ function getPlatformAccountsClientConfig(options = {}) {
3153
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
3154
+ const headers = {
3155
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3156
+ };
3157
+ return {
3158
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
3159
+ };
3160
+ }
3161
+ function initPlatformAccountsClientInstance(baseUrl, token) {
3162
+ if (baseUrl) {
3163
+ platformAccountsClientInstance.interceptors.request.use(
3164
+ (config) => __async(this, null, function* () {
3165
+ config.baseURL = baseUrl;
3166
+ return config;
3167
+ }),
3168
+ (error) => Promise.reject(error)
3169
+ );
3170
+ }
3171
+ if (token) {
3172
+ platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
3173
+ } else {
3174
+ delete platformAccountsClientInstance.defaults.headers["Authorization"];
3175
+ }
3176
+ }
3177
+
3483
3178
  // src/apis/platform/accounts/accounts/api.ts
3484
3179
  var platformAccountsAccountApi = {
3485
3180
  getAccounts(authorization) {
@@ -3899,6 +3594,54 @@ var platformAccountsApi = {
3899
3594
  token: platformAccountsTokenApi
3900
3595
  };
3901
3596
 
3597
+ // src/apis/platform/dps/instance.ts
3598
+ import axios14 from "axios";
3599
+ var platformDpsClientInstance = axios14.create({
3600
+ baseURL: "https://dev-platform.labs.livechatinc.com"
3601
+ });
3602
+ function getPlatformDpsClientAuthorization(req) {
3603
+ var _a;
3604
+ return {
3605
+ token: (_a = req.headers["platform-dps-token"]) != null ? _a : req.headers["platform-token"],
3606
+ tokenType: "Bearer"
3607
+ };
3608
+ }
3609
+ function getPlatformDpsAdminClientAuthorization() {
3610
+ var _a, _b;
3611
+ const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
3612
+ return {
3613
+ token: btoa(`apps@livechatinc.com:${token}`),
3614
+ tokenType: "Basic"
3615
+ };
3616
+ }
3617
+ function getPlatformDpsClientConfig(options = {}) {
3618
+ const currentHeaders = platformDpsClientInstance.defaults.headers;
3619
+ const defaultAuthorization = currentHeaders.Authorization;
3620
+ const headers = {
3621
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3622
+ };
3623
+ return {
3624
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
3625
+ };
3626
+ }
3627
+ function initPlatformDpsClientInstance(baseUrl, token) {
3628
+ const headers = platformDpsClientInstance.defaults.headers;
3629
+ if (baseUrl) {
3630
+ platformDpsClientInstance.interceptors.request.use(
3631
+ (config) => {
3632
+ config.baseURL = baseUrl;
3633
+ return config;
3634
+ },
3635
+ (error) => Promise.reject(error)
3636
+ );
3637
+ }
3638
+ if (token) {
3639
+ headers.Authorization = `Bearer ${token}`;
3640
+ } else {
3641
+ delete headers.Authorization;
3642
+ }
3643
+ }
3644
+
3902
3645
  // src/apis/platform/dps/applications/application/authorization/api.ts
3903
3646
  var platformDpsApplicationAuthorizationApi = {
3904
3647
  createAuth(appId, payload, authorization) {
@@ -3917,8 +3660,75 @@ var platformDpsApplicationAuthorizationApi = {
3917
3660
  }
3918
3661
  throw error;
3919
3662
  }
3920
- });
3663
+ });
3664
+ }
3665
+ };
3666
+
3667
+ // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3668
+ var getEmptyAppAutoReview = () => ({
3669
+ isReviewed: false,
3670
+ recommendations: {
3671
+ listingDetails: {
3672
+ appName: "",
3673
+ shortDescription: "",
3674
+ longDescription: "",
3675
+ features: "",
3676
+ benefits: ""
3677
+ },
3678
+ auth: {
3679
+ hasZeroScopes: false
3680
+ }
3681
+ },
3682
+ errors: {
3683
+ listingDetails: {
3684
+ appName: "",
3685
+ shortDescription: "",
3686
+ longDescription: "",
3687
+ features: "",
3688
+ benefits: ""
3689
+ },
3690
+ auth: {
3691
+ hasAllScopes: false,
3692
+ isRedirectUriSafe: false
3693
+ },
3694
+ links: {
3695
+ tutorial: {
3696
+ returns200: false,
3697
+ isValid: false
3698
+ },
3699
+ privacyPolicy: {
3700
+ returns200: false,
3701
+ isValid: false
3702
+ }
3703
+ },
3704
+ images: {
3705
+ icon: {
3706
+ isNsfw: false,
3707
+ isRatioValid: false
3708
+ },
3709
+ screenshots: {
3710
+ areNsfw: false,
3711
+ areRatiosValid: false
3712
+ }
3713
+ }
3921
3714
  }
3715
+ });
3716
+
3717
+ // src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
3718
+ var getAppAutoReviewPayload = (value) => {
3719
+ return {
3720
+ appName: value,
3721
+ shortDescription: value,
3722
+ longDescription: value,
3723
+ features: value,
3724
+ benefits: value,
3725
+ scopes: value,
3726
+ redirect: value,
3727
+ tutorial: value,
3728
+ privacyPolicy: value,
3729
+ icons: value,
3730
+ screenshots: value
3731
+ };
3922
3732
  };
3923
3733
 
3924
3734
  // src/apis/platform/dps/applications/application/autoReview/api.ts
@@ -5416,6 +5226,156 @@ var platformDpsApi = {
5416
5226
  research: platformDpsResearchApi
5417
5227
  };
5418
5228
 
5229
+ // src/apis/platform/adapter/instance.ts
5230
+ import axios15 from "axios";
5231
+ var REGION2 = {
5232
+ FRA: "fra",
5233
+ DAL: "dal",
5234
+ FRA_A: "fra-a",
5235
+ FRA_B: "fra-b"
5236
+ };
5237
+ var supportedRegions2 = Object.values(REGION2);
5238
+ var getRegion2 = (token) => {
5239
+ const region = token.split(":")[0];
5240
+ if (supportedRegions2.includes(region)) {
5241
+ return region;
5242
+ }
5243
+ };
5244
+ function getPlatformAdapterClientAuthorization(req) {
5245
+ return {
5246
+ platform: {
5247
+ dps: req.headers["platform-dps-token"]
5248
+ },
5249
+ github: {
5250
+ app: req.headers["github-app-token"],
5251
+ oauth: req.headers["github-oauth-token"]
5252
+ },
5253
+ netlify: req.headers["netlify-token"],
5254
+ vercel: req.headers["vercel-token"],
5255
+ planetscale: req.headers["planetscale-token"],
5256
+ neon: req.headers["neon-token"],
5257
+ sentry: req.headers["sentry-token"],
5258
+ openai: req.headers["openai-token"]
5259
+ };
5260
+ }
5261
+ var platformAdapterClientInstance = axios15.create({
5262
+ baseURL: "https://platform.labs.text.com/console-adapter/api",
5263
+ headers: {
5264
+ "Content-Type": "application/json"
5265
+ }
5266
+ });
5267
+ platformAdapterClientInstance.interceptors.response.use(
5268
+ (r) => r,
5269
+ (error) => {
5270
+ var _a;
5271
+ if (axios15.isAxiosError(error)) {
5272
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5273
+ const source = error.response.data.error.source;
5274
+ if (source) {
5275
+ throw new UnauthorizeApiError(source);
5276
+ }
5277
+ }
5278
+ }
5279
+ throw error;
5280
+ }
5281
+ );
5282
+ function getPlatformAdapterClientConfig(options = {}) {
5283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
5284
+ const currentHeaders = platformAdapterClientInstance.defaults.headers;
5285
+ const headers = {
5286
+ platform: {
5287
+ dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
5288
+ },
5289
+ integrations: {
5290
+ github: {
5291
+ app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
5292
+ oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
5293
+ },
5294
+ netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
5295
+ vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5296
+ planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5297
+ neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5298
+ sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5299
+ openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5300
+ }
5301
+ };
5302
+ if (currentHeaders["platform-dps-token"]) {
5303
+ currentHeaders["X-Region"] = (_m = getRegion2(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
5304
+ }
5305
+ if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5306
+ throw new UnauthorizeApiError("dps");
5307
+ }
5308
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5309
+ throw new UnauthorizeApiError("github");
5310
+ }
5311
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
5312
+ throw new UnauthorizeApiError("vercel");
5313
+ }
5314
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
5315
+ throw new UnauthorizeApiError("netlify");
5316
+ }
5317
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
5318
+ throw new UnauthorizeApiError("planetscale");
5319
+ }
5320
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
5321
+ throw new UnauthorizeApiError("neon");
5322
+ }
5323
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5324
+ throw new UnauthorizeApiError("sentry");
5325
+ }
5326
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
5327
+ throw new UnauthorizeApiError("openai");
5328
+ }
5329
+ return {
5330
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5331
+ };
5332
+ }
5333
+ function initPlatformAdapterClientInstance(baseUrl, tokens) {
5334
+ if (baseUrl) {
5335
+ platformAdapterClientInstance.interceptors.request.use(
5336
+ (config) => {
5337
+ config.baseURL = baseUrl;
5338
+ return config;
5339
+ },
5340
+ (error) => Promise.reject(error)
5341
+ );
5342
+ }
5343
+ if (tokens) {
5344
+ updatePlatformAdapterClientInstance(tokens);
5345
+ }
5346
+ }
5347
+ function updatePlatformAdapterClientInstance(tokens) {
5348
+ var _a, _b, _c;
5349
+ const headers = platformAdapterClientInstance.defaults.headers;
5350
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
5351
+ headers["platform-dps-token"] = tokens.platform.dps;
5352
+ }
5353
+ if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
5354
+ headers["github-app-token"] = tokens.github.app;
5355
+ }
5356
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
5357
+ headers["github-oauth-token"] = tokens.github.oauth;
5358
+ }
5359
+ if (tokens == null ? void 0 : tokens.netlify) {
5360
+ headers["netlify-token"] = tokens.netlify;
5361
+ }
5362
+ if (tokens == null ? void 0 : tokens.vercel) {
5363
+ headers["vercel-token"] = tokens.vercel;
5364
+ }
5365
+ if (tokens == null ? void 0 : tokens.planetscale) {
5366
+ headers["planetscale-token"] = tokens.planetscale;
5367
+ }
5368
+ if (tokens == null ? void 0 : tokens.neon) {
5369
+ headers["neon-token"] = tokens.neon;
5370
+ }
5371
+ if (tokens == null ? void 0 : tokens.sentry) {
5372
+ headers["sentry-token"] = tokens.sentry;
5373
+ }
5374
+ if (tokens == null ? void 0 : tokens.openai) {
5375
+ headers["openai-token"] = tokens.openai;
5376
+ }
5377
+ }
5378
+
5419
5379
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5420
5380
  var platformAdapterAppDeploymentApi = {
5421
5381
  get(appId, authorization) {
@@ -5950,10 +5910,90 @@ var platformAdapterConductorApi = {
5950
5910
  }
5951
5911
  };
5952
5912
 
5913
+ // src/apis/platform/billing/instance.ts
5914
+ import axios16 from "axios";
5915
+ var platformBillingClientInstance = axios16.create({
5916
+ baseURL: "https://billing.labs.livechatinc.com"
5917
+ });
5918
+ function getPlatformBillingClientAuthorization(req) {
5919
+ return {
5920
+ token: req.headers["platform-token"]
5921
+ };
5922
+ }
5923
+ function getPlatformBillingClientConfig(options = {}) {
5924
+ const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
5925
+ const headers = {
5926
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
5927
+ };
5928
+ return {
5929
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
5930
+ };
5931
+ }
5932
+ function initPlatformBillingClientInstance(baseUrl, token) {
5933
+ if (baseUrl) {
5934
+ platformBillingClientInstance.interceptors.request.use(
5935
+ (config) => __async(this, null, function* () {
5936
+ config.baseURL = baseUrl;
5937
+ return config;
5938
+ }),
5939
+ (error) => Promise.reject(error)
5940
+ );
5941
+ }
5942
+ if (token) {
5943
+ platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
5944
+ } else {
5945
+ delete platformBillingClientInstance.defaults.headers.Authorization;
5946
+ }
5947
+ }
5948
+
5949
+ // src/apis/platform/adapter/integrations/neon/api.ts
5950
+ var platformAdapterNeonProxyApi = {
5951
+ user(authorization) {
5952
+ return __async(this, null, function* () {
5953
+ const response = yield platformAdapterClientInstance.get(
5954
+ `/integrations/neon/user`,
5955
+ getNeonClientConfig(authorization)
5956
+ );
5957
+ return response.data;
5958
+ });
5959
+ },
5960
+ projects(authorization) {
5961
+ return __async(this, null, function* () {
5962
+ const response = yield platformAdapterClientInstance.get(
5963
+ `/integrations/neon/projects`,
5964
+ getNeonClientConfig(authorization)
5965
+ );
5966
+ return response.data;
5967
+ });
5968
+ },
5969
+ databases(projectId, authorization) {
5970
+ return __async(this, null, function* () {
5971
+ const response = yield platformAdapterClientInstance.post(
5972
+ `/integrations/neon/databases`,
5973
+ { projectId },
5974
+ getNeonClientConfig(authorization)
5975
+ );
5976
+ return response.data;
5977
+ });
5978
+ },
5979
+ refreshToken(authorization) {
5980
+ return __async(this, null, function* () {
5981
+ const response = yield platformAdapterClientInstance.get(`/integrations/neon/refresh-token`, getNeonClientConfig(authorization));
5982
+ return response.data;
5983
+ });
5984
+ }
5985
+ };
5986
+
5987
+ // src/apis/platform/adapter/integrations/api.ts
5988
+ var platformAdapterIntegrationsProxyApi = {
5989
+ neon: platformAdapterNeonProxyApi
5990
+ };
5991
+
5953
5992
  // src/apis/platform/adapter/api.ts
5954
5993
  var platformAdapterApi = {
5955
5994
  app: platformAdapterAppApi,
5956
- conductor: platformAdapterConductorApi
5995
+ conductor: platformAdapterConductorApi,
5996
+ proxy: platformAdapterIntegrationsProxyApi
5957
5997
  };
5958
5998
 
5959
5999
  // src/apis/platform/billing/account/api.ts
@@ -6141,7 +6181,7 @@ export {
6141
6181
  getPlatformDpsAdminClientAuthorization,
6142
6182
  getPlatformDpsClientAuthorization,
6143
6183
  getPlatformDpsClientConfig,
6144
- getRegion2 as getRegion,
6184
+ getRegion,
6145
6185
  getSentryClientAuthorization,
6146
6186
  getSentryClientConfig,
6147
6187
  getTextClientAuthorization,