@shipengine/elements 0.26.0 → 0.26.1
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.cjs +46 -23
- package/index.js +46 -23
- package/package.json +1 -1
- package/src/elements/list-carriers/list-carriers.d.ts +2 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +2 -0
- package/src/elements/onboarding/onboarding.d.ts +2 -0
- package/src/elements/purchase-label/purchase-label.d.ts +2 -0
- package/src/elements/view-shipment/view-shipment.d.ts +2 -0
- package/src/elements/void-label/void-label.d.ts +2 -0
- package/src/locales/en/index.d.ts +2 -0
package/index.cjs
CHANGED
|
@@ -3715,7 +3715,8 @@ $$c({ target: 'String', proto: true }, {
|
|
|
3715
3715
|
}
|
|
3716
3716
|
});
|
|
3717
3717
|
|
|
3718
|
-
|
|
3718
|
+
var _a;
|
|
3719
|
+
let _LOCALE = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.language) !== null && _a !== void 0 ? _a : "en-US";
|
|
3719
3720
|
const loadableLocale = _LOCALE.replaceAll("-", "");
|
|
3720
3721
|
const loadableBackupLocale = _LOCALE.split("-")[0];
|
|
3721
3722
|
let intlLocale = undefined;
|
|
@@ -10866,36 +10867,56 @@ const FundAndPurchase = ({
|
|
|
10866
10867
|
control
|
|
10867
10868
|
});
|
|
10868
10869
|
const [isSavingRate, setIsSavingRate] = React.useState(false);
|
|
10870
|
+
const [isSavingError, setIsSavingError] = React.useState(false);
|
|
10869
10871
|
const handleSaveRate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
10870
10872
|
setIsSavingRate(true);
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
+
setIsSavingError(false);
|
|
10874
|
+
try {
|
|
10875
|
+
yield onSave();
|
|
10876
|
+
} catch (e) {
|
|
10877
|
+
setIsSavingError(true);
|
|
10878
|
+
} finally {
|
|
10879
|
+
setIsSavingRate(false);
|
|
10880
|
+
}
|
|
10873
10881
|
});
|
|
10874
10882
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
10875
10883
|
React.useEffect(() => {
|
|
10876
10884
|
if (isFundingEnabled && isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
10877
10885
|
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingEnabled, isFundingRequired, purchaseAmount]);
|
|
10878
|
-
const renderActionButtons = (addFundsForm = {}) => jsxRuntime.jsxs(
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
})
|
|
10891
|
-
|
|
10892
|
-
disabled: disabled || !carrierId || !isRateFormValid || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
10893
|
-
isLoading: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10894
|
-
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
10886
|
+
const renderActionButtons = (addFundsForm = {}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10887
|
+
children: [isSavingError && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10888
|
+
children: [jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
10889
|
+
type: giger.NotificationType.ERROR,
|
|
10890
|
+
title: t("purchase-label:errorMessages.saveRateFailedTitle")
|
|
10891
|
+
}, {
|
|
10892
|
+
children: jsxRuntime.jsx(giger.Typography, {
|
|
10893
|
+
children: t("purchase-label:errorMessages.saveRateFailedMessage")
|
|
10894
|
+
})
|
|
10895
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
10896
|
+
multiplier: 2
|
|
10897
|
+
})]
|
|
10898
|
+
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
10899
|
+
justify: "end"
|
|
10895
10900
|
}, {
|
|
10896
|
-
children:
|
|
10901
|
+
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
10902
|
+
bold: false,
|
|
10903
|
+
css: styles$8.saveRateButton,
|
|
10904
|
+
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10905
|
+
isLoading: isSavingRate,
|
|
10906
|
+
onClick: handleSaveRate,
|
|
10907
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
10908
|
+
}, {
|
|
10909
|
+
children: t("purchase-label:actions.saveRate")
|
|
10910
|
+
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
10911
|
+
"data-testid": "submit-fund-and-purchase",
|
|
10912
|
+
disabled: disabled || !carrierId || !isRateFormValid || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
10913
|
+
isLoading: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10914
|
+
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
10915
|
+
}, {
|
|
10916
|
+
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
10917
|
+
}))]
|
|
10897
10918
|
}))]
|
|
10898
|
-
})
|
|
10919
|
+
});
|
|
10899
10920
|
// Render: not a walleted carrier;
|
|
10900
10921
|
// don't show balance or funding form
|
|
10901
10922
|
if (!isFundingRequired) return jsxRuntime.jsx("div", Object.assign({
|
|
@@ -14074,7 +14095,9 @@ var purchaseLabel$1 = {
|
|
|
14074
14095
|
invalidAddress: "The address cannot be validated. Please confirm the address details with your customer and <link>edit the address in ShipStation</link>.",
|
|
14075
14096
|
noRates: "We were unable to find any rates matching your shipment information",
|
|
14076
14097
|
salesOrderNotLoaded: "Sales order has not been loaded",
|
|
14077
|
-
unsupportedAddress: "At this time, we do not support shipping to international addresses that require customs declarations, including international, military, and US Territory addresses. You can create a label for this order in ShipStation."
|
|
14098
|
+
unsupportedAddress: "At this time, we do not support shipping to international addresses that require customs declarations, including international, military, and US Territory addresses. You can create a label for this order in ShipStation.",
|
|
14099
|
+
saveRateFailedMessage: "Saving DHL Express Worldwide rates is temporarily unavailable. Please try again later.",
|
|
14100
|
+
saveRateFailedTitle: "Unable To Save Rate"
|
|
14078
14101
|
},
|
|
14079
14102
|
errorTypes: {
|
|
14080
14103
|
results: "No results returned"
|
package/index.js
CHANGED
|
@@ -3683,7 +3683,8 @@ $$c({ target: 'String', proto: true }, {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
});
|
|
3685
3685
|
|
|
3686
|
-
|
|
3686
|
+
var _a;
|
|
3687
|
+
let _LOCALE = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.language) !== null && _a !== void 0 ? _a : "en-US";
|
|
3687
3688
|
const loadableLocale = _LOCALE.replaceAll("-", "");
|
|
3688
3689
|
const loadableBackupLocale = _LOCALE.split("-")[0];
|
|
3689
3690
|
let intlLocale = undefined;
|
|
@@ -10834,36 +10835,56 @@ const FundAndPurchase = ({
|
|
|
10834
10835
|
control
|
|
10835
10836
|
});
|
|
10836
10837
|
const [isSavingRate, setIsSavingRate] = useState(false);
|
|
10838
|
+
const [isSavingError, setIsSavingError] = useState(false);
|
|
10837
10839
|
const handleSaveRate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
10838
10840
|
setIsSavingRate(true);
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
+
setIsSavingError(false);
|
|
10842
|
+
try {
|
|
10843
|
+
yield onSave();
|
|
10844
|
+
} catch (e) {
|
|
10845
|
+
setIsSavingError(true);
|
|
10846
|
+
} finally {
|
|
10847
|
+
setIsSavingRate(false);
|
|
10848
|
+
}
|
|
10841
10849
|
});
|
|
10842
10850
|
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
10843
10851
|
useEffect(() => {
|
|
10844
10852
|
if (isFundingEnabled && isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
10845
10853
|
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingEnabled, isFundingRequired, purchaseAmount]);
|
|
10846
|
-
const renderActionButtons = (addFundsForm = {}) => jsxs(
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
})
|
|
10859
|
-
|
|
10860
|
-
disabled: disabled || !carrierId || !isRateFormValid || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
10861
|
-
isLoading: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10862
|
-
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
10854
|
+
const renderActionButtons = (addFundsForm = {}) => jsxs(Fragment, {
|
|
10855
|
+
children: [isSavingError && jsxs(Fragment, {
|
|
10856
|
+
children: [jsx(InlineNotification, Object.assign({
|
|
10857
|
+
type: NotificationType.ERROR,
|
|
10858
|
+
title: t("purchase-label:errorMessages.saveRateFailedTitle")
|
|
10859
|
+
}, {
|
|
10860
|
+
children: jsx(Typography, {
|
|
10861
|
+
children: t("purchase-label:errorMessages.saveRateFailedMessage")
|
|
10862
|
+
})
|
|
10863
|
+
})), jsx(Spacer, {
|
|
10864
|
+
multiplier: 2
|
|
10865
|
+
})]
|
|
10866
|
+
}), jsxs(ButtonGroup, Object.assign({
|
|
10867
|
+
justify: "end"
|
|
10863
10868
|
}, {
|
|
10864
|
-
children:
|
|
10869
|
+
children: [jsx(Button, Object.assign({
|
|
10870
|
+
bold: false,
|
|
10871
|
+
css: styles$8.saveRateButton,
|
|
10872
|
+
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10873
|
+
isLoading: isSavingRate,
|
|
10874
|
+
onClick: handleSaveRate,
|
|
10875
|
+
variant: ButtonVariant.OUTLINED
|
|
10876
|
+
}, {
|
|
10877
|
+
children: t("purchase-label:actions.saveRate")
|
|
10878
|
+
})), jsx(Button, Object.assign({
|
|
10879
|
+
"data-testid": "submit-fund-and-purchase",
|
|
10880
|
+
disabled: disabled || !carrierId || !isRateFormValid || isFundingEnabled && isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
10881
|
+
isLoading: addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10882
|
+
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
10883
|
+
}, {
|
|
10884
|
+
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
10885
|
+
}))]
|
|
10865
10886
|
}))]
|
|
10866
|
-
})
|
|
10887
|
+
});
|
|
10867
10888
|
// Render: not a walleted carrier;
|
|
10868
10889
|
// don't show balance or funding form
|
|
10869
10890
|
if (!isFundingRequired) return jsx("div", Object.assign({
|
|
@@ -14042,7 +14063,9 @@ var purchaseLabel$1 = {
|
|
|
14042
14063
|
invalidAddress: "The address cannot be validated. Please confirm the address details with your customer and <link>edit the address in ShipStation</link>.",
|
|
14043
14064
|
noRates: "We were unable to find any rates matching your shipment information",
|
|
14044
14065
|
salesOrderNotLoaded: "Sales order has not been loaded",
|
|
14045
|
-
unsupportedAddress: "At this time, we do not support shipping to international addresses that require customs declarations, including international, military, and US Territory addresses. You can create a label for this order in ShipStation."
|
|
14066
|
+
unsupportedAddress: "At this time, we do not support shipping to international addresses that require customs declarations, including international, military, and US Territory addresses. You can create a label for this order in ShipStation.",
|
|
14067
|
+
saveRateFailedMessage: "Saving DHL Express Worldwide rates is temporarily unavailable. Please try again later.",
|
|
14068
|
+
saveRateFailedTitle: "Unable To Save Rate"
|
|
14046
14069
|
},
|
|
14047
14070
|
errorTypes: {
|
|
14048
14071
|
results: "No results returned"
|
package/package.json
CHANGED
|
@@ -144,6 +144,8 @@ export declare const Element: ({ resources, ...props }: object & {
|
|
|
144
144
|
noRates: string;
|
|
145
145
|
salesOrderNotLoaded: string;
|
|
146
146
|
unsupportedAddress: string;
|
|
147
|
+
saveRateFailedMessage: string;
|
|
148
|
+
saveRateFailedTitle: string;
|
|
147
149
|
};
|
|
148
150
|
errorTypes: {
|
|
149
151
|
results: string;
|
|
@@ -148,6 +148,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
148
148
|
noRates: string;
|
|
149
149
|
salesOrderNotLoaded: string;
|
|
150
150
|
unsupportedAddress: string;
|
|
151
|
+
saveRateFailedMessage: string;
|
|
152
|
+
saveRateFailedTitle: string;
|
|
151
153
|
};
|
|
152
154
|
errorTypes: {
|
|
153
155
|
results: string;
|
|
@@ -147,6 +147,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
147
147
|
noRates: string;
|
|
148
148
|
salesOrderNotLoaded: string;
|
|
149
149
|
unsupportedAddress: string;
|
|
150
|
+
saveRateFailedMessage: string;
|
|
151
|
+
saveRateFailedTitle: string;
|
|
150
152
|
};
|
|
151
153
|
errorTypes: {
|
|
152
154
|
results: string;
|
|
@@ -155,6 +155,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
155
155
|
noRates: string;
|
|
156
156
|
salesOrderNotLoaded: string;
|
|
157
157
|
unsupportedAddress: string;
|
|
158
|
+
saveRateFailedMessage: string;
|
|
159
|
+
saveRateFailedTitle: string;
|
|
158
160
|
};
|
|
159
161
|
errorTypes: {
|
|
160
162
|
results: string;
|
|
@@ -156,6 +156,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
156
156
|
noRates: string;
|
|
157
157
|
salesOrderNotLoaded: string;
|
|
158
158
|
unsupportedAddress: string;
|
|
159
|
+
saveRateFailedMessage: string;
|
|
160
|
+
saveRateFailedTitle: string;
|
|
159
161
|
};
|
|
160
162
|
errorTypes: {
|
|
161
163
|
results: string;
|
|
@@ -151,6 +151,8 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
151
151
|
noRates: string;
|
|
152
152
|
salesOrderNotLoaded: string;
|
|
153
153
|
unsupportedAddress: string;
|
|
154
|
+
saveRateFailedMessage: string;
|
|
155
|
+
saveRateFailedTitle: string;
|
|
154
156
|
};
|
|
155
157
|
errorTypes: {
|
|
156
158
|
results: string;
|