@shipengine/elements 0.38.0 → 0.39.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.cjs +65 -61
- package/index.js +65 -61
- package/package.json +6 -6
- package/src/components/add-funds-form/add-funds-form.styles.d.ts +3 -3
- package/src/components/auto-funding-form/auto-funding-form.styles.d.ts +1 -1
- package/src/components/carrier-balance/carrier-balance.styles.d.ts +1 -1
- package/src/components/collapsible-panel/collapsible-panel.d.ts +1 -1
- package/src/components/collapsible-panel/collapsible-panel.styles.d.ts +4 -4
- package/src/components/date-range-select/date-range-select.styles.d.ts +1 -1
- package/src/components/disclosure/disclosure.styles.d.ts +3 -3
- package/src/components/error-display/error-display.styles.d.ts +3 -3
- package/src/components/field/checkbox-input/checkbox-input.d.ts +1 -1
- package/src/components/field/credit-card-input/credit-card-input.d.ts +1 -1
- package/src/components/field/date-picker/date-picker.styles.d.ts +1 -1
- package/src/components/field/expiration-input/expiration-input.d.ts +1 -1
- package/src/components/field/field.styles.d.ts +1 -1
- package/src/components/field/money-input/money-input.d.ts +1 -1
- package/src/components/field/number-input/number-input.d.ts +1 -1
- package/src/components/field/rate-card/cost-breakdown/cost-breakdown.styles.d.ts +1 -1
- package/src/components/field/rate-card/rate-card.d.ts +1 -1
- package/src/components/field/rate-card/rate-card.styles.d.ts +1 -1
- package/src/components/field/rate-select/rate-select.styles.d.ts +1 -1
- package/src/components/field/select-auto-complete/select-auto-complete.d.ts +1 -1
- package/src/components/field/submit-button/submit-button.d.ts +1 -1
- package/src/components/field/switch/switch.d.ts +1 -1
- package/src/components/field/text-area/text-area.d.ts +1 -1
- package/src/components/field/text-input/text-input.d.ts +1 -1
- package/src/components/fund-and-purchase/fund-and-purchase.styles.d.ts +3 -3
- package/src/components/history/history-card/history-card.styles.d.ts +8 -8
- package/src/components/history/history-card-extension/history-card-extension.styles.d.ts +3 -3
- package/src/components/inline-label/inline-label.d.ts +1 -1
- package/src/components/inline-label/inline-label.styles.d.ts +1 -1
- package/src/components/items-breakdown/items-breakdown.styles.d.ts +6 -6
- package/src/components/label/label.d.ts +1 -1
- package/src/components/label/label.styles.d.ts +1 -1
- package/src/components/label-layout/label-layout.styles.d.ts +12 -12
- package/src/components/link-action/link-action.d.ts +2 -2
- package/src/components/loader/loader.d.ts +1 -1
- package/src/components/preset-descriptor/preset-descriptor.styles.d.ts +1 -1
- package/src/components/save-status/save-status-styles.d.ts +4 -4
- package/src/components/section/section.d.ts +1 -1
- package/src/components/section/section.styles.d.ts +4 -4
- package/src/components/settings-card/settings-card.styles.d.ts +5 -5
- package/src/components/spacer/spacer.d.ts +1 -1
- package/src/components/templates/account-settings/account-settings.d.ts +0 -1
- package/src/components/templates/address-form/address-fields.styles.d.ts +1 -1
- package/src/components/templates/carrier-recovery-form/carrier-recovery-form.styles.d.ts +1 -1
- package/src/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +6 -6
- package/src/components/templates/customs-items-display/customs-items-display.styles.d.ts +16 -16
- package/src/components/templates/edit-billing-form/edit-billing-form.styles.d.ts +3 -3
- package/src/components/templates/label/label.styles.d.ts +2 -2
- package/src/components/templates/landing-page/landing-page.styles.d.ts +1 -1
- package/src/components/templates/list-carriers/list-carriers.styles.d.ts +3 -3
- package/src/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +3 -3
- package/src/components/templates/manage-warehouses/manage-warehouse.styles.d.ts +2 -2
- package/src/components/templates/onboarding/onboarding.styles.d.ts +4 -4
- package/src/components/templates/rate-form/rate-form.styles.d.ts +1 -1
- package/src/components/templates/suspend-sales-order/suspend-sales-order.d.ts +1 -1
- package/src/components/templates/suspend-shipment/suspend-shipment.d.ts +1 -1
- package/src/components/templates/wallet-card/wallet-card.styles.d.ts +1 -1
- package/src/components/templates/wallet-form/wallet-form.styles.d.ts +1 -1
- package/src/elements/account-settings/account-settings.d.ts +1 -9
- package/src/elements/configure-shipment/hooks/use-request-preferred-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/list-carriers/hooks/use-list-connected-carriers.d.ts +1 -1
- package/src/elements/purchase-label/hooks/use-load-shipment.d.ts +1 -1
- package/src/elements/view-shipment/view-shipment.d.ts +7 -1
- package/src/features/wallet-history/wallet-history.styles.d.ts +11 -11
- package/src/hooks/use-get-or-create-shipment.d.ts +1 -1
- package/src/testing/extensions/queries/by-icon-name.d.ts +1 -1
- package/src/testing/extensions/queries/index.d.ts +6 -6
- package/src/testing/test-utils.d.ts +1 -2
- package/src/utilities/styles.d.ts +1 -1
package/index.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
6
|
-
var giger = require('@
|
|
7
|
-
var gigerTheme = require('@
|
|
6
|
+
var giger = require('@shipengine/giger');
|
|
7
|
+
var gigerTheme = require('@shipengine/giger-theme');
|
|
8
8
|
var humps = require('humps');
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var reactI18next = require('react-i18next');
|
|
@@ -23,7 +23,7 @@ var Locales = require('date-fns/locale');
|
|
|
23
23
|
var css = require('@emotion/css');
|
|
24
24
|
var min$3 = require('libphonenumber-js/min');
|
|
25
25
|
var copy = require('copy-to-clipboard');
|
|
26
|
-
var reactQuery = require('react-query');
|
|
26
|
+
var reactQuery = require('@tanstack/react-query');
|
|
27
27
|
var cardValidator = require('card-validator');
|
|
28
28
|
|
|
29
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -7649,7 +7649,7 @@ const AddFundsForm = ({
|
|
|
7649
7649
|
const {
|
|
7650
7650
|
t
|
|
7651
7651
|
} = reactI18next.useTranslation();
|
|
7652
|
-
const addFunds = alchemy.useAddFunds(
|
|
7652
|
+
const addFunds = alchemy.useAddFunds();
|
|
7653
7653
|
const carrier = alchemy.useGetCarrierById(carrierId);
|
|
7654
7654
|
const chips = [{
|
|
7655
7655
|
label: "$20",
|
|
@@ -7685,13 +7685,16 @@ const AddFundsForm = ({
|
|
|
7685
7685
|
const handleSubmit = formLogger.capture(form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
7686
7686
|
const payload = values;
|
|
7687
7687
|
try {
|
|
7688
|
-
yield addFunds.mutateAsync(
|
|
7688
|
+
yield addFunds.mutateAsync({
|
|
7689
|
+
carrierId,
|
|
7690
|
+
funds: payload
|
|
7691
|
+
});
|
|
7689
7692
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
7690
7693
|
} catch (_a) {
|
|
7691
7694
|
// Noop; errors available on RQ object
|
|
7692
7695
|
}
|
|
7693
7696
|
})));
|
|
7694
|
-
if (carrier.
|
|
7697
|
+
if (carrier.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
7695
7698
|
message: t("loading.carrier")
|
|
7696
7699
|
});
|
|
7697
7700
|
if (!carrier.data) throw new Error("errorMessages.unableToLoad.carrier");
|
|
@@ -7929,11 +7932,16 @@ const AutoFundingForm = ({
|
|
|
7929
7932
|
const {
|
|
7930
7933
|
t
|
|
7931
7934
|
} = reactI18next.useTranslation();
|
|
7932
|
-
const updateAutoFunding = alchemy.useUpdateAutoFunding(carrierId);
|
|
7933
|
-
const autoFundingConfiguration = alchemy.useGetAutoFundingConfiguration(carrierId);
|
|
7934
7935
|
const {
|
|
7935
|
-
|
|
7936
|
-
|
|
7936
|
+
mutate: updateAutoFunding,
|
|
7937
|
+
isLoading: updateAutoFundingIsLoading
|
|
7938
|
+
} = alchemy.useUpdateAutoFunding(carrierId);
|
|
7939
|
+
const {
|
|
7940
|
+
data: autoFundingConfig,
|
|
7941
|
+
refetch: autoFundingConfigRefetch,
|
|
7942
|
+
isInitialLoading: isLoadingAutoFundingConfig,
|
|
7943
|
+
error: autoFundingConfigErrors
|
|
7944
|
+
} = alchemy.useGetAutoFundingConfiguration(carrierId);
|
|
7937
7945
|
const [showForm, setShowForm] = React.useState(false);
|
|
7938
7946
|
const [isSwitchOn, setIsSwitchOn] = React.useState(false);
|
|
7939
7947
|
const form = reactHookForm.useForm({
|
|
@@ -7949,8 +7957,8 @@ const AutoFundingForm = ({
|
|
|
7949
7957
|
setShowForm(prev => !prev);
|
|
7950
7958
|
setIsSwitchOn(true);
|
|
7951
7959
|
const payload = values;
|
|
7952
|
-
updateAutoFunding
|
|
7953
|
-
onSuccess: () =>
|
|
7960
|
+
updateAutoFunding(payload, {
|
|
7961
|
+
onSuccess: () => autoFundingConfigRefetch()
|
|
7954
7962
|
});
|
|
7955
7963
|
}));
|
|
7956
7964
|
/**
|
|
@@ -7964,19 +7972,19 @@ const AutoFundingForm = ({
|
|
|
7964
7972
|
formReset(isEnabled);
|
|
7965
7973
|
if (!isEnabled) {
|
|
7966
7974
|
setIsSwitchOn(isEnabled);
|
|
7967
|
-
updateAutoFunding
|
|
7968
|
-
onSuccess: () =>
|
|
7975
|
+
updateAutoFunding(form.getValues(), {
|
|
7976
|
+
onSuccess: () => autoFundingConfigRefetch()
|
|
7969
7977
|
});
|
|
7970
7978
|
}
|
|
7971
7979
|
};
|
|
7972
|
-
if (
|
|
7980
|
+
if (isLoadingAutoFundingConfig || updateAutoFundingIsLoading) return jsxRuntime.jsx(Loader, {
|
|
7973
7981
|
message: t("manage-funding:autoFunding.isLoading")
|
|
7974
7982
|
});
|
|
7975
|
-
if (!
|
|
7983
|
+
if (!autoFundingConfig) throw new Error(t("errorMessages:unableToLoad.autoFundingSettings"));
|
|
7976
7984
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7977
7985
|
children: [jsxRuntime.jsxs(Spread, {
|
|
7978
7986
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
7979
|
-
bold: !!(
|
|
7987
|
+
bold: !!(autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.isAutoPurchaseEnabled),
|
|
7980
7988
|
variant: "body1"
|
|
7981
7989
|
}, {
|
|
7982
7990
|
children: t("manage-funding:autoFunding:isEnabledCTA")
|
|
@@ -7989,11 +7997,11 @@ const AutoFundingForm = ({
|
|
|
7989
7997
|
})]
|
|
7990
7998
|
}), jsxRuntime.jsx(Spacer, {
|
|
7991
7999
|
multiplier: 1
|
|
7992
|
-
}), !!(
|
|
8000
|
+
}), !!(autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.isAutoPurchaseEnabled) && !showForm && jsxRuntime.jsxs(Spread, {
|
|
7993
8001
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
7994
8002
|
variant: "body1"
|
|
7995
8003
|
}, {
|
|
7996
|
-
children: t("manage-funding:autoFunding.readSettings", Object.assign({},
|
|
8004
|
+
children: t("manage-funding:autoFunding.readSettings", Object.assign({}, autoFundingConfig))
|
|
7997
8005
|
})), jsxRuntime.jsx(LinkAction, {
|
|
7998
8006
|
css: styles$t.edit,
|
|
7999
8007
|
onClick: () => handleToggle(true),
|
|
@@ -8018,7 +8026,7 @@ const AutoFundingForm = ({
|
|
|
8018
8026
|
css: styles$t.input,
|
|
8019
8027
|
"data-testid": "auto-funding-threshold-input",
|
|
8020
8028
|
defaultValue: {
|
|
8021
|
-
amount:
|
|
8029
|
+
amount: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseThreshold,
|
|
8022
8030
|
currency: alchemy.Currency.USD
|
|
8023
8031
|
},
|
|
8024
8032
|
disabled: !watchIsEnabled,
|
|
@@ -8035,7 +8043,7 @@ const AutoFundingForm = ({
|
|
|
8035
8043
|
css: styles$t.input,
|
|
8036
8044
|
"data-testid": "auto-funding-purchase-amount-input",
|
|
8037
8045
|
defaultValue: {
|
|
8038
|
-
amount:
|
|
8046
|
+
amount: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseAmount,
|
|
8039
8047
|
currency: alchemy.Currency.USD
|
|
8040
8048
|
},
|
|
8041
8049
|
disabled: !watchIsEnabled,
|
|
@@ -8051,7 +8059,7 @@ const AutoFundingForm = ({
|
|
|
8051
8059
|
control: form.control,
|
|
8052
8060
|
css: styles$t.input,
|
|
8053
8061
|
"data-testid": "auto-funding-max-per-day-input",
|
|
8054
|
-
defaultValue:
|
|
8062
|
+
defaultValue: autoFundingConfig === null || autoFundingConfig === void 0 ? void 0 : autoFundingConfig.autoPurchaseCutoff,
|
|
8055
8063
|
disabled: !watchIsEnabled,
|
|
8056
8064
|
isInteger: true,
|
|
8057
8065
|
label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
|
|
@@ -8076,14 +8084,14 @@ const AutoFundingForm = ({
|
|
|
8076
8084
|
children: t("manage-funding:actions.saveRule")
|
|
8077
8085
|
}))]
|
|
8078
8086
|
}))]
|
|
8079
|
-
})),
|
|
8087
|
+
})), autoFundingConfigErrors && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8080
8088
|
children: [jsxRuntime.jsx(Spacer, {
|
|
8081
8089
|
multiplier: 1
|
|
8082
8090
|
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
8083
8091
|
title: t("manage-funding:autoFunding.error.title"),
|
|
8084
8092
|
type: giger.NotificationType.ERROR
|
|
8085
8093
|
}, {
|
|
8086
|
-
children:
|
|
8094
|
+
children: autoFundingConfigErrors[0].message
|
|
8087
8095
|
}))]
|
|
8088
8096
|
})]
|
|
8089
8097
|
});
|
|
@@ -8142,14 +8150,13 @@ const CarrierBalance = ({
|
|
|
8142
8150
|
} = reactI18next.useTranslation();
|
|
8143
8151
|
const {
|
|
8144
8152
|
data: carrier,
|
|
8145
|
-
|
|
8146
|
-
isRefetching: isRefetchingCarrier
|
|
8153
|
+
isFetching: isFetchingCarrier
|
|
8147
8154
|
} = alchemy.useGetCarrierById(carrierId);
|
|
8148
8155
|
const carrierBalance = (_a = carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== null && _a !== void 0 ? _a : balance;
|
|
8149
8156
|
return jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
8150
8157
|
label: t("manage-funding:currentBalance")
|
|
8151
8158
|
}, {
|
|
8152
|
-
children:
|
|
8159
|
+
children: isFetchingCarrier ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
8153
8160
|
bold: true,
|
|
8154
8161
|
css: styles$r.getBalanceText(carrierBalance)
|
|
8155
8162
|
}, {
|
|
@@ -8524,7 +8531,7 @@ const FundAndPurchase = ({
|
|
|
8524
8531
|
const [isAddFundsFormOpen, setIsAddFundsFormOpen] = React.useState(false);
|
|
8525
8532
|
const {
|
|
8526
8533
|
data: carrier,
|
|
8527
|
-
|
|
8534
|
+
isInitialLoading: isLoadingCarrier
|
|
8528
8535
|
} = alchemy.useGetCarrierById(isPreferredRate ? undefined : carrierId);
|
|
8529
8536
|
const {
|
|
8530
8537
|
isSubmitting: isRateFormSubmitting,
|
|
@@ -8735,14 +8742,14 @@ const styles$n = createStyles({
|
|
|
8735
8742
|
verticalAlign: "top"
|
|
8736
8743
|
}),
|
|
8737
8744
|
itemName: theme => ({
|
|
8738
|
-
// Set item name to max 3 lines and truncate with ellipsis
|
|
8739
|
-
"-webkit-box-orient": "vertical",
|
|
8740
|
-
"-webkit-line-clamp": "3",
|
|
8741
8745
|
display: "-webkit-box",
|
|
8742
8746
|
lineHeight: `${theme.spacing(2.5)}px`,
|
|
8743
8747
|
maxHeight: `${theme.spacing(7.5)}px`,
|
|
8744
8748
|
overflow: "hidden",
|
|
8745
8749
|
textOverflow: "ellipsis",
|
|
8750
|
+
// Set item name to max 3 lines and truncate with ellipsis
|
|
8751
|
+
WebkitBoxOrient: "vertical",
|
|
8752
|
+
WebkitLineClamp: "3",
|
|
8746
8753
|
whiteSpace: "normal"
|
|
8747
8754
|
}),
|
|
8748
8755
|
numericCell: () => ({
|
|
@@ -8862,7 +8869,7 @@ const ManageFunding = ({
|
|
|
8862
8869
|
} = reactI18next.useTranslation();
|
|
8863
8870
|
const queryClient = reactQuery.useQueryClient();
|
|
8864
8871
|
const {
|
|
8865
|
-
|
|
8872
|
+
isInitialLoading: isLoadingCarrier
|
|
8866
8873
|
} = alchemy.useGetCarrierById(carrierId);
|
|
8867
8874
|
const [isAddFundsFormOpen, setIsAddFundsFormOpen] = React.useState(false);
|
|
8868
8875
|
return jsxRuntime.jsx(CollapsiblePanel, Object.assign({
|
|
@@ -9584,7 +9591,7 @@ const AddressPreferenceSelect = ({
|
|
|
9584
9591
|
};
|
|
9585
9592
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9586
9593
|
children: [jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
9587
|
-
"data-testid": "
|
|
9594
|
+
"data-testid": "addressPreferenceSelect",
|
|
9588
9595
|
noPadding: true
|
|
9589
9596
|
}, {
|
|
9590
9597
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
@@ -10831,7 +10838,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
10831
10838
|
} : {
|
|
10832
10839
|
name: "111ty02-css",
|
|
10833
10840
|
styles: "align-items:center;display:flex;label:css;",
|
|
10834
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
10841
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQmtkIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24v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c0Rpc2FibGVkOiBpc0Nvbm5lY3RlZCB8fCBzaG93RHJvcERvd24sIGlzTG9hZGluZzogaXNTdWJtaXR0aW5nLCBvbkNsaWNrOiAoKSA9PiBfX2F3YWl0ZXIodm9pZCAwLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVxdWlyZWRGaWVsZHMgPT09IG51bGwgfHwgcmVxdWlyZWRGaWVsZHMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHJlcXVpcmVkRmllbGRzLmluY2x1ZGVzKFwiYWRkcmVzc1wiKSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0Ryb3BEb3duKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgaGFuZGxlUmVnaXN0ZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aXRsZTogaXNDb25uZWN0ZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLmNvbm5lY3RlZFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdChcImxpc3QtY2FycmllcnM6YWN0aW9ucy5zdGF0dXMubm90Q29ubmVjdGVkXCIpIH0pIH0pKV0gfSkpLCBzaG93RHJvcERvd24gJiYgKF9qc3goQWRkQ2FycmllckZvcm0sIHsgY2FycmllclRlcm1zOiBjYXJyaWVyLnRlcm1zICYmIGNhcnJpZXIudGVybXMsIG9uQ2FuY2VsOiAoKSA9PiBzZXRTaG93RHJvcERvd24oZmFsc2UpLCBvblN1Ym1pdDogKHZhbHVlcykgPT4gaGFuZGxlUmVnaXN0ZXIodmFsdWVzKSwgcmVnaXN0ZXJDYXJyaWVyRXJyb3JzOiByZWdpc3RlckNhcnJpZXJFcnJvcnMgfSkpXSB9KSkpO1xyXG59O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1saXN0LWNhcnJpZXJzLXJvdy5qcy5tYXAiXX0= */",
|
|
10835
10842
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
10836
10843
|
};
|
|
10837
10844
|
const ListCarriersRow = ({
|
|
@@ -11017,7 +11024,7 @@ const useListConnectedCarriers = () => {
|
|
|
11017
11024
|
const {
|
|
11018
11025
|
data: carriers,
|
|
11019
11026
|
error,
|
|
11020
|
-
|
|
11027
|
+
isInitialLoading,
|
|
11021
11028
|
refetch
|
|
11022
11029
|
} = alchemy.useListCarriers();
|
|
11023
11030
|
const carrierMetadatas = useCarrierMetadata();
|
|
@@ -11028,7 +11035,7 @@ const useListConnectedCarriers = () => {
|
|
|
11028
11035
|
isConnected: normalizedCarrierCodes.has(m.carrierCode)
|
|
11029
11036
|
})),
|
|
11030
11037
|
error: error,
|
|
11031
|
-
isLoading,
|
|
11038
|
+
isLoading: isInitialLoading,
|
|
11032
11039
|
refetch
|
|
11033
11040
|
};
|
|
11034
11041
|
};
|
|
@@ -11506,7 +11513,7 @@ const Component$5 = ({
|
|
|
11506
11513
|
const {
|
|
11507
11514
|
data: warehouses,
|
|
11508
11515
|
error: listWarehouseErrors,
|
|
11509
|
-
|
|
11516
|
+
isInitialLoading: isLoadingWarehouses,
|
|
11510
11517
|
refetch: refreshListWarehouses
|
|
11511
11518
|
} = alchemy.useListWarehouses();
|
|
11512
11519
|
const {
|
|
@@ -12968,7 +12975,7 @@ const WalletHistory = () => {
|
|
|
12968
12975
|
const queryRange = React.useMemo(() => selectedOption && selectedOption.value === "custom" && customRange ? customRange : selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.range, [customRange, selectedOption]);
|
|
12969
12976
|
const {
|
|
12970
12977
|
data: walletHistoryData,
|
|
12971
|
-
|
|
12978
|
+
isInitialLoading: isWalletHistoryDataLoading,
|
|
12972
12979
|
isFetching: isWalletHistoryFetching,
|
|
12973
12980
|
error: errors
|
|
12974
12981
|
} = alchemy.useGetWalletHistory({
|
|
@@ -13461,7 +13468,7 @@ const UnitSettings = () => {
|
|
|
13461
13468
|
const {
|
|
13462
13469
|
data: accountSettings,
|
|
13463
13470
|
error: getAccountSettingsErrors,
|
|
13464
|
-
|
|
13471
|
+
isInitialLoading: isLoadingAccountSettings,
|
|
13465
13472
|
refetch: refreshAccountSettings
|
|
13466
13473
|
} = alchemy.useGetAccountSettings();
|
|
13467
13474
|
const {
|
|
@@ -14291,9 +14298,6 @@ var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(O
|
|
|
14291
14298
|
* - The `<AccountSettings />` component is used to display the user's account settings, as well as
|
|
14292
14299
|
* allowing them to make changes to various aspects of their account.
|
|
14293
14300
|
*
|
|
14294
|
-
* @param onSaveSettings Any `void` function you wish to execute when the user saves any changes
|
|
14295
|
-
* to their account settings.
|
|
14296
|
-
*
|
|
14297
14301
|
* @returns Element An EmotionJSX.Element that will render the `<AccountSettings />` component
|
|
14298
14302
|
* with all the appropriate wrappers.
|
|
14299
14303
|
*
|
|
@@ -14317,8 +14321,7 @@ const Component$4 = ({
|
|
|
14317
14321
|
data: carriers
|
|
14318
14322
|
} = alchemy.useListCarriers();
|
|
14319
14323
|
return jsxRuntime.jsx(AccountSettings, {
|
|
14320
|
-
carriers: carriers
|
|
14321
|
-
onSaveSettings: onSaveSettings
|
|
14324
|
+
carriers: carriers
|
|
14322
14325
|
});
|
|
14323
14326
|
};
|
|
14324
14327
|
/**
|
|
@@ -14334,9 +14337,7 @@ const Component$4 = ({
|
|
|
14334
14337
|
* The `<Component />` is the source JSX that is rendered when you make use of the `AccountSettings`
|
|
14335
14338
|
* Element directly. Here is a brief example of how you would use it within your application.
|
|
14336
14339
|
* ```tsx
|
|
14337
|
-
* <AccountSettings.Element
|
|
14338
|
-
* onSaveSettings={() => console.log('Settings Saved!')}
|
|
14339
|
-
* />
|
|
14340
|
+
* <AccountSettings.Element/>
|
|
14340
14341
|
* ```
|
|
14341
14342
|
*
|
|
14342
14343
|
* <br />
|
|
@@ -17799,7 +17800,7 @@ const useRatesForm = ({
|
|
|
17799
17800
|
} = alchemy.useListCarriers();
|
|
17800
17801
|
const {
|
|
17801
17802
|
data: labels,
|
|
17802
|
-
|
|
17803
|
+
isInitialLoading: labelsLoading
|
|
17803
17804
|
} = alchemy.useListLabels();
|
|
17804
17805
|
const {
|
|
17805
17806
|
mutateAsync: updateShipment
|
|
@@ -18242,7 +18243,7 @@ const usePendingShipment = ({
|
|
|
18242
18243
|
const {
|
|
18243
18244
|
data: shipments,
|
|
18244
18245
|
error: listShipmentsErrors,
|
|
18245
|
-
|
|
18246
|
+
isInitialLoading: isListShipmentsLoading,
|
|
18246
18247
|
isFetching: isListShipmentsValidating,
|
|
18247
18248
|
refetch: reloadShipments
|
|
18248
18249
|
} = alchemy.useListSalesOrderShipments({
|
|
@@ -18308,7 +18309,6 @@ const useConfigureShipment = ({
|
|
|
18308
18309
|
warehouseId,
|
|
18309
18310
|
printLabelLayout
|
|
18310
18311
|
}) => {
|
|
18311
|
-
var _a, _b;
|
|
18312
18312
|
const {
|
|
18313
18313
|
isPendingShipmentLoading,
|
|
18314
18314
|
pendingShipment,
|
|
@@ -18324,12 +18324,16 @@ const useConfigureShipment = ({
|
|
|
18324
18324
|
yield reloadPendingShipment();
|
|
18325
18325
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
18326
18326
|
}), [onShipmentUpdated, reloadPendingShipment]);
|
|
18327
|
-
const
|
|
18327
|
+
const {
|
|
18328
|
+
data: {
|
|
18329
|
+
defaultLabelLayout = "4x6"
|
|
18330
|
+
} = {}
|
|
18331
|
+
} = alchemy.useGetAccountSettings();
|
|
18328
18332
|
return {
|
|
18329
18333
|
errors: pendingShipmentErrors,
|
|
18330
18334
|
isLoading: isPendingShipmentLoading,
|
|
18331
18335
|
onShipmentUpdated: handleShipmentUpdated,
|
|
18332
|
-
printLabelLayout: printLabelLayout ? printLabelLayout :
|
|
18336
|
+
printLabelLayout: printLabelLayout ? printLabelLayout : defaultLabelLayout,
|
|
18333
18337
|
shipment: pendingShipment,
|
|
18334
18338
|
warehouseId
|
|
18335
18339
|
};
|
|
@@ -18346,7 +18350,7 @@ const useImportSalesOrder = ({
|
|
|
18346
18350
|
data: salesOrders,
|
|
18347
18351
|
error: listSalesOrdersErrors,
|
|
18348
18352
|
isFetching: isFetchingSalesOrders,
|
|
18349
|
-
|
|
18353
|
+
isInitialLoading: isInitialLoadingSalesOrders,
|
|
18350
18354
|
refetch: refetchSalesOrders
|
|
18351
18355
|
} = alchemy.useListSalesOrders({
|
|
18352
18356
|
externalOrderId,
|
|
@@ -18356,7 +18360,7 @@ const useImportSalesOrder = ({
|
|
|
18356
18360
|
data: salesOrder,
|
|
18357
18361
|
error: getSalesOrderErrors,
|
|
18358
18362
|
isFetching: isFetchingSalesOrder,
|
|
18359
|
-
|
|
18363
|
+
isInitialLoading: isInitialLoadingSalesOrder,
|
|
18360
18364
|
refetch: refetchSalesOrder
|
|
18361
18365
|
} = alchemy.useGetSalesOrder(salesOrderId !== null && salesOrderId !== void 0 ? salesOrderId : salesOrders && salesOrders[0] ? salesOrders[0].salesOrderId : undefined);
|
|
18362
18366
|
const {
|
|
@@ -18386,7 +18390,7 @@ const useImportSalesOrder = ({
|
|
|
18386
18390
|
const errors = [...(listOrderSourcesErrors !== null && listOrderSourcesErrors !== void 0 ? listOrderSourcesErrors : []), ...(listSalesOrdersErrors !== null && listSalesOrdersErrors !== void 0 ? listSalesOrdersErrors : []), ...(getSalesOrderErrors !== null && getSalesOrderErrors !== void 0 ? getSalesOrderErrors : []), ...(refreshOrderSourceErrors !== null && refreshOrderSourceErrors !== void 0 ? refreshOrderSourceErrors : [])];
|
|
18387
18391
|
return {
|
|
18388
18392
|
errors: errors.length > 0 ? errors : undefined,
|
|
18389
|
-
isLoading:
|
|
18393
|
+
isLoading: isInitialLoadingSalesOrder || isInitialLoadingSalesOrders || isRefreshingOrderSource || !hasRefreshedOrderSource && !salesOrder && (salesOrders === null || salesOrders === void 0 ? void 0 : salesOrders.length) === 0 && errors.length === 0,
|
|
18390
18394
|
salesOrder
|
|
18391
18395
|
};
|
|
18392
18396
|
};
|
|
@@ -18500,13 +18504,13 @@ const useGetOrCreateShipment = (onShipmentUpdated, shipmentId) => {
|
|
|
18500
18504
|
void (onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(getShipment.data));
|
|
18501
18505
|
setShouldTriggerUpdate(false);
|
|
18502
18506
|
}
|
|
18503
|
-
}, [shouldTriggerUpdate, getShipment]);
|
|
18507
|
+
}, [shouldTriggerUpdate, getShipment, onShipmentUpdated]);
|
|
18504
18508
|
const errors = [...((_a = getShipment.error) !== null && _a !== void 0 ? _a : []), ...((_b = createShipment.error) !== null && _b !== void 0 ? _b : [])];
|
|
18505
18509
|
return {
|
|
18506
18510
|
errors: errors.length > 0 ? errors : undefined,
|
|
18507
18511
|
isLoading:
|
|
18508
18512
|
//bootstrap isLoading to true if one off and create shipment mutation hasn't been triggered yet
|
|
18509
|
-
!createShipment.isError && createShipment.isIdle && shipmentId === undefined || getShipment.
|
|
18513
|
+
!createShipment.isError && createShipment.isIdle && shipmentId === undefined || getShipment.isInitialLoading || createShipment.isLoading,
|
|
18510
18514
|
refetchShipment: getShipment.refetch,
|
|
18511
18515
|
shipment: getShipment.data
|
|
18512
18516
|
};
|
|
@@ -18530,7 +18534,7 @@ const PurchaseLabelByShipment = _a => {
|
|
|
18530
18534
|
};
|
|
18531
18535
|
const {
|
|
18532
18536
|
data: insuranceAccount,
|
|
18533
|
-
|
|
18537
|
+
isInitialLoading: insuranceIsLoading
|
|
18534
18538
|
} = alchemy.useGetInsuranceAccount("shipsurance");
|
|
18535
18539
|
return jsxRuntime.jsx(SuspendShipment, Object.assign({
|
|
18536
18540
|
shipment: shipment
|
|
@@ -19051,7 +19055,7 @@ const Component$1 = ({
|
|
|
19051
19055
|
const salesOrder = alchemy.useGetSalesOrder((_b = (_a = shipment.data) === null || _a === void 0 ? void 0 : _a.salesOrderIds) === null || _b === void 0 ? void 0 : _b[0]);
|
|
19052
19056
|
const warehouses = alchemy.useListWarehouses();
|
|
19053
19057
|
const carriers = alchemy.useListCarriers();
|
|
19054
|
-
if (
|
|
19058
|
+
if (shipment.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
19055
19059
|
message: t("loading.shipment")
|
|
19056
19060
|
});
|
|
19057
19061
|
if (shipment.error) throw new Error(shipment.error.map(e => e.message).join(", "));
|
|
@@ -19271,10 +19275,10 @@ const Component = ({
|
|
|
19271
19275
|
const label = alchemy.useGetLabel(labelId);
|
|
19272
19276
|
const shipment = alchemy.useGetSalesOrderShipment((_a = label.data) === null || _a === void 0 ? void 0 : _a.shipmentId);
|
|
19273
19277
|
const voidLabel = alchemy.useVoidLabel();
|
|
19274
|
-
if (label.
|
|
19278
|
+
if (label.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
19275
19279
|
message: t("loading.label")
|
|
19276
19280
|
});
|
|
19277
|
-
if (shipment.
|
|
19281
|
+
if (shipment.isInitialLoading) return jsxRuntime.jsx(Loader, {
|
|
19278
19282
|
message: t("loading.shipment")
|
|
19279
19283
|
});
|
|
19280
19284
|
throwAny(label.error);
|