@piveau/dpi 0.1.0-beta.5 → 0.1.0-beta.51

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.
Files changed (74) hide show
  1. package/dist/assets/dpi.css +1 -1
  2. package/dist/data-provider-interface/DPIMenu.vue.js +2 -2
  3. package/dist/data-provider-interface/DataProviderInterface.vue2.js +45 -40
  4. package/dist/data-provider-interface/HappyFlowComponents/ComponentLibrary.vue.js +1 -1
  5. package/dist/data-provider-interface/HappyFlowComponents/HomeTable.vue.js +58 -53
  6. package/dist/data-provider-interface/HappyFlowComponents/services/dpiV3_apis.js +78 -66
  7. package/dist/data-provider-interface/HappyFlowComponents/ui/CloseOpenButtonV3.vue.js +11 -10
  8. package/dist/data-provider-interface/HappyFlowComponents/ui/Dropdown.vue.js +100 -76
  9. package/dist/data-provider-interface/HappyFlowComponents/ui/InputField.vue.js +1 -1
  10. package/dist/data-provider-interface/HappyFlowComponents/ui/ModalSimpleV3.vue.js +7 -7
  11. package/dist/data-provider-interface/HappyFlowComponents/ui/ModalV3.vue.js +434 -360
  12. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/AccessServiceV3.vue.js +103 -71
  13. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/AvailabilityV3.vue.js +17 -22
  14. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/ChangeLicenseV3.vue.js +130 -77
  15. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/ChecksumV3.vue.js +91 -61
  16. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/ConformsToV3.vue.js +111 -74
  17. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/DocumentationsV3.vue.js +170 -99
  18. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/LanguageV3.vue.js +109 -52
  19. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/PolicyV3.vue.js +65 -86
  20. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/StatusV3.vue.js +29 -28
  21. package/dist/data-provider-interface/HappyFlowComponents/ui/RapModal.vue.js +153 -102
  22. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/AdditionalsSubModal.vue.js +571 -207
  23. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/CoverageModal.vue.js +100 -53
  24. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/DistributionModal.vue.js +34 -56
  25. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/EssentialsModal.vue.js +301 -100
  26. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/FindabilityChips.vue.js +46 -27
  27. package/dist/data-provider-interface/HappyFlowComponents/ui/SectionItems/HVDSwitch.vue.js +70 -39
  28. package/dist/data-provider-interface/HappyFlowComponents/ui/TableRowV3.vue.js +182 -105
  29. package/dist/data-provider-interface/HappyFlowComponents/ui/TextAreaV3.vue.js +19 -14
  30. package/dist/data-provider-interface/HappyFlowComponents/ui/TextButtonSmall.vue.js +1 -1
  31. package/dist/data-provider-interface/HappyFlowComponents/ui/Toast.vue.js +30 -29
  32. package/dist/data-provider-interface/components/ContactPage.vue.js +153 -105
  33. package/dist/data-provider-interface/components/DiscoverabilityPage.vue.js +32 -32
  34. package/dist/data-provider-interface/components/DistLicense.vue.js +198 -99
  35. package/dist/data-provider-interface/components/DistributionSimplePage.vue.js +856 -790
  36. package/dist/data-provider-interface/components/Dropup.vue.js +6 -6
  37. package/dist/data-provider-interface/components/HVDPage.vue.js +105 -82
  38. package/dist/data-provider-interface/components/InfoSlot.vue.js +5 -5
  39. package/dist/data-provider-interface/components/PolGeoUriPage.vue.js +89 -46
  40. package/dist/data-provider-interface/components/PublisherPage.vue.js +111 -81
  41. package/dist/data-provider-interface/components/ReviewAndPublishPage.vue.js +302 -251
  42. package/dist/data-provider-interface/components/TempResPage.vue.js +267 -187
  43. package/dist/data-provider-interface/components/TempResPageInModal.vue.js +395 -0
  44. package/dist/data-provider-interface/components/UpdateDate.vue.js +33 -29
  45. package/dist/data-provider-interface/components/dpiV3Description.vue.js +7 -6
  46. package/dist/data-provider-interface/composables/useDpiContext.js +5 -7
  47. package/dist/data-provider-interface/composables/useDpiEditMode.js +15 -13
  48. package/dist/data-provider-interface/composables/useDpiSimpleLoader.js +397 -244
  49. package/dist/data-provider-interface/config/dcatapde/vocab-prefixes.js +1 -1
  50. package/dist/data-provider-interface/config/dcatapdeHappyFlow/converter.js +472 -95
  51. package/dist/data-provider-interface/config/dcatapdeHappyFlow/input-definition.js +104 -152
  52. package/dist/data-provider-interface/config/dcatapdeHappyFlow/page-content-config.js +10 -3
  53. package/dist/data-provider-interface/store/index.js +32 -0
  54. package/dist/data-provider-interface/store/modules/authStore.js +301 -0
  55. package/dist/data-provider-interface/store/modules/catalogueDetailsStore.js +34 -0
  56. package/dist/data-provider-interface/store/modules/cataloguesStore.js +256 -0
  57. package/dist/data-provider-interface/store/modules/datasetDetailsStore.js +644 -0
  58. package/dist/data-provider-interface/store/modules/datasetsStore.js +361 -0
  59. package/dist/data-provider-interface/store/{dpiStore.js → modules/dpiStore.js} +11 -12
  60. package/dist/data-provider-interface/store/modules/snackbarStore.js +45 -0
  61. package/dist/data-provider-interface/views/DraftsPage.vue.js +3 -3
  62. package/dist/data-provider-interface/views/InputPage.vue.js +378 -752
  63. package/dist/index.js +4 -4
  64. package/dist/styles/_dpi.scss +1614 -0
  65. package/dist/styles/_maps.scss +24 -0
  66. package/dist/styles/_variables.scss +973 -0
  67. package/dist/utils/draftApi.js +33 -0
  68. package/dist/utils/helpers.js +36 -22
  69. package/dist/utils/identifiersApi.js +16 -0
  70. package/dist/utils/jwt.js +7 -0
  71. package/package.json +12 -7
  72. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/AccessRightsV3.vue.js +0 -41
  73. package/dist/data-provider-interface/HappyFlowComponents/ui/OptionalInformation/LicenseAttributionByText.vue.js +0 -46
  74. package/dist/data-provider-interface/store/modules/formSchemaStore.js +0 -94
