@jskit-ai/connectors-web 0.1.64 → 0.2.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.
package/README.md CHANGED
@@ -10,6 +10,7 @@ by `@jskit-ai/connectors-core/shared/configuration`.
10
10
  integration-id="calendar"
11
11
  :provider="googleCalendarDefinition"
12
12
  :field-errors="fieldErrors"
13
+ :field-error-codes="fieldErrorCodes"
13
14
  :disabled="saving"
14
15
  :callback-url="resolvedCallbackUrl"
15
16
  />
@@ -22,7 +23,21 @@ preserve other integration slots, registrations and extension values.
22
23
 
23
24
  Provider `settingsFields` metadata supplies labelled select controls when `items`
24
25
  are provided and text controls otherwise, with optional hints and placeholders.
25
- A hint may be text or a function of the current settings.
26
+ A hint may be text or a function of the current settings; the function also
27
+ receives `{ formatDate }`, so a date it shows follows the active locale.
28
+
29
+ The component's own texts come from `locales/en.json`
30
+ (`jskit.connectors.configurationFields.*`) through `useJskitText()`. Provider
31
+ texts (labels, hints, placeholders, item titles and subtitles, permission and
32
+ assistant action labels, authentication labels and hints) are rendered with
33
+ `text()`: a message key such as the JSKIT catalog's
34
+ `jskit.connectors.<integration>.fields.<field>.label` or `{ key, params }` is
35
+ translated, and plain text from another catalog renders as written. The app
36
+ must register the catalog's English; the generated JSKIT bootstrap does that for
37
+ every installed package's `locales/en.json`, and the browser fixture registers
38
+ the catalog's English itself. Pass `fieldErrorCodes` with `fieldErrors`, from an
39
+ `IntegrationConfigurationError`, so coded field errors can be translated through
40
+ `fieldErrorMessages()`.
26
41
  Defaults and applicable fields come from
27
42
  `getProviderSettingsSchema(provider, settings).getFieldDefinitions()`, which also
28
43
  supports schemas containing custom validators. A provider may select a schema
