@kong-ui-public/entities-consumers 4.6.3 → 4.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,27 +1,28 @@
1
- import { defineComponent as ae, ref as g, computed as h, watch as ge, resolveComponent as V, openBlock as w, createBlock as z, unref as t, withCtx as a, createElementVNode as v, toDisplayString as f, createVNode as i, createElementBlock as j, createCommentVNode as L, Fragment as Le, renderList as He, onBeforeMount as Je, createSlots as fe, createTextVNode as O, Teleport as Qe, renderSlot as $e, reactive as Ee } from "vue";
2
- import { useRouter as Ae } from "vue-router";
3
- import { BookIcon as Se, AddIcon as Ge, TeamIcon as We } from "@kong/icons";
4
- import { createI18n as ze, 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, PermissionsWrapper as re, TableTags as nt, EntityFilter as rt, EntityDeleteModal as at, EntityTypes as it, useErrors as lt, EntityBaseFormType as Me, EntityBaseForm as ut, SupportedEntityType as De, EntityFormSection as ct, ConfigurationSchemaSection as xe, EntityBaseConfigCard as dt } from "@kong-ui-public/entities-shared";
6
- const mt = { list: { table_headers: { username: "Username", custom_id: "Custom ID", tags: "Tags", id: "ID" }, empty_state: { title: "Configure a new consumer", description: "Consumers are the end users of a service.", title_for_consumer_group: "Configure a new consumer" }, empty_state_v2: { title: "Configure your first consumer", group: "Consumers created in gateways within this group will automatically appear here.", description: "Consumers represent users or apps accessing your APIs, allowing for tailored authentication and individual access control.", learn_more: "Learn more" }, toolbar_actions: { new_consumer: "New consumer" } }, title: "Consumers", search: { placeholder: { konnect: "Filter by name", kongManager: "Filter by exact username or ID" } }, actions: { add_consumer: "Add consumer", create: "New consumer", copy_id: "Copy ID", copy_json: "Copy JSON", edit: "Edit", delete: "Delete", remove: "Remove", view: "View details" }, delete: { title: "Delete a consumer", description: "Deleting this consumer will also remove this consumer from any associated consumer group and delete all its plugins. This action cannot be reversed." }, consumer_groups: { add: { title: "Add consumers", ctaText: "Add consumers to this group", consumers_label: "Consumers", consumer_placeholder: "Add consumer", footer: "Search by exact name or ID to find consumers not included in the list" }, remove: { title: "Remove a consumer", confirmation: "Are you sure you want to remove this consumer {consumer} from consumer group {consumerGroup}?", confirmationNoCG: "Are you sure you want to remove this consumer {consumer} from this consumer group?", description: "Removing this consumer from the group could change the rate limit policy applied to this consumer." } }, errors: { general: "Consumers could not be retrieved", delete: "The consumer could not be deleted at this time.", copy: "Failed to copy to clipboard", add: "Some consumers could not be added at this time.", already_added: "This consumer has already been added to the consumer group" }, copy: { success: "Copied {val} to clipboard", success_brief: "Successfully copied to clipboard" }, form: { title: "Consumer identification", info: { title: "General information", description: "General information will help identify and manage added consumer." }, consumer_identification: { title: "Consumer identification", description: "A consumer can have both unique username and unique custom ID or one of them." } }, fields: { username: { label: "Username", placeholder: "Enter a unique username", tooltip: "The unique username of the consumer. You must send either this field or {custom_id} with the request.", custom_id: "custom_id" }, custom_id: { label: "Custom ID", placeholder: "Enter a unique custom ID", tooltip: "Field for storing an existing unique ID for the consumer - useful for mapping Kong with users in your existing database. You must send either this field or {username} with the request.", username: "username" }, tags: { label: "Tags", placeholder: "Enter a list of tags separated by comma", help: "e.g. tag1, tag2, tag3", tooltip: "An optional set of strings associated with the consumer for grouping and filtering." } } }, pt = {
7
- consumers: mt
1
+ import { defineComponent as ae, ref as y, computed as h, watch as ve, resolveComponent as P, openBlock as E, createBlock as z, unref as o, withCtx as a, createElementVNode as b, toDisplayString as p, createVNode as i, createElementBlock as O, createCommentVNode as j, Fragment as Je, renderList as Qe, onBeforeMount as We, createSlots as ge, createTextVNode as N, Teleport as ze, renderSlot as Ee, reactive as Se } from "vue";
2
+ import { useRouter as Fe } from "vue-router";
3
+ import { BookIcon as Ge, AddIcon as Me, TeamIcon as Ye } from "@kong/icons";
4
+ import { createI18n as Xe, i18nTComponent as Ze } from "@kong-ui-public/i18n";
5
+ import { useAxios as ye, useDebouncedFilter as et, useTableState as tt, useFetcher as ot, useDeleteUrlBuilder as st, FetcherStatus as nt, EntityBaseTable as rt, PermissionsWrapper as re, TableTags as at, EntityFilter as it, EntityDeleteModal as lt, EntityTypes as ct, useErrors as ut, EntityBaseFormType as xe, EntityBaseForm as dt, SupportedEntityType as De, EntityFormSection as mt, ConfigurationSchemaSection as Ae, EntityBaseConfigCard as pt } from "@kong-ui-public/entities-shared";
6
+ const ft = { list: { table_headers: { username: "Username", custom_id: "Custom ID", tags: "Tags", id: "ID" }, empty_state: { title: "Configure a new consumer", description: "Consumers are the end users of a service.", title_for_consumer_group: "Configure a new consumer" }, empty_state_v2: { title: "Configure your first consumer", group: "Consumers created in gateways within this group will automatically appear here.", description: "Consumers represent users or apps accessing your APIs, allowing for tailored authentication and individual access control.", learn_more: "Learn more" }, toolbar_actions: { new_consumer: "New consumer" } }, title: "Consumers", search: { placeholder: { konnect: "Filter by name", kongManager: "Filter by exact username or ID" } }, actions: { add_consumer: "Add consumer", create: "New consumer", copy_id: "Copy ID", copy_json: "Copy JSON", edit: "Edit", delete: "Delete", remove: "Remove", view: "View details" }, delete: { title: "Delete a consumer", description: "Deleting this consumer will also remove this consumer from any associated consumer group and delete all its plugins. This action cannot be reversed." }, consumer_groups: { add: { title: "Add consumers", ctaText: "Add consumers to this group", consumers_label: "Consumers", consumer_placeholder: "Add consumer", footer: "Search by exact name or ID to find consumers not included in the list" }, remove: { title: "Remove a consumer", confirmation: "Are you sure you want to remove this consumer {consumer} from consumer group {consumerGroup}?", confirmationNoCG: "Are you sure you want to remove this consumer {consumer} from this consumer group?", description: "Removing this consumer from the group could change the rate limit policy applied to this consumer." } }, errors: { general: "Consumers could not be retrieved", delete: "The consumer could not be deleted at this time.", copy: "Failed to copy to clipboard", add: "Some consumers could not be added at this time.", already_added: "This consumer has already been added to the consumer group" }, copy: { success: "Copied {val} to clipboard", success_brief: "Successfully copied to clipboard" }, form: { title: "Consumer identification", info: { title: "General information", description: "General information will help identify and manage added consumer." }, consumer_identification: { title: "Consumer identification", description: "A consumer can have both unique username and unique custom ID or one of them." } }, fields: { username: { label: "Username", placeholder: "Enter a unique username", tooltip: "The unique username of the consumer. You must send either this field or {custom_id} with the request.", custom_id: "custom_id" }, custom_id: { label: "Custom ID", placeholder: "Enter a unique custom ID", tooltip: "Field for storing an existing unique ID for the consumer - useful for mapping Kong with users in your existing database. You must send either this field or {username} with the request.", username: "username" }, tags: { label: "Tags", placeholder: "Enter a list of tags separated by comma", help: "e.g. tag1, tag2, tag3", tooltip: "An optional set of strings associated with the consumer for grouping and filtering." } } }, gt = {
7
+ consumers: ft
8
8
  };
9
- function ft() {
10
- const e = ze("en-us", pt);
9
+ function vt() {
10
+ const e = Xe("en-us", gt);
11
11
  return {
12
12
  i18n: e,
13
- i18nT: Ye(e)
13
+ i18nT: Ze(e)
14
14
  // Translation component <i18n-t>
15
15
  };
16
16
  }
17
17
  const ie = {
18
- useI18n: ft
19
- }, te = "/v2/control-planes/{controlPlaneId}/core-entities/{workspace}", oe = "/{workspace}", Y = {
18
+ useI18n: vt
19
+ }, X = "/v2/control-planes/{controlPlaneId}/core-entities/{workspace}", oe = "/{workspace}", L = {
20
20
  list: {
21
21
  konnect: {
22
- all: `${te}/consumers`,
23
- forConsumerGroup: `${te}/consumer_groups/{consumerGroupId}/consumers`,
24
- oneForConsumerGroup: `${te}/consumer_groups/{consumerGroupId}/consumers/{consumerId}`
22
+ all: `${X}/consumers`,
23
+ forConsumerGroup: `${X}/consumer_groups/{consumerGroupId}/consumers`,
24
+ oneForConsumerGroup: `${X}/consumer_groups/{consumerGroupId}/consumers/{consumerId}`,
25
+ search: `${X}/consumers/search`
25
26
  },
26
27
  kongManager: {
27
28
  all: `${oe}/consumers`,
@@ -31,21 +32,21 @@ const ie = {
31
32
  },
32
33
  form: {
33
34
  konnect: {
34
- create: `${te}/consumers`,
35
- edit: `${te}/consumers/{id}`
35
+ create: `${X}/consumers`,
36
+ edit: `${X}/consumers/{id}`
36
37
  },
37
38
  kongManager: {
38
39
  create: `${oe}/consumers`,
39
40
  edit: `${oe}/consumers/{id}`
40
41
  }
41
42
  }
42
- }, gt = { class: "add-consumer-form-container" }, vt = { class: "add-consumer-form-cta" }, yt = { class: "select-item-label" }, ht = {
43
+ }, yt = { class: "add-consumer-form-container" }, ht = { class: "add-consumer-form-cta" }, bt = { class: "select-item-label" }, _t = {
43
44
  key: 0,
44
45
  class: "select-item-desc"
45
- }, bt = {
46
+ }, Ct = {
46
47
  key: 0,
47
48
  class: "kong-ui-entity-add-consumers-error"
48
- }, _t = { key: 0 }, Ct = /* @__PURE__ */ ae({
49
+ }, kt = { key: 0 }, It = /* @__PURE__ */ ae({
49
50
  __name: "AddConsumerModal",
50
51
  props: {
51
52
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -61,129 +62,129 @@ const ie = {
61
62
  },
62
63
  emits: ["cancel", "add:success", "add:partial-success", "error"],
63
64
  setup(e, { emit: c }) {
64
- const { i18n: { t: r } } = ie.useI18n(), o = e, $ = c, { axiosInstance: n } = ve(o.config?.axiosRequestConfig), b = g([]), {
65
- debouncedQueryChange: C,
66
- loading: M,
67
- allRecords: B,
68
- error: d,
69
- loadItems: X,
65
+ const { i18n: { t: r } } = ie.useI18n(), t = e, S = c, { axiosInstance: n } = ye(t.config?.axiosRequestConfig), C = y([]), {
66
+ debouncedQueryChange: $,
67
+ loading: x,
68
+ allRecords: T,
69
+ error: u,
70
+ loadItems: Y,
70
71
  results: H
71
- } = Xe(
72
- o.config,
73
- Y.list[o.config.app].all,
72
+ } = et(
73
+ t.config,
74
+ L.list[t.config.app].all,
74
75
  "",
75
76
  {
76
77
  fetchedItemsKey: "data",
77
78
  searchKeys: ["username", "id"]
78
79
  }
79
- ), q = (l) => l, x = h(() => d.value ? r("consumers.errors.general") : ""), Z = g(0), J = h(() => B.value === void 0), Q = h(() => H.value.map((l) => ({
80
- label: l.username || l.customId,
81
- value: l.id,
82
- selected: b.value.includes(l.id),
83
- data: l
80
+ ), K = (d) => d, J = h(() => u.value ? r("consumers.errors.general") : ""), Z = y(0), G = h(() => T.value === void 0), Q = h(() => H.value.map((d) => ({
81
+ label: d.username || d.customId,
82
+ value: d.id,
83
+ selected: C.value.includes(d.id),
84
+ data: d
84
85
  // we need this to determine whether or not to show the description text
85
- }))), N = (l) => {
86
- const k = J.value ? H.value.find((I) => I.id === l) : B.value?.find((I) => I.id === l);
87
- return k ? k.username || k.custom_id : l;
88
- }, E = () => {
89
- D.value = "", R.value = [], G.value = [], $("cancel");
90
- }, R = g([]), A = g(!1), D = g(""), u = async () => {
91
- if (!b.value.length) {
92
- D.value = "", G.value = [], $("cancel");
86
+ }))), U = (d) => {
87
+ const w = G.value ? H.value.find((_) => _.id === d) : T.value?.find((_) => _.id === d);
88
+ return w ? w.username || w.custom_id : d;
89
+ }, ee = () => {
90
+ A.value = "", F.value = [], I.value = [], S("cancel");
91
+ }, F = y([]), g = y(!1), A = y(""), l = async () => {
92
+ if (!C.value.length) {
93
+ A.value = "", I.value = [], S("cancel");
93
94
  return;
94
95
  }
95
- A.value = !0, D.value = "", R.value = [], G.value = [];
96
+ g.value = !0, A.value = "", F.value = [], I.value = [];
96
97
  try {
97
- const l = b.value.map((F) => W(F)), k = await Promise.allSettled(l);
98
- let I = !0;
99
- k.forEach((F) => {
100
- F.status !== "fulfilled" && (I = !1);
101
- }), I ? (R.value = [], G.value = [], $("add:success", b.value), b.value = []) : (R.value.length && $("add:partial-success", R.value), b.value = [], S(k));
98
+ const d = C.value.map((D) => W(D)), w = await Promise.allSettled(d);
99
+ let _ = !0;
100
+ w.forEach((D) => {
101
+ D.status !== "fulfilled" && (_ = !1);
102
+ }), _ ? (F.value = [], I.value = [], S("add:success", C.value), C.value = []) : (F.value.length && S("add:partial-success", F.value), C.value = [], M(w));
102
103
  } catch {
103
- D.value = r("consumers.errors.add"), $("error", D.value);
104
+ A.value = r("consumers.errors.add"), S("error", A.value);
104
105
  } finally {
105
- A.value = !1;
106
+ g.value = !1;
106
107
  }
107
- }, p = h(() => {
108
- let l = `${o.config.apiBaseUrl}${Y.list[o.config.app].forConsumerGroup}`;
109
- return o.config.app === "konnect" && (l = l.replace(/{controlPlaneId}/gi, o.config?.controlPlaneId || "")), l.replace(/\/{workspace}/gi, o.config?.workspace ? `/${o.config.workspace}` : "").replace(/{consumerGroupId}/gi, o.config?.consumerGroupId || "");
110
- }), W = async (l) => {
111
- const k = {
112
- consumer: l
108
+ }, v = h(() => {
109
+ let d = `${t.config.apiBaseUrl}${L.list[t.config.app].forConsumerGroup}`;
110
+ return t.config.app === "konnect" && (d = d.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), d.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
111
+ }), W = async (d) => {
112
+ const w = {
113
+ consumer: d
113
114
  };
114
115
  try {
115
- const I = await n.post(p.value, k);
116
- return R.value.push(l), I;
117
- } catch (I) {
118
- let F = `${N(l)} - ${I.message}`;
119
- return I.response.status === 409 && (F = `${N(l)} - ${r("consumers.errors.already_added")}`), Promise.reject(Error(F));
116
+ const _ = await n.post(v.value, w);
117
+ return F.value.push(d), _;
118
+ } catch (_) {
119
+ let D = `${U(d)} - ${_.message}`;
120
+ return _.response.status === 409 && (D = `${U(d)} - ${r("consumers.errors.already_added")}`), Promise.reject(Error(D));
120
121
  }
121
- }, G = g([]), S = (l) => {
122
- G.value = l.map((k) => k.reason?.message).filter(Boolean);
122
+ }, I = y([]), M = (d) => {
123
+ I.value = d.map((w) => w.reason?.message).filter(Boolean);
123
124
  };
124
- return ge(Q, () => {
125
+ return ve(Q, () => {
125
126
  Z.value++;
126
- }, { immediate: !0, deep: !0 }), ge(() => o.visible, () => {
127
- o.visible && X();
128
- }, { immediate: !0 }), (l, k) => {
129
- const I = V("KMultiselect"), F = V("KAlert"), le = V("KPrompt");
130
- return w(), z(le, {
131
- "action-button-disabled": A.value,
127
+ }, { immediate: !0, deep: !0 }), ve(() => t.visible, () => {
128
+ t.visible && Y();
129
+ }, { immediate: !0 }), (d, w) => {
130
+ const _ = P("KMultiselect"), D = P("KAlert"), le = P("KPrompt");
131
+ return E(), z(le, {
132
+ "action-button-disabled": g.value,
132
133
  class: "kong-ui-entities-add-consumers-modal",
133
134
  "data-testid": "add-consumer-modal",
134
- title: t(r)("consumers.consumer_groups.add.title"),
135
+ title: o(r)("consumers.consumer_groups.add.title"),
135
136
  visible: e.visible,
136
- onCancel: E,
137
- onProceed: u
137
+ onCancel: ee,
138
+ onProceed: l
138
139
  }, {
139
140
  default: a(() => [
140
- v("div", gt, [
141
- v("p", vt, f(t(r)("consumers.consumer_groups.add.ctaText")), 1),
142
- i(I, {
143
- modelValue: b.value,
144
- "onUpdate:modelValue": k[0] || (k[0] = (P) => b.value = P),
141
+ b("div", yt, [
142
+ b("p", ht, p(o(r)("consumers.consumer_groups.add.ctaText")), 1),
143
+ i(_, {
144
+ modelValue: C.value,
145
+ "onUpdate:modelValue": w[0] || (w[0] = (R) => C.value = R),
145
146
  autosuggest: "",
146
147
  "data-testid": "add-consumers-multiselect",
147
- "dropdown-footer-text": J.value ? t(r)("consumers.consumer_groups.add.footer") : void 0,
148
+ "dropdown-footer-text": G.value ? o(r)("consumers.consumer_groups.add.footer") : void 0,
148
149
  items: Q.value,
149
- label: t(r)("consumers.consumer_groups.add.consumers_label"),
150
- loading: t(M),
151
- placeholder: t(r)("consumers.consumer_groups.add.consumer_placeholder"),
152
- readonly: A.value,
150
+ label: o(r)("consumers.consumer_groups.add.consumers_label"),
151
+ loading: o(x),
152
+ placeholder: o(r)("consumers.consumer_groups.add.consumer_placeholder"),
153
+ readonly: g.value,
153
154
  required: "",
154
155
  width: "100%",
155
- onQueryChange: t(C)
156
+ onQueryChange: o($)
156
157
  }, {
157
- "item-template": a(({ item: P }) => [
158
- v("div", yt, f(P.label), 1),
159
- q(P).data.username && q(P).data.custom_id ? (w(), j("div", ht, f(q(P).data.custom_id), 1)) : L("", !0)
158
+ "item-template": a(({ item: R }) => [
159
+ b("div", bt, p(R.label), 1),
160
+ K(R).data.username && K(R).data.custom_id ? (E(), O("div", _t, p(K(R).data.custom_id), 1)) : j("", !0)
160
161
  ]),
161
162
  _: 1
162
163
  }, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
163
- D.value || x.value || G.value.length ? (w(), j("div", bt, [
164
- i(F, { appearance: "danger" }, {
164
+ A.value || J.value || I.value.length ? (E(), O("div", Ct, [
165
+ i(D, { appearance: "danger" }, {
165
166
  default: a(() => [
166
- v("p", null, f(t(r)("consumers.errors.add")), 1),
167
- G.value.length ? (w(), j("ul", _t, [
168
- (w(!0), j(Le, null, He(G.value, (P, T) => (w(), j("li", { key: T }, f(P), 1))), 128))
169
- ])) : L("", !0),
170
- v("div", null, f(D.value || x.value), 1)
167
+ b("p", null, p(o(r)("consumers.errors.add")), 1),
168
+ I.value.length ? (E(), O("ul", kt, [
169
+ (E(!0), O(Je, null, Qe(I.value, (R, ce) => (E(), O("li", { key: ce }, p(R), 1))), 128))
170
+ ])) : j("", !0),
171
+ b("div", null, p(A.value || J.value), 1)
171
172
  ]),
172
173
  _: 1
173
174
  })
174
- ])) : L("", !0)
175
+ ])) : j("", !0)
175
176
  ])
176
177
  ]),
177
178
  _: 1
178
179
  }, 8, ["action-button-disabled", "title", "visible"]);
179
180
  };
180
181
  }
181
- }), ye = (e, c) => {
182
+ }), he = (e, c) => {
182
183
  const r = e.__vccOpts || e;
183
- for (const [o, $] of c)
184
- r[o] = $;
184
+ for (const [t, S] of c)
185
+ r[t] = S;
185
186
  return r;
186
- }, kt = /* @__PURE__ */ ye(Ct, [["__scopeId", "data-v-ee085540"]]), It = { class: "kong-ui-entities-consumers-list" }, wt = { class: "button-row" }, $t = { class: "empty-state-wrapper" }, Et = /* @__PURE__ */ ae({
187
+ }, wt = /* @__PURE__ */ he(It, [["__scopeId", "data-v-ee085540"]]), $t = { class: "kong-ui-entities-consumers-list" }, Et = { class: "button-row" }, St = { class: "empty-state-wrapper" }, Gt = /* @__PURE__ */ ae({
187
188
  __name: "ConsumerList",
188
189
  props: {
189
190
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -229,44 +230,46 @@ const ie = {
229
230
  },
230
231
  emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
231
232
  setup(e, { emit: c }) {
232
- const r = c, o = e, { i18nT: $, i18n: { t: n } } = ie.useI18n(), b = Ae(), { axiosInstance: C } = ve(o.config?.axiosRequestConfig), M = h(() => o.config.app !== "kongManager" || !!o.config.disableSorting), B = {
233
+ const r = c, t = e, { i18nT: S, i18n: { t: n } } = ie.useI18n(), C = Fe(), { axiosInstance: $ } = ye(t.config?.axiosRequestConfig), x = h(() => t.config.app !== "kongManager" || !!t.config.disableSorting), T = {
233
234
  // the Username column is non-hidable
234
235
  username: { label: n("consumers.list.table_headers.username"), searchable: !0, sortable: !0, hidable: !1 },
235
236
  custom_id: { label: n("consumers.list.table_headers.custom_id"), searchable: !0, sortable: !0 },
236
237
  tags: { label: n("consumers.list.table_headers.tags"), sortable: !1 }
237
- }, d = B, X = (s) => ({
238
+ }, u = T, Y = (s) => ({
238
239
  "data-testid": s.username ?? s.custom_id ?? s.id
239
240
  }), H = () => {
240
- o.config.consumerGroupId ? be() : b.push(o.config.createRoute);
241
- }, q = h(() => {
242
- let s = `${o.config.apiBaseUrl}${Y.list[o.config.app][E.value ? "forConsumerGroup" : "all"]}`;
243
- return o.config.app === "konnect" && (s = s.replace(/{controlPlaneId}/gi, o.config?.controlPlaneId || "")), s.replace(/\/{workspace}/gi, o.config?.workspace ? `/${o.config.workspace}` : "").replace(/{consumerGroupId}/gi, o.config?.consumerGroupId || "");
244
- }), x = g(""), Z = h(() => {
245
- const s = o.config.app === "konnect" || o.config.isExactMatch;
241
+ t.config.consumerGroupId ? _e() : C.push(t.config.createRoute);
242
+ }, K = (s) => {
243
+ let f = `${t.config.apiBaseUrl}${s}`;
244
+ return t.config.app === "konnect" && (f = f.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), f.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
245
+ }, J = h(() => K(
246
+ L.list[t.config.app][g.value ? "forConsumerGroup" : "all"]
247
+ )), Z = h(() => t.config.app === "konnect" && t.config.workspace && G.value ? K(L.list.konnect.search) : J.value), G = y(""), Q = h(() => {
248
+ const s = t.config.app === "konnect" || t.config.isExactMatch;
246
249
  return s ? {
247
250
  isExactMatch: s,
248
- placeholder: n(`consumers.search.placeholder.${o.config.app}`)
251
+ placeholder: n(`consumers.search.placeholder.${t.config.app}`)
249
252
  } : {
250
253
  isExactMatch: s,
251
254
  fields: {
252
- username: B.username,
253
- custom_id: B.custom_id
255
+ username: T.username,
256
+ custom_id: T.custom_id
254
257
  },
255
- schema: o.config.filterSchema
258
+ schema: t.config.filterSchema
256
259
  };
257
- }), { hasRecords: J, handleStateChange: Q } = Ze(x), N = h(() => J.value && o.config.app === "konnect"), E = h(() => !!o.config.consumerGroupId), R = h(
258
- () => E.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
259
- ), A = h(() => E.value && !o.config.paginatedEndpoint ? "consumers" : void 0), {
260
- fetcher: D,
261
- fetcherState: u,
262
- fetcherCacheKey: p
263
- } = et(h(() => ({ ...o.config, cacheIdentifier: o.cacheIdentifier })), q, A), W = () => {
264
- x.value = "";
265
- }, G = () => {
266
- p.value++;
267
- }, S = (s) => s ?? "-", l = g(null), k = async (s, y) => {
268
- const U = s.id;
269
- if (!await y(U)) {
260
+ }), { hasRecords: U, handleStateChange: ee } = tt(G), F = h(() => U.value && t.config.app === "konnect"), g = h(() => !!t.config.consumerGroupId), A = h(
261
+ () => g.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
262
+ ), l = h(() => g.value && !t.config.paginatedEndpoint ? "consumers" : void 0), {
263
+ fetcher: v,
264
+ fetcherState: W,
265
+ fetcherCacheKey: I
266
+ } = ot(h(() => ({ ...t.config, cacheIdentifier: t.cacheIdentifier })), Z, l), M = () => {
267
+ G.value = "";
268
+ }, d = () => {
269
+ I.value++;
270
+ }, w = (s) => s ?? "-", _ = y(null), D = async (s, f) => {
271
+ const B = s.id;
272
+ if (!await f(B)) {
270
273
  r("copy:error", {
271
274
  entity: s,
272
275
  field: "id",
@@ -277,11 +280,11 @@ const ie = {
277
280
  r("copy:success", {
278
281
  entity: s,
279
282
  field: "id",
280
- message: n("consumers.copy.success", { val: U })
283
+ message: n("consumers.copy.success", { val: B })
281
284
  });
282
- }, I = (s, y) => {
283
- const U = JSON.stringify(s);
284
- if (!y(U)) {
285
+ }, le = (s, f) => {
286
+ const B = JSON.stringify(s);
287
+ if (!f(B)) {
285
288
  r("copy:error", {
286
289
  entity: s,
287
290
  message: n("consumers.errors.copy")
@@ -292,138 +295,138 @@ const ie = {
292
295
  entity: s,
293
296
  message: n("consumers.copy.success_brief")
294
297
  });
295
- }, F = async (s) => {
296
- await o.canRetrieve?.(s) && b.push(o.config.getViewRoute(s.id));
297
- }, le = (s) => ({
298
+ }, R = async (s) => {
299
+ await t.canRetrieve?.(s) && C.push(t.config.getViewRoute(s.id));
300
+ }, ce = (s) => ({
298
301
  label: n("consumers.actions.view"),
299
- to: o.config.getViewRoute(s)
300
- }), P = (s) => ({
302
+ to: t.config.getViewRoute(s)
303
+ }), Re = (s) => ({
301
304
  label: n("consumers.actions.edit"),
302
- to: o.config.getEditRoute(s)
303
- }), T = g(void 0), se = g(!1), ne = g(!1), he = g(""), Re = tt(o.config, q.value), Fe = (s) => {
304
- T.value = s, se.value = !0;
305
- }, Pe = () => {
305
+ to: t.config.getEditRoute(s)
306
+ }), q = y(void 0), se = y(!1), ne = y(!1), be = y(""), Pe = st(t.config, J.value), Te = (s) => {
307
+ q.value = s, se.value = !0;
308
+ }, Ve = () => {
306
309
  se.value = !1;
307
- }, Te = async () => {
308
- if (T.value?.id) {
310
+ }, Be = async () => {
311
+ if (q.value?.id) {
309
312
  ne.value = !0;
310
313
  try {
311
- await C.delete(Re(T.value.id)), ne.value = !1, se.value = !1, p.value++, r("delete:success", T.value);
314
+ await $.delete(Pe(q.value.id)), ne.value = !1, se.value = !1, I.value++, r("delete:success", q.value);
312
315
  } catch (s) {
313
- he.value = s.response?.data?.message || s.message || n("consumers.errors.delete"), r("error", s);
316
+ be.value = s.response?.data?.message || s.message || n("consumers.errors.delete"), r("error", s);
314
317
  } finally {
315
318
  ne.value = !1;
316
319
  }
317
320
  }
318
- }, ue = g(!1), be = () => {
321
+ }, ue = y(!1), _e = () => {
319
322
  ue.value = !0;
320
- }, _e = () => {
323
+ }, Ce = () => {
321
324
  ue.value = !1;
322
- }, Ce = (s, y) => {
323
- y || _e(), p.value++, r("add:success", s);
324
- }, Ve = () => {
325
- E.value && be();
326
- }, K = g(void 0), ce = g(!1), Be = g(""), Ke = (s) => {
327
- K.value = s, ce.value = !0;
328
- }, ke = () => {
329
- ce.value = !1, K.value = void 0;
330
- }, Ue = h(() => {
331
- let s = `${o.config.apiBaseUrl}${Y.list[o.config.app].oneForConsumerGroup}`;
332
- return o.config.app === "konnect" && (s = s.replace(/{controlPlaneId}/gi, o.config?.controlPlaneId || "")), s.replace(/\/{workspace}/gi, o.config?.workspace ? `/${o.config.workspace}` : "").replace(/{consumerGroupId}/gi, o.config?.consumerGroupId || "");
333
- }), Ie = g(!1), qe = async () => {
334
- if (K.value) {
335
- Ie.value = !0;
325
+ }, ke = (s, f) => {
326
+ f || Ce(), I.value++, r("add:success", s);
327
+ }, Ke = () => {
328
+ g.value && _e();
329
+ }, V = y(void 0), de = y(!1), Ue = y(""), qe = (s) => {
330
+ V.value = s, de.value = !0;
331
+ }, Ie = () => {
332
+ de.value = !1, V.value = void 0;
333
+ }, Ne = h(() => {
334
+ let s = `${t.config.apiBaseUrl}${L.list[t.config.app].oneForConsumerGroup}`;
335
+ return t.config.app === "konnect" && (s = s.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), s.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
336
+ }), we = y(!1), Oe = async () => {
337
+ if (V.value) {
338
+ we.value = !0;
336
339
  try {
337
- const s = Ue.value.replace(/{consumerId}/gi, K.value.id);
338
- await C.delete(s), r("remove:success", K.value), ke(), p.value++;
340
+ const s = Ne.value.replace(/{consumerId}/gi, V.value.id);
341
+ await $.delete(s), r("remove:success", V.value), Ie(), I.value++;
339
342
  } catch (s) {
340
- Be.value = s.message || n("consumers.errors.delete"), r("error", s);
343
+ Ue.value = s.message || n("consumers.errors.delete"), r("error", s);
341
344
  } finally {
342
- Ie.value = !1;
345
+ we.value = !1;
343
346
  }
344
347
  }
345
348
  };
346
- ge(u, (s) => {
347
- if (s.status === ot.Error) {
348
- l.value = {
349
+ ve(W, (s) => {
350
+ if (s.status === nt.Error) {
351
+ _.value = {
349
352
  title: n("consumers.errors.general")
350
- }, s.error?.response?.data?.message && (l.value.message = s.error.response.data.message), r("error", s.error);
353
+ }, s.error?.response?.data?.message && (_.value.message = s.error.response.data.message), r("error", s.error);
351
354
  return;
352
355
  }
353
- l.value = null;
356
+ _.value = null;
354
357
  });
355
- const de = g({
356
- ctaPath: E.value ? void 0 : o.config.createRoute,
358
+ const me = y({
359
+ ctaPath: g.value ? void 0 : t.config.createRoute,
357
360
  ctaText: void 0,
358
- message: `${n("consumers.list.empty_state.description")}${o.config.additionMessageForEmptyState ? ` ${o.config.additionMessageForEmptyState}` : ""}`,
361
+ message: `${n("consumers.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
359
362
  title: n("consumers.title")
360
- }), me = g(!1);
361
- return Je(async () => {
362
- me.value = await o.canCreate(), me.value && (de.value.title = E.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), de.value.ctaText = E.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
363
- }), (s, y) => {
364
- const U = V("KButton"), Ne = V("KEmptyState"), ee = V("KDropdownItem"), we = V("KClipboardProvider"), Oe = V("KPrompt");
365
- return w(), j("div", It, [
366
- i(t(st), {
363
+ }), pe = y(!1);
364
+ return We(async () => {
365
+ pe.value = await t.canCreate(), pe.value && (me.value.title = g.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), me.value.ctaText = g.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
366
+ }), (s, f) => {
367
+ const B = P("KButton"), je = P("KEmptyState"), te = P("KDropdownItem"), $e = P("KClipboardProvider"), Le = P("KPrompt");
368
+ return E(), O("div", $t, [
369
+ i(o(rt), {
367
370
  "cache-identifier": e.cacheIdentifier,
368
- "disable-sorting": M.value,
369
- "empty-state-options": de.value,
371
+ "disable-sorting": x.value,
372
+ "empty-state-options": me.value,
370
373
  "enable-entity-actions": "",
371
- "error-message": l.value,
372
- fetcher: t(D),
373
- "fetcher-cache-key": t(p),
374
- "hide-pagination": E.value && !e.config.paginatedEndpoint,
374
+ "error-message": _.value,
375
+ fetcher: o(v),
376
+ "fetcher-cache-key": o(I),
377
+ "hide-pagination": g.value && !e.config.paginatedEndpoint,
375
378
  "pagination-type": "offset",
376
- "preferences-storage-key": R.value,
377
- query: x.value,
378
- "row-attributes": X,
379
- "table-headers": t(d),
380
- onClearSearchInput: W,
381
- "onClick:row": y[3] || (y[3] = (m) => F(m)),
382
- onEmptyStateCtaClicked: Ve,
383
- onSort: G,
384
- onState: t(Q)
385
- }, fe({
379
+ "preferences-storage-key": A.value,
380
+ query: G.value,
381
+ "row-attributes": Y,
382
+ "table-headers": o(u),
383
+ onClearSearchInput: M,
384
+ "onClick:row": f[3] || (f[3] = (m) => R(m)),
385
+ onEmptyStateCtaClicked: Ke,
386
+ onSort: d,
387
+ onState: o(ee)
388
+ }, ge({
386
389
  "toolbar-filter": a(() => [
387
- $e(s.$slots, "toolbar-filter", {}, void 0, !0),
388
- E.value ? L("", !0) : (w(), z(t(rt), {
390
+ Ee(s.$slots, "toolbar-filter", {}, void 0, !0),
391
+ g.value ? j("", !0) : (E(), z(o(it), {
389
392
  key: 0,
390
- modelValue: x.value,
391
- "onUpdate:modelValue": y[0] || (y[0] = (m) => x.value = m),
392
- config: Z.value
393
+ modelValue: G.value,
394
+ "onUpdate:modelValue": f[0] || (f[0] = (m) => G.value = m),
395
+ config: Q.value
393
396
  }, null, 8, ["modelValue", "config"]))
394
397
  ]),
395
398
  "toolbar-button": a(() => [
396
- (w(), z(Qe, {
399
+ (E(), z(ze, {
397
400
  disabled: !e.useActionOutside,
398
401
  to: "#kong-ui-app-page-header-action-button"
399
402
  }, [
400
- v("div", wt, [
401
- !E.value && N.value ? (w(), z(U, {
403
+ b("div", Et, [
404
+ !g.value && F.value ? (E(), z(B, {
402
405
  key: 0,
403
406
  appearance: "secondary",
404
407
  class: "open-learning-hub",
405
408
  "data-testid": "consumers-learn-more-button",
406
409
  icon: "",
407
- onClick: y[1] || (y[1] = (m) => s.$emit("click:learn-more"))
410
+ onClick: f[1] || (f[1] = (m) => s.$emit("click:learn-more"))
408
411
  }, {
409
412
  default: a(() => [
410
- i(t(Se), { decorative: "" })
413
+ i(o(Ge), { decorative: "" })
411
414
  ]),
412
415
  _: 1
413
- })) : L("", !0),
414
- i(t(re), {
416
+ })) : j("", !0),
417
+ i(o(re), {
415
418
  "auth-function": () => e.canCreate()
416
419
  }, {
417
420
  default: a(() => [
418
- i(U, {
421
+ i(B, {
419
422
  appearance: "primary",
420
423
  "data-testid": "toolbar-add-consumer",
421
424
  size: e.useActionOutside ? "medium" : "large",
422
425
  onClick: H
423
426
  }, {
424
427
  default: a(() => [
425
- i(t(Ge)),
426
- O(" " + f(e.config.consumerGroupId ? t(n)("consumers.actions.add_consumer") : t(n)("consumers.list.toolbar_actions.new_consumer")), 1)
428
+ i(o(Me)),
429
+ N(" " + p(e.config.consumerGroupId ? o(n)("consumers.actions.add_consumer") : o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
427
430
  ]),
428
431
  _: 1
429
432
  }, 8, ["size"])
@@ -434,78 +437,78 @@ const ie = {
434
437
  ], 8, ["disabled"]))
435
438
  ]),
436
439
  username: a(({ rowValue: m }) => [
437
- v("b", null, f(S(m)), 1)
440
+ b("b", null, p(w(m)), 1)
438
441
  ]),
439
442
  custom_id: a(({ rowValue: m }) => [
440
- O(f(S(m)), 1)
443
+ N(p(w(m)), 1)
441
444
  ]),
442
445
  tags: a(({ rowValue: m }) => [
443
- i(t(nt), { tags: m }, null, 8, ["tags"])
446
+ i(o(at), { tags: m }, null, 8, ["tags"])
444
447
  ]),
445
448
  actions: a(({ row: m }) => [
446
- i(we, null, {
447
- default: a(({ copyToClipboard: pe }) => [
448
- i(ee, {
449
+ i($e, null, {
450
+ default: a(({ copyToClipboard: fe }) => [
451
+ i(te, {
449
452
  "data-testid": "action-entity-copy-id",
450
- onClick: (je) => k(m, pe)
453
+ onClick: (He) => D(m, fe)
451
454
  }, {
452
455
  default: a(() => [
453
- O(f(t(n)("consumers.actions.copy_id")), 1)
456
+ N(p(o(n)("consumers.actions.copy_id")), 1)
454
457
  ]),
455
458
  _: 1
456
459
  }, 8, ["onClick"])
457
460
  ]),
458
461
  _: 2
459
462
  }, 1024),
460
- i(we, null, {
461
- default: a(({ copyToClipboard: pe }) => [
462
- i(ee, {
463
+ i($e, null, {
464
+ default: a(({ copyToClipboard: fe }) => [
465
+ i(te, {
463
466
  "data-testid": "action-entity-copy-json",
464
- onClick: (je) => I(m, pe)
467
+ onClick: (He) => le(m, fe)
465
468
  }, {
466
469
  default: a(() => [
467
- O(f(t(n)("consumers.actions.copy_json")), 1)
470
+ N(p(o(n)("consumers.actions.copy_json")), 1)
468
471
  ]),
469
472
  _: 1
470
473
  }, 8, ["onClick"])
471
474
  ]),
472
475
  _: 2
473
476
  }, 1024),
474
- i(t(re), {
477
+ i(o(re), {
475
478
  "auth-function": () => e.canRetrieve(m)
476
479
  }, {
477
480
  default: a(() => [
478
- i(ee, {
481
+ i(te, {
479
482
  "data-testid": "action-entity-view",
480
483
  "has-divider": "",
481
- item: le(m.id)
484
+ item: ce(m.id)
482
485
  }, null, 8, ["item"])
483
486
  ]),
484
487
  _: 2
485
488
  }, 1032, ["auth-function"]),
486
- i(t(re), {
489
+ i(o(re), {
487
490
  "auth-function": () => e.canEdit(m)
488
491
  }, {
489
492
  default: a(() => [
490
- i(ee, {
493
+ i(te, {
491
494
  "data-testid": "action-entity-edit",
492
- item: P(m.id)
495
+ item: Re(m.id)
493
496
  }, null, 8, ["item"])
494
497
  ]),
495
498
  _: 2
496
499
  }, 1032, ["auth-function"]),
497
- i(t(re), {
500
+ i(o(re), {
498
501
  "auth-function": () => e.canDelete(m)
499
502
  }, {
500
503
  default: a(() => [
501
- i(ee, {
504
+ i(te, {
502
505
  danger: "",
503
506
  "data-testid": "action-entity-delete",
504
507
  "has-divider": "",
505
- onClick: () => e.config.consumerGroupId ? Ke(m) : Fe(m)
508
+ onClick: () => e.config.consumerGroupId ? qe(m) : Te(m)
506
509
  }, {
507
510
  default: a(() => [
508
- O(f(e.config.consumerGroupId ? t(n)("consumers.actions.remove") : t(n)("consumers.actions.delete")), 1)
511
+ N(p(e.config.consumerGroupId ? o(n)("consumers.actions.remove") : o(n)("consumers.actions.delete")), 1)
509
512
  ]),
510
513
  _: 1
511
514
  }, 8, ["onClick"])
@@ -515,40 +518,40 @@ const ie = {
515
518
  ]),
516
519
  _: 2
517
520
  }, [
518
- !x.value && e.config.app === "konnect" ? {
521
+ !G.value && e.config.app === "konnect" ? {
519
522
  name: "empty-state",
520
523
  fn: a(() => [
521
- v("div", $t, [
522
- $e(s.$slots, "empty-state-toolbar", {}, void 0, !0),
523
- i(Ne, {
524
+ b("div", St, [
525
+ Ee(s.$slots, "empty-state-toolbar", {}, void 0, !0),
526
+ i(je, {
524
527
  "data-testid": e.config.consumerGroupId ? "nested-consumers-entity-empty-state" : "consumers-entity-empty-state",
525
528
  "icon-background": "",
526
- message: t(n)("consumers.list.empty_state_v2.description"),
527
- title: t(n)("consumers.list.empty_state_v2.title")
528
- }, fe({
529
+ message: o(n)("consumers.list.empty_state_v2.description"),
530
+ title: o(n)("consumers.list.empty_state_v2.title")
531
+ }, ge({
529
532
  icon: a(() => [
530
- i(t(We), { decorative: "" })
533
+ i(o(Ye), { decorative: "" })
531
534
  ]),
532
535
  action: a(() => [
533
- me.value ? (w(), z(U, {
536
+ pe.value ? (E(), z(B, {
534
537
  key: 0,
535
538
  "data-testid": "entity-create-button",
536
539
  onClick: H
537
540
  }, {
538
541
  default: a(() => [
539
- i(t(Ge), { decorative: "" }),
540
- O(" " + f(t(n)("consumers.list.toolbar_actions.new_consumer")), 1)
542
+ i(o(Me), { decorative: "" }),
543
+ N(" " + p(o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
541
544
  ]),
542
545
  _: 1
543
- })) : L("", !0),
544
- i(U, {
546
+ })) : j("", !0),
547
+ i(B, {
545
548
  appearance: "secondary",
546
549
  "data-testid": "entity-learn-more-button",
547
- onClick: y[2] || (y[2] = (m) => s.$emit("click:learn-more"))
550
+ onClick: f[2] || (f[2] = (m) => s.$emit("click:learn-more"))
548
551
  }, {
549
552
  default: a(() => [
550
- i(t(Se), { decorative: "" }),
551
- O(" " + f(t(n)("consumers.list.empty_state_v2.learn_more")), 1)
553
+ i(o(Ge), { decorative: "" }),
554
+ N(" " + p(o(n)("consumers.list.empty_state_v2.learn_more")), 1)
552
555
  ]),
553
556
  _: 1
554
557
  })
@@ -558,7 +561,7 @@ const ie = {
558
561
  e.config?.isControlPlaneGroup ? {
559
562
  name: "default",
560
563
  fn: a(() => [
561
- O(f(t(n)("consumers.list.empty_state_v2.group")), 1)
564
+ N(p(o(n)("consumers.list.empty_state_v2.group")), 1)
562
565
  ]),
563
566
  key: "0"
564
567
  } : void 0
@@ -568,83 +571,83 @@ const ie = {
568
571
  key: "0"
569
572
  } : void 0
570
573
  ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-pagination", "preferences-storage-key", "query", "table-headers", "onState"]),
571
- i(t(at), {
574
+ i(o(lt), {
572
575
  "action-button-disabled": ne.value,
573
576
  "data-testid": "delete-consumer-modal",
574
- description: t(n)("consumers.delete.description"),
575
- "entity-name": T.value && (T.value.username || T.value.custom_id || T.value.id),
576
- "entity-type": t(it).Consumer,
577
- error: he.value,
578
- title: t(n)("consumers.delete.title"),
577
+ description: o(n)("consumers.delete.description"),
578
+ "entity-name": q.value && (q.value.username || q.value.custom_id || q.value.id),
579
+ "entity-type": o(ct).Consumer,
580
+ error: be.value,
581
+ title: o(n)("consumers.delete.title"),
579
582
  visible: se.value,
580
- onCancel: Pe,
581
- onProceed: Te
583
+ onCancel: Ve,
584
+ onProceed: Be
582
585
  }, null, 8, ["action-button-disabled", "description", "entity-name", "entity-type", "error", "title", "visible"]),
583
- e.config.consumerGroupId ? (w(), z(kt, {
586
+ e.config.consumerGroupId ? (E(), z(wt, {
584
587
  key: 0,
585
588
  config: e.config,
586
589
  "data-testid": "add-consumer-modal",
587
590
  visible: ue.value,
588
- "onAdd:partialSuccess": y[4] || (y[4] = (m) => Ce(m, !0)),
589
- "onAdd:success": y[5] || (y[5] = (m) => Ce(m)),
590
- onCancel: _e
591
- }, null, 8, ["config", "visible"])) : L("", !0),
592
- e.config.consumerGroupId && K.value ? (w(), z(Oe, {
591
+ "onAdd:partialSuccess": f[4] || (f[4] = (m) => ke(m, !0)),
592
+ "onAdd:success": f[5] || (f[5] = (m) => ke(m)),
593
+ onCancel: Ce
594
+ }, null, 8, ["config", "visible"])) : j("", !0),
595
+ e.config.consumerGroupId && V.value ? (E(), z(Le, {
593
596
  key: 1,
594
597
  "action-button-appearance": "danger",
595
598
  "data-testid": "remove-consumer-modal",
596
- title: t(n)("consumers.consumer_groups.remove.title"),
597
- visible: ce.value,
598
- onCancel: ke,
599
- onProceed: qe
599
+ title: o(n)("consumers.consumer_groups.remove.title"),
600
+ visible: de.value,
601
+ onCancel: Ie,
602
+ onProceed: Oe
600
603
  }, {
601
604
  default: a(() => [
602
- i(t($), {
605
+ i(o(S), {
603
606
  class: "message",
604
607
  keypath: e.config.consumerGroupName ? "consumers.consumer_groups.remove.confirmation" : "consumers.consumer_groups.remove.confirmationNoCG",
605
608
  tag: "p"
606
- }, fe({
609
+ }, ge({
607
610
  consumer: a(() => [
608
- v("strong", null, f(K.value.username || K.value.custom_id || K.value.id), 1)
611
+ b("strong", null, p(V.value.username || V.value.custom_id || V.value.id), 1)
609
612
  ]),
610
613
  _: 2
611
614
  }, [
612
615
  e.config.consumerGroupName ? {
613
616
  name: "consumerGroup",
614
617
  fn: a(() => [
615
- v("strong", null, f(e.config.consumerGroupName), 1)
618
+ b("strong", null, p(e.config.consumerGroupName), 1)
616
619
  ]),
617
620
  key: "0"
618
621
  } : void 0
619
622
  ]), 1032, ["keypath"]),
620
- v("p", null, f(t(n)("consumers.consumer_groups.remove.description")), 1)
623
+ b("p", null, p(o(n)("consumers.consumer_groups.remove.description")), 1)
621
624
  ]),
622
625
  _: 1
623
- }, 8, ["title", "visible"])) : L("", !0)
626
+ }, 8, ["title", "visible"])) : j("", !0)
624
627
  ]);
625
628
  };
626
629
  }
627
- }), Ot = /* @__PURE__ */ ye(Et, [["__scopeId", "data-v-079a124d"]]), _ = [];
630
+ }), Lt = /* @__PURE__ */ he(Gt, [["__scopeId", "data-v-eb0fde3b"]]), k = [];
628
631
  for (let e = 0; e < 256; ++e)
629
- _.push((e + 256).toString(16).slice(1));
630
- function St(e, c = 0) {
631
- return (_[e[c + 0]] + _[e[c + 1]] + _[e[c + 2]] + _[e[c + 3]] + "-" + _[e[c + 4]] + _[e[c + 5]] + "-" + _[e[c + 6]] + _[e[c + 7]] + "-" + _[e[c + 8]] + _[e[c + 9]] + "-" + _[e[c + 10]] + _[e[c + 11]] + _[e[c + 12]] + _[e[c + 13]] + _[e[c + 14]] + _[e[c + 15]]).toLowerCase();
632
+ k.push((e + 256).toString(16).slice(1));
633
+ function Mt(e, c = 0) {
634
+ return (k[e[c + 0]] + k[e[c + 1]] + k[e[c + 2]] + k[e[c + 3]] + "-" + k[e[c + 4]] + k[e[c + 5]] + "-" + k[e[c + 6]] + k[e[c + 7]] + "-" + k[e[c + 8]] + k[e[c + 9]] + "-" + k[e[c + 10]] + k[e[c + 11]] + k[e[c + 12]] + k[e[c + 13]] + k[e[c + 14]] + k[e[c + 15]]).toLowerCase();
632
635
  }
633
- const Gt = new Uint8Array(16);
634
- function Mt() {
635
- return crypto.getRandomValues(Gt);
636
+ const xt = new Uint8Array(16);
637
+ function At() {
638
+ return crypto.getRandomValues(xt);
636
639
  }
637
- function xt(e, c, r) {
638
- return crypto.randomUUID ? crypto.randomUUID() : At(e);
640
+ function Ft(e, c, r) {
641
+ return crypto.randomUUID ? crypto.randomUUID() : Dt(e);
639
642
  }
640
- function At(e, c, r) {
643
+ function Dt(e, c, r) {
641
644
  e = e || {};
642
- const o = e.random ?? e.rng?.() ?? Mt();
643
- if (o.length < 16)
645
+ const t = e.random ?? e.rng?.() ?? At();
646
+ if (t.length < 16)
644
647
  throw new Error("Random bytes length must be >= 16");
645
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, St(o);
648
+ return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, Mt(t);
646
649
  }
647
- const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { class: "fields-group-text" }, Pt = ["aria-labelledby"], Tt = /* @__PURE__ */ ae({
650
+ const Rt = { class: "kong-ui-entities-consumer-form" }, Pt = ["id"], Tt = { class: "fields-group-text" }, Vt = ["aria-labelledby"], Bt = /* @__PURE__ */ ae({
648
651
  __name: "ConsumerForm",
649
652
  props: {
650
653
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -662,7 +665,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
662
665
  },
663
666
  emits: ["update", "error", "loading"],
664
667
  setup(e, { emit: c }) {
665
- const r = e, o = c, { i18nT: $, i18n: { t: n } } = ie.useI18n(), b = Ae(), { axiosInstance: C } = ve(r.config?.axiosRequestConfig), { getMessageFromError: M } = lt(), B = xt(), d = Ee({
668
+ const r = e, t = c, { i18nT: S, i18n: { t: n } } = ie.useI18n(), C = Fe(), { axiosInstance: $ } = ye(r.config?.axiosRequestConfig), { getMessageFromError: x } = ut(), T = Ft(), u = Se({
666
669
  fields: {
667
670
  username: "",
668
671
  customId: "",
@@ -670,96 +673,96 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
670
673
  },
671
674
  readonly: !1,
672
675
  errorMessage: ""
673
- }), X = Ee({
676
+ }), Y = Se({
674
677
  username: "",
675
678
  customId: "",
676
679
  tags: ""
677
- }), H = h(() => Y.form[r.config?.app]?.edit), q = () => {
678
- b.push(r.config?.cancelRoute || { name: "consumer-list" });
679
- }, x = (u) => {
680
- o("loading", u);
681
- }, Z = (u) => {
682
- o("error", u);
683
- }, J = (u) => {
684
- d.fields.username = u?.item?.username || u?.username || "", d.fields.customId = u?.item?.custom_id || u?.custom_id || "";
685
- const p = u?.item?.tags || u?.tags || [];
686
- d.fields.tags = p?.join(", ") || "", Object.assign(X, d.fields);
687
- }, Q = h(() => r.consumerId ? Me.Edit : Me.Create), N = (u) => {
688
- let p = `${r.config?.apiBaseUrl}${Y.form[r.config?.app][u]}`;
689
- return r.config?.app === "konnect" && (p = p.replace(/{controlPlaneId}/gi, r.config?.controlPlaneId || "")), p.replace(/\/{workspace}/gi, r.config?.workspace ? `/${r.config.workspace}` : "").replace(/{id}/gi, r.consumerId ?? "");
690
- }, E = h(() => !!d.fields.username || !!d.fields.customId), R = h(() => JSON.stringify(d.fields) !== JSON.stringify(X)), A = h(() => ({
691
- username: d.fields.username || null,
692
- custom_id: d.fields.customId || null,
693
- tags: d.fields.tags.split(",")?.map((u) => String(u || "").trim())?.filter((u) => u !== "")
694
- })), D = async () => {
680
+ }), H = h(() => L.form[r.config?.app]?.edit), K = () => {
681
+ C.push(r.config?.cancelRoute || { name: "consumer-list" });
682
+ }, J = (l) => {
683
+ t("loading", l);
684
+ }, Z = (l) => {
685
+ t("error", l);
686
+ }, G = (l) => {
687
+ u.fields.username = l?.item?.username || l?.username || "", u.fields.customId = l?.item?.custom_id || l?.custom_id || "";
688
+ const v = l?.item?.tags || l?.tags || [];
689
+ u.fields.tags = v?.join(", ") || "", Object.assign(Y, u.fields);
690
+ }, Q = h(() => r.consumerId ? xe.Edit : xe.Create), U = (l) => {
691
+ let v = `${r.config?.apiBaseUrl}${L.form[r.config?.app][l]}`;
692
+ return r.config?.app === "konnect" && (v = v.replace(/{controlPlaneId}/gi, r.config?.controlPlaneId || "")), v.replace(/\/{workspace}/gi, r.config?.workspace ? `/${r.config.workspace}` : "").replace(/{id}/gi, r.consumerId ?? "");
693
+ }, ee = h(() => !!u.fields.username || !!u.fields.customId), F = h(() => JSON.stringify(u.fields) !== JSON.stringify(Y)), g = h(() => ({
694
+ username: u.fields.username || null,
695
+ custom_id: u.fields.customId || null,
696
+ tags: u.fields.tags.split(",")?.map((l) => String(l || "").trim())?.filter((l) => l !== "")
697
+ })), A = async () => {
695
698
  try {
696
- d.readonly = !0;
697
- let u;
698
- Q.value === "create" ? u = await C.post(N("create"), A.value) : Q.value === "edit" && (u = r.config?.app === "konnect" ? await C.put(N("edit"), A.value) : await C.patch(N("edit"), A.value)), J(u?.data), o("update", u?.data);
699
- } catch (u) {
700
- d.errorMessage = M(u), o("error", u);
699
+ u.readonly = !0;
700
+ let l;
701
+ Q.value === "create" ? l = await $.post(U("create"), g.value) : Q.value === "edit" && (l = r.config?.app === "konnect" ? await $.put(U("edit"), g.value) : await $.patch(U("edit"), g.value)), G(l?.data), t("update", l?.data);
702
+ } catch (l) {
703
+ u.errorMessage = x(l), t("error", l);
701
704
  } finally {
702
- d.readonly = !1;
705
+ u.readonly = !1;
703
706
  }
704
707
  };
705
- return (u, p) => {
706
- const W = V("KInput"), G = V("KCard");
707
- return w(), j("div", Dt, [
708
- i(t(ut), {
709
- "can-submit": E.value && R.value,
708
+ return (l, v) => {
709
+ const W = P("KInput"), I = P("KCard");
710
+ return E(), O("div", Rt, [
711
+ i(o(dt), {
712
+ "can-submit": ee.value && F.value,
710
713
  config: e.config,
711
714
  "edit-id": e.consumerId,
712
- "entity-type": t(De).Consumer,
713
- "error-message": d.errorMessage,
715
+ "entity-type": o(De).Consumer,
716
+ "error-message": u.errorMessage,
714
717
  "fetch-url": H.value,
715
- "form-fields": A.value,
716
- "is-readonly": d.readonly,
717
- onCancel: q,
718
- "onFetch:error": p[3] || (p[3] = (S) => Z(S)),
719
- "onFetch:success": J,
720
- onLoading: p[4] || (p[4] = (S) => x(S)),
721
- onSubmit: D
718
+ "form-fields": g.value,
719
+ "is-readonly": u.readonly,
720
+ onCancel: K,
721
+ "onFetch:error": v[3] || (v[3] = (M) => Z(M)),
722
+ "onFetch:success": G,
723
+ onLoading: v[4] || (v[4] = (M) => J(M)),
724
+ onSubmit: A
722
725
  }, {
723
726
  default: a(() => [
724
- v("div", null, [
725
- i(t(ct), {
726
- description: t(n)("consumers.form.info.description"),
727
+ b("div", null, [
728
+ i(o(mt), {
729
+ description: o(n)("consumers.form.info.description"),
727
730
  "has-divider": "",
728
- title: t(n)("consumers.form.info.title")
731
+ title: o(n)("consumers.form.info.title")
729
732
  }, {
730
733
  default: a(() => [
731
- v("div", null, [
732
- v("h3", {
733
- id: `fields-group-title-${t(B)}`,
734
+ b("div", null, [
735
+ b("h3", {
736
+ id: `fields-group-title-${o(T)}`,
734
737
  class: "fields-group-title"
735
- }, f(t(n)("consumers.form.consumer_identification.title")) + "* ", 9, Rt),
736
- v("p", Ft, f(t(n)("consumers.form.consumer_identification.description")), 1)
738
+ }, p(o(n)("consumers.form.consumer_identification.title")) + "* ", 9, Pt),
739
+ b("p", Tt, p(o(n)("consumers.form.consumer_identification.description")), 1)
737
740
  ]),
738
- i(G, null, {
741
+ i(I, null, {
739
742
  default: a(() => [
740
- v("fieldset", {
741
- "aria-labelledby": `fields-group-title-${t(B)}`
743
+ b("fieldset", {
744
+ "aria-labelledby": `fields-group-title-${o(T)}`
742
745
  }, [
743
746
  i(W, {
744
- modelValue: d.fields.username,
745
- "onUpdate:modelValue": p[0] || (p[0] = (S) => d.fields.username = S),
747
+ modelValue: u.fields.username,
748
+ "onUpdate:modelValue": v[0] || (v[0] = (M) => u.fields.username = M),
746
749
  modelModifiers: { trim: !0 },
747
750
  autocomplete: "off",
748
751
  class: "username-field",
749
752
  "data-testid": "consumer-form-username",
750
- label: t(n)("consumers.fields.username.label"),
753
+ label: o(n)("consumers.fields.username.label"),
751
754
  "label-attributes": { tooltipAttributes: { maxWidth: "400" } },
752
- placeholder: t(n)("consumers.fields.username.placeholder"),
753
- readonly: d.readonly,
755
+ placeholder: o(n)("consumers.fields.username.placeholder"),
756
+ readonly: u.readonly,
754
757
  type: "text"
755
758
  }, {
756
759
  "label-tooltip": a(() => [
757
- i(t($), {
760
+ i(o(S), {
758
761
  keypath: "consumers.fields.username.tooltip",
759
762
  scope: "global"
760
763
  }, {
761
764
  custom_id: a(() => [
762
- v("code", null, f(t(n)("consumers.fields.username.custom_id")), 1)
765
+ b("code", null, p(o(n)("consumers.fields.username.custom_id")), 1)
763
766
  ]),
764
767
  _: 1
765
768
  })
@@ -767,48 +770,48 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
767
770
  _: 1
768
771
  }, 8, ["modelValue", "label", "placeholder", "readonly"]),
769
772
  i(W, {
770
- modelValue: d.fields.customId,
771
- "onUpdate:modelValue": p[1] || (p[1] = (S) => d.fields.customId = S),
773
+ modelValue: u.fields.customId,
774
+ "onUpdate:modelValue": v[1] || (v[1] = (M) => u.fields.customId = M),
772
775
  modelModifiers: { trim: !0 },
773
776
  autocomplete: "off",
774
777
  "data-testid": "consumer-form-custom-id",
775
- label: t(n)("consumers.fields.custom_id.label"),
778
+ label: o(n)("consumers.fields.custom_id.label"),
776
779
  "label-attributes": { tooltipAttributes: { maxWidth: "400" } },
777
- placeholder: t(n)("consumers.fields.custom_id.placeholder"),
778
- readonly: d.readonly,
780
+ placeholder: o(n)("consumers.fields.custom_id.placeholder"),
781
+ readonly: u.readonly,
779
782
  type: "text"
780
783
  }, {
781
784
  "label-tooltip": a(() => [
782
- i(t($), {
785
+ i(o(S), {
783
786
  keypath: "consumers.fields.custom_id.tooltip",
784
787
  scope: "global"
785
788
  }, {
786
789
  username: a(() => [
787
- v("code", null, f(t(n)("consumers.fields.custom_id.username")), 1)
790
+ b("code", null, p(o(n)("consumers.fields.custom_id.username")), 1)
788
791
  ]),
789
792
  _: 1
790
793
  })
791
794
  ]),
792
795
  _: 1
793
796
  }, 8, ["modelValue", "label", "placeholder", "readonly"])
794
- ], 8, Pt)
797
+ ], 8, Vt)
795
798
  ]),
796
799
  _: 1
797
800
  }),
798
801
  i(W, {
799
- modelValue: d.fields.tags,
800
- "onUpdate:modelValue": p[2] || (p[2] = (S) => d.fields.tags = S),
802
+ modelValue: u.fields.tags,
803
+ "onUpdate:modelValue": v[2] || (v[2] = (M) => u.fields.tags = M),
801
804
  modelModifiers: { trim: !0 },
802
805
  autocomplete: "off",
803
806
  "data-testid": "consumer-form-tags",
804
- help: t(n)("consumers.fields.tags.help"),
805
- label: t(n)("consumers.fields.tags.label"),
807
+ help: o(n)("consumers.fields.tags.help"),
808
+ label: o(n)("consumers.fields.tags.label"),
806
809
  "label-attributes": {
807
- info: t(n)("consumers.fields.tags.tooltip"),
810
+ info: o(n)("consumers.fields.tags.tooltip"),
808
811
  tooltipAttributes: { maxWidth: "400" }
809
812
  },
810
- placeholder: t(n)("consumers.fields.tags.placeholder"),
811
- readonly: d.readonly,
813
+ placeholder: o(n)("consumers.fields.tags.placeholder"),
814
+ readonly: u.readonly,
812
815
  type: "text"
813
816
  }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
814
817
  ]),
@@ -821,7 +824,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
821
824
  ]);
822
825
  };
823
826
  }
824
- }), jt = /* @__PURE__ */ ye(Tt, [["__scopeId", "data-v-a0873f95"]]), Vt = { class: "kong-ui-consumer-entity-config-card" }, Lt = /* @__PURE__ */ ae({
827
+ }), Ht = /* @__PURE__ */ he(Bt, [["__scopeId", "data-v-a0873f95"]]), Kt = { class: "kong-ui-consumer-entity-config-card" }, Jt = /* @__PURE__ */ ae({
825
828
  __name: "ConsumerConfigCard",
826
829
  props: {
827
830
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -848,15 +851,15 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
848
851
  },
849
852
  emits: ["loading", "fetch:error", "fetch:success"],
850
853
  setup(e) {
851
- const c = e, { i18n: { t: r }, i18nT: o } = ie.useI18n(), $ = h(() => Y.form[c.config.app].edit), n = g({
854
+ const c = e, { i18n: { t: r }, i18nT: t } = ie.useI18n(), S = h(() => L.form[c.config.app].edit), n = y({
852
855
  id: {},
853
856
  username: {
854
- section: xe.Basic,
857
+ section: Ae.Basic,
855
858
  tooltip: r("consumers.fields.username.tooltip"),
856
859
  order: 1
857
860
  },
858
861
  custom_id: {
859
- section: xe.Basic,
862
+ section: Ae.Basic,
860
863
  tooltip: r("consumers.fields.custom_id.tooltip"),
861
864
  label: r("consumers.fields.custom_id.label"),
862
865
  order: 2
@@ -873,36 +876,36 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
873
876
  hidden: !0
874
877
  }
875
878
  });
876
- return (b, C) => (w(), j("div", Vt, [
877
- i(t(dt), {
879
+ return (C, $) => (E(), O("div", Kt, [
880
+ i(o(pt), {
878
881
  config: e.config,
879
882
  "config-card-doc": e.configCardDoc,
880
883
  "config-schema": n.value,
881
- "entity-type": t(De).Consumer,
882
- "fetch-url": $.value,
884
+ "entity-type": o(De).Consumer,
885
+ "fetch-url": S.value,
883
886
  "hide-title": e.hideTitle,
884
- "onFetch:error": C[0] || (C[0] = (M) => b.$emit("fetch:error", M)),
885
- "onFetch:success": C[1] || (C[1] = (M) => b.$emit("fetch:success", M)),
886
- onLoading: C[2] || (C[2] = (M) => b.$emit("loading", M))
887
+ "onFetch:error": $[0] || ($[0] = (x) => C.$emit("fetch:error", x)),
888
+ "onFetch:success": $[1] || ($[1] = (x) => C.$emit("fetch:success", x)),
889
+ onLoading: $[2] || ($[2] = (x) => C.$emit("loading", x))
887
890
  }, {
888
891
  "username-label-tooltip": a(() => [
889
- i(t(o), {
892
+ i(o(t), {
890
893
  keypath: "consumers.fields.username.tooltip",
891
894
  scope: "global"
892
895
  }, {
893
896
  custom_id: a(() => [
894
- v("code", null, f(t(r)("consumers.fields.username.custom_id")), 1)
897
+ b("code", null, p(o(r)("consumers.fields.username.custom_id")), 1)
895
898
  ]),
896
899
  _: 1
897
900
  })
898
901
  ]),
899
902
  "custom_id-label-tooltip": a(() => [
900
- i(t(o), {
903
+ i(o(t), {
901
904
  keypath: "consumers.fields.custom_id.tooltip",
902
905
  scope: "global"
903
906
  }, {
904
907
  username: a(() => [
905
- v("code", null, f(t(r)("consumers.fields.custom_id.username")), 1)
908
+ b("code", null, p(o(r)("consumers.fields.custom_id.username")), 1)
906
909
  ]),
907
910
  _: 1
908
911
  })
@@ -913,7 +916,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
913
916
  }
914
917
  });
915
918
  export {
916
- Lt as ConsumerConfigCard,
917
- jt as ConsumerForm,
918
- Ot as ConsumerList
919
+ Jt as ConsumerConfigCard,
920
+ Ht as ConsumerForm,
921
+ Lt as ConsumerList
919
922
  };