@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/cjs/ReactiveBase.js
CHANGED
|
@@ -7,17 +7,18 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var configureStore = require('@appbaseio/reactivecore');
|
|
8
8
|
var configureStore__default = _interopDefault(configureStore);
|
|
9
9
|
require('@appbaseio/reactivecore/lib/utils/constants');
|
|
10
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
10
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
|
|
11
11
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
12
12
|
var helper = require('@appbaseio/reactivecore/lib/utils/helper');
|
|
13
13
|
var styled = require('@appbaseio/vue-emotion');
|
|
14
14
|
var styled__default = _interopDefault(styled);
|
|
15
|
-
var vueTypes = require('./vueTypes-
|
|
15
|
+
var vueTypes = require('./vueTypes-7cfc2f98.js');
|
|
16
16
|
require('redux');
|
|
17
|
-
var index = require('./index-
|
|
17
|
+
var index = require('./index-30126fd0.js');
|
|
18
18
|
var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
|
|
19
19
|
var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
|
|
20
20
|
var Appbase = _interopDefault(require('appbase-js'));
|
|
21
|
+
var AppbaseAnalytics = _interopDefault(require('@appbaseio/analytics'));
|
|
21
22
|
require('url-search-params-polyfill');
|
|
22
23
|
|
|
23
24
|
var Provider = {
|
|
@@ -30,21 +31,24 @@ var Provider = {
|
|
|
30
31
|
if (!store.dispatch && !store.subscribe && !store.getState) {
|
|
31
32
|
throw new Error('[reactivesearch-vue] - store provided is not a valid redux store');
|
|
32
33
|
}
|
|
33
|
-
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
|
+
},
|
|
37
|
+
analyticsRef: {
|
|
38
|
+
type: Object,
|
|
39
|
+
required: true
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
provide: function provide() {
|
|
39
43
|
return {
|
|
40
|
-
$$store: this.store
|
|
44
|
+
$$store: this.store,
|
|
45
|
+
$analytics: this.analyticsRef
|
|
41
46
|
};
|
|
42
47
|
},
|
|
43
48
|
render: function render(h) {
|
|
44
49
|
if (this.$slots["default"].length > 1) {
|
|
45
50
|
return h('div', this.$slots["default"]);
|
|
46
51
|
}
|
|
47
|
-
|
|
48
52
|
return this.$slots["default"][0];
|
|
49
53
|
}
|
|
50
54
|
};
|
|
@@ -54,9 +58,9 @@ var Base = {
|
|
|
54
58
|
functional: true,
|
|
55
59
|
render: function render(h, _ref) {
|
|
56
60
|
var _ref$data$attrs$as = _ref.data.attrs.as,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
T = _ref$data$attrs$as === void 0 ? 'div' : _ref$data$attrs$as,
|
|
62
|
+
props = _ref.data,
|
|
63
|
+
children = _ref.children;
|
|
60
64
|
delete props.attrs.as;
|
|
61
65
|
return h(T, _mergeJSXProps([{}, props]), [children]);
|
|
62
66
|
}
|
|
@@ -76,7 +80,7 @@ var Base$1 = styled__default(Base)(_templateObject || (_templateObject = _rollup
|
|
|
76
80
|
});
|
|
77
81
|
|
|
78
82
|
var setHeaders = configureStore.Actions.setHeaders,
|
|
79
|
-
|
|
83
|
+
setValue = configureStore.Actions.setValue;
|
|
80
84
|
var isEqual = configureStore.helper.isEqual;
|
|
81
85
|
var URLParamsProvider = {
|
|
82
86
|
name: 'URLParamsProvider',
|
|
@@ -89,32 +93,27 @@ var URLParamsProvider = {
|
|
|
89
93
|
},
|
|
90
94
|
mounted: function mounted() {
|
|
91
95
|
var _this = this;
|
|
92
|
-
|
|
93
96
|
this.init();
|
|
94
|
-
|
|
95
97
|
window.onpopstate = function () {
|
|
96
98
|
_this.init();
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
var activeComponents = Array.from(_this.params.keys());
|
|
100
|
+
// remove inactive components from selectedValues
|
|
100
101
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
101
102
|
return !activeComponents.includes(item);
|
|
102
103
|
}).forEach(function (component) {
|
|
103
104
|
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
104
|
-
});
|
|
105
|
-
|
|
105
|
+
});
|
|
106
|
+
// update active components in selectedValues
|
|
106
107
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
107
108
|
try {
|
|
108
109
|
var component = item[0],
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
value = item[1];
|
|
111
111
|
var _ref = _this.selectedValues[component] || {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
label: component
|
|
113
|
+
},
|
|
114
|
+
label = _ref.label,
|
|
115
|
+
showFilter = _ref.showFilter,
|
|
116
|
+
URLParams = _ref.URLParams;
|
|
118
117
|
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
119
118
|
} catch (e) {
|
|
120
119
|
// Do not set value if JSON parsing fails.
|
|
@@ -132,7 +131,6 @@ var URLParamsProvider = {
|
|
|
132
131
|
},
|
|
133
132
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
134
133
|
var _this2 = this;
|
|
135
|
-
|
|
136
134
|
if (!isEqual(newVal, oldVal)) {
|
|
137
135
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
138
136
|
this.params = new URLSearchParams(this.searchString);
|
|
@@ -142,8 +140,8 @@ var URLParamsProvider = {
|
|
|
142
140
|
currentComponents.filter(function (component) {
|
|
143
141
|
return newVal[component].URLParams;
|
|
144
142
|
}).forEach(function (component) {
|
|
145
|
-
var selectedValues = newVal[component];
|
|
146
|
-
|
|
143
|
+
var selectedValues = newVal[component];
|
|
144
|
+
// prevents empty history pollution on initial load
|
|
147
145
|
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
148
146
|
if (selectedValues.URLParams) {
|
|
149
147
|
if (selectedValues.category) {
|
|
@@ -151,48 +149,41 @@ var URLParamsProvider = {
|
|
|
151
149
|
category: selectedValues.category,
|
|
152
150
|
value: selectedValues.value
|
|
153
151
|
}));
|
|
154
|
-
|
|
155
152
|
if (shouldUpdateHistory) {
|
|
156
153
|
shouldPushHistory = true;
|
|
157
154
|
}
|
|
158
155
|
} else {
|
|
159
156
|
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
160
|
-
|
|
161
157
|
if (_shouldUpdateHistory) {
|
|
162
158
|
shouldPushHistory = true;
|
|
163
159
|
}
|
|
164
160
|
}
|
|
165
161
|
} else {
|
|
166
162
|
_this2.params["delete"](component);
|
|
167
|
-
|
|
168
163
|
shouldPushHistory = true;
|
|
169
164
|
}
|
|
170
165
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
171
166
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
172
167
|
_this2.params["delete"](component);
|
|
173
|
-
|
|
174
168
|
shouldPushHistory = true;
|
|
175
169
|
}
|
|
176
|
-
});
|
|
170
|
+
});
|
|
177
171
|
|
|
172
|
+
// remove unmounted components
|
|
178
173
|
Object.keys(newVal).filter(function (component) {
|
|
179
174
|
return !currentComponents.includes(component);
|
|
180
175
|
}).forEach(function (component) {
|
|
181
176
|
_this2.params["delete"](component);
|
|
182
|
-
|
|
183
177
|
shouldPushHistory = true;
|
|
184
178
|
});
|
|
185
|
-
|
|
186
179
|
if (!currentComponents.length) {
|
|
187
180
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
188
181
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
189
182
|
_this2.params["delete"](item);
|
|
190
|
-
|
|
191
183
|
shouldPushHistory = true;
|
|
192
184
|
}
|
|
193
185
|
});
|
|
194
186
|
}
|
|
195
|
-
|
|
196
187
|
if (shouldPushHistory) {
|
|
197
188
|
this.pushToHistory();
|
|
198
189
|
}
|
|
@@ -216,10 +207,8 @@ var URLParamsProvider = {
|
|
|
216
207
|
// search on homepage -> route changes -> search results page with same search query
|
|
217
208
|
if (window) {
|
|
218
209
|
var searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
219
|
-
|
|
220
210
|
if (searchString !== this.searchString) {
|
|
221
211
|
var event;
|
|
222
|
-
|
|
223
212
|
if (typeof Event === 'function') {
|
|
224
213
|
event = new Event('popstate');
|
|
225
214
|
} else {
|
|
@@ -227,7 +216,6 @@ var URLParamsProvider = {
|
|
|
227
216
|
event = document.createEvent('Event');
|
|
228
217
|
event.initEvent('popstate', true, true);
|
|
229
218
|
}
|
|
230
|
-
|
|
231
219
|
window.dispatchEvent(event);
|
|
232
220
|
}
|
|
233
221
|
}
|
|
@@ -239,20 +227,17 @@ var URLParamsProvider = {
|
|
|
239
227
|
},
|
|
240
228
|
getValue: function getValue(value) {
|
|
241
229
|
var _this3 = this;
|
|
242
|
-
|
|
243
230
|
if (Array.isArray(value) && value.length) {
|
|
244
231
|
return value.map(function (item) {
|
|
245
232
|
return _this3.getValue(item);
|
|
246
233
|
});
|
|
247
234
|
}
|
|
248
|
-
|
|
249
235
|
if (value && typeof value === 'object') {
|
|
250
236
|
// TODO: support for NestedList
|
|
251
237
|
if (value.location) return value;
|
|
252
238
|
if (value.category) return value;
|
|
253
239
|
return value.label || value.key || null;
|
|
254
240
|
}
|
|
255
|
-
|
|
256
241
|
return value;
|
|
257
242
|
},
|
|
258
243
|
setURL: function setURL(component, value) {
|
|
@@ -260,21 +245,17 @@ var URLParamsProvider = {
|
|
|
260
245
|
this.params["delete"](component);
|
|
261
246
|
return true;
|
|
262
247
|
}
|
|
263
|
-
|
|
264
248
|
var data = JSON.stringify(value);
|
|
265
|
-
|
|
266
249
|
if (data !== this.params.get(component)) {
|
|
267
250
|
this.params.set(component, data);
|
|
268
251
|
return true;
|
|
269
252
|
}
|
|
270
|
-
|
|
271
253
|
return false;
|
|
272
254
|
},
|
|
273
255
|
pushToHistory: function pushToHistory() {
|
|
274
256
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
|
275
257
|
var base = window.location.href.split('?')[0];
|
|
276
258
|
var newURL = "" + base + paramsSting;
|
|
277
|
-
|
|
278
259
|
if (this.$props.setSearchParams) {
|
|
279
260
|
this.$props.setSearchParams(newURL);
|
|
280
261
|
} else if (window.history.pushState) {
|
|
@@ -282,7 +263,6 @@ var URLParamsProvider = {
|
|
|
282
263
|
path: newURL
|
|
283
264
|
}, '', newURL);
|
|
284
265
|
}
|
|
285
|
-
|
|
286
266
|
this.init();
|
|
287
267
|
}
|
|
288
268
|
},
|
|
@@ -297,23 +277,19 @@ var URLParamsProvider = {
|
|
|
297
277
|
}, [children]);
|
|
298
278
|
}
|
|
299
279
|
};
|
|
300
|
-
|
|
301
280
|
var mapStateToProps = function mapStateToProps(state) {
|
|
302
281
|
return {
|
|
303
282
|
selectedValues: state.selectedValues,
|
|
304
283
|
searchComponents: state.components
|
|
305
284
|
};
|
|
306
285
|
};
|
|
307
|
-
|
|
308
286
|
var mapDispatchtoProps = {
|
|
309
287
|
setHeaders: setHeaders,
|
|
310
288
|
setValue: setValue
|
|
311
289
|
};
|
|
312
|
-
|
|
313
290
|
URLParamsProvider.install = function (Vue) {
|
|
314
291
|
Vue.component(URLParamsProvider.name, URLParamsProvider);
|
|
315
292
|
};
|
|
316
|
-
|
|
317
293
|
var URLParamsProvider$1 = index.connect(mapStateToProps, mapDispatchtoProps)(URLParamsProvider);
|
|
318
294
|
|
|
319
295
|
var typography = {
|
|
@@ -347,7 +323,6 @@ function getTheme(preset) {
|
|
|
347
323
|
if (preset === 'light') {
|
|
348
324
|
return light;
|
|
349
325
|
}
|
|
350
|
-
|
|
351
326
|
return dark;
|
|
352
327
|
}
|
|
353
328
|
|
|
@@ -364,8 +339,7 @@ var ReactiveBase = {
|
|
|
364
339
|
},
|
|
365
340
|
mounted: function mounted() {
|
|
366
341
|
var enableAppbase = this.enableAppbase,
|
|
367
|
-
|
|
368
|
-
|
|
342
|
+
endpoint = this.endpoint;
|
|
369
343
|
if (!enableAppbase && endpoint) {
|
|
370
344
|
console.warn('Warning(ReactiveSearch): The `endpoint` prop works only when `enableAppbase` prop is set to true.');
|
|
371
345
|
}
|
|
@@ -435,15 +409,13 @@ var ReactiveBase = {
|
|
|
435
409
|
computed: {
|
|
436
410
|
getHeaders: function getHeaders() {
|
|
437
411
|
var _this$$props = this.$props,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
412
|
+
enableAppbase = _this$$props.enableAppbase,
|
|
413
|
+
headers = _this$$props.headers,
|
|
414
|
+
appbaseConfig = _this$$props.appbaseConfig,
|
|
415
|
+
mongodb = _this$$props.mongodb,
|
|
416
|
+
endpoint = _this$$props.endpoint;
|
|
444
417
|
var _ref = appbaseConfig || {},
|
|
445
|
-
|
|
446
|
-
|
|
418
|
+
enableTelemetry = _ref.enableTelemetry;
|
|
447
419
|
return _rollupPluginBabelHelpers._extends({}, enableAppbase && !mongodb && _rollupPluginBabelHelpers._extends({
|
|
448
420
|
'X-Search-Client': index.X_SEARCH_CLIENT
|
|
449
421
|
}, enableTelemetry === false && {
|
|
@@ -459,7 +431,6 @@ var ReactiveBase = {
|
|
|
459
431
|
setStore: function setStore(props) {
|
|
460
432
|
var credentials = props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;
|
|
461
433
|
var url = props.url && props.url.trim() !== '' ? props.url : '';
|
|
462
|
-
|
|
463
434
|
if (props.enableAppbase && props.endpoint) {
|
|
464
435
|
if (props.endpoint.url) {
|
|
465
436
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -468,7 +439,6 @@ var ReactiveBase = {
|
|
|
468
439
|
throw Error('Error(ReactiveSearch): The `endpoint` prop object requires `url` property.');
|
|
469
440
|
}
|
|
470
441
|
}
|
|
471
|
-
|
|
472
442
|
var config = {
|
|
473
443
|
url: url,
|
|
474
444
|
app: props.app,
|
|
@@ -483,51 +453,65 @@ var ReactiveBase = {
|
|
|
483
453
|
endpoint: props.endpoint
|
|
484
454
|
};
|
|
485
455
|
var queryParams = '';
|
|
486
|
-
|
|
487
456
|
if (typeof window !== 'undefined') {
|
|
488
457
|
queryParams = window.location.search;
|
|
489
458
|
} else {
|
|
490
459
|
queryParams = props.queryParams || '';
|
|
491
460
|
}
|
|
492
|
-
|
|
493
461
|
var params = new URLSearchParams(queryParams);
|
|
494
462
|
var selectedValues = {};
|
|
495
463
|
var urlValues = {};
|
|
496
464
|
Array.from(params.keys()).forEach(function (key) {
|
|
497
465
|
try {
|
|
498
466
|
var _extends2, _extends3;
|
|
499
|
-
|
|
500
467
|
var parsedParams = JSON.parse(params.get(key));
|
|
501
468
|
var selectedValue = {};
|
|
502
|
-
|
|
503
469
|
if (parsedParams.value) {
|
|
504
470
|
selectedValue.value = parsedParams.value;
|
|
505
471
|
} else {
|
|
506
472
|
selectedValue.value = parsedParams;
|
|
507
473
|
}
|
|
508
|
-
|
|
509
474
|
if (parsedParams.category) selectedValue.category = parsedParams.category;
|
|
510
475
|
selectedValue.reference = 'URL';
|
|
511
476
|
selectedValues = _rollupPluginBabelHelpers._extends({}, selectedValues, (_extends2 = {}, _extends2[key] = selectedValue, _extends2));
|
|
512
477
|
urlValues = _rollupPluginBabelHelpers._extends({}, urlValues, (_extends3 = {}, _extends3[key] = selectedValue.value, _extends3));
|
|
513
|
-
} catch (e) {
|
|
478
|
+
} catch (e) {
|
|
479
|
+
// Do not add to selectedValues if JSON parsing fails.
|
|
514
480
|
}
|
|
515
481
|
});
|
|
516
482
|
var themePreset = props.themePreset,
|
|
517
|
-
|
|
518
|
-
|
|
483
|
+
enableAppbase = props.enableAppbase,
|
|
484
|
+
endpoint = props.endpoint;
|
|
519
485
|
var appbaseRef = Appbase(config);
|
|
520
|
-
|
|
521
486
|
appbaseRef.transformRequest = function (request) {
|
|
522
487
|
var modifiedRequest = enableAppbase ? helper.transformRequestUsingEndpoint(request, endpoint) : request;
|
|
523
488
|
if (props.transformRequest) return props.transformRequest(modifiedRequest);
|
|
524
489
|
return modifiedRequest;
|
|
525
490
|
};
|
|
526
|
-
|
|
527
491
|
if (this.$props.transformResponse) {
|
|
528
492
|
appbaseRef.transformResponse = this.$props.transformResponse;
|
|
529
493
|
}
|
|
530
|
-
|
|
494
|
+
var analyticsInitConfig = {
|
|
495
|
+
url: url && url.replace(/\/\/.*@/, '//'),
|
|
496
|
+
credentials: appbaseRef.credentials,
|
|
497
|
+
// When endpoint prop is used index is not defined, so we use _default
|
|
498
|
+
index: appbaseRef.app || '_default',
|
|
499
|
+
globalCustomEvents: this.$props.appbaseConfig && this.$props.appbaseConfig.customEvents
|
|
500
|
+
};
|
|
501
|
+
try {
|
|
502
|
+
if (this.$props.endpoint && this.$props.endpoint.url) {
|
|
503
|
+
// Remove parts between '//' and first '/' in the url
|
|
504
|
+
analyticsInitConfig.url = this.$props.endpoint.url.replace(/\/\/(.*?)\/.*/, '//$1');
|
|
505
|
+
var headerCredentials = this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
|
|
506
|
+
analyticsInitConfig.credentials = headerCredentials && headerCredentials.replace('Basic ', '');
|
|
507
|
+
// Decode the credentials
|
|
508
|
+
analyticsInitConfig.credentials = analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
|
|
509
|
+
}
|
|
510
|
+
} catch (e) {
|
|
511
|
+
console.error('Endpoint not set correctly for analytics');
|
|
512
|
+
console.error(e);
|
|
513
|
+
}
|
|
514
|
+
var analyticsRef = AppbaseAnalytics.init(analyticsInitConfig);
|
|
531
515
|
var initialState = _rollupPluginBabelHelpers._extends({
|
|
532
516
|
config: _rollupPluginBabelHelpers._extends({}, config, {
|
|
533
517
|
initialQueriesSyncTime: props.initialQueriesSyncTime,
|
|
@@ -536,23 +520,25 @@ var ReactiveBase = {
|
|
|
536
520
|
themePreset: themePreset
|
|
537
521
|
}),
|
|
538
522
|
appbaseRef: appbaseRef,
|
|
523
|
+
analyticsRef: analyticsRef,
|
|
539
524
|
selectedValues: selectedValues,
|
|
540
525
|
urlValues: urlValues,
|
|
541
526
|
headers: this.getHeaders
|
|
542
527
|
}, this.$props.initialState);
|
|
543
|
-
|
|
544
528
|
this.store = configureStore__default(initialState);
|
|
529
|
+
this.analyticsRef = analyticsRef;
|
|
545
530
|
}
|
|
546
531
|
},
|
|
547
532
|
render: function render() {
|
|
548
533
|
var h = arguments[0];
|
|
549
534
|
var children = this.$slots["default"];
|
|
550
535
|
var _this$$props2 = this.$props,
|
|
551
|
-
|
|
552
|
-
|
|
536
|
+
style = _this$$props2.style,
|
|
537
|
+
className = _this$$props2.className;
|
|
553
538
|
return h(Provider, {
|
|
554
539
|
"attrs": {
|
|
555
|
-
"store": this.store
|
|
540
|
+
"store": this.store,
|
|
541
|
+
"analyticsRef": this.analyticsRef
|
|
556
542
|
}
|
|
557
543
|
}, [h(URLParamsProvider$1, {
|
|
558
544
|
"attrs": {
|
|
@@ -566,7 +552,6 @@ var ReactiveBase = {
|
|
|
566
552
|
}, [children])]);
|
|
567
553
|
}
|
|
568
554
|
};
|
|
569
|
-
|
|
570
555
|
ReactiveBase.install = function (Vue) {
|
|
571
556
|
Vue.component(ReactiveBase.name, ReactiveBase);
|
|
572
557
|
};
|