@yadsh/dsh-qa-integrations 0.6.0 → 0.8.0

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.
Files changed (183) hide show
  1. package/README.md +341 -303
  2. package/lib/broker.js +12 -0
  3. package/lib/broker.js.map +1 -1
  4. package/lib/client/bitrix24.js +66 -5
  5. package/lib/client/bitrix24.js.map +1 -1
  6. package/lib/client/confluence.js +117 -128
  7. package/lib/client/confluence.js.map +1 -1
  8. package/lib/client/gitlab.js +1 -1
  9. package/lib/client/gitlab.js.map +1 -1
  10. package/lib/client/index.js +25 -5
  11. package/lib/client/index.js.map +1 -1
  12. package/lib/client/integrations.js +1 -1
  13. package/lib/client/integrations.js.map +1 -1
  14. package/lib/client/jira.js +115 -126
  15. package/lib/client/jira.js.map +1 -1
  16. package/lib/client/operator-card.js +537 -0
  17. package/lib/client/operator-card.js.map +1 -0
  18. package/lib/client/operator-controls.js +232 -0
  19. package/lib/client/operator-controls.js.map +1 -0
  20. package/lib/client/styles.js +60 -0
  21. package/lib/client/styles.js.map +1 -1
  22. package/lib/client/testit.js +39 -3
  23. package/lib/client/testit.js.map +1 -1
  24. package/lib/client/weblate.js +38 -3
  25. package/lib/client/weblate.js.map +1 -1
  26. package/lib/client.js +2966 -871
  27. package/lib/client.js.map +1 -1
  28. package/lib/coerce.js +17 -1
  29. package/lib/coerce.js.map +1 -1
  30. package/lib/config.js.map +1 -1
  31. package/lib/errors.js +22 -0
  32. package/lib/errors.js.map +1 -1
  33. package/lib/index.js +211 -52
  34. package/lib/index.js.map +1 -1
  35. package/lib/providers/bitrix24/catalog.js +138 -8
  36. package/lib/providers/bitrix24/catalog.js.map +1 -1
  37. package/lib/providers/bitrix24/config.js +84 -14
  38. package/lib/providers/bitrix24/config.js.map +1 -1
  39. package/lib/providers/bitrix24/index.js +100 -0
  40. package/lib/providers/bitrix24/index.js.map +1 -1
  41. package/lib/providers/bitrix24/operations.js +5 -9
  42. package/lib/providers/bitrix24/operations.js.map +1 -1
  43. package/lib/providers/bitrix24/transport.js +11 -31
  44. package/lib/providers/bitrix24/transport.js.map +1 -1
  45. package/lib/providers/confluence/adf.js +28 -23
  46. package/lib/providers/confluence/adf.js.map +1 -1
  47. package/lib/providers/confluence/catalog.js +91 -7
  48. package/lib/providers/confluence/catalog.js.map +1 -1
  49. package/lib/providers/confluence/config.js +27 -2
  50. package/lib/providers/confluence/config.js.map +1 -1
  51. package/lib/providers/confluence/credential-help.js +14 -8
  52. package/lib/providers/confluence/credential-help.js.map +1 -1
  53. package/lib/providers/confluence/dialect.js +215 -0
  54. package/lib/providers/confluence/dialect.js.map +1 -0
  55. package/lib/providers/confluence/index.js +393 -79
  56. package/lib/providers/confluence/index.js.map +1 -1
  57. package/lib/providers/confluence/operations.js +208 -153
  58. package/lib/providers/confluence/operations.js.map +1 -1
  59. package/lib/providers/confluence/storage.js +690 -0
  60. package/lib/providers/confluence/storage.js.map +1 -0
  61. package/lib/providers/confluence/transport.js +26 -89
  62. package/lib/providers/confluence/transport.js.map +1 -1
  63. package/lib/providers/gitlab/config.js +2 -3
  64. package/lib/providers/gitlab/config.js.map +1 -1
  65. package/lib/providers/gitlab/index.js +2 -20
  66. package/lib/providers/gitlab/index.js.map +1 -1
  67. package/lib/providers/gitlab/operations.js +7 -45
  68. package/lib/providers/gitlab/operations.js.map +1 -1
  69. package/lib/providers/gitlab/transport.js +2 -18
  70. package/lib/providers/gitlab/transport.js.map +1 -1
  71. package/lib/providers/jira/adf.js +19 -14
  72. package/lib/providers/jira/adf.js.map +1 -1
  73. package/lib/providers/jira/catalog.js +125 -4
  74. package/lib/providers/jira/catalog.js.map +1 -1
  75. package/lib/providers/jira/config.js +27 -2
  76. package/lib/providers/jira/config.js.map +1 -1
  77. package/lib/providers/jira/credential-help.js +16 -7
  78. package/lib/providers/jira/credential-help.js.map +1 -1
  79. package/lib/providers/jira/dialect.js +94 -0
  80. package/lib/providers/jira/dialect.js.map +1 -0
  81. package/lib/providers/jira/index.js +327 -67
  82. package/lib/providers/jira/index.js.map +1 -1
  83. package/lib/providers/jira/jql.js +54 -21
  84. package/lib/providers/jira/jql.js.map +1 -1
  85. package/lib/providers/jira/operations.js +77 -55
  86. package/lib/providers/jira/operations.js.map +1 -1
  87. package/lib/providers/jira/tools.js +1 -1
  88. package/lib/providers/jira/tools.js.map +1 -1
  89. package/lib/providers/jira/transport.js +12 -83
  90. package/lib/providers/jira/transport.js.map +1 -1
  91. package/lib/providers/shared/health.js +31 -0
  92. package/lib/providers/shared/health.js.map +1 -0
  93. package/lib/providers/shared/http.js +20 -0
  94. package/lib/providers/shared/http.js.map +1 -1
  95. package/lib/providers/shared/paths.js +14 -0
  96. package/lib/providers/shared/paths.js.map +1 -0
  97. package/lib/providers/shared/payload.js +46 -0
  98. package/lib/providers/shared/payload.js.map +1 -0
  99. package/lib/providers/teamcity/artifacts.js +0 -8
  100. package/lib/providers/teamcity/artifacts.js.map +1 -1
  101. package/lib/providers/teamcity/config.js +2 -3
  102. package/lib/providers/teamcity/config.js.map +1 -1
  103. package/lib/providers/teamcity/index.js +2 -20
  104. package/lib/providers/teamcity/index.js.map +1 -1
  105. package/lib/providers/teamcity/operations.js +5 -39
  106. package/lib/providers/teamcity/operations.js.map +1 -1
  107. package/lib/providers/teamcity/transport.js +2 -11
  108. package/lib/providers/teamcity/transport.js.map +1 -1
  109. package/lib/providers/testit/catalog.js +77 -0
  110. package/lib/providers/testit/catalog.js.map +1 -1
  111. package/lib/providers/testit/config.js +2 -3
  112. package/lib/providers/testit/config.js.map +1 -1
  113. package/lib/providers/testit/index.js +260 -4
  114. package/lib/providers/testit/index.js.map +1 -1
  115. package/lib/providers/testit/operations.js +34 -63
  116. package/lib/providers/testit/operations.js.map +1 -1
  117. package/lib/providers/testit/transport.js +2 -18
  118. package/lib/providers/testit/transport.js.map +1 -1
  119. package/lib/providers/weblate/catalog.js +103 -9
  120. package/lib/providers/weblate/catalog.js.map +1 -1
  121. package/lib/providers/weblate/config.js +2 -3
  122. package/lib/providers/weblate/config.js.map +1 -1
  123. package/lib/providers/weblate/index.js +227 -6
  124. package/lib/providers/weblate/index.js.map +1 -1
  125. package/lib/providers/weblate/operations.js +3 -33
  126. package/lib/providers/weblate/operations.js.map +1 -1
  127. package/lib/providers/weblate/query.js +3 -6
  128. package/lib/providers/weblate/query.js.map +1 -1
  129. package/lib/providers/weblate/transport.js +2 -12
  130. package/lib/providers/weblate/transport.js.map +1 -1
  131. package/lib/service-credentials/config.js +2 -3
  132. package/lib/service-credentials/config.js.map +1 -1
  133. package/lib/shared/settings.js +14 -0
  134. package/lib/shared/settings.js.map +1 -0
  135. package/lib/typert.host.js +159 -60
  136. package/lib/typert.remote-client.d.ts +13 -11
  137. package/lib/typert.remote-client.js +98 -52
  138. package/lib/types/broker.d.ts +11 -3
  139. package/lib/types/client/bitrix24.d.ts +24 -2
  140. package/lib/types/client/confluence.d.ts +24 -4
  141. package/lib/types/client/index.d.ts +7 -6
  142. package/lib/types/client/integrations.d.ts +2 -2
  143. package/lib/types/client/jira.d.ts +25 -4
  144. package/lib/types/client/operator-card.d.ts +22 -0
  145. package/lib/types/client/operator-controls.d.ts +135 -0
  146. package/lib/types/client/testit.d.ts +14 -1
  147. package/lib/types/client/weblate.d.ts +14 -1
  148. package/lib/types/coerce.d.ts +14 -0
  149. package/lib/types/config.d.ts +4 -4
  150. package/lib/types/errors.d.ts +16 -0
  151. package/lib/types/index.d.ts +91 -15
  152. package/lib/types/providers/bitrix24/catalog.d.ts +8 -0
  153. package/lib/types/providers/bitrix24/config.d.ts +14 -23
  154. package/lib/types/providers/bitrix24/index.d.ts +37 -1
  155. package/lib/types/providers/confluence/catalog.d.ts +44 -8
  156. package/lib/types/providers/confluence/config.d.ts +39 -7
  157. package/lib/types/providers/confluence/credential-help.d.ts +9 -4
  158. package/lib/types/providers/confluence/dialect.d.ts +113 -0
  159. package/lib/types/providers/confluence/index.d.ts +82 -8
  160. package/lib/types/providers/confluence/operations.d.ts +14 -4
  161. package/lib/types/providers/confluence/storage.d.ts +28 -0
  162. package/lib/types/providers/confluence/transport.d.ts +10 -21
  163. package/lib/types/providers/jira/catalog.d.ts +49 -2
  164. package/lib/types/providers/jira/config.d.ts +37 -6
  165. package/lib/types/providers/jira/credential-help.d.ts +11 -3
  166. package/lib/types/providers/jira/dialect.d.ts +79 -0
  167. package/lib/types/providers/jira/index.d.ts +76 -19
  168. package/lib/types/providers/jira/jql.d.ts +14 -4
  169. package/lib/types/providers/jira/operations.d.ts +3 -0
  170. package/lib/types/providers/jira/transport.d.ts +6 -13
  171. package/lib/types/providers/shared/health.d.ts +18 -0
  172. package/lib/types/providers/shared/http.d.ts +9 -0
  173. package/lib/types/providers/shared/paths.d.ts +10 -0
  174. package/lib/types/providers/shared/payload.d.ts +26 -0
  175. package/lib/types/providers/teamcity/artifacts.d.ts +0 -2
  176. package/lib/types/providers/teamcity/index.d.ts +2 -0
  177. package/lib/types/providers/testit/catalog.d.ts +12 -0
  178. package/lib/types/providers/testit/index.d.ts +63 -2
  179. package/lib/types/providers/weblate/catalog.d.ts +19 -2
  180. package/lib/types/providers/weblate/index.d.ts +43 -1
  181. package/lib/types/shared/settings.d.ts +14 -0
  182. package/lib/types/types.d.ts +8 -0
  183. package/package.json +3 -3
package/lib/client.js CHANGED
@@ -4843,11 +4843,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4843
4843
  }
4844
4844
  //#endregion
4845
4845
  //#region lib/typert.remote-client.js
4846
+ const _yadsh_dsh_qa_integrations_qaIntegrations_bitrix24Instances_parameter_0$schema = string();
4847
+ const _yadsh_dsh_qa_integrations_qaIntegrations_bitrix24Instances_result$schema = array(object({
4848
+ "id": string().readonly(),
4849
+ "label": string().readonly(),
4850
+ "baseUrl": string().readonly(),
4851
+ "deploymentType": union([
4852
+ _undefined(),
4853
+ literal("cloud"),
4854
+ literal("server")
4855
+ ]).readonly().optional(),
4856
+ "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
4857
+ }));
4846
4858
  const _yadsh_dsh_qa_integrations_qaIntegrations_confluenceSites_parameter_0$schema = string();
4847
4859
  const _yadsh_dsh_qa_integrations_qaIntegrations_confluenceSites_result$schema = array(object({
4848
4860
  "id": string().readonly(),
4849
4861
  "label": string().readonly(),
4850
4862
  "baseUrl": string().readonly(),
4863
+ "deploymentType": union([
4864
+ _undefined(),
4865
+ literal("cloud"),
4866
+ literal("server")
4867
+ ]).readonly().optional(),
4851
4868
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
4852
4869
  }));
4853
4870
  const _yadsh_dsh_qa_integrations_qaIntegrations_credentialSource_parameter_0$schema = string();
@@ -5221,6 +5238,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5221
5238
  "id": string().readonly(),
5222
5239
  "label": string().readonly(),
5223
5240
  "baseUrl": string().readonly(),
5241
+ "deploymentType": union([
5242
+ _undefined(),
5243
+ literal("cloud"),
5244
+ literal("server")
5245
+ ]).readonly().optional(),
5224
5246
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
5225
5247
  }));
5226
5248
  const _yadsh_dsh_qa_integrations_qaIntegrations_jiraSites_parameter_0$schema = string();
@@ -5228,6 +5250,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5228
5250
  "id": string().readonly(),
5229
5251
  "label": string().readonly(),
5230
5252
  "baseUrl": string().readonly(),
5253
+ "deploymentType": union([
5254
+ _undefined(),
5255
+ literal("cloud"),
5256
+ literal("server")
5257
+ ]).readonly().optional(),
5231
5258
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
5232
5259
  }));
5233
5260
  const _yadsh_dsh_qa_integrations_qaIntegrations_list_parameter_0$schema = string();
@@ -5673,8 +5700,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5673
5700
  }));
5674
5701
  const _yadsh_dsh_qa_integrations_qaIntegrations_putBitrix24Credential_parameter_0$schema = string();
5675
5702
  const _yadsh_dsh_qa_integrations_qaIntegrations_putBitrix24Credential_parameter_1$schema = object({
5703
+ "instanceId": string().readonly(),
5676
5704
  "token": string().readonly(),
5677
- "options": record(string(), string()).readonly().readonly().optional()
5705
+ "useServiceCredential": union([
5706
+ _undefined(),
5707
+ literal(false),
5708
+ literal(true)
5709
+ ]).readonly().optional()
5678
5710
  });
5679
5711
  const _yadsh_dsh_qa_integrations_qaIntegrations_putBitrix24Credential_result$schema = object({
5680
5712
  "provider": string().readonly(),
@@ -5721,8 +5753,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5721
5753
  const _yadsh_dsh_qa_integrations_qaIntegrations_putConfluenceCredential_parameter_0$schema = string();
5722
5754
  const _yadsh_dsh_qa_integrations_qaIntegrations_putConfluenceCredential_parameter_1$schema = object({
5723
5755
  "instanceId": string().readonly(),
5724
- "email": string().readonly(),
5725
- "token": string().readonly()
5756
+ "email": union([_undefined(), string()]).readonly().optional(),
5757
+ "token": string().readonly(),
5758
+ "useServiceCredential": union([
5759
+ _undefined(),
5760
+ literal(false),
5761
+ literal(true)
5762
+ ]).readonly().optional()
5726
5763
  });
5727
5764
  const _yadsh_dsh_qa_integrations_qaIntegrations_putConfluenceCredential_result$schema = object({
5728
5765
  "provider": string().readonly(),
@@ -5821,8 +5858,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5821
5858
  const _yadsh_dsh_qa_integrations_qaIntegrations_putJiraCredential_parameter_0$schema = string();
5822
5859
  const _yadsh_dsh_qa_integrations_qaIntegrations_putJiraCredential_parameter_1$schema = object({
5823
5860
  "siteId": string().readonly(),
5824
- "email": string().readonly(),
5825
- "token": string().readonly()
5861
+ "email": union([_undefined(), string()]).readonly().optional(),
5862
+ "token": string().readonly(),
5863
+ "useServiceCredential": union([
5864
+ _undefined(),
5865
+ literal(false),
5866
+ literal(true)
5867
+ ]).readonly().optional()
5826
5868
  });
5827
5869
  const _yadsh_dsh_qa_integrations_qaIntegrations_putJiraCredential_result$schema = object({
5828
5870
  "provider": string().readonly(),
@@ -5920,7 +5962,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5920
5962
  const _yadsh_dsh_qa_integrations_qaIntegrations_putTestitCredential_parameter_0$schema = string();
5921
5963
  const _yadsh_dsh_qa_integrations_qaIntegrations_putTestitCredential_parameter_1$schema = object({
5922
5964
  "instanceId": string().readonly(),
5923
- "token": string().readonly()
5965
+ "token": string().readonly(),
5966
+ "useServiceCredential": union([
5967
+ _undefined(),
5968
+ literal(false),
5969
+ literal(true)
5970
+ ]).readonly().optional()
5924
5971
  });
5925
5972
  const _yadsh_dsh_qa_integrations_qaIntegrations_putTestitCredential_result$schema = object({
5926
5973
  "provider": string().readonly(),
@@ -5967,7 +6014,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5967
6014
  const _yadsh_dsh_qa_integrations_qaIntegrations_putWeblateCredential_parameter_0$schema = string();
5968
6015
  const _yadsh_dsh_qa_integrations_qaIntegrations_putWeblateCredential_parameter_1$schema = object({
5969
6016
  "instanceId": string().readonly(),
5970
- "token": string().readonly()
6017
+ "token": string().readonly(),
6018
+ "useServiceCredential": union([
6019
+ _undefined(),
6020
+ literal(false),
6021
+ literal(true)
6022
+ ]).readonly().optional()
5971
6023
  });
5972
6024
  const _yadsh_dsh_qa_integrations_qaIntegrations_putWeblateCredential_result$schema = object({
5973
6025
  "provider": string().readonly(),
@@ -6083,6 +6135,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6083
6135
  "id": string().readonly(),
6084
6136
  "label": string().readonly(),
6085
6137
  "baseUrl": string().readonly(),
6138
+ "deploymentType": union([
6139
+ _undefined(),
6140
+ literal("cloud"),
6141
+ literal("server")
6142
+ ]).readonly().optional(),
6086
6143
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
6087
6144
  })]);
6088
6145
  const _yadsh_dsh_qa_integrations_qaIntegrations_testBitrix24_parameter_0$schema = string();
@@ -6219,6 +6276,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6219
6276
  "id": string().readonly(),
6220
6277
  "label": string().readonly(),
6221
6278
  "baseUrl": string().readonly(),
6279
+ "deploymentType": union([
6280
+ _undefined(),
6281
+ literal("cloud"),
6282
+ literal("server")
6283
+ ]).readonly().optional(),
6222
6284
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
6223
6285
  }));
6224
6286
  const _yadsh_dsh_qa_integrations_qaIntegrations_testJira_parameter_0$schema = string();
@@ -6398,11 +6460,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6398
6460
  "id": string().readonly(),
6399
6461
  "label": string().readonly(),
6400
6462
  "baseUrl": string().readonly(),
6463
+ "deploymentType": union([
6464
+ _undefined(),
6465
+ literal("cloud"),
6466
+ literal("server")
6467
+ ]).readonly().optional(),
6401
6468
  "service": union([literal(null), object({ "label": string().readonly() })]).readonly()
6402
6469
  }));
6403
6470
  const TYPERT_REMOTE = {
6404
6471
  package: "@yadsh/dsh-qa-integrations",
6405
6472
  descriptors: [
6473
+ {
6474
+ id: "@yadsh/dsh-qa-integrations#qaIntegrations/bitrix24Instances",
6475
+ service: "qaIntegrations",
6476
+ namespace: "qaIntegrations",
6477
+ method: "bitrix24Instances",
6478
+ invocation: { kind: "direct" },
6479
+ parameters: [{
6480
+ name: "token",
6481
+ wire: "token",
6482
+ source: "json",
6483
+ codec: {
6484
+ mode: "strict",
6485
+ typeSymbol: "@yadsh/dsh-qa-integrations#qaIntegrations/bitrix24Instances:token",
6486
+ schema: _yadsh_dsh_qa_integrations_qaIntegrations_bitrix24Instances_parameter_0$schema
6487
+ }
6488
+ }],
6489
+ result: {
6490
+ mode: "strict",
6491
+ typeSymbol: "@yadsh/dsh-qa-integrations#qaIntegrations/bitrix24Instances:result",
6492
+ schema: _yadsh_dsh_qa_integrations_qaIntegrations_bitrix24Instances_result$schema
6493
+ },
6494
+ sourceLocation: {
6495
+ "file": "packages/dsh-qa-integrations/src/index.ts",
6496
+ "line": 500,
6497
+ "column": 3
6498
+ }
6499
+ },
6406
6500
  {
6407
6501
  id: "@yadsh/dsh-qa-integrations#qaIntegrations/confluenceSites",
6408
6502
  service: "qaIntegrations",
@@ -6426,7 +6520,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6426
6520
  },
6427
6521
  sourceLocation: {
6428
6522
  "file": "packages/dsh-qa-integrations/src/index.ts",
6429
- "line": 420,
6523
+ "line": 592,
6430
6524
  "column": 3
6431
6525
  }
6432
6526
  },
@@ -6462,7 +6556,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6462
6556
  },
6463
6557
  sourceLocation: {
6464
6558
  "file": "packages/dsh-qa-integrations/src/index.ts",
6465
- "line": 718,
6559
+ "line": 940,
6466
6560
  "column": 9
6467
6561
  }
6468
6562
  },
@@ -6480,7 +6574,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6480
6574
  },
6481
6575
  sourceLocation: {
6482
6576
  "file": "packages/dsh-qa-integrations/src/index.ts",
6483
- "line": 295,
6577
+ "line": 449,
6484
6578
  "column": 3
6485
6579
  }
6486
6580
  },
@@ -6507,7 +6601,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6507
6601
  },
6508
6602
  sourceLocation: {
6509
6603
  "file": "packages/dsh-qa-integrations/src/index.ts",
6510
- "line": 347,
6604
+ "line": 519,
6511
6605
  "column": 3
6512
6606
  }
6513
6607
  },
@@ -6534,7 +6628,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6534
6628
  },
6535
6629
  sourceLocation: {
6536
6630
  "file": "packages/dsh-qa-integrations/src/index.ts",
6537
- "line": 468,
6631
+ "line": 654,
6538
6632
  "column": 3
6539
6633
  }
6540
6634
  },
@@ -6561,7 +6655,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6561
6655
  },
6562
6656
  sourceLocation: {
6563
6657
  "file": "packages/dsh-qa-integrations/src/index.ts",
6564
- "line": 408,
6658
+ "line": 580,
6565
6659
  "column": 3
6566
6660
  }
6567
6661
  },
@@ -6588,7 +6682,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6588
6682
  },
6589
6683
  sourceLocation: {
6590
6684
  "file": "packages/dsh-qa-integrations/src/index.ts",
6591
- "line": 588,
6685
+ "line": 790,
6592
6686
  "column": 3
6593
6687
  }
6594
6688
  },
@@ -6615,7 +6709,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6615
6709
  },
6616
6710
  sourceLocation: {
6617
6711
  "file": "packages/dsh-qa-integrations/src/index.ts",
6618
- "line": 532,
6712
+ "line": 718,
6619
6713
  "column": 3
6620
6714
  }
6621
6715
  },
@@ -6642,7 +6736,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6642
6736
  },
6643
6737
  sourceLocation: {
6644
6738
  "file": "packages/dsh-qa-integrations/src/index.ts",
6645
- "line": 639,
6739
+ "line": 851,
6646
6740
  "column": 3
6647
6741
  }
6648
6742
  },
@@ -6669,7 +6763,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6669
6763
  },
6670
6764
  sourceLocation: {
6671
6765
  "file": "packages/dsh-qa-integrations/src/index.ts",
6672
- "line": 690,
6766
+ "line": 912,
6673
6767
  "column": 3
6674
6768
  }
6675
6769
  },
@@ -6696,7 +6790,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6696
6790
  },
6697
6791
  sourceLocation: {
6698
6792
  "file": "packages/dsh-qa-integrations/src/index.ts",
6699
- "line": 316,
6793
+ "line": 470,
6700
6794
  "column": 3
6701
6795
  }
6702
6796
  },
@@ -6723,7 +6817,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6723
6817
  },
