@shipengine/js-api 4.17.0 → 4.17.2

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.
@@ -55,22 +55,22 @@ export interface CreateSessionRequest {
55
55
  }
56
56
  export interface UpdatePaymentMethodRequest {
57
57
  /** Billing Address associated with the Payment Method */
58
- billingAddress: {
59
- addressLine1: string;
60
- addressLine2: string;
61
- cityLocality: string;
62
- countryCode: string;
63
- postalCode: string;
64
- stateProvince: string;
58
+ billingAddress?: {
59
+ addressLine1?: string;
60
+ addressLine2?: string;
61
+ cityLocality?: string;
62
+ countryCode?: string;
63
+ postalCode?: string;
64
+ stateProvince?: string;
65
65
  };
66
66
  /** Transaction categories for this Payment Method */
67
- defaultPaymentMethodCategories: AuctanePayTransactionCategory[];
67
+ defaultPaymentMethodCategories?: AuctanePayTransactionCategory[];
68
68
  /** Expiration Date for the Payment Method (Format: MM/YYYY) */
69
- expirationDate: string;
69
+ expirationDate?: string;
70
70
  /** Holder name for the payment method */
71
- holderName: string;
71
+ holderName?: string;
72
72
  /** Nickname used for this Payment Method */
73
- nickname: string;
73
+ nickname?: string;
74
74
  }
75
75
  /**
76
76
  * @category Entities
package/client.d.ts CHANGED
@@ -52,6 +52,11 @@ export interface ShipEngineAPIConfig {
52
52
  * `baseURL` is an optional string that represents the base URL to be used for all requests.
53
53
  */
54
54
  baseURL?: string;
55
+ /**
56
+ * The `debug` flag is an optional boolean that allow to disable the debug logs while working in localhost
57
+ * by default is always enabled
58
+ */
59
+ debug?: boolean;
55
60
  /**
56
61
  * `getSandboxToken` is an optional callback function that returns a token to be used to authenticate sandbox requests.
57
62
  */
@@ -79,7 +84,7 @@ export declare class ShipEngineAPI {
79
84
  private client;
80
85
  private getSandboxToken?;
81
86
  sandboxToken?: string;
82
- constructor(token: string, { baseURL, headers, getToken, getSandboxToken, onApiError }: ShipEngineAPIConfig);
87
+ constructor(token: string, { baseURL, debug, headers, getToken, getSandboxToken, onApiError }: ShipEngineAPIConfig);
83
88
  /**
84
89
  * The `token` method takes in a string and sets it as the Authorization header for all requests.
85
90
  */
package/index.js CHANGED
@@ -21770,7 +21770,7 @@ const logger = E({
21770
21770
  ]
21771
21771
  });
21772
21772
  class ShipEngineAPI {
21773
- constructor(token, { baseURL, headers, getToken, getSandboxToken, onApiError }) {
21773
+ constructor(token, { baseURL, debug = true, headers, getToken, getSandboxToken, onApiError }) {
21774
21774
  this.getSandboxToken = getSandboxToken;
21775
21775
  const client = axios.create({
21776
21776
  baseURL,
@@ -21831,27 +21831,31 @@ class ShipEngineAPI {
21831
21831
  client.interceptors.response.use(
21832
21832
  (res) => {
21833
21833
  var _a;
21834
- logger.info(
21835
- { req: res.config, res },
21836
- "%s %s: %s %s",
21837
- (_a = res.config.method) == null ? void 0 : _a.toUpperCase(),
21838
- res.config.url,
21839
- res.status,
21840
- res.statusText
21841
- );
21834
+ if (debug) {
21835
+ logger.info(
21836
+ { req: res.config, res },
21837
+ "%s %s: %s %s",
21838
+ (_a = res.config.method) == null ? void 0 : _a.toUpperCase(),
21839
+ res.config.url,
21840
+ res.status,
21841
+ res.statusText
21842
+ );
21843
+ }
21842
21844
  return res;
21843
21845
  },
21844
21846
  (err) => __async(this, null, function* () {
21845
21847
  var _a, _b, _c, _d, _e;
21846
- logger.error(
21847
- { err, req: err.config, res: err.response },
21848
- "%s %s: %s %s - %s",
21849
- (_b = (_a = err.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase(),
21850
- (_c = err.config) == null ? void 0 : _c.url,
21851
- (_d = err.response) == null ? void 0 : _d.status,
21852
- (_e = err.response) == null ? void 0 : _e.statusText,
21853
- err.message
21854
- );
21848
+ if (debug) {
21849
+ logger.error(
21850
+ { err, req: err.config, res: err.response },
21851
+ "%s %s: %s %s - %s",
21852
+ (_b = (_a = err.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase(),
21853
+ (_c = err.config) == null ? void 0 : _c.url,
21854
+ (_d = err.response) == null ? void 0 : _d.status,
21855
+ (_e = err.response) == null ? void 0 : _e.statusText,
21856
+ err.message
21857
+ );
21858
+ }
21855
21859
  if (isInvalidTokenError(err)) {
21856
21860
  const token2 = yield err.config.isSandbox ? getSandboxToken == null ? void 0 : getSandboxToken() : getToken();
21857
21861
  const config = err.config;
package/index.mjs CHANGED
@@ -21766,7 +21766,7 @@ const logger = E({
21766
21766
  ]
21767
21767
  });
21768
21768
  class ShipEngineAPI {
21769
- constructor(token, { baseURL, headers, getToken, getSandboxToken, onApiError }) {
21769
+ constructor(token, { baseURL, debug = true, headers, getToken, getSandboxToken, onApiError }) {
21770
21770
  this.getSandboxToken = getSandboxToken;
21771
21771
  const client = axios.create({
21772
21772
  baseURL,
@@ -21827,27 +21827,31 @@ class ShipEngineAPI {
21827
21827
  client.interceptors.response.use(
21828
21828
  (res) => {
21829
21829
  var _a;
21830
- logger.info(
21831
- { req: res.config, res },
21832
- "%s %s: %s %s",
21833
- (_a = res.config.method) == null ? void 0 : _a.toUpperCase(),
21834
- res.config.url,
21835
- res.status,
21836
- res.statusText
21837
- );
21830
+ if (debug) {
21831
+ logger.info(
21832
+ { req: res.config, res },
21833
+ "%s %s: %s %s",
21834
+ (_a = res.config.method) == null ? void 0 : _a.toUpperCase(),
21835
+ res.config.url,
21836
+ res.status,
21837
+ res.statusText
21838
+ );
21839
+ }
21838
21840
  return res;
21839
21841
  },
21840
21842
  (err) => __async(this, null, function* () {
21841
21843
  var _a, _b, _c, _d, _e;
21842
- logger.error(
21843
- { err, req: err.config, res: err.response },
21844
- "%s %s: %s %s - %s",
21845
- (_b = (_a = err.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase(),
21846
- (_c = err.config) == null ? void 0 : _c.url,
21847
- (_d = err.response) == null ? void 0 : _d.status,
21848
- (_e = err.response) == null ? void 0 : _e.statusText,
21849
- err.message
21850
- );
21844
+ if (debug) {
21845
+ logger.error(
21846
+ { err, req: err.config, res: err.response },
21847
+ "%s %s: %s %s - %s",
21848
+ (_b = (_a = err.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase(),
21849
+ (_c = err.config) == null ? void 0 : _c.url,
21850
+ (_d = err.response) == null ? void 0 : _d.status,
21851
+ (_e = err.response) == null ? void 0 : _e.statusText,
21852
+ err.message
21853
+ );
21854
+ }
21851
21855
  if (isInvalidTokenError(err)) {
21852
21856
  const token2 = yield err.config.isSandbox ? getSandboxToken == null ? void 0 : getSandboxToken() : getToken();
21853
21857
  const config = err.config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.17.0",
3
+ "version": "4.17.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {