@shipengine/js-api 1.2.0 → 1.3.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/client.d.ts +2 -0
- package/connections/types.d.ts +17 -17
- package/index.d.ts +1 -0
- package/index.js +85 -45
- package/index.mjs +85 -46
- package/labels/api.d.ts +8 -0
- package/package.json +1 -1
- package/service-points/api.d.ts +19 -0
- package/service-points/index.d.ts +2 -0
- package/service-points/types.d.ts +74 -0
- package/shipping-rules/api.d.ts +3 -3
- package/shipping-rules/types.d.ts +55 -7
- package/types.d.ts +1 -0
package/client.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { RateCardsAPI } from "./rate-cards";
|
|
|
14
14
|
import { RatesAPI } from "./rates";
|
|
15
15
|
import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
|
|
16
16
|
import { SalesOrdersAPI } from "./sales-orders";
|
|
17
|
+
import { ServicePointsAPI } from "./service-points";
|
|
17
18
|
import { ShipmentsAPI } from "./shipments";
|
|
18
19
|
import { ShippingRulesAPI } from "./shipping-rules";
|
|
19
20
|
import { ThemesAPI } from "./themes";
|
|
@@ -158,6 +159,7 @@ export declare class ShipEngineAPI {
|
|
|
158
159
|
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
159
160
|
*/
|
|
160
161
|
get salesOrders(): SalesOrdersAPI;
|
|
162
|
+
get servicePoints(): ServicePointsAPI;
|
|
161
163
|
/**
|
|
162
164
|
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
163
165
|
* API. e.g. Create Shipment, Get Shipment, etc.
|
package/connections/types.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { GenericObject, LocaleBasedQuery } from "../resources";
|
|
2
|
+
/**
|
|
3
|
+
* @category Entities
|
|
4
|
+
*/
|
|
5
|
+
export type CarrierMetadata = {
|
|
6
|
+
beta: boolean;
|
|
7
|
+
carrierFeatures?: {
|
|
8
|
+
country: string;
|
|
9
|
+
featureList: string[];
|
|
10
|
+
}[] | null;
|
|
11
|
+
carrierName: string;
|
|
12
|
+
description: string;
|
|
13
|
+
iconUrl: string;
|
|
14
|
+
logoUrl: string;
|
|
15
|
+
name: string;
|
|
16
|
+
searchTerms?: string[] | null;
|
|
17
|
+
};
|
|
2
18
|
/**
|
|
3
19
|
* @category Requests
|
|
4
20
|
*/
|
|
@@ -17,20 +33,4 @@ export type GetCarrierConnectionFormResponse = {
|
|
|
17
33
|
};
|
|
18
34
|
};
|
|
19
35
|
};
|
|
20
|
-
export type ListCarrierConnectionsResponse = [
|
|
21
|
-
{
|
|
22
|
-
beta: boolean;
|
|
23
|
-
carrierFeatures?: [
|
|
24
|
-
{
|
|
25
|
-
country: string;
|
|
26
|
-
featureList: string[];
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
carrierName: string;
|
|
30
|
-
description: string;
|
|
31
|
-
iconUrl: string;
|
|
32
|
-
logoUrl: string;
|
|
33
|
-
name: string;
|
|
34
|
-
searchTerms?: string[];
|
|
35
|
-
}
|
|
36
|
-
];
|
|
36
|
+
export type ListCarrierConnectionsResponse = CarrierMetadata[];
|
package/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./relay-points";
|
|
|
18
18
|
export * from "./resources";
|
|
19
19
|
export * from "./sales-order-shipments";
|
|
20
20
|
export * from "./sales-orders";
|
|
21
|
+
export * from "./service-points";
|
|
21
22
|
export * from "./shipments";
|
|
22
23
|
export * from "./shipping-rules";
|
|
23
24
|
export * from "./utilities";
|
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$5 = Object.getOwnPropertySymbols;
|
|
14
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __propIsEnum$5 = 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$5.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$5)
|
|
22
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
23
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.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$4 = Object.getOwnPropertySymbols;
|
|
146
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
147
|
+
var __propIsEnum$4 = 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$4.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$4)
|
|
154
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
155
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
156
156
|
target[prop] = source[prop];
|
|
157
157
|
}
|
|
158
158
|
return target;
|
|
@@ -996,21 +996,21 @@ const getEndUserIpAddress = () => __async$4(void 0, null, function* () {
|
|
|
996
996
|
}
|
|
997
997
|
});
|
|
998
998
|
|
|
999
|
-
var __defProp$
|
|
999
|
+
var __defProp$3 = 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$3 = Object.getOwnPropertySymbols;
|
|
1003
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1004
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1005
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1006
|
+
var __spreadValues$3 = (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$3.call(b, prop))
|
|
1009
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1010
|
+
if (__getOwnPropSymbols$3)
|
|
1011
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1012
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1013
|
+
__defNormalProp$3(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$3.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$3)
|
|
1024
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1025
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.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$3({}, connection), {
|
|
1074
1074
|
endUserIpAddress
|
|
1075
1075
|
}));
|
|
1076
1076
|
});
|
|
@@ -3381,19 +3381,19 @@ class CustomPackagesAPI {
|
|
|
3381
3381
|
}
|
|
3382
3382
|
}
|
|
3383
3383
|
|
|
3384
|
-
var __defProp$
|
|
3385
|
-
var __getOwnPropSymbols$
|
|
3386
|
-
var __hasOwnProp$
|
|
3387
|
-
var __propIsEnum$
|
|
3388
|
-
var __defNormalProp$
|
|
3389
|
-
var __spreadValues$
|
|
3384
|
+
var __defProp$2 = Object.defineProperty;
|
|
3385
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
3386
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
3387
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
3388
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3389
|
+
var __spreadValues$2 = (a, b) => {
|
|
3390
3390
|
for (var prop in b || (b = {}))
|
|
3391
|
-
if (__hasOwnProp$
|
|
3392
|
-
__defNormalProp$
|
|
3393
|
-
if (__getOwnPropSymbols$
|
|
3394
|
-
for (var prop of __getOwnPropSymbols$
|
|
3395
|
-
if (__propIsEnum$
|
|
3396
|
-
__defNormalProp$
|
|
3391
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
3392
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3393
|
+
if (__getOwnPropSymbols$2)
|
|
3394
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
3395
|
+
if (__propIsEnum$2.call(b, prop))
|
|
3396
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3397
3397
|
}
|
|
3398
3398
|
return a;
|
|
3399
3399
|
};
|
|
@@ -3440,7 +3440,7 @@ class FundingSourcesAPI {
|
|
|
3440
3440
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3441
3441
|
if (!endUserIpAddress)
|
|
3442
3442
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3443
|
-
return yield this.client.post("/v1/funding_sources", __spreadValues$
|
|
3443
|
+
return yield this.client.post("/v1/funding_sources", __spreadValues$2({
|
|
3444
3444
|
endUserIpAddress
|
|
3445
3445
|
}, createFundingSource));
|
|
3446
3446
|
});
|
|
@@ -3470,7 +3470,7 @@ class FundingSourcesAPI {
|
|
|
3470
3470
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3471
3471
|
if (!endUserIpAddress)
|
|
3472
3472
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3473
|
-
return yield this.client.post("/v1/registration/funding_source", __spreadValues$
|
|
3473
|
+
return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
|
|
3474
3474
|
endUserIpAddress
|
|
3475
3475
|
}, carrier));
|
|
3476
3476
|
});
|
|
@@ -3745,6 +3745,42 @@ class SalesOrdersAPI {
|
|
|
3745
3745
|
}
|
|
3746
3746
|
}
|
|
3747
3747
|
|
|
3748
|
+
var __defProp$1 = Object.defineProperty;
|
|
3749
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
3750
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
3751
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
3752
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3753
|
+
var __spreadValues$1 = (a, b) => {
|
|
3754
|
+
for (var prop in b || (b = {}))
|
|
3755
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
3756
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
3757
|
+
if (__getOwnPropSymbols$1)
|
|
3758
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
3759
|
+
if (__propIsEnum$1.call(b, prop))
|
|
3760
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
3761
|
+
}
|
|
3762
|
+
return a;
|
|
3763
|
+
};
|
|
3764
|
+
class ServicePointsAPI {
|
|
3765
|
+
constructor(client) {
|
|
3766
|
+
/**
|
|
3767
|
+
* The `list` method returns a list of service points based on several factors
|
|
3768
|
+
* A providers list that must contain at least one provider but no more than five
|
|
3769
|
+
* Either an address, coordinates, or an address query
|
|
3770
|
+
*/
|
|
3771
|
+
this.list = (options) => {
|
|
3772
|
+
return this.client.post("/v1/service_points/list", __spreadValues$1({}, options));
|
|
3773
|
+
};
|
|
3774
|
+
/**
|
|
3775
|
+
* Get a specific service point by its carrier code, country code, and id
|
|
3776
|
+
*/
|
|
3777
|
+
this.get = ({ carrierCode, countryCode, id }) => {
|
|
3778
|
+
return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
|
|
3779
|
+
};
|
|
3780
|
+
this.client = client;
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3748
3784
|
var __async$1 = (__this, __arguments, generator) => {
|
|
3749
3785
|
return new Promise((resolve, reject) => {
|
|
3750
3786
|
var fulfilled = (value) => {
|
|
@@ -4162,6 +4198,9 @@ class ShipEngineAPI {
|
|
|
4162
4198
|
get salesOrders() {
|
|
4163
4199
|
return new SalesOrdersAPI(this.client);
|
|
4164
4200
|
}
|
|
4201
|
+
get servicePoints() {
|
|
4202
|
+
return new ServicePointsAPI(this.client);
|
|
4203
|
+
}
|
|
4165
4204
|
/**
|
|
4166
4205
|
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
4167
4206
|
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
@@ -4224,6 +4263,7 @@ exports.RatesAPI = RatesAPI;
|
|
|
4224
4263
|
exports.SE = types;
|
|
4225
4264
|
exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
|
|
4226
4265
|
exports.SalesOrdersAPI = SalesOrdersAPI;
|
|
4266
|
+
exports.ServicePointsAPI = ServicePointsAPI;
|
|
4227
4267
|
exports.ShipEngineAPI = ShipEngineAPI;
|
|
4228
4268
|
exports.ShipmentsAPI = ShipmentsAPI;
|
|
4229
4269
|
exports.ShippingRulesAPI = ShippingRulesAPI;
|
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$5 = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum$5 = 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$5.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$5)
|
|
18
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
19
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.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$4 = Object.getOwnPropertySymbols;
|
|
142
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
143
|
+
var __propIsEnum$4 = 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$4.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$4)
|
|
150
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
151
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
152
152
|
target[prop] = source[prop];
|
|
153
153
|
}
|
|
154
154
|
return target;
|
|
@@ -992,21 +992,21 @@ const getEndUserIpAddress = () => __async$4(void 0, null, function* () {
|
|
|
992
992
|
}
|
|
993
993
|
});
|
|
994
994
|
|
|
995
|
-
var __defProp$
|
|
995
|
+
var __defProp$3 = 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$3 = Object.getOwnPropertySymbols;
|
|
999
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1000
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1001
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1002
|
+
var __spreadValues$3 = (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$3.call(b, prop))
|
|
1005
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1006
|
+
if (__getOwnPropSymbols$3)
|
|
1007
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1008
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1009
|
+
__defNormalProp$3(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$3.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$3)
|
|
1020
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1021
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.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$3({}, connection), {
|
|
1070
1070
|
endUserIpAddress
|
|
1071
1071
|
}));
|
|
1072
1072
|
});
|
|
@@ -3377,19 +3377,19 @@ class CustomPackagesAPI {
|
|
|
3377
3377
|
}
|
|
3378
3378
|
}
|
|
3379
3379
|
|
|
3380
|
-
var __defProp$
|
|
3381
|
-
var __getOwnPropSymbols$
|
|
3382
|
-
var __hasOwnProp$
|
|
3383
|
-
var __propIsEnum$
|
|
3384
|
-
var __defNormalProp$
|
|
3385
|
-
var __spreadValues$
|
|
3380
|
+
var __defProp$2 = Object.defineProperty;
|
|
3381
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
3382
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
3383
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
3384
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3385
|
+
var __spreadValues$2 = (a, b) => {
|
|
3386
3386
|
for (var prop in b || (b = {}))
|
|
3387
|
-
if (__hasOwnProp$
|
|
3388
|
-
__defNormalProp$
|
|
3389
|
-
if (__getOwnPropSymbols$
|
|
3390
|
-
for (var prop of __getOwnPropSymbols$
|
|
3391
|
-
if (__propIsEnum$
|
|
3392
|
-
__defNormalProp$
|
|
3387
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
3388
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3389
|
+
if (__getOwnPropSymbols$2)
|
|
3390
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
3391
|
+
if (__propIsEnum$2.call(b, prop))
|
|
3392
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
3393
3393
|
}
|
|
3394
3394
|
return a;
|
|
3395
3395
|
};
|
|
@@ -3436,7 +3436,7 @@ class FundingSourcesAPI {
|
|
|
3436
3436
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3437
3437
|
if (!endUserIpAddress)
|
|
3438
3438
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3439
|
-
return yield this.client.post("/v1/funding_sources", __spreadValues$
|
|
3439
|
+
return yield this.client.post("/v1/funding_sources", __spreadValues$2({
|
|
3440
3440
|
endUserIpAddress
|
|
3441
3441
|
}, createFundingSource));
|
|
3442
3442
|
});
|
|
@@ -3466,7 +3466,7 @@ class FundingSourcesAPI {
|
|
|
3466
3466
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3467
3467
|
if (!endUserIpAddress)
|
|
3468
3468
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3469
|
-
return yield this.client.post("/v1/registration/funding_source", __spreadValues$
|
|
3469
|
+
return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
|
|
3470
3470
|
endUserIpAddress
|
|
3471
3471
|
}, carrier));
|
|
3472
3472
|
});
|
|
@@ -3741,6 +3741,42 @@ class SalesOrdersAPI {
|
|
|
3741
3741
|
}
|
|
3742
3742
|
}
|
|
3743
3743
|
|
|
3744
|
+
var __defProp$1 = Object.defineProperty;
|
|
3745
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
3746
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
3747
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
3748
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3749
|
+
var __spreadValues$1 = (a, b) => {
|
|
3750
|
+
for (var prop in b || (b = {}))
|
|
3751
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
3752
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
3753
|
+
if (__getOwnPropSymbols$1)
|
|
3754
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
3755
|
+
if (__propIsEnum$1.call(b, prop))
|
|
3756
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
3757
|
+
}
|
|
3758
|
+
return a;
|
|
3759
|
+
};
|
|
3760
|
+
class ServicePointsAPI {
|
|
3761
|
+
constructor(client) {
|
|
3762
|
+
/**
|
|
3763
|
+
* The `list` method returns a list of service points based on several factors
|
|
3764
|
+
* A providers list that must contain at least one provider but no more than five
|
|
3765
|
+
* Either an address, coordinates, or an address query
|
|
3766
|
+
*/
|
|
3767
|
+
this.list = (options) => {
|
|
3768
|
+
return this.client.post("/v1/service_points/list", __spreadValues$1({}, options));
|
|
3769
|
+
};
|
|
3770
|
+
/**
|
|
3771
|
+
* Get a specific service point by its carrier code, country code, and id
|
|
3772
|
+
*/
|
|
3773
|
+
this.get = ({ carrierCode, countryCode, id }) => {
|
|
3774
|
+
return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
|
|
3775
|
+
};
|
|
3776
|
+
this.client = client;
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3744
3780
|
var __async$1 = (__this, __arguments, generator) => {
|
|
3745
3781
|
return new Promise((resolve, reject) => {
|
|
3746
3782
|
var fulfilled = (value) => {
|
|
@@ -4158,6 +4194,9 @@ class ShipEngineAPI {
|
|
|
4158
4194
|
get salesOrders() {
|
|
4159
4195
|
return new SalesOrdersAPI(this.client);
|
|
4160
4196
|
}
|
|
4197
|
+
get servicePoints() {
|
|
4198
|
+
return new ServicePointsAPI(this.client);
|
|
4199
|
+
}
|
|
4161
4200
|
/**
|
|
4162
4201
|
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
4163
4202
|
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
@@ -4195,4 +4234,4 @@ class ShipEngineAPI {
|
|
|
4195
4234
|
}
|
|
4196
4235
|
}
|
|
4197
4236
|
|
|
4198
|
-
export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
|
|
4237
|
+
export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
|
package/labels/api.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ export interface CreateLabelOptions {
|
|
|
27
27
|
* e.g. `4x6` or `8.5x11`
|
|
28
28
|
*/
|
|
29
29
|
labelLayout?: LabelLayout;
|
|
30
|
+
/**
|
|
31
|
+
* A unique identifier for a carrier drop-off point where a merchant plans to deliver packages. This will take precedence over a shipment's Ship From address.
|
|
32
|
+
*/
|
|
33
|
+
shipFromServicePointId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* A unique identifier for a carrier service point where the shipment will be delivered by the carrier. This will take precedence over a shipment's Ship To address.
|
|
36
|
+
*/
|
|
37
|
+
shipToServicePointId?: string;
|
|
30
38
|
/**
|
|
31
39
|
* `validateAddress` is an optional string to control address validation during
|
|
32
40
|
* label purchase.
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import type { GetServicePointParams, ListServicePointsOptions, ServicePointsListResponse } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Service points api
|
|
5
|
+
*/
|
|
6
|
+
export declare class ServicePointsAPI {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* The `list` method returns a list of service points based on several factors
|
|
11
|
+
* A providers list that must contain at least one provider but no more than five
|
|
12
|
+
* Either an address, coordinates, or an address query
|
|
13
|
+
*/
|
|
14
|
+
list: (options: ListServicePointsOptions) => Promise<import("axios").AxiosResponse<ServicePointsListResponse, any>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a specific service point by its carrier code, country code, and id
|
|
17
|
+
*/
|
|
18
|
+
get: ({ carrierCode, countryCode, id }: GetServicePointParams) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Address } from "../addresses";
|
|
2
|
+
import type { CodedError } from "../errors";
|
|
3
|
+
/**
|
|
4
|
+
* Specific error type currently only seen during Service Point requests
|
|
5
|
+
*/
|
|
6
|
+
export type ServicePointCustomError = {
|
|
7
|
+
message: string;
|
|
8
|
+
providerId: string;
|
|
9
|
+
sellerProviderId: number;
|
|
10
|
+
};
|
|
11
|
+
export type ServicePointsListResponse = {
|
|
12
|
+
errors: CodedError[] | ServicePointCustomError[];
|
|
13
|
+
lat: number;
|
|
14
|
+
long: number;
|
|
15
|
+
servicePoints: {
|
|
16
|
+
[P in keyof ServicePoint]: ServicePoint[P] | null;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
export type OperatingHours = {
|
|
20
|
+
close: string;
|
|
21
|
+
open: string;
|
|
22
|
+
};
|
|
23
|
+
export type DayOfOperation = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
|
24
|
+
export type ServicePointFeature = "drop_off_point" | "pickup_point";
|
|
25
|
+
export type ServicePoint = {
|
|
26
|
+
addressLine1: string;
|
|
27
|
+
carrierCode: string;
|
|
28
|
+
cityLocality: string;
|
|
29
|
+
companyName: string;
|
|
30
|
+
countryCode: string;
|
|
31
|
+
distanceInMeters: number;
|
|
32
|
+
features: ServicePointFeature[];
|
|
33
|
+
hoursOfOperation: {
|
|
34
|
+
[key in DayOfOperation]: OperatingHours;
|
|
35
|
+
};
|
|
36
|
+
lat: number;
|
|
37
|
+
long: number;
|
|
38
|
+
phoneNumber: string;
|
|
39
|
+
postalCode: string;
|
|
40
|
+
serviceCodes: string[];
|
|
41
|
+
servicePointId: string;
|
|
42
|
+
stateProvince: string;
|
|
43
|
+
type: "pudo";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Types the 3 separate ways to make a request to the list service points endpoint
|
|
47
|
+
*/
|
|
48
|
+
export type ListServicePointsOptions = {
|
|
49
|
+
maxResults?: number;
|
|
50
|
+
providers: ServicePointProvider[];
|
|
51
|
+
radius?: number;
|
|
52
|
+
} & (ListServicePointsOptionAddress | ListServicePointsOptionAddressQuery | ListServicePointsOptionCoordinates);
|
|
53
|
+
export type ListServicePointsOptionCoordinates = {
|
|
54
|
+
lat: number;
|
|
55
|
+
long: number;
|
|
56
|
+
};
|
|
57
|
+
export type ListServicePointsOptionAddressQuery = {
|
|
58
|
+
addressQuery: string;
|
|
59
|
+
};
|
|
60
|
+
export type ListServicePointsOptionAddress = {
|
|
61
|
+
address: ServicePointAddress;
|
|
62
|
+
};
|
|
63
|
+
export type ServicePointAddress = Omit<Address, "adressResidentialIndicator" | "email" | "name" | "phone" | "companyName" | "stateProvince"> & {
|
|
64
|
+
stateProvince?: string;
|
|
65
|
+
};
|
|
66
|
+
export type ServicePointProvider = {
|
|
67
|
+
carrierId: string;
|
|
68
|
+
serviceCode?: string[];
|
|
69
|
+
};
|
|
70
|
+
export type GetServicePointParams = {
|
|
71
|
+
carrierCode: string;
|
|
72
|
+
countryCode: string;
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
package/shipping-rules/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { RuleConditionsOptions, ShippingRule,
|
|
2
|
+
import { RuleConditionsOptions, ShippingRule, ShippingRuleCreateInput, ShippingRuleEditInput } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* # Shipping Rules API module - /v1/shipping_rules
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ export declare class ShippingRulesAPI {
|
|
|
19
19
|
/**
|
|
20
20
|
* The `create` method creates a new shipping rule for a given user.
|
|
21
21
|
*/
|
|
22
|
-
create: (shippingRule:
|
|
22
|
+
create: (shippingRule: ShippingRuleCreateInput) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
|
|
23
23
|
/**
|
|
24
24
|
* The `delete` method deletes a shipping rule by `shippingRuleId`.
|
|
25
25
|
*/
|
|
@@ -28,7 +28,7 @@ export declare class ShippingRulesAPI {
|
|
|
28
28
|
* The `edit` method edits a specific shipping rule by `shippingRuleId` with a new
|
|
29
29
|
* `ShippingRule`.
|
|
30
30
|
*/
|
|
31
|
-
edit: (shippingRule:
|
|
31
|
+
edit: (shippingRule: ShippingRuleEditInput) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
|
|
32
32
|
/**
|
|
33
33
|
* The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
|
|
34
34
|
*/
|
|
@@ -38,6 +38,13 @@ export interface Rule {
|
|
|
38
38
|
priority: number;
|
|
39
39
|
service: ShippingRuleSelectedService;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @category Entities
|
|
43
|
+
*/
|
|
44
|
+
export interface ExclusionRule {
|
|
45
|
+
conditions: ShippingRulesConditions[];
|
|
46
|
+
services: ShippingRuleSelectedService[];
|
|
47
|
+
}
|
|
41
48
|
/**
|
|
42
49
|
* @category Entities
|
|
43
50
|
*/
|
|
@@ -48,20 +55,61 @@ export interface ShippingRuleSelectedService {
|
|
|
48
55
|
/**
|
|
49
56
|
* @category Entities
|
|
50
57
|
*/
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
export type ShippingRuleSelectedServiceWithPriority = {
|
|
59
|
+
priority: number;
|
|
60
|
+
} & ShippingRuleSelectedService;
|
|
61
|
+
export interface CommonShippingRule {
|
|
62
|
+
code: string;
|
|
54
63
|
createdAt?: ISOString;
|
|
55
|
-
|
|
64
|
+
modifiedAt?: ISOString;
|
|
56
65
|
name: string;
|
|
57
|
-
rules?: Rule[];
|
|
58
66
|
shippingRuleId: string;
|
|
59
|
-
updatedAt?: ISOString;
|
|
60
67
|
}
|
|
61
68
|
/**
|
|
62
69
|
* @category Entities
|
|
63
70
|
*/
|
|
64
|
-
export
|
|
71
|
+
export interface ConditionalShippingRule extends CommonShippingRule {
|
|
72
|
+
default?: ShippingRuleSelectedService;
|
|
73
|
+
rules?: Rule[];
|
|
74
|
+
type: "CONDITIONAL";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @category Entities
|
|
78
|
+
*/
|
|
79
|
+
export interface ServiceGroupShippingRule extends CommonShippingRule {
|
|
80
|
+
exclusionRules?: ExclusionRule[];
|
|
81
|
+
services: ShippingRuleSelectedServiceWithPriority[];
|
|
82
|
+
type: "SERVICE_GROUP";
|
|
83
|
+
}
|
|
84
|
+
export type ShippingRule = ConditionalShippingRule | ServiceGroupShippingRule;
|
|
85
|
+
/**
|
|
86
|
+
* @category Entities
|
|
87
|
+
*/
|
|
88
|
+
export type ShippingRuleType = ShippingRule["type"];
|
|
89
|
+
/**
|
|
90
|
+
* @category Entities
|
|
91
|
+
*/
|
|
92
|
+
export type ConditionalShippingRuleCreateInput = Omit<ConditionalShippingRule, "shippingRuleId" | "code">;
|
|
93
|
+
/**
|
|
94
|
+
* @category Entities
|
|
95
|
+
*/
|
|
96
|
+
export type ServiceGroupShippingRuleCreateInput = Omit<ServiceGroupShippingRule, "shippingRuleId" | "code">;
|
|
97
|
+
/**
|
|
98
|
+
* @category Entities
|
|
99
|
+
*/
|
|
100
|
+
export type ConditionalShippingRuleEditInput = Omit<ConditionalShippingRule, "code">;
|
|
101
|
+
/**
|
|
102
|
+
* @category Entities
|
|
103
|
+
*/
|
|
104
|
+
export type ServiceGroupShippingRuleEditInput = Omit<ServiceGroupShippingRule, "code">;
|
|
105
|
+
/**
|
|
106
|
+
* @category Entities
|
|
107
|
+
*/
|
|
108
|
+
export type ShippingRuleCreateInput = ConditionalShippingRuleCreateInput | ServiceGroupShippingRuleCreateInput;
|
|
109
|
+
/**
|
|
110
|
+
* @category Entities
|
|
111
|
+
*/
|
|
112
|
+
export type ShippingRuleEditInput = ConditionalShippingRuleEditInput | ServiceGroupShippingRuleEditInput;
|
|
65
113
|
/**
|
|
66
114
|
* @category Entities
|
|
67
115
|
*/
|
package/types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./relay-points/types";
|
|
|
18
18
|
export * from "./resources/types";
|
|
19
19
|
export * from "./sales-order-shipments/types";
|
|
20
20
|
export * from "./sales-orders/types";
|
|
21
|
+
export * from "./service-points/types";
|
|
21
22
|
export * from "./shipments/types";
|
|
22
23
|
export * from "./shipping-rules/types";
|
|
23
24
|
export * from "./themes/types";
|