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