@kong-ui-public/entities-consumers 3.7.0 → 3.7.1

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.
@@ -1,9 +1,9 @@
1
- import { defineComponent as ue, ref as k, computed as w, watch as ve, resolveComponent as N, openBlock as D, createBlock as se, unref as o, withCtx as l, createElementVNode as _, toDisplayString as C, createVNode as c, createElementBlock as L, createCommentVNode as z, Fragment as je, renderList as Le, onBeforeMount as He, createSlots as Ee, Teleport as Je, createTextVNode as re, reactive as Se } from "vue";
2
- import { useRouter as Ae } from "vue-router";
3
- import { BookIcon as Qe, AddIcon as ze, TeamIcon as We } from "@kong/icons";
4
- import { createI18n as Ye, i18nTComponent as Xe } from "@kong-ui-public/i18n";
5
- import { useAxios as ye, useDebouncedFilter as Ze, useTableState as et, useFetcher as tt, useDeleteUrlBuilder as ot, FetcherStatus as st, EntityBaseTable as nt, EntityFilter as rt, PermissionsWrapper as ie, TableTags as at, EntityEmptyState as it, EntityDeleteModal as lt, EntityTypes as ut, useErrors as ct, EntityBaseFormType as Me, EntityBaseForm as dt, SupportedEntityType as De, EntityFormSection as mt, ConfigurationSchemaSection as Ge, EntityBaseConfigCard as pt } from "@kong-ui-public/entities-shared";
6
- const ft = "#00abd2", gt = "24px", vt = {
1
+ import { defineComponent as ce, ref as I, computed as w, watch as ye, resolveComponent as O, openBlock as x, createBlock as z, unref as o, withCtx as l, createElementVNode as _, toDisplayString as C, createVNode as c, createElementBlock as H, createCommentVNode as W, Fragment as Je, renderList as Qe, onBeforeMount as ze, createSlots as Se, Teleport as Me, createTextVNode as re, reactive as Ge } from "vue";
2
+ import { useRouter as Re } from "vue-router";
3
+ import { BookIcon as xe, AddIcon as We, TeamIcon as Ye } from "@kong/icons";
4
+ import { createI18n as Xe, i18nTComponent as Ze } from "@kong-ui-public/i18n";
5
+ import { useAxios as he, useDebouncedFilter as et, useTableState as tt, useFetcher as ot, useDeleteUrlBuilder as st, FetcherStatus as nt, EntityBaseTable as rt, EntityFilter as at, PermissionsWrapper as le, TableTags as it, EntityEmptyState as lt, EntityDeleteModal as ut, EntityTypes as ct, useErrors as dt, EntityBaseFormType as Ae, EntityBaseForm as mt, SupportedEntityType as Te, EntityFormSection as pt, ConfigurationSchemaSection as De, EntityBaseConfigCard as ft } from "@kong-ui-public/entities-shared";
6
+ const gt = "#00abd2", vt = "24px", yt = {
7
7
  list: {
8
8
  table_headers: {
9
9
  username: "Username",
@@ -102,20 +102,20 @@ const ft = "#00abd2", gt = "24px", vt = {
102
102
  tooltip: "An optional set of strings associated with the Consumer for grouping and filtering."
103
103
  }
104
104
  }
105
- }, yt = {
106
- consumers: vt
105
+ }, ht = {
106
+ consumers: yt
107
107
  };
108
- function ht() {
109
- const e = Ye("en-us", yt);
108
+ function bt() {
109
+ const e = Xe("en-us", ht);
110
110
  return {
111
111
  i18n: e,
112
- i18nT: Xe(e)
112
+ i18nT: Ze(e)
113
113
  // Translation component <i18n-t>
114
114
  };
115
115
  }
116
- const ce = {
117
- useI18n: ht
118
- }, te = "/v2/control-planes/{controlPlaneId}/core-entities", oe = "/{workspace}", W = {
116
+ const de = {
117
+ useI18n: bt
118
+ }, te = "/v2/control-planes/{controlPlaneId}/core-entities", oe = "/{workspace}", Y = {
119
119
  list: {
120
120
  konnect: {
121
121
  all: `${te}/consumers`,
@@ -140,13 +140,13 @@ const ce = {
140
140
  edit: `${oe}/consumers/{id}`
141
141
  }
142
142
  }
143
- }, bt = { class: "add-consumer-form-container" }, Ct = { class: "add-consumer-form-cta" }, _t = { class: "select-item-label" }, kt = {
143
+ }, Ct = { class: "add-consumer-form-container" }, _t = { class: "add-consumer-form-cta" }, kt = { class: "select-item-label" }, It = {
144
144
  key: 0,
145
145
  class: "select-item-desc"
146
- }, It = {
146
+ }, wt = {
147
147
  key: 0,
148
148
  class: "kong-ui-entity-add-consumers-error"
149
- }, wt = { key: 0 }, $t = /* @__PURE__ */ ue({
149
+ }, $t = { key: 0 }, Et = /* @__PURE__ */ ce({
150
150
  __name: "AddConsumerModal",
151
151
  props: {
152
152
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -163,135 +163,135 @@ const ce = {
163
163
  },
164
164
  emits: ["cancel", "add:success", "add:partial-success", "error"],
165
165
  setup(e, { emit: m }) {
166
- var v;
167
- const { i18n: { t: r } } = ce.useI18n(), t = e, x = m, { axiosInstance: n } = ye((v = t.config) == null ? void 0 : v.axiosRequestConfig), $ = k([]), {
166
+ var h;
167
+ const { i18n: { t: a } } = de.useI18n(), t = e, A = m, { axiosInstance: n } = he((h = t.config) == null ? void 0 : h.axiosRequestConfig), E = I([]), {
168
168
  debouncedQueryChange: G,
169
- loading: T,
170
- allRecords: B,
169
+ loading: V,
170
+ allRecords: P,
171
171
  error: p,
172
- loadItems: Y,
173
- results: H
174
- } = Ze(
172
+ loadItems: X,
173
+ results: J
174
+ } = et(
175
175
  t.config,
176
- W.list[t.config.app].all,
176
+ Y.list[t.config.app].all,
177
177
  "",
178
178
  {
179
179
  fetchedItemsKey: "data",
180
180
  searchKeys: ["username", "id"]
181
181
  }
182
- ), O = (u) => u, F = w(() => p.value ? r("consumers.errors.general") : ""), ne = k(0), J = w(() => B.value === void 0), Q = w(() => H.value.map((u) => ({
182
+ ), N = (u) => u, U = w(() => p.value ? a("consumers.errors.general") : ""), se = I(0), j = w(() => P.value === void 0), Q = w(() => J.value.map((u) => ({
183
183
  label: u.username || u.customId,
184
184
  value: u.id,
185
- selected: $.value.includes(u.id),
185
+ selected: E.value.includes(u.id),
186
186
  data: u
187
187
  // we need this to determine whether or not to show the description text
188
188
  }))), K = (u) => {
189
- var y;
190
- const b = J.value ? H.value.find((E) => E.id === u) : (y = B.value) == null ? void 0 : y.find((E) => E.id === u);
189
+ var v;
190
+ const b = j.value ? J.value.find((S) => S.id === u) : (v = P.value) == null ? void 0 : v.find((S) => S.id === u);
191
191
  return b ? b.username || b.custom_id : u;
192
- }, A = () => {
193
- U.value = "", P.value = [], g.value = [], x("cancel");
194
- }, P = k([]), V = k(!1), U = k(""), X = async () => {
195
- if (!$.value.length) {
196
- U.value = "", g.value = [], x("cancel");
192
+ }, ne = () => {
193
+ R.value = "", k.value = [], g.value = [], A("cancel");
194
+ }, k = I([]), D = I(!1), R = I(""), Z = async () => {
195
+ if (!E.value.length) {
196
+ R.value = "", g.value = [], A("cancel");
197
197
  return;
198
198
  }
199
- V.value = !0, U.value = "", P.value = [], g.value = [];
199
+ D.value = !0, R.value = "", k.value = [], g.value = [];
200
200
  try {
201
- const u = $.value.map((E) => i(E)), b = await Promise.allSettled(u);
202
- let y = !0;
203
- b.forEach((E) => {
204
- E.status !== "fulfilled" && (y = !1);
205
- }), y ? (P.value = [], g.value = [], x("add:success", $.value), $.value = []) : (P.value.length && x("add:partial-success", P.value), $.value = [], R(b));
201
+ const u = E.value.map((S) => r(S)), b = await Promise.allSettled(u);
202
+ let v = !0;
203
+ b.forEach((S) => {
204
+ S.status !== "fulfilled" && (v = !1);
205
+ }), v ? (k.value = [], g.value = [], A("add:success", E.value), E.value = []) : (k.value.length && A("add:partial-success", k.value), E.value = [], T(b));
206
206
  } catch {
207
- U.value = r("consumers.errors.add"), x("error", U.value);
207
+ R.value = a("consumers.errors.add"), A("error", R.value);
208
208
  } finally {
209
- V.value = !1;
209
+ D.value = !1;
210
210
  }
211
- }, a = w(() => {
212
- var b, y, E, Z;
213
- let u = `${t.config.apiBaseUrl}${W.list[t.config.app].forConsumerGroup}`;
214
- return t.config.app === "konnect" ? u = u.replace(/{controlPlaneId}/gi, ((b = t.config) == null ? void 0 : b.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((y = t.config) == null ? void 0 : y.consumerGroupId) || "") : t.config.app === "kongManager" && (u = u.replace(/\/{workspace}/gi, (E = t.config) != null && E.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((Z = t.config) == null ? void 0 : Z.consumerGroupId) || "")), u;
215
- }), i = async (u) => {
211
+ }, i = w(() => {
212
+ var b, v, S, ee;
213
+ let u = `${t.config.apiBaseUrl}${Y.list[t.config.app].forConsumerGroup}`;
214
+ return t.config.app === "konnect" ? u = u.replace(/{controlPlaneId}/gi, ((b = t.config) == null ? void 0 : b.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((v = t.config) == null ? void 0 : v.consumerGroupId) || "") : t.config.app === "kongManager" && (u = u.replace(/\/{workspace}/gi, (S = t.config) != null && S.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((ee = t.config) == null ? void 0 : ee.consumerGroupId) || "")), u;
215
+ }), r = async (u) => {
216
216
  const b = {
217
217
  consumer: u
218
218
  };
219
219
  try {
220
- const y = await n.post(a.value, b);
221
- return P.value.push(u), y;
222
- } catch (y) {
223
- let E = `${K(u)} - ${y.message}`;
224
- return y.response.status === 409 && (E = `${K(u)} - ${r("consumers.errors.already_added")}`), Promise.reject(Error(E));
220
+ const v = await n.post(i.value, b);
221
+ return k.value.push(u), v;
222
+ } catch (v) {
223
+ let S = `${K(u)} - ${v.message}`;
224
+ return v.response.status === 409 && (S = `${K(u)} - ${a("consumers.errors.already_added")}`), Promise.reject(Error(S));
225
225
  }
226
- }, g = k([]), R = (u) => {
226
+ }, g = I([]), T = (u) => {
227
227
  g.value = u.map((b) => {
228
- var y;
229
- return (y = b.reason) == null ? void 0 : y.message;
228
+ var v;
229
+ return (v = b.reason) == null ? void 0 : v.message;
230
230
  }).filter(Boolean);
231
231
  };
232
- return ve(Q, () => {
233
- ne.value++;
234
- }, { immediate: !0, deep: !0 }), ve(() => t.visible, () => {
235
- t.visible && Y();
232
+ return ye(Q, () => {
233
+ se.value++;
234
+ }, { immediate: !0, deep: !0 }), ye(() => t.visible, () => {
235
+ t.visible && X();
236
236
  }, { immediate: !0 }), (u, b) => {
237
- const y = N("KMultiselect"), E = N("KAlert"), Z = N("KPrompt");
238
- return D(), se(Z, {
239
- "action-button-disabled": V.value,
237
+ const v = O("KMultiselect"), S = O("KAlert"), ee = O("KPrompt");
238
+ return x(), z(ee, {
239
+ "action-button-disabled": D.value,
240
240
  class: "kong-ui-entities-add-consumers-modal",
241
241
  "data-testid": "add-consumer-modal",
242
- title: o(r)("consumers.consumer_groups.add.title"),
242
+ title: o(a)("consumers.consumer_groups.add.title"),
243
243
  visible: e.visible,
244
- onCancel: A,
245
- onProceed: X
244
+ onCancel: ne,
245
+ onProceed: Z
246
246
  }, {
247
247
  default: l(() => [
248
- _("div", bt, [
249
- _("p", Ct, C(o(r)("consumers.consumer_groups.add.ctaText")), 1),
250
- c(y, {
251
- modelValue: $.value,
252
- "onUpdate:modelValue": b[0] || (b[0] = (S) => $.value = S),
248
+ _("div", Ct, [
249
+ _("p", _t, C(o(a)("consumers.consumer_groups.add.ctaText")), 1),
250
+ c(v, {
251
+ modelValue: E.value,
252
+ "onUpdate:modelValue": b[0] || (b[0] = (F) => E.value = F),
253
253
  autosuggest: "",
254
254
  "data-testid": "add-consumers-multiselect",
255
- "dropdown-footer-text": J.value ? o(r)("consumers.consumer_groups.add.footer") : void 0,
255
+ "dropdown-footer-text": j.value ? o(a)("consumers.consumer_groups.add.footer") : void 0,
256
256
  items: Q.value,
257
- label: o(r)("consumers.consumer_groups.add.consumers_label"),
258
- loading: o(T),
259
- placeholder: o(r)("consumers.consumer_groups.add.consumer_placeholder"),
260
- readonly: V.value,
257
+ label: o(a)("consumers.consumer_groups.add.consumers_label"),
258
+ loading: o(V),
259
+ placeholder: o(a)("consumers.consumer_groups.add.consumer_placeholder"),
260
+ readonly: D.value,
261
261
  required: "",
262
262
  width: "100%",
263
263
  onQueryChange: o(G)
264
264
  }, {
265
- "item-template": l(({ item: S }) => [
266
- _("div", _t, C(S.label), 1),
267
- O(S).data.username && O(S).data.custom_id ? (D(), L("div", kt, C(O(S).data.custom_id), 1)) : z("", !0)
265
+ "item-template": l(({ item: F }) => [
266
+ _("div", kt, C(F.label), 1),
267
+ N(F).data.username && N(F).data.custom_id ? (x(), H("div", It, C(N(F).data.custom_id), 1)) : W("", !0)
268
268
  ]),
269
269
  _: 1
270
270
  }, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
271
- U.value || F.value || g.value.length ? (D(), L("div", It, [
272
- c(E, { appearance: "danger" }, {
271
+ R.value || U.value || g.value.length ? (x(), H("div", wt, [
272
+ c(S, { appearance: "danger" }, {
273
273
  default: l(() => [
274
- _("p", null, C(o(r)("consumers.errors.add")), 1),
275
- g.value.length ? (D(), L("ul", wt, [
276
- (D(!0), L(je, null, Le(g.value, (S, ee) => (D(), L("li", { key: ee }, C(S), 1))), 128))
277
- ])) : z("", !0),
278
- _("div", null, C(U.value || F.value), 1)
274
+ _("p", null, C(o(a)("consumers.errors.add")), 1),
275
+ g.value.length ? (x(), H("ul", $t, [
276
+ (x(!0), H(Je, null, Qe(g.value, (F, B) => (x(), H("li", { key: B }, C(F), 1))), 128))
277
+ ])) : W("", !0),
278
+ _("div", null, C(R.value || U.value), 1)
279
279
  ]),
280
280
  _: 1
281
281
  })
282
- ])) : z("", !0)
282
+ ])) : W("", !0)
283
283
  ])
284
284
  ]),
285
285
  _: 1
286
286
  }, 8, ["action-button-disabled", "title", "visible"]);
287
287
  };
288
288
  }
289
- }), he = (e, m) => {
290
- const r = e.__vccOpts || e;
291
- for (const [t, x] of m)
292
- r[t] = x;
293
- return r;
294
- }, Et = /* @__PURE__ */ he($t, [["__scopeId", "data-v-d54468ab"]]), St = { class: "kong-ui-entities-consumers-list" }, Mt = { class: "button-row" }, Gt = { class: "empty-state-icon-gateway" }, xt = /* @__PURE__ */ ue({
289
+ }), be = (e, m) => {
290
+ const a = e.__vccOpts || e;
291
+ for (const [t, A] of m)
292
+ a[t] = A;
293
+ return a;
294
+ }, St = /* @__PURE__ */ be(Et, [["__scopeId", "data-v-d54468ab"]]), Mt = { class: "kong-ui-entities-consumers-list" }, Gt = { class: "button-row" }, xt = { class: "empty-state-icon-gateway" }, At = /* @__PURE__ */ ce({
295
295
  __name: "ConsumerList",
296
296
  props: {
297
297
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -345,21 +345,21 @@ const ce = {
345
345
  },
346
346
  emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
347
347
  setup(e, { emit: m }) {
348
- var $e;
349
- const r = m, t = e, { i18nT: x, i18n: { t: n } } = ce.useI18n(), $ = Ae(), { axiosInstance: G } = ye(($e = t.config) == null ? void 0 : $e.axiosRequestConfig), T = w(() => t.config.app !== "kongManager" || !!t.config.disableSorting), B = {
348
+ var Ee;
349
+ const a = m, t = e, { i18nT: A, i18n: { t: n } } = de.useI18n(), E = Re(), { axiosInstance: G } = he((Ee = t.config) == null ? void 0 : Ee.axiosRequestConfig), V = w(() => t.config.app !== "kongManager" || !!t.config.disableSorting), P = {
350
350
  // the Username column is non-hidable
351
351
  username: { label: n("consumers.list.table_headers.username"), searchable: !0, sortable: !0, hidable: !1 },
352
352
  custom_id: { label: n("consumers.list.table_headers.custom_id"), searchable: !0, sortable: !0 },
353
353
  tags: { label: n("consumers.list.table_headers.tags"), sortable: !1 }
354
- }, p = B, Y = (s) => ({
354
+ }, p = P, X = (s) => ({
355
355
  "data-testid": s.username ?? s.custom_id ?? s.id
356
- }), H = () => {
357
- t.config.consumerGroupId ? Ce() : $.push(t.config.createRoute);
358
- }, O = w(() => {
359
- var d, h, I, j;
360
- let s = `${t.config.apiBaseUrl}${W.list[t.config.app][A.value ? "forConsumerGroup" : "all"]}`;
361
- return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((h = t.config) == null ? void 0 : h.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (I = t.config) != null && I.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((j = t.config) == null ? void 0 : j.consumerGroupId) || "")), s;
362
- }), F = k(""), ne = w(() => {
356
+ }), J = () => {
357
+ t.config.consumerGroupId ? _e() : E.push(t.config.createRoute);
358
+ }, N = w(() => {
359
+ var d, y, $, L;
360
+ let s = `${t.config.apiBaseUrl}${Y.list[t.config.app][k.value ? "forConsumerGroup" : "all"]}`;
361
+ return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((y = t.config) == null ? void 0 : y.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, ($ = t.config) != null && $.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((L = t.config) == null ? void 0 : L.consumerGroupId) || "")), s;
362
+ }), U = I(""), se = w(() => {
363
363
  const s = t.config.app === "konnect" || t.config.isExactMatch;
364
364
  return s ? {
365
365
  isExactMatch: s,
@@ -367,159 +367,159 @@ const ce = {
367
367
  } : {
368
368
  isExactMatch: s,
369
369
  fields: {
370
- username: B.username,
371
- custom_id: B.custom_id
370
+ username: P.username,
371
+ custom_id: P.custom_id
372
372
  },
373
373
  schema: t.config.filterSchema
374
374
  };
375
- }), { hasRecords: J, handleStateChange: Q } = et(F), K = w(() => t.enableV2EmptyStates ? J.value && t.config.app === "konnect" : t.config.app === "konnect"), A = w(() => !!t.config.consumerGroupId), P = w(
376
- () => A.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
377
- ), V = w(() => A.value && !t.config.paginatedEndpoint ? "consumers" : void 0), {
378
- fetcher: U,
379
- fetcherState: X,
380
- fetcherCacheKey: a
381
- } = tt({ ...t.config, cacheIdentifier: t.cacheIdentifier }, O.value, V.value), i = () => {
382
- F.value = "";
383
- }, g = () => {
384
- a.value++;
385
- }, R = (s) => s ?? "-", v = k(null), u = (s, d) => {
386
- const h = s.id;
387
- if (!d(h)) {
388
- r("copy:error", {
375
+ }), { hasRecords: j, handleStateChange: Q } = tt(U), K = w(() => j.value && t.config.app === "konnect"), ne = w(() => !t.enableV2EmptyStates && t.config.app === "konnect"), k = w(() => !!t.config.consumerGroupId), D = w(
376
+ () => k.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
377
+ ), R = w(() => k.value && !t.config.paginatedEndpoint ? "consumers" : void 0), {
378
+ fetcher: Z,
379
+ fetcherState: i,
380
+ fetcherCacheKey: r
381
+ } = ot({ ...t.config, cacheIdentifier: t.cacheIdentifier }, N.value, R.value), g = () => {
382
+ U.value = "";
383
+ }, T = () => {
384
+ r.value++;
385
+ }, h = (s) => s ?? "-", u = I(null), b = (s, d) => {
386
+ const y = s.id;
387
+ if (!d(y)) {
388
+ a("copy:error", {
389
389
  entity: s,
390
390
  field: "id",
391
391
  message: n("consumers.errors.copy")
392
392
  });
393
393
  return;
394
394
  }
395
- r("copy:success", {
395
+ a("copy:success", {
396
396
  entity: s,
397
397
  field: "id",
398
- message: n("consumers.copy.success", { val: h })
398
+ message: n("consumers.copy.success", { val: y })
399
399
  });
400
- }, b = (s, d) => {
401
- const h = JSON.stringify(s);
402
- if (!d(h)) {
403
- r("copy:error", {
400
+ }, v = (s, d) => {
401
+ const y = JSON.stringify(s);
402
+ if (!d(y)) {
403
+ a("copy:error", {
404
404
  entity: s,
405
405
  message: n("consumers.errors.copy")
406
406
  });
407
407
  return;
408
408
  }
409
- r("copy:success", {
409
+ a("copy:success", {
410
410
  entity: s,
411
411
  message: n("consumers.copy.success_brief")
412
412
  });
413
- }, y = async (s) => {
414
- var h;
415
- await ((h = t.canRetrieve) == null ? void 0 : h.call(t, s)) && $.push(t.config.getViewRoute(s.id));
416
- }, E = (s) => ({
413
+ }, S = async (s) => {
414
+ var y;
415
+ await ((y = t.canRetrieve) == null ? void 0 : y.call(t, s)) && E.push(t.config.getViewRoute(s.id));
416
+ }, ee = (s) => ({
417
417
  label: n("consumers.actions.view"),
418
418
  to: t.config.getViewRoute(s)
419
- }), Z = (s) => ({
419
+ }), F = (s) => ({
420
420
  label: n("consumers.actions.edit"),
421
421
  to: t.config.getEditRoute(s)
422
- }), S = k(void 0), ee = k(!1), ae = k(!1), be = k(""), Ve = ot(t.config, O.value), Re = (s) => {
423
- S.value = s, ee.value = !0;
424
- }, Te = () => {
425
- ee.value = !1;
426
- }, Ue = async () => {
427
- var s, d, h;
428
- if ((s = S.value) != null && s.id) {
429
- ae.value = !0;
422
+ }), B = I(void 0), ae = I(!1), ie = I(!1), Ce = I(""), Ue = st(t.config, N.value), Fe = (s) => {
423
+ B.value = s, ae.value = !0;
424
+ }, Be = () => {
425
+ ae.value = !1;
426
+ }, Pe = async () => {
427
+ var s, d, y;
428
+ if ((s = B.value) != null && s.id) {
429
+ ie.value = !0;
430
430
  try {
431
- await G.delete(Ve(S.value.id)), ae.value = !1, ee.value = !1, a.value++, r("delete:success", S.value);
432
- } catch (I) {
433
- be.value = ((h = (d = I.response) == null ? void 0 : d.data) == null ? void 0 : h.message) || I.message || n("consumers.errors.delete"), r("error", I);
431
+ await G.delete(Ue(B.value.id)), ie.value = !1, ae.value = !1, r.value++, a("delete:success", B.value);
432
+ } catch ($) {
433
+ Ce.value = ((y = (d = $.response) == null ? void 0 : d.data) == null ? void 0 : y.message) || $.message || n("consumers.errors.delete"), a("error", $);
434
434
  } finally {
435
- ae.value = !1;
435
+ ie.value = !1;
436
436
  }
437
437
  }
438
- }, de = k(!1), Ce = () => {
439
- de.value = !0;
440
- }, _e = () => {
441
- de.value = !1;
442
- }, ke = (s, d) => {
443
- d || _e(), a.value++, r("add:success", s);
444
- }, Fe = () => {
445
- A.value && Ce();
446
- }, q = k(void 0), me = k(!1), Pe = k(""), Be = (s) => {
447
- q.value = s, me.value = !0;
448
- }, Ie = () => {
449
- me.value = !1, q.value = void 0;
450
- }, Ke = w(() => {
451
- var d, h, I, j;
452
- let s = `${t.config.apiBaseUrl}${W.list[t.config.app].oneForConsumerGroup}`;
453
- return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((h = t.config) == null ? void 0 : h.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (I = t.config) != null && I.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((j = t.config) == null ? void 0 : j.consumerGroupId) || "")), s;
454
- }), we = k(!1), qe = async () => {
438
+ }, me = I(!1), _e = () => {
439
+ me.value = !0;
440
+ }, ke = () => {
441
+ me.value = !1;
442
+ }, Ie = (s, d) => {
443
+ d || ke(), r.value++, a("add:success", s);
444
+ }, Ke = () => {
445
+ k.value && _e();
446
+ }, q = I(void 0), pe = I(!1), qe = I(""), Oe = (s) => {
447
+ q.value = s, pe.value = !0;
448
+ }, we = () => {
449
+ pe.value = !1, q.value = void 0;
450
+ }, Ne = w(() => {
451
+ var d, y, $, L;
452
+ let s = `${t.config.apiBaseUrl}${Y.list[t.config.app].oneForConsumerGroup}`;
453
+ return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((y = t.config) == null ? void 0 : y.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, ($ = t.config) != null && $.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((L = t.config) == null ? void 0 : L.consumerGroupId) || "")), s;
454
+ }), $e = I(!1), je = async () => {
455
455
  if (q.value) {
456
- we.value = !0;
456
+ $e.value = !0;
457
457
  try {
458
- const s = Ke.value.replace(/{consumerId}/gi, q.value.id);
459
- await G.delete(s), r("remove:success", q.value), Ie(), a.value++;
458
+ const s = Ne.value.replace(/{consumerId}/gi, q.value.id);
459
+ await G.delete(s), a("remove:success", q.value), we(), r.value++;
460
460
  } catch (s) {
461
- Pe.value = s.message || n("consumers.errors.delete"), r("error", s);
461
+ qe.value = s.message || n("consumers.errors.delete"), a("error", s);
462
462
  } finally {
463
- we.value = !1;
463
+ $e.value = !1;
464
464
  }
465
465
  }
466
466
  };
467
- ve(X, (s) => {
468
- var d, h, I;
469
- if (s.status === st.Error) {
470
- v.value = {
467
+ ye(i, (s) => {
468
+ var d, y, $;
469
+ if (s.status === nt.Error) {
470
+ u.value = {
471
471
  title: n("consumers.errors.general")
472
- }, (I = (h = (d = s.error) == null ? void 0 : d.response) == null ? void 0 : h.data) != null && I.message && (v.value.message = s.error.response.data.message), r("error", s.error);
472
+ }, ($ = (y = (d = s.error) == null ? void 0 : d.response) == null ? void 0 : y.data) != null && $.message && (u.value.message = s.error.response.data.message), a("error", s.error);
473
473
  return;
474
474
  }
475
- v.value = null;
475
+ u.value = null;
476
476
  });
477
- const pe = k({
478
- ctaPath: A.value ? void 0 : t.config.createRoute,
477
+ const fe = I({
478
+ ctaPath: k.value ? void 0 : t.config.createRoute,
479
479
  ctaText: void 0,
480
480
  message: `${n("consumers.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
481
481
  title: n("consumers.title")
482
482
  });
483
- return He(async () => {
484
- await t.canCreate() && (pe.value.title = A.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), pe.value.ctaText = A.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
483
+ return ze(async () => {
484
+ await t.canCreate() && (fe.value.title = k.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), fe.value.ctaText = k.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
485
485
  }), (s, d) => {
486
- const h = N("KButton"), I = N("KDropdownItem"), j = N("KClipboardProvider"), Ne = N("KPrompt");
487
- return D(), L("div", St, [
488
- c(o(nt), {
486
+ const y = O("KButton"), $ = O("KDropdownItem"), L = O("KClipboardProvider"), Le = O("KPrompt");
487
+ return x(), H("div", Mt, [
488
+ c(o(rt), {
489
489
  "cache-identifier": e.cacheIdentifier,
490
- "disable-sorting": T.value,
491
- "empty-state-options": pe.value,
490
+ "disable-sorting": V.value,
491
+ "empty-state-options": fe.value,
492
492
  "enable-entity-actions": "",
493
- "error-message": v.value,
494
- fetcher: o(U),
495
- "fetcher-cache-key": o(a),
496
- "hide-pagination": A.value && !e.config.paginatedEndpoint,
493
+ "error-message": u.value,
494
+ fetcher: o(Z),
495
+ "fetcher-cache-key": o(r),
496
+ "hide-pagination": k.value && !e.config.paginatedEndpoint,
497
497
  "pagination-type": "offset",
498
- "preferences-storage-key": P.value,
499
- query: F.value,
500
- "row-attributes": Y,
498
+ "preferences-storage-key": D.value,
499
+ query: U.value,
500
+ "row-attributes": X,
501
501
  "table-headers": o(p),
502
- onClearSearchInput: i,
503
- "onClick:row": d[3] || (d[3] = (f) => y(f)),
504
- onEmptyStateCtaClicked: Fe,
505
- onSort: g,
502
+ onClearSearchInput: g,
503
+ "onClick:row": d[4] || (d[4] = (f) => S(f)),
504
+ onEmptyStateCtaClicked: Ke,
505
+ onSort: T,
506
506
  onState: o(Q)
507
- }, Ee({
507
+ }, Se({
508
508
  "toolbar-filter": l(() => [
509
- A.value ? z("", !0) : (D(), se(o(rt), {
509
+ k.value ? W("", !0) : (x(), z(o(at), {
510
510
  key: 0,
511
- modelValue: F.value,
512
- "onUpdate:modelValue": d[0] || (d[0] = (f) => F.value = f),
513
- config: ne.value
511
+ modelValue: U.value,
512
+ "onUpdate:modelValue": d[0] || (d[0] = (f) => U.value = f),
513
+ config: se.value
514
514
  }, null, 8, ["modelValue", "config"]))
515
515
  ]),
516
516
  "toolbar-button": l(() => [
517
- (D(), se(Je, {
517
+ (x(), z(Me, {
518
518
  disabled: !e.useActionOutside,
519
519
  to: "#kong-ui-app-page-header-action-button"
520
520
  }, [
521
- _("div", Mt, [
522
- !A.value && K.value ? (D(), se(h, {
521
+ _("div", Gt, [
522
+ !k.value && K.value ? (x(), z(y, {
523
523
  key: 0,
524
524
  appearance: "secondary",
525
525
  class: "open-learning-hub",
@@ -528,22 +528,22 @@ const ce = {
528
528
  onClick: d[1] || (d[1] = (f) => s.$emit("click:learn-more"))
529
529
  }, {
530
530
  default: l(() => [
531
- c(o(Qe), { decorative: "" })
531
+ c(o(xe), { decorative: "" })
532
532
  ]),
533
533
  _: 1
534
- })) : z("", !0),
535
- c(o(ie), {
534
+ })) : W("", !0),
535
+ c(o(le), {
536
536
  "auth-function": () => e.canCreate()
537
537
  }, {
538
538
  default: l(() => [
539
- c(h, {
539
+ c(y, {
540
540
  appearance: "primary",
541
541
  "data-testid": "toolbar-add-consumer",
542
542
  size: e.useActionOutside ? "medium" : "large",
543
- onClick: H
543
+ onClick: J
544
544
  }, {
545
545
  default: l(() => [
546
- c(o(ze)),
546
+ c(o(We)),
547
547
  re(" " + C(e.config.consumerGroupId ? o(n)("consumers.actions.add_consumer") : o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
548
548
  ]),
549
549
  _: 1
@@ -555,20 +555,20 @@ const ce = {
555
555
  ], 8, ["disabled"]))
556
556
  ]),
557
557
  username: l(({ rowValue: f }) => [
558
- _("b", null, C(R(f)), 1)
558
+ _("b", null, C(h(f)), 1)
559
559
  ]),
560
560
  custom_id: l(({ rowValue: f }) => [
561
- re(C(R(f)), 1)
561
+ re(C(h(f)), 1)
562
562
  ]),
563
563
  tags: l(({ rowValue: f }) => [
564
- c(o(at), { tags: f }, null, 8, ["tags"])
564
+ c(o(it), { tags: f }, null, 8, ["tags"])
565
565
  ]),
566
566
  actions: l(({ row: f }) => [
567
- c(j, null, {
568
- default: l(({ copyToClipboard: fe }) => [
569
- c(I, {
567
+ c(L, null, {
568
+ default: l(({ copyToClipboard: ge }) => [
569
+ c($, {
570
570
  "data-testid": "action-entity-copy-id",
571
- onClick: (Oe) => u(f, fe)
571
+ onClick: (He) => b(f, ge)
572
572
  }, {
573
573
  default: l(() => [
574
574
  re(C(o(n)("consumers.actions.copy_id")), 1)
@@ -578,11 +578,11 @@ const ce = {
578
578
  ]),
579
579
  _: 2
580
580
  }, 1024),
581
- c(j, null, {
582
- default: l(({ copyToClipboard: fe }) => [
583
- c(I, {
581
+ c(L, null, {
582
+ default: l(({ copyToClipboard: ge }) => [
583
+ c($, {
584
584
  "data-testid": "action-entity-copy-json",
585
- onClick: (Oe) => b(f, fe)
585
+ onClick: (He) => v(f, ge)
586
586
  }, {
587
587
  default: l(() => [
588
588
  re(C(o(n)("consumers.actions.copy_json")), 1)
@@ -592,38 +592,38 @@ const ce = {
592
592
  ]),
593
593
  _: 2
594
594
  }, 1024),
595
- c(o(ie), {
595
+ c(o(le), {
596
596
  "auth-function": () => e.canRetrieve(f)
597
597
  }, {
598
598
  default: l(() => [
599
- c(I, {
599
+ c($, {
600
600
  "data-testid": "action-entity-view",
601
601
  "has-divider": "",
602
- item: E(f.id)
602
+ item: ee(f.id)
603
603
  }, null, 8, ["item"])
604
604
  ]),
605
605
  _: 2
606
606
  }, 1032, ["auth-function"]),
607
- c(o(ie), {
607
+ c(o(le), {
608
608
  "auth-function": () => e.canEdit(f)
609
609
  }, {
610
610
  default: l(() => [
611
- c(I, {
611
+ c($, {
612
612
  "data-testid": "action-entity-edit",
613
- item: Z(f.id)
613
+ item: F(f.id)
614
614
  }, null, 8, ["item"])
615
615
  ]),
616
616
  _: 2
617
617
  }, 1032, ["auth-function"]),
618
- c(o(ie), {
618
+ c(o(le), {
619
619
  "auth-function": () => e.canDelete(f)
620
620
  }, {
621
621
  default: l(() => [
622
- c(I, {
622
+ c($, {
623
623
  danger: "",
624
624
  "data-testid": "action-entity-delete",
625
625
  "has-divider": "",
626
- onClick: () => e.config.consumerGroupId ? Be(f) : Re(f)
626
+ onClick: () => e.config.consumerGroupId ? Oe(f) : Fe(f)
627
627
  }, {
628
628
  default: l(() => [
629
629
  re(C(e.config.consumerGroupId ? o(n)("consumers.actions.remove") : o(n)("consumers.actions.delete")), 1)
@@ -636,69 +636,92 @@ const ce = {
636
636
  ]),
637
637
  _: 2
638
638
  }, [
639
+ !o(j) && ne.value ? {
640
+ name: "outside-actions",
641
+ fn: l(() => [
642
+ (x(), z(Me, {
643
+ disabled: !e.useActionOutside,
644
+ to: "#kong-ui-app-page-header-action-button"
645
+ }, [
646
+ c(y, {
647
+ appearance: "secondary",
648
+ class: "open-learning-hub",
649
+ "data-testid": "consumers-learn-more-button",
650
+ icon: "",
651
+ onClick: d[2] || (d[2] = (f) => s.$emit("click:learn-more"))
652
+ }, {
653
+ default: l(() => [
654
+ c(o(xe), { decorative: "" })
655
+ ]),
656
+ _: 1
657
+ })
658
+ ], 8, ["disabled"]))
659
+ ]),
660
+ key: "0"
661
+ } : void 0,
639
662
  e.enableV2EmptyStates && e.config.app === "konnect" ? {
640
663
  name: "empty-state",
641
664
  fn: l(() => [
642
- c(o(it), {
665
+ c(o(lt), {
643
666
  "action-button-text": o(n)("consumers.list.toolbar_actions.new_consumer"),
644
667
  appearance: "secondary",
645
668
  "can-create": () => e.canCreate(),
646
669
  description: o(n)("consumers.list.empty_state_v2.description"),
647
670
  "learn-more": e.config.app === "konnect",
648
671
  title: o(n)("consumers.list.empty_state_v2.title"),
649
- "onClick:create": H,
650
- "onClick:learnMore": d[2] || (d[2] = (f) => s.$emit("click:learn-more"))
672
+ "onClick:create": J,
673
+ "onClick:learnMore": d[3] || (d[3] = (f) => s.$emit("click:learn-more"))
651
674
  }, {
652
675
  image: l(() => [
653
- _("div", Gt, [
654
- c(o(We), {
655
- color: o(ft),
656
- size: o(gt)
676
+ _("div", xt, [
677
+ c(o(Ye), {
678
+ color: o(gt),
679
+ size: o(vt)
657
680
  }, null, 8, ["color", "size"])
658
681
  ])
659
682
  ]),
660
683
  _: 1
661
684
  }, 8, ["action-button-text", "can-create", "description", "learn-more", "title"])
662
685
  ]),
663
- key: "0"
686
+ key: "1"
664
687
  } : void 0
665
688
  ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-pagination", "preferences-storage-key", "query", "table-headers", "onState"]),
666
- c(o(lt), {
667
- "action-button-disabled": ae.value,
689
+ c(o(ut), {
690
+ "action-button-disabled": ie.value,
668
691
  "data-testid": "delete-consumer-modal",
669
692
  description: o(n)("consumers.delete.description"),
670
- "entity-name": S.value && (S.value.username || S.value.custom_id || S.value.id),
671
- "entity-type": o(ut).Consumer,
672
- error: be.value,
693
+ "entity-name": B.value && (B.value.username || B.value.custom_id || B.value.id),
694
+ "entity-type": o(ct).Consumer,
695
+ error: Ce.value,
673
696
  title: o(n)("consumers.delete.title"),
674
- visible: ee.value,
675
- onCancel: Te,
676
- onProceed: Ue
697
+ visible: ae.value,
698
+ onCancel: Be,
699
+ onProceed: Pe
677
700
  }, null, 8, ["action-button-disabled", "description", "entity-name", "entity-type", "error", "title", "visible"]),
678
- e.config.consumerGroupId ? (D(), se(Et, {
701
+ e.config.consumerGroupId ? (x(), z(St, {
679
702
  key: 0,
680
703
  config: e.config,
681
704
  "data-testid": "add-consumer-modal",
682
- visible: de.value,
683
- "onAdd:partialSuccess": d[4] || (d[4] = (f) => ke(f, !0)),
684
- "onAdd:success": d[5] || (d[5] = (f) => ke(f)),
685
- onCancel: _e
686
- }, null, 8, ["config", "visible"])) : z("", !0),
687
- e.config.consumerGroupId && q.value ? (D(), se(Ne, {
705
+ visible: me.value,
706
+ "onAdd:partialSuccess": d[5] || (d[5] = (f) => Ie(f, !0)),
707
+ "onAdd:success": d[6] || (d[6] = (f) => Ie(f)),
708
+ onCancel: ke
709
+ }, null, 8, ["config", "visible"])) : W("", !0),
710
+ e.config.consumerGroupId && q.value ? (x(), z(Le, {
688
711
  key: 1,
689
712
  "action-button-appearance": "danger",
690
713
  "data-testid": "remove-consumer-modal",
691
714
  title: o(n)("consumers.consumer_groups.remove.title"),
692
- visible: me.value,
693
- onCancel: Ie,
694
- onProceed: qe
715
+ visible: pe.value,
716
+ onCancel: we,
717
+ onProceed: je
695
718
  }, {
696
719
  default: l(() => [
697
- c(o(x), {
720
+ c(o(A), {
698
721
  class: "message",
699
722
  keypath: e.config.consumerGroupName ? "consumers.consumer_groups.remove.confirmation" : "consumers.consumer_groups.remove.confirmationNoCG",
700
723
  tag: "p"
701
- }, Ee({
724
+ }, Se({
702
725
  consumer: l(() => [
703
726
  _("strong", null, C(q.value.username || q.value.custom_id || q.value.id), 1)
704
727
  ]),
@@ -715,35 +738,35 @@ const ce = {
715
738
  _("p", null, C(o(n)("consumers.consumer_groups.remove.description")), 1)
716
739
  ]),
717
740
  _: 1
718
- }, 8, ["title", "visible"])) : z("", !0)
741
+ }, 8, ["title", "visible"])) : W("", !0)
719
742
  ]);
720
743
  };
721
744
  }
722
- }), Jt = /* @__PURE__ */ he(xt, [["__scopeId", "data-v-260b39e3"]]);
745
+ }), Qt = /* @__PURE__ */ be(At, [["__scopeId", "data-v-c7796978"]]);
723
746
  var M = [];
724
- for (var ge = 0; ge < 256; ++ge)
725
- M.push((ge + 256).toString(16).slice(1));
726
- function At(e, m = 0) {
747
+ for (var ve = 0; ve < 256; ++ve)
748
+ M.push((ve + 256).toString(16).slice(1));
749
+ function Dt(e, m = 0) {
727
750
  return (M[e[m + 0]] + M[e[m + 1]] + M[e[m + 2]] + M[e[m + 3]] + "-" + M[e[m + 4]] + M[e[m + 5]] + "-" + M[e[m + 6]] + M[e[m + 7]] + "-" + M[e[m + 8]] + M[e[m + 9]] + "-" + M[e[m + 10]] + M[e[m + 11]] + M[e[m + 12]] + M[e[m + 13]] + M[e[m + 14]] + M[e[m + 15]]).toLowerCase();
728
751
  }
729
- var le, Dt = new Uint8Array(16);
730
- function Vt() {
731
- if (!le && (le = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !le))
752
+ var ue, Vt = new Uint8Array(16);
753
+ function Rt() {
754
+ if (!ue && (ue = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ue))
732
755
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
733
- return le(Dt);
756
+ return ue(Vt);
734
757
  }
735
- var Rt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
736
- const xe = {
737
- randomUUID: Rt
758
+ var Tt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
759
+ const Ve = {
760
+ randomUUID: Tt
738
761
  };
739
- function Tt(e, m, r) {
740
- if (xe.randomUUID && !m && !e)
741
- return xe.randomUUID();
762
+ function Ut(e, m, a) {
763
+ if (Ve.randomUUID && !m && !e)
764
+ return Ve.randomUUID();
742
765
  e = e || {};
743
- var t = e.random || (e.rng || Vt)();
744
- return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, At(t);
766
+ var t = e.random || (e.rng || Rt)();
767
+ return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, Dt(t);
745
768
  }
746
- const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { class: "fields-group-text" }, Bt = ["aria-labelledby"], Kt = /* @__PURE__ */ ue({
769
+ const Ft = { class: "kong-ui-entities-consumer-form" }, Bt = ["id"], Pt = { class: "fields-group-text" }, Kt = ["aria-labelledby"], qt = /* @__PURE__ */ ce({
747
770
  __name: "ConsumerForm",
748
771
  props: {
749
772
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -761,8 +784,8 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
761
784
  },
762
785
  emits: ["update", "error", "loading"],
763
786
  setup(e, { emit: m }) {
764
- var X;
765
- const r = e, t = m, { i18nT: x, i18n: { t: n } } = ce.useI18n(), $ = Ae(), { axiosInstance: G } = ye((X = r.config) == null ? void 0 : X.axiosRequestConfig), { getMessageFromError: T } = ct(), B = Tt(), p = Se({
787
+ var Z;
788
+ const a = e, t = m, { i18nT: A, i18n: { t: n } } = de.useI18n(), E = Re(), { axiosInstance: G } = he((Z = a.config) == null ? void 0 : Z.axiosRequestConfig), { getMessageFromError: V } = dt(), P = Ut(), p = Ge({
766
789
  fields: {
767
790
  username: "",
768
791
  customId: "",
@@ -770,69 +793,69 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
770
793
  },
771
794
  readonly: !1,
772
795
  errorMessage: ""
773
- }), Y = Se({
796
+ }), X = Ge({
774
797
  username: "",
775
798
  customId: "",
776
799
  tags: ""
777
- }), H = w(() => {
778
- var a, i;
779
- return (i = W.form[(a = r.config) == null ? void 0 : a.app]) == null ? void 0 : i.edit;
780
- }), O = () => {
781
- var a;
782
- $.push(((a = r.config) == null ? void 0 : a.cancelRoute) || { name: "consumer-list" });
783
- }, F = (a) => {
784
- t("loading", a);
785
- }, ne = (a) => {
786
- t("error", a);
787
- }, J = (a) => {
788
- var g, R, v;
789
- p.fields.username = ((g = a == null ? void 0 : a.item) == null ? void 0 : g.username) || (a == null ? void 0 : a.username) || "", p.fields.customId = ((R = a == null ? void 0 : a.item) == null ? void 0 : R.custom_id) || (a == null ? void 0 : a.custom_id) || "";
790
- const i = ((v = a == null ? void 0 : a.item) == null ? void 0 : v.tags) || (a == null ? void 0 : a.tags) || [];
791
- p.fields.tags = (i == null ? void 0 : i.join(", ")) || "", Object.assign(Y, p.fields);
792
- }, Q = w(() => r.consumerId ? Me.Edit : Me.Create), K = (a) => {
793
- var g, R, v, u, b, y;
794
- let i = `${(g = r.config) == null ? void 0 : g.apiBaseUrl}${W.form[(R = r.config) == null ? void 0 : R.app][a]}`;
795
- return ((v = r.config) == null ? void 0 : v.app) === "konnect" ? i = i.replace(/{controlPlaneId}/gi, ((u = r.config) == null ? void 0 : u.controlPlaneId) || "") : ((b = r.config) == null ? void 0 : b.app) === "kongManager" && (i = i.replace(/\/{workspace}/gi, (y = r.config) != null && y.workspace ? `/${r.config.workspace}` : "")), i = i.replace(/{id}/gi, r.consumerId), i;
796
- }, A = w(() => !!p.fields.username || !!p.fields.customId), P = w(() => JSON.stringify(p.fields) !== JSON.stringify(Y)), V = w(() => {
797
- var a, i;
800
+ }), J = w(() => {
801
+ var i, r;
802
+ return (r = Y.form[(i = a.config) == null ? void 0 : i.app]) == null ? void 0 : r.edit;
803
+ }), N = () => {
804
+ var i;
805
+ E.push(((i = a.config) == null ? void 0 : i.cancelRoute) || { name: "consumer-list" });
806
+ }, U = (i) => {
807
+ t("loading", i);
808
+ }, se = (i) => {
809
+ t("error", i);
810
+ }, j = (i) => {
811
+ var g, T, h;
812
+ p.fields.username = ((g = i == null ? void 0 : i.item) == null ? void 0 : g.username) || (i == null ? void 0 : i.username) || "", p.fields.customId = ((T = i == null ? void 0 : i.item) == null ? void 0 : T.custom_id) || (i == null ? void 0 : i.custom_id) || "";
813
+ const r = ((h = i == null ? void 0 : i.item) == null ? void 0 : h.tags) || (i == null ? void 0 : i.tags) || [];
814
+ p.fields.tags = (r == null ? void 0 : r.join(", ")) || "", Object.assign(X, p.fields);
815
+ }, Q = w(() => a.consumerId ? Ae.Edit : Ae.Create), K = (i) => {
816
+ var g, T, h, u, b, v;
817
+ let r = `${(g = a.config) == null ? void 0 : g.apiBaseUrl}${Y.form[(T = a.config) == null ? void 0 : T.app][i]}`;
818
+ return ((h = a.config) == null ? void 0 : h.app) === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((u = a.config) == null ? void 0 : u.controlPlaneId) || "") : ((b = a.config) == null ? void 0 : b.app) === "kongManager" && (r = r.replace(/\/{workspace}/gi, (v = a.config) != null && v.workspace ? `/${a.config.workspace}` : "")), r = r.replace(/{id}/gi, a.consumerId), r;
819
+ }, ne = w(() => !!p.fields.username || !!p.fields.customId), k = w(() => JSON.stringify(p.fields) !== JSON.stringify(X)), D = w(() => {
820
+ var i, r;
798
821
  return {
799
822
  username: p.fields.username || null,
800
823
  custom_id: p.fields.customId || null,
801
- tags: (i = (a = p.fields.tags.split(",")) == null ? void 0 : a.map((g) => String(g || "").trim())) == null ? void 0 : i.filter((g) => g !== "")
824
+ tags: (r = (i = p.fields.tags.split(",")) == null ? void 0 : i.map((g) => String(g || "").trim())) == null ? void 0 : r.filter((g) => g !== "")
802
825
  };
803
- }), U = async () => {
804
- var a;
826
+ }), R = async () => {
827
+ var i;
805
828
  try {
806
829
  p.readonly = !0;
807
- let i;
808
- await G.post(K("validate"), V.value), Q.value === "create" ? i = await G.post(K("create"), V.value) : Q.value === "edit" && (i = ((a = r.config) == null ? void 0 : a.app) === "konnect" ? await G.put(K("edit"), V.value) : await G.patch(K("edit"), V.value)), J(i == null ? void 0 : i.data), t("update", i == null ? void 0 : i.data);
809
- } catch (i) {
810
- p.errorMessage = T(i), t("error", i);
830
+ let r;
831
+ await G.post(K("validate"), D.value), Q.value === "create" ? r = await G.post(K("create"), D.value) : Q.value === "edit" && (r = ((i = a.config) == null ? void 0 : i.app) === "konnect" ? await G.put(K("edit"), D.value) : await G.patch(K("edit"), D.value)), j(r == null ? void 0 : r.data), t("update", r == null ? void 0 : r.data);
832
+ } catch (r) {
833
+ p.errorMessage = V(r), t("error", r);
811
834
  } finally {
812
835
  p.readonly = !1;
813
836
  }
814
837
  };
815
- return (a, i) => {
816
- const g = N("KInput"), R = N("KCard");
817
- return D(), L("div", Ut, [
818
- c(o(dt), {
819
- "can-submit": A.value && P.value,
838
+ return (i, r) => {
839
+ const g = O("KInput"), T = O("KCard");
840
+ return x(), H("div", Ft, [
841
+ c(o(mt), {
842
+ "can-submit": ne.value && k.value,
820
843
  config: e.config,
821
844
  "edit-id": e.consumerId,
822
- "entity-type": o(De).Consumer,
845
+ "entity-type": o(Te).Consumer,
823
846
  "error-message": p.errorMessage,
824
- "fetch-url": H.value,
825
- "form-fields": V.value,
847
+ "fetch-url": J.value,
848
+ "form-fields": D.value,
826
849
  "is-readonly": p.readonly,
827
- onCancel: O,
828
- "onFetch:error": i[3] || (i[3] = (v) => ne(v)),
829
- "onFetch:success": J,
830
- onLoading: i[4] || (i[4] = (v) => F(v)),
831
- onSubmit: U
850
+ onCancel: N,
851
+ "onFetch:error": r[3] || (r[3] = (h) => se(h)),
852
+ "onFetch:success": j,
853
+ onLoading: r[4] || (r[4] = (h) => U(h)),
854
+ onSubmit: R
832
855
  }, {
833
856
  default: l(() => [
834
857
  _("div", null, [
835
- c(o(mt), {
858
+ c(o(pt), {
836
859
  description: o(n)("consumers.form.info.description"),
837
860
  "has-divider": "",
838
861
  title: o(n)("consumers.form.info.title")
@@ -840,19 +863,19 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
840
863
  default: l(() => [
841
864
  _("div", null, [
842
865
  _("h3", {
843
- id: `fields-group-title-${o(B)}`,
866
+ id: `fields-group-title-${o(P)}`,
844
867
  class: "fields-group-title"
845
- }, C(o(n)("consumers.form.consumer_identification.title")) + "* ", 9, Ft),
868
+ }, C(o(n)("consumers.form.consumer_identification.title")) + "* ", 9, Bt),
846
869
  _("p", Pt, C(o(n)("consumers.form.consumer_identification.description")), 1)
847
870
  ]),
848
- c(R, null, {
871
+ c(T, null, {
849
872
  default: l(() => [
850
873
  _("fieldset", {
851
- "aria-labelledby": `fields-group-title-${o(B)}`
874
+ "aria-labelledby": `fields-group-title-${o(P)}`
852
875
  }, [
853
876
  c(g, {
854
877
  modelValue: p.fields.username,
855
- "onUpdate:modelValue": i[0] || (i[0] = (v) => p.fields.username = v),
878
+ "onUpdate:modelValue": r[0] || (r[0] = (h) => p.fields.username = h),
856
879
  modelModifiers: { trim: !0 },
857
880
  autocomplete: "off",
858
881
  class: "username-field",
@@ -864,7 +887,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
864
887
  type: "text"
865
888
  }, {
866
889
  "label-tooltip": l(() => [
867
- c(o(x), {
890
+ c(o(A), {
868
891
  keypath: "consumers.fields.username.tooltip",
869
892
  scope: "global"
870
893
  }, {
@@ -878,7 +901,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
878
901
  }, 8, ["modelValue", "label", "placeholder", "readonly"]),
879
902
  c(g, {
880
903
  modelValue: p.fields.customId,
881
- "onUpdate:modelValue": i[1] || (i[1] = (v) => p.fields.customId = v),
904
+ "onUpdate:modelValue": r[1] || (r[1] = (h) => p.fields.customId = h),
882
905
  modelModifiers: { trim: !0 },
883
906
  autocomplete: "off",
884
907
  "data-testid": "consumer-form-custom-id",
@@ -889,7 +912,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
889
912
  type: "text"
890
913
  }, {
891
914
  "label-tooltip": l(() => [
892
- c(o(x), {
915
+ c(o(A), {
893
916
  keypath: "consumers.fields.custom_id.tooltip",
894
917
  scope: "global"
895
918
  }, {
@@ -901,13 +924,13 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
901
924
  ]),
902
925
  _: 1
903
926
  }, 8, ["modelValue", "label", "placeholder", "readonly"])
904
- ], 8, Bt)
927
+ ], 8, Kt)
905
928
  ]),
906
929
  _: 1
907
930
  }),
908
931
  c(g, {
909
932
  modelValue: p.fields.tags,
910
- "onUpdate:modelValue": i[2] || (i[2] = (v) => p.fields.tags = v),
933
+ "onUpdate:modelValue": r[2] || (r[2] = (h) => p.fields.tags = h),
911
934
  modelModifiers: { trim: !0 },
912
935
  autocomplete: "off",
913
936
  "data-testid": "consumer-form-tags",
@@ -931,7 +954,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
931
954
  ]);
932
955
  };
933
956
  }
934
- }), Qt = /* @__PURE__ */ he(Kt, [["__scopeId", "data-v-5580f86e"]]), qt = { class: "kong-ui-consumer-entity-config-card" }, zt = /* @__PURE__ */ ue({
957
+ }), zt = /* @__PURE__ */ be(qt, [["__scopeId", "data-v-5580f86e"]]), Ot = { class: "kong-ui-consumer-entity-config-card" }, Wt = /* @__PURE__ */ ce({
935
958
  __name: "ConsumerConfigCard",
936
959
  props: {
937
960
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -958,23 +981,23 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
958
981
  },
959
982
  emits: ["loading", "fetch:error", "fetch:success"],
960
983
  setup(e) {
961
- const m = e, { i18n: { t: r }, i18nT: t } = ce.useI18n(), x = w(() => W.form[m.config.app].edit), n = k({
984
+ const m = e, { i18n: { t: a }, i18nT: t } = de.useI18n(), A = w(() => Y.form[m.config.app].edit), n = I({
962
985
  id: {},
963
986
  username: {
964
- section: Ge.Basic,
965
- tooltip: r("consumers.fields.username.tooltip"),
987
+ section: De.Basic,
988
+ tooltip: a("consumers.fields.username.tooltip"),
966
989
  order: 1
967
990
  },
968
991
  custom_id: {
969
- section: Ge.Basic,
970
- tooltip: r("consumers.fields.custom_id.tooltip"),
971
- label: r("consumers.fields.custom_id.label"),
992
+ section: De.Basic,
993
+ tooltip: a("consumers.fields.custom_id.tooltip"),
994
+ label: a("consumers.fields.custom_id.label"),
972
995
  order: 2
973
996
  },
974
997
  updated_at: {},
975
998
  created_at: {},
976
999
  tags: {
977
- tooltip: r("consumers.fields.tags.tooltip")
1000
+ tooltip: a("consumers.fields.tags.tooltip")
978
1001
  },
979
1002
  username_lower: {
980
1003
  hidden: !0
@@ -983,17 +1006,17 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
983
1006
  hidden: !0
984
1007
  }
985
1008
  });
986
- return ($, G) => (D(), L("div", qt, [
987
- c(o(pt), {
1009
+ return (E, G) => (x(), H("div", Ot, [
1010
+ c(o(ft), {
988
1011
  config: e.config,
989
1012
  "config-card-doc": e.configCardDoc,
990
1013
  "config-schema": n.value,
991
- "entity-type": o(De).Consumer,
992
- "fetch-url": x.value,
1014
+ "entity-type": o(Te).Consumer,
1015
+ "fetch-url": A.value,
993
1016
  "hide-title": e.hideTitle,
994
- "onFetch:error": G[0] || (G[0] = (T) => $.$emit("fetch:error", T)),
995
- "onFetch:success": G[1] || (G[1] = (T) => $.$emit("fetch:success", T)),
996
- onLoading: G[2] || (G[2] = (T) => $.$emit("loading", T))
1017
+ "onFetch:error": G[0] || (G[0] = (V) => E.$emit("fetch:error", V)),
1018
+ "onFetch:success": G[1] || (G[1] = (V) => E.$emit("fetch:success", V)),
1019
+ onLoading: G[2] || (G[2] = (V) => E.$emit("loading", V))
997
1020
  }, {
998
1021
  "username-label-tooltip": l(() => [
999
1022
  c(o(t), {
@@ -1001,7 +1024,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
1001
1024
  scope: "global"
1002
1025
  }, {
1003
1026
  custom_id: l(() => [
1004
- _("code", null, C(o(r)("consumers.fields.username.custom_id")), 1)
1027
+ _("code", null, C(o(a)("consumers.fields.username.custom_id")), 1)
1005
1028
  ]),
1006
1029
  _: 1
1007
1030
  })
@@ -1012,7 +1035,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
1012
1035
  scope: "global"
1013
1036
  }, {
1014
1037
  username: l(() => [
1015
- _("code", null, C(o(r)("consumers.fields.custom_id.username")), 1)
1038
+ _("code", null, C(o(a)("consumers.fields.custom_id.username")), 1)
1016
1039
  ]),
1017
1040
  _: 1
1018
1041
  })
@@ -1023,7 +1046,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
1023
1046
  }
1024
1047
  });
1025
1048
  export {
1026
- zt as ConsumerConfigCard,
1027
- Qt as ConsumerForm,
1028
- Jt as ConsumerList
1049
+ Wt as ConsumerConfigCard,
1050
+ zt as ConsumerForm,
1051
+ Qt as ConsumerList
1029
1052
  };