6724
6818
  sourceLocation: {
6725
6819
  "file": "packages/dsh-qa-integrations/src/index.ts",
6726
- "line": 425,
6820
+ "line": 597,
6727
6821
  "column": 3
6728
6822
  }
6729
6823
  },
@@ -6750,7 +6844,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6750
6844
  },
6751
6845
  sourceLocation: {
6752
6846
  "file": "packages/dsh-qa-integrations/src/index.ts",
6753
- "line": 364,
6847
+ "line": 536,
6754
6848
  "column": 3
6755
6849
  }
6756
6850
  },
@@ -6777,7 +6871,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6777
6871
  },
6778
6872
  sourceLocation: {
6779
6873
  "file": "packages/dsh-qa-integrations/src/index.ts",
6780
- "line": 550,
6874
+ "line": 736,
6781
6875
  "column": 3
6782
6876
  }
6783
6877
  },
@@ -6804,7 +6898,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6804
6898
  },
6805
6899
  sourceLocation: {
6806
6900
  "file": "packages/dsh-qa-integrations/src/index.ts",
6807
- "line": 475,
6901
+ "line": 661,
6808
6902
  "column": 3
6809
6903
  }
6810
6904
  },
@@ -6831,7 +6925,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6831
6925
  },
6832
6926
  sourceLocation: {
6833
6927
  "file": "packages/dsh-qa-integrations/src/index.ts",
6834
- "line": 605,
6928
+ "line": 807,
6835
6929
  "column": 3
6836
6930
  }
6837
6931
  },
@@ -6858,7 +6952,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6858
6952
  },
6859
6953
  sourceLocation: {
6860
6954
  "file": "packages/dsh-qa-integrations/src/index.ts",
6861
- "line": 656,
6955
+ "line": 868,
6862
6956
  "column": 3
6863
6957
  }
6864
6958
  },
@@ -6885,7 +6979,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6885
6979
  },
6886
6980
  sourceLocation: {
6887
6981
  "file": "packages/dsh-qa-integrations/src/index.ts",
6888
- "line": 359,
6982
+ "line": 531,
6889
6983
  "column": 3
6890
6984
  }
6891
6985
  },
@@ -6912,7 +7006,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6912
7006
  },
6913
7007
  sourceLocation: {
6914
7008
  "file": "packages/dsh-qa-integrations/src/index.ts",
6915
- "line": 545,
7009
+ "line": 731,
6916
7010
  "column": 3
6917
7011
  }
6918
7012
  },
@@ -6939,7 +7033,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6939
7033
  },
6940
7034
  sourceLocation: {
6941
7035
  "file": "packages/dsh-qa-integrations/src/index.ts",
6942
- "line": 311,
7036
+ "line": 465,
6943
7037
  "column": 3
6944
7038
  }
6945
7039
  },
@@ -6966,7 +7060,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6966
7060
  },
6967
7061
  sourceLocation: {
6968
7062
  "file": "packages/dsh-qa-integrations/src/index.ts",
6969
- "line": 702,
7063
+ "line": 924,
6970
7064
  "column": 3
6971
7065
  }
6972
7066
  },
@@ -7002,7 +7096,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7002
7096
  },
7003
7097
  sourceLocation: {
7004
7098
  "file": "packages/dsh-qa-integrations/src/index.ts",
7005
- "line": 340,
7099
+ "line": 512,
7006
7100
  "column": 3
7007
7101
  }
7008
7102
  },
@@ -7038,7 +7132,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7038
7132
  },
7039
7133
  sourceLocation: {
7040
7134
  "file": "packages/dsh-qa-integrations/src/index.ts",
7041
- "line": 461,
7135
+ "line": 647,
7042
7136
  "column": 3
7043
7137
  }
7044
7138
  },
@@ -7074,7 +7168,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7074
7168
  },
7075
7169
  sourceLocation: {
7076
7170
  "file": "packages/dsh-qa-integrations/src/index.ts",
7077
- "line": 401,
7171
+ "line": 573,
7078
7172
  "column": 3
7079
7173
  }
7080
7174
  },
@@ -7110,7 +7204,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7110
7204
  },
7111
7205
  sourceLocation: {
7112
7206
  "file": "packages/dsh-qa-integrations/src/index.ts",
7113
- "line": 581,
7207
+ "line": 783,
7114
7208
  "column": 3
7115
7209
  }
7116
7210
  },
@@ -7146,7 +7240,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7146
7240
  },
7147
7241
  sourceLocation: {
7148
7242
  "file": "packages/dsh-qa-integrations/src/index.ts",
7149
- "line": 525,
7243
+ "line": 711,
7150
7244
  "column": 3
7151
7245
  }
7152
7246
  },
@@ -7182,7 +7276,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7182
7276
  },
7183
7277
  sourceLocation: {
7184
7278
  "file": "packages/dsh-qa-integrations/src/index.ts",
7185
- "line": 632,
7279
+ "line": 844,
7186
7280
  "column": 3
7187
7281
  }
7188
7282
  },
@@ -7218,7 +7312,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7218
7312
  },
7219
7313
  sourceLocation: {
7220
7314
  "file": "packages/dsh-qa-integrations/src/index.ts",
7221
- "line": 683,
7315
+ "line": 905,
7222
7316
  "column": 3
7223
7317
  }
7224
7318
  },
@@ -7245,7 +7339,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7245
7339
  },
7246
7340
  sourceLocation: {
7247
7341
  "file": "packages/dsh-qa-integrations/src/index.ts",
7248
- "line": 306,
7342
+ "line": 460,
7249
7343
  "column": 3
7250
7344
  }
7251
7345
  },
@@ -7270,7 +7364,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7270
7364
  source: "json",
7271
7365
  codec: {
7272
7366
  mode: "strict",
7273
- typeSymbol: "@yadsh/dsh-qa-integrations/types#CredentialInput",
7367
+ typeSymbol: "@yadsh/dsh-qa-integrations#qaIntegrations/putBitrix24Credential:input",
7274
7368
  schema: _yadsh_dsh_qa_integrations_qaIntegrations_putBitrix24Credential_parameter_1$schema
7275
7369
  }
7276
7370
  }],
@@ -7281,7 +7375,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7281
7375
  },
7282
7376
  sourceLocation: {
7283
7377
  "file": "packages/dsh-qa-integrations/src/index.ts",
7284
- "line": 323,
7378
+ "line": 477,
7285
7379
  "column": 9
7286
7380
  }
7287
7381
  },
@@ -7317,7 +7411,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7317
7411
  },
7318
7412
  sourceLocation: {
7319
7413
  "file": "packages/dsh-qa-integrations/src/index.ts",
7320
- "line": 437,
7414
+ "line": 612,
7321
7415
  "column": 9
7322
7416
  }
7323
7417
  },
@@ -7353,7 +7447,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7353
7447
  },
7354
7448
  sourceLocation: {
7355
7449
  "file": "packages/dsh-qa-integrations/src/index.ts",
7356
- "line": 371,
7450
+ "line": 543,
7357
7451
  "column": 9
7358
7452
  }
7359
7453
  },
@@ -7389,7 +7483,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7389
7483
  },
7390
7484
  sourceLocation: {
7391
7485
  "file": "packages/dsh-qa-integrations/src/index.ts",
7392
- "line": 557,
7486
+ "line": 743,
7393
7487
  "column": 9
7394
7488
  }
7395
7489
  },
@@ -7425,7 +7519,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7425
7519
  },
7426
7520
  sourceLocation: {
7427
7521
  "file": "packages/dsh-qa-integrations/src/index.ts",
7428
- "line": 488,
7522
+ "line": 674,
7429
7523
  "column": 9
7430
7524
  }
7431
7525
  },
@@ -7461,7 +7555,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7461
7555
  },
7462
7556
  sourceLocation: {
7463
7557
  "file": "packages/dsh-qa-integrations/src/index.ts",
7464
- "line": 612,
7558
+ "line": 814,
7465
7559
  "column": 9
7466
7560
  }
7467
7561
  },
@@ -7497,7 +7591,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7497
7591
  },
7498
7592
  sourceLocation: {
7499
7593
  "file": "packages/dsh-qa-integrations/src/index.ts",
7500
- "line": 663,
7594
+ "line": 875,
7501
7595
  "column": 9
7502
7596
  }
7503
7597
  },
@@ -7533,7 +7627,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7533
7627
  },
7534
7628
  sourceLocation: {
7535
7629
  "file": "packages/dsh-qa-integrations/src/index.ts",
7536
- "line": 736,
7630
+ "line": 958,
7537
7631
  "column": 3
7538
7632
  }
7539
7633
  },
@@ -7569,7 +7663,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7569
7663
  },
7570
7664
  sourceLocation: {
7571
7665
  "file": "packages/dsh-qa-integrations/src/index.ts",
7572
- "line": 757,
7666
+ "line": 979,
7573
7667
  "column": 3
7574
7668
  }
7575
7669
  },
@@ -7596,7 +7690,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7596
7690
  },
7597
7691
  sourceLocation: {
7598
7692
  "file": "packages/dsh-qa-integrations/src/index.ts",
7599
- "line": 513,
7693
+ "line": 699,
7600
7694
  "column": 3
7601
7695
  }
7602
7696
  },
@@ -7623,7 +7717,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7623
7717
  },
7624
7718
  sourceLocation: {
7625
7719
  "file": "packages/dsh-qa-integrations/src/index.ts",
7626
- "line": 333,
7720
+ "line": 505,
7627
7721
  "column": 9
7628
7722
  }
7629
7723
  },
@@ -7650,7 +7744,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7650
7744
  },
7651
7745
  sourceLocation: {
7652
7746
  "file": "packages/dsh-qa-integrations/src/index.ts",
7653
- "line": 454,
7747
+ "line": 640,
7654
7748
  "column": 9
7655
7749
  }
7656
7750
  },
@@ -7677,7 +7771,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7677
7771
  },
7678
7772
  sourceLocation: {
7679
7773
  "file": "packages/dsh-qa-integrations/src/index.ts",
7680
- "line": 394,
7774
+ "line": 566,
7681
7775
  "column": 9
7682
7776
  }
7683
7777
  },
@@ -7704,7 +7798,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7704
7798
  },
7705
7799
  sourceLocation: {
7706
7800
  "file": "packages/dsh-qa-integrations/src/index.ts",
7707
- "line": 600,
7801
+ "line": 802,
7708
7802
  "column": 3
7709
7803
  }
7710
7804
  },
@@ -7731,7 +7825,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7731
7825
  },
7732
7826
  sourceLocation: {
7733
7827
  "file": "packages/dsh-qa-integrations/src/index.ts",
7734
- "line": 574,
7828
+ "line": 776,
7735
7829
  "column": 9
7736
7830
  }
7737
7831
  },
@@ -7758,7 +7852,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7758
7852
  },
7759
7853
  sourceLocation: {
7760
7854
  "file": "packages/dsh-qa-integrations/src/index.ts",
7761
- "line": 518,
7855
+ "line": 704,
7762
7856
  "column": 9
7763
7857
  }
7764
7858
  },
@@ -7785,7 +7879,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7785
7879
  },
7786
7880
  sourceLocation: {
7787
7881
  "file": "packages/dsh-qa-integrations/src/index.ts",
7788
- "line": 625,
7882
+ "line": 837,
7789
7883
  "column": 9
7790
7884
  }
7791
7885
  },
@@ -7812,7 +7906,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7812
7906
  },
7813
7907
  sourceLocation: {
7814
7908
  "file": "packages/dsh-qa-integrations/src/index.ts",
7815
- "line": 676,
7909
+ "line": 898,
7816
7910
  "column": 9
7817
7911
  }
7818
7912
  },
@@ -7839,7 +7933,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7839
7933
  },
7840
7934
  sourceLocation: {
7841
7935
  "file": "packages/dsh-qa-integrations/src/index.ts",
7842
- "line": 651,
7936
+ "line": 863,
7843
7937
  "column": 3
7844
7938
  }
7845
7939
  }
@@ -8181,6 +8275,67 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8181
8275
  }) : null]
8182
8276
  });
8183
8277
  }
8278
+ function noop() {}
8279
+ /**
8280
+ * Inject one stylesheet tag for the plugin's card CSS. The tag carries
8281
+ * `data-plugin="<pluginName>"` and is guarded against double injection; the
8282
+ * returned disposer removes the tag when this call created it. No-op in
8283
+ * non-DOM environments (headless bundles, module probes).
8284
+ */
8285
+ function injectCardStyles(pluginName, css) {
8286
+ if (typeof document === "undefined") return noop;
8287
+ const selector = `style[data-plugin="${pluginName}"]`;
8288
+ if (typeof document.querySelector === "function" && document.querySelector(selector) !== null) return noop;
8289
+ const tag = document.createElement("style");
8290
+ tag.dataset.plugin = pluginName;
8291
+ tag.textContent = css;
8292
+ document.head.appendChild(tag);
8293
+ return () => {
8294
+ tag.remove();
8295
+ };
8296
+ }
8297
+ /**
8298
+ * Register the card component into the shared settings-plugins slot. Returns
8299
+ * the registration disposer. Use this variant when the plugin drives the
8300
+ * slot's inject-factory itself (e.g. to dispose a form controller alongside).
8301
+ */
8302
+ function registerSettingsSlot(host, options) {
8303
+ const slotOptions = {
8304
+ name: options.slotName ?? "settings.plugin.item",
8305
+ key: options.key,
8306
+ ...options.locale === void 0 ? {} : { locale: options.locale },
8307
+ ...options.inject === void 0 ? {} : { inject: options.inject }
8308
+ };
8309
+ return host.slots.register(slotOptions, options.component);
8310
+ }
8311
+ /**
8312
+ * Full bootstrap: inject {@link options.styles} once (when provided), then
8313
+ * mount the card into the settings-plugins slot. Returns a disposer removing
8314
+ * the slot effect and the injected stylesheet.
8315
+ */
8316
+ function registerSettingsCard(host, options) {
8317
+ const removeStyles = options.styles === void 0 || options.pluginName === void 0 ? void 0 : injectCardStyles(options.pluginName, options.styles);
8318
+ const slotName = options.slotName ?? "settings.plugin.item";
8319
+ const disposeEffect = host.slots.inject(slotName, () => registerSettingsSlot(host, options));
8320
+ return () => {
8321
+ disposeEffect();
8322
+ removeStyles?.();
8323
+ };
8324
+ }
8325
+ //#endregion
8326
+ //#region ../../packages/plugin-kit/lib/client/settings-store.js
8327
+ /**
8328
+ * React calls external-store callbacks as plain functions, while
8329
+ * SettingsScope's methods depend on their receiver. Forwarding the methods
8330
+ * directly loses `this` and crashes while reading the internal store, so
8331
+ * bind them through stable wrappers.
8332
+ */
8333
+ function bindSettingsExternalStore(scope) {
8334
+ return {
8335
+ subscribe: (listener) => scope.subscribe(listener),
8336
+ getSnapshot: () => scope.getSnapshot()
8337
+ };
8338
+ }
8184
8339
  //#endregion
8185
8340
  //#region src/client/copy.ts
