@piveau/dpi 0.2.0-alpha.48 → 0.2.0-alpha.49

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,33 +1,46 @@
1
- import { ref as f, computed as B, getCurrentInstance as F, unref as m, onMounted as M, watch as O, createElementBlock as c, openBlock as d, createElementVNode as s, createCommentVNode as h, toDisplayString as r, createVNode as u, Fragment as E, renderList as D } from "vue";
2
- import { PhWarning as g } from "@phosphor-icons/vue";
3
- import { useEditModeInfo as I } from "../composables/useDpiEditMode.js";
4
- import P from "../HappyFlowComponents/ui/InputField.vue.js";
5
- import z from "../HappyFlowComponents/ui/TextButtonSmall.vue.js";
6
- import { useFormValues as U } from "../composables/useDpiFormValues.js";
1
+ import { ref as p, computed as P, unref as v, watch as M, createElementBlock as r, openBlock as c, createElementVNode as s, createCommentVNode as g, toDisplayString as d, createVNode as u, Fragment as C, renderList as z } from "vue";
2
+ import { PhWarning as _ } from "@phosphor-icons/vue";
3
+ import { useEditModeInfo as x } from "../composables/useDpiEditMode.js";
4
+ import { useFormValues as q } from "../composables/useDpiFormValues.js";
5
+ import { useOrganizationInfo as G } from "../composables/useOrganizationInfo.js";
6
+ import { useTwinbyUser as H } from "../composables/useTwinbyUser.js";
7
+ import T from "../HappyFlowComponents/ui/InputField.vue.js";
8
+ import D from "../HappyFlowComponents/ui/TextButtonSmall.vue.js";
7
9
  /* empty css */
