@iobroker/json-config 8.4.13 → 8.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1822,6 +1822,9 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
1822
1822
  ### **WORK IN PROGRESS**
1823
1823
  -->
1824
1824
  ## Changelog
1825
+ ### 8.4.15 (2026-07-04)
1826
+ - (@GermanBluefox) Extended Credentials Component with AWS and Azure
1827
+
1825
1828
  ### 8.4.13 (2026-06-29)
1826
1829
  - (@GermanBluefox) Corrected the file selector component
1827
1830
  - (@GermanBluefox) Implemented no translation for the select component
@@ -1,7 +1,7 @@
1
1
  import { type JSX } from 'react';
2
2
  import type { ConfigItemCredentialSelect } from '../types';
3
3
  import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
4
- type CredentialType = 'email' | 'cloud' | 'ai' | 'custom';
4
+ type CredentialType = 'email' | 'cloud' | 'ai' | 'aws' | 'azure' | 'custom';
5
5
  interface ConfigCredentialSelectProps extends ConfigGenericProps {
6
6
  schema: ConfigItemCredentialSelect;
7
7
  }
@@ -7,21 +7,88 @@ import ConfigGeneric from './ConfigGeneric';
7
7
  const CREDENTIALS_PREFIX = 'system.credentials.';
8
8
  /** Current version of the credential data format (keep in sync with `@iobroker/adapter-core`). */
9
9
  const CREDENTIALS_VERSION = 1;
10
- const CREDENTIAL_TYPES = ['email', 'cloud', 'ai', 'custom'];
10
+ const CREDENTIAL_TYPES = ['email', 'cloud', 'ai', 'aws', 'azure', 'custom'];
11
11
  /** Readable labels for the category selector (translated where a key exists, English fallback otherwise). */
12
12
  const CREDENTIAL_TYPE_LABELS = {
13
13
  email: 'E-mail',
14
14
  cloud: 'Cloud',
15
15
  ai: 'AI',
16
+ aws: 'AWS',
17
+ azure: 'Azure',
16
18
  custom: 'Custom',
17
19
  };
18
- /** The two credential forms and their fields (keep in sync with admin `credentialTypes.ts`). */
20
+ /** Common AWS regions offered in the region selector (keep in sync with admin `credentialTypes.ts`). */
21
+ const AWS_REGIONS = [
22
+ { value: 'us-east-1', label: 'us-east-1 (US East, N. Virginia)' },
23
+ { value: 'us-east-2', label: 'us-east-2 (US East, Ohio)' },
24
+ { value: 'us-west-1', label: 'us-west-1 (US West, N. California)' },
25
+ { value: 'us-west-2', label: 'us-west-2 (US West, Oregon)' },
26
+ { value: 'ca-central-1', label: 'ca-central-1 (Canada Central)' },
27
+ { value: 'sa-east-1', label: 'sa-east-1 (South America, São Paulo)' },
28
+ { value: 'eu-west-1', label: 'eu-west-1 (Europe, Ireland)' },
29
+ { value: 'eu-west-2', label: 'eu-west-2 (Europe, London)' },
30
+ { value: 'eu-west-3', label: 'eu-west-3 (Europe, Paris)' },
31
+ { value: 'eu-central-1', label: 'eu-central-1 (Europe, Frankfurt)' },
32
+ { value: 'eu-central-2', label: 'eu-central-2 (Europe, Zurich)' },
33
+ { value: 'eu-north-1', label: 'eu-north-1 (Europe, Stockholm)' },
34
+ { value: 'eu-south-1', label: 'eu-south-1 (Europe, Milan)' },
35
+ { value: 'eu-south-2', label: 'eu-south-2 (Europe, Spain)' },
36
+ { value: 'ap-south-1', label: 'ap-south-1 (Asia Pacific, Mumbai)' },
37
+ { value: 'ap-northeast-1', label: 'ap-northeast-1 (Asia Pacific, Tokyo)' },
38
+ { value: 'ap-northeast-2', label: 'ap-northeast-2 (Asia Pacific, Seoul)' },
39
+ { value: 'ap-northeast-3', label: 'ap-northeast-3 (Asia Pacific, Osaka)' },
40
+ { value: 'ap-southeast-1', label: 'ap-southeast-1 (Asia Pacific, Singapore)' },
41
+ { value: 'ap-southeast-2', label: 'ap-southeast-2 (Asia Pacific, Sydney)' },
42
+ { value: 'me-central-1', label: 'me-central-1 (Middle East, UAE)' },
43
+ { value: 'me-south-1', label: 'me-south-1 (Middle East, Bahrain)' },
44
+ { value: 'af-south-1', label: 'af-south-1 (Africa, Cape Town)' },
45
+ ];
46
+ /** Common Azure regions offered in the region selector (keep in sync with admin `credentialTypes.ts`). */
47
+ const AZURE_REGIONS = [
48
+ { value: 'eastus', label: 'eastus (East US)' },
49
+ { value: 'eastus2', label: 'eastus2 (East US 2)' },
50
+ { value: 'centralus', label: 'centralus (Central US)' },
51
+ { value: 'northcentralus', label: 'northcentralus (North Central US)' },
52
+ { value: 'southcentralus', label: 'southcentralus (South Central US)' },
53
+ { value: 'westus', label: 'westus (West US)' },
54
+ { value: 'westus2', label: 'westus2 (West US 2)' },
55
+ { value: 'westus3', label: 'westus3 (West US 3)' },
56
+ { value: 'canadacentral', label: 'canadacentral (Canada Central)' },
57
+ { value: 'brazilsouth', label: 'brazilsouth (Brazil South)' },
58
+ { value: 'northeurope', label: 'northeurope (North Europe)' },
59
+ { value: 'westeurope', label: 'westeurope (West Europe)' },
60
+ { value: 'francecentral', label: 'francecentral (France Central)' },
61
+ { value: 'germanywestcentral', label: 'germanywestcentral (Germany West Central)' },
62
+ { value: 'norwayeast', label: 'norwayeast (Norway East)' },
63
+ { value: 'swedencentral', label: 'swedencentral (Sweden Central)' },
64
+ { value: 'switzerlandnorth', label: 'switzerlandnorth (Switzerland North)' },
65
+ { value: 'uksouth', label: 'uksouth (UK South)' },
66
+ { value: 'ukwest', label: 'ukwest (UK West)' },
67
+ { value: 'uaenorth', label: 'uaenorth (UAE North)' },
68
+ { value: 'southafricanorth', label: 'southafricanorth (South Africa North)' },
69
+ { value: 'centralindia', label: 'centralindia (Central India)' },
70
+ { value: 'eastasia', label: 'eastasia (East Asia)' },
71
+ { value: 'southeastasia', label: 'southeastasia (Southeast Asia)' },
72
+ { value: 'japaneast', label: 'japaneast (Japan East)' },
73
+ { value: 'koreacentral', label: 'koreacentral (Korea Central)' },
74
+ { value: 'australiaeast', label: 'australiaeast (Australia East)' },
75
+ ];
76
+ /** The credential forms and their fields (keep in sync with admin `credentialTypes.ts`). */
19
77
  const CREDENTIAL_FORMS = {
20
78
  login: [
21
79
  { name: 'login', type: 'text', required: true, label: 'Login' },
22
80
  { name: 'password', type: 'password', encrypted: true, required: true, label: 'Password' },
23
81
  ],
24
82
  key: [{ name: 'key', type: 'password', encrypted: true, required: true, label: 'Key' }],
83
+ aws: [
84
+ { name: 'accessKeyId', type: 'text', required: true, label: 'Access Key ID' },
85
+ { name: 'secretAccessKey', type: 'password', encrypted: true, required: true, label: 'Secret Access Key' },
86
+ { name: 'region', type: 'select', required: true, label: 'Region', options: AWS_REGIONS },
87
+ ],
88
+ azure: [
89
+ { name: 'subscriptionKey', type: 'password', encrypted: true, required: true, label: 'Subscription Key' },
90
+ { name: 'region', type: 'select', required: true, label: 'Region', options: AZURE_REGIONS },
91
+ ],
25
92
  };
