@shipengine/js-api 1.8.0 → 1.9.0

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/index.js CHANGED
@@ -21322,7 +21322,6 @@ class ShipEngineAPI {
21322
21322
  const client = axios.create({
21323
21323
  baseURL,
21324
21324
  headers: __spreadProps(__spreadValues({}, headers), {
21325
- Authorization: `Bearer ${token}`,
21326
21325
  "Content-Type": "application/json"
21327
21326
  }),
21328
21327
  paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
@@ -21355,6 +21354,7 @@ class ShipEngineAPI {
21355
21354
  }
21356
21355
  ]
21357
21356
  });
21357
+ client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
21358
21358
  client.interceptors.response.use(
21359
21359
  (res) => {
21360
21360
  var _a;
@@ -21382,9 +21382,11 @@ class ShipEngineAPI {
21382
21382
  if (isInvalidTokenError(err)) {
21383
21383
  const token2 = yield getToken();
21384
21384
  const config = err.config;
21385
+ this.token = token2;
21385
21386
  if (config) {
21386
21387
  config.headers || (config.headers = {});
21387
21388
  config.headers["Authorization"] = `Bearer ${token2}`;
21389
+ config.data = config.data && !(config.data instanceof FormData) ? JSON.parse(config.data) : config.data;
21388
21390
  }
21389
21391
  return axios(config);
21390
21392
  }
package/index.mjs CHANGED
@@ -21318,7 +21318,6 @@ class ShipEngineAPI {
21318
21318
  const client = axios.create({
21319
21319
  baseURL,
21320
21320
  headers: __spreadProps(__spreadValues({}, headers), {
21321
- Authorization: `Bearer ${token}`,
21322
21321
  "Content-Type": "application/json"
21323
21322
  }),
21324
21323
  paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
@@ -21351,6 +21350,7 @@ class ShipEngineAPI {
21351
21350
  }
21352
21351
  ]
21353
21352
  });
21353
+ client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
21354
21354
  client.interceptors.response.use(
21355
21355
  (res) => {
21356
21356
  var _a;
@@ -21378,9 +21378,11 @@ class ShipEngineAPI {
21378
21378
  if (isInvalidTokenError(err)) {
21379
21379
  const token2 = yield getToken();
21380
21380
  const config = err.config;
21381
+ this.token = token2;
21381
21382
  if (config) {
21382
21383
  config.headers || (config.headers = {});
21383
21384
  config.headers["Authorization"] = `Bearer ${token2}`;
21385
+ config.data = config.data && !(config.data instanceof FormData) ? JSON.parse(config.data) : config.data;
21384
21386
  }
21385
21387
  return axios(config);
21386
21388
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -138,7 +138,6 @@ export interface Product {
138
138
  description?: string;
139
139
  harmonizedTariffCode?: string;
140
140
  midCode?: string;
141
- productId?: string;
142
141
  productUrl?: string;
143
142
  quantity: number;
144
143
  sku?: string;
@@ -196,12 +195,30 @@ export type OriginTypes = "pickup" | "drop_off";
196
195
  * @category Entities
197
196
  */
198
197
  export type PaymentTypes = "any" | "cash" | "cash_equivalent" | "none";
198
+ /**
199
+ * @deprecated since July 2023
200
+ */
201
+ export interface CustomsItem {
202
+ countryOfOrigin?: string;
203
+ customsItemId?: string;
204
+ description?: string;
205
+ harmonizedTariffCode?: string;
206
+ quantity: number;
207
+ sku?: string;
208
+ skuDescription?: string;
209
+ unitOfMeasure?: string;
210
+ value: Money | number;
211
+ }
199
212
  /**
200
213
  * @category Entities
201
214
  */
202
215
  export type Customs = {
203
216
  contents: CustomsContents;
204
217
  contentsExplanation?: string;
218
+ /**
219
+ * @deprecated since July 2023
220
+ */
221
+ customsItems?: CustomsItem[];
205
222
  declaration?: string;
206
223
  importerOfRecord?: Address;
207
224
  invoiceAdditionalDetails?: CustomsInvoiceAdditionalDetails;