@rebilly/instruments 12.4.4 → 12.4.5

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/CHANGELOG.md CHANGED
@@ -1,6 +1 @@
1
- ## [12.4.4](https://github.com/Rebilly/rebilly/compare/instruments/core-v12.4.3...instruments/core-v12.4.4) (2024-12-05)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **cashier:** Fix units issues on the hosted app when injecting styles ([#9054](https://github.com/Rebilly/rebilly/issues/9054)) ([21ac23d](https://github.com/Rebilly/rebilly/commit/21ac23d6dc8800e3facba2681d7999f36e437af8))
1
+ ## [12.4.5](https://github.com/Rebilly/rebilly/compare/instruments/core-v12.4.4...instruments/core-v12.4.5) (2024-12-06)
package/dist/index.js CHANGED
@@ -4058,6 +4058,11 @@ function buildURL(url, params, options) {
4058
4058
  return url;
4059
4059
  }
4060
4060
  const _encode = options && options.encode || encode;
4061
+ if (utils$1.isFunction(options)) {
4062
+ options = {
4063
+ serialize: options
4064
+ };
4065
+ }
4061
4066
  const serializeFn = options && options.serialize;
4062
4067
  let serializedParams;
4063
4068
  if (serializeFn) {
@@ -4737,45 +4742,13 @@ const progressEventDecorator = (total, throttled) => {
4737
4742
  }), throttled[1]];
4738
4743
  };
4739
4744
  const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
4740
- const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
4741
- // Standard browser envs have full support of the APIs needed to test
4742
- // whether the request URL is of the same origin as current location.
4743
- function standardBrowserEnv() {
4744
- const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
4745
- const urlParsingNode = document.createElement("a");
4746
- let originURL;
4747
- function resolveURL(url) {
4748
- let href = url;
4749
- if (msie) {
4750
- urlParsingNode.setAttribute("href", href);
4751
- href = urlParsingNode.href;
4752
- }
4753
- urlParsingNode.setAttribute("href", href);
4754
- return {
4755
- href: urlParsingNode.href,
4756
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
4757
- host: urlParsingNode.host,
4758
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
4759
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
4760
- hostname: urlParsingNode.hostname,
4761
- port: urlParsingNode.port,
4762
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
4763
- };
4764
- }
4765
- originURL = resolveURL(window.location.href);
4766
- return function isURLSameOrigin2(requestURL) {
4767
- const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
4768
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
4769
- };
4770
- }()
4771
- ) : (
4772
- // Non standard browser envs (web workers, react-native) lack needed support.
4773
- /* @__PURE__ */ function nonStandardBrowserEnv() {
4774
- return function isURLSameOrigin2() {
4775
- return true;
4776
- };
4777
- }()
4778
- );
4745
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
4746
+ url = new URL(url, platform.origin);
4747
+ return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
4748
+ })(
4749
+ new URL(platform.origin),
4750
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
4751
+ ) : () => true;
4779
4752
  const cookies = platform.hasStandardBrowserEnv ? (
4780
4753
  // Standard browser envs support document.cookie
4781
4754
  {
@@ -4823,7 +4796,7 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing }
4823
4796
  function mergeConfig(config1, config2) {
4824
4797
  config2 = config2 || {};
4825
4798
  const config = {};
4826
- function getMergedValue(target, source, caseless) {
4799
+ function getMergedValue(target, source, prop, caseless) {
4827
4800
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
4828
4801
  return utils$1.merge.call({ caseless }, target, source);
4829
4802
  } else if (utils$1.isPlainObject(source)) {
@@ -4833,11 +4806,11 @@ function mergeConfig(config1, config2) {
4833
4806
  }
4834
4807
  return source;
4835
4808
  }
4836
- function mergeDeepProperties(a, b2, caseless) {
4809
+ function mergeDeepProperties(a, b2, prop, caseless) {
4837
4810
  if (!utils$1.isUndefined(b2)) {
4838
- return getMergedValue(a, b2, caseless);
4811
+ return getMergedValue(a, b2, prop, caseless);
4839
4812
  } else if (!utils$1.isUndefined(a)) {
4840
- return getMergedValue(void 0, a, caseless);
4813
+ return getMergedValue(void 0, a, prop, caseless);
4841
4814
  }
4842
4815
  }
4843
4816
  function valueFromConfig2(a, b2) {
@@ -4888,7 +4861,7 @@ function mergeConfig(config1, config2) {
4888
4861
  socketPath: defaultToConfig2,
4889
4862
  responseEncoding: defaultToConfig2,
4890
4863
  validateStatus: mergeDirectKeys,
4891
- headers: (a, b2) => mergeDeepProperties(headersToObject(a), headersToObject(b2), true)
4864
+ headers: (a, b2, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b2), prop, true)
4892
4865
  };
4893
4866
  utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
4894
4867
  const merge2 = mergeMap[prop] || mergeDeepProperties;
@@ -5418,7 +5391,7 @@ function dispatchRequest(config) {
5418
5391
  return Promise.reject(reason);
5419
5392
  });
5420
5393
  }
5421
- const VERSION = "1.7.7";
5394
+ const VERSION = "1.7.9";
5422
5395
  const validators$1 = {};
5423
5396
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
5424
5397
  validators$1[type] = function validator2(thing) {
@@ -5449,6 +5422,12 @@ validators$1.transitional = function transitional(validator2, version, message)
5449
5422
  return validator2 ? validator2(value, opt, opts) : true;
5450
5423
  };
5451
5424
  };
5425
+ validators$1.spelling = function spelling(correctSpelling) {
5426
+ return (value, opt) => {
5427
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
5428
+ return true;
5429
+ };
5430
+ };
5452
5431
  function assertOptions(options, schema, allowUnknown) {
5453
5432
  if (typeof options !== "object") {
5454
5433
  throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
@@ -5497,8 +5476,8 @@ class Axios {
5497
5476
  return await this._request(configOrUrl, config);
5498
5477
  } catch (err) {
5499
5478
  if (err instanceof Error) {
5500
- let dummy;
5501
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
5479
+ let dummy = {};
5480
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
5502
5481
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
5503
5482
  try {
5504
5483
  if (!err.stack) {
@@ -5540,6 +5519,10 @@ class Axios {
5540
5519
  }, true);
5541
5520
  }
5542
5521
  }
5522
+ validator.assertOptions(config, {
5523
+ baseUrl: validators.spelling("baseURL"),
5524
+ withXsrfToken: validators.spelling("withXSRFToken")
5525
+ }, true);
5543
5526
  config.method = (config.method || this.defaults.method || "get").toLowerCase();
5544
5527
  let contextHeaders = headers && utils$1.merge(
5545
5528
  headers.common,
@@ -6288,7 +6271,7 @@ function C$1({ options: e2 }) {
6288
6271
  }
6289
6272
  function o2() {
6290
6273
  const i = {
6291
- "REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@774bc4a`
6274
+ "REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@f1c7474`
6292
6275
  };
6293
6276
  return e2.apiKey && (i["REB-APIKEY"] = e2.apiKey), i;
6294
6277
  }