@@ -0,0 +1,301 @@
1
+ import n from "axios";
2
+ import { cloneDeep as u, get as T } from "lodash-es";
3
+ import i from "../../../utils/draftApi.js";
4
+ import f from "../../../utils/identifiersApi.js";
5
+ import { decode as R } from "../../../utils/jwt.js";
6
+ let _, A;
7
+ const d = {
8
+ authenticated: !1,
9
+ rtptoken: "",
10
+ keycloak: null,
11
+ userData: {
12
+ authToken: "",
13
+ rtpToken: "",
14
+ userName: "",
15
+ permissions: [],
16
+ drafts: [],
17
+ roles: []
18
+ },
19
+ isEditMode: !1,
20
+ isDraft: !1
21
+ }, U = {
22
+ securityAuth: (e) => e.authenticated,
23
+ getRTPToken: (e) => e.rtptoken,
24
+ getKeycloak: (e) => e.keycloak,
25
+ getUserData: (e) => e.userData,
26
+ getUserName: (e) => e.userData.userName,
27
+ /**
28
+ * @description Get all catalogs associated to the user where they have access to.
29
+ * @returns {Array} Array of catalogs
30
+ */
31
+ getUserCatalogs: (e) => e.userData.permissions.filter(
32
+ // User must have CRUD authorization
33
+ (t) => ["dataset:update", "dataset:delete", "dataset:create"].every(
34
+ (a) => t.scopes.includes(a)
35
+ )
36
+ ),
37
+ /**
38
+ * @description Get all catalog IDs associated to the user where they have access to.
39
+ */
40
+ getUserCatalogIds: (e, t) => t.getUserCatalogs.map((a) => a.rsname),
41
+ getUserDrafts: (e) => e.userData.drafts,
42
+ getUserDraftIds: (e) => e.userData.drafts.map((t) => t.id),
43
+ getIsEditMode: (e) => e.isEditMode,
44
+ getIsDraft: (e) => e.isDraft
45
+ }, l = {
46
+ authLogin({ commit: e }, t) {
47
+ e("SECURITY_AUTH", t);
48
+ },
49
+ authLogout({ commit: e }) {
50
+ e("SECURITY_AUTH", !1), e("RTP_TOKEN", "");
51
+ },
52
+ rtpToken({ commit: e }, t) {
53
+ e("RTP_TOKEN", t);
54
+ },
55
+ setKeycloak({ commit: e }, t) {
56
+ e("SET_KEYCLOAK", t);
57
+ },
58
+ /**
59
+ * Updates user data according to an authentication token and by supplying neccessary
60
+ * information to retrieve tFhe user's permissions as well as their drafts.
61
+ * @param {*} commit
62
+ * @param {Object} params
63
+ * @returns {Promise<Object>}
64
+ */
65
+ async updateUserData({ commit: e, dispatch: t }, { authToken: a, rtpToken: s, hubUrl: r }) {
66
+ if (!a || !s)
67
+ return console.error("Missing authToken or rtpToken"), e("UPDATE_USER_DATA_ERROR"), {};
68
+ e("UPDATE_USER_DATA_PENDING");
69
+ try {
70
+ if (!s) throw new Error("Failed to retrieve RTP token");
71
+ const E = R(s), D = T(E, "authorization.permissions", []), o = T(E, "realm_access.roles", []);
72
+ e("SET_USER_DATA", {
73
+ authToken: a,
74
+ rtpToken: s,
75
+ userName: E.preferred_username,
76
+ permissions: D,
77
+ drafts: [],
78
+ roles: o
79
+ }), _ = i({ baseURL: r, authToken: s }), A = f({
80
+ baseURL: r,
81
+ authToken: s
82
+ }), t("updateUserDrafts"), e("UPDATE_USER_DATA_SUCCESS");
83
+ } catch (E) {
84
+ console.error(E), e("UPDATE_USER_DATA_ERROR");
85
+ }
86
+ return {};
87
+ },
88
+ async updateUserDrafts({ commit: e, state: t }) {
89
+ if (!t.userData.rtpToken) throw new Error("Requires RTP token");
90
+ const s = await _.getAllDatasetDrafts(), r = s.status === 200 && s.data;
91
+ e("SET_USER_DATA", { drafts: r });
92
+ },
93
+ async createDataset({ commit: e }, t) {
94
+ const a = {
95
+ method: "PUT",
96
+ url: t.url,
97
+ headers: {
98
+ "Content-Type": "application/json",
99
+ Authorization: `Bearer ${t.token}`
100
+ },
101
+ data: t.body
102
+ };
103
+ console.log("############", a);
104
+ const s = await n.request(a);
105
+ (s.status === 201 || s.status === 204) && (e("CHANGE_IS_EDIT_MODE", !1), e("CHANGE_IS_DRAFT", !1));
106
+ },
107
+ /**
108
+ * Creates a draft dataset
109
+ * @param {*} commit
110
+ * @param {object} dataset - The dataset object
111
+ * @param {string} dataset.id - The ID of the dataset
112
+ * @param {string} dataset.catalog - The ID of the dataset
113
+ * @param {object} dataset.description - The description object of the dataset containing different locales
114
+ * @param {object} dataset.title - The title object of the dataset containing different locales
115
+ * @param {object} dataset.body - the JSON-LD representation of the dataset
116
+ * @returns {Promise<Object>}
117
+ */
118
+ async createUserDraft({ commit: e }, { id: t, catalog: a, description: s = { en: "" }, title: r = { en: "" }, body: E = {} }) {
119
+ if (!_) return {};
120
+ e("UPDATE_USER_DATA_PENDING");
121
+ let D;
122
+ try {
123
+ D = await _.createDatasetDraft({
124
+ id: t,
125
+ catalogue: a,
126
+ body: E
127
+ }), e("CREATE_USER_DRAFT", {
128
+ id: t,
129
+ catalog: a,
130
+ description: s,
131
+ title: r,
132
+ body: E
133
+ }), e("UPDATE_USER_DATA_SUCCESS");
134
+ } catch (o) {
135
+ throw e("UPDATE_USER_DATA_ERROR"), o;
136
+ }
137
+ return D;
138
+ },
139
+ async deleteUserDraftById({ commit: e, state: t }, { id: a, catalog: s }) {
140
+ if (console.log(a), !_) return {};
141
+ if (!t.userData.drafts.find((D) => D.id === a)) return {};
142
+ e("UPDATE_USER_DATA_PENDING");
143
+ let E;
144
+ try {
145
+ E = await _.deleteDatasetDraft({ id: a, catalogue: s }), e("DELETE_USER_DRAFT", a), e("UPDATE_USER_DATA_SUCCESS");
146
+ } catch (D) {
147
+ throw e("UPDATE_USER_DATA_ERROR"), D;
148
+ }
149
+ return E;
150
+ },
151
+ async publishUserDraftById({ commit: e, state: t }, { id: a, catalog: s, body: r = {} }) {
152
+ if (!_) return {};
153
+ if (!t.userData.drafts.find((o) => o.id === a)) return {};
154
+ e("UPDATE_USER_DATA_PENDING");
155
+ let D;
156
+ try {
157
+ D = await _.publishDatasetDraft({
158
+ id: a,
159
+ catalogue: s,
160
+ body: r
161
+ }), e("DELETE_USER_DRAFT", a), e("UPDATE_USER_DATA_SUCCESS"), e("CHANGE_IS_DRAFT", !1), e("CHANGE_IS_EDIT_MODE", !1);
162
+ } catch (o) {
163
+ throw console.log("error"), e("UPDATE_USER_DATA_ERROR"), o;
164
+ }
165
+ return D;
166
+ },
167
+ async duplicateDataset({ commit: e, state: t }, { id: a, newId: s, catalog: r, url: E }) {
168
+ console.log(a, r, E);
169
+ const D = {
170
+ method: "GET",
171
+ url: E + "drafts/datasets/" + a + ".nt?catalogue=" + r
172
+ };
173
+ await n.request(D);
174
+ },
175
+ async publishUserDraft({ dispatch: e }, { id: t, catalog: a, body: s }) {
176
+ return e("publishUserDraftById", { id: t, catalog: a, body: s });
177
+ },
178
+ async putDatasetToDraft({ commit: e }, { id: t, catalog: a, title: s, description: r }) {
179
+ if (!_) return {};
180
+ e("UPDATE_USER_DATA_PENDING");
181
+ let E;
182
+ try {
183
+ console.log(t, a, s, r), E = await _.putDatasetToDraft({ id: t, catalogue: a }), e("PUT_DATASET_TO_DRAFT", {
184
+ id: t,
185
+ catalog: a,
186
+ title: s,
187
+ description: r
188
+ }), e("UPDATE_USER_DATA_SUCCESS");
189
+ } catch (D) {
190
+ throw e("UPDATE_USER_DATA_ERROR"), D;
191
+ }
192
+ return E;
193
+ },
194
+ setIsEditMode({ commit: e }, t) {
195
+ e("CHANGE_IS_EDIT_MODE", t);
196
+ },
197
+ setIsDraft({ commit: e }, t) {
198
+ e("CHANGE_IS_DRAFT", t);
199
+ },
200
+ async createPersistentIdentifier({ commit: e }, { id: t, catalog: a, type: s = "mock" }) {
201
+ if (!A) return {};
202
+ e("UPDATE_USER_DATA_PENDING");
203
+ let r;
204
+ try {
205
+ r = await A.createPersistentIdentifier({
206
+ id: t,
207
+ catalogue: a,
208
+ type: s
209
+ }), e("UPDATE_USER_DATA_SUCCESS");
210
+ } catch (E) {
211
+ throw e("UPDATE_USER_DATA_ERROR"), E;
212
+ }
213
+ return r;
214
+ },
215
+ populateDraftAndEdit({ commit: e }) {
216
+ e("PREDEFINE_DRAFT_AND_EDIT");
217
+ },
218
+ async createCatalogue({ commit: e }, t) {
219
+ const a = {
220
+ method: "PUT",
221
+ url: t.url,
222
+ headers: {
223
+ "Content-Type": "text/turtle",
224
+ Authorization: `Bearer ${t.token}`
225
+ },
226
+ data: t.data
227
+ }, s = await n.request(a);
228
+ if (s.status === 201 | s.status === 204) {
229
+ e("CHANGE_IS_EDIT_MODE", !1), e("CHANGE_IS_DRAFT", !1);
230
+ const r = u(d.userData), E = {
231
+ rsid: "",
232
+ rsname: t.id,
233
+ scopes: ["dataset:update", "dataset:delete", "dataset:create"]
234
+ };
235
+ r.permissions.push(E), e("SET_USER_DATA", r);
236
+ }
237
+ }
238
+ }, S = {
239
+ SECURITY_AUTH(e, t) {
240
+ e.authenticated = t;
241
+ },
242
+ RTP_TOKEN(e, t) {
243
+ e.rtptoken = t;
244
+ },
245
+ SET_KEYCLOAK(e, t) {
246
+ e.keycloak = t;
247
+ },
248
+ SET_USER_DATA(e, t) {
249
+ e.userData = { ...e.userData, ...t };
250
+ },
251
+ UPDATE_USER_DATA_PENDING(e) {
252
+ e.userData.pending = !0;
253
+ },
254
+ UPDATE_USER_DATA_SUCCESS(e) {
255
+ e.userData.pending = !1;
256
+ },
257
+ UPDATE_USER_DATA_ERROR(e) {
258
+ e.userData.pending = !1;
259
+ },
260
+ CREATE_USER_DRAFT(e, { id: t, catalog: a, title: s, description: r }) {
261
+ e.userData.drafts.push({
262
+ id: t,
263
+ catalog: a,
264
+ title: s,
265
+ description: r
266
+ });
267
+ },
268
+ PUT_DATASET_TO_DRAFT(e, { id: t, catalog: a, title: s, description: r }) {
269
+ e.userData.drafts.push({
270
+ id: t,
271
+ catalog: a,
272
+ title: s,
273
+ description: r
274
+ });
275
+ },
276
+ DELETE_USER_DRAFT(e, t) {
277
+ const a = e.userData.drafts.findIndex(
278
+ (s) => s.id === t
279
+ );
280
+ a > -1 && e.userData.drafts.splice(a, 1);
281
+ },
282
+ CHANGE_IS_EDIT_MODE(e, t) {
283
+ e.isEditMode = t, localStorage.setItem("dpi_editmode", t);
284
+ },
285
+ CHANGE_IS_DRAFT(e, t) {
286
+ e.isDraft = t, localStorage.setItem("dpi_draftmode", t);
287
+ },
288
+ PREDEFINE_DRAFT_AND_EDIT(e) {
289
+ const t = Object.keys(localStorage);
290
+ t.includes("dpi_editmode") && (e.isEditMode = JSON.parse(localStorage.getItem("dpi_editmode"))), t.includes("dpi_draftmode") && (e.isDraft = JSON.parse(localStorage.getItem("dpi_draftmode")));
291
+ }
292
+ }, C = {
293
+ namespaced: !0,
294
+ state: d,
295
+ actions: l,
296
+ mutations: S,
297
+ getters: U
298
+ };
299
+ export {
300
+ C as default
301
+ };
@@ -0,0 +1,34 @@
1
+ const l = {
2
+ catalog: {}
3
+ }, g = {
4
+ getCatalog: (a) => a.catalog
5
+ }, n = {
6
+ /**
7
+ * @description Loads details for the dataset with the given ID.
8
+ * @param commit
9
+ * @param state
10
+ * @param id {String} The dataset ID.
11
+ */
12
+ loadCatalog({ state: a, commit: o }, e) {
13
+ return new Promise((c, s) => {
14
+ this.$catalogService.getSingle(e).then((t) => {
15
+ o("SET_catalog", t), c(t);
16
+ }).catch((t) => {
17
+ console.error(t), s(t);
18
+ });
19
+ });
20
+ }
21
+ }, r = {
22
+ SET_catalog(a, o) {
23
+ a.catalog = o;
24
+ }
25
+ }, i = {
26
+ namespaced: !0,
27
+ state: l,
28
+ actions: n,
29
+ mutations: r,
30
+ getters: g
31
+ };
32
+ export {
33
+ i as default
34
+ };
@@ -0,0 +1,256 @@
1
+ const u = {
2
+ /**
3
+ * @property catalogs
4
+ * @type Array
5
+ * @description An array of catalogs.
6
+ */
7
+ catalogs: [],
8
+ datasetCounts: {},
9
+ loading: !1,
10
+ searchParameters: {
11
+ query: "",
12
+ fields: void 0,
13
+ limit: 10,
14
+ offset: 0,
15
+ facets: [],
16
+ facetOperator: "AND",
17
+ facetGroupOperator: "AND",
18
+ sort: "relevance+desc,modified+desc,title+asc"
19
+ },
20
+ availableFacets: [],
21
+ page: 1,
22
+ pageCount: 1,
23
+ catalogsCount: 0
24
+ }, r = {
25
+ getCatalogs: (e) => e.catalogs,
26
+ getCatalogsCount: (e) => e.catalogsCount,
27
+ getQuery: (e) => e.searchParameters.query,
28
+ getFields: (e) => e.searchParameters.fields,
29
+ getLimit: (e) => e.searchParameters.limit,
30
+ getLoading: (e) => e.loading,
31
+ getOffset: (e) => e.searchParameters.offset,
32
+ getFacets: (e) => e.searchParameters.facets,
33
+ getFacetOperator: (e) => e.searchParameters.facetOperator,
34
+ getFacetGroupOperator: (e) => e.searchParameters.facetGroupOperator,
35
+ getAvailableFacets: (e) => [
36
+ ...e.availableFacets,
37
+ {
38
+ id: "erpd",
39
+ items: [
40
+ { count: void 0, id: "true", title: "yes" },
41
+ { count: void 0, id: "false", title: "no" }
42
+ ],
43
+ title: "ERPD"
44
+ }
45
+ ],
46
+ getPage: (e) => e.page,
47
+ getPageCount: (e) => e.pageCount,
48
+ getSort: (e) => e.searchParameters.sort
49
+ }, E = {
50
+ /**
51
+ * @description Load all catalogs matching the given parameters.
52
+ * @param commit
53
+ * @param state
54
+ * @param options {Object} - Given search parameters
55
+ * @param options.query {String} - The given query string
56
+ * @param options.fields {String} - The given fields
57
+ * @param options.facets {Array} - The active facets
58
+ * @param options.limit {Number} - The maximum amount of catalogs to fetch
59
+ * @param options.page {Number} - The current page
60
+ * @param options.sort {String} - The sort method to use
61
+ * @param options.append {Boolean} - Decides whether current catalogs in state will be replaced or fetched catalogs appended.
62
+ */
63
+ loadCatalogs({ commit: e, state: a }, {
64
+ query: t = r.getQuery(a),
65
+ fields: o = r.getFields(a),
66
+ limit: c = r.getLimit(a),
67
+ page: l = r.getPage(a),
68
+ sort: g = r.getSort(a),
69
+ facetOperator: S = r.getFacetOperator(a),
70
+ facetGroupOperator: T = r.getFacetGroupOperator(a),
71
+ facets: _ = r.getFacets(a),
72
+ append: i = !1
73
+ }) {
74
+ return e("SET_LOADING", !0), new Promise((P, n) => {
75
+ this.$catalogService.get(t, o, c, l, g, S, T, _).then((s) => {
76
+ e("SET_FIEELDS", s.fields), e("SET_AVAILABLE_FACETS", s.availableFacets), e("SET_catalogS_COUNT", s.catalogsCount), e(i ? "ADD_catalogS" : "SET_catalogS", s.catalogs), e("SET_LOADING", !1), P();
77
+ }).catch((s) => {
78
+ console.error(s), e("SET_LOADING", !1), n(s);
79
+ });
80
+ });
81
+ },
82
+ /**
83
+ * @description Loads more catalogs.
84
+ * @param commit
85
+ * @param state
86
+ * @param {number} amount - The amount of catalogs to add.
87
+ */
88
+ loadAdditionalCatalogs({ commit: e, state: a }) {
89
+ const t = r.getPage(a);
90
+ E.loadCatalogs({ commit: e, state: a }, { page: t, append: !0 });
91
+ },
92
+ /**
93
+ * @description Autocomplete a query String by using a autocompletion service
94
+ * @param commit
95
+ * @param q {String} The Query to autocomplete
96
+ */
97
+ autocompleteQuery({ commit: e }, a) {
98
+ if (typeof this.$catalogService.autocomplete == "function")
99
+ return new Promise((t, o) => {
100
+ this.$catalogService.autocomplete(a).then((c) => {
101
+ t(c);
102
+ }).catch((c) => {
103
+ o(c);
104
+ });
105
+ });
106
+ },
107
+ /**
108
+ * @description Replace the current state facets by the given facets
109
+ * @param commit
110
+ * @param facets {Array} - The given facets
111
+ */
112
+ setFacets({ commit: e }, a) {
113
+ a && e("SET_FACETS", a);
114
+ },
115
+ /**
116
+ * @description Add the given facet to the states facets.
117
+ * @param commit
118
+ * @param params {Object} - The wrapped action parameters.
119
+ * @param params.field {String} - The field of the given facet
120
+ * @param params.facet {String} - The facet to add
121
+ */
122
+ addFacet({ commit: e }, { field: a, facet: t }) {
123
+ e("ADD_FACET", { field: a, facet: t });
124
+ },
125
+ /**
126
+ * @description Remove the given facet from the states facets.
127
+ * @param commit
128
+ * @param params {Object} - The wrapped action parameters.
129
+ * @param params.field {String} - The field of the given facet
130
+ * @param params.facet {String} - The facet to remove
131
+ */
132
+ removeFacet({ commit: e }, { field: a, facet: t }) {
133
+ e("REMOVE_FACET", { field: a, facet: t });
134
+ },
135
+ /**
136
+ * @description Remove the given facet from the states facets.
137
+ * @param commit
138
+ * @param operator {String} - The facet operator to set. Possible Operators : ['AND', 'OR'].
139
+ */
140
+ setFacetOperator({ commit: e }, a) {
141
+ e("SET_FACET_OPERATOR", a);
142
+ },
143
+ /**
144
+ * @description Remove the given facet from the states facets.
145
+ * @param commit
146
+ * @param operator {String} - The facet operator to set. Possible Operators : ['AND', 'OR'].
147
+ */
148
+ setFacetGroupOperator({ commit: e }, a) {
149
+ e("SET_FACET_GROUP_OPERATOR", a);
150
+ },
151
+ /**
152
+ * @description Handles page changes by through URL query.
153
+ * @param commit
154
+ * @param state
155
+ * @param page {String} The given page number as a String
156
+ */
157
+ setPage({ commit: e }, a) {
158
+ e("SET_PAGE", a);
159
+ },
160
+ setPageCount({ commit: e }, a) {
161
+ e("SET_PAGE_COUNT", a);
162
+ },
163
+ /**
164
+ * @description Replace the current state query by the given query
165
+ * @param commit
166
+ * @param query {String} - The given query
167
+ */
168
+ setQuery({ commit: e }, a) {
169
+ e("SET_QUERY", a);
170
+ },
171
+ setFields({ commit: e }, a) {
172
+ e("SET_FIELDS", a);
173
+ },
174
+ /**
175
+ * @description Replace the current sort method
176
+ * @param commit
177
+ * @param sort {String} - The given sort method to use now
178
+ */
179
+ setSort({ commit: e }, a) {
180
+ e("SET_SORT", a);
181
+ },
182
+ setLimit({ commit: e }, a = 10) {
183
+ e("SET_LIMIT", a);
184
+ },
185
+ setLoading({ commit: e }, a) {
186
+ e("SET_LOADING", a);
187
+ },
188
+ setCatalogs({ commit: e }, a) {
189
+ e("SET_catalogS", a);
190
+ },
191
+ setCatalogsCount({ commit: e }, a) {
192
+ e("SET_catalogS_COUNT", a);
193
+ }
194
+ }, A = {
195
+ SET_catalogS(e, a) {
196
+ e.catalogs = a;
197
+ },
198
+ ADD_catalogS(e, a) {
199
+ e.catalogs = e.catalogs.concat(a);
200
+ },
201
+ SET_LIMIT(e, a) {
202
+ e.searchParameters.limit = a;
203
+ },
204
+ SET_OFFSET(e, a) {
205
+ e.searchParameters.offset = a;
206
+ },
207
+ SET_FACETS(e, a) {
208
+ e.searchParameters.facets = a;
209
+ },
210
+ ADD_FACET(e, { field: a, facet: t }) {
211
+ Object.prototype.hasOwnProperty.call(e.searchParameters.facets, a) ? e.searchParameters.facets[a].push(t) : e.searchParameters.facets[a] = [t];
212
+ },
213
+ REMOVE_FACET(e, { field: a, facet: t }) {
214
+ const o = e.searchParameters.facets[a].indexOf(t);
215
+ e.searchParameters.facets[a].splice(o, 1);
216
+ },
217
+ SET_AVAILABLE_FACETS(e, a) {
218
+ e.availableFacets = a;
219
+ },
220
+ SET_catalogS_COUNT(e, a) {
221
+ e.catalogsCount = a;
222
+ },
223
+ SET_FACET_OPERATOR(e, a) {
224
+ e.searchParameters.facetOperator = a;
225
+ },
226
+ SET_FACET_GROUP_OPERATOR(e, a) {
227
+ e.searchParameters.facetGroupOperator = a;
228
+ },
229
+ SET_PAGE(e, a) {
230
+ e.page = a;
231
+ },
232
+ SET_PAGE_COUNT(e, a) {
233
+ e.pageCount = a;
234
+ },
235
+ SET_QUERY(e, a) {
236
+ e.searchParameters.query = a;
237
+ },
238
+ SET_FIELDS(e, a) {
239
+ e.searchParameters.fields = a;
240
+ },
241
+ SET_SORT(e, a) {
242
+ e.searchParameters.sort = a;
243
+ },
244
+ SET_LOADING(e, a) {
245
+ e.loading = a;
246
+ }
247
+ }, O = {
248
+ namespaced: !0,
249
+ state: u,
250
+ actions: E,
251
+ mutations: A,
252
+ getters: r
253
+ };
254
+ export {
255
+ O as default
256
+ };