8186
8341
  /**
@@ -8662,7 +8817,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8662
8817
  ProviderUnavailable: "Bitrix24 сейчас недоступен. Попробуйте позже.",
8663
8818
  IntegrationNotConnected: "Интеграция не подключена.",
8664
8819
  CredentialExpired: "Срок действия подключения истёк. Замените токен.",
8665
- CredentialRevoked: "Подключение больше не действует. Замените токен."
8820
+ CredentialRevoked: "Подключение больше не действует. Замените токен.",
8821
+ ServiceCredentialUnavailable: "Для этого портала администратор не настроил сервисный токен.",
8822
+ ServiceCredentialDisabled: "Сервисный токен этого портала отключён администратором.",
8823
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного портала. Сообщите администратору.",
8824
+ PersonalCredentialRequired: "Личный вебхук не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
8825
+ ServiceResourceNotAllowed: "Сервисный токен не работает на этом портале. Подключите личный аккаунт.",
8826
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
8827
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
8666
8828
  };
8667
8829
  function createBitrix24Card(remote) {
8668
8830
  return createProviderCard({
@@ -8672,54 +8834,142 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8672
8834
  errorCopy: ERROR_COPY$6,
8673
8835
  notGrantedText: "Нет разрешения Bitrix24",
8674
8836
  futurePermissions: ["Отправлять сообщения", "Изменять CRM"],
8675
- useExtra: () => void 0,
8676
- load: async ({ token, accept }) => {
8837
+ useExtra: () => {
8838
+ const [instances, setInstances] = (0, react.useState)([]);
8839
+ const [instanceId, setInstanceId] = (0, react.useState)("");
8840
+ return {
8841
+ instances,
8842
+ setInstances,
8843
+ instanceId,
8844
+ setInstanceId
8845
+ };
8846
+ },
8847
+ load: async ({ token, extra, accept, fail }) => {
8848
+ const list = await remote.bitrix24Instances(token);
8849
+ if (list.ok) {
8850
+ extra.setInstances(list.value);
8851
+ extra.setInstanceId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
8852
+ } else fail(list.error);
8677
8853
  accept(await remote.getBitrix24(token));
8678
8854
  },
8679
8855
  calls: {
8680
- save: (token, credential) => remote.putBitrix24Credential(token, { token: credential }),
8856
+ save: (token, credential, extra, options) => remote.putBitrix24Credential(token, {
8857
+ instanceId: extra.instanceId,
8858
+ token: credential,
8859
+ useServiceCredential: options.useServiceCredential
8860
+ }),
8681
8861
  test: (token) => remote.testBitrix24(token),
8682
8862
  patch: (token, patch) => remote.patchBitrix24Policy(token, patch),
8683
- disconnect: (token) => remote.disconnectBitrix24(token)
8863
+ disconnect: (token) => remote.disconnectBitrix24(token),
8864
+ setSource: (token, source) => remote.credentialSource(token, {
8865
+ provider: "bitrix24",
8866
+ source
8867
+ }),
8868
+ setBoundary: (token, selection) => remote.serviceBoundary(token, {
8869
+ provider: "bitrix24",
8870
+ selection
8871
+ })
8684
8872
  },
8685
- credentialSection: (state, help) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8686
- className: "dsh-qa-integrations__section",
8687
- children: [
8688
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8689
- className: "dsh-qa-integrations__field",
8690
- children: ["URL входящего вебхука Bitrix24", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8691
- className: "dsh-qa-integrations__input",
8692
- type: "password",
8693
- autoComplete: "new-password",
8694
- value: state.credential,
8695
- disabled: state.busy,
8696
- onChange: (event) => state.setCredential(event.currentTarget.value),
8697
- placeholder: "https://company.bitrix24.ru/rest/…"
8698
- })]
8699
- }),
8700
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
8701
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8702
- className: "dsh-qa-integrations__hint",
8703
- children: "Токен хранится в зашифрованном виде и после сохранения больше не отображается."
8704
- }),
8705
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8706
- className: "dsh-qa-integrations__actions",
8707
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8708
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
8709
- type: "button",
8710
- disabled: state.busy || state.credential.trim() === "",
8711
- onClick: state.save,
8712
- children: "Сохранить и проверить"
8713
- }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8714
- className: "dsh-qa-integrations__button",
8715
- type: "button",
8716
- disabled: state.busy,
8717
- onClick: state.cancelCredential,
8718
- children: "Отмена"
8719
- }) : null]
8720
- })
8721
- ]
8722
- })
8873
+ serviceBinding: (extra) => {
8874
+ if (extra.instanceId === "") return extra.instances.length === 1 ? extra.instances[0]?.service ?? null : null;
8875
+ return extra.instances.find((instance) => instance.id === extra.instanceId)?.service ?? null;
8876
+ },
8877
+ serviceDefault: async (token) => {
8878
+ const result = await remote.managedServiceCredentials(token);
8879
+ return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
8880
+ },
8881
+ credentialSection: (state, help) => {
8882
+ const { instances, instanceId } = state.extra;
8883
+ if (!(instances.length > 0)) return null;
8884
+ const needsChoice = instances.length > 1;
8885
+ const service = serviceConnectOption(state);
8886
+ const instancePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8887
+ className: "dsh-qa-integrations__field",
8888
+ children: ["Портал Bitrix24", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
8889
+ className: "dsh-qa-integrations__input",
8890
+ value: instanceId,
8891
+ disabled: state.busy,
8892
+ onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
8893
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
8894
+ value: "",
8895
+ children: "Выберите портал"
8896
+ }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
8897
+ value: instance.id,
8898
+ children: instance.label
8899
+ }, instance.id))]
8900
+ })]
8901
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8902
+ className: "dsh-qa-integrations__muted",
8903
+ children: ["Портал: ", instances[0]?.label ?? ""]
8904
+ });
8905
+ if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8906
+ className: "dsh-qa-integrations__section",
8907
+ children: [
8908
+ instancePicker,
8909
+ service,
8910
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8911
+ className: "dsh-qa-integrations__actions",
8912
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8913
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
8914
+ type: "button",
8915
+ disabled: state.busy || needsChoice && instanceId === "",
8916
+ onClick: state.save,
8917
+ children: "Подключить сервисный токен"
8918
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8919
+ className: "dsh-qa-integrations__button",
8920
+ type: "button",
8921
+ disabled: state.busy,
8922
+ onClick: state.cancelCredential,
8923
+ children: "Отмена"
8924
+ }) : null]
8925
+ })
8926
+ ]
8927
+ });
8928
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8929
+ className: "dsh-qa-integrations__section",
8930
+ children: [
8931
+ service,
8932
+ instancePicker,
8933
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8934
+ className: "dsh-qa-integrations__field",
8935
+ children: ["URL входящего вебхука Bitrix24", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8936
+ className: "dsh-qa-integrations__input",
8937
+ type: "password",
8938
+ autoComplete: "new-password",
8939
+ value: state.credential,
8940
+ disabled: state.busy,
8941
+ onChange: (event) => state.setCredential(event.currentTarget.value),
8942
+ placeholder: "https://company.bitrix24.ru/rest/…"
8943
+ })]
8944
+ }),
8945
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
8946
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8947
+ className: "dsh-qa-integrations__hint",
8948
+ children: "Токен хранится в зашифрованном виде и после сохранения больше не отображается."
8949
+ }),
8950
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8951
+ className: "dsh-qa-integrations__actions",
8952
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8953
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
8954
+ type: "button",
8955
+ disabled: state.busy || state.credential.trim() === "" || needsChoice && instanceId === "",
8956
+ onClick: state.save,
8957
+ children: "Сохранить и проверить"
8958
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8959
+ className: "dsh-qa-integrations__button",
8960
+ type: "button",
8961
+ disabled: state.busy,
8962
+ onClick: state.cancelCredential,
8963
+ children: "Отмена"
8964
+ }) : null]
8965
+ })
8966
+ ]
8967
+ });
8968
+ },
8969
+ notConfiguredHint: (state) => state.extra.instances.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8970
+ className: "dsh-qa-integrations__hint",
8971
+ children: "Оператор не настроил ни одного портала Bitrix24, подключать нечего."
8972
+ }) : null
8723
8973
  });
8724
8974
  }
8725
8975
  //#endregion
@@ -8734,411 +8984,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8734
8984
  ResourceNotFound: "Confluence не нашёл страницу или аккаунт её не видит.",
8735
8985
  RateLimited: "Слишком много запросов. Попробуйте позже.",
8736
8986
  ResultTooLarge: "Ответ Confluence слишком большой для одного запроса.",
8737
- OperationDeniedByPolicy: "Пространство вне списка, разрешённого оператором стенда."
8987
+ OperationDeniedByPolicy: "Пространство вне списка, разрешённого оператором стенда.",
8988
+ ServiceCredentialUnavailable: "Для этого сайта администратор не настроил сервисный токен.",
8989
+ ServiceCredentialDisabled: "Сервисный токен этого сайта отключён администратором.",
8990
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного сайта. Сообщите администратору.",
8991
+ PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
8992
+ ServiceResourceNotAllowed: "Сервисный режим читает только пространства из списка доступа. Сузьте запрос или подключите личный аккаунт.",
8993
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
8994
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
8738
8995
  };
8739
8996
  function createConfluenceCard(remote) {
8740
- return function ConfluenceCard({ token, help }) {
8741
- const [sites, setSites] = (0, react.useState)([]);
8742
- const [summary, setSummary] = (0, react.useState)();
8743
- const [instanceId, setInstanceId] = (0, react.useState)("");
8744
- const [email, setEmail] = (0, react.useState)("");
8745
- const [credential, setCredential] = (0, react.useState)("");
8746
- const [busy, setBusy] = (0, react.useState)(false);
8747
- const [error, setError] = (0, react.useState)(null);
8748
- const [replace, setReplace] = (0, react.useState)(false);
8749
- const [confirmDisconnect, setConfirmDisconnect] = (0, react.useState)(false);
8750
- const fail = (0, react.useCallback)((cause) => {
8751
- setError(failureCopy(ERROR_COPY$5, cause));
8752
- }, []);
8753
- const accept = (0, react.useCallback)((result) => {
8754
- if (result.ok) {
8755
- setSummary(result.value);
8756
- setError(null);
8757
- return true;
8758
- }
8759
- fail(result.error);
8760
- return false;
8761
- }, [fail]);
8762
- const load = (0, react.useCallback)(async () => {
8763
- try {
8764
- const list = await remote.confluenceSites(token);
8765
- if (list.ok) {
8766
- setSites(list.value);
8767
- setInstanceId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
8768
- } else fail(list.error);
8769
- accept(await remote.getConfluence(token));
8770
- } catch (cause) {
8771
- fail(cause);
8772
- }
8773
- }, [
8774
- accept,
8775
- fail,
8776
- token
8777
- ]);
8778
- (0, react.useEffect)(() => {
8779
- load();
8780
- }, [load]);
8781
- const save = async () => {
8782
- setBusy(true);
8783
- try {
8784
- if (accept(await remote.putConfluenceCredential(token, {
8785
- instanceId,
8786
- email,
8787
- token: credential
8788
- }))) {
8789
- setCredential("");
8790
- setEmail("");
8791
- setReplace(false);
8792
- }
8793
- } catch (cause) {
8794
- fail(cause);
8795
- } finally {
8796
- setBusy(false);
8797
- }
8798
- };
8799
- const test = async () => {
8800
- setBusy(true);
8801
- try {
8802
- accept(await remote.testConfluence(token));
8803
- } catch (cause) {
8804
- fail(cause);
8805
- } finally {
8806
- setBusy(false);
8807
- }
8808
- };
8809
- const patch = async (capability, allowed) => {
8810
- setBusy(true);
8811
- try {
8812
- accept(await remote.patchConfluencePolicy(token, {
8813
- operation: capability,
8814
- mode: allowed ? "allow" : "deny"
8815
- }));
8816
- } catch (cause) {
8817
- fail(cause);
8818
- } finally {
8819
- setBusy(false);
8820
- }
8821
- };
8822
- const disconnect = async () => {
8823
- setBusy(true);
8824
- try {
8825
- const result = await remote.disconnectConfluence(token);
8826
- if (result.ok) {
8827
- setSummary(void 0);
8828
- setConfirmDisconnect(false);
8829
- await load();
8830
- } else fail(result.error);
8831
- } catch (cause) {
8832
- fail(cause);
8833
- } finally {
8834
- setBusy(false);
8835
- }
8836
- };
8837
- const connected = summary?.status !== "not_connected" && summary !== void 0;
8838
- const showCredential = !connected || replace;
8839
- const configured = sites.length > 0;
8840
- const needsChoice = configured && sites.length > 1;
8841
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
8842
- className: "dsh-qa-integrations__card",
8843
- children: [
8844
- error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8845
- className: "dsh-qa-integrations__error",
8846
- role: "alert",
8847
- children: error
8848
- }),
8849
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8850
- className: "dsh-qa-integrations__card-head",
8851
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
8852
- className: "dsh-qa-integrations__provider",
8853
- children: "Confluence"
8854
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8855
- className: "dsh-qa-integrations__portal",
8856
- children: summary?.portal ?? "База знаний и документация вашей команды"
8857
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8858
- className: `dsh-qa-integrations__status${summary?.status === "connected" ? " dsh-qa-integrations__status--ok" : ""}`,
8859
- children: summary?.status === "connected" ? "Подключено" : summary?.status === "error" ? "Нужна проверка" : "Не подключено"
8860
- })]
8861
- }),
8862
- connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8863
- className: "dsh-qa-integrations__section",
8864
- children: [
8865
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: summary.externalAccountName ?? "Пользователь Atlassian" }),
8866
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8867
- className: "dsh-qa-integrations__muted",
8868
- children: ["Последняя успешная проверка: ", dateTime(summary.lastValidatedAt)]
8869
- }),
8870
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8871
- className: "dsh-qa-integrations__muted",
8872
- children: ["Токен настроен · обновлён ", dateTime(summary.credentialUpdatedAt)]
8873
- })
8874
- ]
8875
- }) : null,
8876
- showCredential && configured ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8877
- className: "dsh-qa-integrations__section",
8878
- children: [
8879
- needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8880
- className: "dsh-qa-integrations__field",
8881
- children: ["Сайт Confluence", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
8882
- className: "dsh-qa-integrations__input",
8883
- value: instanceId,
8884
- disabled: busy,
8885
- onChange: (event) => setInstanceId(event.currentTarget.value),
8886
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
8887
- value: "",
8888
- children: "Выберите сайт"
8889
- }), sites.map((site) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
8890
- value: site.id,
8891
- children: site.label
8892
- }, site.id))]
8893
- })]
8894
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8895
- className: "dsh-qa-integrations__muted",
8896
- children: ["Сайт: ", sites[0]?.label ?? ""]
8897
- }),
8898
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8899
- className: "dsh-qa-integrations__field",
8900
- children: ["Почта аккаунта Atlassian", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8901
- className: "dsh-qa-integrations__input",
8902
- type: "email",
8903
- autoComplete: "off",
8904
- value: email,
8905
- disabled: busy,
8906
- onChange: (event) => setEmail(event.currentTarget.value),
8907
- placeholder: "user@example.com"
8908
- })]
8909
- }),
8910
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8911
- className: "dsh-qa-integrations__field",
8912
- children: ["Atlassian API token", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8913
- className: "dsh-qa-integrations__input",
8914
- type: "password",
8915
- autoComplete: "new-password",
8916
- value: credential,
8917
- disabled: busy,
8918
- onChange: (event) => setCredential(event.currentTarget.value),
8919
- placeholder: "ATATT…"
8920
- })]
8921
- }),
8922
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
8923
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8924
- className: "dsh-qa-integrations__hint",
8925
- children: "Почта и токен хранятся в зашифрованном виде и после сохранения больше не отображаются."
8926
- }),
8927
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8928
- className: "dsh-qa-integrations__actions",
8929
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8930
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
8931
- type: "button",
8932
- disabled: busy || credential.trim() === "" || email.trim() === "" || needsChoice && instanceId === "",
8933
- onClick: () => void save(),
8934
- children: "Сохранить и проверить"
8935
- }), connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8936
- className: "dsh-qa-integrations__button",
8937
- type: "button",
8938
- disabled: busy,
8939
- onClick: () => {
8940
- setCredential("");
8941
- setEmail("");
8942
- setReplace(false);
8943
- },
8944
- children: "Отмена"
8945
- }) : null]
8946
- })
8947
- ]
8948
- }) : null,
8949
- !configured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8950
- className: "dsh-qa-integrations__hint",
8951
- children: "Оператор не настроил ни одного сайта Confluence, подключать нечего."
8952
- }) : null,
8953
- connected && !showCredential ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8954
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8955
- className: "dsh-qa-integrations__section",
8956
- children: [
8957
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", { children: "Доступ агента" }),
8958
- Object.entries(summary.capabilityInfo).map(([capability, info]) => {
8959
- const granted = summary.capabilities.includes(capability);
8960
- const mode = summary.policy.find((entry) => entry.capability === capability)?.mode;
8961
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8962
- className: "dsh-qa-integrations__permission",
8963
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8964
- type: "checkbox",
8965
- checked: mode === "allow",
8966
- disabled: busy || !granted,
8967
- onChange: (event) => void patch(capability, event.currentTarget.checked)
8968
- }), info.label] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8969
- className: "dsh-qa-integrations__muted",
8970
- title: info.hint,
8971
- children: granted ? "Доступно" : "Выключено оператором стенда"
8972
- })]
8973
- }, capability);
8974
- }),
8975
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8976
- className: "dsh-qa-integrations__permission",
8977
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8978
- type: "checkbox",
8979
- disabled: true
8980
- }), " Создание и правка страниц, комментарии на запись"] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8981
- className: "dsh-qa-integrations__muted",
8982
- children: "Появится позже"
8983
- })]
8984
- })
8985
- ]
8986
- }),
8987
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8988
- className: "dsh-qa-integrations__actions",
8989
- children: [
8990
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8991
- className: "dsh-qa-integrations__button",
8992
- type: "button",
8993
- disabled: busy,
8994
- onClick: () => void test(),
8995
- children: "Проверить"
8996
- }),
8997
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8998
- className: "dsh-qa-integrations__button",
8999
- type: "button",
9000
- disabled: busy,
9001
- onClick: () => setReplace(true),
9002
- children: "Заменить токен"
9003
- }),
9004
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9005
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--danger",
9006
- type: "button",
9007
- disabled: busy,
9008
- onClick: () => setConfirmDisconnect(true),
9009
- children: "Отключить"
9010
- })
9011
- ]
9012
- }),
9013
- confirmDisconnect ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9014
- className: "dsh-qa-integrations__notice",
9015
- role: "alertdialog",
9016
- "aria-label": "Подтверждение отключения Confluence",
9017
- children: ["Отключить Confluence и удалить сохранённый токен?", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9018
- className: "dsh-qa-integrations__actions",
9019
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9020
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--danger",
9021
- type: "button",
9022
- disabled: busy,
9023
- onClick: () => void disconnect(),
9024
- children: "Да, отключить"
9025
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9026
- className: "dsh-qa-integrations__button",
9027
- type: "button",
9028
- disabled: busy,
9029
- onClick: () => setConfirmDisconnect(false),
9030
- children: "Отмена"
9031
- })]
9032
- })]
9033
- }) : null
9034
- ] }) : null
9035
- ]
9036
- });
9037
- };
9038
- }
9039
- //#endregion
9040
- //#region src/client/gitlab.tsx
9041
- const ERROR_COPY$4 = {
9042
- PrincipalNotResolved: "Сессия истекла. Войдите заново.",
9043
- InvalidCredential: "Проверьте personal access token и выбранный инстанс.",
9044
- ProviderPermissionDenied: "GitLab не разрешил это действие: проверьте права токена.",
9045
- ProviderUnavailable: "GitLab сейчас недоступен. Попробуйте позже.",
9046
- IntegrationNotConnected: "Интеграция не подключена.",
9047
- CredentialExpired: "Срок действия токена истёк. Создайте новый токен.",
9048
- CredentialRevoked: "GitLab отклонил токен. Создайте новый и замените его.",
9049
- ResourceNotFound: "GitLab не нашёл ресурс или токен его не видит.",
9050
- RateLimited: "Слишком много запросов. Попробуйте позже.",
9051
- ResultTooLarge: "Ответ GitLab слишком большой для одного запроса.",
9052
- UpstreamTimeout: "GitLab не ответил вовремя. Попробуйте ещё раз.",
9053
- TlsFailure: "Сертификат GitLab не принят стендом. Нужен сертификат, которому доверяет сервер.",
9054
- ServiceCredentialUnavailable: "Для этого инстанса администратор не настроил сервисный токен.",
9055
- ServiceCredentialDisabled: "Сервисный токен этого инстанса отключён администратором.",
9056
- ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного инстанса. Сообщите администратору.",
9057
- PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
9058
- ServiceResourceNotAllowed: "Сервисный токен не даёт доступа к этому проекту. Сузьте доступ в списке или подключите личный аккаунт.",
9059
- SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
9060
- OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
9061
- };
9062
- function createGitlabCard(remote) {
8997
+ const credentialSource = remote.credentialSource;
8998
+ const serviceBoundary = remote.serviceBoundary;
8999
+ const managedServiceCredentials = remote.managedServiceCredentials;
9063
9000
  return createProviderCard({
9064
- title: "GitLab",
9065
- portalFallback: "Issues, merge requests и CI вашего GitLab",
9066
- accountFallback: "Пользователь GitLab",
9067
- errorCopy: ERROR_COPY$4,
9068
- notGrantedText: "Нет в правах токена",
9069
- futurePermissions: ["Комментарии, задачи и MR на запись"],
9001
+ title: "Confluence",
9002
+ portalFallback: "База знаний и документация вашей команды",
9003
+ accountFallback: "Пользователь Atlassian",
9004
+ errorCopy: ERROR_COPY$5,
9005
+ notGrantedText: "Выключено оператором стенда",
9006
+ futurePermissions: ["Создание и правка страниц, комментарии на запись"],
9070
9007
  useExtra: () => {
9071
- const [instances, setInstances] = (0, react.useState)([]);
9008
+ const [sites, setSites] = (0, react.useState)([]);
9072
9009
  const [instanceId, setInstanceId] = (0, react.useState)("");
9010
+ const [email, setEmail] = (0, react.useState)("");
9073
9011
  return {
9074
- instances,
9075
- setInstances,
9012
+ sites,
9013
+ setSites,
9076
9014
  instanceId,
9077
- setInstanceId
9015
+ setInstanceId,
9016
+ email,
9017
+ setEmail
9078
9018
  };
9079
9019
  },
9080
9020
  load: async ({ token, extra, accept, fail }) => {
9081
- const list = await remote.gitlabInstances(token);
9021
+ const list = await remote.confluenceSites(token);
9082
9022
  if (list.ok) {
9083
- extra.setInstances(list.value);
9023
+ extra.setSites(list.value);
9084
9024
  extra.setInstanceId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
9085
9025
  } else fail(list.error);
9086
- accept(await remote.getGitlab(token));
9026
+ accept(await remote.getConfluence(token));
9087
9027
  },
9088
9028
  calls: {
9089
- save: (token, credential, extra, options) => remote.putGitlabCredential(token, {
9090
- instanceId: extra.instanceId,
9091
- token: credential,
9092
- useServiceCredential: options.useServiceCredential
9093
- }),
9094
- test: (token) => remote.testGitlab(token),
9095
- patch: (token, patch) => remote.patchGitlabPolicy(token, patch),
9096
- disconnect: (token) => remote.disconnectGitlab(token),
9097
- setSource: (token, source) => remote.credentialSource(token, {
9098
- provider: "gitlab",
9029
+ save: (token, credential, extra, options) => {
9030
+ const email = extra.email;
9031
+ return remote.putConfluenceCredential(token, {
9032
+ instanceId: extra.instanceId,
9033
+ ...email.trim() === "" ? {} : { email },
9034
+ token: credential,
9035
+ ...options.useServiceCredential ? { useServiceCredential: true } : {}
9036
+ });
9037
+ },
9038
+ test: (token) => remote.testConfluence(token),
9039
+ patch: (token, patch) => remote.patchConfluencePolicy(token, patch),
9040
+ disconnect: (token) => remote.disconnectConfluence(token),
9041
+ setSource: credentialSource === void 0 ? void 0 : (token, source) => credentialSource(token, {
9042
+ provider: "confluence",
9099
9043
  source
9100
9044
  }),
9101
- setBoundary: (token, selection) => remote.serviceBoundary(token, {
9102
- provider: "gitlab",
9045
+ setBoundary: serviceBoundary === void 0 ? void 0 : (token, selection) => serviceBoundary(token, {
9046
+ provider: "confluence",
9103
9047
  selection
9104
9048
  })
9105
9049
  },
9106
9050
  serviceBinding: (extra) => {
9107
- if (extra.instanceId === "") return extra.instances.length === 1 ? extra.instances[0]?.service ?? null : null;
9108
- return extra.instances.find((instance) => instance.id === extra.instanceId)?.service ?? null;
9051
+ if (extra.instanceId === "") return extra.sites.length === 1 ? extra.sites[0]?.service ?? null : null;
9052
+ return extra.sites.find((site) => site.id === extra.instanceId)?.service ?? null;
9109
9053
  },
9110
- serviceDefault: async (token) => {
9111
- const result = await remote.managedServiceCredentials(token);
9112
- return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
9054
+ serviceDefault: managedServiceCredentials === void 0 ? void 0 : async (token) => {
9055
+ const result = await managedServiceCredentials(token);
9056
+ return result.ok && result.value.enabled && result.value.defaultForNewConnections;
9113
9057
  },
9114
9058
  credentialSection: (state, help) => {
9115
- const { instances, instanceId } = state.extra;
9116
- if (!(instances.length > 0)) return null;
9117
- const needsChoice = instances.length > 1;
9059
+ const { sites, instanceId, email } = state.extra;
9060
+ if (!(sites.length > 0)) return null;
9061
+ const needsChoice = sites.length > 1;
9118
9062
  const service = serviceConnectOption(state);
9119
- const instancePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9063
+ const server = (instanceId === "" ? sites.length === 1 ? sites[0] : void 0 : sites.find((site) => site.id === instanceId))?.deploymentType === "server";
9064
+ const sitePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9120
9065
  className: "dsh-qa-integrations__field",
9121
- children: ["Инстанс GitLab", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9066
+ children: ["Сайт Confluence", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9122
9067
  className: "dsh-qa-integrations__input",
9123
9068
  value: instanceId,
9124
9069
  disabled: state.busy,
9125
9070
  onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9126
9071
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9127
9072
  value: "",
9128
- children: "Выберите инстанс"
9129
- }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9130
- value: instance.id,
9131
- children: instance.label
9132
- }, instance.id))]
9073
+ children: "Выберите сайт"
9074
+ }), sites.map((site) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9075
+ value: site.id,
9076
+ children: site.label
9077
+ }, site.id))]
9133
9078
  })]
9134
9079
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9135
9080
  className: "dsh-qa-integrations__muted",
9136
- children: ["Инстанс: ", instances[0]?.label ?? ""]
9081
+ children: ["Сайт: ", sites[0]?.label ?? ""]
9082
+ });
9083
+ const deployment = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9084
+ className: "dsh-qa-integrations__muted",
9085
+ children: ["Развёртывание: ", server ? "Server / Data Center" : "Atlassian Cloud"]
9137
9086
  });
9138
9087
  if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9139
9088
  className: "dsh-qa-integrations__section",
9140
9089
  children: [
9141
- instancePicker,
9090
+ sitePicker,
9091
+ deployment,
9142
9092
  service,
9143
9093
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9144
9094
  className: "dsh-qa-integrations__actions",
@@ -9162,30 +9112,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9162
9112
  className: "dsh-qa-integrations__section",
9163
9113
  children: [
9164
9114
  service,
9165
- instancePicker,
9115
+ sitePicker,
9116
+ deployment,
9117
+ server ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9118
+ className: "dsh-qa-integrations__field",
9119
+ children: ["Почта аккаунта Atlassian", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9120
+ className: "dsh-qa-integrations__input",
9121
+ type: "email",
9122
+ autoComplete: "off",
9123
+ value: email,
9124
+ disabled: state.busy,
9125
+ onChange: (event) => state.extra.setEmail(event.currentTarget.value),
9126
+ placeholder: "user@example.com"
9127
+ })]
9128
+ }),
9166
9129
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9167
9130
  className: "dsh-qa-integrations__field",
9168
- children: ["Personal access token GitLab", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9131
+ children: [server ? "Личный токен доступа (PAT)" : "Atlassian API token", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9169
9132
  className: "dsh-qa-integrations__input",
9170
9133
  type: "password",
9171
9134
  autoComplete: "new-password",
9172
9135
  value: state.credential,
9173
9136
  disabled: state.busy,
9174
9137
  onChange: (event) => state.setCredential(event.currentTarget.value),
9175
- placeholder: "glpat-…"
9138
+ placeholder: server ? "Вставьте личный токен доступа" : "ATATT…"
9176
9139
  })]
9177
9140
  }),
9178
9141
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
9179
9142
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9180
9143
  className: "dsh-qa-integrations__hint",
9181
- children: "Токен хранится в зашифрованном виде и после сохранения больше не отображается."
9144
+ children: server ? "Токен хранится в зашифрованном виде и после сохранения не отображается." : "Почта и токен хранятся в зашифрованном виде и после сохранения больше не отображаются."
9182
9145
  }),
9183
9146
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9184
9147
  className: "dsh-qa-integrations__actions",
9185
9148
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9186
9149
  className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9187
9150
  type: "button",
9188
- disabled: state.busy || state.credential.trim() === "" || needsChoice && instanceId === "",
9151
+ disabled: state.busy || state.credential.trim() === "" || !server && email.trim() === "" || needsChoice && instanceId === "",
9189
9152
  onClick: state.save,
9190
9153
  children: "Сохранить и проверить"
9191
9154
  }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -9201,329 +9164,387 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9201
9164
  },
9202
9165
  notConfiguredHint: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9203
9166
  className: "dsh-qa-integrations__hint",
9204
- children: "Оператор не настроил ни одного инстанса GitLab, подключать нечего."
9167
+ children: "Оператор не настроил ни одного сайта Confluence, подключать нечего."
9205
9168
  })
9206
9169
  });
9207
9170
  }
9208
9171
  //#endregion
9209
- //#region src/client/jira.tsx
9210
- const ERROR_COPY$3 = {
9172
+ //#region src/client/gitlab.tsx
9173
+ const ERROR_COPY$4 = {
9211
9174
  PrincipalNotResolved: "Сессия истекла. Войдите заново.",
9212
- InvalidCredential: "Проверьте API-токен, e-mail аккаунта Atlassian и выбранный сайт.",
9213
- ProviderPermissionDenied: "Jira не разрешил это действие: задача, проект или поле закрыты правами вашего аккаунта.",
9214
- ProviderUnavailable: "Jira недоступна с этого стенда. Проверьте адрес сайта, заданный оператором, и сетевую доступность.",
9175
+ InvalidCredential: "Проверьте personal access token и выбранный инстанс.",
9176
+ ProviderPermissionDenied: "GitLab не разрешил это действие: проверьте права токена.",
9177
+ ProviderUnavailable: "GitLab сейчас недоступен. Попробуйте позже.",
9215
9178
  IntegrationNotConnected: "Интеграция не подключена.",
9216
9179
  CredentialExpired: "Срок действия токена истёк. Создайте новый токен.",
9217
- CredentialRevoked: "Jira отклонила токен. Создайте новый API-токен и замените его.",
9218
- ResourceNotFound: "Jira не нашла ресурс или ваш аккаунт его не видит.",
9219
- RateLimited: "Слишком много запросов к Jira. Попробуйте позже.",
9220
- ResultTooLarge: "Ответ Jira слишком большой для одного запроса.",
9221
- UpstreamTimeout: "Jira не ответила вовремя. Попробуйте ещё раз.",
9222
- TlsFailure: "Сертификат сайта Jira не принят стендом. Нужен сертификат, которому доверяет сервер."
9180
+ CredentialRevoked: "GitLab отклонил токен. Создайте новый и замените его.",
9181
+ ResourceNotFound: "GitLab не нашёл ресурс или токен его не видит.",
9182
+ RateLimited: "Слишком много запросов. Попробуйте позже.",
9183
+ ResultTooLarge: "Ответ GitLab слишком большой для одного запроса.",
9184
+ UpstreamTimeout: "GitLab не ответил вовремя. Попробуйте ещё раз.",
9185
+ TlsFailure: "Сертификат GitLab не принят стендом. Нужен сертификат, которому доверяет сервер.",
9186
+ ServiceCredentialUnavailable: "Для этого инстанса администратор не настроил сервисный токен.",
9187
+ ServiceCredentialDisabled: "Сервисный токен этого инстанса отключён администратором.",
9188
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного инстанса. Сообщите администратору.",
9189
+ PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
9190
+ ServiceResourceNotAllowed: "Сервисный токен не даёт доступа к этому проекту. Сузьте доступ в списке или подключите личный аккаунт.",
9191
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
9192
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
9223
9193
  };
9224
- function createJiraCard(remote) {
9225
- return function JiraCard({ token, help }) {
9226
- const [sites, setSites] = (0, react.useState)([]);
9227
- const [summary, setSummary] = (0, react.useState)();
9228
- const [siteId, setSiteId] = (0, react.useState)("");
9229
- const [email, setEmail] = (0, react.useState)("");
9230
- const [credential, setCredential] = (0, react.useState)("");
9231
- const [busy, setBusy] = (0, react.useState)(false);
9232
- const [error, setError] = (0, react.useState)(null);
9233
- const [replace, setReplace] = (0, react.useState)(false);
9234
- const [confirmDisconnect, setConfirmDisconnect] = (0, react.useState)(false);
9235
- const fail = (0, react.useCallback)((cause) => {
9236
- setError(failureCopy(ERROR_COPY$3, cause));
9237
- }, []);
9238
- const accept = (0, react.useCallback)((result) => {
9239
- if (result.ok) {
9240
- setSummary(result.value);
9241
- setError(null);
9242
- return true;
9243
- }
9244
- fail(result.error);
9245
- return false;
9246
- }, [fail]);
9247
- const load = (0, react.useCallback)(async () => {
9248
- try {
9249
- const list = await remote.jiraSites(token);
9250
- if (list.ok) {
9251
- setSites(list.value);
9252
- setSiteId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
9253
- } else fail(list.error);
9254
- accept(await remote.getJira(token));
9255
- } catch (cause) {
9256
- fail(cause);
9257
- }
9258
- }, [
9259
- accept,
9260
- fail,
9261
- token
9262
- ]);
9263
- (0, react.useEffect)(() => {
9264
- load();
9265
- }, [load]);
9266
- const save = async () => {
9267
- setBusy(true);
9268
- try {
9269
- if (accept(await remote.putJiraCredential(token, {
9270
- siteId,
9271
- email,
9272
- token: credential
9273
- }))) {
9274
- setCredential("");
9275
- setEmail("");
9276
- setReplace(false);
9277
- }
9278
- } catch (cause) {
9279
- fail(cause);
9280
- } finally {
9281
- setBusy(false);
9282
- }
9283
- };
9284
- const test = async () => {
9285
- setBusy(true);
9286
- try {
9287
- accept(await remote.testJira(token));
9288
- } catch (cause) {
9289
- fail(cause);
9290
- } finally {
9291
- setBusy(false);
9292
- }
9293
- };
9294
- const patch = async (capability, allowed) => {
9295
- setBusy(true);
9296
- try {
9297
- accept(await remote.patchJiraPolicy(token, {
9298
- operation: capability,
9299
- mode: allowed ? "allow" : "deny"
9300
- }));
9301
- } catch (cause) {
9302
- fail(cause);
9303
- } finally {
9304
- setBusy(false);
9305
- }
9306
- };
9307
- const disconnect = async () => {
9308
- setBusy(true);
9309
- try {
9310
- const result = await remote.disconnectJira(token);
9311
- if (result.ok) {
9312
- setSummary(void 0);
9313
- setConfirmDisconnect(false);
9314
- await load();
9315
- } else fail(result.error);
9316
- } catch (cause) {
9317
- fail(cause);
9318
- } finally {
9319
- setBusy(false);
9320
- }
9321
- };
9322
- const connected = summary?.status !== "not_connected" && summary !== void 0;
9323
- const showCredential = !connected || replace;
9324
- const configured = sites.length > 0;
9325
- const needsChoice = configured && sites.length > 1;
9326
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
9327
- className: "dsh-qa-integrations__card",
9328
- children: [
9329
- error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9330
- className: "dsh-qa-integrations__error",
9331
- role: "alert",
9332
- children: error
9333
- }),
9334
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9335
- className: "dsh-qa-integrations__card-head",
9336
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
9337
- className: "dsh-qa-integrations__provider",
9338
- children: "Jira"
9339
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9340
- className: "dsh-qa-integrations__portal",
9341
- children: summary?.portal ?? "Задачи, комментарии и вложения вашей Jira"
9342
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9343
- className: `dsh-qa-integrations__status${summary?.status === "connected" ? " dsh-qa-integrations__status--ok" : ""}`,
9344
- children: summary?.status === "connected" ? "Подключено" : summary?.status === "error" ? "Нужна проверка" : "Не подключено"
9345
- })]
9346
- }),
9347
- connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9348
- className: "dsh-qa-integrations__section",
9349
- children: [
9350
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: summary.externalAccountName ?? "Пользователь Jira" }),
9351
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9352
- className: "dsh-qa-integrations__muted",
9353
- children: ["Последняя успешная проверка: ", dateTime(summary.lastValidatedAt)]
9354
- }),
9355
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9356
- className: "dsh-qa-integrations__muted",
9357
- children: ["Токен настроен · обновлён ", dateTime(summary.credentialUpdatedAt)]
9358
- })
9359
- ]
9360
- }) : null,
9361
- showCredential && configured ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9362
- className: "dsh-qa-integrations__section",
9363
- children: [
9364
- needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9365
- className: "dsh-qa-integrations__field",
9366
- children: ["Сайт Jira", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9367
- className: "dsh-qa-integrations__input",
9368
- value: siteId,
9369
- disabled: busy,
9370
- onChange: (event) => setSiteId(event.currentTarget.value),
9371
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9372
- value: "",
9373
- children: "Выберите сайт"
9374
- }), sites.map((site) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9375
- value: site.id,
9376
- children: site.label
9377
- }, site.id))]
9378
- })]
9379
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9380
- className: "dsh-qa-integrations__muted",
9381
- children: [
9382
- "Сайт: ",
9383
- sites[0]?.label ?? "",
9384
- " — задан оператором стенда"
9385
- ]
9386
- }),
9387
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9388
- className: "dsh-qa-integrations__field",
9389
- children: ["Аккаунт Atlassian (e-mail)", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9390
- className: "dsh-qa-integrations__input",
9391
- type: "email",
9392
- autoComplete: "off",
9393
- value: email,
9394
- disabled: busy,
9395
- onChange: (event) => setEmail(event.currentTarget.value),
9396
- placeholder: "ivan@example.com"
9397
- })]
9398
- }),
9399
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9400
- className: "dsh-qa-integrations__field",
9401
- children: ["API-токен Jira", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9402
- className: "dsh-qa-integrations__input",
9403
- type: "password",
9404
- autoComplete: "new-password",
9405
- value: credential,
9406
- disabled: busy,
9407
- onChange: (event) => setCredential(event.currentTarget.value),
9408
- placeholder: "ATATT…"
9409
- })]
9410
- }),
9411
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
9412
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9413
- className: "dsh-qa-integrations__hint",
9414
- children: "Токен и e-mail хранятся в зашифрованном виде и после сохранения не отображаются."
9415
- }),
9416
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9417
- className: "dsh-qa-integrations__actions",
9418
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9419
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9420
- type: "button",
9421
- disabled: busy || credential.trim() === "" || email.trim() === "" || needsChoice && siteId === "",
9422
- onClick: () => void save(),
9423
- children: "Сохранить и проверить"
9424
- }), connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9425
- className: "dsh-qa-integrations__button",
9426
- type: "button",
9427
- disabled: busy,
9428
- onClick: () => {
9429
- setCredential("");
9430
- setEmail("");
9431
- setReplace(false);
9432
- },
9433
- children: "Отмена"
9434
- }) : null]
9435
- })
9436
- ]
9437
- }) : null,
9438
- !configured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9439
- className: "dsh-qa-integrations__hint",
9440
- children: "Оператор не настроил ни одного сайта Jira, подключать нечего. Адреса сайтов задаются в конфигурации развёртывания."
9441
- }) : null,
9442
- connected && !showCredential ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
9194
+ function createGitlabCard(remote) {
9195
+ return createProviderCard({
9196
+ title: "GitLab",
9197
+ portalFallback: "Issues, merge requests и CI вашего GitLab",
9198
+ accountFallback: "Пользователь GitLab",
9199
+ errorCopy: ERROR_COPY$4,
9200
+ notGrantedText: "Нет в правах токена",
9201
+ futurePermissions: ["Комментарии, задачи и MR на запись"],
9202
+ useExtra: () => {
9203
+ const [instances, setInstances] = (0, react.useState)([]);
9204
+ const [instanceId, setInstanceId] = (0, react.useState)("");
9205
+ return {
9206
+ instances,
9207
+ setInstances,
9208
+ instanceId,
9209
+ setInstanceId
9210
+ };
9211
+ },
9212
+ load: async ({ token, extra, accept, fail }) => {
9213
+ const list = await remote.gitlabInstances(token);
9214
+ if (list.ok) {
9215
+ extra.setInstances(list.value);
9216
+ extra.setInstanceId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
9217
+ } else fail(list.error);
9218
+ accept(await remote.getGitlab(token));
9219
+ },
9220
+ calls: {
9221
+ save: (token, credential, extra, options) => remote.putGitlabCredential(token, {
9222
+ instanceId: extra.instanceId,
9223
+ token: credential,
9224
+ useServiceCredential: options.useServiceCredential
9225
+ }),
9226
+ test: (token) => remote.testGitlab(token),
9227
+ patch: (token, patch) => remote.patchGitlabPolicy(token, patch),
9228
+ disconnect: (token) => remote.disconnectGitlab(token),
9229
+ setSource: (token, source) => remote.credentialSource(token, {
9230
+ provider: "gitlab",
9231
+ source
9232
+ }),
9233
+ setBoundary: (token, selection) => remote.serviceBoundary(token, {
9234
+ provider: "gitlab",
9235
+ selection
9236
+ })
9237
+ },
9238
+ serviceBinding: (extra) => {
9239
+ if (extra.instanceId === "") return extra.instances.length === 1 ? extra.instances[0]?.service ?? null : null;
9240
+ return extra.instances.find((instance) => instance.id === extra.instanceId)?.service ?? null;
9241
+ },
9242
+ serviceDefault: async (token) => {
9243
+ const result = await remote.managedServiceCredentials(token);
9244
+ return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
9245
+ },
9246
+ credentialSection: (state, help) => {
9247
+ const { instances, instanceId } = state.extra;
9248
+ if (!(instances.length > 0)) return null;
9249
+ const needsChoice = instances.length > 1;
9250
+ const service = serviceConnectOption(state);
9251
+ const instancePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9252
+ className: "dsh-qa-integrations__field",
9253
+ children: ["Инстанс GitLab", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9254
+ className: "dsh-qa-integrations__input",
9255
+ value: instanceId,
9256
+ disabled: state.busy,
9257
+ onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9258
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9259
+ value: "",
9260
+ children: "Выберите инстанс"
9261
+ }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9262
+ value: instance.id,
9263
+ children: instance.label
9264
+ }, instance.id))]
9265
+ })]
9266
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9267
+ className: "dsh-qa-integrations__muted",
9268
+ children: ["Инстанс: ", instances[0]?.label ?? ""]
9269
+ });
9270
+ if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9271
+ className: "dsh-qa-integrations__section",
9272
+ children: [
9273
+ instancePicker,
9274
+ service,
9443
9275
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9444
- className: "dsh-qa-integrations__section",
9445
- children: [
9446
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", { children: "Доступ агента" }),
9447
- Object.entries(summary.capabilityInfo).map(([capability, info]) => {
9448
- const granted = summary.capabilities.includes(capability);
9449
- const mode = summary.policy.find((entry) => entry.capability === capability)?.mode;
9450
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9451
- className: "dsh-qa-integrations__permission",
9452
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9453
- type: "checkbox",
9454
- checked: mode === "allow",
9455
- disabled: busy || !granted,
9456
- onChange: (event) => void patch(capability, event.currentTarget.checked)
9457
- }), info.label] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9458
- className: "dsh-qa-integrations__muted",
9459
- title: info.hint,
9460
- children: granted ? "Доступно" : "Выключено оператором стенда"
9461
- })]
9462
- }, capability);
9463
- }),
9464
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9465
- className: "dsh-qa-integrations__permission",
9466
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9467
- type: "checkbox",
9468
- disabled: true
9469
- }), " Создание и правка задач, комментарии, переходы"] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9470
- className: "dsh-qa-integrations__muted",
9471
- children: "Появится позже"
9472
- })]
9473
- })
9474
- ]
9276
+ className: "dsh-qa-integrations__actions",
9277
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9278
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9279
+ type: "button",
9280
+ disabled: state.busy || needsChoice && instanceId === "",
9281
+ onClick: state.save,
9282
+ children: "Подключить сервисный токен"
9283
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9284
+ className: "dsh-qa-integrations__button",
9285
+ type: "button",
9286
+ disabled: state.busy,
9287
+ onClick: state.cancelCredential,
9288
+ children: "Отмена"
9289
+ }) : null]
9290
+ })
9291
+ ]
9292
+ });
9293
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9294
+ className: "dsh-qa-integrations__section",
9295
+ children: [
9296
+ service,
9297
+ instancePicker,
9298
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9299
+ className: "dsh-qa-integrations__field",
9300
+ children: ["Personal access token GitLab", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9301
+ className: "dsh-qa-integrations__input",
9302
+ type: "password",
9303
+ autoComplete: "new-password",
9304
+ value: state.credential,
9305
+ disabled: state.busy,
9306
+ onChange: (event) => state.setCredential(event.currentTarget.value),
9307
+ placeholder: "glpat-…"
9308
+ })]
9309
+ }),
9310
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
9311
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9312
+ className: "dsh-qa-integrations__hint",
9313
+ children: "Токен хранится в зашифрованном виде и после сохранения больше не отображается."
9475
9314
  }),
9476
9315
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9477
9316
  className: "dsh-qa-integrations__actions",
9478
- children: [
9479
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9480
- className: "dsh-qa-integrations__button",
9481
- type: "button",
9482
- disabled: busy,
9483
- onClick: () => void test(),
9484
- children: "Проверить"
9485
- }),
9486
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9487
- className: "dsh-qa-integrations__button",
9488
- type: "button",
9489
- disabled: busy,
9490
- onClick: () => setReplace(true),
9491
- children: "Заменить токен"
9492
- }),
9493
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9494
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--danger",
9495
- type: "button",
9496
- disabled: busy,
9497
- onClick: () => setConfirmDisconnect(true),
9498
- children: "Отключить"
9499
- })
9500
- ]
9317
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9318
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9319
+ type: "button",
9320
+ disabled: state.busy || state.credential.trim() === "" || needsChoice && instanceId === "",
9321
+ onClick: state.save,
9322
+ children: "Сохранить и проверить"
9323
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9324
+ className: "dsh-qa-integrations__button",
9325
+ type: "button",
9326
+ disabled: state.busy,
9327
+ onClick: state.cancelCredential,
9328
+ children: "Отмена"
9329
+ }) : null]
9330
+ })
9331
+ ]
9332
+ });
9333
+ },
9334
+ notConfiguredHint: (state) => state.extra.instances.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9335
+ className: "dsh-qa-integrations__hint",
9336
+ children: "Оператор не настроил ни одного инстанса GitLab, подключать нечего."
9337
+ }) : null
9338
+ });
9339
+ }
9340
+ //#endregion
9341
+ //#region src/client/jira.tsx
9342
+ const ERROR_COPY$3 = {
9343
+ PrincipalNotResolved: "Сессия истекла. Войдите заново.",
9344
+ InvalidCredential: "Проверьте API-токен, e-mail аккаунта Atlassian и выбранный сайт.",
9345
+ ProviderPermissionDenied: "Jira не разрешил это действие: задача, проект или поле закрыты правами вашего аккаунта.",
9346
+ ProviderUnavailable: "Jira недоступна с этого стенда. Проверьте адрес сайта, заданный оператором, и сетевую доступность.",
9347
+ IntegrationNotConnected: "Интеграция не подключена.",
9348
+ CredentialExpired: "Срок действия токена истёк. Создайте новый токен.",
9349
+ CredentialRevoked: "Jira отклонила токен. Создайте новый API-токен и замените его.",
9350
+ ResourceNotFound: "Jira не нашла ресурс или ваш аккаунт его не видит.",
9351
+ RateLimited: "Слишком много запросов к Jira. Попробуйте позже.",
9352
+ ResultTooLarge: "Ответ Jira слишком большой для одного запроса.",
9353
+ UpstreamTimeout: "Jira не ответила вовремя. Попробуйте ещё раз.",
9354
+ TlsFailure: "Сертификат сайта Jira не принят стендом. Нужен сертификат, которому доверяет сервер.",
9355
+ ServiceCredentialUnavailable: "Для этого сайта администратор не настроил сервисный токен.",
9356
+ ServiceCredentialDisabled: "Сервисный токен этого сайта отключён администратором.",
9357
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного сайта. Сообщите администратору.",
9358
+ PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
9359
+ ServiceResourceNotAllowed: "Сервисный токен не даёт доступа к этому проекту. Сузьте доступ в списке или подключите личный аккаунт.",
9360
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
9361
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
9362
+ };
9363
+ function createJiraCard(remote) {
9364
+ return createProviderCard({
9365
+ title: "Jira",
9366
+ portalFallback: "Задачи, комментарии и вложения вашей Jira",
9367
+ accountFallback: "Пользователь Jira",
9368
+ errorCopy: ERROR_COPY$3,
9369
+ notGrantedText: "Выключено оператором стенда",
9370
+ futurePermissions: ["Создание и правка задач, комментарии, переходы"],
9371
+ useExtra: () => {
9372
+ const [sites, setSites] = (0, react.useState)([]);
9373
+ const [siteId, setSiteId] = (0, react.useState)("");
9374
+ const [email, setEmail] = (0, react.useState)("");
9375
+ return {
9376
+ sites,
9377
+ setSites,
9378
+ siteId,
9379
+ setSiteId,
9380
+ email,
9381
+ setEmail
9382
+ };
9383
+ },
9384
+ load: async ({ token, extra, accept, fail }) => {
9385
+ const list = await remote.jiraSites(token);
9386
+ if (list.ok) {
9387
+ extra.setSites(list.value);
9388
+ extra.setSiteId(list.value.length === 1 ? list.value[0]?.id ?? "" : "");
9389
+ } else fail(list.error);
9390
+ accept(await remote.getJira(token));
9391
+ },
9392
+ calls: {
9393
+ save: (token, credential, extra, options) => {
9394
+ const email = extra.email;
9395
+ return remote.putJiraCredential(token, {
9396
+ siteId: extra.siteId,
9397
+ ...email.trim() === "" ? {} : { email },
9398
+ token: credential,
9399
+ useServiceCredential: options.useServiceCredential || void 0
9400
+ });
9401
+ },
9402
+ test: (token) => remote.testJira(token),
9403
+ patch: (token, patch) => remote.patchJiraPolicy(token, patch),
9404
+ disconnect: (token) => remote.disconnectJira(token),
9405
+ setSource: (token, source) => {
9406
+ const call = remote.credentialSource;
9407
+ if (call === void 0) return Promise.reject(/* @__PURE__ */ new Error("This deployment does not offer service mode for Jira"));
9408
+ return call(token, {
9409
+ provider: "jira",
9410
+ source
9411
+ });
9412
+ },
9413
+ setBoundary: (token, selection) => {
9414
+ const call = remote.serviceBoundary;
9415
+ if (call === void 0) return Promise.reject(/* @__PURE__ */ new Error("This deployment does not offer service mode for Jira"));
9416
+ return call(token, {
9417
+ provider: "jira",
9418
+ selection
9419
+ });
9420
+ }
9421
+ },
9422
+ serviceBinding: (extra) => {
9423
+ if (extra.siteId === "") return extra.sites.length === 1 ? extra.sites[0]?.service ?? null : null;
9424
+ return extra.sites.find((site) => site.id === extra.siteId)?.service ?? null;
9425
+ },
9426
+ serviceDefault: async (token) => {
9427
+ const call = remote.managedServiceCredentials;
9428
+ if (call === void 0) return false;
9429
+ const result = await call(token);
9430
+ return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
9431
+ },
9432
+ credentialSection: (state, help) => {
9433
+ const { sites, siteId, email } = state.extra;
9434
+ if (!(sites.length > 0)) return null;
9435
+ const needsChoice = sites.length > 1;
9436
+ const service = serviceConnectOption(state);
9437
+ const server = (siteId === "" ? sites.length === 1 ? sites[0] : void 0 : sites.find((site) => site.id === siteId))?.deploymentType === "server";
9438
+ const sitePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9439
+ className: "dsh-qa-integrations__field",
9440
+ children: ["Сайт Jira", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9441
+ className: "dsh-qa-integrations__input",
9442
+ value: siteId,
9443
+ disabled: state.busy,
9444
+ onChange: (event) => state.extra.setSiteId(event.currentTarget.value),
9445
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9446
+ value: "",
9447
+ children: "Выберите сайт"
9448
+ }), sites.map((site) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9449
+ value: site.id,
9450
+ children: site.label
9451
+ }, site.id))]
9452
+ })]
9453
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9454
+ className: "dsh-qa-integrations__muted",
9455
+ children: [
9456
+ "Сайт: ",
9457
+ sites[0]?.label ?? "",
9458
+ " — задан оператором стенда"
9459
+ ]
9460
+ });
9461
+ const deployment = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9462
+ className: "dsh-qa-integrations__muted",
9463
+ children: ["Развёртывание: ", server ? "Server / Data Center" : "Atlassian Cloud"]
9464
+ });
9465
+ if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9466
+ className: "dsh-qa-integrations__section",
9467
+ children: [
9468
+ sitePicker,
9469
+ deployment,
9470
+ service,
9471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9472
+ className: "dsh-qa-integrations__actions",
9473
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9474
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9475
+ type: "button",
9476
+ disabled: state.busy || needsChoice && siteId === "",
9477
+ onClick: state.save,
9478
+ children: "Подключить сервисный токен"
9479
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9480
+ className: "dsh-qa-integrations__button",
9481
+ type: "button",
9482
+ disabled: state.busy,
9483
+ onClick: state.cancelCredential,
9484
+ children: "Отмена"
9485
+ }) : null]
9486
+ })
9487
+ ]
9488
+ });
9489
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9490
+ className: "dsh-qa-integrations__section",
9491
+ children: [
9492
+ service,
9493
+ sitePicker,
9494
+ deployment,
9495
+ server ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9496
+ className: "dsh-qa-integrations__field",
9497
+ children: ["Аккаунт Atlassian (e-mail)", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9498
+ className: "dsh-qa-integrations__input",
9499
+ type: "email",
9500
+ autoComplete: "off",
9501
+ value: email,
9502
+ disabled: state.busy,
9503
+ onChange: (event) => state.extra.setEmail(event.currentTarget.value),
9504
+ placeholder: "ivan@example.com"
9505
+ })]
9501
9506
  }),
