@shipengine/elements 0.11.1 → 0.12.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/components/configure-shipment/configure-shipment.d.ts +3 -2
- package/components/configure-shipment/hooks/use-address.d.ts +3 -1
- package/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -1
- package/components/index.d.ts +2 -0
- package/components/manage-funding/index.d.ts +1 -0
- package/components/manage-funding/manage-funding.d.ts +2 -0
- package/components/register-wallet/index.d.ts +1 -0
- package/components/register-wallet/register-wallet.d.ts +9 -0
- package/components/sales-order/sales-order.d.ts +2 -1
- package/index.cjs +18 -4
- package/index.d.ts +1 -0
- package/index.js +17 -4
- package/package.json +4 -4
- package/register-wallet.d.ts +1 -0
|
@@ -3,13 +3,14 @@ import * as SE from "@shipengine/types";
|
|
|
3
3
|
import { UseShippingPresetsOptionsProps } from "@shipengine/elements-ui";
|
|
4
4
|
import { UseRatesFormProps, UseShipmentFormProps } from "./hooks";
|
|
5
5
|
export type ShipmentFormMode = "browse_rates" | "select_service";
|
|
6
|
-
export type
|
|
6
|
+
export type ConfigureShipmentFeatures = {
|
|
7
|
+
compatibleCountryCodes?: UseShipmentFormProps["compatibleCountryCodes"];
|
|
7
8
|
rateForm?: Templates.RateFormFeatures;
|
|
8
9
|
shipmentForm?: Templates.ShipmentFormFeatures;
|
|
9
10
|
};
|
|
10
11
|
export type ConfigureShipmentProps = {
|
|
11
12
|
errors?: Templates.ShipmentFormProps["errors"];
|
|
12
|
-
features?:
|
|
13
|
+
features?: ConfigureShipmentFeatures;
|
|
13
14
|
isLoading?: Templates.ShipmentFormProps["isLoading"];
|
|
14
15
|
onAddressValidation?: UseShipmentFormProps["onAddressValidation"];
|
|
15
16
|
onApplyPreset?: UseShipmentFormProps["onApplyPreset"];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Templates } from "@shipengine/elements-ui";
|
|
2
2
|
import * as SE from "@shipengine/types";
|
|
3
|
+
import { CountryCode } from "@shipengine/elements-core";
|
|
3
4
|
export type UseAddressProps = {
|
|
5
|
+
compatibleCountryCodes?: CountryCode[];
|
|
4
6
|
onChange?: (oldShipment: SE.SalesOrderShipment, updatedShipment: SE.SalesOrderShipment) => Promise<void> | void;
|
|
5
7
|
onValidation?: (addressPreference: Templates.AddressPreference) => Promise<void> | void;
|
|
6
8
|
salesOrder: SE.SalesOrder;
|
|
7
9
|
shipment?: SE.SalesOrderShipment;
|
|
8
10
|
};
|
|
9
|
-
export declare const useAddress: ({ onChange, onValidation, salesOrder, shipment }: UseAddressProps) => {
|
|
11
|
+
export declare const useAddress: ({ compatibleCountryCodes, onChange, onValidation, salesOrder, shipment, }: UseAddressProps) => {
|
|
10
12
|
addressErrors: SE.CodedError[] | undefined;
|
|
11
13
|
addressPreference: Templates.AddressPreference | undefined;
|
|
12
14
|
charsetWarning: Templates.CharsetWarning | undefined;
|
|
@@ -3,6 +3,7 @@ import * as SE from "@shipengine/types";
|
|
|
3
3
|
import { UseAddressProps } from "./use-address";
|
|
4
4
|
import { UsePresetsProps } from "./use-presets";
|
|
5
5
|
export type UseShipmentFormProps = {
|
|
6
|
+
compatibleCountryCodes?: UseAddressProps["compatibleCountryCodes"];
|
|
6
7
|
onAddressValidation?: UseAddressProps["onValidation"];
|
|
7
8
|
onApplyPreset?: UsePresetsProps["onApply"];
|
|
8
9
|
onChangeAddress?: UseAddressProps["onChange"];
|
|
@@ -11,7 +12,7 @@ export type UseShipmentFormProps = {
|
|
|
11
12
|
salesOrder: SE.SalesOrder;
|
|
12
13
|
shipment?: SE.SalesOrderShipment;
|
|
13
14
|
};
|
|
14
|
-
export declare const useShipmentForm: ({ onAddressValidation, onApplyPreset, onChangeAddress, onShipmentUpdated, onSubmit, salesOrder, shipment, }: UseShipmentFormProps) => {
|
|
15
|
+
export declare const useShipmentForm: ({ compatibleCountryCodes, onAddressValidation, onApplyPreset, onChangeAddress, onShipmentUpdated, onSubmit, salesOrder, shipment, }: UseShipmentFormProps) => {
|
|
15
16
|
addressPreference: import("dist/elements-ui/components/templates").AddressPreference | undefined;
|
|
16
17
|
charsetWarning: import("dist/elements-ui/components/templates").CharsetWarning | undefined;
|
|
17
18
|
carriers: SE.Carrier[] | undefined;
|
package/components/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./manage-funding";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./register-wallet";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Templates } from "@shipengine/elements-ui";
|
|
2
|
+
export type WalletFeatures = {
|
|
3
|
+
wallet?: Templates.RegisterWalletFeatures;
|
|
4
|
+
};
|
|
5
|
+
export type RegisterWalletProps = {
|
|
6
|
+
features: WalletFeatures;
|
|
7
|
+
onRegisterWallet: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const RegisterWallet: ({ features, onRegisterWallet }: RegisterWalletProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { UseConfigureShipmentProps, UseImportSalesOrderProps } from "./hooks";
|
|
|
4
4
|
export type SalesOrderProps = {
|
|
5
5
|
externalOrderId?: UseImportSalesOrderProps["externalOrderId"];
|
|
6
6
|
externalOrderNumber?: UseImportSalesOrderProps["externalOrderNumber"];
|
|
7
|
+
features?: ConfigureShipmentProps["features"];
|
|
7
8
|
onAddressValidation?: ConfigureShipmentProps["onAddressValidation"];
|
|
8
9
|
onApplyPreset?: ConfigureShipmentProps["onApplyPreset"];
|
|
9
10
|
onBeforeLabelCreate?: ConfigureShipmentProps["onBeforeLabelCreate"];
|
|
@@ -22,4 +23,4 @@ export type SalesOrderProps = {
|
|
|
22
23
|
shippingPresets?: UseShippingPresetsOptionsProps;
|
|
23
24
|
warehouseId?: UseConfigureShipmentProps["warehouseId"];
|
|
24
25
|
};
|
|
25
|
-
export declare const SalesOrder: ({ externalOrderId, externalOrderNumber, onLoad, onShipmentUpdated, orderSourceCode, salesOrderId, warehouseId, ...props }: SalesOrderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare const SalesOrder: ({ features, externalOrderId, externalOrderNumber, onLoad, onShipmentUpdated, orderSourceCode, salesOrderId, warehouseId, ...props }: SalesOrderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
package/index.cjs
CHANGED
|
@@ -19183,6 +19183,7 @@ var lodash = {exports: {}};
|
|
|
19183
19183
|
var _ = lodash.exports;
|
|
19184
19184
|
|
|
19185
19185
|
const useAddress = ({
|
|
19186
|
+
compatibleCountryCodes,
|
|
19186
19187
|
onChange,
|
|
19187
19188
|
onValidation,
|
|
19188
19189
|
salesOrder,
|
|
@@ -19194,7 +19195,7 @@ const useAddress = ({
|
|
|
19194
19195
|
const {
|
|
19195
19196
|
errors: validateAddressErrors,
|
|
19196
19197
|
trigger: validateAddresses
|
|
19197
|
-
} = elementsCore.useValidateAddresses();
|
|
19198
|
+
} = elementsCore.useValidateAddresses(compatibleCountryCodes);
|
|
19198
19199
|
const {
|
|
19199
19200
|
errors: updateShipmentErrors,
|
|
19200
19201
|
trigger: updateShipment
|
|
@@ -19732,6 +19733,7 @@ const useRatesForm = ({
|
|
|
19732
19733
|
};
|
|
19733
19734
|
|
|
19734
19735
|
const useShipmentForm = ({
|
|
19736
|
+
compatibleCountryCodes,
|
|
19735
19737
|
onAddressValidation,
|
|
19736
19738
|
onApplyPreset,
|
|
19737
19739
|
onChangeAddress,
|
|
@@ -19762,6 +19764,7 @@ const useShipmentForm = ({
|
|
|
19762
19764
|
handleChangeAddress,
|
|
19763
19765
|
handleParseShipTo
|
|
19764
19766
|
} = useAddress({
|
|
19767
|
+
compatibleCountryCodes,
|
|
19765
19768
|
onChange: react.useCallback((oldShipment, updatedShipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19766
19769
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
19767
19770
|
yield onChangeAddress === null || onChangeAddress === void 0 ? void 0 : onChangeAddress(oldShipment, updatedShipment);
|
|
@@ -19852,6 +19855,7 @@ const ConfigureShipment = _a => {
|
|
|
19852
19855
|
} = _b,
|
|
19853
19856
|
rateFormProps = __rest(_b, ["requestRates", "resetRates", "resetLabel"]);
|
|
19854
19857
|
const _c = useShipmentForm({
|
|
19858
|
+
compatibleCountryCodes: features === null || features === void 0 ? void 0 : features.compatibleCountryCodes,
|
|
19855
19859
|
onAddressValidation,
|
|
19856
19860
|
onApplyPreset: react.useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19857
19861
|
if (shipment.packages[0].weight.value) {
|
|
@@ -21041,6 +21045,7 @@ const useImportSalesOrder = ({
|
|
|
21041
21045
|
|
|
21042
21046
|
const SalesOrder = _a => {
|
|
21043
21047
|
var {
|
|
21048
|
+
features,
|
|
21044
21049
|
externalOrderId,
|
|
21045
21050
|
externalOrderNumber,
|
|
21046
21051
|
onLoad,
|
|
@@ -21049,7 +21054,7 @@ const SalesOrder = _a => {
|
|
|
21049
21054
|
salesOrderId,
|
|
21050
21055
|
warehouseId
|
|
21051
21056
|
} = _a,
|
|
21052
|
-
props = __rest(_a, ["externalOrderId", "externalOrderNumber", "onLoad", "onShipmentUpdated", "orderSourceCode", "salesOrderId", "warehouseId"]);
|
|
21057
|
+
props = __rest(_a, ["features", "externalOrderId", "externalOrderNumber", "onLoad", "onShipmentUpdated", "orderSourceCode", "salesOrderId", "warehouseId"]);
|
|
21053
21058
|
const _b = useImportSalesOrder({
|
|
21054
21059
|
externalOrderId,
|
|
21055
21060
|
externalOrderNumber,
|
|
@@ -21070,12 +21075,18 @@ const SalesOrder = _a => {
|
|
|
21070
21075
|
salesOrder: salesOrder
|
|
21071
21076
|
}, salesOrderProps, {
|
|
21072
21077
|
children: salesOrder && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
21078
|
+
features: features,
|
|
21073
21079
|
salesOrder: salesOrder
|
|
21074
21080
|
}, configureShipmentProps, props))
|
|
21075
21081
|
}));
|
|
21076
21082
|
};
|
|
21077
21083
|
|
|
21078
|
-
const Element$
|
|
21084
|
+
const Element$3 = elementsCore.registerElement("purchase-label", SalesOrder, ["externalOrderId", "externalOrderNumber", "salesOrderId"]);
|
|
21085
|
+
|
|
21086
|
+
const RegisterWallet = ({
|
|
21087
|
+
features,
|
|
21088
|
+
onRegisterWallet
|
|
21089
|
+
}) => jsxRuntime.jsx(elementsUi.Templates.RegisterWallet, {});
|
|
21079
21090
|
|
|
21080
21091
|
const Shipment = ({
|
|
21081
21092
|
features,
|
|
@@ -21155,10 +21166,13 @@ const VoidLabel = ({
|
|
|
21155
21166
|
});
|
|
21156
21167
|
};
|
|
21157
21168
|
|
|
21169
|
+
const Element$2 = elementsCore.registerElement("register-wallet", RegisterWallet);
|
|
21170
|
+
|
|
21158
21171
|
const Element$1 = elementsCore.registerElement("view-shipment", Shipment, "shipmentId");
|
|
21159
21172
|
|
|
21160
21173
|
const Element = elementsCore.registerElement("void-label", VoidLabel, "labelId");
|
|
21161
21174
|
|
|
21162
|
-
exports.PurchaseLabel = Element$
|
|
21175
|
+
exports.PurchaseLabel = Element$3;
|
|
21176
|
+
exports.RegisterWallet = Element$2;
|
|
21163
21177
|
exports.ViewShipment = Element$1;
|
|
21164
21178
|
exports.VoidLabel = Element;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -19179,6 +19179,7 @@ var lodash = {exports: {}};
|
|
|
19179
19179
|
var _ = lodash.exports;
|
|
19180
19180
|
|
|
19181
19181
|
const useAddress = ({
|
|
19182
|
+
compatibleCountryCodes,
|
|
19182
19183
|
onChange,
|
|
19183
19184
|
onValidation,
|
|
19184
19185
|
salesOrder,
|
|
@@ -19190,7 +19191,7 @@ const useAddress = ({
|
|
|
19190
19191
|
const {
|
|
19191
19192
|
errors: validateAddressErrors,
|
|
19192
19193
|
trigger: validateAddresses
|
|
19193
|
-
} = useValidateAddresses();
|
|
19194
|
+
} = useValidateAddresses(compatibleCountryCodes);
|
|
19194
19195
|
const {
|
|
19195
19196
|
errors: updateShipmentErrors,
|
|
19196
19197
|
trigger: updateShipment
|
|
@@ -19728,6 +19729,7 @@ const useRatesForm = ({
|
|
|
19728
19729
|
};
|
|
19729
19730
|
|
|
19730
19731
|
const useShipmentForm = ({
|
|
19732
|
+
compatibleCountryCodes,
|
|
19731
19733
|
onAddressValidation,
|
|
19732
19734
|
onApplyPreset,
|
|
19733
19735
|
onChangeAddress,
|
|
@@ -19758,6 +19760,7 @@ const useShipmentForm = ({
|
|
|
19758
19760
|
handleChangeAddress,
|
|
19759
19761
|
handleParseShipTo
|
|
19760
19762
|
} = useAddress({
|
|
19763
|
+
compatibleCountryCodes,
|
|
19761
19764
|
onChange: useCallback((oldShipment, updatedShipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19762
19765
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(updatedShipment);
|
|
19763
19766
|
yield onChangeAddress === null || onChangeAddress === void 0 ? void 0 : onChangeAddress(oldShipment, updatedShipment);
|
|
@@ -19848,6 +19851,7 @@ const ConfigureShipment = _a => {
|
|
|
19848
19851
|
} = _b,
|
|
19849
19852
|
rateFormProps = __rest(_b, ["requestRates", "resetRates", "resetLabel"]);
|
|
19850
19853
|
const _c = useShipmentForm({
|
|
19854
|
+
compatibleCountryCodes: features === null || features === void 0 ? void 0 : features.compatibleCountryCodes,
|
|
19851
19855
|
onAddressValidation,
|
|
19852
19856
|
onApplyPreset: useCallback((_preset, shipment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19853
19857
|
if (shipment.packages[0].weight.value) {
|
|
@@ -21037,6 +21041,7 @@ const useImportSalesOrder = ({
|
|
|
21037
21041
|
|
|
21038
21042
|
const SalesOrder = _a => {
|
|
21039
21043
|
var {
|
|
21044
|
+
features,
|
|
21040
21045
|
externalOrderId,
|
|
21041
21046
|
externalOrderNumber,
|
|
21042
21047
|
onLoad,
|
|
@@ -21045,7 +21050,7 @@ const SalesOrder = _a => {
|
|
|
21045
21050
|
salesOrderId,
|
|
21046
21051
|
warehouseId
|
|
21047
21052
|
} = _a,
|
|
21048
|
-
props = __rest(_a, ["externalOrderId", "externalOrderNumber", "onLoad", "onShipmentUpdated", "orderSourceCode", "salesOrderId", "warehouseId"]);
|
|
21053
|
+
props = __rest(_a, ["features", "externalOrderId", "externalOrderNumber", "onLoad", "onShipmentUpdated", "orderSourceCode", "salesOrderId", "warehouseId"]);
|
|
21049
21054
|
const _b = useImportSalesOrder({
|
|
21050
21055
|
externalOrderId,
|
|
21051
21056
|
externalOrderNumber,
|
|
@@ -21066,12 +21071,18 @@ const SalesOrder = _a => {
|
|
|
21066
21071
|
salesOrder: salesOrder
|
|
21067
21072
|
}, salesOrderProps, {
|
|
21068
21073
|
children: salesOrder && jsx(ConfigureShipment, Object.assign({
|
|
21074
|
+
features: features,
|
|
21069
21075
|
salesOrder: salesOrder
|
|
21070
21076
|
}, configureShipmentProps, props))
|
|
21071
21077
|
}));
|
|
21072
21078
|
};
|
|
21073
21079
|
|
|
21074
|
-
const Element$
|
|
21080
|
+
const Element$3 = registerElement("purchase-label", SalesOrder, ["externalOrderId", "externalOrderNumber", "salesOrderId"]);
|
|
21081
|
+
|
|
21082
|
+
const RegisterWallet = ({
|
|
21083
|
+
features,
|
|
21084
|
+
onRegisterWallet
|
|
21085
|
+
}) => jsx(Templates.RegisterWallet, {});
|
|
21075
21086
|
|
|
21076
21087
|
const Shipment = ({
|
|
21077
21088
|
features,
|
|
@@ -21151,8 +21162,10 @@ const VoidLabel = ({
|
|
|
21151
21162
|
});
|
|
21152
21163
|
};
|
|
21153
21164
|
|
|
21165
|
+
const Element$2 = registerElement("register-wallet", RegisterWallet);
|
|
21166
|
+
|
|
21154
21167
|
const Element$1 = registerElement("view-shipment", Shipment, "shipmentId");
|
|
21155
21168
|
|
|
21156
21169
|
const Element = registerElement("void-label", VoidLabel, "labelId");
|
|
21157
21170
|
|
|
21158
|
-
export { Element$
|
|
21171
|
+
export { Element$3 as PurchaseLabel, Element$2 as RegisterWallet, Element$1 as ViewShipment, Element as VoidLabel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipengine/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@packlink/giger": "*",
|
|
6
6
|
"react-i18next": "*",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"types": "./index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"react": "^18.2.0",
|
|
15
|
-
"@shipengine/elements-core": "0.
|
|
16
|
-
"@shipengine/elements-ui": "0.
|
|
17
|
-
"@shipengine/types": "0.
|
|
15
|
+
"@shipengine/elements-core": "0.12.0",
|
|
16
|
+
"@shipengine/elements-ui": "0.12.0",
|
|
17
|
+
"@shipengine/types": "0.12.0",
|
|
18
18
|
"@emotion/react": "^11.10.0",
|
|
19
19
|
"@packlink/brands": "^3.18.0"
|
|
20
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Element: (props: import("./components").RegisterWalletProps & Record<string, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
|