@aslaluroba/help-center-react 3.0.18 → 3.0.19

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/services.js CHANGED
@@ -266,7 +266,7 @@ var isUndefined = typeOfTest('undefined');
266
266
  * @returns {boolean} True if value is a Buffer, otherwise false
267
267
  */
268
268
  function isBuffer(val) {
269
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
269
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
270
270
  }
271
271
 
272
272
  /**
@@ -310,7 +310,7 @@ var isString = typeOfTest('string');
310
310
  * @param {*} val The value to test
311
311
  * @returns {boolean} True if value is a Function, otherwise false
312
312
  */
313
- var isFunction = typeOfTest('function');
313
+ var isFunction$1 = typeOfTest('function');
314
314
 
315
315
  /**
316
316
  * Determine if a value is a Number
@@ -416,7 +416,7 @@ var isFileList = kindOfTest('FileList');
416
416
  *
417
417
  * @returns {boolean} True if value is a Stream, otherwise false
418
418
  */
419
- var isStream = val => isObject(val) && isFunction(val.pipe);
419
+ var isStream = val => isObject(val) && isFunction$1(val.pipe);
420
420
 
421
421
  /**
422
422
  * Determine if a value is a FormData
@@ -427,9 +427,9 @@ var isStream = val => isObject(val) && isFunction(val.pipe);
427
427
  */
428
428
  var isFormData = thing => {
429
429
  var kind;
430
- return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
430
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
431
431
  // detect form-data instance
432
- kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
432
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
433
433
  };
434
434
 
435
435
  /**
@@ -547,7 +547,8 @@ var isContextDefined = context => !isUndefined(context) && context !== _global;
547
547
  function merge(/* obj1, obj2, obj3, ... */