9502
- confirmDisconnect ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9503
- className: "dsh-qa-integrations__notice",
9504
- role: "alertdialog",
9505
- "aria-label": "Подтверждение отключения Jira",
9506
- children: ["Отключить Jira и удалить сохранённый токен?", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9507
- className: "dsh-qa-integrations__actions",
9508
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9509
- className: "dsh-qa-integrations__button dsh-qa-integrations__button--danger",
9510
- type: "button",
9511
- disabled: busy,
9512
- onClick: () => void disconnect(),
9513
- children: "Да, отключить"
9514
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9515
- className: "dsh-qa-integrations__button",
9516
- type: "button",
9517
- disabled: busy,
9518
- onClick: () => setConfirmDisconnect(false),
9519
- children: "Отмена"
9520
- })]
9507
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9508
+ className: "dsh-qa-integrations__field",
9509
+ children: [server ? "Личный токен доступа (PAT)" : "API-токен Jira", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9510
+ className: "dsh-qa-integrations__input",
9511
+ type: "password",
9512
+ autoComplete: "new-password",
9513
+ value: state.credential,
9514
+ disabled: state.busy,
9515
+ onChange: (event) => state.setCredential(event.currentTarget.value),
9516
+ placeholder: server ? "Вставьте личный токен доступа" : "ATATT…"
9521
9517
  })]
9522
- }) : null
9523
- ] }) : null
9524
- ]
9525
- });
9526
- };
9518
+ }),
9519
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpNote, { help }),
9520
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9521
+ className: "dsh-qa-integrations__hint",
9522
+ children: server ? "Токен хранится в зашифрованном виде и после сохранения не отображается." : "Токен и e-mail хранятся в зашифрованном виде и после сохранения не отображаются."
9523
+ }),
9524
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9525
+ className: "dsh-qa-integrations__actions",
9526
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9527
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9528
+ type: "button",
9529
+ disabled: state.busy || state.credential.trim() === "" || !server && email.trim() === "" || needsChoice && siteId === "",
9530
+ onClick: state.save,
9531
+ children: "Сохранить и проверить"
9532
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9533
+ className: "dsh-qa-integrations__button",
9534
+ type: "button",
9535
+ disabled: state.busy,
9536
+ onClick: state.cancelCredential,
9537
+ children: "Отмена"
9538
+ }) : null]
9539
+ })
9540
+ ]
9541
+ });
9542
+ },
9543
+ notConfiguredHint: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9544
+ className: "dsh-qa-integrations__hint",
9545
+ children: "Оператор не настроил ни одного сайта Jira, подключать нечего. Адреса сайтов задаются в конфигурации развёртывания."
9546
+ })
9547
+ });
9527
9548
  }
9528
9549
  //#endregion
9529
9550
  //#region src/client/teamcity.tsx
@@ -9689,7 +9710,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9689
9710
  RateLimited: "Слишком много запросов. Попробуйте позже.",
9690
9711
  ResultTooLarge: "Ответ Test IT слишком большой для одного запроса. Сузьте фильтр или лимит.",
9691
9712
  UpstreamTimeout: "Test IT не ответил вовремя. Попробуйте ещё раз.",