8
- import j from "../../../../../_virtual/_plugin-vue_export-helper.js";
9
- const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular" }, G = { class: "dpiV3AutoCompleteWrap" }, H = { class: "CardTips_internal" }, J = { class: "CardTips_Part" }, K = { class: "firstRow" }, Q = { class: "icon_title copy-small-semi-bold" }, X = { class: "TextButton_small" }, Y = { class: "secondRow" }, Z = { class: "copy-small-regular" }, ee = { class: "CardTips_Part" }, ae = { class: "firstRow" }, te = { class: "icon_title copy-small-semi-bold" }, se = { class: "TextButton_small" }, oe = { class: "secondRow" }, le = { class: "copy-small-regular" }, ie = { class: "input-container" }, ne = {
10
+ import J from "../../../../../_virtual/_plugin-vue_export-helper.js";
11
+ const Q = { class: "dpiV3InnerComponentWrap" }, X = { class: "copy-large-regular" }, Y = { class: "dpiV3AutoCompleteWrap" }, Z = { class: "CardTips_internal" }, ee = { class: "CardTips_Part" }, ae = { class: "firstRow" }, te = { class: "icon_title copy-small-semi-bold" }, se = { class: "TextButton_small" }, le = { class: "secondRow" }, oe = {
12
+ key: 0,
13
+ class: "copy-small-regular"
14
+ }, ie = {
15
+ key: 2,
16
+ class: "copy-small-regular"
17
+ }, ne = { class: "CardTips_Part" }, re = { class: "firstRow" }, ce = { class: "icon_title copy-small-semi-bold" }, de = { class: "TextButton_small" }, ue = { class: "secondRow" }, me = { class: "input-container" }, pe = {
10
18
  key: 0,
11
19
  class: "dpiV3_errormsgWrapper"
12
- }, re = { class: "copy-mini-regular" }, ce = { class: "input-container" }, de = {
20
+ }, ve = { class: "copy-mini-regular" }, fe = { class: "input-container" }, he = {
13
21
  key: 0,
14
22
  class: "dpiV3_errormsgWrapper"
15
- }, ue = { class: "copy-mini-regular" }, pe = { class: "input-container" }, fe = {
23
+ }, ge = { class: "copy-mini-regular" }, _e = { class: "input-container" }, be = {
16
24
  key: 0,
17
25
  class: "dpiV3_errormsgWrapper"
18
- }, me = { class: "copy-mini-regular" }, ve = { class: "copy-large-regular" }, he = {
26
+ }, we = { class: "copy-mini-regular" }, ye = { class: "copy-large-regular" }, ke = {
19
27
  key: 0,
20
28
  class: "form-error-message"
21
- }, T = "", ge = {
29
+ }, Pe = {
22
30
  __name: "ContactPage",
23
31
  props: {
24
32
  context: Object
25
33
  },
26
34
  setup(S) {
27
- const { formValues: N } = U(), v = S, { isEditMode: R } = I(), _ = f(null), b = f(null), w = B(() => {
35
+ const f = S, { formValues: F } = q(), { isEditMode: O } = x(), { organization: R, authToken: W, startFetchPermissions: A } = H();
36
+ A();
37
+ const { resultEnhanced: L, isLoading: N, isFetching: U } = G({
38
+ id: R,
39
+ authToken: W
40
+ }), b = p(null), w = p(null), y = P(() => {
28
41
  var e, t;
29
42
  try {
30
- const a = (t = (e = N.value.BasicInfos) == null ? void 0 : e["dct:publisher"]) == null ? void 0 : t[0];
43
+ const a = (t = (e = F.value.BasicInfos) == null ? void 0 : e["dct:publisher"]) == null ? void 0 : t[0];
31
44
  if (a && a["foaf:name"] && a["foaf:mbox"])
32
45
  return [
33
46
  a["foaf:name"],
@@ -41,17 +54,16 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
41
54
  "",
42
55
  ""
43
56
  ];
44
- }), k = B(() => {
45
- var t, a;
46
- const e = (a = (t = F().appContext.config.globalProperties.$keycloak) == null ? void 0 : t.idTokenParsed) == null ? void 0 : a.contact;
47
- if (e) {
48
- const i = {
49
- organization: e.organization
50
- };
51
- return e.email && (i.email = e.email), (e.phone || e.phoneNumber) && (i.phone = e.phone || e.phoneNumber), i;
52
- }
53
- return {};
54
- }), o = f({
57
+ }), V = P(() => N.value || U.value), h = P(() => {
58
+ var a;
59
+ const e = (a = L.value) == null ? void 0 : a.publisher;
60
+ if (!e)
61
+ return {};
62
+ const t = {
63
+ organization: e.name
64
+ };
65
+ return e.email && (t.email = e.email), t;
66
+ }), l = p({
55
67
  1: {
56
68
  show: !1,
57
69
  message: "Bitte geben Sie einen gültigen Organisationsnamen ein."
@@ -65,8 +77,8 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
65
77
  message: "Bitte geben Sie eine gültige Telefonnummer ein."
66
78
  }
67
79
  });
68
- let n = f({ 1: !1, 2: !1, 3: !1 });
69
- const l = f([
80
+ let n = p({ 1: !1, 2: !1, 3: !1 });
81
+ const o = p([
70
82
  {
71
83
  isValid: "unset",
72
84
  "vcard:fn": "",
@@ -74,41 +86,35 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
74
86
  "vcard:hasTelephone": ""
75
87
  }
76
88
  ]);
77
- R.value || v.context.node.input(l), v.context.node.value.length === 0 && v.context.node.input(m(l)), M(() => {
78
- try {
79
- T && T["foaf:name"] && T["foaf:mbox"];
80
- } catch (e) {
81
- console.warn("Could not load publisher data from context:", e);
82
- }
83
- });
84
- function V(e) {
89
+ O.value || f.context.node.input(o), f.context.node.value.length === 0 && f.context.node.input(v(o));
90
+ function E(e) {
85
91
  return e.trim().length >= 2;
86
92
  }
87
- function C(e) {
93
+ function B(e) {
88
94
  return /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(e);
89
95
  }
90
96
  function $(e) {
91
97
  if (!e || e.trim() === "")
92
98
  return !0;
93
99
  const t = e.replace(/[\s\-().]/g, "");
94
- if (!/^[+]?\d+$/.test(t))
100
+ if (!/^\+?\d+$/.test(t))
95
101
  return !1;
96
102
  const a = t.replace(/\D/g, "");
97
103
  return a.length >= 6 && a.length <= 15;
98
104
  }
99
- function y(e, t, a) {
105
+ function k(e, t, a) {
100
106
  let i = !1;
101
107
  if (a === 3 && e.trim() === "")
102
- o.value[a].show = !1, n.value[a] = !0;
108
+ l.value[a].show = !1, n.value[a] = !0;
103
109
  else if (e.trim() === "")
104
- o.value[a].show = !0, n.value[a] = !1;
110
+ l.value[a].show = !0, n.value[a] = !1;
105
111
  else {
106
112
  switch (t) {
107
113
  case "vcard:fn":
108
- i = V(e);
114
+ i = E(e);
109
115
  break;
110
116
  case "vcard:hasEmail":
111
- i = C(e);
117
+ i = B(e);
112
118
  break;
113
119
  case "vcard:hasTelephone":
114
120
  i = $(e);
@@ -116,96 +122,103 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
116
122
  default:
117
123
  i = e.trim() !== "";
118
124
  }
119
- o.value[a].show = !i, n.value[a] = i;
125
+ l.value[a].show = !i, n.value[a] = i;
120
126
  }
121
- n.value[1] && n.value[2] ? l.value[0].isValid = !0 : l.value[0].isValid = "unset";
127
+ n.value[1] && n.value[2] ? o.value[0].isValid = !0 : o.value[0].isValid = "unset";
122
128
  }
123
- function p(e, t, a) {
124
- l.value = l.value.map((i) => t in i ? { ...i, [t]: e } : i), v.context.node.input(l.value), a === 2 ? (_.value && clearTimeout(_.value), _.value = setTimeout(() => {
125
- y(e, t, a);
126
- }, 800)) : a === 3 ? (b.value && clearTimeout(b.value), b.value = setTimeout(() => {
127
- y(e, t, a);
128
- }, 800)) : y(e, t, a);
129
+ function m(e, t, a) {
130
+ o.value = o.value.map((i) => t in i ? { ...i, [t]: e } : i), f.context.node.input(o.value), a === 2 ? (b.value && clearTimeout(b.value), b.value = setTimeout(() => {
131
+ k(e, t, a);
132
+ }, 800)) : a === 3 ? (w.value && clearTimeout(w.value), w.value = setTimeout(() => {
133
+ k(e, t, a);
134
+ }, 800)) : k(e, t, a);
129
135
  }
130
- function W() {
131
- const e = k.value;
132
- e.organization && p(e.organization, "vcard:fn", 1), e.email && p(e.email, "vcard:hasEmail", 2);
136
+ function j() {
137
+ const e = h.value;
138
+ e.organization && m(e.organization, "vcard:fn", 1), e.email && m(e.email, "vcard:hasEmail", 2);
133
139
  }
134
- function x() {
135
- p(w.value[0], "vcard:fn", 1), p(w.value[1], "vcard:hasEmail", 2);
140
+ function I() {
141
+ m(y.value[0], "vcard:fn", 1), m(y.value[1], "vcard:hasEmail", 2);
136
142
  }
137
- const A = () => {
138
- const e = l.value[0];
143
+ function K() {
144
+ const e = o.value[0];
139
145
  if (e["vcard:fn"].trim() === "")
140
- o.value[1].show = !0, n.value[1] = !1;
146
+ l.value[1].show = !0, n.value[1] = !1;
141
147
  else {
142
- const t = V(e["vcard:fn"]);
143
- o.value[1].show = !t, n.value[1] = t;
148
+ const t = E(e["vcard:fn"]);
149
+ l.value[1].show = !t, n.value[1] = t;
144
150
  }
145
151
  if (e["vcard:hasEmail"].trim() === "")
146
- o.value[2].show = !0, n.value[2] = !1;
152
+ l.value[2].show = !0, n.value[2] = !1;
147
153
  else {
148
- const t = C(e["vcard:hasEmail"]);
149
- o.value[2].show = !t, n.value[2] = t;
154
+ const t = B(e["vcard:hasEmail"]);
155
+ l.value[2].show = !t, n.value[2] = t;
150
156
  }
151
157
  if (e["vcard:hasTelephone"].trim() === "")
152
- o.value[3].show = !1, n.value[3] = !0;
158
+ l.value[3].show = !1, n.value[3] = !0;
153
159
  else {
154
160
  const t = $(e["vcard:hasTelephone"]);
155
- o.value[3].show = !t, n.value[3] = t;
161
+ l.value[3].show = !t, n.value[3] = t;
156
162
  }
157
- n.value[1] && n.value[2] ? l.value[0].isValid = !0 : l.value[0].isValid = !1;
158
- };
159
- return O(() => l.value[0].isValid, (e) => {
160
- e === !1 && A();
161
- }), (e, t) => (d(), c("div", L, [
162
- s("h4", null, r(e.$t("message.dataupload.datasets.dcat:contactPoint.title")), 1),
163
- s("div", q, r(e.$t("message.dataupload.datasets.dcat:contactPoint.description")), 1),
164
- s("div", G, [
165
- s("div", H, [
166
- s("div", J, [
167
- s("div", K, [
168
- s("div", Q, r(e.$t("message.dataupload.datasets.dcat:contactPoint.account")), 1),
169
- s("div", X, [
170
- u(z, {
163
+ n.value[1] && n.value[2] ? o.value[0].isValid = !0 : o.value[0].isValid = !1;
164
+ }
165
+ return M(() => o.value[0].isValid, (e) => {
166
+ e === !1 && K();
167
+ }), (e, t) => (c(), r("div", Q, [
168
+ s("h4", null, d(e.$t("message.dataupload.datasets.dcat:contactPoint.title")), 1),
169
+ s("div", X, d(e.$t("message.dataupload.datasets.dcat:contactPoint.description")), 1),
170
+ s("div", Y, [
171
+ s("div", Z, [
172
+ s("div", ee, [
173
+ s("div", ae, [
174
+ s("div", te, d(e.$t("message.dataupload.datasets.dcat:contactPoint.account")), 1),
175
+ s("div", se, [
176
+ u(D, {
171
177
  "button-text": e.$t(
172
178
  "message.dataupload.datasets.dcat:contactPoint.useAccountButton"
173
179
  ),
174
180
  "icon-start": "DeleteBlue",
175
181
  "icon-name": "copy",
176
182
  class: "dpiV3_usedetailsButton",
177
- onClick: W
178
- }, null, 8, ["button-text"])
183
+ disabled: V.value || Object.keys(h.value).length === 0,
184
+ onClick: j
185
+ }, null, 8, ["button-text", "disabled"])
179
186
  ])
180
187
  ]),
181
- s("div", Y, [
182
- (d(!0), c(E, null, D(Object.values(k.value), (a) => (d(), c("span", Z, r(a), 1))), 256))
188
+ s("div", le, [
189
+ V.value ? (c(), r("span", oe, "Lade Kontodaten...")) : Object.keys(h.value).length > 0 ? (c(!0), r(C, { key: 1 }, z(h.value, (a, i) => (c(), r("span", {
190
+ key: i,
191
+ class: "copy-small-regular"
192
+ }, d(a), 1))), 128)) : (c(), r("span", ie, "Keine Kontodaten verfügbar"))
183
193
  ])
184
194
  ]),
185
- s("div", ee, [
186
- s("div", ae, [
187
- s("div", te, r(e.$t("message.metadata.publisher")), 1),
188
- s("div", se, [
189
- u(z, {
195
+ s("div", ne, [
196
+ s("div", re, [
197
+ s("div", ce, d(e.$t("message.metadata.publisher")), 1),
198
+ s("div", de, [
199
+ u(D, {
190
200
  "button-text": e.$t(
191
201
  "message.dataupload.datasets.dcat:contactPoint.usePublisherButton"
192
202
  ),
193
203
  "icon-start": "true",
194
204
  "icon-name": "copy",
195
205
  class: "",
196
- onClick: x
206
+ onClick: I
197
207
  }, null, 8, ["button-text"])
198
208
  ])
199
209
  ]),
200
- s("div", oe, [
201
- (d(!0), c(E, null, D(w.value, (a) => (d(), c("span", le, r(a), 1))), 256))
210
+ s("div", ue, [
211
+ (c(!0), r(C, null, z(y.value, (a, i) => (c(), r("span", {
212
+ key: i,
213
+ class: "copy-small-regular"
214
+ }, d(a), 1))), 128))
202
215
  ])
203
216
  ])
204
217
  ])
205
218
  ]),
206
- s("div", ie, [
207
- u(P, {
208
- "model-value": l.value[0]["vcard:fn"],
219
+ s("div", me, [
220
+ u(T, {
221
+ "model-value": o.value[0]["vcard:fn"],
209
222
  "add-on-text": !1,
210
223
  "date-picker": !1,
211
224
  "info-icon": !1,
@@ -217,20 +230,20 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
217
230
  "initial-hint-text": !1,
218
231
  label: e.$t("message.dataupload.datasets.dcat:contactPoint.nameInput.title"),
219
232
  "show-end-icon": !1,
220
- "show-error": o.value[1].show,
221
- "onUpdate:modelValue": t[0] || (t[0] = (a) => p(a, "vcard:fn", 1))
233
+ "show-error": l.value[1].show,
234
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => m(a, "vcard:fn", 1))
222
235
  }, null, 8, ["model-value", "placeholder", "label", "show-error"]),
223
- o.value[1].show ? (d(), c("div", ne, [
224
- u(m(g), {
236
+ l.value[1].show ? (c(), r("div", pe, [
237
+ u(v(_), {
225
238
  size: 16,
226
239
  weight: "fill"
227
240
  }),
228
- s("span", re, r(o.value[1].message), 1)
229
- ])) : h("", !0)
241
+ s("span", ve, d(l.value[1].message), 1)
242
+ ])) : g("", !0)
230
243
  ]),
231
- s("div", ce, [
232
- u(P, {
233
- "model-value": l.value[0]["vcard:hasEmail"],
244
+ s("div", fe, [
245
+ u(T, {
246
+ "model-value": o.value[0]["vcard:hasEmail"],
234
247
  "add-on-text": !1,
235
248
  "date-picker": !1,
236
249
  "info-icon": !1,
@@ -242,20 +255,20 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
242
255
  "initial-hint-text": !1,
243
256
  label: e.$t("message.dataupload.datasets.dcat:contactPoint.mailInput.title"),
244
257
  "show-end-icon": !1,
245
- "show-error": o.value[2].show,
246
- "onUpdate:modelValue": t[1] || (t[1] = (a) => p(a, "vcard:hasEmail", 2))
258
+ "show-error": l.value[2].show,
259
+ "onUpdate:modelValue": t[1] || (t[1] = (a) => m(a, "vcard:hasEmail", 2))
247
260
  }, null, 8, ["model-value", "placeholder", "label", "show-error"]),
248
- o.value[2].show ? (d(), c("div", de, [
249
- u(m(g), {
261
+ l.value[2].show ? (c(), r("div", he, [
262
+ u(v(_), {
250
263
  size: 16,
251
264
  weight: "fill"
252
265
  }),
253
- s("span", ue, r(o.value[2].message), 1)
254
- ])) : h("", !0)
266
+ s("span", ge, d(l.value[2].message), 1)
267
+ ])) : g("", !0)
255
268
  ]),
256
- s("div", pe, [
257
- u(P, {
258
- "model-value": l.value[0]["vcard:hasTelephone"],
269
+ s("div", _e, [
270
+ u(T, {
271
+ "model-value": o.value[0]["vcard:hasTelephone"],
259
272
  "add-on-text": !1,
260
273
  "date-picker": !1,
261
274
  "info-icon": !1,
@@ -267,28 +280,28 @@ const L = { class: "dpiV3InnerComponentWrap" }, q = { class: "copy-large-regular
267
280
  "initial-hint-text": !1,
268
281
  label: e.$t("message.dataupload.datasets.dcat:contactPoint.telInput.title"),
269
282
  "show-end-icon": !1,
270
- "show-error": o.value[3].show,
271
- "onUpdate:modelValue": t[2] || (t[2] = (a) => p(a, "vcard:hasTelephone", 3))
283
+ "show-error": l.value[3].show,
284
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => m(a, "vcard:hasTelephone", 3))
272
285
  }, null, 8, ["model-value", "placeholder", "label", "show-error"]),
273
- o.value[3].show ? (d(), c("div", fe, [
274
- u(m(g), {
286
+ l.value[3].show ? (c(), r("div", be, [
287
+ u(v(_), {
275
288
  size: 16,
276
289
  weight: "fill"
277
290
  }),
278
- s("span", me, r(o.value[3].message), 1)
279
- ])) : h("", !0)
291
+ s("span", we, d(l.value[3].message), 1)
292
+ ])) : g("", !0)
280
293
  ]),
281
- s("div", ve, r(e.$t("message.dataupload.datasets.dcat:contactPoint.descriptionBottom")), 1),
282
- l.value.find((a) => a.isValid === !1) ? (d(), c("div", he, [
283
- u(m(g), {
294
+ s("div", ye, d(e.$t("message.dataupload.datasets.dcat:contactPoint.descriptionBottom")), 1),
295
+ o.value.find((a) => a.isValid === !1) ? (c(), r("div", ke, [
296
+ u(v(_), {
284
297
  size: 16,
285
298
  weight: "fill"
286
299
  }),
287
300
  t[3] || (t[3] = s("span", { class: "copy-mini-regular" }, "Bitte füllen Sie alle Pflichtfelder aus, bevor Sie fortfahren.", -1))
288
- ])) : h("", !0)
301
+ ])) : g("", !0)
289
302
  ]));
290
303
  }
291
- }, Ce = /* @__PURE__ */ j(ge, [["__scopeId", "data-v-071ac638"]]);
304
+ }, Oe = /* @__PURE__ */ J(Pe, [["__scopeId", "data-v-00c46b14"]]);
292
305
  export {
293
- Ce as default
306
+ Oe as default
294
307
  };