@blockquote-web-components/ajax-provider 1.3.4 → 1.3.6
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/package.json +5 -4
- package/src/AjaxProvider.js +1 -1
- package/src/AjaxProviderMixin.js +10 -10
- package/src/index.js +2 -2
- package/src/utils.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote-web-components/ajax-provider",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Webcomponent ajax-provider following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"prettier": {
|
|
69
|
-
"arrowParens": "avoid",
|
|
70
69
|
"bracketSameLine": true,
|
|
70
|
+
"bracketSpacing": false,
|
|
71
71
|
"htmlWhitespaceSensitivity": "ignore",
|
|
72
72
|
"printWidth": 100,
|
|
73
73
|
"singleQuote": true,
|
|
74
|
-
"trailingComma": "
|
|
74
|
+
"trailingComma": "es5",
|
|
75
75
|
"overrides": [
|
|
76
76
|
{
|
|
77
77
|
"files": "*.{scss,css}",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.9.1",
|
|
100
|
+
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.2",
|
|
100
101
|
"inspector-elements": "0.1.0",
|
|
101
102
|
"lit": "^3.1.1"
|
|
102
103
|
},
|
|
@@ -104,5 +105,5 @@
|
|
|
104
105
|
"access": "public"
|
|
105
106
|
},
|
|
106
107
|
"customElements": "custom-elements.json",
|
|
107
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "0d8e9582b65cca369553640cc72d2ca93f2c0a61"
|
|
108
109
|
}
|
package/src/AjaxProvider.js
CHANGED
package/src/AjaxProviderMixin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {dedupeMixin} from '@open-wc/dedupe-mixin';
|
|
2
|
+
import {lastValueFrom, catchError, tap} from 'rxjs';
|
|
3
|
+
import {ajax} from 'rxjs/ajax';
|
|
4
|
+
import {assignIfDefined, isFormData} from './utils.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Mixin for providing AJAX functionality using RxJS. This mixin can be used to enhance classes with AJAX capabilities.
|
|
8
8
|
*/
|
|
9
|
-
const AjaxProvider = Base =>
|
|
9
|
+
const AjaxProvider = (Base) =>
|
|
10
10
|
// @ts-ignore
|
|
11
11
|
class AjaxProviderBase extends Base {
|
|
12
12
|
constructor() {
|
|
@@ -169,7 +169,7 @@ const AjaxProvider = Base =>
|
|
|
169
169
|
* @private
|
|
170
170
|
*/
|
|
171
171
|
_joinHeaders(formData) {
|
|
172
|
-
const assignHeaders = {
|
|
172
|
+
const assignHeaders = {...this._headers, ...(this.headers || {})};
|
|
173
173
|
|
|
174
174
|
if (isFormData(formData) && !this.avoidBoundary) {
|
|
175
175
|
delete assignHeaders['Content-Type']; // Let the browser set it
|
|
@@ -214,7 +214,7 @@ const AjaxProvider = Base =>
|
|
|
214
214
|
|
|
215
215
|
const toPromise$ = await lastValueFrom(
|
|
216
216
|
ajax(this._assignAjaxRxjsConfig()).pipe(
|
|
217
|
-
tap(response => {
|
|
217
|
+
tap((response) => {
|
|
218
218
|
const setProgress = {
|
|
219
219
|
type: response.type,
|
|
220
220
|
loaded: response.loaded,
|
|
@@ -222,13 +222,13 @@ const AjaxProvider = Base =>
|
|
|
222
222
|
};
|
|
223
223
|
this._dispatchEvent('progress', setProgress);
|
|
224
224
|
}),
|
|
225
|
-
catchError(error => {
|
|
225
|
+
catchError((error) => {
|
|
226
226
|
this._dispatchEvent('error', error);
|
|
227
227
|
this._dispatchEvent('errorend', true);
|
|
228
228
|
this.lastError = error;
|
|
229
229
|
return Promise.reject(error);
|
|
230
|
-
})
|
|
231
|
-
)
|
|
230
|
+
})
|
|
231
|
+
)
|
|
232
232
|
);
|
|
233
233
|
|
|
234
234
|
this._dispatchEvent('response', toPromise$);
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export {AjaxProvider} from './AjaxProvider.js';
|
|
2
|
+
export {AjaxProviderMixin} from './AjaxProviderMixin.js';
|
package/src/utils.js
CHANGED
|
@@ -16,7 +16,7 @@ export const isStandardBrowserEnv = (() => {
|
|
|
16
16
|
* or NativeScript.
|
|
17
17
|
*/
|
|
18
18
|
if (typeof navigator !== 'undefined') {
|
|
19
|
-
const {
|
|
19
|
+
const {product} = navigator;
|
|
20
20
|
return !(product === 'ReactNative' || product === 'NativeScript' || product === 'NS');
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ export const isStandardBrowserWebWorkerEnv = (() =>
|
|
|
56
56
|
* @param {*} thing The value to test
|
|
57
57
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
58
58
|
*/
|
|
59
|
-
export const isFormData = thing =>
|
|
59
|
+
export const isFormData = (thing) =>
|
|
60
60
|
(thing && thing instanceof FormData) ||
|
|
61
61
|
(typeof thing === 'object' &&
|
|
62
62
|
typeof thing.append === 'function' /* c8 ignore next */ &&
|