9692
- TlsFailure: "Сертификат Test IT не принят стендом. Нужен сертификат, которому доверяет сервер."
9713
+ TlsFailure: "Сертификат Test IT не принят стендом. Нужен сертификат, которому доверяет сервер.",
9714
+ ServiceCredentialUnavailable: "Для этой инсталляции администратор не настроил сервисный токен.",
9715
+ ServiceCredentialDisabled: "Сервисный токен этой инсталляции отключён администратором.",
9716
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранной инсталляции. Сообщите администратору.",
9717
+ PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
9718
+ ServiceResourceNotAllowed: "Сервисный токен не даёт доступа к этому проекту. Сузьте доступ в списке или подключите личный аккаунт.",
9719
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
9720
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
9693
9721
  };
9694
9722
  function createTestitCard(remote) {
9695
9723
  return createProviderCard({
@@ -9718,40 +9746,83 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9718
9746
  accept(await remote.getTestit(token));
9719
9747
  },
9720
9748
  calls: {
9721
- save: (token, credential, extra) => remote.putTestitCredential(token, {
9749
+ save: (token, credential, extra, options) => remote.putTestitCredential(token, {
9722
9750
  instanceId: extra.instanceId,
9723
- token: credential
9751
+ token: credential,
9752
+ useServiceCredential: options.useServiceCredential
9724
9753
  }),
9725
9754
  test: (token) => remote.testTestit(token),
9726
9755
  patch: (token, patch) => remote.patchTestitPolicy(token, patch),
9727
- disconnect: (token) => remote.disconnectTestit(token)
9756
+ disconnect: (token) => remote.disconnectTestit(token),
9757
+ setSource: (token, source) => remote.credentialSource(token, {
9758
+ provider: "testit",
9759
+ source
9760
+ }),
9761
+ setBoundary: (token, selection) => remote.serviceBoundary(token, {
9762
+ provider: "testit",
9763
+ selection
9764
+ })
9765
+ },
9766
+ serviceBinding: (extra) => {
9767
+ if (extra.instanceId === "") return extra.instances.length === 1 ? extra.instances[0]?.service ?? null : null;
9768
+ return extra.instances.find((instance) => instance.id === extra.instanceId)?.service ?? null;
9769
+ },
9770
+ serviceDefault: async (token) => {
9771
+ const result = await remote.managedServiceCredentials(token);
9772
+ return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
9728
9773
  },
9729
9774
  credentialSection: (state, help) => {
9730
9775
  const { instances, instanceId } = state.extra;
9731
9776
  if (!(instances.length > 0)) return null;
9732
9777
  const needsChoice = instances.length > 1;
9733
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9778
+ const service = serviceConnectOption(state);
9779
+ const instancePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9780
+ className: "dsh-qa-integrations__field",
9781
+ children: ["Инсталляция Test IT", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9782
+ className: "dsh-qa-integrations__input",
9783
+ value: instanceId,
9784
+ disabled: state.busy,
9785
+ onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9786
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9787
+ value: "",
9788
+ children: "Выберите инсталляцию"
9789
+ }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9790
+ value: instance.id,
9791
+ children: instance.label
9792
+ }, instance.id))]
9793
+ })]
9794
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9795
+ className: "dsh-qa-integrations__muted",
9796
+ children: ["Инсталляция: ", instances[0]?.label ?? ""]
9797
+ });
9798
+ if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9734
9799
  className: "dsh-qa-integrations__section",
9735
9800
  children: [
9736
- needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9737
- className: "dsh-qa-integrations__field",
9738
- children: ["Инсталляция Test IT", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9739
- className: "dsh-qa-integrations__input",
9740
- value: instanceId,
9801
+ instancePicker,
9802
+ service,
9803
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9804
+ className: "dsh-qa-integrations__actions",
9805
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9806
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9807
+ type: "button",
9808
+ disabled: state.busy || needsChoice && instanceId === "",
9809
+ onClick: state.save,
9810
+ children: "Подключить сервисный токен"
9811
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9812
+ className: "dsh-qa-integrations__button",
9813
+ type: "button",
9741
9814
  disabled: state.busy,
9742
- onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9743
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9744
- value: "",
9745
- children: "Выберите инсталляцию"
9746
- }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9747
- value: instance.id,
9748
- children: instance.label
9749
- }, instance.id))]
9750
- })]
9751
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9752
- className: "dsh-qa-integrations__muted",
9753
- children: ["Инсталляция: ", instances[0]?.label ?? ""]
9754
- }),
9815
+ onClick: state.cancelCredential,
9816
+ children: "Отмена"
9817
+ }) : null]
9818
+ })
9819
+ ]
9820
+ });
9821
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9822
+ className: "dsh-qa-integrations__section",
9823
+ children: [
9824
+ service,
9825
+ instancePicker,
9755
9826
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9756
9827
  className: "dsh-qa-integrations__field",
9757
9828
  children: ["API-токен Test IT", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
@@ -9808,7 +9879,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9808
9879
  RateLimited: "Слишком много запросов. Попробуйте позже.",
9809
9880
  ResultTooLarge: "Ответ Weblate слишком большой для одного запроса.",
9810
9881
  UpstreamTimeout: "Weblate не ответил вовремя. Попробуйте ещё раз.",
9811
- TlsFailure: "Сертификат Weblate не принят стендом. Нужен сертификат, которому доверяет сервер."
9882
+ TlsFailure: "Сертификат Weblate не принят стендом. Нужен сертификат, которому доверяет сервер.",
9883
+ ServiceCredentialUnavailable: "Для этого инстанса администратор не настроил сервисный токен.",
9884
+ ServiceCredentialDisabled: "Сервисный токен этого инстанса отключён администратором.",
9885
+ ServiceCredentialInvalid: "Сервисный токен не подходит для выбранного инстанса. Сообщите администратору.",
9886
+ PersonalCredentialRequired: "Личный токен не сохранён: подключите его, чтобы вернуться к личному аккаунту.",
9887
+ ServiceResourceNotAllowed: "Сервисный токен не даёт доступа к этому проекту. Сузьте доступ в списке или подключите личный аккаунт.",
9888
+ SensitiveReadRequiresPersonalCredential: "Эта операция может содержать личные или чувствительные данные. Подключите личный аккаунт, чтобы использовать её.",
9889
+ OperationNotAllowedWithServiceCredential: "Сервисный режим — только безопасное чтение: изменения недоступны."
9812
9890
  };
9813
9891
  function createWeblateCard(remote) {
9814
9892
  return createProviderCard({
@@ -9842,40 +9920,83 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9842
9920
  accept(await remote.getWeblate(token));
9843
9921
  },
9844
9922
  calls: {
9845
- save: (token, credential, extra) => remote.putWeblateCredential(token, {
9923
+ save: (token, credential, extra, options) => remote.putWeblateCredential(token, {
9846
9924
  instanceId: extra.instanceId,
9847
- token: credential
9925
+ token: credential,
9926
+ useServiceCredential: options.useServiceCredential
9848
9927
  }),
9849
9928
  test: (token) => remote.testWeblate(token),
9850
9929
  patch: (token, patch) => remote.patchWeblatePolicy(token, patch),
9851
- disconnect: (token) => remote.disconnectWeblate(token)
9930
+ disconnect: (token) => remote.disconnectWeblate(token),
9931
+ setSource: (token, source) => remote.credentialSource(token, {
9932
+ provider: "weblate",
9933
+ source
9934
+ }),
9935
+ setBoundary: (token, selection) => remote.serviceBoundary(token, {
9936
+ provider: "weblate",
9937
+ selection
9938
+ })
9939
+ },
9940
+ serviceBinding: (extra) => {
9941
+ if (extra.instanceId === "") return extra.instances.length === 1 ? extra.instances[0]?.service ?? null : null;
9942
+ return extra.instances.find((instance) => instance.id === extra.instanceId)?.service ?? null;
9943
+ },
9944
+ serviceDefault: async (token) => {
9945
+ const result = await remote.managedServiceCredentials(token);
9946
+ return result.ok ? result.value.enabled && result.value.defaultForNewConnections : false;
9852
9947
  },
9853
9948
  credentialSection: (state, help) => {
9854
9949
  const { instances, instanceId } = state.extra;
9855
9950
  if (!(instances.length > 0)) return null;
9856
9951
  const needsChoice = instances.length > 1;
9857
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9952
+ const service = serviceConnectOption(state);
9953
+ const instancePicker = needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9954
+ className: "dsh-qa-integrations__field",
9955
+ children: ["Инстанс Weblate", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9956
+ className: "dsh-qa-integrations__input",
9957
+ value: instanceId,
9958
+ disabled: state.busy,
9959
+ onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9960
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9961
+ value: "",
9962
+ children: "Выберите инстанс"
9963
+ }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9964
+ value: instance.id,
9965
+ children: instance.label
9966
+ }, instance.id))]
9967
+ })]
9968
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9969
+ className: "dsh-qa-integrations__muted",
9970
+ children: ["Инстанс: ", instances[0]?.label ?? ""]
9971
+ });
9972
+ if (state.useService) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9858
9973
  className: "dsh-qa-integrations__section",
9859
9974
  children: [
9860
- needsChoice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9861
- className: "dsh-qa-integrations__field",
9862
- children: ["Инстанс Weblate", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
9863
- className: "dsh-qa-integrations__input",
9864
- value: instanceId,
9975
+ instancePicker,
9976
+ service,
9977
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9978
+ className: "dsh-qa-integrations__actions",
9979
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9980
+ className: "dsh-qa-integrations__button dsh-qa-integrations__button--primary",
9981
+ type: "button",
9982
+ disabled: state.busy || needsChoice && instanceId === "",
9983
+ onClick: state.save,
9984
+ children: "Подключить сервисный токен"
9985
+ }), state.connected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9986
+ className: "dsh-qa-integrations__button",
9987
+ type: "button",
9865
9988
  disabled: state.busy,
9866
- onChange: (event) => state.extra.setInstanceId(event.currentTarget.value),
9867
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9868
- value: "",
9869
- children: "Выберите инстанс"
9870
- }), instances.map((instance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
9871
- value: instance.id,
9872
- children: instance.label
9873
- }, instance.id))]
9874
- })]
9875
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9876
- className: "dsh-qa-integrations__muted",
9877
- children: ["Инстанс: ", instances[0]?.label ?? ""]
9878
- }),
9989
+ onClick: state.cancelCredential,
9990
+ children: "Отмена"
9991
+ }) : null]
9992
+ })
9993
+ ]
9994
+ });
9995
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9996
+ className: "dsh-qa-integrations__section",
9997
+ children: [
9998
+ service,
9999
+ instancePicker,
9879
10000
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
9880
10001
  className: "dsh-qa-integrations__field",
9881
10002
  children: ["API-токен Weblate", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
@@ -10024,55 +10145,1944 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10024
10145
  });
10025
10146
  };
10026
10147
  }
10027
- //#endregion
10028
- //#region src/client/card.tsx
10029
- /** What the card shows while no QA account is signed in. */
10030
- function gateCopy(stage) {
10031
- switch (stage) {
10032
- case "checking": return "Проверяем вход в QA Surface…";
10033
- case "anonymous": return "Войдите в QA Surface, чтобы подключать свои сервисы: подключение принадлежит вашему аккаунту, а не стенду.";
10034
- default: return "";
10148
+ //#endregion
10149
+ //#region src/client/card.tsx
10150
+ /** What the card shows while no QA account is signed in. */
10151
+ function gateCopy(stage) {
10152
+ switch (stage) {
10153
+ case "checking": return "Проверяем вход в QA Surface…";
10154
+ case "anonymous": return "Войдите в QA Surface, чтобы подключать свои сервисы: подключение принадлежит вашему аккаунту, а не стенду.";
10155
+ default: return "";
10156
+ }
10157
+ }
10158
+ /**
10159
+ * The Integrations card shown inside the plugin-owned host settings tab.
10160
+ *
10161
+ * A connection belongs to a QA account, and the token of that account is the
10162
+ * only credential the principal-scoped remotes accept, so the card renders the
10163
+ * provider cards only once the QA session service reports a signed-in account —
10164
+ * and says so instead of showing forms that could only fail.
10165
+ */
10166
+ function createIntegrationsCard(remote, providers, session) {
10167
+ const ProviderCards = createProviderCards(remote);
10168
+ return function IntegrationsCard() {
10169
+ const snapshot = (0, react.useSyncExternalStore)(session.subscribe, session.getSnapshot, session.getSnapshot);
10170
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardShell, {
10171
+ title: "Интеграции",
10172
+ description: "Свои рабочие сервисы: подключения принадлежат вашему аккаунту QA.",
10173
+ label: (open) => open ? "Свернуть настройки интеграций" : "Развернуть настройки интеграций",
10174
+ bodyClassName: "dsh-qa-integrations__body",
10175
+ children: snapshot.stage === "authed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderCards, {
10176
+ token: snapshot.token,
10177
+ providers
10178
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10179
+ className: "dsh-qa-integrations__notice",
10180
+ children: INTEGRATIONS_DISCLOSURE
10181
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10182
+ className: "dsh-qa-integrations__hint",
10183
+ children: gateCopy(snapshot.stage)
10184
+ })
10185
+ });
10186
+ };
10187
+ }
10188
+ /** Host tab wrapper that preserves the card shell's direct ul > li contract. */
10189
+ function createIntegrationsHostTab(remote, providers, session) {
10190
+ const IntegrationsCard = createIntegrationsCard(remote, providers, session);
10191
+ return function IntegrationsHostTab() {
10192
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10193
+ className: "dsh-qa-integrations__host-tab",
10194
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntegrationsCard, {})
10195
+ });
10196
+ };
10197
+ }
10198
+ //#endregion
10199
+ //#region src/client/operator-controls.tsx
10200
+ /**
10201
+ * Shared controls of the operator card body.
10202
+ *
10203
+ * Every control edits the settings namespace through a path-addressed write,
10204
+ * and text, number and list drafts commit on blur or Enter rather than per
10205
+ * keystroke: a half-typed value is one the Host refuses, and a refusal
10206
+ * mid-typing would clear the field the operator is still editing. Structured
10207
+ * values (instance lists, records, credential profiles) commit as a whole at
10208
+ * the parent path, because the Host stores the user layer per section path.
10209
+ */
10210
+ function OverriddenMark(props) {
10211
+ if (!props.shown) return null;
10212
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10213
+ className: "qai-op__overridden",
10214
+ children: "переопределено"
10215
+ });
10216
+ }
10217
+ /** The control's DOM id, derived from its settings path: one per field. */
10218
+ function fieldId(path) {
10219
+ return `qai-op-${path.join("-")}`;
10220
+ }
10221
+ function FieldFrame(props) {
10222
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10223
+ className: "qai-op__field",
10224
+ children: [
10225
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10226
+ className: "qai-op__label",
10227
+ htmlFor: fieldId(props.path),
10228
+ children: [props.label, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverriddenMark, { shown: props.overridden })]
10229
+ }),
10230
+ props.children,
10231
+ props.hint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10232
+ className: "qai-op__hint",
10233
+ children: props.hint
10234
+ })
10235
+ ]
10236
+ });
10237
+ }
10238
+ /** Two-state control with a label and an explanatory hint. */
10239
+ function Toggle(props) {
10240
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10241
+ className: "qai-op__toggle-row",
10242
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10243
+ className: "qai-op__toggle-copy",
10244
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("strong", { children: [props.label, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverriddenMark, { shown: props.overridden === true })] }), props.hint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: props.hint })]
10245
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10246
+ className: "qai-op__toggle",
10247
+ type: "checkbox",
10248
+ checked: props.value,
10249
+ disabled: props.disabled,
10250
+ onChange: (event) => {
10251
+ props.write(props.path, event.currentTarget.checked);
10252
+ }
10253
+ })]
10254
+ });
10255
+ }
10256
+ /** Whole-number control; the draft commits on blur and on Enter. */
10257
+ function NumberField(props) {
10258
+ const [draft, setDraft] = (0, react.useState)(props.value === void 0 ? "" : String(props.value));
10259
+ (0, react.useEffect)(() => {
10260
+ setDraft(props.value === void 0 ? "" : String(props.value));
10261
+ }, [props.value]);
10262
+ const commit = () => {
10263
+ const text = draft.trim();
10264
+ if (text === "") {
10265
+ if (props.value !== void 0) props.unset(props.path);
10266
+ return;
10267
+ }
10268
+ const next = Number(text);
10269
+ if (!Number.isFinite(next) || next === props.value) return;
10270
+ props.write(props.path, next);
10271
+ };
10272
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldFrame, {
10273
+ label: props.label,
10274
+ path: props.path,
10275
+ overridden: props.overridden(props.path),
10276
+ hint: props.hint,
10277
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10278
+ id: fieldId(props.path),
10279
+ className: "qai-op__input",
10280
+ type: "text",
10281
+ inputMode: "numeric",
10282
+ value: draft,
10283
+ disabled: props.disabled,
10284
+ onChange: (event) => {
10285
+ setDraft(event.currentTarget.value);
10286
+ },
10287
+ onBlur: commit,
10288
+ onKeyDown: (event) => {
10289
+ if (event.key === "Enter") {
10290
+ event.preventDefault();
10291
+ commit();
10292
+ }
10293
+ }
10294
+ })
10295
+ });
10296
+ }
10297
+ /** Free-text control; the draft commits on blur and on Enter. */
10298
+ function TextField(props) {
10299
+ const [draft, setDraft] = (0, react.useState)(props.value ?? "");
10300
+ (0, react.useEffect)(() => {
10301
+ setDraft(props.value ?? "");
10302
+ }, [props.value]);
10303
+ const commit = () => {
10304
+ const next = draft.trim();
10305
+ if (next === "") {
10306
+ if (props.value !== void 0 && props.value !== "") props.unset(props.path);
10307
+ return;
10308
+ }
10309
+ if (next === props.value) return;
10310
+ props.write(props.path, next);
10311
+ };
10312
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldFrame, {
10313
+ label: props.label,
10314
+ path: props.path,
10315
+ overridden: props.overridden(props.path),
10316
+ hint: props.hint,
10317
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10318
+ id: fieldId(props.path),
10319
+ className: "qai-op__input",
10320
+ type: "text",
10321
+ value: draft,
10322
+ placeholder: props.placeholder,
10323
+ disabled: props.disabled,
10324
+ onChange: (event) => {
10325
+ setDraft(event.currentTarget.value);
10326
+ },
10327
+ onBlur: commit,
10328
+ onKeyDown: (event) => {
10329
+ if (event.key === "Enter") {
10330
+ event.preventDefault();
10331
+ commit();
10332
+ }
10333
+ }
10334
+ })
10335
+ });
10336
+ }
10337
+ /** Fixed-option control for the schema's string unions. */
10338
+ function SelectField(props) {
10339
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldFrame, {
10340
+ label: props.label,
10341
+ path: props.path,
10342
+ overridden: props.overridden(props.path),
10343
+ hint: props.hint,
10344
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
10345
+ id: fieldId(props.path),
10346
+ className: "qai-op__input",
10347
+ value: props.value,
10348
+ disabled: props.disabled,
10349
+ onChange: (event) => {
10350
+ props.write(props.path, event.currentTarget.value);
10351
+ },
10352
+ children: props.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10353
+ value: option.value,
10354
+ children: option.label
10355
+ }, option.value))
10356
+ })
10357
+ });
10358
+ }
10359
+ /**
10360
+ * List of strings; every committed value replaces the whole array at the
10361
+ * parent path, which is the granularity the namespace stores.
10362
+ */
10363
+ function StringListField(props) {
10364
+ const [draft, setDraft] = (0, react.useState)("");
10365
+ const commit = (next) => {
10366
+ if (next.length === 0) props.unset(props.path);
10367
+ else props.write(props.path, next);
10368
+ };
10369
+ const add = () => {
10370
+ const value = draft.trim();
10371
+ if (value === "" || props.values.includes(value)) return;
10372
+ commit([...props.values, value]);
10373
+ setDraft("");
10374
+ };
10375
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldFrame, {
10376
+ label: props.label,
10377
+ path: props.path,
10378
+ overridden: props.overridden(props.path),
10379
+ hint: props.hint,
10380
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10381
+ className: "qai-op__rows",
10382
+ children: props.values.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
10383
+ className: "qai-op__row",
10384
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10385
+ className: "qai-op__row-value",
10386
+ children: row
10387
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10388
+ type: "button",
10389
+ className: "qai-op__row-remove",
10390
+ disabled: props.disabled,
10391
+ onClick: () => {
10392
+ commit(props.values.filter((_, at) => at !== index));
10393
+ },
10394
+ children: "убрать"
10395
+ })]
10396
+ }, `${index}:${row}`))
10397
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10398
+ className: "qai-op__row-add",
10399
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10400
+ className: "qai-op__input",
10401
+ type: "text",
10402
+ value: draft,
10403
+ placeholder: props.placeholder,
10404
+ disabled: props.disabled,
10405
+ onChange: (event) => {
10406
+ setDraft(event.currentTarget.value);
10407
+ },
10408
+ onKeyDown: (event) => {
10409
+ if (event.key === "Enter") {
10410
+ event.preventDefault();
10411
+ add();
10412
+ }
10413
+ }
10414
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10415
+ type: "button",
10416
+ className: "qai-op__button",
10417
+ disabled: props.disabled || draft.trim() === "",
10418
+ onClick: add,
10419
+ children: "добавить"
10420
+ })]
10421
+ })]
10422
+ });
10423
+ }
10424
+ /**
10425
+ * Deployment instances (GitLab, Confluence, Jira sites, Test IT, Weblate): a
10426
+ * row edits id, label and address, and every committed edit writes the whole
10427
+ * list, because a partially stored row would fail the resolvers anyway.
10428
+ */
10429
+ function InstanceListField(props) {
10430
+ const [drafts, setDrafts] = (0, react.useState)(() => props.instances.map((row) => ({ ...row })));
10431
+ (0, react.useEffect)(() => {
10432
+ setDrafts(props.instances.map((row) => ({ ...row })));
10433
+ }, [props.instances]);
10434
+ const commit = (next) => {
10435
+ setDrafts(next);
10436
+ if (next.length === 0) props.unset(props.path);
10437
+ else props.write(props.path, next.map((row) => ({ ...row })));
10438
+ };
10439
+ const edit = (index, patch) => {
10440
+ commit(props.instances.map((row, at) => at === index ? {
10441
+ ...row,
10442
+ ...patch
10443
+ } : row));
10444
+ };
10445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldFrame, {
10446
+ label: props.label,
10447
+ path: props.path,
10448
+ overridden: props.overridden(props.path),
10449
+ hint: props.hint,
10450
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10451
+ className: "qai-op__instances",
10452
+ children: props.instances.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
10453
+ className: "qai-op__instance",
10454
+ children: [
10455
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10456
+ className: "qai-op__instance-cell",
10457
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10458
+ className: "qai-op__instance-key",
10459
+ children: "id"
10460
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10461
+ className: "qai-op__input",
10462
+ type: "text",
10463
+ value: drafts[index]?.id ?? "",
10464
+ placeholder: "corp",
10465
+ disabled: props.disabled,
10466
+ onChange: (event) => {
10467
+ setDrafts(drafts.map((draft, at) => at === index ? {
10468
+ ...draft,
10469
+ id: event.currentTarget.value
10470
+ } : draft));
10471
+ },
10472
+ onBlur: () => {
10473
+ const id = drafts[index]?.id.trim() ?? "";
10474
+ if (id !== "" && id !== row.id) edit(index, { id });
10475
+ }
10476
+ })]
10477
+ }),
10478
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10479
+ className: "qai-op__instance-cell",
10480
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10481
+ className: "qai-op__instance-key",
10482
+ children: "название"
10483
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10484
+ className: "qai-op__input",
10485
+ type: "text",
10486
+ value: drafts[index]?.label ?? "",
10487
+ placeholder: "Корпоративный GitLab",
10488
+ disabled: props.disabled,
10489
+ onChange: (event) => {
10490
+ setDrafts(drafts.map((draft, at) => at === index ? {
10491
+ ...draft,
10492
+ label: event.currentTarget.value
10493
+ } : draft));
10494
+ },
10495
+ onBlur: () => {
10496
+ const label = drafts[index]?.label.trim() ?? "";
10497
+ if (label !== "" && label !== row.label) edit(index, { label });
10498
+ }
10499
+ })]
10500
+ }),
10501
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10502
+ className: "qai-op__instance-cell qai-op__instance-cell--wide",
10503
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10504
+ className: "qai-op__instance-key",
10505
+ children: "адрес"
10506
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10507
+ className: "qai-op__input",
10508
+ type: "text",
10509
+ value: drafts[index]?.baseUrl ?? "",
10510
+ placeholder: "https://gitlab.example.corp",
10511
+ disabled: props.disabled,
10512
+ onChange: (event) => {
10513
+ setDrafts(drafts.map((draft, at) => at === index ? {
10514
+ ...draft,
10515
+ baseUrl: event.currentTarget.value
10516
+ } : draft));
10517
+ },
10518
+ onBlur: () => {
10519
+ const baseUrl = drafts[index]?.baseUrl.trim() ?? "";
10520
+ if (baseUrl !== "" && baseUrl !== row.baseUrl) edit(index, { baseUrl });
10521
+ }
10522
+ })]
10523
+ }),
10524
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10525
+ type: "button",
10526
+ className: "qai-op__row-remove",
10527
+ disabled: props.disabled,
10528
+ onClick: () => {
10529
+ commit(props.instances.filter((_, at) => at !== index));
10530
+ },
10531
+ children: "убрать"
10532
+ })
10533
+ ]
10534
+ }, `${index}:${row.id}`))
10535
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10536
+ type: "button",
10537
+ className: "qai-op__button",
10538
+ disabled: props.disabled,
10539
+ onClick: () => {
10540
+ commit([...props.instances, {
10541
+ id: "",
10542
+ label: "",
10543
+ baseUrl: ""
10544
+ }]);
10545
+ },
10546
+ children: "добавить"
10547
+ }) })]
10548
+ });
10549
+ }
10550
+ /**
10551
+ * Mapping control for `fieldAliases`, credential resources and deny policy:
10552
+ * rows of a key and its value, committed as one record at the parent path.
10553
+ * A new entry is typed into the key (and value) inputs and lands in the
10554
+ * record on «добавить»; an existing value commits on blur.
10555
+ */
10556
+ function RecordField(props) {
10557
+ const [keyDraft, setKeyDraft] = (0, react.useState)("");
10558
+ const [valueDraft, setValueDraft] = (0, react.useState)("");
10559
+ const commit = (next) => {
10560
+ if (next.length === 0) {
10561
+ props.unset(props.path);
10562
+ return;
10563
+ }
10564
+ const record = {};
10565
+ for (const [key, value] of next) record[key] = props.fixedValue ?? value;
10566
+ props.write(props.path, record);
10567
+ };
10568
+ const add = () => {
10569
+ const key = keyDraft.trim();
10570
+ if (key === "" || props.entries.some(([rowKey]) => rowKey === key)) return;
10571
+ const value = props.fixedValue ?? valueDraft.trim();
10572
+ if (value === "") return;
10573
+ commit([...props.entries, [key, value]]);
10574
+ setKeyDraft("");
10575
+ setValueDraft("");
10576
+ };
10577
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldFrame, {
10578
+ label: props.label,
10579
+ path: props.path,
10580
+ overridden: props.overridden(props.path),
10581
+ hint: props.hint,
10582
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10583
+ className: "qai-op__rows",
10584
+ children: props.entries.map(([key, value]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
10585
+ className: "qai-op__row",
10586
+ children: [
10587
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10588
+ className: "qai-op__row-key",
10589
+ children: key
10590
+ }),
10591
+ props.fixedValue === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10592
+ className: "qai-op__input",
10593
+ type: "text",
10594
+ defaultValue: value,
10595
+ placeholder: props.valuePlaceholder,
10596
+ disabled: props.disabled,
10597
+ onBlur: (event) => {
10598
+ const next = event.currentTarget.value.trim();
10599
+ if (next !== "" && next !== value) commit(props.entries.map((row) => row[0] === key ? [key, next] : row));
10600
+ },
10601
+ onKeyDown: (event) => {
10602
+ if (event.key === "Enter") {
10603
+ event.preventDefault();
10604
+ event.currentTarget.blur();
10605
+ }
10606
+ }
10607
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10608
+ className: "qai-op__row-value",
10609
+ children: value
10610
+ }),
10611
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10612
+ type: "button",
10613
+ className: "qai-op__row-remove",
10614
+ disabled: props.disabled,
10615
+ onClick: () => {
10616
+ commit(props.entries.filter(([rowKey]) => rowKey !== key));
10617
+ },
10618
+ children: "убрать"
10619
+ })
10620
+ ]
10621
+ }, key))
10622
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10623
+ className: "qai-op__row-add",
10624
+ children: [
10625
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10626
+ className: "qai-op__input",
10627
+ type: "text",
10628
+ value: keyDraft,
10629
+ placeholder: props.keyPlaceholder,
10630
+ disabled: props.disabled,
10631
+ onChange: (event) => {
10632
+ setKeyDraft(event.currentTarget.value);
10633
+ },
10634
+ onKeyDown: (event) => {
10635
+ if (event.key === "Enter") {
10636
+ event.preventDefault();
10637
+ add();
10638
+ }
10639
+ }
10640
+ }),
10641
+ props.fixedValue === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10642
+ className: "qai-op__input",
10643
+ type: "text",
10644
+ value: valueDraft,
10645
+ placeholder: props.valuePlaceholder,
10646
+ disabled: props.disabled,
10647
+ onChange: (event) => {
10648
+ setValueDraft(event.currentTarget.value);
10649
+ },
10650
+ onKeyDown: (event) => {
10651
+ if (event.key === "Enter") {
10652
+ event.preventDefault();
10653
+ add();
10654
+ }
10655
+ }
10656
+ }) : null,
10657
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10658
+ type: "button",
10659
+ className: "qai-op__button",
10660
+ disabled: props.disabled || keyDraft.trim() === "",
10661
+ onClick: add,
10662
+ children: "добавить"
10663
+ })
10664
+ ]
10665
+ })]
10666
+ });
10667
+ }
10668
+ //#endregion
10669
+ //#region src/client/operator-card.tsx
10670
+ function rawObject(value) {
10671
+ return typeof value === "object" && value !== null ? value : {};
10672
+ }
10673
+ function rawArray(value) {
10674
+ return Array.isArray(value) ? value : [];
10675
+ }
10676
+ function rawString(value) {
10677
+ return typeof value === "string" ? value : "";
10678
+ }
10679
+ function rawNumber(value) {
10680
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
10681
+ }
10682
+ function rawStringList(value) {
10683
+ return rawArray(value).filter((row) => typeof row === "string");
10684
+ }
10685
+ function rawRecord(value) {
10686
+ return Object.entries(rawObject(value)).filter((entry) => typeof entry[1] === "string");
10687
+ }
10688
+ function rawBool(value, fallback) {
10689
+ return typeof value === "boolean" ? value : fallback;
10690
+ }
10691
+ /** Resource rows as `kind: v1, v2` text pairs for the record editor. */
10692
+ function resourceRows(value) {
10693
+ return Object.entries(rawObject(value)).map(([kind, values]) => [kind, rawArray(values).map(String).join(", ")]);
10694
+ }
10695
+ /** `{ kind: ["a", "b"] }` from the editor's `kind: "a, b"` rows. */
10696
+ function resourceRecord(rows) {
10697
+ const record = {};
10698
+ for (const [kind, values] of rows) {
10699
+ const list = values.split(",").map((row) => row.trim()).filter((row) => row !== "");
10700
+ if (list.length > 0) record[kind] = list;
10701
+ }
10702
+ return record;
10703
+ }
10704
+ function displayError(error) {
10705
+ if (error instanceof Error) return error.message;
10706
+ if (typeof error === "string") return error;
10707
+ return "Хост отклонил значение.";
10708
+ }
10709
+ /** Whether the raw user layer carries the path (an object walk; lists whole). */
10710
+ function isOverridden(user, path) {
10711
+ let cursor = user;
10712
+ for (const segment of path) {
10713
+ if (typeof cursor !== "object" || cursor === null) return false;
10714
+ cursor = cursor[segment];
10715
+ if (cursor === void 0) return false;
10716
+ }
10717
+ return true;
10718
+ }
10719
+ /** Top-level keys the user layer overrides; what «reset» clears. */
10720
+ function overriddenKeys(user) {
10721
+ return Object.keys(rawObject(user));
10722
+ }
10723
+ function Section(props) {
10724
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
10725
+ className: "qai-op__section",
10726
+ open: props.open,
10727
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
10728
+ className: "qai-op__section-summary",
10729
+ children: [
10730
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10731
+ className: "qai-op__section-title",
10732
+ children: props.title
10733
+ }),
10734
+ props.state === void 0 || props.state === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10735
+ className: "qai-op__section-state",
10736
+ children: props.state
10737
+ }),
10738
+ props.hint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10739
+ className: "qai-op__hint",
10740
+ children: props.hint
10741
+ })
10742
+ ]
10743
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10744
+ className: "qai-op__section-body",
10745
+ children: props.children
10746
+ })]
10747
+ });
10748
+ }
10749
+ /**
10750
+ * A labelled block inside one section: switches that describe the provider,
10751
+ * the connections it reads through, the surface it opens to the agent, and the
10752
+ * tuning knobs folded away at the end. The fields stay the same controls in the
10753
+ * same paths — only the headings that say what belongs with what change.
10754
+ */
10755
+ function Group(props) {
10756
+ const className = [
10757
+ "qai-op__group",
10758
+ props.kind === "checks" ? "qai-op__group--checks" : "",
10759
+ props.wide === true ? "qai-op__group--wide" : ""
10760
+ ].filter((part) => part !== "").join(" ");
10761
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
10762
+ className,
10763
+ children: [
10764
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
10765
+ className: "qai-op__group-title",
10766
+ children: props.title
10767
+ }),
10768
+ props.hint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10769
+ className: "qai-op__group-hint",
10770
+ children: props.hint
10771
+ }),
10772
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10773
+ className: "qai-op__grid",
10774
+ children: props.children
10775
+ })
10776
+ ]
10777
+ });
10778
+ }
10779
+ /** The tuning knobs of one provider, folded away until someone needs them. */
10780
+ function LimitsGroup(props) {
10781
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
10782
+ className: "qai-op__group qai-op__group--limits",
10783
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
10784
+ className: "qai-op__group-summary",
10785
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10786
+ className: "qai-op__group-title",
10787
+ children: "Ограничения и повторы"
10788
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10789
+ className: "qai-op__group-hint",
10790
+ children: props.hint ?? "потолки ответов и повторы при ошибках провайдера"
10791
+ })]
10792
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10793
+ className: "qai-op__grid",
10794
+ children: props.children
10795
+ })]
10796
+ });
10797
+ }
10798
+ /** `1 инстанс`, `3 инстанса`, `11 инстансов`. */
10799
+ function plural(count, forms) {
10800
+ const mod10 = count % 10;
10801
+ const mod100 = count % 100;
10802
+ const [one, few, many] = forms;
10803
+ if (mod10 === 1 && mod100 !== 11) return `${count} ${one}`;
10804
+ if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) return `${count} ${few}`;
10805
+ return `${count} ${many}`;
10806
+ }
10807
+ /** One line describing a collapsed provider: on/off, connections, surface. */
10808
+ function providerState(provider, shape = {}) {
10809
+ const parts = [];
10810
+ if (shape.enabled === true) parts.push(rawBool(provider.enabled, true) ? "включён" : "выключен");
10811
+ for (const entry of shape.counts ?? []) {
10812
+ const list = provider[entry.path];
10813
+ const size = Array.isArray(list) ? list.length : 0;
10814
+ if (size > 0) parts.push(plural(size, entry.forms));
10815
+ }
10816
+ const capabilities = shape.capabilities ?? [];
10817
+ if (capabilities.length > 0) {
10818
+ const on = capabilities.filter(([key, fallback]) => rawBool(provider[key], fallback)).length;
10819
+ parts.push(`доступно ${on} из ${capabilities.length}`);
10035
10820
  }
10821
+ return parts.join(" · ");
10822
+ }
10823
+ function instanceRows(value) {
10824
+ return rawArray(value).map(rawObject).map((row) => ({
10825
+ id: rawString(row.id),
10826
+ label: rawString(row.label),
10827
+ baseUrl: rawString(row.baseUrl)
10828
+ }));
10829
+ }
10830
+ function profileDrafts(value) {
10831
+ return rawArray(value).map(rawObject).map((row) => {
10832
+ const credential = rawObject(row.credential);
10833
+ return {
10834
+ id: rawString(row.id),
10835
+ provider: rawString(row.provider),
10836
+ instance: rawString(row.instance),
10837
+ label: rawString(row.label),
10838
+ enabled: rawBool(row.enabled, true),
10839
+ secretFile: rawString(credential.secretFile),
10840
+ secretEnv: rawString(credential.secretEnv),
10841
+ resources: resourceRows(row.resources),
10842
+ policy: rawRecord(row.policy)
10843
+ };
10844
+ });
10845
+ }
10846
+ const PROVIDER_IDS = [
10847
+ "bitrix24",
10848
+ "confluence",
10849
+ "gitlab",
10850
+ "teamcity",
10851
+ "jira",
10852
+ "testit",
10853
+ "weblate"
10854
+ ];
10855
+ function profileWire(draft) {
10856
+ const wire = {
10857
+ id: draft.id.trim(),
10858
+ provider: draft.provider.trim(),
10859
+ instance: draft.instance.trim(),
10860
+ label: draft.label.trim(),
10861
+ enabled: draft.enabled
10862
+ };
10863
+ const secretFile = draft.secretFile.trim();
10864
+ const secretEnv = draft.secretEnv.trim();
10865
+ if (secretFile !== "" || secretEnv !== "") wire.credential = {
10866
+ ...secretFile === "" ? {} : { secretFile },
10867
+ ...secretEnv === "" ? {} : { secretEnv }
10868
+ };
10869
+ if (draft.resources.length > 0) wire.resources = resourceRecord(draft.resources);
10870
+ if (draft.policy.length > 0) wire.policy = Object.fromEntries(draft.policy.map(([operation]) => [operation, "deny"]));
10871
+ return wire;
10036
10872
  }
