@appbaseio/reactivesearch-vue 1.33.1 → 1.33.3
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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +2888 -6530
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +7 -9
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
- package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
- package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
- package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
- package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
- package/dist/cjs/{DataSearch-c42d8681.js → DataSearch-e4822dbf.js} +131 -299
- package/dist/cjs/DataSearch.js +11 -11
- package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
- package/dist/cjs/DynamicRangeSlider.js +44 -93
- package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
- package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
- package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
- package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
- package/dist/cjs/MultiDropdownList.js +41 -102
- package/dist/cjs/MultiList.js +35 -98
- package/dist/cjs/MultiRange.js +27 -53
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-4707bd94.js → PreferencesConsumer-5d67b486.js} +8 -18
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +66 -81
- package/dist/cjs/{ReactiveComponent-63ef70c2.js → ReactiveComponent-b8efb0cf.js} +118 -301
- package/dist/cjs/ReactiveComponent.js +20 -20
- package/dist/cjs/ReactiveGoogleMap.js +167 -353
- package/dist/cjs/ReactiveList.js +88 -176
- package/dist/cjs/ResultCard.js +10 -18
- package/dist/cjs/ResultList.js +13 -24
- package/dist/cjs/SelectedFilters.js +16 -34
- package/dist/cjs/SingleDropdownList.js +35 -75
- package/dist/cjs/SingleList.js +29 -75
- package/dist/cjs/SingleRange.js +17 -40
- package/dist/cjs/StateProvider.js +28 -32
- package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
- package/dist/cjs/ToggleButton.js +20 -58
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
- package/dist/cjs/index.js +21 -22
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +21 -21
- package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
- package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
- package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
- package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
- package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
- package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
- package/dist/es/{DataSearch-d56bf07a.js → DataSearch-5ddfba23.js} +131 -299
- package/dist/es/DataSearch.js +11 -11
- package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
- package/dist/es/DynamicRangeSlider.js +44 -93
- package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
- package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
- package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
- package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
- package/dist/es/MultiDropdownList.js +41 -102
- package/dist/es/MultiList.js +35 -98
- package/dist/es/MultiRange.js +27 -53
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-4169deb1.js → PreferencesConsumer-bc097ebb.js} +8 -18
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +66 -81
- package/dist/es/{ReactiveComponent-9e4721e1.js → ReactiveComponent-59107264.js} +118 -301
- package/dist/es/ReactiveComponent.js +20 -20
- package/dist/es/ReactiveGoogleMap.js +167 -353
- package/dist/es/ReactiveList.js +88 -176
- package/dist/es/ResultCard.js +10 -18
- package/dist/es/ResultList.js +13 -24
- package/dist/es/SelectedFilters.js +16 -34
- package/dist/es/SingleDropdownList.js +35 -75
- package/dist/es/SingleList.js +29 -75
- package/dist/es/SingleRange.js +17 -40
- package/dist/es/StateProvider.js +29 -33
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
- package/dist/es/ToggleButton.js +20 -58
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
- package/dist/es/index.js +21 -22
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +21 -21
- package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
- package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
- package/package.json +3 -2
package/dist/es/ReactiveBase.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import configureStore, { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
2
|
import '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import { isEqual as isEqual$1, transformRequestUsingEndpoint } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
6
6
|
import styled from '@appbaseio/vue-emotion';
|
|
7
|
-
import { t as types } from './vueTypes-
|
|
7
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
8
8
|
import 'redux';
|
|
9
|
-
import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-
|
|
9
|
+
import { c as connect, e as composeThemeObject, X as X_SEARCH_CLIENT } from './index-0444a498.js';
|
|
10
10
|
import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
|
|
11
11
|
import { updateAnalyticsConfig } from '@appbaseio/reactivecore/lib/actions/analytics';
|
|
12
12
|
import Appbase from 'appbase-js';
|
|
13
|
+
import AppbaseAnalytics from '@appbaseio/analytics';
|
|
13
14
|
import 'url-search-params-polyfill';
|
|
14
15
|
|
|
15
16
|
var Provider = {
|
|
@@ -22,21 +23,24 @@ var Provider = {
|
|
|
22
23
|
if (!store.dispatch && !store.subscribe && !store.getState) {
|
|
23
24
|
throw new Error('[reactivesearch-vue] - store provided is not a valid redux store');
|
|
24
25
|
}
|
|
25
|
-
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
|
+
},
|
|
29
|
+
analyticsRef: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: true
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
provide: function provide() {
|
|
31
35
|
return {
|
|
32
|
-
$$store: this.store
|
|
36
|
+
$$store: this.store,
|
|
37
|
+
$analytics: this.analyticsRef
|
|
33
38
|
};
|
|
34
39
|
},
|
|
35
40
|
render: function render(h) {
|
|
36
41
|
if (this.$slots["default"].length > 1) {
|
|
37
42
|
return h('div', this.$slots["default"]);
|
|
38
43
|
}
|
|
39
|
-
|
|
40
44
|
return this.$slots["default"][0];
|
|
41
45
|
}
|
|
42
46
|
};
|
|
@@ -46,9 +50,9 @@ var Base = {
|
|
|
46
50
|
functional: true,
|
|
47
51
|
render: function render(h, _ref) {
|
|
48
52
|
var _ref$data$attrs$as = _ref.data.attrs.as,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
|
|
54
|
+
props = _ref.data,
|
|
55
|
+
children = _ref.children;
|
|
52
56
|
delete props.attrs.as;
|
|
53
57
|
return h(T, _mergeJSXProps([{}, props]), [children]);
|
|
54
58
|
}
|
|
@@ -68,7 +72,7 @@ var Base$1 = styled(Base)(_templateObject || (_templateObject = _taggedTemplateL
|
|
|
68
72
|
});
|
|
69
73
|
|
|
70
74
|
var setHeaders = Actions.setHeaders,
|
|
71
|
-
|
|
75
|
+
setValue = Actions.setValue;
|
|
72
76
|
var isEqual = helper.isEqual;
|
|
73
77
|
var URLParamsProvider = {
|
|
74
78
|
name: 'URLParamsProvider',
|
|
@@ -81,32 +85,27 @@ var URLParamsProvider = {
|
|
|
81
85
|
},
|
|
82
86
|
mounted: function mounted() {
|
|
83
87
|
var _this = this;
|
|
84
|
-
|
|
85
88
|
this.init();
|
|
86
|
-
|
|
87
89
|
window.onpopstate = function () {
|
|
88
90
|
_this.init();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
var activeComponents = Array.from(_this.params.keys());
|
|
92
|
+
// remove inactive components from selectedValues
|
|
92
93
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
93
94
|
return !activeComponents.includes(item);
|
|
94
95
|
}).forEach(function (component) {
|
|
95
96
|
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
96
|
-
});
|
|
97
|
-
|
|
97
|
+
});
|
|
98
|
+
// update active components in selectedValues
|
|
98
99
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
99
100
|
try {
|
|
100
101
|
var component = item[0],
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
value = item[1];
|
|
103
103
|
var _ref = _this.selectedValues[component] || {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
label: component
|
|
105
|
+
},
|
|
106
|
+
label = _ref.label,
|
|
107
|
+
showFilter = _ref.showFilter,
|
|
108
|
+
URLParams = _ref.URLParams;
|
|
110
109
|
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
111
110
|
} catch (e) {
|
|
112
111
|
// Do not set value if JSON parsing fails.
|
|
@@ -124,7 +123,6 @@ var URLParamsProvider = {
|
|
|
124
123
|
},
|
|
125
124
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
126
125
|
var _this2 = this;
|
|
127
|
-
|
|
128
126
|
if (!isEqual(newVal, oldVal)) {
|
|
129
127
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
130
128
|
this.params = new URLSearchParams(this.searchString);
|
|
@@ -134,8 +132,8 @@ var URLParamsProvider = {
|
|
|
134
132
|
currentComponents.filter(function (component) {
|
|
135
133
|
return newVal[component].URLParams;
|
|
136
134
|
}).forEach(function (component) {
|
|
137
|
-
var selectedValues = newVal[component];
|
|
138
|
-
|
|
135
|
+
var selectedValues = newVal[component];
|
|
136
|
+
// prevents empty history pollution on initial load
|
|
139
137
|
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
140
138
|
if (selectedValues.URLParams) {
|
|
141
139
|
if (selectedValues.category) {
|
|
@@ -143,48 +141,41 @@ var URLParamsProvider = {
|
|
|
143
141
|
category: selectedValues.category,
|
|
144
142
|
value: selectedValues.value
|
|
145
143
|
}));
|
|
146
|
-
|
|
147
144
|
if (shouldUpdateHistory) {
|
|
148
145
|
shouldPushHistory = true;
|
|
149
146
|
}
|
|
150
147
|
} else {
|
|
151
148
|
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
152
|
-
|
|
153
149
|
if (_shouldUpdateHistory) {
|
|
154
150
|
shouldPushHistory = true;
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
} else {
|
|
158
154
|
_this2.params["delete"](component);
|
|
159
|
-
|
|
160
155
|
shouldPushHistory = true;
|
|
161
156
|
}
|
|
162
157
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
163
158
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
164
159
|
_this2.params["delete"](component);
|
|
165
|
-
|
|
166
160
|
shouldPushHistory = true;
|
|
167
161
|
}
|
|
168
|
-
});
|
|
162
|
+
});
|
|
169
163
|
|
|
164
|
+
// remove unmounted components
|
|
170
165
|
Object.keys(newVal).filter(function (component) {
|
|
171
166
|
return !currentComponents.includes(component);
|
|
172
167
|
}).forEach(function (component) {
|
|
173
168
|
_this2.params["delete"](component);
|
|
174
|
-
|
|
175
169
|
shouldPushHistory = true;
|
|
176
170
|
});
|
|
177
|
-
|
|
178
171
|
if (!currentComponents.length) {
|
|
179
172
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
180
173
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
181
174
|
_this2.params["delete"](item);
|
|
182
|
-
|
|
183
175
|
shouldPushHistory = true;
|
|
184
176
|
}
|
|
185
177
|
});
|
|
186
178
|
}
|
|
187
|
-
|
|
188
179
|
if (shouldPushHistory) {
|
|
189
180
|
this.pushToHistory();
|
|
190
181
|
}
|
|
@@ -208,10 +199,8 @@ var URLParamsProvider = {
|
|
|
208
199
|
// search on homepage -> route changes -> search results page with same search query
|
|
209
200
|
if (window) {
|
|
210
201
|
var searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
211
|
-
|
|
212
202
|
if (searchString !== this.searchString) {
|
|
213
203
|
var event;
|
|
214
|
-
|
|
215
204
|
if (typeof Event === 'function') {
|
|
216
205
|
event = new Event('popstate');
|
|
217
206
|
} else {
|
|
@@ -219,7 +208,6 @@ var URLParamsProvider = {
|
|
|
219
208
|
event = document.createEvent('Event');
|
|
220
209
|
event.initEvent('popstate', true, true);
|
|
221
210
|
}
|
|
222
|
-
|
|
223
211
|
window.dispatchEvent(event);
|
|
224
212
|
}
|
|
225
213
|
}
|
|
@@ -231,20 +219,17 @@ var URLParamsProvider = {
|
|
|
231
219
|
},
|
|
232
220
|
getValue: function getValue(value) {
|
|
233
221
|
var _this3 = this;
|
|
234
|
-
|
|
235
222
|
if (Array.isArray(value) && value.length) {
|
|
236
223
|
return value.map(function (item) {
|
|
237
224
|
return _this3.getValue(item);
|
|
238
225
|
});
|
|
239
226
|
}
|
|
240
|
-
|
|
241
227
|
if (value && typeof value === 'object') {
|
|
242
228
|
// TODO: support for NestedList
|
|
243
229
|
if (value.location) return value;
|
|
244
230
|
if (value.category) return value;
|
|
245
231
|
return value.label || value.key || null;
|
|
246
232
|
}
|
|
247
|
-
|
|
248
233
|
return value;
|
|
249
234
|
},
|
|
250
235
|
setURL: function setURL(component, value) {
|
|
@@ -252,21 +237,17 @@ var URLParamsProvider = {
|
|
|
252
237
|
this.params["delete"](component);
|
|
253
238
|
return true;
|
|
254
239
|
}
|
|
255
|
-
|
|
256
240
|
var data = JSON.stringify(value);
|
|
257
|
-
|
|
258
241
|
if (data !== this.params.get(component)) {
|
|
259
242
|
this.params.set(component, data);
|
|
260
243
|
return true;
|
|
261
244
|
}
|
|
262
|
-
|
|
263
245
|
return false;
|
|
264
246
|
},
|
|
265
247
|
pushToHistory: function pushToHistory() {
|
|
266
248
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
|
267
249
|
var base = window.location.href.split('?')[0];
|
|
268
250
|
var newURL = "" + base + paramsSting;
|
|
269
|
-
|
|
270
251
|
if (this.$props.setSearchParams) {
|
|
271
252
|
this.$props.setSearchParams(newURL);
|
|
272
253
|
} else if (window.history.pushState) {
|
|
@@ -274,7 +255,6 @@ var URLParamsProvider = {
|
|
|
274
255
|
path: newURL
|
|
275
256
|
}, '', newURL);
|
|
276
257
|
}
|
|
277
|
-
|
|
278
258
|
this.init();
|
|
279
259
|
}
|
|
280
260
|
},
|
|
@@ -289,23 +269,19 @@ var URLParamsProvider = {
|
|
|
289
269
|
}, [children]);
|
|
290
270
|
}
|
|
291
271
|
};
|
|
292
|
-
|
|
293
272
|
var mapStateToProps = function mapStateToProps(state) {
|
|
294
273
|
return {
|
|
295
274
|
selectedValues: state.selectedValues,
|
|
296
275
|
searchComponents: state.components
|
|
297
276
|
};
|
|
298
277
|
};
|
|
299
|
-
|
|
300
278
|
var mapDispatchtoProps = {
|
|
301
279
|
setHeaders: setHeaders,
|
|
302
280
|
setValue: setValue
|
|
303
281
|
};
|
|
304
|
-
|
|
305
282
|
URLParamsProvider.install = function (Vue) {
|
|
306
283
|
Vue.component(URLParamsProvider.name, URLParamsProvider);
|
|
307
284
|
};
|
|
308
|
-
|
|
309
285
|
var URLParamsProvider$1 = connect(mapStateToProps, mapDispatchtoProps)(URLParamsProvider);
|
|
310
286
|
|
|
311
287
|
var typography = {
|
|
@@ -339,7 +315,6 @@ function getTheme(preset) {
|
|
|
339
315
|
if (preset === 'light') {
|
|
340
316
|
return light;
|
|
341
317
|
}
|
|
342
|
-
|
|
343
318
|
return dark;
|
|
344
319
|
}
|
|
345
320
|
|
|
@@ -356,8 +331,7 @@ var ReactiveBase = {
|
|
|
356
331
|
},
|
|
357
332
|
mounted: function mounted() {
|
|
358
333
|
var enableAppbase = this.enableAppbase,
|
|
359
|
-
|
|
360
|
-
|
|
334
|
+
endpoint = this.endpoint;
|
|
361
335
|
if (!enableAppbase && endpoint) {
|
|
362
336
|
console.warn('Warning(ReactiveSearch): The `endpoint` prop works only when `enableAppbase` prop is set to true.');
|
|
363
337
|
}
|
|
@@ -427,15 +401,13 @@ var ReactiveBase = {
|
|
|
427
401
|
computed: {
|
|
428
402
|
getHeaders: function getHeaders() {
|
|
429
403
|
var _this$$props = this.$props,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
404
|
+
enableAppbase = _this$$props.enableAppbase,
|
|
405
|
+
headers = _this$$props.headers,
|
|
406
|
+
appbaseConfig = _this$$props.appbaseConfig,
|
|
407
|
+
mongodb = _this$$props.mongodb,
|
|
408
|
+
endpoint = _this$$props.endpoint;
|
|
436
409
|
var _ref = appbaseConfig || {},
|
|
437
|
-
|
|
438
|
-
|
|
410
|
+
enableTelemetry = _ref.enableTelemetry;
|
|
439
411
|
return _extends({}, enableAppbase && !mongodb && _extends({
|
|
440
412
|
'X-Search-Client': X_SEARCH_CLIENT
|
|
441
413
|
}, enableTelemetry === false && {
|
|
@@ -451,7 +423,6 @@ var ReactiveBase = {
|
|
|
451
423
|
setStore: function setStore(props) {
|
|
452
424
|
var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
|
|
453
425
|
var url = props.url && props.url.trim() !== '' ? props.url : '';
|
|
454
|
-
|
|
455
426
|
if (props.enableAppbase && props.endpoint) {
|
|
456
427
|
if (props.endpoint.url) {
|
|
457
428
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -460,7 +431,6 @@ var ReactiveBase = {
|
|
|
460
431
|
throw Error('Error(ReactiveSearch): The `endpoint` prop object requires `url` property.');
|
|
461
432
|
}
|
|
462
433
|
}
|
|
463
|
-
|
|
464
434
|
var config = {
|
|
465
435
|
url: url,
|
|
466
436
|
app: props.app,
|
|
@@ -475,51 +445,65 @@ var ReactiveBase = {
|
|
|
475
445
|
endpoint: props.endpoint
|
|
476
446
|
};
|
|
477
447
|
var queryParams = '';
|
|
478
|
-
|
|
479
448
|
if (typeof window !== 'undefined') {
|
|
480
449
|
queryParams = window.location.search;
|
|
481
450
|
} else {
|
|
482
451
|
queryParams = props.queryParams || '';
|
|
483
452
|
}
|
|
484
|
-
|
|
485
453
|
var params = new URLSearchParams(queryParams);
|
|
486
454
|
var selectedValues = {};
|
|
487
455
|
var urlValues = {};
|
|
488
456
|
Array.from(params.keys()).forEach(function (key) {
|
|
489
457
|
try {
|
|
490
458
|
var _extends2, _extends3;
|
|
491
|
-
|
|
492
459
|
var parsedParams = JSON.parse(params.get(key));
|
|
493
460
|
var selectedValue = {};
|
|
494
|
-
|
|
495
461
|
if (parsedParams.value) {
|
|
496
462
|
selectedValue.value = parsedParams.value;
|
|
497
463
|
} else {
|
|
498
464
|
selectedValue.value = parsedParams;
|
|
499
465
|
}
|
|
500
|
-
|
|
501
466
|
if (parsedParams.category) selectedValue.category = parsedParams.category;
|
|
502
467
|
selectedValue.reference = 'URL';
|
|
503
468
|
selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
|
|
504
469
|
urlValues = _extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
|
|
505
|
-
} catch (e) {
|
|
470
|
+
} catch (e) {
|
|
471
|
+
// Do not add to selectedValues if JSON parsing fails.
|
|
506
472
|
}
|
|
507
473
|
});
|
|
508
474
|
var themePreset = props.themePreset,
|
|
509
|
-
|
|
510
|
-
|
|
475
|
+
enableAppbase = props.enableAppbase,
|
|
476
|
+
endpoint = props.endpoint;
|
|
511
477
|
var appbaseRef = Appbase(config);
|
|
512
|
-
|
|
513
478
|
appbaseRef.transformRequest = function (request) {
|
|
514
479
|
var modifiedRequest = enableAppbase ? transformRequestUsingEndpoint(request, endpoint) : request;
|
|
515
480
|
if (props.transformRequest) return props.transformRequest(modifiedRequest);
|
|
516
481
|
return modifiedRequest;
|
|
517
482
|
};
|
|
518
|
-
|
|
519
483
|
if (this.$props.transformResponse) {
|
|
520
484
|
appbaseRef.transformResponse = this.$props.transformResponse;
|
|
521
485
|
}
|
|
522
|
-
|
|
486
|
+
var analyticsInitConfig = {
|
|
487
|
+
url: url && url.replace(/\/\/.*@/, '//'),
|
|
488
|
+
credentials: appbaseRef.credentials,
|
|
489
|
+
// When endpoint prop is used index is not defined, so we use _default
|
|
490
|
+
index: appbaseRef.app || '_default',
|
|
491
|
+
globalCustomEvents: this.$props.appbaseConfig && this.$props.appbaseConfig.customEvents
|
|
492
|
+
};
|
|
493
|
+
try {
|
|
494
|
+
if (this.$props.endpoint && this.$props.endpoint.url) {
|
|
495
|
+
// Remove parts between '//' and first '/' in the url
|
|
496
|
+
analyticsInitConfig.url = this.$props.endpoint.url.replace(/\/\/(.*?)\/.*/, '//$1');
|
|
497
|
+
var headerCredentials = this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
|
|
498
|
+
analyticsInitConfig.credentials = headerCredentials && headerCredentials.replace('Basic ', '');
|
|
499
|
+
// Decode the credentials
|
|
500
|
+
analyticsInitConfig.credentials = analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
|
|
501
|
+
}
|
|
502
|
+
} catch (e) {
|
|
503
|
+
console.error('Endpoint not set correctly for analytics');
|
|
504
|
+
console.error(e);
|
|
505
|
+
}
|
|
506
|
+
var analyticsRef = AppbaseAnalytics.init(analyticsInitConfig);
|
|
523
507
|
var initialState = _extends({
|
|
524
508
|
config: _extends({}, config, {
|
|
525
509
|
initialQueriesSyncTime: props.initialQueriesSyncTime,
|
|
@@ -528,23 +512,25 @@ var ReactiveBase = {
|
|
|
528
512
|
themePreset: themePreset
|
|
529
513
|
}),
|
|
530
514
|
appbaseRef: appbaseRef,
|
|
515
|
+
analyticsRef: analyticsRef,
|
|
531
516
|
selectedValues: selectedValues,
|
|
532
517
|
urlValues: urlValues,
|
|
533
518
|
headers: this.getHeaders
|
|
534
519
|
}, this.$props.initialState);
|
|
535
|
-
|
|
536
520
|
this.store = configureStore(initialState);
|
|
521
|
+
this.analyticsRef = analyticsRef;
|
|
537
522
|
}
|
|
538
523
|
},
|
|
539
524
|
render: function render() {
|
|
540
525
|
var h = arguments[0];
|
|
541
526
|
var children = this.$slots["default"];
|
|
542
527
|
var _this$$props2 = this.$props,
|
|
543
|
-
|
|
544
|
-
|
|
528
|
+
style = _this$$props2.style,
|
|
529
|
+
className = _this$$props2.className;
|
|
545
530
|
return h(Provider, {
|
|
546
531
|
"attrs": {
|
|
547
|
-
"store": this.store
|
|
532
|
+
"store": this.store,
|
|
533
|
+
"analyticsRef": this.analyticsRef
|
|
548
534
|
}
|
|
549
535
|
}, [h(URLParamsProvider$1, {
|
|
550
536
|
"attrs": {
|
|
@@ -558,7 +544,6 @@ var ReactiveBase = {
|
|
|
558
544
|
}, [children])]);
|
|
559
545
|
}
|
|
560
546
|
};
|
|
561
|
-
|
|
562
547
|
ReactiveBase.install = function (Vue) {
|
|
563
548
|
Vue.component(ReactiveBase.name, ReactiveBase);
|
|
564
549
|
};
|