@shipengine/js-api 1.14.0 → 1.16.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
@@ -1201,7 +1201,15 @@ class ConnectionsAPI {
1201
1201
  this.connectCarrier = (carrierName, formData) => __async$3(this, null, function* () {
1202
1202
  return yield this.client.post(
1203
1203
  `/v1/connections/carriers/${carrierName}`,
1204
- formData
1204
+ formData,
1205
+ {
1206
+ // This actually doesn't work in-browser; redirects will still be followed if the location header
1207
+ // is set. This is relying on the Elements Proxy stripping that header and putting it in the body.
1208
+ maxRedirects: 0,
1209
+ validateStatus: (status) => {
1210
+ return status >= 200 && status < 400;
1211
+ }
1212
+ }
1205
1213
  );
1206
1214
  });
1207
1215
  /**
@@ -3864,6 +3872,12 @@ class ServicePointsAPI {
3864
3872
  this.get = ({ carrierCode, countryCode, id }) => {
3865
3873
  return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
3866
3874
  };
3875
+ /**
3876
+ * Get an OAuth token to make HERE Maps API requests
3877
+ */
3878
+ this.getHereToken = () => {
3879
+ return this.client.get("/here-api/generate-token");
3880
+ };
3867
3881
  this.client = client;
3868
3882
  }
3869
3883
  }
package/index.mjs CHANGED
@@ -1197,7 +1197,15 @@ class ConnectionsAPI {
1197
1197
  this.connectCarrier = (carrierName, formData) => __async$3(this, null, function* () {
1198
1198
  return yield this.client.post(
1199
1199
  `/v1/connections/carriers/${carrierName}`,
1200
- formData
1200
+ formData,
1201
+ {
1202
+ // This actually doesn't work in-browser; redirects will still be followed if the location header
1203
+ // is set. This is relying on the Elements Proxy stripping that header and putting it in the body.
1204
+ maxRedirects: 0,
1205
+ validateStatus: (status) => {
1206
+ return status >= 200 && status < 400;
1207
+ }
1208
+ }
1201
1209
  );
1202
1210
  });
1203
1211
  /**
@@ -3860,6 +3868,12 @@ class ServicePointsAPI {
3860
3868
  this.get = ({ carrierCode, countryCode, id }) => {
3861
3869
  return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
3862
3870
  };
3871
+ /**
3872
+ * Get an OAuth token to make HERE Maps API requests
3873
+ */
3874
+ this.getHereToken = () => {
3875
+ return this.client.get("/here-api/generate-token");
3876
+ };
3863
3877
  this.client = client;
3864
3878
  }
3865
3879
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/rates/types.d.ts CHANGED
@@ -4,6 +4,20 @@ import { Money } from "../payments";
4
4
  * @category Entities
5
5
  */
6
6
  export type RateType = "check" | "shipment";
7
+ /**
8
+ * @category Entities
9
+ */
10
+ export type RateDetailType = "uncategorized" | "shipping" | "insurance" | "confirmation" | "discount" | "fuel_charge" | "additional_fees" | "tariff" | "tax" | "delivery" | "handling" | "special_goods" | "pickup" | "location_fee" | "oversize" | "returns" | "notifications" | "tip" | "duties_and_taxes" | "brokerage_fee" | "admin_fee" | "adjustment";
11
+ /**
12
+ * @category Entities
13
+ */
14
+ export type RateDetail = {
15
+ amount: Money;
16
+ carrierBillingCode: string;
17
+ carrierDescription: string;
18
+ carrierMemo: string;
19
+ rateDetailType: RateDetailType;
20
+ };
7
21
  /**
8
22
  * @category Entities
9
23
  */
@@ -26,6 +40,7 @@ export interface Rate {
26
40
  negotiatedRate: boolean;
27
41
  otherAmount: Money;
28
42
  packageType: string;
43
+ rateDetails: RateDetail[];
29
44
  rateId: string;
30
45
  rateType: RateType;
31
46
  serviceCode: string;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import type { GetServicePointParams, ListServicePointsOptions, ServicePointsListResponse } from "./types";
2
+ import type { GetServicePointParams, HereTokenResponse, ListServicePointsOptions, ServicePointsListResponse } from "./types";
3
3
  /**
4
4
  * Service points api
5
5
  */
@@ -16,4 +16,8 @@ export declare class ServicePointsAPI {
16
16
  * Get a specific service point by its carrier code, country code, and id
17
17
  */
18
18
  get: ({ carrierCode, countryCode, id }: GetServicePointParams) => Promise<import("axios").AxiosResponse<any, any>>;
19
+ /**
20
+ * Get an OAuth token to make HERE Maps API requests
21
+ */
22
+ getHereToken: () => Promise<import("axios").AxiosResponse<HereTokenResponse, any>>;
19
23
  }
@@ -72,3 +72,8 @@ export type GetServicePointParams = {
72
72
  countryCode: string;
73
73
  id: string;
74
74
  };
75
+ export type HereTokenResponse = {
76
+ accessToken: string;
77
+ expiresIn: number;
78
+ tokenType: string;
79
+ };