26
93
  /**
27
94
  * SVG paths in a 24x24 viewBox: brand logos from https://simpleicons.org (CC0), the rest Material icons.
@@ -34,6 +101,8 @@ const ICON_PATHS = {
34
101
  email: 'M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z',
35
102
  login: 'M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z',
36
103
  key: 'M21 10h-8.35A5.99 5.99 0 0 0 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6a5.99 5.99 0 0 0 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z',
104
+ aws: 'M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z',
105
+ azure: 'M22.379 23.343a1.62 1.62 0 0 0 1.536-2.14v.002L17.35 1.76A1.62 1.62 0 0 0 15.816.657H8.184A1.62 1.62 0 0 0 6.65 1.76L.086 21.204a1.62 1.62 0 0 0 1.536 2.139h4.741a1.62 1.62 0 0 0 1.535-1.103l.977-2.892 4.947 3.675c.28.208.618.32.966.32m-3.084-12.531 3.624 10.739a.54.54 0 0 1-.51.713v-.001h-.03a.54.54 0 0 1-.322-.106l-9.287-6.9h4.853m6.313 7.006c.116-.326.13-.694.007-1.058L9.79 1.76a1.722 1.722 0 0 0-.007-.02h6.034a.54.54 0 0 1 .512.366l6.562 19.445a.54.54 0 0 1-.338.684',
37
106
  };
38
107
  /** Convert an SVG path to a base64 data URL (the SVG content is pure ASCII, so `btoa` can encode it directly). */
