@aslaluroba/help-center-react 3.2.15 → 3.2.17

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
@@ -244,7 +244,7 @@ var kindOfTest = type => {
244
244
  var typeOfTest = type => thing => typeof thing === type;
245
245
 
246
246
  /**
247
- * Determine if a value is an Array
247
+ * Determine if a value is a non-null object
248
248
  *
249
249
  * @param {Object} val The value to test
250
250
  *
@@ -396,6 +396,31 @@ var isDate = kindOfTest('Date');
396
396
  */
397
397
  var isFile = kindOfTest('File');
398
398
 
399
+ /**
400
+ * Determine if a value is a React Native Blob
401
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
402
+ * also have a `name` and `type` attribute to specify filename and content type
403
+ *
404
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
405
+ *
406
+ * @param {*} value The value to test
407
+ *
408
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
409
+ */
410
+ var isReactNativeBlob = value => {
411
+ return !!(value && typeof value.uri !== 'undefined');
412
+ };
413
+
414
+ /**
415
+ * Determine if environment is React Native
416
+ * ReactNative `FormData` has a non-standard `getParts()` method
417
+ *
418
+ * @param {*} formData The formData to test
419
+ *
420
+ * @returns {boolean} True if environment is React Native, otherwise false
421
+ */
422
+ var isReactNative = formData => formData && typeof formData.getParts !== 'undefined';
423
+
399
424
  /**
400
425
  * Determine if a value is a Blob
401
426
  *
@@ -430,9 +455,18 @@ var isStream = val => isObject(val) && isFunction$1(val.pipe);
430
455
  *
431
456
  * @returns {boolean} True if value is an FormData, otherwise false
432
457
  */
458
+ function getGlobal() {
459
+ if (typeof globalThis !== 'undefined') return globalThis;
460
+ if (typeof self !== 'undefined') return self;
461
+ if (typeof window !== 'undefined') return window;
462
+ if (typeof global !== 'undefined') return global;
463
+ return {};
464
+ }
465
+ var G = getGlobal();
466
+ var FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
433
467
  var isFormData = thing => {
434
468
  var kind;
435
- return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
469
+ return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
436
470
  // detect form-data instance
437
471
  kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
438
472
  };
@@ -454,8 +488,9 @@ var [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'R
454
488
  *
455
489
  * @returns {String} The String freed of excess whitespace
456
490
  */
457
- var trim = str => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
458
-
491
+ var trim = str => {
492
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
493
+ };
459
494
  /**
460
495
  * Iterate over an Array or an Object invoking a function for each item.
461
496
  *
@@ -509,6 +544,15 @@ function forEach(obj, fn) {
509
544
  }
510
545
  }
511
546
  }
547
+
548
+ /**
549
+ * Finds a key in an object, case-insensitive, returning the actual key name.
550
+ * Returns null if the object is a Buffer or if no match is found.
551
+ *
552
+ * @param {Object} obj - The object to search.
553
+ * @param {string} key - The key to find (case-insensitive).
554
+ * @returns {?string} The actual key name if found, otherwise null.
555
+ */
512
556
  function findKey(obj, key) {
513
557
  if (isBuffer(obj)) {
514
558
  return null;
@@ -527,8 +571,8 @@ function findKey(obj, key) {
527
571
  }
528
572
  var _global = (() => {
529
573
  /*eslint no-undef:0*/
530
- if (typeof globalThis !== "undefined") return globalThis;
531
- return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
574
+ if (typeof globalThis !== 'undefined') return globalThis;
575
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
532
576
  })();
533
577
  var isContextDefined = context => !isUndefined(context) && context !== _global;
534
578
 
@@ -558,6 +602,10 @@ function merge(/* obj1, obj2, obj3, ... */
558
602
  } = isContextDefined(this) && this || {};
559
603
  var result = {};
560
604
  var assignValue = (val, key) => {
605
+ // Skip dangerous property names to prevent prototype pollution
606
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
607
+ return;
608
+ }
561
609
  var targetKey = caseless && findKey(result, key) || key;
562
610
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
563
611
  result[targetKey] = merge(result[targetKey], val);
@@ -620,7 +668,7 @@ var extend = function extend(a, b, thisArg) {
620
668
  * @returns {string} content value without BOM
621
669
  */
622
670
  var stripBOM = content => {
623
- if (content.charCodeAt(0) === 0xFEFF) {
671
+ if (content.charCodeAt(0) === 0xfeff) {
624
672
  content = content.slice(1);
625
673
  }
626
674
  return content;
@@ -826,11 +874,20 @@ var freezeMethods = obj => {
826
874
  }
827
875
  if (!descriptor.set) {
828
876
  descriptor.set = () => {
829
- throw Error('Can not rewrite read-only method \'' + name + '\'');
877
+ throw Error("Can not rewrite read-only method '" + name + "'");
830
878
  };
831
879
  }
832
880
  });
833
881
  };
882
+
883
+ /**
884
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
885
+ * Useful for fast membership checks.
886
+ *
887
+ * @param {Array|string} arrayOrString - The array or string to convert.
888
+ * @param {string} delimiter - The delimiter to use if input is a string.
889
+ * @returns {Object} An object with keys from the array or string, values set to true.
890
+ */
834
891
  var toObjectSet = (arrayOrString, delimiter) => {
835
892
  var obj = {};
836
893
  var define = arr => {
@@ -856,6 +913,13 @@ var toFiniteNumber = (value, defaultValue) => {
856
913
  function isSpecCompliantForm(thing) {
857
914
  return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
858
915
  }
916
+
917
+ /**
918
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
919
+ *
920
+ * @param {Object} obj - The object to convert.
921
+ * @returns {Object} The JSON-compatible object.
922
+ */
859
923
  var toJSONObject = obj => {
860
924
  var stack = new Array(10);
861
925
  var visit = (source, i) => {
@@ -883,18 +947,40 @@ var toJSONObject = obj => {
883
947
  };
884
948
  return visit(obj, 0);
885
949
  };
950
+
951
+ /**
952
+ * Determines if a value is an async function.
953
+ *
954
+ * @param {*} thing - The value to test.
955
+ * @returns {boolean} True if value is an async function, otherwise false.
956
+ */
886
957
  var isAsyncFn = kindOfTest('AsyncFunction');
958
+
959
+ /**
960
+ * Determines if a value is thenable (has then and catch methods).
961
+ *
962
+ * @param {*} thing - The value to test.
963
+ * @returns {boolean} True if value is thenable, otherwise false.
964
+ */
887
965
  var isThenable = thing => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
888
966
 
889
967
  // original code
890
968
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
891
969
 
970
+ /**
971
+ * Provides a cross-platform setImmediate implementation.
972
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
973
+ *
974
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
975
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
976
+ * @returns {Function} A function to schedule a callback asynchronously.
977
+ */
892
978
  var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
893
979
  if (setImmediateSupported) {
894
980
  return setImmediate;
895
981
  }
896
982
  return postMessageSupported ? ((token, callbacks) => {
897
- _global.addEventListener("message", _ref2 => {
983
+ _global.addEventListener('message', _ref2 => {
898
984
  var {
899
985
  source,
900
986
  data
@@ -905,10 +991,17 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
905
991
  }, false);
906
992
  return cb => {
907
993
  callbacks.push(cb);
908
- _global.postMessage(token, "*");
994
+ _global.postMessage(token, '*');
909
995
  };
910
996
  })("axios@".concat(Math.random()), []) : cb => setTimeout(cb);
911
997
  })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
998
+
999
+ /**
1000
+ * Schedules a microtask or asynchronous callback as soon as possible.
1001
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
1002
+ *
1003
+ * @type {Function}
1004
+ */
912
1005
  var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
913
1006
 
914
1007
  // *********************
@@ -933,6 +1026,8 @@ var utils$1 = {
933
1026
  isUndefined,
934
1027
  isDate,
935
1028
  isFile,
1029
+ isReactNativeBlob,
1030
+ isReactNative,
936
1031
  isBlob,
937
1032
  isRegExp,
938
1033
  isFunction: isFunction$1,
@@ -980,6 +1075,11 @@ let AxiosError$1 = class AxiosError extends Error {
980
1075
  var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
981
1076
  axiosError.cause = error;
982
1077
  axiosError.name = error.name;
1078
+
1079
+ // Preserve status from the original error if not already set from response
1080
+ if (error.status != null && axiosError.status == null) {
1081
+ axiosError.status = error.status;
1082
+ }
983
1083
  customProps && Object.assign(axiosError, customProps);
984
1084
  return axiosError;
985
1085
  }
@@ -997,6 +1097,16 @@ let AxiosError$1 = class AxiosError extends Error {
997
1097
  */
998
1098
  constructor(message, code, config, request, response) {
999
1099
  super(message);
1100
+
1101
+ // Make message enumerable to maintain backward compatibility
1102
+ // The native Error constructor sets message as non-enumerable,
1103
+ // but axios < v1.13.3 had it as enumerable
1104
+ Object.defineProperty(this, 'message', {
1105
+ value: message,
1106
+ enumerable: true,
1107
+ writable: true,
1108
+ configurable: true
1109
+ });
1000
1110
  this.name = 'AxiosError';
1001
1111
  this.isAxiosError = true;
1002
1112
  code && (this.code = code);
@@ -1178,6 +1288,10 @@ function toFormData$1(obj, formData, options) {
1178
1288
  */
1179
1289
  function defaultVisitor(value, key, path) {
1180
1290
  var arr = value;
1291
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1292
+ formData.append(renderKey(path, key, dots), convertValue(value));
1293
+ return false;
1294
+ }
1181
1295
  if (value && !path && typeof value === 'object') {
1182
1296
  if (utils$1.endsWith(key, '{}')) {
1183
1297
  // eslint-disable-next-line no-param-reassign
@@ -1313,7 +1427,7 @@ function buildURL(url, params, options) {
1313
1427
  serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1314
1428
  }
1315
1429
  if (serializedParams) {
1316
- var hashmarkIndex = url.indexOf("#");
1430
+ var hashmarkIndex = url.indexOf('#');
1317
1431
  if (hashmarkIndex !== -1) {
1318
1432
  url = url.slice(0, hashmarkIndex);
1319
1433
  }
@@ -1392,7 +1506,8 @@ class InterceptorManager {
1392
1506
  var transitionalDefaults = {
1393
1507
  silentJSONParsing: true,
1394
1508
  forcedJSONParsing: true,
1395
- clarifyTimeoutError: false
1509
+ clarifyTimeoutError: false,
1510
+ legacyInterceptorReqResOrdering: true
1396
1511
  };
1397
1512
 
1398
1513
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -1656,7 +1771,7 @@ var defaults = {
1656
1771
  },
1657
1772
  headers: {
1658
1773
  common: {
1659
- 'Accept': 'application/json, text/plain, */*',
1774
+ Accept: 'application/json, text/plain, */*',
1660
1775
  'Content-Type': undefined
1661
1776
  }
1662
1777
  }
@@ -1901,7 +2016,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
1901
2016
  }).join('\n');
1902
2017
  }
1903
2018
  getSetCookie() {
1904
- return this.get("set-cookie") || [];
2019
+ return this.get('set-cookie') || [];
1905
2020
  }
1906
2021
  get [Symbol.toStringTag]() {
1907
2022
  return 'AxiosHeaders';
@@ -2195,6 +2310,9 @@ function isAbsoluteURL(url) {
2195
2310
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2196
2311
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2197
2312
  // by any combination of letters, digits, plus, period, or hyphen.
2313
+ if (typeof url !== 'string') {
2314
+ return false;
2315
+ }
2198
2316
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2199
2317
  }
2200
2318
 
@@ -2319,7 +2437,8 @@ function mergeConfig$1(config1, config2) {
2319
2437
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
2320
2438
  };
2321
2439
  utils$1.forEach(Object.keys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
2322
- var merge = mergeMap[prop] || mergeDeepProperties;
2440
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2441
+ var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2323
2442
  var configValue = merge(config1[prop], config2[prop], prop);
2324
2443
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2325
2444
  });
@@ -2847,7 +2966,7 @@ var factory = env => {
2847
2966
  var _request = new Request(url, {
2848
2967
  method: 'POST',
2849
2968
  body: data,
2850
- duplex: "half"
2969
+ duplex: 'half'
2851
2970
  });
2852
2971
  var contentTypeHeader;
2853
2972
  if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
@@ -2864,13 +2983,13 @@ var factory = env => {
2864
2983
 
2865
2984
  // Cloudflare Workers throws when credentials are defined
2866
2985
  // see https://github.com/cloudflare/workerd/issues/902
2867
- var isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2986
+ var isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
2868
2987
  var resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
2869
2988
  signal: composedSignal,
2870
2989
  method: method.toUpperCase(),
2871
2990
  headers: headers.normalize().toJSON(),
2872
2991
  body: data,
2873
- duplex: "half",
2992
+ duplex: 'half',
2874
2993
  credentials: isCredentialsSupported ? withCredentials : undefined
2875
2994
  });
2876
2995
  request = isRequestSupported && new Request(url, resolvedOptions);
@@ -2904,11 +3023,11 @@ var factory = env => {
2904
3023
  } catch (err) {
2905
3024
  unsubscribe && unsubscribe();
2906
3025
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2907
- throw Object.assign(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request), {
3026
+ throw Object.assign(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, err && err.response), {
2908
3027
  cause: err.cause || err
2909
3028
  });
2910
3029
  }
2911
- throw AxiosError$1.from(err, err && err.code, config, request);
3030
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
2912
3031
  }
2913
3032
  });
2914
3033
  return function (_x5) {
@@ -2946,7 +3065,7 @@ getFetch();
2946
3065
  * - `http` for Node.js
2947
3066
  * - `xhr` for browsers
2948
3067
  * - `fetch` for fetch API-based requests
2949
- *
3068
+ *
2950
3069
  * @type {Object<string, Function|Object>}
2951
3070
  */
2952
3071
  var knownAdapters = {
@@ -2975,7 +3094,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
2975
3094
 
2976
3095
  /**
2977
3096
  * Render a rejection reason string for unknown or unsupported adapters
2978
- *
3097
+ *
2979
3098
  * @param {string} reason
2980
3099
  * @returns {string}
2981
3100
  */
@@ -2983,7 +3102,7 @@ var renderReason = reason => "- ".concat(reason);
2983
3102
 
2984
3103
  /**
2985
3104
  * Check if the adapter is resolved (function, null, or false)
2986
- *
3105
+ *
2987
3106
  * @param {Function|null|false} adapter
2988
3107
  * @returns {boolean}
2989
3108
  */
@@ -2993,7 +3112,7 @@ var isResolvedHandle = adapter => utils$1.isFunction(adapter) || adapter === nul
2993
3112
  * Get the first suitable adapter from the provided list.
2994
3113
  * Tries each adapter in order until a supported one is found.
2995
3114
  * Throws an AxiosError if no adapter is suitable.
2996
- *
3115
+ *
2997
3116
  * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
2998
3117
  * @param {Object} config - Axios request configuration
2999
3118
  * @throws {AxiosError} If no suitable adapter is available
@@ -3103,7 +3222,7 @@ function dispatchRequest(config) {
3103
3222
  });
3104
3223
  }
3105
3224
 
3106
- var VERSION$1 = "1.13.4";
3225
+ var VERSION$1 = "1.13.6";
3107
3226
 
3108
3227
  var validators$1 = {};
3109
3228
 
@@ -3126,7 +3245,7 @@ var deprecatedWarnings = {};
3126
3245
  */
3127
3246
  validators$1.transitional = function transitional(validator, version, message) {
3128
3247
  function formatMessage(opt, desc) {
3129
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3248
+ return '[Axios v' + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? '. ' + message : '');
3130
3249
  }
3131
3250
 
3132
3251
  // eslint-disable-next-line func-names
@@ -3259,7 +3378,8 @@ let Axios$1 = class Axios {
3259
3378
  validator.assertOptions(transitional, {
3260
3379
  silentJSONParsing: validators.transitional(validators.boolean),
3261
3380
  forcedJSONParsing: validators.transitional(validators.boolean),
3262
- clarifyTimeoutError: validators.transitional(validators.boolean)
3381
+ clarifyTimeoutError: validators.transitional(validators.boolean),
3382
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
3263
3383
  }, false);
3264
3384
  }
3265
3385
  if (paramsSerializer != null) {
@@ -3304,7 +3424,13 @@ let Axios$1 = class Axios {
3304
3424
  return;
3305
3425
  }
3306
3426
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3307
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3427
+ var transitional = config.transitional || transitionalDefaults;
3428
+ var legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
3429
+ if (legacyInterceptorReqResOrdering) {
3430
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3431
+ } else {
3432
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3433
+ }
3308
3434
  });
3309
3435
  var responseInterceptorChain = [];
3310
3436
  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
@@ -4096,12 +4222,13 @@ function requireAbly() {
4096
4222
  if (err.statusCode) result += "; statusCode=" + err.statusCode;
4097
4223
  if (err.code) result += "; code=" + err.code;
4098
4224
  if (err.cause) result += "; cause=" + _inspectError(err.cause);
4225
+ if (err.detail && Object.keys(err.detail).length > 0) result += "; detail=" + JSON.stringify(err.detail);
4099
4226
  if (err.href && !(err.message && err.message.indexOf("help.ably.io") > -1)) result += "; see " + err.href + " ";
4100
4227
  result += "]";
4101
4228
  return result;
4102
4229
  }
4103
4230
  var _ErrorInfo2 = class _ErrorInfo extends Error {
4104
- constructor(message, code, statusCode, cause) {
4231
+ constructor(message, code, statusCode, cause, detail) {
4105
4232
  super(message);
4106
4233
  if (typeof Object.setPrototypeOf !== "undefined") {
4107
4234
  Object.setPrototypeOf(this, _ErrorInfo.prototype);
@@ -4109,6 +4236,7 @@ function requireAbly() {
4109
4236
  this.code = code;
4110
4237
  this.statusCode = statusCode;
4111
4238
  this.cause = cause;
4239
+ this.detail = detail;
4112
4240
  }
4113
4241
  toString() {
4114
4242
  return toString(this);
@@ -4117,12 +4245,13 @@ function requireAbly() {
4117
4245
  var {
4118
4246
  message,
4119
4247
  code,
4120
- statusCode
4248
+ statusCode,
4249
+ detail
4121
4250
  } = values;
4122
- if (typeof message !== "string" || typeof code !== "number" || typeof statusCode !== "number") {
4251
+ if (typeof message !== "string" || typeof code !== "number" || typeof statusCode !== "number" || !_isNil(detail) && (typeof detail !== "object" || Array.isArray(detail))) {
4123
4252
  throw new Error("ErrorInfo.fromValues(): invalid values: " + Platform.Config.inspect(values));
4124
4253
  }
4125
- var result = Object.assign(new _ErrorInfo(message, code, statusCode), values);
4254
+ var result = Object.assign(new _ErrorInfo(message, code, statusCode, void 0, detail), values);
4126
4255
  if (result.code && !result.href) {
4127
4256
  result.href = "https://help.ably.io/error/" + result.code;
4128
4257
  }
@@ -4130,7 +4259,7 @@ function requireAbly() {
4130
4259
  }
4131
4260
  };
4132
4261
  var PartialErrorInfo = class _PartialErrorInfo extends Error {
4133
- constructor(message, code, statusCode, cause) {
4262
+ constructor(message, code, statusCode, cause, detail) {
4134
4263
  super(message);
4135
4264
  if (typeof Object.setPrototypeOf !== "undefined") {
4136
4265
  Object.setPrototypeOf(this, _PartialErrorInfo.prototype);
@@ -4138,6 +4267,7 @@ function requireAbly() {
4138
4267
  this.code = code;
4139
4268
  this.statusCode = statusCode;
4140
4269
  this.cause = cause;
4270
+ this.detail = detail;
4141
4271
  }
4142
4272
  toString() {
4143
4273
  return toString(this);
@@ -4146,12 +4276,13 @@ function requireAbly() {
4146
4276
  var {
4147
4277
  message,
4148
4278
  code,
4149
- statusCode
4279
+ statusCode,
4280
+ detail
4150
4281
  } = values;
4151
- if (typeof message !== "string" || !_isNil(code) && typeof code !== "number" || !_isNil(statusCode) && typeof statusCode !== "number") {
4282
+ if (typeof message !== "string" || !_isNil(code) && typeof code !== "number" || !_isNil(statusCode) && typeof statusCode !== "number" || !_isNil(detail) && (typeof detail !== "object" || Array.isArray(detail))) {
4152
4283
  throw new Error("PartialErrorInfo.fromValues(): invalid values: " + Platform.Config.inspect(values));
4153
4284
  }
4154
- var result = Object.assign(new _PartialErrorInfo(message, code, statusCode), values);
4285
+ var result = Object.assign(new _PartialErrorInfo(message, code, statusCode, void 0, detail), values);
4155
4286
  if (result.code && !result.href) {
4156
4287
  result.href = "https://help.ably.io/error/" + result.code;
4157
4288
  }
@@ -4502,7 +4633,7 @@ function requireAbly() {
4502
4633
  }
4503
4634
 
4504
4635
  // package.json
4505
- var version = "2.17.1";
4636
+ var version = "2.21.0";
4506
4637
 
4507
4638
  // src/common/lib/util/defaults.ts
4508
4639
  var agent = "ably-js/" + version;
@@ -4533,7 +4664,7 @@ function requireAbly() {
4533
4664
  httpMaxRetryCount: 3,
4534
4665
  maxMessageSize: 65536,
4535
4666
  version,
4536
- protocolVersion: 5,
4667
+ protocolVersion: 6,
4537
4668
  agent,
4538
4669
  getPort,
4539
4670
  getHttpScheme,
@@ -6133,7 +6264,7 @@ function requireAbly() {
6133
6264
  this.Utils = utils_exports;
6134
6265
  this.EventEmitter = eventemitter_default;
6135
6266
  this.MessageEncoding = MessageEncoding;
6136
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6267
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6137
6268
  this._additionalHTTPRequestImplementations = (_a2 = options.plugins) != null ? _a2 : null;
6138
6269
  this.logger = new logger_default();
6139
6270
  this.logger.setLog(options.logLevel, options.logHandler);
@@ -6162,6 +6293,7 @@ function requireAbly() {
6162
6293
  this._Crypto = (_f = (_e = options.plugins) == null ? void 0 : _e.Crypto) != null ? _f : null;
6163
6294
  this.__FilteredSubscriptions = (_h = (_g = options.plugins) == null ? void 0 : _g.MessageInteractions) != null ? _h : null;
6164
6295
  this._Annotations = (_j = (_i = options.plugins) == null ? void 0 : _i.Annotations) != null ? _j : null;
6296
+ this._liveObjectsPlugin = (_l = (_k = options.plugins) == null ? void 0 : _k.LiveObjects) != null ? _l : null;
6165
6297
  }
6166
6298
  get rest() {
6167
6299
  if (!this._rest) {
@@ -6644,6 +6776,7 @@ function requireAbly() {
6644
6776
  this.headers = headers;
6645
6777
  this.errorCode = err && err.code;
6646
6778
  this.errorMessage = err && err.message;
6779
+ this.errorDetail = err == null ? void 0 : err.detail;
6647
6780
  }
6648
6781
  toJSON() {
6649
6782
  return {
@@ -6652,7 +6785,8 @@ function requireAbly() {
6652
6785
  success: this.success,
6653
6786
  headers: this.headers,
6654
6787
  errorCode: this.errorCode,
6655
- errorMessage: this.errorMessage
6788
+ errorMessage: this.errorMessage,
6789
+ errorDetail: this.errorDetail
6656
6790
  };
6657
6791
  }
6658
6792
  };
@@ -7340,6 +7474,9 @@ function requireAbly() {
7340
7474
  if (client._Annotations) {
7341
7475
  this._annotations = new client._Annotations.RestAnnotations(this);
7342
7476
  }
7477
+ if (client._liveObjectsPlugin) {
7478
+ this._object = new client._liveObjectsPlugin.RestObject(this);
7479
+ }
7343
7480
  }
7344
7481
  get annotations() {
7345
7482
  if (!this._annotations) {
@@ -7353,6 +7490,12 @@ function requireAbly() {
7353
7490
  }
7354
7491
  return this._push;
7355
7492
  }
7493
+ get object() {
7494
+ if (!this._object) {
7495
+ _throwMissingPluginError("LiveObjects");
7496
+ }
7497
+ return this._object;
7498
+ }
7356
7499
  get logger() {
7357
7500
  return this.client.logger;
7358
7501
  }
@@ -8184,7 +8327,6 @@ function requireAbly() {
8184
8327
  var channelstatechange_default = ChannelStateChange;
8185
8328
 
8186
8329
  // src/common/lib/client/realtimechannel.ts
8187
- var noop = function noop() {};
8188
8330
  function validateChannelOptions(options) {
8189
8331
  if (options && "params" in options && !_isObject(options.params)) {
8190
8332
  return new _ErrorInfo2("options.params must be an object", 4e4, 400);
@@ -8203,7 +8345,7 @@ function requireAbly() {
8203
8345
  }
8204
8346
  var RealtimeChannel = class _RealtimeChannel extends eventemitter_default {
8205
8347
  constructor(client, name, options) {
8206
- var _a2, _b, _c;
8348
+ var _a2, _b;
8207
8349
  super(client.logger);
8208
8350
  this._annotations = null;
8209
8351
  this._mode = 0;
@@ -8260,12 +8402,13 @@ function requireAbly() {
8260
8402
  protocolMessageChannelSerial: null,
8261
8403
  decodeFailureRecoveryInProgress: null
8262
8404
  };
8263
- this._allChannelChanges = new eventemitter_default(this.logger);
8405
+ this._attachedReceived = new eventemitter_default(this.logger);
8406
+ this.internalStateChanges = new eventemitter_default(this.logger);
8264
8407
  if ((_b = client.options.plugins) == null ? void 0 : _b.Push) {
8265
8408
  this._push = new client.options.plugins.Push.PushChannel(this);
8266
8409
  }
8267
- if ((_c = client.options.plugins) == null ? void 0 : _c.LiveObjects) {
8268
- this._object = new client.options.plugins.LiveObjects.RealtimeObject(this);
8410
+ if (client._liveObjectsPlugin) {
8411
+ this._object = new client._liveObjectsPlugin.RealtimeObject(this);
8269
8412
  }
8270
8413
  }
8271
8414
  get presence() {
@@ -8293,6 +8436,14 @@ function requireAbly() {
8293
8436
  }
8294
8437
  return this._object;
8295
8438
  }
8439
+ // Override of EventEmitter method
8440
+ emit(event) {
8441
+ for (var _len0 = arguments.length, args = new Array(_len0 > 1 ? _len0 - 1 : 0), _key0 = 1; _key0 < _len0; _key0++) {
8442
+ args[_key0 - 1] = arguments[_key0];
8443
+ }
8444
+ super.emit(event, ...args);
8445
+ this.internalStateChanges.emit(event, ...args);
8446
+ }
8296
8447
  invalidStateError() {
8297
8448
  return new _ErrorInfo2("Channel operation failed as channel state is " + this.state, 90001, 400, this.errorReason || void 0);
8298
8449
  }
@@ -8317,16 +8468,20 @@ function requireAbly() {
8317
8468
  if (_this67._shouldReattachToSetOptions(options, previousChannelOptions)) {
8318
8469
  _this67.attachImpl();
8319
8470
  return new Promise((resolve, reject) => {
8320
- _this67._allChannelChanges.once(["attached", "update", "detached", "failed"], function (stateChange) {
8321
- switch (this.event) {
8322
- case "update":
8323
- case "attached":
8324
- resolve();
8325
- break;
8326
- default:
8327
- reject(stateChange.reason);
8328
- }
8329
- });
8471
+ var cleanup = () => {
8472
+ _this67._attachedReceived.off(onAttached);
8473
+ _this67.internalStateChanges.off(onFailure);
8474
+ };
8475
+ var onAttached = () => {
8476
+ cleanup();
8477
+ resolve();
8478
+ };
8479
+ var onFailure = stateChange => {
8480
+ cleanup();
8481
+ reject(stateChange.reason);
8482
+ };
8483
+ _this67._attachedReceived.once("attached", onAttached);
8484
+ _this67.internalStateChanges.once(["detached", "failed"], onFailure);
8330
8485
  });
8331
8486
  }
8332
8487
  })();
@@ -8389,10 +8544,7 @@ function requireAbly() {
8389
8544
  messages: wireMessages,
8390
8545
  params: params ? _stringifyValues(params) : void 0
8391
8546
  });
8392
- var res = yield _this68.sendMessage(pm);
8393
- return res || {
8394
- serials: []
8395
- };
8547
+ return _this68.sendAndAwaitAck(pm);
8396
8548
  })();
8397
8549
  }
8398
8550
  throwIfUnpublishableState() {
@@ -8438,7 +8590,7 @@ function requireAbly() {
8438
8590
  if (this.state !== "attaching" || forceReattach) {
8439
8591
  this.requestState("attaching", attachReason);
8440
8592
  }
8441
- this.once(function (stateChange) {
8593
+ this.internalStateChanges.once(function (stateChange) {
8442
8594
  switch (this.event) {
8443
8595
  case "attached":
8444
8596
  callback == null ? void 0 : callback(null, stateChange);
@@ -8473,7 +8625,7 @@ function requireAbly() {
8473
8625
  if (this._lastPayload.decodeFailureRecoveryInProgress) {
8474
8626
  attachMsg.channelSerial = this._lastPayload.protocolMessageChannelSerial;
8475
8627
  }
8476
- this.sendMessage(attachMsg).catch(noop);
8628
+ this.send(attachMsg);
8477
8629
  }
8478
8630
  detach() {
8479
8631
  var _this70 = this;
@@ -8495,7 +8647,7 @@ function requireAbly() {
8495
8647
  _this70.requestState("detaching");
8496
8648
  case "detaching":
8497
8649
  return new Promise((resolve, reject) => {
8498
- _this70.once(function (stateChange) {
8650
+ _this70.internalStateChanges.once(function (stateChange) {
8499
8651
  switch (this.event) {
8500
8652
  case "detached":
8501
8653
  resolve();
@@ -8520,14 +8672,14 @@ function requireAbly() {
8520
8672
  action: actions.DETACH,
8521
8673
  channel: this.name
8522
8674
  });
8523
- this.sendMessage(msg).catch(noop);
8675
+ this.send(msg);
8524
8676
  }
8525
8677
  subscribe() {
8526
8678
  var _arguments3 = arguments,
8527
8679
  _this71 = this;
8528
8680
  return _asyncToGenerator(function* () {
8529
- for (var _len0 = _arguments3.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
8530
- args[_key0] = _arguments3[_key0];
8681
+ for (var _len1 = _arguments3.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
8682
+ args[_key1] = _arguments3[_key1];
8531
8683
  }
8532
8684
  var [event, listener] = _RealtimeChannel.processListenerArgs(args);
8533
8685
  if (_this71.state === "failed") {
@@ -8547,8 +8699,8 @@ function requireAbly() {
8547
8699
  }
8548
8700
  unsubscribe() {
8549
8701
  var _a2;
8550
- for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
8551
- args[_key1] = arguments[_key1];
8702
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
8703
+ args[_key10] = arguments[_key10];
8552
8704
  }
8553
8705
  var [event, listener] = _RealtimeChannel.processListenerArgs(args);
8554
8706
  if (typeof event === "object" && !listener || ((_a2 = this.filteredSubscriptions) == null ? void 0 : _a2.has(listener))) {
@@ -8577,7 +8729,10 @@ function requireAbly() {
8577
8729
  }
8578
8730
  connectionManager.send(syncMessage);
8579
8731
  }
8580
- sendMessage(msg) {
8732
+ send(msg) {
8733
+ this.connectionManager.send(msg);
8734
+ }
8735
+ sendAndAwaitAck(msg) {
8581
8736
  var _this72 = this;
8582
8737
  return _asyncToGenerator(function* () {
8583
8738
  return new Promise((resolve, reject) => {
@@ -8599,7 +8754,7 @@ function requireAbly() {
8599
8754
  channel: _this73.name,
8600
8755
  presence
8601
8756
  });
8602
- yield _this73.sendMessage(msg);
8757
+ yield _this73.sendAndAwaitAck(msg);
8603
8758
  })();
8604
8759
  }
8605
8760
  sendState(objectMessages) {
@@ -8610,7 +8765,7 @@ function requireAbly() {
8610
8765
  channel: _this74.name,
8611
8766
  state: objectMessages
8612
8767
  });
8613
- yield _this74.sendMessage(msg);
8768
+ return _this74.sendAndAwaitAck(msg);
8614
8769
  })();
8615
8770
  }
8616
8771
  // Access to this method is synchronised by ConnectionManager#processChannelMessage, in order to synchronise access to the state stored in _decodingContext.
@@ -8634,17 +8789,17 @@ function requireAbly() {
8634
8789
  var hasPresence = message.hasFlag("HAS_PRESENCE");
8635
8790
  var hasBacklog = message.hasFlag("HAS_BACKLOG");
8636
8791
  var hasObjects = message.hasFlag("HAS_OBJECTS");
8792
+ _this75._attachedReceived.emit("attached");
8637
8793
  if (_this75.state === "attached") {
8638
8794
  if (!resumed) {
8639
8795
  if (_this75._presence) {
8640
8796
  _this75._presence.onAttached(hasPresence);
8641
8797
  }
8642
- if (_this75._object) {
8643
- _this75._object.onAttached(hasObjects);
8644
- }
8798
+ }
8799
+ if (_this75._object) {
8800
+ _this75._object.onAttached(hasObjects);
8645
8801
  }
8646
8802
  var change = new channelstatechange_default(_this75.state, _this75.state, resumed, hasBacklog, message.error);
8647
- _this75._allChannelChanges.emit("update", change);
8648
8803
  if (!resumed || _this75.channelOptions.updateOnAttached) {
8649
8804
  _this75.emit("update", change);
8650
8805
  }
@@ -8824,7 +8979,6 @@ function requireAbly() {
8824
8979
  this._attachResume = false;
8825
8980
  }
8826
8981
  this.state = state;
8827
- this._allChannelChanges.emit(state, change);
8828
8982
  this.emit(state, change);
8829
8983
  }
8830
8984
  requestState(state, reason) {
@@ -8958,7 +9112,7 @@ function requireAbly() {
8958
9112
  sendUpdate(message, action, operation, params) {
8959
9113
  var _this81 = this;
8960
9114
  return _asyncToGenerator(function* () {
8961
- var _a2, _b;
9115
+ var _a2;
8962
9116
  if (!message.serial) {
8963
9117
  throw new _ErrorInfo2('This message lacks a serial and cannot be updated. Make sure you have enabled "Message annotations, updates, and deletes" in channel settings on your dashboard.', 40003, 400);
8964
9118
  }
@@ -8974,9 +9128,9 @@ function requireAbly() {
8974
9128
  messages: [wireMessage],
8975
9129
  params: params ? _stringifyValues(params) : void 0
8976
9130
  });
8977
- var publishResponse = yield _this81.sendMessage(pm);
9131
+ var publishResponse = yield _this81.sendAndAwaitAck(pm);
8978
9132
  return {
8979
- versionSerial: (_b = (_a2 = publishResponse == null ? void 0 : publishResponse.serials) == null ? void 0 : _a2[0]) != null ? _b : null
9133
+ versionSerial: (_a2 = publishResponse.serials[0]) != null ? _a2 : null
8980
9134
  };
8981
9135
  })();
8982
9136
  }
@@ -9046,7 +9200,7 @@ function requireAbly() {
9046
9200
  channel: channelName,
9047
9201
  annotations: [wireAnnotation]
9048
9202
  });
9049
- yield _this84.channel.sendMessage(pm);
9203
+ yield _this84.channel.sendAndAwaitAck(pm);
9050
9204
  })();
9051
9205
  }
9052
9206
  delete(msgOrSerial, annotationValues) {
@@ -9060,8 +9214,8 @@ function requireAbly() {
9060
9214
  var _arguments4 = arguments,
9061
9215
  _this86 = this;
9062
9216
  return _asyncToGenerator(function* () {
9063
- for (var _len10 = _arguments4.length, _args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
9064
- _args[_key10] = _arguments4[_key10];
9217
+ for (var _len11 = _arguments4.length, _args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
9218
+ _args[_key11] = _arguments4[_key11];
9065
9219
  }
9066
9220
  var args = realtimechannel_default.processListenerArgs(_args);
9067
9221
  var event = args[0];
@@ -9080,8 +9234,8 @@ function requireAbly() {
9080
9234
  })();
9081
9235
  }
9082
9236
  unsubscribe() {
9083
- for (var _len11 = arguments.length, _args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
9084
- _args[_key11] = arguments[_key11];
9237
+ for (var _len12 = arguments.length, _args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
9238
+ _args[_key12] = arguments[_key12];
9085
9239
  }
9086
9240
  var args = realtimechannel_default.processListenerArgs(_args);
9087
9241
  var event = args[0];
@@ -9593,7 +9747,7 @@ function requireAbly() {
9593
9747
  var _a2;
9594
9748
  return typeof Platform.WebStorage !== "undefined" && ((_a2 = Platform.WebStorage) == null ? void 0 : _a2.sessionSupported);
9595
9749
  };
9596
- var noop2 = function noop2() {};
9750
+ var noop = function noop() {};
9597
9751
  var transportPreferenceName = "ably-transport-preference";
9598
9752
  function decodeRecoveryKey(recoveryKey) {
9599
9753
  try {
@@ -10458,7 +10612,7 @@ function requireAbly() {
10458
10612
  this.disconnectAllTransports();
10459
10613
  this.connectWs(transportParams, ++this.connectCounter);
10460
10614
  }
10461
- }).catch(noop2);
10615
+ }).catch(noop);
10462
10616
  }
10463
10617
  if (transportPreference && transportPreference === this.baseTransport || this.baseTransport && !this.webSocketTransportAvailable) {
10464
10618
  this.connectBase(transportParams, connectCount);
@@ -10665,7 +10819,7 @@ function requireAbly() {
10665
10819
  * event queueing
10666
10820
  ******************/
10667
10821
  send(msg, queueEvent, callback) {
10668
- callback = callback || noop2;
10822
+ callback = callback || noop;
10669
10823
  var state = this.state;
10670
10824
  if (state.sendEvents) {
10671
10825
  logger_default.logAction(this.logger, logger_default.LOG_MICRO, "ConnectionManager.send()", "sending event");
@@ -10949,7 +11103,7 @@ function requireAbly() {
10949
11103
  * tell the compiler that these cases are possible so that it forces us to handle them.
10950
11104
  */
10951
11105
  constructor(options) {
10952
- var _a2, _b, _c, _d;
11106
+ var _a2, _b;
10953
11107
  super(defaults_default.objectifyOptions(options, false, "BaseRealtime", logger_default.defaultLogger));
10954
11108
  logger_default.logAction(this.logger, logger_default.LOG_MINOR, "Realtime()", "");
10955
11109
  if (typeof EdgeRuntime === "string") {
@@ -10957,7 +11111,6 @@ function requireAbly() {
10957
11111
  }
10958
11112
  this._additionalTransportImplementations = _BaseRealtime.transportImplementationsFromPlugins(this.options.plugins);
10959
11113
  this._RealtimePresence = (_b = (_a2 = this.options.plugins) == null ? void 0 : _a2.RealtimePresence) != null ? _b : null;
10960
- this._liveObjectsPlugin = (_d = (_c = this.options.plugins) == null ? void 0 : _c.LiveObjects) != null ? _d : null;
10961
11114
  this.connection = new connection_default(this, this.options);
10962
11115
  this._channels = new Channels2(this);
10963
11116
  if (this.options.autoConnect !== false) this.connect();
@@ -11545,8 +11698,8 @@ function requireAbly() {
11545
11698
  var _arguments5 = arguments,
11546
11699
  _this102 = this;
11547
11700
  return _asyncToGenerator(function* () {
11548
- for (var _len12 = _arguments5.length, _args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
11549
- _args[_key12] = _arguments5[_key12];
11701
+ for (var _len13 = _arguments5.length, _args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
11702
+ _args[_key13] = _arguments5[_key13];
11550
11703
  }
11551
11704
  var args = realtimechannel_default.processListenerArgs(_args);
11552
11705
  var event = args[0];
@@ -11562,8 +11715,8 @@ function requireAbly() {
11562
11715
  })();
11563
11716
  }
11564
11717
  unsubscribe() {
11565
- for (var _len13 = arguments.length, _args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
11566
- _args[_key13] = arguments[_key13];
11718
+ for (var _len14 = arguments.length, _args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
11719
+ _args[_key14] = arguments[_key14];
11567
11720
  }
11568
11721
  var args = realtimechannel_default.processListenerArgs(_args);
11569
11722
  var event = args[0];
@@ -12181,7 +12334,7 @@ function requireAbly() {
12181
12334
  try {
12182
12335
  return config.getRandomArrayBuffer((keyLength || DEFAULT_KEYLENGTH) / 8);
12183
12336
  } catch (err) {
12184
- throw new _ErrorInfo2("Failed to generate random key: " + err.message, 400, 5e4, err);
12337
+ throw new _ErrorInfo2("Failed to generate random key: " + err.message, 400, 5e4);
12185
12338
  }
12186
12339
  })();
12187
12340
  }
@@ -12790,7 +12943,7 @@ function requireAbly() {
12790
12943
  return responseBody.error && _ErrorInfo2.fromValues(responseBody.error);
12791
12944
  }
12792
12945
  }
12793
- var noop3 = function noop3() {};
12946
+ var noop2 = function noop2() {};
12794
12947
  var idCounter = 0;
12795
12948
  var pendingRequests = {};
12796
12949
  function getHeader(xhr, header) {
@@ -12986,7 +13139,7 @@ function requireAbly() {
12986
13139
  dispose() {
12987
13140
  var xhr = this.xhr;
12988
13141
  if (xhr) {
12989
- xhr.onreadystatechange = xhr.onerror = xhr.onabort = xhr.ontimeout = noop3;
13142
+ xhr.onreadystatechange = xhr.onerror = xhr.onabort = xhr.ontimeout = noop2;
12990
13143
  this.xhr = null;
12991
13144
  var timer = this.timer;
12992
13145
  if (timer) {