10037
10873
  /**
10038
- * The Integrations card shown inside the plugin-owned host settings tab.
10039
- *
10040
- * A connection belongs to a QA account, and the token of that account is the
10041
- * only credential the principal-scoped remotes accept, so the card renders the
10042
- * provider cards only once the QA session service reports a signed-in account —
10043
- * and says so instead of showing forms that could only fail.
10874
+ * The managed-credential profile list. Every field edit commits the whole
10875
+ * array at the parent path, so a row can never be half-stored; the drafts
10876
+ * reset from the stored list when the Host accepts or refuels it.
10044
10877
  */
10045
- function createIntegrationsCard(remote, providers, session) {
10046
- const ProviderCards = createProviderCards(remote);
10047
- return function IntegrationsCard() {
10048
- const snapshot = (0, react.useSyncExternalStore)(session.subscribe, session.getSnapshot, session.getSnapshot);
10049
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardShell, {
10050
- title: "Интеграции",
10051
- description: "Свои рабочие сервисы: подключения принадлежат вашему аккаунту QA.",
10052
- label: (open) => open ? "Свернуть настройки интеграций" : "Развернуть настройки интеграций",
10053
- bodyClassName: "dsh-qa-integrations__body",
10054
- children: snapshot.stage === "authed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderCards, {
10055
- token: snapshot.token,
10056
- providers
10057
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10058
- className: "dsh-qa-integrations__notice",
10059
- children: INTEGRATIONS_DISCLOSURE
10060
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10061
- className: "dsh-qa-integrations__hint",
10062
- children: gateCopy(snapshot.stage)
10063
- })
10064
- });
10878
+ function ServiceProfilesField(props) {
10879
+ const [drafts, setDrafts] = (0, react.useState)(props.profiles);
10880
+ (0, react.useEffect)(() => {
10881
+ setDrafts(props.profiles);
10882
+ }, [props.profiles]);
10883
+ const commit = (next) => {
10884
+ setDrafts(next);
10885
+ if (next.length === 0) {
10886
+ props.unset(["managedServiceCredentials", "profiles"]);
10887
+ return;
10888
+ }
10889
+ props.write(["managedServiceCredentials", "profiles"], next.map(profileWire));
10890
+ };
10891
+ const edit = (index, patch) => {
10892
+ commit(props.profiles.map((row, at) => at === index ? {
10893
+ ...row,
10894
+ ...patch
10895
+ } : row));
10896
+ };
10897
+ const commitRecord = (index, key, rows) => {
10898
+ if (rows.length === 0) {
10899
+ commit(props.profiles.map((row, at) => at === index ? {
10900
+ ...row,
10901
+ [key]: []
10902
+ } : row));
10903
+ return;
10904
+ }
10905
+ commit(props.profiles.map((row, at) => at === index ? {
10906
+ ...row,
10907
+ [key]: key === "resources" ? resourceRecord(rows) : Object.fromEntries(rows.map(([operation]) => [operation, "deny"]))
10908
+ } : row));
10909
+ };
10910
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10911
+ className: "qai-op__field",
10912
+ children: [
10913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10914
+ className: "qai-op__label",
10915
+ children: ["Профили доступов", props.overridden(["managedServiceCredentials", "profiles"]) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10916
+ className: "qai-op__overridden",
10917
+ children: "переопределено"
10918
+ }) : null]
10919
+ }),
10920
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10921
+ className: "qai-op__profiles",
10922
+ children: props.profiles.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
10923
+ className: "qai-op__profile",
10924
+ children: [
10925
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10926
+ className: "qai-op__profile-head",
10927
+ children: [
10928
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: row.label || row.id || "новый профиль" }),
10929
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10930
+ className: "qai-op__toggle-row qai-op__toggle-row--inline",
10931
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10932
+ className: "qai-op__toggle",
10933
+ type: "checkbox",
10934
+ checked: row.enabled,
10935
+ disabled: props.disabled,
10936
+ onChange: (event) => {
10937
+ edit(index, { enabled: event.currentTarget.checked });
10938
+ }
10939
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "включён" })]
10940
+ }),
10941
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10942
+ type: "button",
10943
+ className: "qai-op__row-remove",
10944
+ disabled: props.disabled,
10945
+ onClick: () => {
10946
+ commit(props.profiles.filter((_, at) => at !== index));
10947
+ },
10948
+ children: "убрать"
10949
+ })
10950
+ ]
10951
+ }),
10952
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10953
+ className: "qai-op__profile-grid",
10954
+ children: [
10955
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10956
+ className: "qai-op__instance-cell",
10957
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10958
+ className: "qai-op__instance-key",
10959
+ children: "id"
10960
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10961
+ className: "qai-op__input",
10962
+ type: "text",
10963
+ value: row.id,
10964
+ placeholder: "qa-gitlab-readonly",
10965
+ disabled: props.disabled,
10966
+ onChange: (event) => {
10967
+ setDrafts(drafts.map((draft, at) => at === index ? {
10968
+ ...draft,
10969
+ id: event.currentTarget.value
10970
+ } : draft));
10971
+ },
10972
+ onBlur: () => {
10973
+ const id = row.id.trim();
10974
+ const next = drafts[index]?.id.trim() ?? "";
10975
+ if (next !== "" && next !== id) edit(index, { id: next });
10976
+ }
10977
+ })]
10978
+ }),
10979
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10980
+ className: "qai-op__instance-cell",
10981
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10982
+ className: "qai-op__instance-key",
10983
+ children: "провайдер"
10984
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
10985
+ className: "qai-op__input",
10986
+ value: row.provider,
10987
+ disabled: props.disabled,
10988
+ onChange: (event) => {
10989
+ edit(index, { provider: event.currentTarget.value });
10990
+ },
10991
+ children: PROVIDER_IDS.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
10992
+ value: id,
10993
+ children: id
10994
+ }, id))
10995
+ })]
10996
+ }),
10997
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10998
+ className: "qai-op__instance-cell",
10999
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11000
+ className: "qai-op__instance-key",
11001
+ children: "инстанс"
11002
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11003
+ className: "qai-op__input",
11004
+ type: "text",
11005
+ value: row.instance,
11006
+ placeholder: "corp",
11007
+ disabled: props.disabled,
11008
+ onChange: (event) => {
11009
+ setDrafts(drafts.map((draft, at) => at === index ? {
11010
+ ...draft,
11011
+ instance: event.currentTarget.value
11012
+ } : draft));
11013
+ },
11014
+ onBlur: () => {
11015
+ const instance = row.instance.trim();
11016
+ const next = drafts[index]?.instance.trim() ?? "";
11017
+ if (next !== "" && next !== instance) edit(index, { instance: next });
11018
+ }
11019
+ })]
11020
+ }),
11021
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11022
+ className: "qai-op__instance-cell",
11023
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11024
+ className: "qai-op__instance-key",
11025
+ children: "название"
11026
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11027
+ className: "qai-op__input",
11028
+ type: "text",
11029
+ value: row.label,
11030
+ placeholder: "QA GitLab Read-only",
11031
+ disabled: props.disabled,
11032
+ onChange: (event) => {
11033
+ setDrafts(drafts.map((draft, at) => at === index ? {
11034
+ ...draft,
11035
+ label: event.currentTarget.value
11036
+ } : draft));
11037
+ },
11038
+ onBlur: () => {
11039
+ const label = row.label.trim();
11040
+ const next = drafts[index]?.label.trim() ?? "";
11041
+ if (next !== "" && next !== label) edit(index, { label: next });
11042
+ }
11043
+ })]
11044
+ }),
11045
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11046
+ className: "qai-op__instance-cell",
11047
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11048
+ className: "qai-op__instance-key",
11049
+ children: "файл секрета"
11050
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11051
+ className: "qai-op__input",
11052
+ type: "text",
11053
+ value: row.secretFile,
11054
+ placeholder: "/run/secrets/…",
11055
+ disabled: props.disabled,
11056
+ onChange: (event) => {
11057
+ setDrafts(drafts.map((draft, at) => at === index ? {
11058
+ ...draft,
11059
+ secretFile: event.currentTarget.value
11060
+ } : draft));
11061
+ },
11062
+ onBlur: () => {
11063
+ const secretFile = row.secretFile.trim();
11064
+ const next = drafts[index]?.secretFile.trim() ?? "";
11065
+ if (next !== "" && next !== secretFile) edit(index, { secretFile: next });
11066
+ }
11067
+ })]
11068
+ }),
11069
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11070
+ className: "qai-op__instance-cell",
11071
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11072
+ className: "qai-op__instance-key",
11073
+ children: "переменная секрета"
11074
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11075
+ className: "qai-op__input",
11076
+ type: "text",
11077
+ value: row.secretEnv,
11078
+ placeholder: "QA_GITLAB_TOKEN",
11079
+ disabled: props.disabled,
11080
+ onChange: (event) => {
11081
+ setDrafts(drafts.map((draft, at) => at === index ? {
11082
+ ...draft,
11083
+ secretEnv: event.currentTarget.value
11084
+ } : draft));
11085
+ },
11086
+ onBlur: () => {
11087
+ const secretEnv = row.secretEnv.trim();
11088
+ const next = drafts[index]?.secretEnv.trim() ?? "";
11089
+ if (next !== "" && next !== secretEnv) edit(index, { secretEnv: next });
11090
+ }
11091
+ })]
11092
+ })
11093
+ ]
11094
+ }),
11095
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RecordField, {
11096
+ label: "Ресурсы (вид: значения через запятую)",
11097
+ path: ["managedServiceCredentials", "profiles"],
11098
+ entries: row.resources,
11099
+ keyPlaceholder: "projects",
11100
+ valuePlaceholder: "group/repo, group/other",
11101
+ disabled: props.disabled,
11102
+ write: (_path, value) => {
11103
+ commitRecord(index, "resources", Object.entries(value).map(([kind, values]) => [kind, values.join(", ")]));
11104
+ },
11105
+ unset: () => {
11106
+ commitRecord(index, "resources", []);
11107
+ },
11108
+ overridden: props.overridden
11109
+ }),
11110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RecordField, {
11111
+ label: "Запрещённые операции",
11112
+ hint: "каждая запись всегда хранит значение deny",
11113
+ path: ["managedServiceCredentials", "profiles"],
11114
+ entries: row.policy,
11115
+ keyPlaceholder: "mergeRequest.create",
11116
+ valuePlaceholder: "",
11117
+ fixedValue: "deny",
11118
+ disabled: props.disabled,
11119
+ write: (_path, value) => {
11120
+ commitRecord(index, "policy", Object.keys(value).map((operation) => [operation, "deny"]));
11121
+ },
11122
+ unset: () => {
11123
+ commitRecord(index, "policy", []);
11124
+ },
11125
+ overridden: props.overridden
11126
+ })
11127
+ ]
11128
+ }, `${index}:${row.id}`))
11129
+ }),
11130
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11131
+ type: "button",
11132
+ className: "qai-op__button",
11133
+ disabled: props.disabled,
11134
+ onClick: () => {
11135
+ commit([...props.profiles, {
11136
+ id: "",
11137
+ provider: "gitlab",
11138
+ instance: "",
11139
+ label: "",
11140
+ enabled: true,
11141
+ secretFile: "",
11142
+ secretEnv: "",
11143
+ resources: [],
11144
+ policy: []
11145
+ }]);
11146
+ },
11147
+ children: "добавить профиль"
11148
+ }) })
11149
+ ]
11150
+ });
11151
+ }
11152
+ /** One provider's credential-help override: every field optional, every miss keeps the built-in help. */
11153
+ function CredentialHelpSection(props) {
11154
+ const base = ["credentialHelp", props.provider];
11155
+ const control = {
11156
+ disabled: props.disabled,
11157
+ write: props.write,
11158
+ unset: props.unset,
11159
+ overridden: props.overridden
10065
11160
  };
11161
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
11162
+ className: "qai-op__subsection",
11163
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
11164
+ className: "qai-op__section-summary",
11165
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11166
+ className: "qai-op__section-title",
11167
+ children: props.provider
11168
+ }), Object.keys(props.override).length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11169
+ className: "qai-op__hint",
11170
+ children: "встроенная подсказка"
11171
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11172
+ className: "qai-op__overridden",
11173
+ children: "переопределено"
11174
+ })]
11175
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11176
+ className: "qai-op__section-body",
11177
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11178
+ className: "qai-op__grid",
11179
+ children: [
11180
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toggle, {
11181
+ label: "Подсказка показывается",
11182
+ path: [...base, "enabled"],
11183
+ value: rawBool(props.override.enabled, true),
11184
+ disabled: props.disabled,
11185
+ write: props.write
11186
+ }),
11187
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11188
+ label: "Механизм (kind)",
11189
+ path: [...base, "kind"],
11190
+ value: rawString(props.override.kind),
11191
+ ...control
11192
+ }),
11193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11194
+ label: "Название",
11195
+ path: [...base, "label"],
11196
+ value: rawString(props.override.label),
11197
+ ...control
11198
+ }),
11199
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11200
+ label: "Где получить токен (адрес)",
11201
+ path: [...base, "obtainUrl"],
11202
+ value: rawString(props.override.obtainUrl),
11203
+ placeholder: "https://wiki.example.corp/tokens",
11204
+ ...control
11205
+ }),
11206
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11207
+ label: "Где получить токен (подпись)",
11208
+ path: [...base, "obtainLabel"],
11209
+ value: rawString(props.override.obtainLabel),
11210
+ ...control
11211
+ }),
11212
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11213
+ label: "Документация (адрес)",
11214
+ path: [...base, "docsUrl"],
11215
+ value: rawString(props.override.docsUrl),
11216
+ ...control
11217
+ }),
11218
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11219
+ label: "Документация (подпись)",
11220
+ path: [...base, "docsLabel"],
11221
+ value: rawString(props.override.docsLabel),
11222
+ ...control
11223
+ }),
11224
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11225
+ label: "Инструкция",
11226
+ path: [...base, "instructions"],
11227
+ value: rawString(props.override.instructions),
11228
+ ...control
11229
+ }),
11230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11231
+ label: "Ключ локализации инструкции",
11232
+ path: [...base, "instructionsLocaleKey"],
11233
+ value: rawString(props.override.instructionsLocaleKey),
11234
+ ...control
11235
+ }),
11236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11237
+ label: "Скоупы",
11238
+ path: [...base, "scopes"],
11239
+ values: rawStringList(props.override.scopes),
11240
+ placeholder: "read_user",
11241
+ ...control
11242
+ }),
11243
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11244
+ label: "Заметки",
11245
+ path: [...base, "notes"],
11246
+ values: rawStringList(props.override.notes),
11247
+ placeholder: "токен живёт один год",
11248
+ ...control
11249
+ }),
11250
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toggle, {
11251
+ label: "Self-hosted",
11252
+ path: [...base, "selfHosted"],
11253
+ value: rawBool(props.override.selfHosted, false),
11254
+ disabled: props.disabled,
11255
+ write: props.write
11256
+ })
11257
+ ]
11258
+ })
11259
+ })]
11260
+ });
10066
11261
  }
