@shipengine/js-api 1.21.0 → 1.23.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/connections/api.d.ts +11 -1
- package/connections/settings-types.d.ts +42 -0
- package/connections/types.d.ts +1 -0
- package/index.js +87 -45
- package/index.mjs +87 -45
- package/package.json +1 -1
- package/rates/api.d.ts +6 -28
- package/rates/types.d.ts +43 -25
package/connections/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { CarrierServicesListResponse, ConnectCarrierAccount, ConnectCarrierAccountResponse, GetCarrierConnectionFormParams, GetCarrierConnectionFormResponse, ListCarrierConnectionsParams, ListCarrierConnectionsResponse } from "./types";
|
|
2
|
+
import { CarrierServicesListResponse, ConnectCarrierAccount, ConnectCarrierAccountResponse, ConnectionsCarrierName, ConnectionsCarrierSettingsData, ConnectionsCarrierSettingsResponse, GetCarrierConnectionFormParams, GetCarrierConnectionFormResponse, ListCarrierConnectionsParams, ListCarrierConnectionsResponse } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* # Connections API module - /v1/connections
|
|
5
5
|
*/
|
|
@@ -24,4 +24,14 @@ export declare class ConnectionsAPI {
|
|
|
24
24
|
* identified by the `carrier_code`.
|
|
25
25
|
*/
|
|
26
26
|
getCarrierConnectionsServicesList: (carrierCode: string) => Promise<import("axios").AxiosResponse<CarrierServicesListResponse, any>>;
|
|
27
|
+
/**
|
|
28
|
+
* The `getCarrierSettings` method retrieves the settings for a given carrier,
|
|
29
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
30
|
+
*/
|
|
31
|
+
getCarrierSettings: <T extends ConnectionsCarrierName>(carrierName: T, carrierCode: string) => Promise<import("axios").AxiosResponse<ConnectionsCarrierSettingsResponse<T>, any>>;
|
|
32
|
+
/**
|
|
33
|
+
* The `updateCarrierSettings` method updates the settings for a given carrier,
|
|
34
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
35
|
+
*/
|
|
36
|
+
updateCarrierSettings: <T extends ConnectionsCarrierName>(carrierName: T, carrierCode: string, formData: ConnectionsCarrierSettingsData<T>) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
27
37
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type DHLExpressSettings = {
|
|
2
|
+
isPrimaryAccount: boolean;
|
|
3
|
+
nickname: string;
|
|
4
|
+
shouldHideAccountNumberOnArchiveDoc: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type FedexSettings = {
|
|
7
|
+
isPrimaryAccount: boolean;
|
|
8
|
+
letterheadImage?: string;
|
|
9
|
+
nickname: string;
|
|
10
|
+
pickupType: "none" | "regular_pickup" | "request_courier" | "drop_box" | "business_service_center" | "station";
|
|
11
|
+
signatureImage?: string;
|
|
12
|
+
smartPostEndorsement: "none" | "return_service_requested" | "forwarding_service_requested" | "address_service_requested" | "change_service_requested" | "leave_if_no_response";
|
|
13
|
+
smartPostHub: "none" | "allentown_pa" | "atlanta_ga" | "baltimore_md" | "charlotte_nc" | "chino_ca" | "dallas_tx" | "denver_co" | "detroit_mi" | "edison_nj" | "grove_city_oh" | "groveport_oh" | "houston_tx" | "indianapolis_in" | "kansas_city_ks" | "los_angeles_ca" | "martinsburg_wv" | "memphis_tn" | "minneapolis_mn" | "new_berlin_wi" | "northborough_ma" | "orlando_fl" | "phoneix_az" | "pittsburgh_pa" | "reno_nv" | "sacramento_ca" | "salt_lake_city_ut" | "seattle_wa" | "st_louis_mo" | "windsor_ct" | "newark_ny" | "south_brunswick_nj" | "scranton_pa" | "wheeling_il";
|
|
14
|
+
};
|
|
15
|
+
export type UPSSettings = {
|
|
16
|
+
accountCountryCode: string;
|
|
17
|
+
accountNumber: string;
|
|
18
|
+
accountPostalCode: string;
|
|
19
|
+
invoice?: {
|
|
20
|
+
controlId: string;
|
|
21
|
+
invoiceAmount: number;
|
|
22
|
+
invoiceCurrencyCode: string;
|
|
23
|
+
invoiceDate: string;
|
|
24
|
+
invoiceNumber: string;
|
|
25
|
+
};
|
|
26
|
+
isPrimaryAccount: boolean;
|
|
27
|
+
mailInnovationsCostCenter?: string;
|
|
28
|
+
mailInnovationsCustomerGuid?: string;
|
|
29
|
+
mailInnovationsCustomerId?: string;
|
|
30
|
+
mailInnovationsEndorsement: "none" | "return_service_requested" | "forwarding_service_requested" | "address_service_requested" | "change_service_requested" | "leave_if_no_response";
|
|
31
|
+
nickname: string;
|
|
32
|
+
pickupType: "daily_pickup" | "occasional_pickup" | "customer_counter";
|
|
33
|
+
useCarbonNeutralShippingProgram: boolean;
|
|
34
|
+
useConsolidationServices: boolean;
|
|
35
|
+
useGroundFreightPricing: boolean;
|
|
36
|
+
useNegotiatedRates: boolean;
|
|
37
|
+
useOrderNumberOnMailInnovationsLabels: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type UPSUpdateSettings = Omit<UPSSettings, "accountNumber">;
|
|
40
|
+
export type ConnectionsCarrierName = "dhl_express" | "fedex" | "ups";
|
|
41
|
+
export type ConnectionsCarrierSettingsResponse<Name extends ConnectionsCarrierName = ConnectionsCarrierName> = Name extends "dhl_express" ? DHLExpressSettings : Name extends "fedex" ? FedexSettings : Name extends "ups" ? UPSSettings : never;
|
|
42
|
+
export type ConnectionsCarrierSettingsData<Name extends ConnectionsCarrierName = ConnectionsCarrierName> = Name extends "dhl_express" ? DHLExpressSettings : Name extends "fedex" ? FedexSettings : Name extends "ups" ? UPSUpdateSettings : never;
|
package/connections/types.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -10,17 +10,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
|
|
|
10
10
|
return AccountBillingPlanChangeType2;
|
|
11
11
|
})(AccountBillingPlanChangeType || {});
|
|
12
12
|
|
|
13
|
-
var __getOwnPropSymbols$
|
|
14
|
-
var __hasOwnProp$
|
|
15
|
-
var __propIsEnum$
|
|
13
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
14
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
16
16
|
var __objRest$2 = (source, exclude) => {
|
|
17
17
|
var target = {};
|
|
18
18
|
for (var prop in source)
|
|
19
|
-
if (__hasOwnProp$
|
|
19
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
20
20
|
target[prop] = source[prop];
|
|
21
|
-
if (source != null && __getOwnPropSymbols$
|
|
22
|
-
for (var prop of __getOwnPropSymbols$
|
|
23
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
21
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
22
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
23
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
24
24
|
target[prop] = source[prop];
|
|
25
25
|
}
|
|
26
26
|
return target;
|
|
@@ -142,17 +142,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
142
142
|
RateCardStatus
|
|
143
143
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
144
144
|
|
|
145
|
-
var __getOwnPropSymbols$
|
|
146
|
-
var __hasOwnProp$
|
|
147
|
-
var __propIsEnum$
|
|
145
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
146
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
147
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
148
148
|
var __objRest$1 = (source, exclude) => {
|
|
149
149
|
var target = {};
|
|
150
150
|
for (var prop in source)
|
|
151
|
-
if (__hasOwnProp$
|
|
151
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
152
152
|
target[prop] = source[prop];
|
|
153
|
-
if (source != null && __getOwnPropSymbols$
|
|
154
|
-
for (var prop of __getOwnPropSymbols$
|
|
155
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
153
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
154
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
155
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
156
156
|
target[prop] = source[prop];
|
|
157
157
|
}
|
|
158
158
|
return target;
|
|
@@ -996,21 +996,21 @@ const getEndUserIpAddress = () => __async$5(void 0, null, function* () {
|
|
|
996
996
|
}
|
|
997
997
|
});
|
|
998
998
|
|
|
999
|
-
var __defProp$
|
|
999
|
+
var __defProp$4 = Object.defineProperty;
|
|
1000
1000
|
var __defProps$1 = Object.defineProperties;
|
|
1001
1001
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1002
|
-
var __getOwnPropSymbols$
|
|
1003
|
-
var __hasOwnProp$
|
|
1004
|
-
var __propIsEnum$
|
|
1005
|
-
var __defNormalProp$
|
|
1006
|
-
var __spreadValues$
|
|
1002
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1003
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1004
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1005
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1006
|
+
var __spreadValues$4 = (a, b) => {
|
|
1007
1007
|
for (var prop in b || (b = {}))
|
|
1008
|
-
if (__hasOwnProp$
|
|
1009
|
-
__defNormalProp$
|
|
1010
|
-
if (__getOwnPropSymbols$
|
|
1011
|
-
for (var prop of __getOwnPropSymbols$
|
|
1012
|
-
if (__propIsEnum$
|
|
1013
|
-
__defNormalProp$
|
|
1008
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1009
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1010
|
+
if (__getOwnPropSymbols$4)
|
|
1011
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1012
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1013
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1014
1014
|
}
|
|
1015
1015
|
return a;
|
|
1016
1016
|
};
|
|
@@ -1018,11 +1018,11 @@ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
|
1018
1018
|
var __objRest = (source, exclude) => {
|
|
1019
1019
|
var target = {};
|
|
1020
1020
|
for (var prop in source)
|
|
1021
|
-
if (__hasOwnProp$
|
|
1021
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1022
1022
|
target[prop] = source[prop];
|
|
1023
|
-
if (source != null && __getOwnPropSymbols$
|
|
1024
|
-
for (var prop of __getOwnPropSymbols$
|
|
1025
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1023
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1024
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1025
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1026
1026
|
target[prop] = source[prop];
|
|
1027
1027
|
}
|
|
1028
1028
|
return target;
|
|
@@ -1070,7 +1070,7 @@ class CarriersAPI {
|
|
|
1070
1070
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
1071
1071
|
if (!endUserIpAddress)
|
|
1072
1072
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
1073
|
-
return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$
|
|
1073
|
+
return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$4({}, connection), {
|
|
1074
1074
|
endUserIpAddress
|
|
1075
1075
|
}));
|
|
1076
1076
|
});
|
|
@@ -1221,6 +1221,25 @@ class ConnectionsAPI {
|
|
|
1221
1221
|
`/v1/connections/carriers/${carrierCode}/services`
|
|
1222
1222
|
);
|
|
1223
1223
|
};
|
|
1224
|
+
/**
|
|
1225
|
+
* The `getCarrierSettings` method retrieves the settings for a given carrier,
|
|
1226
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
1227
|
+
*/
|
|
1228
|
+
this.getCarrierSettings = (carrierName, carrierCode) => {
|
|
1229
|
+
return this.client.get(
|
|
1230
|
+
`/v1/connections/carriers/${carrierName}/${carrierCode}/settings`
|
|
1231
|
+
);
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* The `updateCarrierSettings` method updates the settings for a given carrier,
|
|
1235
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
1236
|
+
*/
|
|
1237
|
+
this.updateCarrierSettings = (carrierName, carrierCode, formData) => {
|
|
1238
|
+
return this.client.put(
|
|
1239
|
+
`/v1/connections/carriers/${carrierName}/${carrierCode}/settings`,
|
|
1240
|
+
formData
|
|
1241
|
+
);
|
|
1242
|
+
};
|
|
1224
1243
|
this.client = client;
|
|
1225
1244
|
}
|
|
1226
1245
|
}
|
|
@@ -3434,19 +3453,19 @@ class CustomPackagesAPI {
|
|
|
3434
3453
|
}
|
|
3435
3454
|
}
|
|
3436
3455
|
|
|
3437
|
-
var __defProp$
|
|
3438
|
-
var __getOwnPropSymbols$
|
|
3439
|
-
var __hasOwnProp$
|
|
3440
|
-
var __propIsEnum$
|
|
3441
|
-
var __defNormalProp$
|
|
3442
|
-
var __spreadValues$
|
|
3456
|
+
var __defProp$3 = Object.defineProperty;
|
|
3457
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
3458
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
3459
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
3460
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3461
|
+
var __spreadValues$3 = (a, b) => {
|
|
3443
3462
|
for (var prop in b || (b = {}))
|
|
3444
|
-
if (__hasOwnProp$
|
|
3445
|
-
__defNormalProp$
|
|
3446
|
-
if (__getOwnPropSymbols$
|
|
3447
|
-
for (var prop of __getOwnPropSymbols$
|
|
3448
|
-
if (__propIsEnum$
|
|
3449
|
-
__defNormalProp$
|
|
3463
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
3464
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
3465
|
+
if (__getOwnPropSymbols$3)
|
|
3466
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
3467
|
+
if (__propIsEnum$3.call(b, prop))
|
|
3468
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
3450
3469
|
}
|
|
3451
3470
|
return a;
|
|
3452
3471
|
};
|
|
@@ -3494,7 +3513,7 @@ class FundingSourcesAPI {
|
|
|
3494
3513
|
if (!endUserIpAddress) {
|
|
3495
3514
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3496
3515
|
}
|
|
3497
|
-
return yield this.client.post("/v1/funding_sources", __spreadValues$
|
|
3516
|
+
return yield this.client.post("/v1/funding_sources", __spreadValues$3({
|
|
3498
3517
|
endUserIpAddress
|
|
3499
3518
|
}, createFundingSource));
|
|
3500
3519
|
});
|
|
@@ -3526,7 +3545,7 @@ class FundingSourcesAPI {
|
|
|
3526
3545
|
if (!endUserIpAddress) {
|
|
3527
3546
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3528
3547
|
}
|
|
3529
|
-
return yield this.client.post("/v1/registration/funding_source", __spreadValues$
|
|
3548
|
+
return yield this.client.post("/v1/registration/funding_source", __spreadValues$3({
|
|
3530
3549
|
endUserIpAddress
|
|
3531
3550
|
}, carrier));
|
|
3532
3551
|
});
|
|
@@ -3731,6 +3750,22 @@ class RateCardsAPI {
|
|
|
3731
3750
|
}
|
|
3732
3751
|
}
|
|
3733
3752
|
|
|
3753
|
+
var __defProp$2 = Object.defineProperty;
|
|
3754
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
3755
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
3756
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
3757
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3758
|
+
var __spreadValues$2 = (a, b) => {
|
|
3759
|
+
for (var prop in b || (b = {}))
|
|
3760
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
3761
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3762
|
+
if (__getOwnPropSymbols$2)
|
|
3763
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
3764
|
+
if (__propIsEnum$2.call(b, prop))
|
|
3765
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3766
|
+
}
|
|
3767
|
+
return a;
|
|
3768
|
+
};
|
|
3734
3769
|
class RatesAPI {
|
|
3735
3770
|
constructor(client) {
|
|
3736
3771
|
this.client = client;
|
|
@@ -3744,6 +3779,13 @@ class RatesAPI {
|
|
|
3744
3779
|
shipmentId
|
|
3745
3780
|
});
|
|
3746
3781
|
};
|
|
3782
|
+
/**
|
|
3783
|
+
* The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
|
|
3784
|
+
* method.
|
|
3785
|
+
*/
|
|
3786
|
+
this.estimate = (params) => {
|
|
3787
|
+
return this.client.post("/v1/rates/estimate", __spreadValues$2({}, params));
|
|
3788
|
+
};
|
|
3747
3789
|
this.client = client;
|
|
3748
3790
|
}
|
|
3749
3791
|
}
|
package/index.mjs
CHANGED
|
@@ -6,17 +6,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
|
|
|
6
6
|
return AccountBillingPlanChangeType2;
|
|
7
7
|
})(AccountBillingPlanChangeType || {});
|
|
8
8
|
|
|
9
|
-
var __getOwnPropSymbols$
|
|
10
|
-
var __hasOwnProp$
|
|
11
|
-
var __propIsEnum$
|
|
9
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
12
12
|
var __objRest$2 = (source, exclude) => {
|
|
13
13
|
var target = {};
|
|
14
14
|
for (var prop in source)
|
|
15
|
-
if (__hasOwnProp$
|
|
15
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16
16
|
target[prop] = source[prop];
|
|
17
|
-
if (source != null && __getOwnPropSymbols$
|
|
18
|
-
for (var prop of __getOwnPropSymbols$
|
|
19
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
17
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
18
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
19
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
20
20
|
target[prop] = source[prop];
|
|
21
21
|
}
|
|
22
22
|
return target;
|
|
@@ -138,17 +138,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
138
138
|
RateCardStatus
|
|
139
139
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
140
140
|
|
|
141
|
-
var __getOwnPropSymbols$
|
|
142
|
-
var __hasOwnProp$
|
|
143
|
-
var __propIsEnum$
|
|
141
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
142
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
143
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
144
144
|
var __objRest$1 = (source, exclude) => {
|
|
145
145
|
var target = {};
|
|
146
146
|
for (var prop in source)
|
|
147
|
-
if (__hasOwnProp$
|
|
147
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
148
148
|
target[prop] = source[prop];
|
|
149
|
-
if (source != null && __getOwnPropSymbols$
|
|
150
|
-
for (var prop of __getOwnPropSymbols$
|
|
151
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
149
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
150
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
151
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
152
152
|
target[prop] = source[prop];
|
|
153
153
|
}
|
|
154
154
|
return target;
|
|
@@ -992,21 +992,21 @@ const getEndUserIpAddress = () => __async$5(void 0, null, function* () {
|
|
|
992
992
|
}
|
|
993
993
|
});
|
|
994
994
|
|
|
995
|
-
var __defProp$
|
|
995
|
+
var __defProp$4 = Object.defineProperty;
|
|
996
996
|
var __defProps$1 = Object.defineProperties;
|
|
997
997
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
998
|
-
var __getOwnPropSymbols$
|
|
999
|
-
var __hasOwnProp$
|
|
1000
|
-
var __propIsEnum$
|
|
1001
|
-
var __defNormalProp$
|
|
1002
|
-
var __spreadValues$
|
|
998
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
999
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1000
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1001
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1002
|
+
var __spreadValues$4 = (a, b) => {
|
|
1003
1003
|
for (var prop in b || (b = {}))
|
|
1004
|
-
if (__hasOwnProp$
|
|
1005
|
-
__defNormalProp$
|
|
1006
|
-
if (__getOwnPropSymbols$
|
|
1007
|
-
for (var prop of __getOwnPropSymbols$
|
|
1008
|
-
if (__propIsEnum$
|
|
1009
|
-
__defNormalProp$
|
|
1004
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1005
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1006
|
+
if (__getOwnPropSymbols$4)
|
|
1007
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1008
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1009
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1010
1010
|
}
|
|
1011
1011
|
return a;
|
|
1012
1012
|
};
|
|
@@ -1014,11 +1014,11 @@ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
|
1014
1014
|
var __objRest = (source, exclude) => {
|
|
1015
1015
|
var target = {};
|
|
1016
1016
|
for (var prop in source)
|
|
1017
|
-
if (__hasOwnProp$
|
|
1017
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1018
1018
|
target[prop] = source[prop];
|
|
1019
|
-
if (source != null && __getOwnPropSymbols$
|
|
1020
|
-
for (var prop of __getOwnPropSymbols$
|
|
1021
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1019
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1020
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1021
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1022
1022
|
target[prop] = source[prop];
|
|
1023
1023
|
}
|
|
1024
1024
|
return target;
|
|
@@ -1066,7 +1066,7 @@ class CarriersAPI {
|
|
|
1066
1066
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
1067
1067
|
if (!endUserIpAddress)
|
|
1068
1068
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
1069
|
-
return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$
|
|
1069
|
+
return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$4({}, connection), {
|
|
1070
1070
|
endUserIpAddress
|
|
1071
1071
|
}));
|
|
1072
1072
|
});
|
|
@@ -1217,6 +1217,25 @@ class ConnectionsAPI {
|
|
|
1217
1217
|
`/v1/connections/carriers/${carrierCode}/services`
|
|
1218
1218
|
);
|
|
1219
1219
|
};
|
|
1220
|
+
/**
|
|
1221
|
+
* The `getCarrierSettings` method retrieves the settings for a given carrier,
|
|
1222
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
1223
|
+
*/
|
|
1224
|
+
this.getCarrierSettings = (carrierName, carrierCode) => {
|
|
1225
|
+
return this.client.get(
|
|
1226
|
+
`/v1/connections/carriers/${carrierName}/${carrierCode}/settings`
|
|
1227
|
+
);
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* The `updateCarrierSettings` method updates the settings for a given carrier,
|
|
1231
|
+
* identified by the `carrierName` and `carrierCode`.
|
|
1232
|
+
*/
|
|
1233
|
+
this.updateCarrierSettings = (carrierName, carrierCode, formData) => {
|
|
1234
|
+
return this.client.put(
|
|
1235
|
+
`/v1/connections/carriers/${carrierName}/${carrierCode}/settings`,
|
|
1236
|
+
formData
|
|
1237
|
+
);
|
|
1238
|
+
};
|
|
1220
1239
|
this.client = client;
|
|
1221
1240
|
}
|
|
1222
1241
|
}
|
|
@@ -3430,19 +3449,19 @@ class CustomPackagesAPI {
|
|
|
3430
3449
|
}
|
|
3431
3450
|
}
|
|
3432
3451
|
|
|
3433
|
-
var __defProp$
|
|
3434
|
-
var __getOwnPropSymbols$
|
|
3435
|
-
var __hasOwnProp$
|
|
3436
|
-
var __propIsEnum$
|
|
3437
|
-
var __defNormalProp$
|
|
3438
|
-
var __spreadValues$
|
|
3452
|
+
var __defProp$3 = Object.defineProperty;
|
|
3453
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
3454
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
3455
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
3456
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3457
|
+
var __spreadValues$3 = (a, b) => {
|
|
3439
3458
|
for (var prop in b || (b = {}))
|
|
3440
|
-
if (__hasOwnProp$
|
|
3441
|
-
__defNormalProp$
|
|
3442
|
-
if (__getOwnPropSymbols$
|
|
3443
|
-
for (var prop of __getOwnPropSymbols$
|
|
3444
|
-
if (__propIsEnum$
|
|
3445
|
-
__defNormalProp$
|
|
3459
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
3460
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
3461
|
+
if (__getOwnPropSymbols$3)
|
|
3462
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
3463
|
+
if (__propIsEnum$3.call(b, prop))
|
|
3464
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
3446
3465
|
}
|
|
3447
3466
|
return a;
|
|
3448
3467
|
};
|
|
@@ -3490,7 +3509,7 @@ class FundingSourcesAPI {
|
|
|
3490
3509
|
if (!endUserIpAddress) {
|
|
3491
3510
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3492
3511
|
}
|
|
3493
|
-
return yield this.client.post("/v1/funding_sources", __spreadValues$
|
|
3512
|
+
return yield this.client.post("/v1/funding_sources", __spreadValues$3({
|
|
3494
3513
|
endUserIpAddress
|
|
3495
3514
|
}, createFundingSource));
|
|
3496
3515
|
});
|
|
@@ -3522,7 +3541,7 @@ class FundingSourcesAPI {
|
|
|
3522
3541
|
if (!endUserIpAddress) {
|
|
3523
3542
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3524
3543
|
}
|
|
3525
|
-
return yield this.client.post("/v1/registration/funding_source", __spreadValues$
|
|
3544
|
+
return yield this.client.post("/v1/registration/funding_source", __spreadValues$3({
|
|
3526
3545
|
endUserIpAddress
|
|
3527
3546
|
}, carrier));
|
|
3528
3547
|
});
|
|
@@ -3727,6 +3746,22 @@ class RateCardsAPI {
|
|
|
3727
3746
|
}
|
|
3728
3747
|
}
|
|
3729
3748
|
|
|
3749
|
+
var __defProp$2 = Object.defineProperty;
|
|
3750
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
3751
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
3752
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
3753
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3754
|
+
var __spreadValues$2 = (a, b) => {
|
|
3755
|
+
for (var prop in b || (b = {}))
|
|
3756
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
3757
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3758
|
+
if (__getOwnPropSymbols$2)
|
|
3759
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
3760
|
+
if (__propIsEnum$2.call(b, prop))
|
|
3761
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3762
|
+
}
|
|
3763
|
+
return a;
|
|
3764
|
+
};
|
|
3730
3765
|
class RatesAPI {
|
|
3731
3766
|
constructor(client) {
|
|
3732
3767
|
this.client = client;
|
|
@@ -3740,6 +3775,13 @@ class RatesAPI {
|
|
|
3740
3775
|
shipmentId
|
|
3741
3776
|
});
|
|
3742
3777
|
};
|
|
3778
|
+
/**
|
|
3779
|
+
* The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
|
|
3780
|
+
* method.
|
|
3781
|
+
*/
|
|
3782
|
+
this.estimate = (params) => {
|
|
3783
|
+
return this.client.post("/v1/rates/estimate", __spreadValues$2({}, params));
|
|
3784
|
+
};
|
|
3743
3785
|
this.client = client;
|
|
3744
3786
|
}
|
|
3745
3787
|
}
|
package/package.json
CHANGED
package/rates/api.d.ts
CHANGED
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import {
|
|
3
|
-
import { RateResponse } from "./types";
|
|
4
|
-
/**
|
|
5
|
-
* # Rates API - Calculate Rates Options
|
|
6
|
-
*/
|
|
7
|
-
export interface CalculateRatesOptions {
|
|
8
|
-
/**
|
|
9
|
-
* `calculateTaxAmount` is an optional boolean that indicates rates returned
|
|
10
|
-
* should include the tax amount.
|
|
11
|
-
*/
|
|
12
|
-
calculateTaxAmount?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* `carrierIds` is an array of carrier IDs to filter rates by.
|
|
15
|
-
*/
|
|
16
|
-
carrierIds: string[];
|
|
17
|
-
/**
|
|
18
|
-
* `packageTypes` is an optional array of package types to filter rates by.
|
|
19
|
-
*/
|
|
20
|
-
packageTypes?: string[];
|
|
21
|
-
/**
|
|
22
|
-
* `preferredCurrency` is an optional indicator of the currency to return rates in.
|
|
23
|
-
*/
|
|
24
|
-
preferredCurrency?: Currency;
|
|
25
|
-
/**
|
|
26
|
-
* `serviceCodes` is an optional array of specific carrier service codes to filter rates by.
|
|
27
|
-
*/
|
|
28
|
-
serviceCodes?: string[];
|
|
29
|
-
}
|
|
2
|
+
import { CalculateRatesOptions, RateResponse, RatesEstimateParams, RatesEstimateResponse } from "./types";
|
|
30
3
|
/**
|
|
31
4
|
* # Rates API module - /v1/rates
|
|
32
5
|
*/
|
|
@@ -43,4 +16,9 @@ export declare class RatesAPI {
|
|
|
43
16
|
} & {
|
|
44
17
|
rateResponse: RateResponse;
|
|
45
18
|
}, any>>;
|
|
19
|
+
/**
|
|
20
|
+
* The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
|
|
21
|
+
* method.
|
|
22
|
+
*/
|
|
23
|
+
estimate: (params: RatesEstimateParams) => Promise<import("axios").AxiosResponse<RatesEstimateResponse, any>>;
|
|
46
24
|
}
|
package/rates/types.d.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
|
+
import { DimensionsWithUnit } from "../dimensions";
|
|
1
2
|
import { CodedError } from "../errors";
|
|
2
|
-
import { Money } from "../payments";
|
|
3
|
-
|
|
4
|
-
* @category Entities
|
|
5
|
-
*/
|
|
3
|
+
import { Currency, Money } from "../payments";
|
|
4
|
+
import { WeightWithUnit } from "../weight";
|
|
6
5
|
export type RateType = "check" | "shipment";
|
|
7
|
-
/**
|
|
8
|
-
* @category Entities
|
|
9
|
-
*/
|
|
10
6
|
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
7
|
export type TaxType = "VAT";
|
|
15
|
-
/**
|
|
16
|
-
* @category Entities
|
|
17
|
-
*/
|
|
18
8
|
export type RateDetailAttributes = {
|
|
19
9
|
taxCode: string;
|
|
20
10
|
taxPercentage: number;
|
|
21
11
|
taxType: TaxType;
|
|
22
12
|
};
|
|
23
|
-
/**
|
|
24
|
-
* @category Entities
|
|
25
|
-
*/
|
|
26
13
|
export type RateDetail = {
|
|
27
14
|
amount: Money;
|
|
28
15
|
carrierBillingCode: string | null;
|
|
@@ -31,13 +18,7 @@ export type RateDetail = {
|
|
|
31
18
|
rateDetailAttributes: RateDetailAttributes | null;
|
|
32
19
|
rateDetailType: RateDetailType;
|
|
33
20
|
};
|
|
34
|
-
/**
|
|
35
|
-
* @category Entities
|
|
36
|
-
*/
|
|
37
21
|
export type RateValidationStatus = "valid" | "invalid" | "has_warnings" | "unknown";
|
|
38
|
-
/**
|
|
39
|
-
* @category Entities
|
|
40
|
-
*/
|
|
41
22
|
export interface Rate {
|
|
42
23
|
carrierCode: string;
|
|
43
24
|
carrierDeliveryDays: string;
|
|
@@ -66,9 +47,6 @@ export interface Rate {
|
|
|
66
47
|
warningMessages: string[];
|
|
67
48
|
zone?: number;
|
|
68
49
|
}
|
|
69
|
-
/**
|
|
70
|
-
* @category Entities
|
|
71
|
-
*/
|
|
72
50
|
export interface RateResponse {
|
|
73
51
|
createdAt: string;
|
|
74
52
|
errors: CodedError[];
|
|
@@ -78,3 +56,43 @@ export interface RateResponse {
|
|
|
78
56
|
shipmentId: string;
|
|
79
57
|
status: "working" | "completed" | "partial" | "error";
|
|
80
58
|
}
|
|
59
|
+
export type RatesEstimateResponse = Array<Omit<Rate, "rateId">>;
|
|
60
|
+
export interface CalculateRatesOptions {
|
|
61
|
+
/**
|
|
62
|
+
* `calculateTaxAmount` is an optional boolean that indicates rates returned
|
|
63
|
+
* should include the tax amount.
|
|
64
|
+
*/
|
|
65
|
+
calculateTaxAmount?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* `carrierIds` is an array of carrier IDs to filter rates by.
|
|
68
|
+
*/
|
|
69
|
+
carrierIds: string[];
|
|
70
|
+
/**
|
|
71
|
+
* `packageTypes` is an optional array of package types to filter rates by.
|
|
72
|
+
*/
|
|
73
|
+
packageTypes?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* `preferredCurrency` is an optional indicator of the currency to return rates in.
|
|
76
|
+
*/
|
|
77
|
+
preferredCurrency?: Currency;
|
|
78
|
+
/**
|
|
79
|
+
* `serviceCodes` is an optional array of specific carrier service codes to filter rates by.
|
|
80
|
+
*/
|
|
81
|
+
serviceCodes?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface RatesEstimateParams {
|
|
84
|
+
addressResidentialIndicator: string;
|
|
85
|
+
carrierIds: string[];
|
|
86
|
+
confirmation: string;
|
|
87
|
+
dimensions: DimensionsWithUnit;
|
|
88
|
+
fromCityLocality: string;
|
|
89
|
+
fromCountryCode: string;
|
|
90
|
+
fromPostalCode: string;
|
|
91
|
+
fromStateProvince: string;
|
|
92
|
+
shipDate: string;
|
|
93
|
+
toCityLocality: string;
|
|
94
|
+
toCountryCode: string;
|
|
95
|
+
toPostalCode: string;
|
|
96
|
+
toStateProvince: string;
|
|
97
|
+
weight: WeightWithUnit;
|
|
98
|
+
}
|