548
548
  ) {
549
549
  var {
550
- caseless
550
+ caseless,
551
+ skipUndefined
551
552
  } = isContextDefined(this) && this || {};
552
553
  var result = {};
553
554
  var assignValue = (val, key) => {
@@ -558,7 +559,7 @@ function merge(/* obj1, obj2, obj3, ... */
558
559
  result[targetKey] = merge({}, val);
559
560
  } else if (isArray(val)) {
560
561
  result[targetKey] = val.slice();
561
- } else {
562
+ } else if (!skipUndefined || !isUndefined(val)) {
562
563
  result[targetKey] = val;
563
564
  }
564
565
  };
@@ -583,7 +584,7 @@ var extend = function extend(a, b, thisArg) {
583
584
  allOwnKeys
584
585
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
585
586
  forEach(b, (val, key) => {
586
- if (thisArg && isFunction(val)) {
587
+ if (thisArg && isFunction$1(val)) {
587
588
  a[key] = bind(val, thisArg);
588
589
  } else {
589
590
  a[key] = val;
@@ -791,11 +792,11 @@ var reduceDescriptors = (obj, reducer) => {
791
792
  var freezeMethods = obj => {
792
793
  reduceDescriptors(obj, (descriptor, name) => {
793
794
  // skip restricted props in strict mode
794
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
795
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
795
796
  return false;
796
797
  }
797
798
  var value = obj[name];
798
- if (!isFunction(value)) return;
799
+ if (!isFunction$1(value)) return;
799
800
  descriptor.enumerable = false;
800
801
  if ('writable' in descriptor) {
801
802
  descriptor.writable = false;
@@ -831,7 +832,7 @@ var toFiniteNumber = (value, defaultValue) => {
831
832
  * @returns {boolean}
832
833
  */
833
834
  function isSpecCompliantForm(thing) {
834
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
835
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
835
836
  }
836
837
  var toJSONObject = obj => {
837
838
  var stack = new Array(10);
@@ -861,7 +862,7 @@ var toJSONObject = obj => {
861
862
  return visit(obj, 0);
862
863
  };
863
864
  var isAsyncFn = kindOfTest('AsyncFunction');
864
- var isThenable = thing => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
865
+ var isThenable = thing => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
865
866
 
866
867
  // original code
867
868
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -885,12 +886,12 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
885
886
  _global.postMessage(token, "*");
886
887
  };
887
888
  })("axios@".concat(Math.random()), []) : cb => setTimeout(cb);
888
- })(typeof setImmediate === 'function', isFunction(_global.postMessage));
889
+ })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
889
890
  var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
890
891
 
891
892
  // *********************
892
893
 
893
- var isIterable = thing => thing != null && isFunction(thing[iterator]);
894
+ var isIterable = thing => thing != null && isFunction$1(thing[iterator]);
894
895
  var utils$1 = {
895
896
  isArray,
896
897
  isArrayBuffer,
@@ -912,7 +913,7 @@ var utils$1 = {
912
913
  isFile,
913
914
  isBlob,
914
915
  isRegExp,
915
- isFunction,
916
+ isFunction: isFunction$1,
916
917
  isStream,
917
918
  isURLSearchParams,
918
919
  isTypedArray,
@@ -1023,9 +1024,20 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
1023
1024
  }, prop => {
1024
1025
  return prop !== 'isAxiosError';
1025
1026
  });
1026
- AxiosError.call(axiosError, error.message, code, config, request, response);
1027
- axiosError.cause = error;
1028
- axiosError.name = error.name;
1027
+ var msg = error && error.message ? error.message : 'Error';
1028
+
1029
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
1030
+ var errCode = code == null && error ? error.code : code;
1031
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
1032
+
1033
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
1034
+ if (error && axiosError.cause == null) {
1035
+ Object.defineProperty(axiosError, 'cause', {
1036
+ value: error,
1037
+ configurable: true
1038
+ });
1039
+ }
1040
+ axiosError.name = error && error.name || 'Error';
1029
1041
  customProps && Object.assign(axiosError, customProps);
1030
1042
  return axiosError;
1031
1043
  };
@@ -1273,7 +1285,7 @@ prototype.toString = function toString(encoder) {
1273
1285
  * @returns {string} The encoded value.
1274
1286
  */
1275
1287
  function encode(val) {
1276
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
1288
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1277
1289
  }
1278
1290
 
1279
1291
  /**
@@ -1617,7 +1629,7 @@ var defaults = {
1617
1629
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
1618
1630
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
1619
1631
  try {
1620
- return JSON.parse(data);
1632
+ return JSON.parse(data, this.parseReviver);
1621
1633
  } catch (e) {
1622
1634
  if (strictJSONParsing) {
1623
1635
  if (e.name === 'SyntaxError') {
@@ -2326,14 +2338,20 @@ var resolveConfig = config => {
2326
2338
  if (auth) {
2327
2339
  headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
2328
2340
  }
2329
- var contentType;
2330
2341
  if (utils$1.isFormData(data)) {
2331
2342
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2332
- headers.setContentType(undefined); // Let the browser set it
2333
- } else if ((contentType = headers.getContentType()) !== false) {
2334
- // fix semicolon duplication issue for ReactNative FormData implementation
2335
- var [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2336
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2343
+ headers.setContentType(undefined); // browser handles it
2344
+ } else if (utils$1.isFunction(data.getHeaders)) {
2345
+ // Node.js FormData (like form-data package)
2346
+ var formHeaders = data.getHeaders();
2347
+ // Only set safe headers to avoid overwriting security headers
2348
+ var allowedHeaders = ['content-type', 'content-length'];
2349
+ Object.entries(formHeaders).forEach(_ref => {
2350
+ var [key, val] = _ref;
2351
+ if (allowedHeaders.includes(key.toLowerCase())) {
2352
+ headers.set(key, val);
2353
+ }
2354
+ });
2337
2355
  }
2338
2356
  }
2339
2357
 
@@ -2441,12 +2459,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2441
2459
  };
2442
2460
 
2443
2461
  // Handle low level network errors
2444
- request.onerror = function handleError() {
2445
- // Real errors are hidden from us by the browser
2446
- // onerror should only fire if it's a network error
2447
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2448
-
2449
- // Clean up request
2462
+ request.onerror = function handleError(event) {
2463
+ // Browsers deliver a ProgressEvent in XHR onerror
2464
+ // (message may be empty; when present, surface it)
2465
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2466
+ var msg = event && event.message ? event.message : 'Network Error';
2467
+ var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
2468
+ // attach the underlying event for consumers who want details
2469
+ err.event = event || null;
2470
+ reject(err);
2450
2471
  request = null;
2451
2472
  };
2452
2473
 
@@ -2676,18 +2697,24 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
2676
2697
  });
2677
2698
  };
2678
2699
 
2679
- var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
2680
- var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
2681
-
2682
- // used only inside the fetch adapter
2683
- var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder()) : (/*#__PURE__*/function () {
2684
- var _ref = _asyncToGenerator(function* (str) {
2685
- return new Uint8Array(yield new Response(str).arrayBuffer());
2686
- });
2687
- return function (_x) {
2688
- return _ref.apply(this, arguments);
2700
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
2701
+ var {
2702
+ isFunction
2703
+ } = utils$1;
2704
+ var globalFetchAPI = (_ref => {
2705
+ var {
2706
+ Request,
2707
+ Response
2708
+ } = _ref;
2709
+ return {
2710
+ Request,
2711
+ Response
2689
2712
  };
2690
- }()));
2713
+ })(utils$1.global);
2714
+ var {
2715
+ ReadableStream: ReadableStream$1,
2716
+ TextEncoder
2717
+ } = utils$1.global;
2691
2718
  var test = function test(fn) {
2692
2719
  try {
2693
2720
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -2698,168 +2725,223 @@ var test = function test(fn) {
2698
2725
  return false;
2699
2726
  }
2700
2727
  };
2701
- var supportsRequestStream = isReadableStreamSupported && test(() => {
2702
- var duplexAccessed = false;
2703
- var hasContentType = new Request(platform.origin, {
2704
- body: new ReadableStream(),
2705
- method: 'POST',
2706
- get duplex() {
2707
- duplexAccessed = true;
2708
- return 'half';
2709
- }
2710
- }).headers.has('Content-Type');
2711
- return duplexAccessed && !hasContentType;
2712
- });
2713
- var DEFAULT_CHUNK_SIZE = 64 * 1024;
2714
- var supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
2715
- var resolvers = {
2716
- stream: supportsResponseStream && (res => res.body)
2717
- };
2718
- isFetchSupported && (res => {
2719
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2720
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? res => res[type]() : (_, config) => {
2721
- throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
2728
+ var factory = env => {
2729
+ env = utils$1.merge.call({
2730
+ skipUndefined: true
2731
+ }, globalFetchAPI, env);
2732
+ var {
2733
+ fetch: envFetch,
2734
+ Request,
2735
+ Response
2736
+ } = env;
2737
+ var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
2738
+ var isRequestSupported = isFunction(Request);
2739
+ var isResponseSupported = isFunction(Response);
2740
+ if (!isFetchSupported) {
2741
+ return false;
2742
+ }
2743
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2744
+ var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder()) : (/*#__PURE__*/function () {
2745
+ var _ref2 = _asyncToGenerator(function* (str) {
2746
+ return new Uint8Array(yield new Request(str).arrayBuffer());
2722
2747
  });
2748
+ return function (_x) {
2749
+ return _ref2.apply(this, arguments);
2750
+ };
2751
+ }()));
2752
+ var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2753
+ var duplexAccessed = false;
2754
+ var hasContentType = new Request(platform.origin, {
2755
+ body: new ReadableStream$1(),
2756
+ method: 'POST',
2757
+ get duplex() {
2758
+ duplexAccessed = true;
2759
+ return 'half';
2760
+ }
2761
+ }).headers.has('Content-Type');
2762
+ return duplexAccessed && !hasContentType;
2723
2763
  });
2724
- })(new Response());
2725
- var getBodyLength = /*#__PURE__*/function () {
2726
- var _ref2 = _asyncToGenerator(function* (body) {
2727
- if (body == null) {
2728
- return 0;
2729
- }
2730
- if (utils$1.isBlob(body)) {
2731
- return body.size;
2732
- }
2733
- if (utils$1.isSpecCompliantForm(body)) {
2734
- var _request = new Request(platform.origin, {
2735
- method: 'POST',
2736
- body
2737
- });
2738
- return (yield _request.arrayBuffer()).byteLength;
2739
- }
2740
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2741
- return body.byteLength;
2742
- }
2743
- if (utils$1.isURLSearchParams(body)) {
2744
- body = body + '';
2745
- }
2746
- if (utils$1.isString(body)) {
2747
- return (yield encodeText(body)).byteLength;
2748
- }
2749
- });
2750
- return function getBodyLength(_x2) {
2751
- return _ref2.apply(this, arguments);
2752
- };
2753
- }();
2754
- var resolveBodyLength = /*#__PURE__*/function () {
2755
- var _ref3 = _asyncToGenerator(function* (headers, body) {
2756
- var length = utils$1.toFiniteNumber(headers.getContentLength());
2757
- return length == null ? getBodyLength(body) : length;
2758
- });
2759
- return function resolveBodyLength(_x3, _x4) {
2760
- return _ref3.apply(this, arguments);
2764
+ var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
2765
+ var resolvers = {
2766
+ stream: supportsResponseStream && (res => res.body)
2761
2767
  };
2762
- }();
2763
- var fetchAdapter = isFetchSupported && (/*#__PURE__*/function () {
2764
- var _ref4 = _asyncToGenerator(function* (config) {
2765
- var {
2766
- url,
2767
- method,
2768
- data,
2769
- signal,
2770
- cancelToken,
2771
- timeout,
2772
- onDownloadProgress,
2773
- onUploadProgress,
2774
- responseType,
2775
- headers,
2776
- withCredentials = 'same-origin',
2777
- fetchOptions
2778
- } = resolveConfig(config);
2779
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2780
- var composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2781
- var request;
2782
- var unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2783
- composedSignal.unsubscribe();
2768
+ isFetchSupported && (() => {
2769
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2770
+ !resolvers[type] && (resolvers[type] = (res, config) => {
2771
+ var method = res && res[type];
2772
+ if (method) {
2773
+ return method.call(res);
2774
+ }
2775
+ throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
2776
+ });
2784
2777
  });
2785
- var requestContentLength;
2786
- try {
2787
- if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = yield resolveBodyLength(headers, data)) !== 0) {
2788
- var _request = new Request(url, {
2778
+ })();
2779
+ var getBodyLength = /*#__PURE__*/function () {
2780
+ var _ref3 = _asyncToGenerator(function* (body) {
2781
+ if (body == null) {
2782
+ return 0;
2783
+ }
2784
+ if (utils$1.isBlob(body)) {
2785
+ return body.size;
2786
+ }
2787
+ if (utils$1.isSpecCompliantForm(body)) {
2788
+ var _request = new Request(platform.origin, {
2789
2789
  method: 'POST',
2790
- body: data,
2791
- duplex: "half"
2790
+ body
2792
2791
  });
2793
- var contentTypeHeader;
2794
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2795
- headers.setContentType(contentTypeHeader);
2796
- }
2797
- if (_request.body) {
2798
- var [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
2799
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2800
- }
2792
+ return (yield _request.arrayBuffer()).byteLength;
2793
+ }
2794
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2795
+ return body.byteLength;
2801
2796
  }
2802
- if (!utils$1.isString(withCredentials)) {
2803
- withCredentials = withCredentials ? 'include' : 'omit';
2797
+ if (utils$1.isURLSearchParams(body)) {
2798
+ body = body + '';
2804
2799
  }
2800
+ if (utils$1.isString(body)) {
2801
+ return (yield encodeText(body)).byteLength;
2802
+ }
2803
+ });
2804
+ return function getBodyLength(_x2) {
2805
+ return _ref3.apply(this, arguments);
2806
+ };
2807
+ }();
2808
+ var resolveBodyLength = /*#__PURE__*/function () {
2809
+ var _ref4 = _asyncToGenerator(function* (headers, body) {
2810
+ var length = utils$1.toFiniteNumber(headers.getContentLength());
2811
+ return length == null ? getBodyLength(body) : length;
2812
+ });
2813
+ return function resolveBodyLength(_x3, _x4) {
2814
+ return _ref4.apply(this, arguments);
2815
+ };
2816
+ }();
2817
+ return /*#__PURE__*/function () {
2818
+ var _ref5 = _asyncToGenerator(function* (config) {
2819
+ var {
2820
+ url,
2821
+ method,
2822
+ data,
2823
+ signal,
2824
+ cancelToken,
2825
+ timeout,
2826
+ onDownloadProgress,
2827
+ onUploadProgress,
2828
+ responseType,
2829
+ headers,
2830
+ withCredentials = 'same-origin',
2831
+ fetchOptions
2832
+ } = resolveConfig(config);
2833
+ var _fetch = envFetch || fetch;
2834
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2835
+ var composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2836
+ var request = null;
2837
+ var unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2838
+ composedSignal.unsubscribe();
2839
+ });
2840
+ var requestContentLength;
2841
+ try {
2842
+ if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = yield resolveBodyLength(headers, data)) !== 0) {
2843
+ var _request = new Request(url, {
2844
+ method: 'POST',
2845
+ body: data,
2846
+ duplex: "half"
2847
+ });
2848
+ var contentTypeHeader;
2849
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2850
+ headers.setContentType(contentTypeHeader);
2851
+ }
2852
+ if (_request.body) {
2853
+ var [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
2854
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2855
+ }
2856
+ }
2857
+ if (!utils$1.isString(withCredentials)) {
2858
+ withCredentials = withCredentials ? 'include' : 'omit';
2859
+ }
2805
2860
 
2806
- // Cloudflare Workers throws when credentials are defined
2807
- // see https://github.com/cloudflare/workerd/issues/902
2808
- var isCredentialsSupported = "credentials" in Request.prototype;
2809
- request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
2810
- signal: composedSignal,
2811
- method: method.toUpperCase(),
2812
- headers: headers.normalize().toJSON(),
2813
- body: data,
2814
- duplex: "half",
2815
- credentials: isCredentialsSupported ? withCredentials : undefined
2816
- }));
2817
- var response = yield fetch(request, fetchOptions);
2818
- var isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2819
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2820
- var options = {};
2821
- ['status', 'statusText', 'headers'].forEach(prop => {
2822
- options[prop] = response[prop];
2823
- });
2824
- var responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2825
- var [_onProgress, _flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
2826
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, () => {
2827
- _flush && _flush();
2828
- unsubscribe && unsubscribe();
2829
- }), options);
2830
- }
2831
- responseType = responseType || 'text';
2832
- var responseData = yield resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2833
- !isStreamResponse && unsubscribe && unsubscribe();
2834
- return yield new Promise((resolve, reject) => {
2835
- settle(resolve, reject, {
2836
- data: responseData,
2837
- headers: AxiosHeaders$1.from(response.headers),
2838
- status: response.status,
2839
- statusText: response.statusText,
2840
- config,
2841
- request
2861
+ // Cloudflare Workers throws when credentials are defined
2862
+ // see https://github.com/cloudflare/workerd/issues/902
2863
+ var isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2864
+ var resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
2865
+ signal: composedSignal,
2866
+ method: method.toUpperCase(),
2867
+ headers: headers.normalize().toJSON(),
2868
+ body: data,
2869
+ duplex: "half",
2870
+ credentials: isCredentialsSupported ? withCredentials : undefined
2842
2871
  });
2843
- });
2844
- } catch (err) {
2845
- unsubscribe && unsubscribe();
2846
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2847
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
2848
- cause: err.cause || err
2872
+ request = isRequestSupported && new Request(url, resolvedOptions);
2873
+ var response = yield isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
2874
+ var isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2875
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2876
+ var options = {};
2877
+ ['status', 'statusText', 'headers'].forEach(prop => {
2878
+ options[prop] = response[prop];
2879
+ });
2880
+ var responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2881
+ var [_onProgress, _flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
2882
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, () => {
2883
+ _flush && _flush();
2884
+ unsubscribe && unsubscribe();
2885
+ }), options);
2886
+ }
2887
+ responseType = responseType || 'text';
2888
+ var responseData = yield resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2889
+ !isStreamResponse && unsubscribe && unsubscribe();
2890
+ return yield new Promise((resolve, reject) => {
2891
+ settle(resolve, reject, {
2892
+ data: responseData,
2893
+ headers: AxiosHeaders$1.from(response.headers),
2894
+ status: response.status,
2895
+ statusText: response.statusText,
2896
+ config,
2897
+ request
2898
+ });
2849
2899
  });