39
108
  function svgDataUrl(path, color) {
@@ -48,12 +117,16 @@ const ICON_DATA = {
48
117
  email: svgDataUrl(ICON_PATHS.email, '#2196f3'),
49
118
  login: svgDataUrl(ICON_PATHS.login, '#9e9e9e'),
50
119
  key: svgDataUrl(ICON_PATHS.key, '#ffc107'),
120
+ aws: svgDataUrl(ICON_PATHS.aws, '#ff9900'),
121
+ azure: svgDataUrl(ICON_PATHS.azure, '#0089d6'),
51
122
  };
52
123
  /** Templates offered in the "Add credential" dialog (a focused subset of the admin's templates). */
53
124
  const CREDENTIAL_TEMPLATES = {
54
125
  anthropic: { label: 'Anthropic', icon: ICON_DATA.anthropic, form: 'key', type: 'ai', name: 'anthropic' },
55
126
  chatgpt: { label: 'ChatGPT', icon: ICON_DATA.chatgpt, form: 'key', type: 'ai', name: 'chatgpt' },
56
127
  gemini: { label: 'Google Gemini', icon: ICON_DATA.gemini, form: 'key', type: 'ai', name: 'gemini' },
128
+ aws: { label: 'AWS', icon: ICON_DATA.aws, form: 'aws', type: 'aws', name: 'aws' },
129
+ azure: { label: 'Azure', icon: ICON_DATA.azure, form: 'azure', type: 'azure', name: 'azure' },
57
130
  email: { label: 'E-mail', icon: ICON_DATA.email, form: 'login', type: 'email' },
58
131
  login: { label: 'Login & password', icon: ICON_DATA.login, form: 'login', type: null },
59
132
  key: { label: 'Key', icon: ICON_DATA.key, form: 'key', type: null },
@@ -170,6 +243,7 @@ export default class ConfigCredentialSelect extends ConfigGeneric {
170
243
  const socket = this.props.oContext.socket;
171
244
  const native = {
172
245
  type,
246
+ form,
173
247
  version: CREDENTIALS_VERSION,
174
248
  encryptedFields: fields.filter(field => field.encrypted).map(field => field.name),
175
249
  };
@@ -229,13 +303,30 @@ export default class ConfigCredentialSelect extends ConfigGeneric {
229
303
  React.createElement(InputLabel, { shrink: true }, I18n.t('jc_Credential type')),
230
304
  React.createElement(Select, { variant: "standard", value: this.state.addType || 'custom', onChange: e => this.setState({ addType: e.target.value }) }, CREDENTIAL_TYPES.map(type => (React.createElement(MenuItem, { key: type, value: type }, I18n.t(CREDENTIAL_TYPE_LABELS[type]))))))) : null,
231
305
  React.createElement(TextField, { variant: "standard", fullWidth: true, label: I18n.t('jc_Name'), value: this.state.addName || '', error: !!this.state.addError, helperText: this.state.addName ? id : '', slotProps: { inputLabel: { shrink: true }, htmlInput: { autoComplete: 'off' } }, onChange: e => this.setState({ addName: e.target.value, addError: '' }) }),
232
- fields.map(field => (React.createElement(TextField, { key: field.name, variant: "standard", fullWidth: true, type: field.type === 'password' ? 'password' : 'text', required: field.required, label: I18n.t(field.label), value: this.state.addFields?.[field.name] || '', slotProps: {
233
- inputLabel: { shrink: true },
234
- htmlInput: { autoComplete: field.type === 'password' ? 'new-password' : 'off' },
235
- }, onChange: e => this.setState({
236
- addFields: { ...(this.state.addFields || {}), [field.name]: e.target.value },
237
- addError: '',
238
- }) }))),
306
+ fields.map(field => {
307
+ const fieldValue = this.state.addFields?.[field.name] || '';
308
+ if (field.type === 'select') {
309
+ const options = field.options ? [...field.options] : [];
310
+ // keep a preset value that is not part of the predefined list selectable
311
+ if (fieldValue && !options.find(option => option.value === fieldValue)) {
312
+ options.unshift({ value: fieldValue });
313
+ }
314
+ return (React.createElement(TextField, { key: field.name, select: true, variant: "standard", fullWidth: true, required: field.required, label: I18n.t(field.label), value: fieldValue, slotProps: { inputLabel: { shrink: true } }, onChange: e => this.setState({
315
+ addFields: {
316
+ ...(this.state.addFields || {}),
317
+ [field.name]: e.target.value,
318
+ },
319
+ addError: '',
320
+ }) }, options.map(option => (React.createElement(MenuItem, { key: option.value, value: option.value }, option.label || option.value)))));
321
+ }
322
+ return (React.createElement(TextField, { key: field.name, variant: "standard", fullWidth: true, type: field.type === 'password' ? 'password' : 'text', required: field.required, label: I18n.t(field.label), value: fieldValue, slotProps: {
323
+ inputLabel: { shrink: true },
324
+ htmlInput: { autoComplete: field.type === 'password' ? 'new-password' : 'off' },
325
+ }, onChange: e => this.setState({
326
+ addFields: { ...(this.state.addFields || {}), [field.name]: e.target.value },
327
+ addError: '',
328
+ }) }));
329
+ }),
239
330
  this.state.addError ? React.createElement(Alert, { severity: "error" }, this.state.addError) : null),
240
331
  React.createElement(DialogActions, null,
241
332
  React.createElement(Button, { variant: "contained", color: "primary", disabled: !!this.state.addSaving || !(this.state.addName || '').trim(), startIcon: React.createElement(CheckIcon, null), onClick: () => this.createCredential() }, I18n.t('jc_Create')),
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigCredentialSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCredentialSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,WAAW,EACX,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,EACN,WAAW,EACX,aAAa,EACb,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,2GAA2G;AAC3G,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,kGAAkG;AAClG,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAG9B,MAAM,gBAAgB,GAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9E,6GAA6G;AAC7G,MAAM,sBAAsB,GAAmC;IAC3D,KAAK,EAAE,QAAQ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AI,CAAC,KAAK,CAAC,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACpC,oBAAC,QAAQ,IACL,GAAG,EAAE,KAAK,CAAC,KAAK,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAEtE,oBAAoB,CACjB,KAAK,EACL,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,KAAK,KAAK,CAAC,EACpE,OAAO,CACV,CACM,CACd,CAAC,CACG;gBACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE;YACb,SAAS,CAAC,CAAC,CAAC,CACT,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;gBAEnC,oBAAC,OAAO,OAAG,CACF,CAChB,CAAC,CAAC,CAAC,IAAI;YACP,IAAI,CAAC,eAAe,EAAE,CACrB,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormControl,\n Select,\n FormHelperText,\n IconButton,\n Dialog,\n DialogTitle,\n DialogContent,\n DialogActions,\n Button,\n TextField,\n Alert,\n} from '@mui/material';\nimport { Add as AddIcon, Check as CheckIcon, Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n, Icon, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemCredentialSelect } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\n/** Prefix of all credential object IDs. Synchronized with `@iobroker/adapter-core` (src/credentials.ts) */\nconst CREDENTIALS_PREFIX = 'system.credentials.';\n\n/** Current version of the credential data format (keep in sync with `@iobroker/adapter-core`). */\nconst CREDENTIALS_VERSION = 1;\n\ntype CredentialType = 'email' | 'cloud' | 'ai' | 'custom';\nconst CREDENTIAL_TYPES: CredentialType[] = ['email', 'cloud', 'ai', 'custom'];\n/** Readable labels for the category selector (translated where a key exists, English fallback otherwise). */\nconst CREDENTIAL_TYPE_LABELS: Record<CredentialType, string> = {\n email: 'E-mail',\n cloud: 'Cloud',\n ai: 'AI',\n custom: 'Custom',\n};\n\ntype CredentialForm = 'login' | 'key';\n\ninterface CredentialFieldDefinition {\n /** Attribute name in the object's `native` */\n name: string;\n type: 'text' | 'password';\n /** Stored encrypted with the system secret */\n encrypted?: boolean;\n required?: boolean;\n /** Label shown in the create dialog */\n label: string;\n}\n\n/** The two credential forms and their fields (keep in sync with admin `credentialTypes.ts`). */\nconst CREDENTIAL_FORMS: Record<CredentialForm, CredentialFieldDefinition[]> = {\n login: [\n { name: 'login', type: 'text', required: true, label: 'Login' },\n { name: 'password', type: 'password', encrypted: true, required: true, label: 'Password' },\n ],\n key: [{ name: 'key', type: 'password', encrypted: true, required: true, label: 'Key' }],\n};\n\n/**\n * SVG paths in a 24x24 viewBox: brand logos from https://simpleicons.org (CC0), the rest Material icons.\n * Kept in sync with admin `CredentialsDialog.tsx`.\n */\nconst ICON_PATHS = {\n anthropic:\n 'M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5527h3.7442L10.5363 3.541Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z',\n chatgpt:\n 'M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.073zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.8956zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654 2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z',\n gemini: 'M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81',\n email: 'M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z',\n login: 'M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z',\n key: 'M21 10h-8.35A5.99 5.99 0 0 0 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6a5.99 5.99 0 0 0 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z',\n};\n\n/** Convert an SVG path to a base64 data URL (the SVG content is pure ASCII, so `btoa` can encode it directly). */\nfunction svgDataUrl(path: string, color: string): string {\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"${color}\" d=\"${path}\"/></svg>`;\n return `data:image/svg+xml;base64,${window.btoa(svg)}`;\n}\n\n/** Icon data URLs per template key — stored in `common.icon` of the created credential and shown in the UI. */\nconst ICON_DATA: Record<string, string> = {\n anthropic: svgDataUrl(ICON_PATHS.anthropic, '#d97757'),\n chatgpt: svgDataUrl(ICON_PATHS.chatgpt, '#74aa9c'),\n gemini: svgDataUrl(ICON_PATHS.gemini, '#8e75b2'),\n email: svgDataUrl(ICON_PATHS.email, '#2196f3'),\n login: svgDataUrl(ICON_PATHS.login, '#9e9e9e'),\n key: svgDataUrl(ICON_PATHS.key, '#ffc107'),\n};\n\ninterface CredentialTemplate {\n /** Label shown in the template selector */\n label: string;\n /** Icon (data URL) stored in `common.icon` */\n icon: string;\n /** Form of the credential: login/password or a single key */\n form: CredentialForm;\n /** Fixed category, or null if it follows the schema/user selection */\n type: CredentialType | null;\n /** Proposed unique name */\n name?: string;\n}\n\n/** Templates offered in the \"Add credential\" dialog (a focused subset of the admin's templates). */\nconst CREDENTIAL_TEMPLATES: Record<string, CredentialTemplate> = {\n anthropic: { label: 'Anthropic', icon: ICON_DATA.anthropic, form: 'key', type: 'ai', name: 'anthropic' },\n chatgpt: { label: 'ChatGPT', icon: ICON_DATA.chatgpt, form: 'key', type: 'ai', name: 'chatgpt' },\n gemini: { label: 'Google Gemini', icon: ICON_DATA.gemini, form: 'key', type: 'ai', name: 'gemini' },\n email: { label: 'E-mail', icon: ICON_DATA.email, form: 'login', type: 'email' },\n login: { label: 'Login & password', icon: ICON_DATA.login, form: 'login', type: null },\n key: { label: 'Key', icon: ICON_DATA.key, form: 'key', type: null },\n};\n\ninterface ConfigCredentialSelectProps extends ConfigGenericProps {\n schema: ConfigItemCredentialSelect;\n}\n\ninterface CredentialSelectOption {\n label: string;\n value: string;\n /** Icon of the credential (data URL from `common.icon`) */\n icon?: string;\n}\n\ninterface ConfigCredentialSelectState extends ConfigGenericState {\n selectOptions?: CredentialSelectOption[];\n /** Whether the \"create credential\" dialog is open */\n addOpen?: boolean;\n /** Selected template key */\n addTemplate?: string;\n addName?: string;\n addType?: CredentialType;\n addFields?: Record<string, string>;\n addError?: string;\n addSaving?: boolean;\n}\n\nfunction renderCredentialItem(\n option: CredentialSelectOption | undefined,\n label: string,\n anyIcon: boolean,\n): JSX.Element {\n return (\n <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n {option?.icon ? (\n <Icon\n src={option.icon}\n style={{ width: 20, height: 20 }}\n />\n ) : anyIcon ? (\n // if at least one option has an icon, keep the labels aligned\n <span style={{ width: 20, height: 20, flexShrink: 0 }} />\n ) : null}\n {label}\n </span>\n );\n}\n\nexport default class ConfigCredentialSelect extends ConfigGeneric<\n ConfigCredentialSelectProps,\n ConfigCredentialSelectState\n> {\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n const selectOptions = await this.readCredentials();\n this.setState({ value, selectOptions });\n }\n\n /**\n * Read the credential objects (\"system.credentials.<name>\") and turn them into select options,\n * filtered by `schema.credentialType` if set. The \"none\" option is prepended.\n */\n async readCredentials(): Promise<CredentialSelectOption[]> {\n let selectOptions: CredentialSelectOption[] = [];\n try {\n const objs = await this.props.oContext.socket.getObjectViewSystem(\n 'config',\n CREDENTIALS_PREFIX,\n `${CREDENTIALS_PREFIX}香`,\n );\n selectOptions = Object.values(objs)\n .filter(\n obj =>\n !!obj &&\n (!this.props.schema.credentialType ||\n (obj.native as Record<string, any>)?.type === this.props.schema.credentialType),\n )\n .map(obj => ({\n label: ConfigCredentialSelect.getCredentialName(obj as ioBroker.Object),\n value: obj._id,\n icon: typeof obj.common?.icon === 'string' ? obj.common.icon : undefined,\n }))\n .sort((a, b) => a.label.localeCompare(b.label));\n } catch (e) {\n console.error(`Cannot read credentials: ${e}`);\n }\n\n selectOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });\n return selectOptions;\n }\n\n static getCredentialName(obj: ioBroker.Object): string {\n const name = obj.common?.name;\n let text: string;\n if (name && typeof name === 'object') {\n text = name[I18n.getLanguage()] || name.en || Object.values(name)[0] || '';\n } else {\n text = (name as string) || '';\n }\n return text || obj._id.substring(CREDENTIALS_PREFIX.length);\n }\n\n /** Template keys offered for this field, filtered by `schema.credentialType` (type-agnostic ones always shown). */\n templateKeys(): string[] {\n const credentialType = this.props.schema.credentialType;\n return Object.keys(CREDENTIAL_TEMPLATES).filter(key => {\n const template = CREDENTIAL_TEMPLATES[key];\n return !credentialType || template.type === credentialType || template.type === null;\n });\n }\n\n /** Apply a template: it defines the form, the (proposed) name, the category and the icon. */\n selectTemplate(key: string): void {\n const template = CREDENTIAL_TEMPLATES[key];\n this.setState({\n addTemplate: key,\n addName: template.name || '',\n addType: template.type || this.props.schema.credentialType || 'custom',\n addFields: {},\n addError: '',\n });\n }\n\n /** Open the create dialog, pre-selecting the first template that fits the schema's credentialType. */\n openAddDialog(): void {\n const keys = this.templateKeys();\n const addTemplate = keys[0];\n const template = CREDENTIAL_TEMPLATES[addTemplate];\n this.setState({\n addOpen: true,\n addTemplate,\n addName: template.name || '',\n addType: template.type || this.props.schema.credentialType || 'custom',\n addFields: {},\n addError: '',\n addSaving: false,\n });\n }\n\n /** Create the credential object, encrypt its secret fields, store it (with icon), then select it. */\n async createCredential(): Promise<void> {\n const template = CREDENTIAL_TEMPLATES[this.state.addTemplate || ''];\n const name = (this.state.addName || '').trim().replace(Utils.FORBIDDEN_CHARS, '_');\n if (!name) {\n this.setState({ addError: I18n.t('jc_A unique name is required') });\n return;\n }\n const id = `${CREDENTIALS_PREFIX}${name}`;\n if ((this.state.selectOptions || []).find(option => option.value === id)) {\n this.setState({ addError: I18n.t('jc_A credential with this name already exists') });\n return;\n }\n\n const form = template?.form || 'login';\n const fields = CREDENTIAL_FORMS[form];\n const addFields = this.state.addFields || {};\n if (fields.some(field => field.required && !(addFields[field.name] || '').trim())) {\n this.setState({ addError: I18n.t('jc_Please fill in all required fields') });\n return;\n }\n const type: CredentialType =\n template?.type || this.props.schema.credentialType || this.state.addType || 'custom';\n\n this.setState({ addSaving: true, addError: '' });\n try {\n // The actual socket is always an AdminConnection at runtime (only admin can write credentials);\n // `encrypt` uses the system secret, exactly as the admin \"Credentials\" dialog does.\n const socket = this.props.oContext.socket;\n const native: Record<string, any> = {\n type,\n version: CREDENTIALS_VERSION,\n encryptedFields: fields.filter(field => field.encrypted).map(field => field.name),\n };\n for (const field of fields) {\n const raw = addFields[field.name] || '';\n native[field.name] = field.encrypted && raw ? await socket.encrypt(raw) : raw;\n }\n\n const obj = {\n _id: id,\n type: 'config',\n common: { name, ...(template?.icon ? { icon: template.icon } : {}) },\n native,\n // Only the admin may read credentials.\n acl: {\n object: 0x600,\n owner: 'system.user.admin',\n ownerGroup: 'system.group.administrator',\n },\n } as unknown as ioBroker.SettableObject;\n\n await socket.setObject(id, obj);\n\n // Insert the new credential into the options (keeping \"none\" on top), then select it.\n const existing = this.state.selectOptions || [];\n const none = existing.find(option => option.value === ConfigGeneric.NONE_VALUE);\n const rest = existing.filter(option => option.value !== ConfigGeneric.NONE_VALUE);\n rest.push({ label: name, value: id, icon: template?.icon });\n rest.sort((a, b) => a.label.localeCompare(b.label));\n const selectOptions = none ? [none, ...rest] : rest;\n\n this.setState({ addOpen: false, addSaving: false, selectOptions, value: id }, () =>\n this.onChange(this.props.attr, id),\n );\n } catch (e) {\n this.setState({\n addSaving: false,\n addError: I18n.t('jc_Cannot create credential: %s', (e as Error).toString()),\n });\n }\n }\n\n renderAddDialog(): JSX.Element | null {\n if (!this.state.addOpen) {\n return null;\n }\n const template = CREDENTIAL_TEMPLATES[this.state.addTemplate || ''];\n const form = template?.form || 'login';\n const fields = CREDENTIAL_FORMS[form];\n const id = `${CREDENTIALS_PREFIX}${(this.state.addName || '').trim().replace(Utils.FORBIDDEN_CHARS, '_')}`;\n // The category can only be chosen for type-agnostic templates when the schema doesn't pin a type.\n const showCategory = !this.props.schema.credentialType && template?.type === null;\n\n return (\n <Dialog\n open\n maxWidth=\"sm\"\n fullWidth\n onClose={() => this.setState({ addOpen: false })}\n >\n <DialogTitle>{I18n.t('jc_Add credential')}</DialogTitle>\n <DialogContent style={{ display: 'flex', flexDirection: 'column', gap: 12, paddingTop: 8 }}>\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <InputLabel shrink>{I18n.t('jc_Template')}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.addTemplate || ''}\n onChange={e => this.selectTemplate(e.target.value)}\n >\n {this.templateKeys().map(key => (\n <MenuItem\n key={key}\n value={key}\n >\n <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n <img\n src={CREDENTIAL_TEMPLATES[key].icon}\n width={20}\n height={20}\n alt=\"\"\n />\n {I18n.t(CREDENTIAL_TEMPLATES[key].label)}\n </span>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n {showCategory ? (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <InputLabel shrink>{I18n.t('jc_Credential type')}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.addType || 'custom'}\n onChange={e => this.setState({ addType: e.target.value as CredentialType })}\n >\n {CREDENTIAL_TYPES.map(type => (\n <MenuItem\n key={type}\n value={type}\n >\n {I18n.t(CREDENTIAL_TYPE_LABELS[type])}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n\n <TextField\n variant=\"standard\"\n fullWidth\n label={I18n.t('jc_Name')}\n value={this.state.addName || ''}\n error={!!this.state.addError}\n helperText={this.state.addName ? id : ''}\n slotProps={{ inputLabel: { shrink: true }, htmlInput: { autoComplete: 'off' } }}\n onChange={e => this.setState({ addName: e.target.value, addError: '' })}\n />\n\n {fields.map(field => (\n <TextField\n key={field.name}\n variant=\"standard\"\n fullWidth\n type={field.type === 'password' ? 'password' : 'text'}\n required={field.required}\n label={I18n.t(field.label)}\n value={this.state.addFields?.[field.name] || ''}\n slotProps={{\n inputLabel: { shrink: true },\n htmlInput: { autoComplete: field.type === 'password' ? 'new-password' : 'off' },\n }}\n onChange={e =>\n this.setState({\n addFields: { ...(this.state.addFields || {}), [field.name]: e.target.value },\n addError: '',\n })\n }\n />\n ))}\n\n {this.state.addError ? <Alert severity=\"error\">{this.state.addError}</Alert> : null}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={!!this.state.addSaving || !(this.state.addName || '').trim()}\n startIcon={<CheckIcon />}\n onClick={() => this.createCredential()}\n >\n {I18n.t('jc_Create')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n disabled={!!this.state.addSaving}\n startIcon={<CloseIcon />}\n onClick={() => this.setState({ addOpen: false })}\n >\n {I18n.t('jc_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | null {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const item = this.state.selectOptions?.find(_item => _item.value === this.state.value);\n // The stored value could point to a meanwhile deleted credential\n const unknownValue =\n this.state.value && this.state.value !== ConfigGeneric.NONE_VALUE && !item ? this.state.value : null;\n // if at least one option has an icon, options without icon get a placeholder for alignment\n const anyIcon = this.state.selectOptions.some(option => !!option.icon);\n // creation can be suppressed per schema (`disableCreation`)\n const canCreate = !this.props.schema.disableCreation;\n\n return (\n <div style={{ display: 'flex', alignItems: 'flex-end', gap: 4, width: '100%' }}>\n <FormControl\n style={{ flex: 1, minWidth: 0 }}\n variant=\"standard\"\n >\n {this.props.schema.label ? (\n <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel>\n ) : null}\n <Select\n variant=\"standard\"\n error={!!error || !!unknownValue}\n displayEmpty\n disabled={!!disabled}\n value={this.state.value || ConfigGeneric.NONE_VALUE}\n renderValue={() =>\n unknownValue\n ? unknownValue\n : renderCredentialItem(\n item,\n this.getText(item?.label, this.props.schema.noTranslation !== false),\n anyIcon,\n )\n }\n onChange={e =>\n this.setState(\n { value: e.target.value === ConfigGeneric.NONE_VALUE ? '' : e.target.value },\n () => this.onChange(this.props.attr, this.state.value),\n )\n }\n >\n {this.state.selectOptions?.map(item_ => (\n <MenuItem\n key={item_.value}\n value={item_.value}\n style={item_.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}\n >\n {renderCredentialItem(\n item_,\n this.getText(item_.label, this.props.schema.noTranslation !== false),\n anyIcon,\n )}\n </MenuItem>\n ))}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n {canCreate ? (\n <IconButton\n size=\"small\"\n disabled={!!disabled}\n title={I18n.t('jc_Add credential')}\n onClick={() => this.openAddDialog()}\n >\n <AddIcon />\n </IconButton>\n ) : null}\n {this.renderAddDialog()}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ConfigCredentialSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCredentialSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,WAAW,EACX,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,EACN,WAAW,EACX,aAAa,EACb,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,2GAA2G;AAC3G,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,kGAAkG;AAClG,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAG9B,MAAM,gBAAgB,GAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC9F,6GAA6G;AAC7G,MAAM,sBAAsB,GAAmC;IAC3D,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,OAAO;IACd,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I,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,KAAK,KAAK,CAAC,EACpE,OAAO,CACV,CACM,CACd,CAAC,CACG;gBACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE;YACb,SAAS,CAAC,CAAC,CAAC,CACT,oBAAC,UAAU,IACP,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;gBAEnC,oBAAC,OAAO,OAAG,CACF,CAChB,CAAC,CAAC,CAAC,IAAI;YACP,IAAI,CAAC,eAAe,EAAE,CACrB,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormControl,\n Select,\n FormHelperText,\n IconButton,\n Dialog,\n DialogTitle,\n DialogContent,\n DialogActions,\n Button,\n TextField,\n Alert,\n} from '@mui/material';\nimport { Add as AddIcon, Check as CheckIcon, Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n, Icon, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemCredentialSelect } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\n/** Prefix of all credential object IDs. Synchronized with `@iobroker/adapter-core` (src/credentials.ts) */\nconst CREDENTIALS_PREFIX = 'system.credentials.';\n\n/** Current version of the credential data format (keep in sync with `@iobroker/adapter-core`). */\nconst CREDENTIALS_VERSION = 1;\n\ntype CredentialType = 'email' | 'cloud' | 'ai' | 'aws' | 'azure' | 'custom';\nconst CREDENTIAL_TYPES: CredentialType[] = ['email', 'cloud', 'ai', 'aws', 'azure', 'custom'];\n/** Readable labels for the category selector (translated where a key exists, English fallback otherwise). */\nconst CREDENTIAL_TYPE_LABELS: Record<CredentialType, string> = {\n email: 'E-mail',\n cloud: 'Cloud',\n ai: 'AI',\n aws: 'AWS',\n azure: 'Azure',\n custom: 'Custom',\n};\n\ntype CredentialForm = 'login' | 'key' | 'aws' | 'azure';\n\ninterface CredentialFieldOption {\n /** Value stored in `native` */\n value: string;\n /** Text shown in the dropdown (defaults to `value`) */\n label?: string;\n}\n\ninterface CredentialFieldDefinition {\n /** Attribute name in the object's `native` */\n name: string;\n type: 'text' | 'password' | 'select';\n /** Stored encrypted with the system secret */\n encrypted?: boolean;\n required?: boolean;\n /** Label shown in the create dialog */\n label: string;\n /** For `type: 'select'`: the selectable options */\n options?: CredentialFieldOption[];\n}\n\n/** Common AWS regions offered in the region selector (keep in sync with admin `credentialTypes.ts`). */\nconst AWS_REGIONS: CredentialFieldOption[] = [\n { value: 'us-east-1', label: 'us-east-1 (US East, N. Virginia)' },\n { value: 'us-east-2', label: 'us-east-2 (US East, Ohio)' },\n { value: 'us-west-1', label: 'us-west-1 (US West, N. California)' },\n { value: 'us-west-2', label: 'us-west-2 (US West, Oregon)' },\n { value: 'ca-central-1', label: 'ca-central-1 (Canada Central)' },\n { value: 'sa-east-1', label: 'sa-east-1 (South America, São Paulo)' },\n { value: 'eu-west-1', label: 'eu-west-1 (Europe, Ireland)' },\n { value: 'eu-west-2', label: 'eu-west-2 (Europe, London)' },\n { value: 'eu-west-3', label: 'eu-west-3 (Europe, Paris)' },\n { value: 'eu-central-1', label: 'eu-central-1 (Europe, Frankfurt)' },\n { value: 'eu-central-2', label: 'eu-central-2 (Europe, Zurich)' },\n { value: 'eu-north-1', label: 'eu-north-1 (Europe, Stockholm)' },\n { value: 'eu-south-1', label: 'eu-south-1 (Europe, Milan)' },\n { value: 'eu-south-2', label: 'eu-south-2 (Europe, Spain)' },\n { value: 'ap-south-1', label: 'ap-south-1 (Asia Pacific, Mumbai)' },\n { value: 'ap-northeast-1', label: 'ap-northeast-1 (Asia Pacific, Tokyo)' },\n { value: 'ap-northeast-2', label: 'ap-northeast-2 (Asia Pacific, Seoul)' },\n { value: 'ap-northeast-3', label: 'ap-northeast-3 (Asia Pacific, Osaka)' },\n { value: 'ap-southeast-1', label: 'ap-southeast-1 (Asia Pacific, Singapore)' },\n { value: 'ap-southeast-2', label: 'ap-southeast-2 (Asia Pacific, Sydney)' },\n { value: 'me-central-1', label: 'me-central-1 (Middle East, UAE)' },\n { value: 'me-south-1', label: 'me-south-1 (Middle East, Bahrain)' },\n { value: 'af-south-1', label: 'af-south-1 (Africa, Cape Town)' },\n];\n\n/** Common Azure regions offered in the region selector (keep in sync with admin `credentialTypes.ts`). */\nconst AZURE_REGIONS: CredentialFieldOption[] = [\n { value: 'eastus', label: 'eastus (East US)' },\n { value: 'eastus2', label: 'eastus2 (East US 2)' },\n { value: 'centralus', label: 'centralus (Central US)' },\n { value: 'northcentralus', label: 'northcentralus (North Central US)' },\n { value: 'southcentralus', label: 'southcentralus (South Central US)' },\n { value: 'westus', label: 'westus (West US)' },\n { value: 'westus2', label: 'westus2 (West US 2)' },\n { value: 'westus3', label: 'westus3 (West US 3)' },\n { value: 'canadacentral', label: 'canadacentral (Canada Central)' },\n { value: 'brazilsouth', label: 'brazilsouth (Brazil South)' },\n { value: 'northeurope', label: 'northeurope (North Europe)' },\n { value: 'westeurope', label: 'westeurope (West Europe)' },\n { value: 'francecentral', label: 'francecentral (France Central)' },\n { value: 'germanywestcentral', label: 'germanywestcentral (Germany West Central)' },\n { value: 'norwayeast', label: 'norwayeast (Norway East)' },\n { value: 'swedencentral', label: 'swedencentral (Sweden Central)' },\n { value: 'switzerlandnorth', label: 'switzerlandnorth (Switzerland North)' },\n { value: 'uksouth', label: 'uksouth (UK South)' },\n { value: 'ukwest', label: 'ukwest (UK West)' },\n { value: 'uaenorth', label: 'uaenorth (UAE North)' },\n { value: 'southafricanorth', label: 'southafricanorth (South Africa North)' },\n { value: 'centralindia', label: 'centralindia (Central India)' },\n { value: 'eastasia', label: 'eastasia (East Asia)' },\n { value: 'southeastasia', label: 'southeastasia (Southeast Asia)' },\n { value: 'japaneast', label: 'japaneast (Japan East)' },\n { value: 'koreacentral', label: 'koreacentral (Korea Central)' },\n { value: 'australiaeast', label: 'australiaeast (Australia East)' },\n];\n\n/** The credential forms and their fields (keep in sync with admin `credentialTypes.ts`). */\nconst CREDENTIAL_FORMS: Record<CredentialForm, CredentialFieldDefinition[]> = {\n login: [\n { name: 'login', type: 'text', required: true, label: 'Login' },\n { name: 'password', type: 'password', encrypted: true, required: true, label: 'Password' },\n ],\n key: [{ name: 'key', type: 'password', encrypted: true, required: true, label: 'Key' }],\n aws: [\n { name: 'accessKeyId', type: 'text', required: true, label: 'Access Key ID' },\n { name: 'secretAccessKey', type: 'password', encrypted: true, required: true, label: 'Secret Access Key' },\n { name: 'region', type: 'select', required: true, label: 'Region', options: AWS_REGIONS },\n ],\n azure: [\n { name: 'subscriptionKey', type: 'password', encrypted: true, required: true, label: 'Subscription Key' },\n { name: 'region', type: 'select', required: true, label: 'Region', options: AZURE_REGIONS },\n ],\n};\n\n/**\n * SVG paths in a 24x24 viewBox: brand logos from https://simpleicons.org (CC0), the rest Material icons.\n * Kept in sync with admin `CredentialsDialog.tsx`.\n */\nconst ICON_PATHS = {\n anthropic:\n 'M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5527h3.7442L10.5363 3.541Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z',\n chatgpt:\n 'M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.073zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.8956zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654 2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z',\n gemini: 'M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81',\n email: 'M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z',\n login: 'M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z',\n key: 'M21 10h-8.35A5.99 5.99 0 0 0 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6a5.99 5.99 0 0 0 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z',\n aws: 'M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z',\n azure: 'M22.379 23.343a1.62 1.62 0 0 0 1.536-2.14v.002L17.35 1.76A1.62 1.62 0 0 0 15.816.657H8.184A1.62 1.62 0 0 0 6.65 1.76L.086 21.204a1.62 1.62 0 0 0 1.536 2.139h4.741a1.62 1.62 0 0 0 1.535-1.103l.977-2.892 4.947 3.675c.28.208.618.32.966.32m-3.084-12.531 3.624 10.739a.54.54 0 0 1-.51.713v-.001h-.03a.54.54 0 0 1-.322-.106l-9.287-6.9h4.853m6.313 7.006c.116-.326.13-.694.007-1.058L9.79 1.76a1.722 1.722 0 0 0-.007-.02h6.034a.54.54 0 0 1 .512.366l6.562 19.445a.54.54 0 0 1-.338.684',\n};\n\n/** Convert an SVG path to a base64 data URL (the SVG content is pure ASCII, so `btoa` can encode it directly). */\nfunction svgDataUrl(path: string, color: string): string {\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"${color}\" d=\"${path}\"/></svg>`;\n return `data:image/svg+xml;base64,${window.btoa(svg)}`;\n}\n\n/** Icon data URLs per template key — stored in `common.icon` of the created credential and shown in the UI. */\nconst ICON_DATA: Record<string, string> = {\n anthropic: svgDataUrl(ICON_PATHS.anthropic, '#d97757'),\n chatgpt: svgDataUrl(ICON_PATHS.chatgpt, '#74aa9c'),\n gemini: svgDataUrl(ICON_PATHS.gemini, '#8e75b2'),\n email: svgDataUrl(ICON_PATHS.email, '#2196f3'),\n login: svgDataUrl(ICON_PATHS.login, '#9e9e9e'),\n key: svgDataUrl(ICON_PATHS.key, '#ffc107'),\n aws: svgDataUrl(ICON_PATHS.aws, '#ff9900'),\n azure: svgDataUrl(ICON_PATHS.azure, '#0089d6'),\n};\n\ninterface CredentialTemplate {\n /** Label shown in the template selector */\n label: string;\n /** Icon (data URL) stored in `common.icon` */\n icon: string;\n /** Form of the credential: login/password or a single key */\n form: CredentialForm;\n /** Fixed category, or null if it follows the schema/user selection */\n type: CredentialType | null;\n /** Proposed unique name */\n name?: string;\n}\n\n/** Templates offered in the \"Add credential\" dialog (a focused subset of the admin's templates). */\nconst CREDENTIAL_TEMPLATES: Record<string, CredentialTemplate> = {\n anthropic: { label: 'Anthropic', icon: ICON_DATA.anthropic, form: 'key', type: 'ai', name: 'anthropic' },\n chatgpt: { label: 'ChatGPT', icon: ICON_DATA.chatgpt, form: 'key', type: 'ai', name: 'chatgpt' },\n gemini: { label: 'Google Gemini', icon: ICON_DATA.gemini, form: 'key', type: 'ai', name: 'gemini' },\n aws: { label: 'AWS', icon: ICON_DATA.aws, form: 'aws', type: 'aws', name: 'aws' },\n azure: { label: 'Azure', icon: ICON_DATA.azure, form: 'azure', type: 'azure', name: 'azure' },\n email: { label: 'E-mail', icon: ICON_DATA.email, form: 'login', type: 'email' },\n login: { label: 'Login & password', icon: ICON_DATA.login, form: 'login', type: null },\n key: { label: 'Key', icon: ICON_DATA.key, form: 'key', type: null },\n};\n\ninterface ConfigCredentialSelectProps extends ConfigGenericProps {\n schema: ConfigItemCredentialSelect;\n}\n\ninterface CredentialSelectOption {\n label: string;\n value: string;\n /** Icon of the credential (data URL from `common.icon`) */\n icon?: string;\n}\n\ninterface ConfigCredentialSelectState extends ConfigGenericState {\n selectOptions?: CredentialSelectOption[];\n /** Whether the \"create credential\" dialog is open */\n addOpen?: boolean;\n /** Selected template key */\n addTemplate?: string;\n addName?: string;\n addType?: CredentialType;\n addFields?: Record<string, string>;\n addError?: string;\n addSaving?: boolean;\n}\n\nfunction renderCredentialItem(\n option: CredentialSelectOption | undefined,\n label: string,\n anyIcon: boolean,\n): JSX.Element {\n return (\n <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n {option?.icon ? (\n <Icon\n src={option.icon}\n style={{ width: 20, height: 20 }}\n />\n ) : anyIcon ? (\n // if at least one option has an icon, keep the labels aligned\n <span style={{ width: 20, height: 20, flexShrink: 0 }} />\n ) : null}\n {label}\n </span>\n );\n}\n\nexport default class ConfigCredentialSelect extends ConfigGeneric<\n ConfigCredentialSelectProps,\n ConfigCredentialSelectState\n> {\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n const selectOptions = await this.readCredentials();\n this.setState({ value, selectOptions });\n }\n\n /**\n * Read the credential objects (\"system.credentials.<name>\") and turn them into select options,\n * filtered by `schema.credentialType` if set. The \"none\" option is prepended.\n */\n async readCredentials(): Promise<CredentialSelectOption[]> {\n let selectOptions: CredentialSelectOption[] = [];\n try {\n const objs = await this.props.oContext.socket.getObjectViewSystem(\n 'config',\n CREDENTIALS_PREFIX,\n `${CREDENTIALS_PREFIX}香`,\n );\n selectOptions = Object.values(objs)\n .filter(\n obj =>\n !!obj &&\n (!this.props.schema.credentialType ||\n (obj.native as Record<string, any>)?.type === this.props.schema.credentialType),\n )\n .map(obj => ({\n label: ConfigCredentialSelect.getCredentialName(obj as ioBroker.Object),\n value: obj._id,\n icon: typeof obj.common?.icon === 'string' ? obj.common.icon : undefined,\n }))\n .sort((a, b) => a.label.localeCompare(b.label));\n } catch (e) {\n console.error(`Cannot read credentials: ${e}`);\n }\n\n selectOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });\n return selectOptions;\n }\n\n static getCredentialName(obj: ioBroker.Object): string {\n const name = obj.common?.name;\n let text: string;\n if (name && typeof name === 'object') {\n text = name[I18n.getLanguage()] || name.en || Object.values(name)[0] || '';\n } else {\n text = (name as string) || '';\n }\n return text || obj._id.substring(CREDENTIALS_PREFIX.length);\n }\n\n /** Template keys offered for this field, filtered by `schema.credentialType` (type-agnostic ones always shown). */\n templateKeys(): string[] {\n const credentialType = this.props.schema.credentialType;\n return Object.keys(CREDENTIAL_TEMPLATES).filter(key => {\n const template = CREDENTIAL_TEMPLATES[key];\n return !credentialType || template.type === credentialType || template.type === null;\n });\n }\n\n /** Apply a template: it defines the form, the (proposed) name, the category and the icon. */\n selectTemplate(key: string): void {\n const template = CREDENTIAL_TEMPLATES[key];\n this.setState({\n addTemplate: key,\n addName: template.name || '',\n addType: template.type || this.props.schema.credentialType || 'custom',\n addFields: {},\n addError: '',\n });\n }\n\n /** Open the create dialog, pre-selecting the first template that fits the schema's credentialType. */\n openAddDialog(): void {\n const keys = this.templateKeys();\n const addTemplate = keys[0];\n const template = CREDENTIAL_TEMPLATES[addTemplate];\n this.setState({\n addOpen: true,\n addTemplate,\n addName: template.name || '',\n addType: template.type || this.props.schema.credentialType || 'custom',\n addFields: {},\n addError: '',\n addSaving: false,\n });\n }\n\n /** Create the credential object, encrypt its secret fields, store it (with icon), then select it. */\n async createCredential(): Promise<void> {\n const template = CREDENTIAL_TEMPLATES[this.state.addTemplate || ''];\n const name = (this.state.addName || '').trim().replace(Utils.FORBIDDEN_CHARS, '_');\n if (!name) {\n this.setState({ addError: I18n.t('jc_A unique name is required') });\n return;\n }\n const id = `${CREDENTIALS_PREFIX}${name}`;\n if ((this.state.selectOptions || []).find(option => option.value === id)) {\n this.setState({ addError: I18n.t('jc_A credential with this name already exists') });\n return;\n }\n\n const form = template?.form || 'login';\n const fields = CREDENTIAL_FORMS[form];\n const addFields = this.state.addFields || {};\n if (fields.some(field => field.required && !(addFields[field.name] || '').trim())) {\n this.setState({ addError: I18n.t('jc_Please fill in all required fields') });\n return;\n }\n const type: CredentialType =\n template?.type || this.props.schema.credentialType || this.state.addType || 'custom';\n\n this.setState({ addSaving: true, addError: '' });\n try {\n // The actual socket is always an AdminConnection at runtime (only admin can write credentials);\n // `encrypt` uses the system secret, exactly as the admin \"Credentials\" dialog does.\n const socket = this.props.oContext.socket;\n const native: Record<string, any> = {\n type,\n form,\n version: CREDENTIALS_VERSION,\n encryptedFields: fields.filter(field => field.encrypted).map(field => field.name),\n };\n for (const field of fields) {\n const raw = addFields[field.name] || '';\n native[field.name] = field.encrypted && raw ? await socket.encrypt(raw) : raw;\n }\n\n const obj = {\n _id: id,\n type: 'config',\n common: { name, ...(template?.icon ? { icon: template.icon } : {}) },\n native,\n // Only the admin may read credentials.\n acl: {\n object: 0x600,\n owner: 'system.user.admin',\n ownerGroup: 'system.group.administrator',\n },\n } as unknown as ioBroker.SettableObject;\n\n await socket.setObject(id, obj);\n\n // Insert the new credential into the options (keeping \"none\" on top), then select it.\n const existing = this.state.selectOptions || [];\n const none = existing.find(option => option.value === ConfigGeneric.NONE_VALUE);\n const rest = existing.filter(option => option.value !== ConfigGeneric.NONE_VALUE);\n rest.push({ label: name, value: id, icon: template?.icon });\n rest.sort((a, b) => a.label.localeCompare(b.label));\n const selectOptions = none ? [none, ...rest] : rest;\n\n this.setState({ addOpen: false, addSaving: false, selectOptions, value: id }, () =>\n this.onChange(this.props.attr, id),\n );\n } catch (e) {\n this.setState({\n addSaving: false,\n addError: I18n.t('jc_Cannot create credential: %s', (e as Error).toString()),\n });\n }\n }\n\n renderAddDialog(): JSX.Element | null {\n if (!this.state.addOpen) {\n return null;\n }\n const template = CREDENTIAL_TEMPLATES[this.state.addTemplate || ''];\n const form = template?.form || 'login';\n const fields = CREDENTIAL_FORMS[form];\n const id = `${CREDENTIALS_PREFIX}${(this.state.addName || '').trim().replace(Utils.FORBIDDEN_CHARS, '_')}`;\n // The category can only be chosen for type-agnostic templates when the schema doesn't pin a type.\n const showCategory = !this.props.schema.credentialType && template?.type === null;\n\n return (\n <Dialog\n open\n maxWidth=\"sm\"\n fullWidth\n onClose={() => this.setState({ addOpen: false })}\n >\n <DialogTitle>{I18n.t('jc_Add credential')}</DialogTitle>\n <DialogContent style={{ display: 'flex', flexDirection: 'column', gap: 12, paddingTop: 8 }}>\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <InputLabel shrink>{I18n.t('jc_Template')}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.addTemplate || ''}\n onChange={e => this.selectTemplate(e.target.value)}\n >\n {this.templateKeys().map(key => (\n <MenuItem\n key={key}\n value={key}\n >\n <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n <img\n src={CREDENTIAL_TEMPLATES[key].icon}\n width={20}\n height={20}\n alt=\"\"\n />\n {I18n.t(CREDENTIAL_TEMPLATES[key].label)}\n </span>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n {showCategory ? (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n <InputLabel shrink>{I18n.t('jc_Credential type')}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.addType || 'custom'}\n onChange={e => this.setState({ addType: e.target.value as CredentialType })}\n >\n {CREDENTIAL_TYPES.map(type => (\n <MenuItem\n key={type}\n value={type}\n >\n {I18n.t(CREDENTIAL_TYPE_LABELS[type])}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n\n <TextField\n variant=\"standard\"\n fullWidth\n label={I18n.t('jc_Name')}\n value={this.state.addName || ''}\n error={!!this.state.addError}\n helperText={this.state.addName ? id : ''}\n slotProps={{ inputLabel: { shrink: true }, htmlInput: { autoComplete: 'off' } }}\n onChange={e => this.setState({ addName: e.target.value, addError: '' })}\n />\n\n {fields.map(field => {\n const fieldValue = this.state.addFields?.[field.name] || '';\n if (field.type === 'select') {\n const options = field.options ? [...field.options] : [];\n // keep a preset value that is not part of the predefined list selectable\n if (fieldValue && !options.find(option => option.value === fieldValue)) {\n options.unshift({ value: fieldValue });\n }\n return (\n <TextField\n key={field.name}\n select\n variant=\"standard\"\n fullWidth\n required={field.required}\n label={I18n.t(field.label)}\n value={fieldValue}\n slotProps={{ inputLabel: { shrink: true } }}\n onChange={e =>\n this.setState({\n addFields: {\n ...(this.state.addFields || {}),\n [field.name]: e.target.value,\n },\n addError: '',\n })\n }\n >\n {options.map(option => (\n <MenuItem\n key={option.value}\n value={option.value}\n >\n {option.label || option.value}\n </MenuItem>\n ))}\n </TextField>\n );\n }\n return (\n <TextField\n key={field.name}\n variant=\"standard\"\n fullWidth\n type={field.type === 'password' ? 'password' : 'text'}\n required={field.required}\n label={I18n.t(field.label)}\n value={fieldValue}\n slotProps={{\n inputLabel: { shrink: true },\n htmlInput: { autoComplete: field.type === 'password' ? 'new-password' : 'off' },\n }}\n onChange={e =>\n this.setState({\n addFields: { ...(this.state.addFields || {}), [field.name]: e.target.value },\n addError: '',\n })\n }\n />\n );\n })}\n\n {this.state.addError ? <Alert severity=\"error\">{this.state.addError}</Alert> : null}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={!!this.state.addSaving || !(this.state.addName || '').trim()}\n startIcon={<CheckIcon />}\n onClick={() => this.createCredential()}\n >\n {I18n.t('jc_Create')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n disabled={!!this.state.addSaving}\n startIcon={<CloseIcon />}\n onClick={() => this.setState({ addOpen: false })}\n >\n {I18n.t('jc_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | null {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const item = this.state.selectOptions?.find(_item => _item.value === this.state.value);\n // The stored value could point to a meanwhile deleted credential\n const unknownValue =\n this.state.value && this.state.value !== ConfigGeneric.NONE_VALUE && !item ? this.state.value : null;\n // if at least one option has an icon, options without icon get a placeholder for alignment\n const anyIcon = this.state.selectOptions.some(option => !!option.icon);\n // creation can be suppressed per schema (`disableCreation`)\n const canCreate = !this.props.schema.disableCreation;\n\n return (\n <div style={{ display: 'flex', alignItems: 'flex-end', gap: 4, width: '100%' }}>\n <FormControl\n style={{ flex: 1, minWidth: 0 }}\n variant=\"standard\"\n >\n {this.props.schema.label ? (\n <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel>\n ) : null}\n <Select\n variant=\"standard\"\n error={!!error || !!unknownValue}\n displayEmpty\n disabled={!!disabled}\n value={this.state.value || ConfigGeneric.NONE_VALUE}\n renderValue={() =>\n unknownValue\n ? unknownValue\n : renderCredentialItem(\n item,\n this.getText(item?.label, this.props.schema.noTranslation !== false),\n anyIcon,\n )\n }\n onChange={e =>\n this.setState(\n { value: e.target.value === ConfigGeneric.NONE_VALUE ? '' : e.target.value },\n () => this.onChange(this.props.attr, this.state.value),\n )\n }\n >\n {this.state.selectOptions?.map(item_ => (\n <MenuItem\n key={item_.value}\n value={item_.value}\n style={item_.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}\n >\n {renderCredentialItem(\n item_,\n this.getText(item_.label, this.props.schema.noTranslation !== false),\n anyIcon,\n )}\n </MenuItem>\n ))}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n {canCreate ? (\n <IconButton\n size=\"small\"\n disabled={!!disabled}\n title={I18n.t('jc_Add credential')}\n onClick={() => this.openAddDialog()}\n >\n <AddIcon />\n </IconButton>\n ) : null}\n {this.renderAddDialog()}\n </div>\n );\n }\n}\n"]}
package/build/types.d.ts CHANGED
@@ -994,8 +994,8 @@ export interface ConfigItemCertificateSelect extends ConfigItem {
994
994
 
995
995
  export interface ConfigItemCredentialSelect extends ConfigItem {
996
996
  type: 'credential';
997
- /** Show only credentials of this type, e.g. 'email', 'cloud', 'ai' or 'custom'. If not defined, all credentials are listed. */
998
- credentialType?: 'email' | 'cloud' | 'ai' | 'custom';
997
+ /** Show only credentials of this type, e.g. 'email', 'cloud', 'ai', 'aws', 'azure' or 'custom'. If not defined, all credentials are listed. */
998
+ credentialType?: 'email' | 'cloud' | 'ai' | 'aws' | 'azure' | 'custom';
999
999
  /** Do not allow creation of credentials, just selection */
1000
1000
  disableCreation?: boolean;
1001
1001
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iobroker/json-config",
3
3
  "description": "This package contains the ioBroker JSON config UI components",
4
- "version": "8.4.13",
4
+ "version": "8.4.15",
5
5
  "author": {
6
6
  "name": "bluefox",
7
7
  "email": "dogafox@gmail.com"