10067
- /** Host tab wrapper that preserves the card shell's direct ul > li contract. */
10068
- function createIntegrationsHostTab(remote, providers, session) {
10069
- const IntegrationsCard = createIntegrationsCard(remote, providers, session);
10070
- return function IntegrationsHostTab() {
10071
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
10072
- className: "dsh-qa-integrations__host-tab",
10073
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntegrationsCard, {})
11262
+ function OperatorCard({ scope }) {
11263
+ const store = (0, react.useMemo)(() => bindSettingsExternalStore(scope), [scope]);
11264
+ const settings = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
11265
+ const [error, setError] = (0, react.useState)(null);
11266
+ const config = rawObject(settings.value);
11267
+ const writable = settings.status === "ready" && settings.writable;
11268
+ const write = (0, react.useCallback)((path, value) => {
11269
+ const ops = [{
11270
+ op: "set",
11271
+ path: [...path],
11272
+ value
11273
+ }];
11274
+ scope.mutate(ops).catch((cause) => {
11275
+ setError(displayError(cause));
10074
11276
  });
11277
+ }, [scope]);
11278
+ const unset = (0, react.useCallback)((path) => {
11279
+ const ops = [{
11280
+ op: "unset",
11281
+ path: [...path]
11282
+ }];
11283
+ scope.mutate(ops).catch((cause) => {
11284
+ setError(displayError(cause));
11285
+ });
11286
+ }, [scope]);
11287
+ const overridden = (0, react.useCallback)((path) => isOverridden(settings.user, path), [settings.user]);
11288
+ const keys = overriddenKeys(settings.user);
11289
+ const resetAll = (0, react.useCallback)(() => {
11290
+ const ops = keys.map((key) => ({
11291
+ op: "unset",
11292
+ path: [key]
11293
+ }));
11294
+ scope.mutate(ops).catch((cause) => {
11295
+ setError(displayError(cause));
11296
+ });
11297
+ }, [keys, scope]);
11298
+ if (settings.status === "unavailable") return null;
11299
+ const control = {
11300
+ disabled: !writable,
11301
+ write,
11302
+ unset,
11303
+ overridden
10075
11304
  };
11305
+ const msc = rawObject(config.managedServiceCredentials);
11306
+ /** Capability toggle: reads default on, deny-listed switches default off. */
11307
+ const tg = (label, path, value, hint) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toggle, {
11308
+ label,
11309
+ hint,
11310
+ path,
11311
+ value,
11312
+ disabled: !writable,
11313
+ write,
11314
+ overridden: overridden(path)
11315
+ });
11316
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardShell, {
11317
+ title: "Интеграции — конфигурация",
11318
+ description: "Операторские настройки подключений: провайдеры, адреса, возможности и сервисные доступы. Правка применяется к запущенному сервису сразу.",
11319
+ badge: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11320
+ className: "dsh-plugin-card__badge",
11321
+ children: keys.length === 0 ? "по умолчанию" : `переопределено: ${keys.length}`
11322
+ }),
11323
+ label: (open) => open ? "Свернуть конфигурацию интеграций" : "Развернуть конфигурацию интеграций",
11324
+ bodyClassName: "qai-op__body",
11325
+ children: settings.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11326
+ className: "qai-op__muted",
11327
+ children: "Загружаем конфигурацию интеграций…"
11328
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
11329
+ error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11330
+ className: "qai-op__error",
11331
+ children: error
11332
+ }) : null,
11333
+ !writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11334
+ className: "qai-op__muted",
11335
+ children: "Хост не принимает правки из этого браузера — значения показаны только для чтения."
11336
+ }) : null,
11337
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11338
+ className: "qai-op__toolbar",
11339
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11340
+ className: "qai-op__hint",
11341
+ children: "Слой правок поверх конфигурации профиля: очищенная настройка возвращается к значению из yaml."
11342
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
11343
+ type: "button",
11344
+ className: "qai-op__button",
11345
+ disabled: !writable || keys.length === 0,
11346
+ onClick: resetAll,
11347
+ children: [
11348
+ "Сбросить переопределения (",
11349
+ keys.length,
11350
+ ")"
11351
+ ]
11352
+ })]
11353
+ }),
11354
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11355
+ title: "Общие",
11356
+ open: true,
11357
+ children: [
11358
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11359
+ title: "Плагин",
11360
+ children: tg("Плагин включён", ["enabled"], rawBool(config.enabled, false), "выключенный плагин не регистрирует инструменты и прячет пользовательские страницы")
11361
+ }),
11362
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11363
+ title: "Хранилище и ключи",
11364
+ wide: true,
11365
+ hint: "пути читаются хостом при старте: правка действует со следующего рестарта",
11366
+ children: [
11367
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11368
+ label: "Файл хранилища подключений",
11369
+ hint: "применяется со следующим рестартом хоста",
11370
+ path: ["dataPath"],
11371
+ value: rawString(config.dataPath),
11372
+ ...control
11373
+ }),
11374
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11375
+ label: "Файл мастер-ключа",
11376
+ hint: "применяется со следующим рестартом хоста",
11377
+ path: ["masterKeyPath"],
11378
+ value: rawString(config.masterKeyPath),
11379
+ ...control
11380
+ }),
11381
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11382
+ label: "Версия мастер-ключа",
11383
+ path: ["masterKeyVersion"],
11384
+ value: rawNumber(config.masterKeyVersion),
11385
+ ...control
11386
+ })
11387
+ ]
11388
+ }),
11389
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11390
+ title: "Домены подключений",
11391
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11392
+ label: "Суффиксы порталов Bitrix24",
11393
+ hint: "хосты, на которые может указывать вебхук; каждый с точки",
11394
+ path: ["allowedPortalSuffixes"],
11395
+ values: rawStringList(config.allowedPortalSuffixes),
11396
+ placeholder: ".bitrix24.example",
11397
+ ...control
11398
+ })
11399
+ }),
11400
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, {
11401
+ hint: "потолки ответов провайдеров и срок хранения аудита",
11402
+ children: [
11403
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11404
+ label: "Таймаут запроса, мс",
11405
+ path: ["timeoutMs"],
11406
+ value: rawNumber(config.timeoutMs),
11407
+ ...control
11408
+ }),
11409
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11410
+ label: "Потолок ответа провайдера, байт",
11411
+ path: ["maxResponseBytes"],
11412
+ value: rawNumber(config.maxResponseBytes),
11413
+ ...control
11414
+ }),
11415
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11416
+ label: "Хранение аудита, дней",
11417
+ path: ["auditRetentionDays"],
11418
+ value: rawNumber(config.auditRetentionDays),
11419
+ ...control
11420
+ })
11421
+ ]
11422
+ })
11423
+ ]
11424
+ }),
11425
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11426
+ title: "Bitrix24",
11427
+ state: providerState(rawObject(config.bitrix24), {
11428
+ enabled: true,
11429
+ capabilities: [
11430
+ ["crmRead", true],
11431
+ ["crmCommentWrite", false],
11432
+ ["chatRead", true],
11433
+ ["openlinesRead", true],
11434
+ ["userRead", true],
11435
+ ["departmentRead", true],
11436
+ ["tasksRead", true],
11437
+ ["calendarRead", true],
11438
+ ["diskRead", true]
11439
+ ]
11440
+ }),
11441
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11442
+ title: "Провайдер",
11443
+ children: tg("Провайдер включён", ["bitrix24", "enabled"], rawBool(rawObject(config.bitrix24).enabled, true))
11444
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11445
+ title: "Что доступно агенту",
11446
+ kind: "checks",
11447
+ children: [
11448
+ tg("CRM: чтение", ["bitrix24", "crmRead"], rawBool(rawObject(config.bitrix24).crmRead, true)),
11449
+ tg("CRM: комментарий таймлайна (запись)", ["bitrix24", "crmCommentWrite"], rawBool(rawObject(config.bitrix24).crmCommentWrite, false), "единственный инструмент записи; выключен по умолчанию"),
11450
+ tg("Чаты: чтение", ["bitrix24", "chatRead"], rawBool(rawObject(config.bitrix24).chatRead, true)),
11451
+ tg("Открытые линии: чтение", ["bitrix24", "openlinesRead"], rawBool(rawObject(config.bitrix24).openlinesRead, true)),
11452
+ tg("Пользователи: чтение", ["bitrix24", "userRead"], rawBool(rawObject(config.bitrix24).userRead, true)),
11453
+ tg("Структура компании: чтение", ["bitrix24", "departmentRead"], rawBool(rawObject(config.bitrix24).departmentRead, true)),
11454
+ tg("Задачи: чтение", ["bitrix24", "tasksRead"], rawBool(rawObject(config.bitrix24).tasksRead, true)),
11455
+ tg("Календарь: чтение", ["bitrix24", "calendarRead"], rawBool(rawObject(config.bitrix24).calendarRead, true)),
11456
+ tg("Диск: чтение", ["bitrix24", "diskRead"], rawBool(rawObject(config.bitrix24).diskRead, true))
11457
+ ]
11458
+ })]
11459
+ }),
11460
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11461
+ title: "Confluence",
11462
+ state: providerState(rawObject(config.confluence), {
11463
+ enabled: true,
11464
+ capabilities: [
11465
+ ["identityRead", true],
11466
+ ["spacesRead", true],
11467
+ ["searchRead", true],
11468
+ ["contentRead", true],
11469
+ ["commentsRead", true],
11470
+ ["attachmentsRead", true],
11471
+ ["versionsRead", true]
11472
+ ],
11473
+ counts: [{
11474
+ path: "instances",
11475
+ forms: [
11476
+ "сайт",
11477
+ "сайта",
11478
+ "сайтов"
11479
+ ]
11480
+ }]
11481
+ }),
11482
+ children: [
11483
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11484
+ title: "Провайдер",
11485
+ children: [tg("Провайдер включён", ["confluence", "enabled"], rawBool(rawObject(config.confluence).enabled, true)), tg("Разрешить http", ["confluence", "allowInsecureHttp"], rawBool(rawObject(config.confluence).allowInsecureHttp, false), "только для dev-стенда")]
11486
+ }),
11487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11488
+ title: "Подключение",
11489
+ wide: true,
11490
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstanceListField, {
11491
+ label: "Сайты Confluence",
11492
+ hint: "пользователь выбирает сайт из списка и вводит e-mail с токеном",
11493
+ path: ["confluence", "instances"],
11494
+ instances: instanceRows(rawObject(config.confluence).instances),
11495
+ ...control
11496
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11497
+ label: "Разрешённые пространства",
11498
+ hint: "пусто — все пространства, доступные подключённому аккаунту",
11499
+ path: ["confluence", "allowedSpaces"],
11500
+ values: rawStringList(rawObject(config.confluence).allowedSpaces),
11501
+ placeholder: "PROJ",
11502
+ ...control
11503
+ })]
11504
+ }),
11505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11506
+ title: "Что доступно агенту",
11507
+ kind: "checks",
11508
+ children: [
11509
+ tg("Профиль: чтение", ["confluence", "identityRead"], rawBool(rawObject(config.confluence).identityRead, true)),
11510
+ tg("Пространства: чтение", ["confluence", "spacesRead"], rawBool(rawObject(config.confluence).spacesRead, true)),
11511
+ tg("Поиск: чтение", ["confluence", "searchRead"], rawBool(rawObject(config.confluence).searchRead, true)),
11512
+ tg("Страницы: чтение", ["confluence", "contentRead"], rawBool(rawObject(config.confluence).contentRead, true)),
11513
+ tg("Комментарии: чтение", ["confluence", "commentsRead"], rawBool(rawObject(config.confluence).commentsRead, true)),
11514
+ tg("Вложения: чтение", ["confluence", "attachmentsRead"], rawBool(rawObject(config.confluence).attachmentsRead, true)),
11515
+ tg("Версии: чтение", ["confluence", "versionsRead"], rawBool(rawObject(config.confluence).versionsRead, true))
11516
+ ]
11517
+ }),
11518
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
11519
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11520
+ label: "Тело страницы по умолчанию, знаков",
11521
+ path: ["confluence", "defaultBodyChars"],
11522
+ value: rawNumber(rawObject(config.confluence).defaultBodyChars),
11523
+ ...control
11524
+ }),
11525
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11526
+ label: "Потолок тела страницы, знаков",
11527
+ path: ["confluence", "maxBodyChars"],
11528
+ value: rawNumber(rawObject(config.confluence).maxBodyChars),
11529
+ ...control
11530
+ }),
11531
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11532
+ label: "Строк на страницу списка",
11533
+ path: ["confluence", "maxResults"],
11534
+ value: rawNumber(rawObject(config.confluence).maxResults),
11535
+ ...control
11536
+ }),
11537
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11538
+ label: "Родителей комментариев на вызов",
11539
+ path: ["confluence", "maxReplyParents"],
11540
+ value: rawNumber(rawObject(config.confluence).maxReplyParents),
11541
+ ...control
11542
+ }),
11543
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11544
+ label: "Повторы при 429/5xx",
11545
+ path: ["confluence", "retries"],
11546
+ value: rawNumber(rawObject(config.confluence).retries),
11547
+ ...control
11548
+ })
11549
+ ] })
11550
+ ]
11551
+ }),
11552
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11553
+ title: "GitLab",
11554
+ state: providerState(rawObject(config.gitlab), {
11555
+ enabled: true,
11556
+ capabilities: [
11557
+ ["identityRead", true],
11558
+ ["projectsRead", true],
11559
+ ["repositoryRead", true],
11560
+ ["searchRead", true],
11561
+ ["issuesRead", true],
11562
+ ["mergeRequestsRead", true],
11563
+ ["ciRead", true]
11564
+ ],
11565
+ counts: [{
11566
+ path: "instances",
11567
+ forms: [
11568
+ "инстанс",
11569
+ "инстанса",
11570
+ "инстансов"
11571
+ ]
11572
+ }]
11573
+ }),
11574
+ children: [
11575
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11576
+ title: "Провайдер",
11577
+ children: [tg("Провайдер включён", ["gitlab", "enabled"], rawBool(rawObject(config.gitlab).enabled, true)), tg("Разрешить http", ["gitlab", "allowInsecureHttp"], rawBool(rawObject(config.gitlab).allowInsecureHttp, false), "только для dev-стенда")]
11578
+ }),
11579
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11580
+ title: "Подключение",
11581
+ wide: true,
11582
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstanceListField, {
11583
+ label: "Инстансы GitLab",
11584
+ hint: "пользователь выбирает инстанс из списка, произвольный хост ввести нельзя",
11585
+ path: ["gitlab", "instances"],
11586
+ instances: instanceRows(rawObject(config.gitlab).instances),
11587
+ ...control
11588
+ })
11589
+ }),
11590
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11591
+ title: "Что доступно агенту",
11592
+ kind: "checks",
11593
+ children: [
11594
+ tg("Профиль: чтение", ["gitlab", "identityRead"], rawBool(rawObject(config.gitlab).identityRead, true)),
11595
+ tg("Проекты: чтение", ["gitlab", "projectsRead"], rawBool(rawObject(config.gitlab).projectsRead, true)),
11596
+ tg("Репозиторий: чтение", ["gitlab", "repositoryRead"], rawBool(rawObject(config.gitlab).repositoryRead, true)),
11597
+ tg("Поиск: чтение", ["gitlab", "searchRead"], rawBool(rawObject(config.gitlab).searchRead, true)),
11598
+ tg("Задачи: чтение", ["gitlab", "issuesRead"], rawBool(rawObject(config.gitlab).issuesRead, true)),
11599
+ tg("MR: чтение", ["gitlab", "mergeRequestsRead"], rawBool(rawObject(config.gitlab).mergeRequestsRead, true)),
11600
+ tg("CI: чтение", ["gitlab", "ciRead"], rawBool(rawObject(config.gitlab).ciRead, true))
11601
+ ]
11602
+ }),
11603
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
11604
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11605
+ label: "Потолок файла, байт",
11606
+ path: ["gitlab", "maxFileBytes"],
11607
+ value: rawNumber(rawObject(config.gitlab).maxFileBytes),
11608
+ ...control
11609
+ }),
11610
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11611
+ label: "Потолок лога задачи CI, байт",
11612
+ path: ["gitlab", "maxJobLogBytes"],
11613
+ value: rawNumber(rawObject(config.gitlab).maxJobLogBytes),
11614
+ ...control
11615
+ }),
11616
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11617
+ label: "Потолок результатов поиска",
11618
+ path: ["gitlab", "maxSearchResults"],
11619
+ value: rawNumber(rawObject(config.gitlab).maxSearchResults),
11620
+ ...control
11621
+ }),
11622
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11623
+ label: "Повторы при 429/5xx",
11624
+ path: ["gitlab", "retries"],
11625
+ value: rawNumber(rawObject(config.gitlab).retries),
11626
+ ...control
11627
+ })
11628
+ ] })
11629
+ ]
11630
+ }),
11631
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11632
+ title: "TeamCity",
11633
+ state: providerState(rawObject(config.teamcity), {
11634
+ enabled: true,
11635
+ capabilities: [
11636
+ ["identityRead", true],
11637
+ ["projectsRead", true],
11638
+ ["buildConfigsRead", true],
11639
+ ["buildsRead", true],
11640
+ ["failuresRead", true],
11641
+ ["logsRead", true],
11642
+ ["queueRead", true],
11643
+ ["investigationsRead", true],
11644
+ ["agentsRead", true],
11645
+ ["artifactsRead", true]
11646
+ ]
11647
+ }),
11648
+ children: [
11649
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11650
+ title: "Провайдер",
11651
+ children: [tg("Провайдер включён", ["teamcity", "enabled"], rawBool(rawObject(config.teamcity).enabled, true)), tg("Разрешить http", [
11652
+ "teamcity",
11653
+ "network",
11654
+ "allowHttp"
11655
+ ], rawBool(rawObject(rawObject(config.teamcity).network).allowHttp, false), "незащищённые адреса TeamCity")]
11656
+ }),
11657
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11658
+ title: "Подключение",
11659
+ wide: true,
11660
+ children: [
11661
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
11662
+ label: "Адрес сервера TeamCity",
11663
+ hint: "один на весь стенд; пользователь вводит только токен",
11664
+ placeholder: "https://teamcity.example.corp",
11665
+ path: ["teamcity", "serverUrl"],
11666
+ value: rawString(rawObject(config.teamcity).serverUrl),
11667
+ ...control
11668
+ }),
11669
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectField, {
11670
+ label: "Режим сетевой политики",
11671
+ path: [
11672
+ "teamcity",
11673
+ "network",
11674
+ "mode"
11675
+ ],
11676
+ value: rawString(rawObject(rawObject(config.teamcity).network).mode) || "allowlist",
11677
+ options: [{
11678
+ value: "allowlist",
11679
+ label: "allowlist — только перечисленные адреса"
11680
+ }, {
11681
+ value: "trusted-private",
11682
+ label: "trusted-private — любой хост, приватные диапазоны разрешены"
11683
+ }],
11684
+ disabled: !writable,
11685
+ write,
11686
+ overridden
11687
+ }),
11688
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11689
+ label: "Разрешённые хосты",
11690
+ hint: "точные имена или *.суффикс; опечатка падает при записи",
11691
+ path: [
11692
+ "teamcity",
11693
+ "network",
11694
+ "allowedHosts"
11695
+ ],
11696
+ values: rawStringList(rawObject(rawObject(config.teamcity).network).allowedHosts),
11697
+ placeholder: "teamcity.example.corp",
11698
+ ...control
11699
+ }),
11700
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11701
+ label: "Разрешённые CIDR",
11702
+ hint: "только для адресов, записанных цифрами",
11703
+ path: [
11704
+ "teamcity",
11705
+ "network",
11706
+ "allowedCidrs"
11707
+ ],
11708
+ values: rawStringList(rawObject(rawObject(config.teamcity).network).allowedCidrs),
11709
+ placeholder: "10.20.0.0/16",
11710
+ ...control
11711
+ }),
11712
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
11713
+ label: "Разрешённые порты",
11714
+ hint: "пусто — только порт схемы",
11715
+ path: [
11716
+ "teamcity",
11717
+ "network",
11718
+ "allowedPorts"
11719
+ ],
11720
+ values: rawStringList(rawObject(rawObject(config.teamcity).network).allowedPorts),
11721
+ placeholder: "8111",
11722
+ ...control
11723
+ })
11724
+ ]
11725
+ }),
11726
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11727
+ title: "Что доступно агенту",
11728
+ kind: "checks",
11729
+ children: [
11730
+ ["identityRead", "Профиль: чтение"],
11731
+ ["projectsRead", "Проекты: чтение"],
11732
+ ["buildConfigsRead", "Конфигурации сборок: чтение"],
11733
+ ["buildsRead", "Сборки: чтение"],
11734
+ ["failuresRead", "Провалы: чтение"],
11735
+ ["logsRead", "Логи сборок: чтение"],
11736
+ ["queueRead", "Очередь: чтение"],
11737
+ ["investigationsRead", "Расследования: чтение"],
11738
+ ["agentsRead", "Агенты: чтение"],
11739
+ ["artifactsRead", "Артефакты: чтение"]
11740
+ ].map(([key, label]) => tg(label, ["teamcity", key], rawBool(rawObject(config.teamcity)[key], true)))
11741
+ }),
11742
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
11743
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11744
+ label: "Строк в ответе лога",
11745
+ path: ["teamcity", "maxLogLines"],
11746
+ value: rawNumber(rawObject(config.teamcity).maxLogLines),
11747
+ ...control
11748
+ }),
11749
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11750
+ label: "Скачивать лога, байт",
11751
+ path: ["teamcity", "maxLogBytes"],
11752
+ value: rawNumber(rawObject(config.teamcity).maxLogBytes),
11753
+ ...control
11754
+ }),
11755
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11756
+ label: "Артефакт по умолчанию, байт",
11757
+ path: ["teamcity", "defaultArtifactBytes"],
11758
+ value: rawNumber(rawObject(config.teamcity).defaultArtifactBytes),
11759
+ ...control
11760
+ }),
11761
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11762
+ label: "Потолок артефакта, байт",
11763
+ path: ["teamcity", "maxArtifactBytes"],
11764
+ value: rawNumber(rawObject(config.teamcity).maxArtifactBytes),
11765
+ ...control
11766
+ }),
11767
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11768
+ label: "Таймаут логов и артефактов, мс",
11769
+ path: ["teamcity", "streamTimeoutMs"],
11770
+ value: rawNumber(rawObject(config.teamcity).streamTimeoutMs),
11771
+ ...control
11772
+ }),
11773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11774
+ label: "Повторы при 429/5xx",
11775
+ path: ["teamcity", "retries"],
11776
+ value: rawNumber(rawObject(config.teamcity).retries),
11777
+ ...control
11778
+ })
11779
+ ] })
11780
+ ]
11781
+ }),
11782
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11783
+ title: "Jira",
11784
+ state: providerState(rawObject(config.jira), {
11785
+ enabled: true,
11786
+ capabilities: [
11787
+ ["identityRead", true],
11788
+ ["issuesRead", true],
11789
+ ["commentsRead", true],
11790
+ ["attachmentsRead", true],
11791
+ ["transitionsRead", true],
11792
+ ["projectsRead", true],
11793
+ ["fieldsRead", true]
11794
+ ],
11795
+ counts: [{
11796
+ path: "sites",
11797
+ forms: [
11798
+ "сайт",
11799
+ "сайта",
11800
+ "сайтов"
11801
+ ]
11802
+ }]
11803
+ }),
11804
+ children: [
11805
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11806
+ title: "Провайдер",
11807
+ children: [tg("Провайдер включён", ["jira", "enabled"], rawBool(rawObject(config.jira).enabled, true)), tg("Разрешить http", ["jira", "allowInsecureHttp"], rawBool(rawObject(config.jira).allowInsecureHttp, false), "только для dev-стенда")]
11808
+ }),
11809
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11810
+ title: "Подключение",
11811
+ wide: true,
11812
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstanceListField, {
11813
+ label: "Сайты Jira Cloud",
11814
+ hint: "пользователь выбирает сайт из списка, произвольный хост ввести нельзя",
11815
+ path: ["jira", "sites"],
11816
+ instances: instanceRows(rawObject(config.jira).sites),
11817
+ ...control
11818
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RecordField, {
11819
+ label: "Псевдонимы полей",
11820
+ hint: "имя поля Jira по бизнес-термину",
11821
+ path: ["jira", "fieldAliases"],
11822
+ entries: rawRecord(rawObject(config.jira).fieldAliases),
11823
+ keyPlaceholder: "продукт",
11824
+ valuePlaceholder: "customfield_10000",
11825
+ ...control
11826
+ })]
11827
+ }),
11828
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11829
+ title: "Что доступно агенту",
11830
+ kind: "checks",
11831
+ children: [
11832
+ ["identityRead", "Профиль: чтение"],
11833
+ ["issuesRead", "Задачи: чтение"],
11834
+ ["commentsRead", "Комментарии: чтение"],
11835
+ ["attachmentsRead", "Вложения: чтение"],
11836
+ ["transitionsRead", "Переходы: чтение"],
11837
+ ["projectsRead", "Проекты: чтение"],
11838
+ ["fieldsRead", "Схема полей: чтение"]
11839
+ ].map(([key, label]) => tg(label, ["jira", key], rawBool(rawObject(config.jira)[key], true)))
11840
+ }),
11841
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
11842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11843
+ label: "Строк поиска по умолчанию",
11844
+ path: ["jira", "defaultSearchLimit"],
11845
+ value: rawNumber(rawObject(config.jira).defaultSearchLimit),
11846
+ ...control
11847
+ }),
11848
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11849
+ label: "Потолок строк поиска",
11850
+ path: ["jira", "maxSearchLimit"],
11851
+ value: rawNumber(rawObject(config.jira).maxSearchLimit),
11852
+ ...control
11853
+ }),
11854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11855
+ label: "Потолок страницы комментариев",
11856
+ path: ["jira", "maxCommentLimit"],
11857
+ value: rawNumber(rawObject(config.jira).maxCommentLimit),
11858
+ ...control
11859
+ }),
11860
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11861
+ label: "Знаков текста в ответе",
11862
+ path: ["jira", "maxTextChars"],
11863
+ value: rawNumber(rawObject(config.jira).maxTextChars),
11864
+ ...control
11865
+ }),
11866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11867
+ label: "Повторы при 429/5xx",
11868
+ path: ["jira", "retries"],
11869
+ value: rawNumber(rawObject(config.jira).retries),
11870
+ ...control
11871
+ })
11872
+ ] })
11873
+ ]
11874
+ }),
11875
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11876
+ title: "Test IT",
11877
+ state: providerState(rawObject(config.testit), {
11878
+ enabled: true,
11879
+ capabilities: [
11880
+ ["projectsRead", true],
11881
+ ["sectionsRead", true],
11882
+ ["workItemsRead", true],
11883
+ ["historyRead", true],
11884
+ ["commentsRead", true],
11885
+ ["testPlansRead", true],
11886
+ ["testRunsRead", true],
11887
+ ["testResultsRead", true],
11888
+ ["autoTestsRead", true],
11889
+ ["attachmentsRead", true],
11890
+ ["configurationsRead", true]
11891
+ ],
11892
+ counts: [{
11893
+ path: "instances",
11894
+ forms: [
11895
+ "инстанс",
11896
+ "инстанса",
11897
+ "инстансов"
11898
+ ]
11899
+ }]
11900
+ }),
11901
+ children: [
11902
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
11903
+ title: "Провайдер",
11904
+ children: [tg("Провайдер включён", ["testit", "enabled"], rawBool(rawObject(config.testit).enabled, true)), tg("Разрешить http", ["testit", "allowInsecureHttp"], rawBool(rawObject(config.testit).allowInsecureHttp, false), "только для dev-стенда")]
11905
+ }),
11906
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11907
+ title: "Подключение",
11908
+ wide: true,
11909
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstanceListField, {
11910
+ label: "Инсталляции Test IT",
11911
+ path: ["testit", "instances"],
11912
+ instances: instanceRows(rawObject(config.testit).instances),
11913
+ ...control
11914
+ })
11915
+ }),
11916
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
11917
+ title: "Что доступно агенту",
11918
+ kind: "checks",
11919
+ children: [
11920
+ ["projectsRead", "Проекты: чтение"],
11921
+ ["sectionsRead", "Секции: чтение"],
11922
+ ["workItemsRead", "Work items: чтение"],
11923
+ ["historyRead", "История: чтение"],
11924
+ ["commentsRead", "Комментарии: чтение"],
11925
+ ["testPlansRead", "Планы: чтение"],
11926
+ ["testRunsRead", "Прогоны: чтение"],
11927
+ ["testResultsRead", "Результаты: чтение"],
11928
+ ["autoTestsRead", "Автотесты: чтение"],
11929
+ ["attachmentsRead", "Вложения: чтение"],
11930
+ ["configurationsRead", "Конфигурации: чтение"]
11931
+ ].map(([key, label]) => tg(label, ["testit", key], rawBool(rawObject(config.testit)[key], true)))
11932
+ }),
11933
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
11934
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11935
+ label: "Строк по умолчанию",
11936
+ path: ["testit", "defaultResults"],
11937
+ value: rawNumber(rawObject(config.testit).defaultResults),
11938
+ ...control
11939
+ }),
11940
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11941
+ label: "Потолок строк списка",
11942
+ path: ["testit", "maxResults"],
11943
+ value: rawNumber(rawObject(config.testit).maxResults),
11944
+ ...control
11945
+ }),
11946
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11947
+ label: "Вложение по умолчанию, байт",
11948
+ path: ["testit", "defaultAttachmentBytes"],
11949
+ value: rawNumber(rawObject(config.testit).defaultAttachmentBytes),
11950
+ ...control
11951
+ }),
11952
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11953
+ label: "Потолок вложения, байт",
11954
+ path: ["testit", "maxAttachmentBytes"],
11955
+ value: rawNumber(rawObject(config.testit).maxAttachmentBytes),
11956
+ ...control
11957
+ }),
11958
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11959
+ label: "Таймаут вложения, мс",
11960
+ path: ["testit", "attachmentTimeoutMs"],
11961
+ value: rawNumber(rawObject(config.testit).attachmentTimeoutMs),
11962
+ ...control
11963
+ }),
11964
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
11965
+ label: "Повторы при 429/5xx",
11966
+ path: ["testit", "retries"],
11967
+ value: rawNumber(rawObject(config.testit).retries),
11968
+ ...control
11969
+ })
11970
+ ] })
11971
+ ]
11972
+ }),
11973
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
11974
+ title: "Weblate",
11975
+ state: providerState(rawObject(config.weblate), {
11976
+ enabled: true,
11977
+ capabilities: [
11978
+ ["identityRead", true],
11979
+ ["projectsRead", true],
11980
+ ["componentsRead", true],
11981
+ ["translationsRead", true],
11982
+ ["unitsRead", true],
11983
+ ["checksRead", true],
11984
+ ["commentsRead", true],
11985
+ ["suggestionsRead", true],
11986
+ ["changesRead", true],
11987
+ ["statisticsRead", true],
11988
+ ["screenshotsRead", true]
11989
+ ],
11990
+ counts: [{
11991
+ path: "instances",
11992
+ forms: [
11993
+ "инстанс",
11994
+ "инстанса",
11995
+ "инстансов"
11996
+ ]
11997
+ }]
11998
+ }),
11999
+ children: [
12000
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
12001
+ title: "Провайдер",
12002
+ children: [tg("Провайдер включён", ["weblate", "enabled"], rawBool(rawObject(config.weblate).enabled, true)), tg("Разрешить http", ["weblate", "allowInsecureHttp"], rawBool(rawObject(config.weblate).allowInsecureHttp, false), "только для dev-стенда")]
12003
+ }),
12004
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
12005
+ title: "Подключение",
12006
+ wide: true,
12007
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstanceListField, {
12008
+ label: "Инстансы Weblate",
12009
+ path: ["weblate", "instances"],
12010
+ instances: instanceRows(rawObject(config.weblate).instances),
12011
+ ...control
12012
+ })
12013
+ }),
12014
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
12015
+ title: "Что доступно агенту",
12016
+ kind: "checks",
12017
+ children: [
12018
+ ["identityRead", "Профиль: чтение"],
12019
+ ["projectsRead", "Проекты: чтение"],
12020
+ ["componentsRead", "Компоненты: чтение"],
12021
+ ["translationsRead", "Переводы: чтение"],
12022
+ ["unitsRead", "Единицы: чтение"],
12023
+ ["checksRead", "Проверки: чтение"],
12024
+ ["commentsRead", "Комментарии: чтение"],
12025
+ ["suggestionsRead", "Предложения: чтение"],
12026
+ ["changesRead", "Изменения: чтение"],
12027
+ ["statisticsRead", "Статистика: чтение"],
12028
+ ["screenshotsRead", "Скриншоты: чтение"]
12029
+ ].map(([key, label]) => tg(label, ["weblate", key], rawBool(rawObject(config.weblate)[key], true)))
12030
+ }),
12031
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LimitsGroup, { children: [
12032
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
12033
+ label: "Знаков строки в ответе",
12034
+ path: ["weblate", "maxTextChars"],
12035
+ value: rawNumber(rawObject(config.weblate).maxTextChars),
12036
+ ...control
12037
+ }),
12038
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
12039
+ label: "Строк на страницу",
12040
+ path: ["weblate", "maxPageSize"],
12041
+ value: rawNumber(rawObject(config.weblate).maxPageSize),
12042
+ ...control
12043
+ }),
12044
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberField, {
12045
+ label: "Повторы при 429/5xx",
12046
+ path: ["weblate", "retries"],
12047
+ value: rawNumber(rawObject(config.weblate).retries),
12048
+ ...control
12049
+ })
12050
+ ] })
12051
+ ]
12052
+ }),
12053
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
12054
+ title: "Сервисные доступы",
12055
+ hint: "общие read-only креденшалы, которыми владеет развёртывание",
12056
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Group, {
12057
+ title: "Режим",
12058
+ children: [tg("Сервисные доступы включены", ["managedServiceCredentials", "enabled"], rawBool(msc.enabled, false)), tg("Новое подключение стартует в сервисном режиме", ["managedServiceCredentials", "defaultForNewConnections"], rawBool(msc.defaultForNewConnections, true))]
12059
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Group, {
12060
+ title: "Профили доступа",
12061
+ wide: true,
12062
+ hint: "read-only аккаунт, которым развёртывание подключается вместо гостя",
12063
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServiceProfilesField, {
12064
+ profiles: profileDrafts(msc.profiles),
12065
+ disabled: !writable,
12066
+ write,
12067
+ unset,
12068
+ overridden
12069
+ })
12070
+ })]
12071
+ }),
12072
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
12073
+ title: "Подсказки получения доступа",
12074
+ hint: "замена встроенных ссылок провайдеров своими",
12075
+ children: PROVIDER_IDS.map((provider) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredentialHelpSection, {
12076
+ provider,
12077
+ override: rawObject(rawObject(config.credentialHelp)[provider]),
12078
+ disabled: !writable,
12079
+ write,
12080
+ unset,
12081
+ overridden
12082
+ }, provider))
12083
+ })
12084
+ ] })
12085
+ });
10076
12086
  }