2900
+ } catch (err) {
2901
+ unsubscribe && unsubscribe();
2902
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2903
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
2904
+ cause: err.cause || err
2905
+ });
2906
+ }
2907
+ throw AxiosError.from(err, err && err.code, config, request);
2850
2908
  }
2851
- throw AxiosError.from(err, err && err.code, config, request);
2852
- }
2853
- });
2854
- return function (_x5) {
2855
- return _ref4.apply(this, arguments);
2856
- };
2857
- }());
2909
+ });
2910
+ return function (_x5) {
2911
+ return _ref5.apply(this, arguments);
2912
+ };
2913
+ }();
2914
+ };
2915
+ var seedCache = new Map();
2916
+ var getFetch = config => {
2917
+ var env = config ? config.env : {};
2918
+ var {
2919
+ fetch,
2920
+ Request,
2921
+ Response
2922
+ } = env;
2923
+ var seeds = [Request, Response, fetch];
2924
+ var len = seeds.length,
2925
+ i = len,
2926
+ seed,
2927
+ target,
2928
+ map = seedCache;
2929
+ while (i--) {
2930
+ seed = seeds[i];
2931
+ target = map.get(seed);
2932
+ target === undefined && map.set(seed, target = i ? new Map() : factory(env));
2933
+ map = target;
2934
+ }
2935
+ return target;
2936
+ };
2937
+ getFetch();
2858
2938
 