@@ -0,0 +1,85 @@
1
+ {
2
+ "jskit": {
3
+ "connectors": {
4
+ "configurationFields": {
5
+ "accountMode": {
6
+ "label": "Account used by the application"
7
+ },
8
+ "accountModes": {
9
+ "assistant": "Assistant access",
10
+ "perUser": "Each app user's own account",
11
+ "shared": "One shared account"
12
+ },
13
+ "apiKeyReference": {
14
+ "hint": "Store the API key in your environment or secret store. Enter its reference here, such as env:SERVICE_API_KEY.",
15
+ "label": "API key reference"
16
+ },
17
+ "ariaLabel": "{provider} configuration",
18
+ "assistant": {
19
+ "defaultPermission": {
20
+ "hint": "Changing this sets every assistant action below to the same choice.",
21
+ "label": "Manage all permissions"
22
+ },
23
+ "enabled": {
24
+ "label": "Allow assistant access"
25
+ },
26
+ "hint": "These choices control assistant actions for this integration. They do not grant access to the provider or replace your application's permissions."
27
+ },
28
+ "assistantPermissions": {
29
+ "always": "Always allow",
30
+ "ask": "Ask each time",
31
+ "never": "Never allow"
32
+ },
33
+ "authentication": {
34
+ "label": "Authentication"
35
+ },
36
+ "authenticationMethods": {
37
+ "apiKey": "API key",
38
+ "none": "No credentials",
39
+ "oauth2": "OAuth",
40
+ "serviceAccount": "Service account"
41
+ },
42
+ "callbackUrl": {
43
+ "label": "Callback URL"
44
+ },
45
+ "callbackUrlReference": {
46
+ "hint": "Reference the callback route implemented by your application and registered with the provider.",
47
+ "label": "Callback URL reference"
48
+ },
49
+ "clientId": {
50
+ "label": "Client ID"
51
+ },
52
+ "clientSecretReference": {
53
+ "hint": "Use an environment reference such as env:{prefix}_CLIENT_SECRET. Keep the value outside this file.",
54
+ "label": "Client secret reference"
55
+ },
56
+ "displayName": {
57
+ "label": "Display name"
58
+ },
59
+ "grantType": {
60
+ "label": "OAuth flow"
61
+ },
62
+ "grantTypes": {
63
+ "authorizationCode": "User consent",
64
+ "clientCredentials": "Service account"
65
+ },
66
+ "panels": {
67
+ "assistant": "Assistant permissions",
68
+ "credentials": "Credentials",
69
+ "details": "Details",
70
+ "permissions": "Permissions"
71
+ },
72
+ "permissions": {
73
+ "hint": "Choose what the application needs. The account owner approves these permissions when connecting."
74
+ },
75
+ "registration": {
76
+ "label": "App registration"
77
+ },
78
+ "serviceAccountReference": {
79
+ "hint": "Store the service credential in your environment or secret store and enter its reference here.",
80
+ "label": "Service-account credential reference"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@jskit-ai/connectors-web",
3
- "version": "0.1.64",
3
+ "version": "0.2.0",
4
4
  "description": "Shared Vue fields for portable application integration configuration.",
5
5
  "type": "module",
6
6
  "files": [
7
- "src"
7
+ "src",
8
+ "locales"
8
9
  ],
9
10
  "exports": {
10
- "./client": "./src/client/index.js"
11
+ "./client": "./src/client/index.js",
12
+ "./locales/en.json": "./locales/en.json"
11
13
  },
12
14
  "dependencies": {
13
- "@jskit-ai/connectors-core": "0.1.64"
15
+ "@jskit-ai/connectors-core": "0.2.0"
14
16
  },
15
17
  "peerDependencies": {
18
+ "@jskit-ai/kernel": "0.2.0",
16
19
  "vue": "^3.5.13",
17
20
  "vuetify": "^4.0.0"
18
21
  },
@@ -1,47 +1,67 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
- import { DEFAULT_GRANT_TYPE, DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD, getProviderAccountModes, getProviderAuthenticationMethods, getProviderClientAuthenticationMethods, getProviderScopes, getProviderSettingsSchema, providerGrantTypes, registrationClientAuthentication, registrationGrantType } from "@jskit-ai/connectors-core/shared/configuration";
3
+ import { DEFAULT_GRANT_TYPE, DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD, MESSAGE_KEY_SOURCE, getProviderAccountModes, getProviderAuthenticationMethods, getProviderClientAuthenticationMethods, getProviderScopes, getProviderSettingsSchema, providerGrantTypes, registrationClientAuthentication, registrationGrantType } from "@jskit-ai/connectors-core/shared/configuration";
4
+ import { useJskitText } from "./i18n.js";
4
5
 
5
6
  const props = defineProps({
6
7
  modelValue: { type: Object, required: true },
7
8
  integrationId: { type: String, required: true },
8
9
  provider: { type: Object, required: true },
9
10
  fieldErrors: { type: Object, default: () => ({}) },
11
+ // The coded form of fieldErrors (IntegrationConfigurationError.fieldErrorCodes), so they can be translated.
12
+ fieldErrorCodes: { type: Object, default: () => ({}) },
10
13
  disabled: Boolean,
11
14
  callbackUrl: { type: String, default: "" }
12
15
  });
13
16
  const emit = defineEmits(["update:modelValue"]);
17
+ // Provider texts may be message keys (the JSKIT catalog) or plain text (other catalogs); text() renders both.
18
+ // The catalog's public definitions are English; each keeps its keyed original under MESSAGE_KEY_SOURCE.
19
+ const jskitText = useJskitText();
20
+ const { t, text, formatDate, fieldErrorMessages } = jskitText;
21
+ const definition = computed(() => props.provider[MESSAGE_KEY_SOURCE] || props.provider);
22
+ const errors = computed(() => fieldErrorMessages({ fieldErrors: props.fieldErrors, fieldErrorCodes: props.fieldErrorCodes }));
14
23
  const panels = ref(["details", "credentials"]);
15
24
  const integration = computed(() => props.modelValue.integrations[props.integrationId]);
16
25
  const registrationId = computed(() => integration.value?.authentication.registrationRef);
17
26
  const registration = computed(() => props.modelValue.registrations[registrationId.value]);
18
27
  const grantType = computed(() => registrationGrantType(registration.value));
19
- const grantOptions = computed(() => providerGrantTypes(props.provider).map((value) => ({
20
- value, title: { authorization_code: "User consent", client_credentials: "Service account" }[value] || value
28
+ const grantTitles = { authorization_code: "jskit.connectors.configurationFields.grantTypes.authorizationCode", client_credentials: "jskit.connectors.configurationFields.grantTypes.clientCredentials" };
29
+ const grantOptions = computed(() => providerGrantTypes(definition.value).map((value) => ({
30
+ value, title: grantTitles[value] ? t(grantTitles[value]) : value
21
31
  })));
22
- const modes = computed(() => getProviderAccountModes(props.provider, integration.value.settings || {}).filter((mode) =>
32
+ const modeTitles = { shared: "jskit.connectors.configurationFields.accountModes.shared", "per-user": "jskit.connectors.configurationFields.accountModes.perUser", assistant: "jskit.connectors.configurationFields.accountModes.assistant" };
33
+ const modes = computed(() => getProviderAccountModes(definition.value, integration.value.settings || {}).filter((mode) =>
23
34
  integration.value?.authentication.method !== "oauth2" || grantType.value !== "client_credentials" || mode !== "per-user"
24
35
  ).map((value) => ({
25
36
  value,
26
- title: { shared: "One shared account", "per-user": "Each app user's own account", assistant: "Assistant access" }[value] || value
37
+ title: modeTitles[value] ? t(modeTitles[value]) : value
27
38
  })));
28
39
  const registrationOptions = computed(() => Object.keys(props.modelValue.registrations));
29
40
  const integrationPath = computed(() => `integrations.${props.integrationId}`);
30
41
  const registrationPath = computed(() => `registrations.${registrationId.value}`);
31
- const settingProperties = computed(() => getProviderSettingsSchema(props.provider, integration.value?.settings)?.getFieldDefinitions() || {});
32
- const authenticationOptions = computed(() => getProviderAuthenticationMethods(props.provider, integration.value.settings).map((value) => ({
33
- value, title: props.provider.authenticationLabels?.[value] || { "api-key": "API key", "service-account": "Service account", oauth2: "OAuth", none: "No credentials" }[value] || value
42
+ const settingProperties = computed(() => getProviderSettingsSchema(definition.value, integration.value?.settings)?.getFieldDefinitions() || {});
43
+ const methodTitles = { "api-key": "jskit.connectors.configurationFields.authenticationMethods.apiKey", "service-account": "jskit.connectors.configurationFields.authenticationMethods.serviceAccount",
44
+ oauth2: "jskit.connectors.configurationFields.authenticationMethods.oauth2", none: "jskit.connectors.configurationFields.authenticationMethods.none" };
45
+ const authenticationOptions = computed(() => getProviderAuthenticationMethods(definition.value, integration.value.settings).map((value) => ({
46
+ value, title: text(definition.value.authenticationLabels?.[value]) || (methodTitles[value] ? t(methodTitles[value]) : value)
34
47
  })));
35
- const visibleSettings = computed(() => (props.provider.settingsFields || []).filter((field) =>
48
+ const visibleSettings = computed(() => (definition.value.settingsFields || []).filter((field) =>
36
49
  Object.hasOwn(settingProperties.value, field.name) &&
37
50
  (!field.authenticationMethods || field.authenticationMethods.includes(integration.value.authentication.method))
38
51
  ));
39
- const visibleScopes = computed(() => getProviderScopes(props.provider, integration.value.settings || {}, grantType.value, integration.value.authentication.method));
52
+ const visibleScopes = computed(() => getProviderScopes(definition.value, integration.value.settings || {}, grantType.value, integration.value.authentication.method));
40
53
  const clientSecretHint = computed(() =>
41
- `Use an environment reference such as env:${environmentPrefix(registrationId.value || props.integrationId)}_CLIENT_SECRET. Keep the value outside this file.`);
42
- const assistantPermissions = [
43
- { value: "ask", title: "Ask each time" }, { value: "always", title: "Always allow" }, { value: "never", title: "Never allow" }
44
- ];
54
+ t("jskit.connectors.configurationFields.clientSecretReference.hint", { prefix: environmentPrefix(registrationId.value || props.integrationId) }));
55
+ const assistantPermissions = computed(() => [
56
+ { value: "ask", title: t("jskit.connectors.configurationFields.assistantPermissions.ask") },
57
+ { value: "always", title: t("jskit.connectors.configurationFields.assistantPermissions.always") },
58
+ { value: "never", title: t("jskit.connectors.configurationFields.assistantPermissions.never") }
59
+ ]);
60
+ const credentialReference = computed(() => integration.value?.authentication.method === "service-account"
61
+ ? { label: text(definition.value.serviceAccountReferenceLabel) || t("jskit.connectors.configurationFields.serviceAccountReference.label"),
62
+ hint: text(definition.value.serviceAccountReferenceHint) || t("jskit.connectors.configurationFields.serviceAccountReference.hint") }
63
+ : { label: text(definition.value.apiKeyReferenceLabel) || t("jskit.connectors.configurationFields.apiKeyReference.label"),
64
+ hint: text(definition.value.apiKeyReferenceHint) || t("jskit.connectors.configurationFields.apiKeyReference.hint") });
45
65
 
46
66
  // The environment-variable prefix editAuthentication uses for a new registration's references.
47
67
  function environmentPrefix(id) {
@@ -51,19 +71,28 @@ function environmentPrefix(id) {
51
71
  // A service account cannot connect as each app user; fall back to a mode these settings allow.
52
72
  function accountModeForGrant(grant, settings, accountMode) {
53
73
  return grant === "client_credentials" && accountMode === "per-user"
54
- ? getProviderAccountModes(props.provider, settings || {}).find((mode) => mode !== "per-user") : accountMode;
74
+ ? getProviderAccountModes(definition.value, settings || {}).find((mode) => mode !== "per-user") : accountMode;
55
75
  }
56
76
 
57
77
  function settingValue(field) {
58
78
  return integration.value.settings?.[field.name] ?? settingProperties.value[field.name]?.defaultTo;
59
79
  }
60
80
 
81
+ // A hint function receives formatDate so dates it shows follow the app's language (none: its own English).
61
82
  function settingHint(field) {
62
- return typeof field.hint === "function" ? field.hint(integration.value.settings) : field.hint;
83
+ return text(typeof field.hint === "function" ? field.hint(integration.value.settings, jskitText.locale ? { formatDate } : {}) : field.hint);
84
+ }
85
+
86
+ function settingItems(field) {
87
+ return field.items?.map((item) => item && typeof item === "object" ? {
88
+ ...item,
89
+ ...(item.title !== undefined ? { title: text(item.title) } : {}),
90
+ ...(item.props?.subtitle !== undefined ? { props: { ...item.props, subtitle: text(item.props.subtitle) } } : {})
91
+ } : item);
63
92
  }
64
93
 
65
94
  function settingErrors(field) {
66
- return props.fieldErrors[`${integrationPath.value}.settings.${field.name}`];
95
+ return errors.value[`${integrationPath.value}.settings.${field.name}`];
67
96
  }
68
97
 
69
98
  function editAssistantPolicy(changes) {
@@ -92,19 +121,19 @@ function editSetting(field, value) {
92
121
  const settings = { ...integration.value.settings };
93
122
  if (value === undefined || value === "") delete settings[field];
94
123
  else settings[field] = value;
95
- if (typeof props.provider.settingsSchema === "function") {
96
- const fields = getProviderSettingsSchema(props.provider, settings).getFieldDefinitions();
124
+ if (typeof definition.value.settingsSchema === "function") {
125
+ const fields = getProviderSettingsSchema(definition.value, settings).getFieldDefinitions();
97
126
  for (const key of Object.keys(settings)) if (!Object.hasOwn(fields, key)) delete settings[key];
98
127
  }
99
- const available = getProviderScopes(props.provider, settings, grantType.value, integration.value.authentication.method);
128
+ const available = getProviderScopes(definition.value, settings, grantType.value, integration.value.authentication.method);
100
129
  const scopes = integration.value.scopes.filter((value) => available.some((scope) => scope.value === value));
101
130
  for (const scope of available) if (scope.required && !scopes.includes(scope.value)) scopes.push(scope.value);
102
- const methods = getProviderAuthenticationMethods(props.provider, settings);
103
- const credentialScope = props.provider.settingsFields?.find((item) => item.name === field)?.credentialScope;
131
+ const methods = getProviderAuthenticationMethods(definition.value, settings);
132
+ const credentialScope = definition.value.settingsFields?.find((item) => item.name === field)?.credentialScope;
104
133
  const changedProvider = credentialScope && credentialScope(value) !== credentialScope(integration.value.settings?.[field] ?? settingProperties.value[field]?.defaultTo);
105
134
  const authentication = changedProvider || !methods.includes(integration.value.authentication.method)
106
135
  ? { method: methods[0] } : integration.value.authentication;
107
- const accountModes = getProviderAccountModes(props.provider, settings);
136
+ const accountModes = getProviderAccountModes(definition.value, settings);
108
137
  const accountMode = accountModes.includes(integration.value.accountMode) ? integration.value.accountMode : accountModes[0];
109
138
  if (authentication.method === "oauth2" && !authentication.registrationRef) {
110
139
  editAuthentication("oauth2", { ...integration.value, settings, scopes, authentication, accountMode });
@@ -113,18 +142,18 @@ function editSetting(field, value) {
113
142
 
114
143
  function editAuthentication(method, current = integration.value) {
115
144
  const settings = { ...current.settings };
116
- for (const field of props.provider.settingsFields || []) {
145
+ for (const field of definition.value.settingsFields || []) {
117
146
  if (field.authenticationMethods && !field.authenticationMethods.includes(method)) delete settings[field.name];
118
147
  }
119
- const grant = method === "oauth2" ? props.provider.oauthGrantTypes?.[0] || DEFAULT_GRANT_TYPE : DEFAULT_GRANT_TYPE;
120
- const availableScopes = getProviderScopes(props.provider, settings, grant, method);
148
+ const grant = method === "oauth2" ? definition.value.oauthGrantTypes?.[0] || DEFAULT_GRANT_TYPE : DEFAULT_GRANT_TYPE;
149
+ const availableScopes = getProviderScopes(definition.value, settings, grant, method);
121
150
  const scopes = availableScopes.filter(scope => current.scopes.includes(scope.value) || scope.required || (scope.authenticationMethods && scope.recommended)).map(scope => scope.value);
122
151
  if (method === "oauth2") {
123
152
  let id = props.integrationId;
124
153
  let suffix = 2;
125
154
  while (Object.hasOwn(props.modelValue.registrations, id)) id = `${props.integrationId}-${suffix++}`;
126
155
  const prefix = environmentPrefix(id);
127
- const clientAuthentication = getProviderClientAuthenticationMethods(props.provider, grant, settings)[0];
156
+ const clientAuthentication = getProviderClientAuthenticationMethods(definition.value, grant, settings)[0];
128
157
  emit("update:modelValue", {
129
158
  ...props.modelValue,
130
159
  integrations: { ...props.modelValue.integrations, [props.integrationId]: {
@@ -146,7 +175,7 @@ function editAuthentication(method, current = integration.value) {
146
175
 
147
176
  function editSecretReference(value) {
148
177
  const authentication = { ...integration.value.authentication, secretRef: value };
149
- if (!value && props.provider.apiKeySecretOptional) delete authentication.secretRef;
178
+ if (!value && definition.value.apiKeySecretOptional) delete authentication.secretRef;
150
179
  editIntegration({ authentication });
151
180
  }
152
181
 
@@ -162,11 +191,11 @@ function editRegistration(field, value) {
162
191
 
163
192
  function editGrantType(value) {
164
193
  const nextRegistration = { ...registration.value, grantType: value };
165
- const methods = getProviderClientAuthenticationMethods(props.provider, value, integration.value.settings || {});
194
+ const methods = getProviderClientAuthenticationMethods(definition.value, value, integration.value.settings || {});
166
195
  if (!methods.includes(registrationClientAuthentication(nextRegistration))) nextRegistration.tokenEndpointAuthMethod = methods[0];
167
196
  if (nextRegistration.tokenEndpointAuthMethod === "none") delete nextRegistration.clientSecretRef;
168
197
  if (value === "client_credentials") delete nextRegistration.callbackUrlRef;
169
- const allowed = getProviderScopes(props.provider, integration.value.settings || {}, value, integration.value.authentication.method).map((scope) => scope.value);
198
+ const allowed = getProviderScopes(definition.value, integration.value.settings || {}, value, integration.value.authentication.method).map((scope) => scope.value);
170
199
  emit("update:modelValue", {
171
200
  ...props.modelValue,
172
201
  registrations: { ...props.modelValue.registrations, [registrationId.value]: nextRegistration },
@@ -180,50 +209,50 @@ function editGrantType(value) {
180
209
  </script>
181
210
 
182
211
  <template>
183
- <v-sheet v-if="integration" class="integration-fields" :aria-label="`${provider.name} configuration`">
212
+ <v-sheet v-if="integration" class="integration-fields" :aria-label="t('jskit.connectors.configurationFields.ariaLabel', { provider: definition.name })">
184
213
  <v-expansion-panels v-model="panels" multiple variant="accordion" :disabled="disabled">
185
- <v-expansion-panel value="details" title="Details">
214
+ <v-expansion-panel value="details" :title="t('jskit.connectors.configurationFields.panels.details')">
186
215
  <v-expansion-panel-text>
187
216
  <v-text-field
188
- label="Display name" :model-value="integration.displayName || ''" :disabled="disabled"
189
- :placeholder="provider.name" :error-messages="fieldErrors[`${integrationPath}.displayName`]"
217
+ :label="t('jskit.connectors.configurationFields.displayName.label')" :model-value="integration.displayName || ''" :disabled="disabled"
218
+ :placeholder="definition.name" :error-messages="errors[`${integrationPath}.displayName`]"
190
219
  @update:model-value="editIntegration({ displayName: $event || undefined })"
191
220
  />
192
221
  <v-select
193
- label="Account used by the application" :items="modes" :model-value="integration.accountMode" :disabled="disabled"
194
- :error-messages="fieldErrors[`${integrationPath}.accountMode`]"
222
+ :label="t('jskit.connectors.configurationFields.accountMode.label')" :items="modes" :model-value="integration.accountMode" :disabled="disabled"
223
+ :error-messages="errors[`${integrationPath}.accountMode`]"
195
224
  @update:model-value="editIntegration({ accountMode: $event })"
196
225
  />
197
226
  </v-expansion-panel-text>
198
227
  </v-expansion-panel>
199
228
 
200
- <v-expansion-panel value="credentials" title="Credentials">
229
+ <v-expansion-panel value="credentials" :title="t('jskit.connectors.configurationFields.panels.credentials')">
201
230
  <v-expansion-panel-text>
202
231
  <v-select
203
232
  v-if="authenticationOptions.length > 1"
204
- label="Authentication" :items="authenticationOptions" :model-value="integration.authentication.method" :disabled="disabled"
205
- :hint="provider.authenticationHint" :persistent-hint="Boolean(provider.authenticationHint)"
206
- :error-messages="fieldErrors[`${integrationPath}.authentication.method`]"
233
+ :label="t('jskit.connectors.configurationFields.authentication.label')" :items="authenticationOptions" :model-value="integration.authentication.method" :disabled="disabled"
234
+ :hint="text(definition.authenticationHint)" :persistent-hint="Boolean(definition.authenticationHint)"
235
+ :error-messages="errors[`${integrationPath}.authentication.method`]"
207
236
  @update:model-value="editAuthentication"
208
237
  />
209
238
  <template v-for="field in visibleSettings" :key="field.name">
210
239
  <v-autocomplete
211
240
  v-if="field.searchable"
212
- :label="field.label" :items="field.items" :disabled="disabled" auto-select-first
241
+ :label="text(field.label)" :items="settingItems(field)" :disabled="disabled" auto-select-first
213
242
  :model-value="settingValue(field)"
214
243
  :hint="settingHint(field)" persistent-hint :error-messages="settingErrors(field)"
215
244
  @update:model-value="editSetting(field.name, $event)"
216
245
  />
217
246
  <v-select
218
247
  v-else-if="field.items"
219
- :label="field.label" :items="field.items" :disabled="disabled"
248
+ :label="text(field.label)" :items="settingItems(field)" :disabled="disabled"
220
249
  :model-value="settingValue(field)"
221
250
  :hint="settingHint(field)" persistent-hint :error-messages="settingErrors(field)"
222
251
  @update:model-value="editSetting(field.name, $event)"
223
252
  />
224
253
  <v-text-field
225
254
  v-else
226
- :label="field.label" :disabled="disabled" :placeholder="field.placeholder"
255
+ :label="text(field.label)" :disabled="disabled" :placeholder="text(field.placeholder)"
227
256
  :model-value="settingValue(field) ?? ''"
228
257
  :hint="settingHint(field)" persistent-hint :error-messages="settingErrors(field)"
229
258
  @update:model-value="editSetting(field.name, $event)"
@@ -232,86 +261,86 @@ function editGrantType(value) {
232
261
  <template v-if="['api-key', 'service-account'].includes(integration.authentication.method)">
233
262
  <slot name="credential" :reference="integration.authentication.secretRef" :disabled="disabled">
234
263
  <v-text-field
235
- :label="integration.authentication.method === 'service-account' ? provider.serviceAccountReferenceLabel || 'Service-account credential reference' : provider.apiKeyReferenceLabel || 'API key reference'" :model-value="integration.authentication.secretRef" :disabled="disabled"
236
- :hint="integration.authentication.method === 'service-account' ? provider.serviceAccountReferenceHint || 'Store the service credential in your environment or secret store and enter its reference here.' : provider.apiKeyReferenceHint || 'Store the API key in your environment or secret store. Enter its reference here, such as env:SERVICE_API_KEY.'"
237
- persistent-hint :error-messages="fieldErrors[`${integrationPath}.authentication.secretRef`]"
264
+ :label="credentialReference.label" :model-value="integration.authentication.secretRef" :disabled="disabled"
265
+ :hint="credentialReference.hint"
266
+ persistent-hint :error-messages="errors[`${integrationPath}.authentication.secretRef`]"
238
267
  @update:model-value="editSecretReference"
239
268
  />
240
269
  </slot>
241
270
  </template>
242
271
  <template v-else-if="integration.authentication.method === 'oauth2'">
243
272
  <v-select
244
- label="App registration" :items="registrationOptions" :model-value="registrationId" :disabled="disabled"
245
- :error-messages="fieldErrors[`${integrationPath}.authentication.registrationRef`]"
273
+ :label="t('jskit.connectors.configurationFields.registration.label')" :items="registrationOptions" :model-value="registrationId" :disabled="disabled"
274
+ :error-messages="errors[`${integrationPath}.authentication.registrationRef`]"
246
275
  @update:model-value="editIntegration({ authentication: { ...integration.authentication, registrationRef: $event } })"
247
276
  />
248
277
  <template v-if="registration?.source === 'own'">
249
278
  <v-select
250
279
  v-if="grantOptions.length > 1"
251
- label="OAuth flow" :items="grantOptions" :model-value="grantType" :disabled="disabled"
252
- :hint="provider.oauthGrantHint" :persistent-hint="Boolean(provider.oauthGrantHint)"
253
- :error-messages="fieldErrors[`${registrationPath}.grantType`]"
280
+ :label="t('jskit.connectors.configurationFields.grantType.label')" :items="grantOptions" :model-value="grantType" :disabled="disabled"
281
+ :hint="text(definition.oauthGrantHint)" :persistent-hint="Boolean(definition.oauthGrantHint)"
282
+ :error-messages="errors[`${registrationPath}.grantType`]"
254
283
  @update:model-value="editGrantType"
255
284
  />
256
285
  <v-text-field
257
- :label="provider.clientIdLabel || 'Client ID'" :hint="provider.clientIdHint" :persistent-hint="Boolean(provider.clientIdHint)" :model-value="registration.clientId" autocomplete="off" :disabled="disabled"
258
- :error-messages="fieldErrors[`${registrationPath}.clientId`]"
286
+ :label="text(definition.clientIdLabel) || t('jskit.connectors.configurationFields.clientId.label')" :hint="text(definition.clientIdHint)" :persistent-hint="Boolean(definition.clientIdHint)" :model-value="registration.clientId" autocomplete="off" :disabled="disabled"
287
+ :error-messages="errors[`${registrationPath}.clientId`]"
259
288
  @update:model-value="editRegistration('clientId', $event)"
260
289
  />
261
290
  <slot v-if="registration.tokenEndpointAuthMethod !== 'none'" name="credential" :reference="registration.clientSecretRef" :disabled="disabled">
262
291
  <v-text-field
263
- label="Client secret reference" :model-value="registration.clientSecretRef" :disabled="disabled"
292
+ :label="t('jskit.connectors.configurationFields.clientSecretReference.label')" :model-value="registration.clientSecretRef" :disabled="disabled"
264
293
  :hint="clientSecretHint"
265
- persistent-hint :error-messages="fieldErrors[`${registrationPath}.clientSecretRef`]"
294
+ persistent-hint :error-messages="errors[`${registrationPath}.clientSecretRef`]"
266
295
  @update:model-value="editRegistration('clientSecretRef', $event)"
267
296
  />
268
297
  </slot>
269
298
  <v-text-field
270
299
  v-if="grantType === 'authorization_code'"
271
- hint="Reference the callback route implemented by your application and registered with the provider." persistent-hint
272
- class="mt-4" label="Callback URL reference" :model-value="registration.callbackUrlRef" :disabled="disabled"
273
- :error-messages="fieldErrors[`${registrationPath}.callbackUrlRef`]"
300
+ :hint="t('jskit.connectors.configurationFields.callbackUrlReference.hint')" persistent-hint
301
+ class="mt-4" :label="t('jskit.connectors.configurationFields.callbackUrlReference.label')" :model-value="registration.callbackUrlRef" :disabled="disabled"
302
+ :error-messages="errors[`${registrationPath}.callbackUrlRef`]"
274
303
  @update:model-value="editRegistration('callbackUrlRef', $event)"
275
304
  />
276
- <v-text-field v-if="callbackUrl && grantType === 'authorization_code'" label="Callback URL" :model-value="callbackUrl" readonly />
305
+ <v-text-field v-if="callbackUrl && grantType === 'authorization_code'" :label="t('jskit.connectors.configurationFields.callbackUrl.label')" :model-value="callbackUrl" readonly />
277
306
  </template>
278
307
  </template>
279
308
  </v-expansion-panel-text>
280
309
  </v-expansion-panel>
281
310
 
282
- <v-expansion-panel v-if="visibleScopes.length && (provider.scopes.length || provider.permissionsHint || ['oauth2', 'service-account'].includes(integration.authentication.method))" value="permissions" title="Permissions">
311
+ <v-expansion-panel v-if="visibleScopes.length && (definition.scopes.length || definition.permissionsHint || ['oauth2', 'service-account'].includes(integration.authentication.method))" value="permissions" :title="t('jskit.connectors.configurationFields.panels.permissions')">
283
312
  <v-expansion-panel-text>
284
- <p class="text-body-medium mb-3">{{ provider.permissionsHint || 'Choose what the application needs. The account owner approves these permissions when connecting.' }}</p>
313
+ <p class="text-body-medium mb-3">{{ text(definition.permissionsHint) || t('jskit.connectors.configurationFields.permissions.hint') }}</p>
285
314
  <v-checkbox
286
315
  v-for="permission in visibleScopes" :key="permission.value"
287
- :label="permission.label" :value="permission.value" :model-value="integration.scopes" :disabled="disabled || permission.required"
316
+ :label="text(permission.label)" :value="permission.value" :model-value="integration.scopes" :disabled="disabled || permission.required"
288
317
  hide-details @update:model-value="editIntegration({ scopes: $event })"
289
318
  />
290
- <p v-if="fieldErrors[`${integrationPath}.scopes`]" role="alert" class="text-error text-body-small mt-2">
291
- {{ fieldErrors[`${integrationPath}.scopes`] }}
319
+ <p v-if="errors[`${integrationPath}.scopes`]" role="alert" class="text-error text-body-small mt-2">
320
+ {{ errors[`${integrationPath}.scopes`] }}
292
321
  </p>
293
322
  </v-expansion-panel-text>
294
323
  </v-expansion-panel>
295
- <v-expansion-panel v-if="provider.assistantActions?.length" value="assistant" title="Assistant permissions">
324
+ <v-expansion-panel v-if="definition.assistantActions?.length" value="assistant" :title="t('jskit.connectors.configurationFields.panels.assistant')">
296
325
  <v-expansion-panel-text>
297
- <p class="text-body-medium mb-3">These choices control assistant actions for this integration. They do not grant access to the provider or replace your application's permissions.</p>
326
+ <p class="text-body-medium mb-3">{{ t('jskit.connectors.configurationFields.assistant.hint') }}</p>
298
327
  <v-switch
299
- label="Allow assistant access" :model-value="integration.assistantPolicy?.enabled ?? true" :disabled="disabled"
300
- :error-messages="fieldErrors[`${integrationPath}.assistantPolicy.enabled`]"
328
+ :label="t('jskit.connectors.configurationFields.assistant.enabled.label')" :model-value="integration.assistantPolicy?.enabled ?? true" :disabled="disabled"
329
+ :error-messages="errors[`${integrationPath}.assistantPolicy.enabled`]"
301
330
  @update:model-value="editAssistantPolicy({ enabled: $event })"
302
331
  />
303
332
  <v-select
304
- label="Manage all permissions" :items="assistantPermissions" :model-value="integration.assistantPolicy?.defaultPermission || 'ask'"
333
+ :label="t('jskit.connectors.configurationFields.assistant.defaultPermission.label')" :items="assistantPermissions" :model-value="integration.assistantPolicy?.defaultPermission || 'ask'"
305
334
  :disabled="disabled || integration.assistantPolicy?.enabled === false"
306
- hint="Changing this sets every assistant action below to the same choice." persistent-hint
307
- :error-messages="fieldErrors[`${integrationPath}.assistantPolicy.defaultPermission`]"
335
+ :hint="t('jskit.connectors.configurationFields.assistant.defaultPermission.hint')" persistent-hint
336
+ :error-messages="errors[`${integrationPath}.assistantPolicy.defaultPermission`]"
308
337
  @update:model-value="editAssistantPolicy({ defaultPermission: $event, actions: {} })"
309
338
  />
310
339
  <v-select
311
- v-for="action in provider.assistantActions" :key="action.value" :label="action.label" :items="assistantPermissions"
340
+ v-for="action in definition.assistantActions" :key="action.value" :label="text(action.label)" :items="assistantPermissions"
312
341
  :model-value="integration.assistantPolicy?.actions?.[action.value] || integration.assistantPolicy?.defaultPermission || 'ask'"
313
342
  :disabled="disabled || integration.assistantPolicy?.enabled === false"
314
- :error-messages="fieldErrors[`${integrationPath}.assistantPolicy.actions.${action.value}`]"
343
+ :error-messages="errors[`${integrationPath}.assistantPolicy.actions.${action.value}`]"
315
344
  @update:model-value="editAssistantPolicy({ actions: { ...integration.assistantPolicy?.actions, [action.value]: $event } })"
316
345
  />
317
346
  </v-expansion-panel-text>
@@ -0,0 +1,6 @@
1
+ import { registerJskitMessages, useJskitText } from "@jskit-ai/kernel/client";
2
+ import en from "../../locales/en.json" with { type: "json" };
3
+
4
+ registerJskitMessages(en);
5
+
6
+ export { useJskitText };