@shipengine/js-api 0.47.2 → 0.48.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
@@ -3779,6 +3779,12 @@ class ShippingRulesAPI {
3779
3779
  shippingRule
3780
3780
  );
3781
3781
  };
3782
+ /**
3783
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
3784
+ */
3785
+ this.getConditionOptions = () => {
3786
+ return this.client.get(`/v1/shipping_rules/rule_conditions_options`);
3787
+ };
3782
3788
  this.client = client;
3783
3789
  }
3784
3790
  }
package/index.mjs CHANGED
@@ -3775,6 +3775,12 @@ class ShippingRulesAPI {
3775
3775
  shippingRule
3776
3776
  );
3777
3777
  };
3778
+ /**
3779
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
3780
+ */
3781
+ this.getConditionOptions = () => {
3782
+ return this.client.get(`/v1/shipping_rules/rule_conditions_options`);
3783
+ };
3778
3784
  this.client = client;
3779
3785
  }
3780
3786
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.47.2",
3
+ "version": "0.48.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { ShippingRule, ShippingRuleInput } from "./types";
2
+ import { RuleConditionsOptions, ShippingRule, ShippingRuleInput } from "./types";
3
3
  /**
4
4
  * # Shipping Rules API module - /v1/shipping_rules
5
5
  */
@@ -29,4 +29,8 @@ export declare class ShippingRulesAPI {
29
29
  * `ShippingRule`.
30
30
  */
31
31
  edit: (shippingRule: ShippingRule) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
32
+ /**
33
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
34
+ */
35
+ getConditionOptions: () => Promise<import("axios").AxiosResponse<RuleConditionsOptions[], any>>;
32
36
  }
@@ -2,17 +2,25 @@ import { ISOString } from "../resources";
2
2
  /**
3
3
  * @category Entities
4
4
  */
5
- type RuleType = "dimension" | "number_of_packages" | "ship_from_address_residential_indicator" | "ship_from_country_code" | "ship_to_address_residential_indicator" | "ship_to_country_code" | "warehouse_id" | "weight";
5
+ type RuleIdentifier = "MAX_DIMENSION" | "NUMBER_OF_PACKAGES" | "SHIP_FROM_ADDRESS_RESIDENTIAL_INDICATOR" | "SHIP_FROM_COUNTRY_CODE" | "SHIP_TO_ADDRESS_RESIDENTIAL_INDICATOR" | "SHIP_TO_COUNTRY_CODE" | "SHIP_TO_POSTAL_CODE" | "SHIP_FROM_POSTAL_CODE" | "SHIPMENT_VALUE" | "WAREHOUSE_ID" | "WEIGHT";
6
6
  /**
7
7
  * @category Entities
8
8
  */
9
- type RuleTypeCondition = "is" | "is_less" | "is_more" | "is_not";
9
+ type RuleOperation = "IS" | "IS_LESS_THAN" | "IS_GREATER_THAN" | "IS_NOT" | "IN" | "NOT_IN" | "STARTS_WITH" | "IS_LESS_OR_EQUAL_TO" | "IS_GREATER_OR_EQUAL_TO";
10
+ /**
11
+ * @category Entities
12
+ */
13
+ type RuleValueType = "STRING" | "LIST" | "INTEGER" | "DECIMAL";
14
+ /**
15
+ * @category Entities
16
+ */
17
+ type RuleValueField = "SELECT" | "MULTISELECT" | "FIELD";
10
18
  /**
11
19
  * @category Entities
12
20
  */
13
21
  export interface ShippingRulesConditions {
14
- identifier: RuleType;
15
- operation: RuleTypeCondition;
22
+ identifier: RuleIdentifier;
23
+ operation: RuleOperation;
16
24
  value: string;
17
25
  }
18
26
  /**
@@ -49,4 +57,15 @@ export interface ShippingRule {
49
57
  * @category Entities
50
58
  */
51
59
  export type ShippingRuleInput = Omit<ShippingRule, "shippingRuleId">;
60
+ /**
61
+ * @category Entities
62
+ */
63
+ export interface RuleConditionsOptions {
64
+ identifier: RuleIdentifier;
65
+ operations: RuleOperation[];
66
+ unitOptions?: string[];
67
+ valueField: RuleValueField;
68
+ valueOptions?: string[];
69
+ valueType: RuleValueType;
70
+ }
52
71
  export {};