10077
12087
  //#endregion
10078
12088
  //#region src/client/styles.ts
@@ -10111,21 +12121,98 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10111
12121
  .dsh-qa-integrations__notice{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px;font-size:12px;line-height:1.55;color:var(--dsw-alias-label-secondary)}
10112
12122
  .dsh-qa-integrations__check{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600}
10113
12123
  .dsh-qa-integrations__hint code{background:var(--dsw-alias-bg-layer-2);border-radius:4px;padding:0 4px;font-size:12px}
12124
+ .qai-op__body{display:flex;flex-direction:column;gap:14px;padding:14px 0 8px}
12125
+ .qai-op__muted{margin:0;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}
12126
+ .qai-op__error{border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;padding:9px 11px;color:var(--dsw-alias-state-error-primary);font-size:13px}
12127
+ .qai-op__toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px}
12128
+ .qai-op__section{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2)}
12129
+ .qai-op__section-summary{display:flex;align-items:center;gap:10px;padding:11px 14px;cursor:pointer;list-style:none;user-select:none}
12130
+ .qai-op__section-summary::-webkit-details-marker{display:none}
12131
+ .qai-op__section-summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}
12132
+ .qai-op__section-title{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}
12133
+ .qai-op__section-summary::before{content:"";width:8px;height:8px;flex:none;border-right:1.5px solid var(--dsw-alias-label-tertiary);border-bottom:1.5px solid var(--dsw-alias-label-tertiary);transform:rotate(-45deg);transition:transform .16s}
12134
+ .qai-op__section[open]>.qai-op__section-summary::before{transform:rotate(45deg)}
12135
+ .qai-op__section-body{display:flex;flex-direction:column;gap:12px;padding:2px 14px 14px;border-top:1px solid var(--dsw-alias-border-l2)}
12136
+ .qai-op__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px 18px}
12137
+ .qai-op__section-state{margin-left:auto;color:var(--dsw-alias-label-secondary);font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
12138
+ .qai-op__group{display:flex;flex-direction:column;gap:8px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l2)}
12139
+ .qai-op__section-body>.qai-op__group:first-child{padding-top:0;border-top:0}
12140
+ .qai-op__group-title{margin:0;color:var(--dsw-alias-label-secondary);font-size:11.5px;font-weight:600;letter-spacing:.02em;text-transform:uppercase}
12141
+ .qai-op__group-hint{margin:0;color:var(--dsw-alias-label-tertiary);font-size:11.5px;line-height:1.45}
12142
+ .qai-op__group--wide>.qai-op__grid{grid-template-columns:minmax(0,1fr)}
12143
+ .qai-op__group--checks>.qai-op__grid{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:2px 18px}
12144
+ .qai-op__group--checks .qai-op__toggle-row{flex-direction:row-reverse;justify-content:flex-end;align-items:center;gap:9px;padding:3px 0;text-align:left}
12145
+ .qai-op__group--checks .qai-op__toggle-copy span{padding-left:25px}
12146
+ .qai-op__group--limits{border-top:1px solid var(--dsw-alias-border-l2);padding-top:10px}
12147
+ .qai-op__group-summary{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;cursor:pointer;list-style:none;user-select:none}
12148
+ .qai-op__group-summary::-webkit-details-marker{display:none}
12149
+ .qai-op__group-summary::before{content:"";width:6px;height:6px;flex:none;align-self:center;border-right:1.5px solid var(--dsw-alias-label-tertiary);border-bottom:1.5px solid var(--dsw-alias-label-tertiary);transform:rotate(-45deg);transition:transform .16s}
12150
+ .qai-op__group--limits[open]>.qai-op__group-summary::before{transform:rotate(45deg)}
12151
+ .qai-op__group-summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
12152
+ .qai-op__group--limits>.qai-op__grid{padding-top:10px}
12153
+ .qai-op__field{display:flex;flex-direction:column;gap:6px;font-size:13px;min-width:0}
12154
+ .qai-op__label{display:flex;align-items:center;gap:6px;font-weight:600;color:var(--dsw-alias-label-primary);font-size:12.5px}
12155
+ .qai-op__hint{color:var(--dsw-alias-label-tertiary);font-size:11.5px;line-height:1.45;font-weight:400}
12156
+ .qai-op__overridden{border-radius:999px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);padding:0 7px;font-size:10.5px;font-weight:500;white-space:nowrap}
12157
+ .qai-op__input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;padding:7px 10px;font:inherit;font-size:13px;width:100%;min-width:0;box-sizing:border-box}
12158
+ .qai-op__input:focus-visible,.qai-op__button:focus-visible,.qai-op__section-summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
12159
+ .qai-op__button{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;padding:7px 12px;font:inherit;font-size:12.5px;cursor:pointer;white-space:nowrap}
12160
+ .qai-op__button:disabled{cursor:not-allowed;opacity:.55}
12161
+ .qai-op__toggle-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;font-size:12.5px;padding:4px 0}
12162
+ .qai-op__toggle-row--inline{align-items:center;padding:0}
12163
+ .qai-op__toggle-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
12164
+ .qai-op__toggle-copy strong{display:flex;align-items:center;gap:6px;font-weight:600;color:var(--dsw-alias-label-primary)}
12165
+ .qai-op__toggle-copy span{color:var(--dsw-alias-label-tertiary);font-size:11.5px;line-height:1.45}
12166
+ .qai-op__toggle{width:16px;height:16px;flex:none;accent-color:var(--dsw-alias-brand-primary);margin-top:2px}
12167
+ .qai-op__rows{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
12168
+ .qai-op__row{display:flex;align-items:center;gap:8px;font-size:12.5px}
12169
+ .qai-op__row-key{color:var(--dsw-alias-label-secondary);font-size:12px;flex:none;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
12170
+ .qai-op__row-value{color:var(--dsw-alias-label-primary);font-size:12.5px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
12171
+ .qai-op__row-add{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
12172
+ .qai-op__row-add .qai-op__input{width:auto;flex:1;min-width:120px}
12173
+ .qai-op__row-remove{border:0;background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11.5px;cursor:pointer;padding:2px 4px;flex:none}
12174
+ .qai-op__row-remove:hover{color:var(--dsw-alias-state-error-primary)}
12175
+ .qai-op__instances,.qai-op__profiles{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none}
12176
+ .qai-op__instance,.qai-op__profile{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-3);padding:10px;display:flex;flex-direction:column;gap:8px}
12177
+ .qai-op__instance{flex-direction:row;align-items:flex-end;flex-wrap:wrap}
12178
+ .qai-op__instance-cell{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--dsw-alias-label-tertiary);flex:1;min-width:110px}
12179
+ .qai-op__instance-cell--wide{flex:2}
12180
+ .qai-op__instance-key{font-size:11px;color:var(--dsw-alias-label-tertiary)}
12181
+ .qai-op__profile-head{display:flex;align-items:center;gap:10px}
12182
+ .qai-op__profile-head strong{font-size:13px;color:var(--dsw-alias-label-primary);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
12183
+ .qai-op__profile-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px 12px}
10114
12184
  `}`;
12185
+ //#endregion
12186
+ //#region src/shared/settings.ts
12187
+ /**
12188
+ * Identity shared by the Host plugin and its operator card.
12189
+ *
12190
+ * This module must stay dependency-free: the card bundle inlines it, and a
12191
+ * browser build must not pull the Host config surface (schemastery) into the
12192
+ * page just to learn the namespace name.
12193
+ */
12194
+ /**
12195
+ * Settings namespace the plugin owns and its operator card binds to. The
12196
+ * namespace carries the deployment configuration the card edits; the profile
12197
+ * composition row stays the base layer an override reverts to.
12198
+ */
12199
+ const QA_INTEGRATIONS_SETTINGS_NAMESPACE = "qa-integrations";
10115
12200
  //#endregion
10116
12201
  //#region src/client/index.tsx
10117
12202
  const inject = [
10118
12203
  "remote",
10119
12204
  "qaUserSettingsSections",
10120
12205
  "qaUserSession",
12206
+ "settingsScope",
10121
12207
  "slots"
10122
12208
  ];
10123
12209
  /**
10124
- * Both mounts of the provider cards come from this one bundle: the page of the
10125
- * signed-in user's QA settings dialog, where the account gate lives, and the
10126
- * feature-owned tab in the host's Plugins settings, which reaches the same
10127
- * account through the `qaUserSession` service without depending on the Host
10128
- * settings directory.
12210
+ * All three mounts of this one bundle: the operator card in the Host's
12211
+ * "Plugin configuration" tab, which edits the plugin's settings namespace, the
12212
+ * page of the signed-in user's QA settings dialog, where the account gate
12213
+ * lives, and the feature-owned tab in the host's Plugins settings, which
12214
+ * reaches the same account through the `qaUserSession` service without
12215
+ * depending on the Host settings directory.
10129
12216
  */
10130
12217
  async function apply(ctx) {
10131
12218
  const disposeRemote = await ctx.remote.$mount(TYPERT_REMOTE);
@@ -10134,6 +12221,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10134
12221
  "remote.qaIntegrations",
10135
12222
  "qaUserSettingsSections",
10136
12223
  "qaUserSession",
12224
+ "settingsScope",
10137
12225
  "slots"
10138
12226
  ], (injected) => {
10139
12227
  const face = injected;
@@ -10147,6 +12235,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10147
12235
  document.head.append(style);
10148
12236
  return () => style.remove();
10149
12237
  }, "dsh-qa-integrations: styles");
12238
+ const removeCard = registerSettingsCard(face, {
12239
+ key: QA_INTEGRATIONS_SETTINGS_NAMESPACE,
12240
+ pluginName: "@yadsh/dsh-qa-integrations",
12241
+ component: OperatorCard,
12242
+ inject: () => ({ scope: face.settingsScope.bind({ namespace: QA_INTEGRATIONS_SETTINGS_NAMESPACE }) })
12243
+ });
10150
12244
  (async () => {
10151
12245
  const description = await face.remote.qaIntegrations.describe();
10152
12246
  if (cancelled || !description.ok || !description.value.enabled) return;
@@ -10169,6 +12263,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10169
12263
  cancelled = true;
10170
12264
  removeSection?.();
10171
12265
  removeHostTab?.();
12266
+ removeCard?.();
10172
12267
  };
10173
12268
  });
10174
12269
  } catch (error) {