2859
2939
  var knownAdapters = {
2860
2940
  http: httpAdapter,
2861
2941
  xhr: xhrAdapter,
2862
- fetch: fetchAdapter
2942
+ fetch: {
2943
+ get: getFetch
2944
+ }
2863
2945
  };
2864
2946
  utils$1.forEach(knownAdapters, (fn, value) => {
2865
2947
  if (fn) {
@@ -2878,7 +2960,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
2878
2960
  var renderReason = reason => "- ".concat(reason);
2879
2961
  var isResolvedHandle = adapter => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2880
2962
  var adapters = {
2881
- getAdapter: adapters => {
2963
+ getAdapter: (adapters, config) => {
2882
2964
  adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2883
2965
  var {
2884
2966
  length
@@ -2896,7 +2978,7 @@ var adapters = {
2896
2978
  throw new AxiosError("Unknown adapter '".concat(id, "'"));
2897
2979
  }
2898
2980
  }
2899
- if (adapter) {
2981
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
2900
2982
  break;
2901
2983
  }
2902
2984
  rejectedReasons[id || '#' + i] = adapter;
@@ -2946,7 +3028,7 @@ function dispatchRequest(config) {
2946
3028
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2947
3029
  config.headers.setContentType('application/x-www-form-urlencoded', false);
2948
3030
  }
2949
- var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3031
+ var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
2950
3032
  return adapter(config).then(function onAdapterResolution(response) {
2951
3033
  throwIfCancellationRequested(config);
2952
3034
 
@@ -2968,7 +3050,7 @@ function dispatchRequest(config) {
2968
3050
  });
2969
3051
  }
2970
3052
 
2971
- var VERSION = "1.11.0";
3053
+ var VERSION = "1.12.2";
2972
3054
 
2973
3055
  var validators$1 = {};
2974
3056
 
@@ -3191,7 +3273,6 @@ class Axios {
3191
3273
  }
3192
3274
  len = requestInterceptorChain.length;
3193
3275
  var newConfig = config;
3194
- i = 0;
3195
3276
  while (i < len) {
3196
3277
  var onFulfilled = requestInterceptorChain[i++];
3197
3278
  var onRejected = requestInterceptorChain[i++];
@@ -4276,7 +4357,7 @@ var ably = {exports: {}};
4276
4357
  });
4277
4358
  return _withTimeoutAsync2.apply(this, arguments);
4278
4359
  }
4279
- var version = "2.12.0";
4360
+ var version = "2.13.0";
4280
4361
 
4281
4362
  // src/common/lib/util/defaults.ts
4282
4363
  var agent = "ably-js/" + version;
@@ -4307,7 +4388,7 @@ var ably = {exports: {}};
4307
4388
  httpMaxRetryCount: 3,
4308
4389
  maxMessageSize: 65536,
4309
4390
  version,
4310
- protocolVersion: 3,
4391
+ protocolVersion: 4,
4311
4392
  agent,
4312
4393
  getPort,
4313
4394
  getHttpScheme,
@@ -5880,6 +5961,10 @@ var ably = {exports: {}};
5880
5961
  }
5881
5962
  } else if (attr && (attr === "extras" || attr === "operation")) {
5882
5963
  result += "; " + attr + "=" + JSON.stringify(m[attr]);
5964
+ } else if (attr === "version") {
5965
+ result += "; version=" + JSON.stringify(m[attr]);
5966
+ } else if (attr === "annotations") {
5967
+ result += "; annotations=" + JSON.stringify(m[attr]);
5883
5968
  } else if (m[attr] !== void 0) {
5884
5969
  result += "; " + attr + "=" + m[attr];
5885
5970
  }
@@ -7004,15 +7089,22 @@ var ably = {exports: {}};
7004
7089
  return total;
7005
7090
  }
7006
7091
  var Message = class _Message extends BaseMessage {
7007
- // TODO improve typings after summary structure is finalised
7008
7092
  expandFields() {
7009
- if (this.action === "message.create") {
7010
- if (this.version && !this.serial) {
7011
- this.serial = this.version;
7012
- }
7013
- if (this.timestamp && !this.createdAt) {
7014
- this.createdAt = this.timestamp;
7015
- }
7093
+ if (!this.version) {
7094
+ this.version = {};
7095
+ }
7096
+ if (!this.version.serial && this.serial) {
7097
+ this.version.serial = this.serial;
7098
+ }
7099
+ if (!this.version.timestamp && this.timestamp) {
7100
+ this.version.timestamp = this.timestamp;
7101
+ }
7102
+ if (!this.annotations) {
7103
+ this.annotations = {
7104
+ summary: {}
7105
+ };
7106
+ } else if (!this.annotations.summary) {
7107
+ this.annotations.summary = {};
7016
7108
  }
7017
7109
  }
7018
7110
  encode(options) {