@shipengine/elements 0.37.3 → 0.37.12
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 +102 -50
- package/index.js +103 -51
- package/package.json +1 -1
- package/src/components/items-breakdown/items-breakdown.styles.d.ts +14 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -1
- package/src/elements/account-settings/account-settings.d.ts +3 -2
- package/src/elements/configure-shipment/configure-shipment.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +1 -0
- package/src/elements/onboarding/onboarding.d.ts +3 -2
- package/src/elements/purchase-label/purchase-label.d.ts +3 -26
- package/src/elements/view-shipment/view-shipment.d.ts +3 -2
- package/src/elements/void-label/void-label.d.ts +3 -2
- package/src/locales/en/index.d.ts +3 -2
package/index.cjs
CHANGED
|
@@ -4536,8 +4536,7 @@ const useShipmentMetadata = shipment => {
|
|
|
4536
4536
|
};
|
|
4537
4537
|
|
|
4538
4538
|
let _$2 = t => t,
|
|
4539
|
-
_t$2
|
|
4540
|
-
_t2$2;
|
|
4539
|
+
_t$2;
|
|
4541
4540
|
const findGenericPackageFromCarriers = carriers => {
|
|
4542
4541
|
const carrier = carriers.find(c => c.packages.some(p => p.packageCode === "package"));
|
|
4543
4542
|
return carrier === null || carrier === void 0 ? void 0 : carrier.packages.find(p => p.packageCode === "package");
|
|
@@ -4564,17 +4563,14 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4564
4563
|
[c.carrierCode]: partialResults[c.carrierCode] === undefined
|
|
4565
4564
|
}));
|
|
4566
4565
|
const genericPackage = findGenericPackageFromCarriers(carriers);
|
|
4567
|
-
const
|
|
4568
|
-
label: t(_t$2 || (_t$2 = _$2`packageCategories.
|
|
4569
|
-
options: [{
|
|
4566
|
+
const customPackageOptions = [...(genericPackage || (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? [{
|
|
4567
|
+
label: t(_t$2 || (_t$2 = _$2`packageCategories.customPackages`)),
|
|
4568
|
+
options: [...(genericPackage ? [{
|
|
4570
4569
|
label: t("packageCodes.package"),
|
|
4571
4570
|
value: {
|
|
4572
4571
|
code: "package"
|
|
4573
4572
|
}
|
|
4574
|
-
}]
|
|
4575
|
-
}] : []), ...((customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? [{
|
|
4576
|
-
label: t(_t2$2 || (_t2$2 = _$2`packageCategories.myCustomPackages`)),
|
|
4577
|
-
options: customPackageTypes.sort((a, b) => a.name.localeCompare(b.name)).map(({
|
|
4573
|
+
}] : []), ...((customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? customPackageTypes.sort((a, b) => a.name.localeCompare(b.name)).map(({
|
|
4578
4574
|
dimensions,
|
|
4579
4575
|
name,
|
|
4580
4576
|
packageId
|
|
@@ -4585,7 +4581,7 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4585
4581
|
code: packageId
|
|
4586
4582
|
}
|
|
4587
4583
|
};
|
|
4588
|
-
})
|
|
4584
|
+
}) : [])]
|
|
4589
4585
|
}] : [])];
|
|
4590
4586
|
return carriers.reduce((options, carrier) => {
|
|
4591
4587
|
if (carrier.packages.length === 0) return options;
|
|
@@ -4606,7 +4602,7 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4606
4602
|
})),
|
|
4607
4603
|
value: carrier.carrierId
|
|
4608
4604
|
}];
|
|
4609
|
-
},
|
|
4605
|
+
}, customPackageOptions);
|
|
4610
4606
|
}, [carriers, customPackageTypes, isPoBox, isUnsupportedUpsCountry, t]);
|
|
4611
4607
|
};
|
|
4612
4608
|
|
|
@@ -14663,6 +14659,7 @@ const RateForm = ({
|
|
|
14663
14659
|
carriers,
|
|
14664
14660
|
disabled,
|
|
14665
14661
|
displayableRateErrors,
|
|
14662
|
+
displayableSaveRateErrors,
|
|
14666
14663
|
errors,
|
|
14667
14664
|
features,
|
|
14668
14665
|
isLoading,
|
|
@@ -14795,6 +14792,12 @@ const RateForm = ({
|
|
|
14795
14792
|
title: "errorTypes.rateInvalid"
|
|
14796
14793
|
};
|
|
14797
14794
|
}
|
|
14795
|
+
if (displayableSaveRateErrors === null || displayableSaveRateErrors === void 0 ? void 0 : displayableSaveRateErrors.length) {
|
|
14796
|
+
return {
|
|
14797
|
+
messages: displayableSaveRateErrors,
|
|
14798
|
+
title: "errorTypes.saveRate"
|
|
14799
|
+
};
|
|
14800
|
+
}
|
|
14798
14801
|
if (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) {
|
|
14799
14802
|
return {
|
|
14800
14803
|
messages: labelErrors,
|
|
@@ -14802,7 +14805,7 @@ const RateForm = ({
|
|
|
14802
14805
|
};
|
|
14803
14806
|
}
|
|
14804
14807
|
return undefined;
|
|
14805
|
-
}, [
|
|
14808
|
+
}, [displayableRateErrors, outOfBandDisplayableErrors, rateOptions.length, displayableSaveRateErrors, labelErrors]);
|
|
14806
14809
|
return jsxRuntime.jsxs("form", Object.assign({
|
|
14807
14810
|
id: "rate-form",
|
|
14808
14811
|
onSubmit: handleSubmit,
|
|
@@ -14911,15 +14914,29 @@ const SuspendSalesOrder = ({
|
|
|
14911
14914
|
};
|
|
14912
14915
|
|
|
14913
14916
|
const styles$2 = createStyles({
|
|
14917
|
+
itemDescription: theme => ({
|
|
14918
|
+
display: "flex",
|
|
14919
|
+
flexDirection: "column",
|
|
14920
|
+
padding: `${theme.spacing(2)}px ${theme.spacing(2)}px ${theme.spacing(0)}px ${theme.spacing(0)}px`
|
|
14921
|
+
}),
|
|
14914
14922
|
itemDetail: theme => ({
|
|
14915
|
-
padding: `${theme.spacing(
|
|
14923
|
+
padding: `${theme.spacing(2)}px ${theme.spacing(2)}px ${theme.spacing(0.5)}px ${theme.spacing(0)}px`,
|
|
14924
|
+
verticalAlign: "top"
|
|
14916
14925
|
}),
|
|
14917
14926
|
itemName: theme => ({
|
|
14918
|
-
|
|
14927
|
+
// Set item name to max 3 lines and truncate with ellipsis
|
|
14928
|
+
"-webkit-box-orient": "vertical",
|
|
14929
|
+
"-webkit-line-clamp": "3",
|
|
14930
|
+
display: "-webkit-box",
|
|
14931
|
+
lineHeight: `${theme.spacing(2.5)}px`,
|
|
14932
|
+
maxHeight: `${theme.spacing(7.5)}px`,
|
|
14933
|
+
overflow: "hidden",
|
|
14934
|
+
textOverflow: "ellipsis",
|
|
14935
|
+
whiteSpace: "normal"
|
|
14919
14936
|
}),
|
|
14920
14937
|
numericCell: () => ({
|
|
14921
14938
|
textAlign: "right",
|
|
14922
|
-
width: "
|
|
14939
|
+
width: "80px"
|
|
14923
14940
|
}),
|
|
14924
14941
|
tableWrapper: theme => ({
|
|
14925
14942
|
"&& > div": {
|
|
@@ -14978,23 +14995,18 @@ const ItemsBreakdown = ({
|
|
|
14978
14995
|
quantity,
|
|
14979
14996
|
value,
|
|
14980
14997
|
totalValue
|
|
14981
|
-
}, index) => jsxRuntime.
|
|
14982
|
-
children:
|
|
14983
|
-
children: jsxRuntime.
|
|
14984
|
-
|
|
14985
|
-
css: styles$2.itemName
|
|
14998
|
+
}, index) => jsxRuntime.jsx(React.Fragment, {
|
|
14999
|
+
children: jsxRuntime.jsxs(giger.TableBaseRow, {
|
|
15000
|
+
children: [jsxRuntime.jsxs(giger.TableBodyCell, Object.assign({
|
|
15001
|
+
css: styles$2.itemDescription
|
|
14986
15002
|
}, {
|
|
14987
|
-
children: jsxRuntime.jsx(giger.Typography, {
|
|
15003
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
15004
|
+
css: styles$2.itemName
|
|
15005
|
+
}, {
|
|
14988
15006
|
children: name
|
|
14989
|
-
})
|
|
14990
|
-
}))
|
|
14991
|
-
}), jsxRuntime.jsxs(giger.TableBaseRow, {
|
|
14992
|
-
children: [jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
14993
|
-
css: styles$2.itemDetail
|
|
14994
|
-
}, {
|
|
14995
|
-
children: jsxRuntime.jsx(giger.Typography, {
|
|
15007
|
+
})), jsxRuntime.jsx(giger.Typography, {
|
|
14996
15008
|
children: detail
|
|
14997
|
-
})
|
|
15009
|
+
})]
|
|
14998
15010
|
})), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
14999
15011
|
css: [styles$2.numericCell, styles$2.itemDetail]
|
|
15000
15012
|
}, {
|
|
@@ -15008,7 +15020,7 @@ const ItemsBreakdown = ({
|
|
|
15008
15020
|
}, {
|
|
15009
15021
|
children: totalValue && formatMoney(totalValue)
|
|
15010
15022
|
}))]
|
|
15011
|
-
})
|
|
15023
|
+
})
|
|
15012
15024
|
}, index))
|
|
15013
15025
|
})
|
|
15014
15026
|
}))
|
|
@@ -16005,6 +16017,7 @@ const ShipmentForm = ({
|
|
|
16005
16017
|
}, {
|
|
16006
16018
|
children: presetCategory.options.map(preset => jsxRuntime.jsx(giger.Option, Object.assign({
|
|
16007
16019
|
onClick: () => {
|
|
16020
|
+
onDirty(); // bypass rate cache
|
|
16008
16021
|
handleApplyPreset(preset.value);
|
|
16009
16022
|
},
|
|
16010
16023
|
selected: ___default["default"].isEqual(selectedPreset, preset.value),
|
|
@@ -16901,7 +16914,8 @@ var common = {
|
|
|
16901
16914
|
warehouses: "Unable to load warehouses"
|
|
16902
16915
|
},
|
|
16903
16916
|
unknown: "Oops! Something went wrong.",
|
|
16904
|
-
noRatesAvailable: "No rates available for this shipment. Please check your shipment configuration."
|
|
16917
|
+
noRatesAvailable: "No rates available for this shipment. Please check your shipment configuration.",
|
|
16918
|
+
saveRateError: "An error occurred while attempting to save your rate. Please try again later or save a different rate option."
|
|
16905
16919
|
},
|
|
16906
16920
|
errorTypes: {
|
|
16907
16921
|
accountStatus: "Account status error",
|
|
@@ -16909,6 +16923,7 @@ var common = {
|
|
|
16909
16923
|
integrations: "Integrations error",
|
|
16910
16924
|
purchase: "Purchase error",
|
|
16911
16925
|
rateInvalid: "Invalid rate configuration",
|
|
16926
|
+
saveRate: "Error saving rate",
|
|
16912
16927
|
security: "Security error",
|
|
16913
16928
|
shipmentStatus: "Shipment status error",
|
|
16914
16929
|
system: "System error",
|
|
@@ -16949,8 +16964,7 @@ var common = {
|
|
|
16949
16964
|
december: "December"
|
|
16950
16965
|
},
|
|
16951
16966
|
packageCategories: {
|
|
16952
|
-
|
|
16953
|
-
myCustomPackages: "My Custom Packages"
|
|
16967
|
+
customPackages: "Custom Packages"
|
|
16954
16968
|
},
|
|
16955
16969
|
packageCodes: {
|
|
16956
16970
|
"package": "Custom"
|
|
@@ -18190,11 +18204,14 @@ const useRatesForm = ({
|
|
|
18190
18204
|
carrierId,
|
|
18191
18205
|
serviceCode
|
|
18192
18206
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18207
|
+
var _d, _e;
|
|
18193
18208
|
if (!shipment) throw new Error("shipment not found");
|
|
18209
|
+
// clear any errors before attempting to save
|
|
18210
|
+
setBeforeSaveError(undefined);
|
|
18194
18211
|
try {
|
|
18195
18212
|
const beforeSaveResponse = yield onBeforeRateSaved === null || onBeforeRateSaved === void 0 ? void 0 : onBeforeRateSaved(carrierId, serviceCode);
|
|
18196
18213
|
let updatedShipment;
|
|
18197
|
-
if (!beforeSaveResponse) {
|
|
18214
|
+
if (!beforeSaveResponse || Object.keys(beforeSaveResponse).length === 0) {
|
|
18198
18215
|
updatedShipment = yield updateShipment(Object.assign(Object.assign({}, shipment), {
|
|
18199
18216
|
carrierId,
|
|
18200
18217
|
serviceCode,
|
|
@@ -18227,24 +18244,34 @@ const useRatesForm = ({
|
|
|
18227
18244
|
return;
|
|
18228
18245
|
}
|
|
18229
18246
|
} catch (e) {
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
|
|
18235
|
-
|
|
18247
|
+
if (Array.isArray(e)) {
|
|
18248
|
+
if (e[0] instanceof alchemy.SE.CodedError) setBeforeSaveError(e[0]);else setBeforeSaveError({
|
|
18249
|
+
errorCode: "unknown",
|
|
18250
|
+
errorSource: "client",
|
|
18251
|
+
errorType: "unknown",
|
|
18252
|
+
message: (_d = e[0].message) !== null && _d !== void 0 ? _d : "An unknown error occurred"
|
|
18253
|
+
});
|
|
18254
|
+
} else {
|
|
18255
|
+
if (e instanceof alchemy.SE.CodedError) setBeforeSaveError(e);else setBeforeSaveError({
|
|
18256
|
+
errorCode: "unknown",
|
|
18257
|
+
errorSource: "client",
|
|
18258
|
+
errorType: "unknown",
|
|
18259
|
+
message: (_e = e.message) !== null && _e !== void 0 ? _e : "An unknown error occurred"
|
|
18260
|
+
});
|
|
18261
|
+
}
|
|
18262
|
+
return;
|
|
18236
18263
|
}
|
|
18237
18264
|
}), [onBeforeRateSaved, onUpdatedShipment, resetRates, shipment, updateShipment]);
|
|
18238
18265
|
const handleSubmit = React.useCallback(rateId => __awaiter(void 0, void 0, void 0, function* () {
|
|
18239
|
-
var
|
|
18266
|
+
var _f, _g, _h;
|
|
18240
18267
|
setBeforeCreateError(undefined);
|
|
18241
18268
|
if (!shipment) return;
|
|
18242
18269
|
const preferredRates = preferredRatesResponse === null || preferredRatesResponse === void 0 ? void 0 : preferredRatesResponse.map(r => r.rate);
|
|
18243
|
-
const rate = [...((
|
|
18270
|
+
const rate = [...((_f = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.rates) !== null && _f !== void 0 ? _f : []), ...(preferredRates !== null && preferredRates !== void 0 ? preferredRates : [])].find(r => r.rateId === rateId);
|
|
18244
18271
|
if (rate) {
|
|
18245
18272
|
try {
|
|
18246
18273
|
const beforePurchaseResponse = yield onBeforeLabelCreate === null || onBeforeLabelCreate === void 0 ? void 0 : onBeforeLabelCreate(rate, shipment);
|
|
18247
|
-
if (!beforePurchaseResponse) {
|
|
18274
|
+
if (!beforePurchaseResponse || Object.keys(beforePurchaseResponse).length === 0) {
|
|
18248
18275
|
yield purchaseLabel(rateId, shipment, rate);
|
|
18249
18276
|
return;
|
|
18250
18277
|
}
|
|
@@ -18271,12 +18298,21 @@ const useRatesForm = ({
|
|
|
18271
18298
|
}
|
|
18272
18299
|
}
|
|
18273
18300
|
} catch (e) {
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18301
|
+
if (Array.isArray(e)) {
|
|
18302
|
+
if (e[0] instanceof alchemy.SE.CodedError) setBeforeCreateError(e[0]);else setBeforeCreateError({
|
|
18303
|
+
errorCode: "unknown",
|
|
18304
|
+
errorSource: "client",
|
|
18305
|
+
errorType: "unknown",
|
|
18306
|
+
message: (_g = e[0].message) !== null && _g !== void 0 ? _g : "An unknown error occurred"
|
|
18307
|
+
});
|
|
18308
|
+
} else {
|
|
18309
|
+
if (e instanceof alchemy.SE.CodedError) setBeforeCreateError(e);else setBeforeCreateError({
|
|
18310
|
+
errorCode: "unknown",
|
|
18311
|
+
errorSource: "client",
|
|
18312
|
+
errorType: "unknown",
|
|
18313
|
+
message: (_h = e.message) !== null && _h !== void 0 ? _h : "An unknown error occurred"
|
|
18314
|
+
});
|
|
18315
|
+
}
|
|
18280
18316
|
return;
|
|
18281
18317
|
}
|
|
18282
18318
|
}
|
|
@@ -18297,6 +18333,11 @@ const useRatesForm = ({
|
|
|
18297
18333
|
name: "CodedError"
|
|
18298
18334
|
}))) !== null && _b !== void 0 ? _b : [];
|
|
18299
18335
|
}
|
|
18336
|
+
const displayableSaveRateErrors = useScrubErrors({
|
|
18337
|
+
errors: errors,
|
|
18338
|
+
predicate: React.useCallback(e => e.message.includes("Only residential delivery addresses are allowed for UPS Ground Saver."), []),
|
|
18339
|
+
scrubber: React.useCallback(() => "common:errorMessages.saveRateError", [])
|
|
18340
|
+
});
|
|
18300
18341
|
const displayableRateErrors = useScrubErrors({
|
|
18301
18342
|
errors: errors,
|
|
18302
18343
|
predicate: React.useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
@@ -18309,6 +18350,7 @@ const useRatesForm = ({
|
|
|
18309
18350
|
return {
|
|
18310
18351
|
carriers,
|
|
18311
18352
|
displayableRateErrors,
|
|
18353
|
+
displayableSaveRateErrors,
|
|
18312
18354
|
errors: errors.length > 0 ? errors : undefined,
|
|
18313
18355
|
isLoading: ratesCalculating,
|
|
18314
18356
|
labelErrors: displayableLabelErrors,
|
|
@@ -18736,13 +18778,18 @@ const PurchaseLabelBySalesOrder = _a => {
|
|
|
18736
18778
|
salesOrder,
|
|
18737
18779
|
warehouseId
|
|
18738
18780
|
});
|
|
18781
|
+
const {
|
|
18782
|
+
data: insuranceAccount,
|
|
18783
|
+
isLoading: insuranceIsLoading
|
|
18784
|
+
} = alchemy.useGetInsuranceAccount("shipsurance");
|
|
18739
18785
|
return jsxRuntime.jsx(SuspendSalesOrder, Object.assign({
|
|
18740
18786
|
salesOrder: salesOrder
|
|
18741
18787
|
}, salesOrderProps, {
|
|
18742
|
-
isLoading: salesOrderLoading || configureShipmentProps.isLoading
|
|
18788
|
+
isLoading: salesOrderLoading || configureShipmentProps.isLoading || insuranceIsLoading
|
|
18743
18789
|
}, {
|
|
18744
18790
|
children: salesOrder && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
18745
18791
|
features: features,
|
|
18792
|
+
insuranceAccount: insuranceAccount,
|
|
18746
18793
|
salesOrder: salesOrder
|
|
18747
18794
|
}, configureShipmentProps, props))
|
|
18748
18795
|
}));
|
|
@@ -18811,11 +18858,16 @@ const PurchaseLabelByShipment = _a => {
|
|
|
18811
18858
|
void shipmentProps.refetchShipment();
|
|
18812
18859
|
onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
18813
18860
|
};
|
|
18861
|
+
const {
|
|
18862
|
+
data: insuranceAccount,
|
|
18863
|
+
isLoading: insuranceIsLoading
|
|
18864
|
+
} = alchemy.useGetInsuranceAccount("shipsurance");
|
|
18814
18865
|
return jsxRuntime.jsx(SuspendShipment, Object.assign({
|
|
18815
18866
|
shipment: shipment
|
|
18816
18867
|
}, shipmentProps, {
|
|
18817
18868
|
children: shipment && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
18818
18869
|
errors: shipmentProps.errors,
|
|
18870
|
+
insuranceAccount: insuranceAccount,
|
|
18819
18871
|
isLoading: shipmentProps.isLoading,
|
|
18820
18872
|
onShipmentUpdated: handleShipmentUpdated,
|
|
18821
18873
|
shipment: shipment
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { useTranslation, Trans } from 'react-i18next';
|
|
3
3
|
import { InlineNotification, NotificationType, Typography, Link, ButtonSize, Spinner, Icon, IconSize, Divider, Skeleton, SkeletonAnimation, SkeletonVariant, Grid, GridChild, Pagination, SkeletonBackgroundColor, RadioGroup, Radio, SpinnerSize, FormField, FieldMessageType, Checkbox, Input, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ChipList, Chip, ButtonVariant, ButtonColor, Tag, TagColor, Stepper, Step, IconTooltip, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, DatePicker as DatePicker$1, BottomSheet } from '@packlink/giger';
|
|
4
|
-
import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, AlchemyContext, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, CodedError, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
|
|
4
|
+
import alchemy, { SE, logger, useValidateAddresses, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useGetWalletHistory, useGetAccountSettings, useUpdateAccountSettings, AlchemyContext, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useUpdateFundingSource, useListFundingSources, useCreateFundingSource, useRegisterCarrier, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, CodedError, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetInsuranceAccount, useCreateShipment, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import _$3, { get as get$1, isEqual } from 'lodash';
|
|
7
7
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
@@ -4504,8 +4504,7 @@ const useShipmentMetadata = shipment => {
|
|
|
4504
4504
|
};
|
|
4505
4505
|
|
|
4506
4506
|
let _$2 = t => t,
|
|
4507
|
-
_t$2
|
|
4508
|
-
_t2$2;
|
|
4507
|
+
_t$2;
|
|
4509
4508
|
const findGenericPackageFromCarriers = carriers => {
|
|
4510
4509
|
const carrier = carriers.find(c => c.packages.some(p => p.packageCode === "package"));
|
|
4511
4510
|
return carrier === null || carrier === void 0 ? void 0 : carrier.packages.find(p => p.packageCode === "package");
|
|
@@ -4532,17 +4531,14 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4532
4531
|
[c.carrierCode]: partialResults[c.carrierCode] === undefined
|
|
4533
4532
|
}));
|
|
4534
4533
|
const genericPackage = findGenericPackageFromCarriers(carriers);
|
|
4535
|
-
const
|
|
4536
|
-
label: t(_t$2 || (_t$2 = _$2`packageCategories.
|
|
4537
|
-
options: [{
|
|
4534
|
+
const customPackageOptions = [...(genericPackage || (customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? [{
|
|
4535
|
+
label: t(_t$2 || (_t$2 = _$2`packageCategories.customPackages`)),
|
|
4536
|
+
options: [...(genericPackage ? [{
|
|
4538
4537
|
label: t("packageCodes.package"),
|
|
4539
4538
|
value: {
|
|
4540
4539
|
code: "package"
|
|
4541
4540
|
}
|
|
4542
|
-
}]
|
|
4543
|
-
}] : []), ...((customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? [{
|
|
4544
|
-
label: t(_t2$2 || (_t2$2 = _$2`packageCategories.myCustomPackages`)),
|
|
4545
|
-
options: customPackageTypes.sort((a, b) => a.name.localeCompare(b.name)).map(({
|
|
4541
|
+
}] : []), ...((customPackageTypes === null || customPackageTypes === void 0 ? void 0 : customPackageTypes.length) ? customPackageTypes.sort((a, b) => a.name.localeCompare(b.name)).map(({
|
|
4546
4542
|
dimensions,
|
|
4547
4543
|
name,
|
|
4548
4544
|
packageId
|
|
@@ -4553,7 +4549,7 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4553
4549
|
code: packageId
|
|
4554
4550
|
}
|
|
4555
4551
|
};
|
|
4556
|
-
})
|
|
4552
|
+
}) : [])]
|
|
4557
4553
|
}] : [])];
|
|
4558
4554
|
return carriers.reduce((options, carrier) => {
|
|
4559
4555
|
if (carrier.packages.length === 0) return options;
|
|
@@ -4574,7 +4570,7 @@ const usePackageOptions = (carriers, customPackageTypes, shipment) => {
|
|
|
4574
4570
|
})),
|
|
4575
4571
|
value: carrier.carrierId
|
|
4576
4572
|
}];
|
|
4577
|
-
},
|
|
4573
|
+
}, customPackageOptions);
|
|
4578
4574
|
}, [carriers, customPackageTypes, isPoBox, isUnsupportedUpsCountry, t]);
|
|
4579
4575
|
};
|
|
4580
4576
|
|
|
@@ -14631,6 +14627,7 @@ const RateForm = ({
|
|
|
14631
14627
|
carriers,
|
|
14632
14628
|
disabled,
|
|
14633
14629
|
displayableRateErrors,
|
|
14630
|
+
displayableSaveRateErrors,
|
|
14634
14631
|
errors,
|
|
14635
14632
|
features,
|
|
14636
14633
|
isLoading,
|
|
@@ -14763,6 +14760,12 @@ const RateForm = ({
|
|
|
14763
14760
|
title: "errorTypes.rateInvalid"
|
|
14764
14761
|
};
|
|
14765
14762
|
}
|
|
14763
|
+
if (displayableSaveRateErrors === null || displayableSaveRateErrors === void 0 ? void 0 : displayableSaveRateErrors.length) {
|
|
14764
|
+
return {
|
|
14765
|
+
messages: displayableSaveRateErrors,
|
|
14766
|
+
title: "errorTypes.saveRate"
|
|
14767
|
+
};
|
|
14768
|
+
}
|
|
14766
14769
|
if (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) {
|
|
14767
14770
|
return {
|
|
14768
14771
|
messages: labelErrors,
|
|
@@ -14770,7 +14773,7 @@ const RateForm = ({
|
|
|
14770
14773
|
};
|
|
14771
14774
|
}
|
|
14772
14775
|
return undefined;
|
|
14773
|
-
}, [
|
|
14776
|
+
}, [displayableRateErrors, outOfBandDisplayableErrors, rateOptions.length, displayableSaveRateErrors, labelErrors]);
|
|
14774
14777
|
return jsxs("form", Object.assign({
|
|
14775
14778
|
id: "rate-form",
|
|
14776
14779
|
onSubmit: handleSubmit,
|
|
@@ -14879,15 +14882,29 @@ const SuspendSalesOrder = ({
|
|
|
14879
14882
|
};
|
|
14880
14883
|
|
|
14881
14884
|
const styles$2 = createStyles({
|
|
14885
|
+
itemDescription: theme => ({
|
|
14886
|
+
display: "flex",
|
|
14887
|
+
flexDirection: "column",
|
|
14888
|
+
padding: `${theme.spacing(2)}px ${theme.spacing(2)}px ${theme.spacing(0)}px ${theme.spacing(0)}px`
|
|
14889
|
+
}),
|
|
14882
14890
|
itemDetail: theme => ({
|
|
14883
|
-
padding: `${theme.spacing(
|
|
14891
|
+
padding: `${theme.spacing(2)}px ${theme.spacing(2)}px ${theme.spacing(0.5)}px ${theme.spacing(0)}px`,
|
|
14892
|
+
verticalAlign: "top"
|
|
14884
14893
|
}),
|
|
14885
14894
|
itemName: theme => ({
|
|
14886
|
-
|
|
14895
|
+
// Set item name to max 3 lines and truncate with ellipsis
|
|
14896
|
+
"-webkit-box-orient": "vertical",
|
|
14897
|
+
"-webkit-line-clamp": "3",
|
|
14898
|
+
display: "-webkit-box",
|
|
14899
|
+
lineHeight: `${theme.spacing(2.5)}px`,
|
|
14900
|
+
maxHeight: `${theme.spacing(7.5)}px`,
|
|
14901
|
+
overflow: "hidden",
|
|
14902
|
+
textOverflow: "ellipsis",
|
|
14903
|
+
whiteSpace: "normal"
|
|
14887
14904
|
}),
|
|
14888
14905
|
numericCell: () => ({
|
|
14889
14906
|
textAlign: "right",
|
|
14890
|
-
width: "
|
|
14907
|
+
width: "80px"
|
|
14891
14908
|
}),
|
|
14892
14909
|
tableWrapper: theme => ({
|
|
14893
14910
|
"&& > div": {
|
|
@@ -14946,23 +14963,18 @@ const ItemsBreakdown = ({
|
|
|
14946
14963
|
quantity,
|
|
14947
14964
|
value,
|
|
14948
14965
|
totalValue
|
|
14949
|
-
}, index) =>
|
|
14950
|
-
children:
|
|
14951
|
-
children:
|
|
14952
|
-
|
|
14953
|
-
css: styles$2.itemName
|
|
14966
|
+
}, index) => jsx(Fragment$1, {
|
|
14967
|
+
children: jsxs(TableBaseRow, {
|
|
14968
|
+
children: [jsxs(TableBodyCell, Object.assign({
|
|
14969
|
+
css: styles$2.itemDescription
|
|
14954
14970
|
}, {
|
|
14955
|
-
children: jsx(Typography, {
|
|
14971
|
+
children: [jsx(Typography, Object.assign({
|
|
14972
|
+
css: styles$2.itemName
|
|
14973
|
+
}, {
|
|
14956
14974
|
children: name
|
|
14957
|
-
})
|
|
14958
|
-
}))
|
|
14959
|
-
}), jsxs(TableBaseRow, {
|
|
14960
|
-
children: [jsx(TableBodyCell, Object.assign({
|
|
14961
|
-
css: styles$2.itemDetail
|
|
14962
|
-
}, {
|
|
14963
|
-
children: jsx(Typography, {
|
|
14975
|
+
})), jsx(Typography, {
|
|
14964
14976
|
children: detail
|
|
14965
|
-
})
|
|
14977
|
+
})]
|
|
14966
14978
|
})), jsx(TableBodyCell, Object.assign({
|
|
14967
14979
|
css: [styles$2.numericCell, styles$2.itemDetail]
|
|
14968
14980
|
}, {
|
|
@@ -14976,7 +14988,7 @@ const ItemsBreakdown = ({
|
|
|
14976
14988
|
}, {
|
|
14977
14989
|
children: totalValue && formatMoney(totalValue)
|
|
14978
14990
|
}))]
|
|
14979
|
-
})
|
|
14991
|
+
})
|
|
14980
14992
|
}, index))
|
|
14981
14993
|
})
|
|
14982
14994
|
}))
|
|
@@ -15973,6 +15985,7 @@ const ShipmentForm = ({
|
|
|
15973
15985
|
}, {
|
|
15974
15986
|
children: presetCategory.options.map(preset => jsx(Option, Object.assign({
|
|
15975
15987
|
onClick: () => {
|
|
15988
|
+
onDirty(); // bypass rate cache
|
|
15976
15989
|
handleApplyPreset(preset.value);
|
|
15977
15990
|
},
|
|
15978
15991
|
selected: _$3.isEqual(selectedPreset, preset.value),
|
|
@@ -16869,7 +16882,8 @@ var common = {
|
|
|
16869
16882
|
warehouses: "Unable to load warehouses"
|
|
16870
16883
|
},
|
|
16871
16884
|
unknown: "Oops! Something went wrong.",
|
|
16872
|
-
noRatesAvailable: "No rates available for this shipment. Please check your shipment configuration."
|
|
16885
|
+
noRatesAvailable: "No rates available for this shipment. Please check your shipment configuration.",
|
|
16886
|
+
saveRateError: "An error occurred while attempting to save your rate. Please try again later or save a different rate option."
|
|
16873
16887
|
},
|
|
16874
16888
|
errorTypes: {
|
|
16875
16889
|
accountStatus: "Account status error",
|
|
@@ -16877,6 +16891,7 @@ var common = {
|
|
|
16877
16891
|
integrations: "Integrations error",
|
|
16878
16892
|
purchase: "Purchase error",
|
|
16879
16893
|
rateInvalid: "Invalid rate configuration",
|
|
16894
|
+
saveRate: "Error saving rate",
|
|
16880
16895
|
security: "Security error",
|
|
16881
16896
|
shipmentStatus: "Shipment status error",
|
|
16882
16897
|
system: "System error",
|
|
@@ -16917,8 +16932,7 @@ var common = {
|
|
|
16917
16932
|
december: "December"
|
|
16918
16933
|
},
|
|
16919
16934
|
packageCategories: {
|
|
16920
|
-
|
|
16921
|
-
myCustomPackages: "My Custom Packages"
|
|
16935
|
+
customPackages: "Custom Packages"
|
|
16922
16936
|
},
|
|
16923
16937
|
packageCodes: {
|
|
16924
16938
|
"package": "Custom"
|
|
@@ -18158,11 +18172,14 @@ const useRatesForm = ({
|
|
|
18158
18172
|
carrierId,
|
|
18159
18173
|
serviceCode
|
|
18160
18174
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18175
|
+
var _d, _e;
|
|
18161
18176
|
if (!shipment) throw new Error("shipment not found");
|
|
18177
|
+
// clear any errors before attempting to save
|
|
18178
|
+
setBeforeSaveError(undefined);
|
|
18162
18179
|
try {
|
|
18163
18180
|
const beforeSaveResponse = yield onBeforeRateSaved === null || onBeforeRateSaved === void 0 ? void 0 : onBeforeRateSaved(carrierId, serviceCode);
|
|
18164
18181
|
let updatedShipment;
|
|
18165
|
-
if (!beforeSaveResponse) {
|
|
18182
|
+
if (!beforeSaveResponse || Object.keys(beforeSaveResponse).length === 0) {
|
|
18166
18183
|
updatedShipment = yield updateShipment(Object.assign(Object.assign({}, shipment), {
|
|
18167
18184
|
carrierId,
|
|
18168
18185
|
serviceCode,
|
|
@@ -18195,24 +18212,34 @@ const useRatesForm = ({
|
|
|
18195
18212
|
return;
|
|
18196
18213
|
}
|
|
18197
18214
|
} catch (e) {
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18215
|
+
if (Array.isArray(e)) {
|
|
18216
|
+
if (e[0] instanceof SE.CodedError) setBeforeSaveError(e[0]);else setBeforeSaveError({
|
|
18217
|
+
errorCode: "unknown",
|
|
18218
|
+
errorSource: "client",
|
|
18219
|
+
errorType: "unknown",
|
|
18220
|
+
message: (_d = e[0].message) !== null && _d !== void 0 ? _d : "An unknown error occurred"
|
|
18221
|
+
});
|
|
18222
|
+
} else {
|
|
18223
|
+
if (e instanceof SE.CodedError) setBeforeSaveError(e);else setBeforeSaveError({
|
|
18224
|
+
errorCode: "unknown",
|
|
18225
|
+
errorSource: "client",
|
|
18226
|
+
errorType: "unknown",
|
|
18227
|
+
message: (_e = e.message) !== null && _e !== void 0 ? _e : "An unknown error occurred"
|
|
18228
|
+
});
|
|
18229
|
+
}
|
|
18230
|
+
return;
|
|
18204
18231
|
}
|
|
18205
18232
|
}), [onBeforeRateSaved, onUpdatedShipment, resetRates, shipment, updateShipment]);
|
|
18206
18233
|
const handleSubmit = useCallback(rateId => __awaiter(void 0, void 0, void 0, function* () {
|
|
18207
|
-
var
|
|
18234
|
+
var _f, _g, _h;
|
|
18208
18235
|
setBeforeCreateError(undefined);
|
|
18209
18236
|
if (!shipment) return;
|
|
18210
18237
|
const preferredRates = preferredRatesResponse === null || preferredRatesResponse === void 0 ? void 0 : preferredRatesResponse.map(r => r.rate);
|
|
18211
|
-
const rate = [...((
|
|
18238
|
+
const rate = [...((_f = ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.rates) !== null && _f !== void 0 ? _f : []), ...(preferredRates !== null && preferredRates !== void 0 ? preferredRates : [])].find(r => r.rateId === rateId);
|
|
18212
18239
|
if (rate) {
|
|
18213
18240
|
try {
|
|
18214
18241
|
const beforePurchaseResponse = yield onBeforeLabelCreate === null || onBeforeLabelCreate === void 0 ? void 0 : onBeforeLabelCreate(rate, shipment);
|
|
18215
|
-
if (!beforePurchaseResponse) {
|
|
18242
|
+
if (!beforePurchaseResponse || Object.keys(beforePurchaseResponse).length === 0) {
|
|
18216
18243
|
yield purchaseLabel(rateId, shipment, rate);
|
|
18217
18244
|
return;
|
|
18218
18245
|
}
|
|
@@ -18239,12 +18266,21 @@ const useRatesForm = ({
|
|
|
18239
18266
|
}
|
|
18240
18267
|
}
|
|
18241
18268
|
} catch (e) {
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18269
|
+
if (Array.isArray(e)) {
|
|
18270
|
+
if (e[0] instanceof SE.CodedError) setBeforeCreateError(e[0]);else setBeforeCreateError({
|
|
18271
|
+
errorCode: "unknown",
|
|
18272
|
+
errorSource: "client",
|
|
18273
|
+
errorType: "unknown",
|
|
18274
|
+
message: (_g = e[0].message) !== null && _g !== void 0 ? _g : "An unknown error occurred"
|
|
18275
|
+
});
|
|
18276
|
+
} else {
|
|
18277
|
+
if (e instanceof SE.CodedError) setBeforeCreateError(e);else setBeforeCreateError({
|
|
18278
|
+
errorCode: "unknown",
|
|
18279
|
+
errorSource: "client",
|
|
18280
|
+
errorType: "unknown",
|
|
18281
|
+
message: (_h = e.message) !== null && _h !== void 0 ? _h : "An unknown error occurred"
|
|
18282
|
+
});
|
|
18283
|
+
}
|
|
18248
18284
|
return;
|
|
18249
18285
|
}
|
|
18250
18286
|
}
|
|
@@ -18265,6 +18301,11 @@ const useRatesForm = ({
|
|
|
18265
18301
|
name: "CodedError"
|
|
18266
18302
|
}))) !== null && _b !== void 0 ? _b : [];
|
|
18267
18303
|
}
|
|
18304
|
+
const displayableSaveRateErrors = useScrubErrors({
|
|
18305
|
+
errors: errors,
|
|
18306
|
+
predicate: useCallback(e => e.message.includes("Only residential delivery addresses are allowed for UPS Ground Saver."), []),
|
|
18307
|
+
scrubber: useCallback(() => "common:errorMessages.saveRateError", [])
|
|
18308
|
+
});
|
|
18268
18309
|
const displayableRateErrors = useScrubErrors({
|
|
18269
18310
|
errors: errors,
|
|
18270
18311
|
predicate: useCallback(e => e.message.includes("No rates are available for service_codes"), []),
|
|
@@ -18277,6 +18318,7 @@ const useRatesForm = ({
|
|
|
18277
18318
|
return {
|
|
18278
18319
|
carriers,
|
|
18279
18320
|
displayableRateErrors,
|
|
18321
|
+
displayableSaveRateErrors,
|
|
18280
18322
|
errors: errors.length > 0 ? errors : undefined,
|
|
18281
18323
|
isLoading: ratesCalculating,
|
|
18282
18324
|
labelErrors: displayableLabelErrors,
|
|
@@ -18704,13 +18746,18 @@ const PurchaseLabelBySalesOrder = _a => {
|
|
|
18704
18746
|
salesOrder,
|
|
18705
18747
|
warehouseId
|
|
18706
18748
|
});
|
|
18749
|
+
const {
|
|
18750
|
+
data: insuranceAccount,
|
|
18751
|
+
isLoading: insuranceIsLoading
|
|
18752
|
+
} = useGetInsuranceAccount("shipsurance");
|
|
18707
18753
|
return jsx(SuspendSalesOrder, Object.assign({
|
|
18708
18754
|
salesOrder: salesOrder
|
|
18709
18755
|
}, salesOrderProps, {
|
|
18710
|
-
isLoading: salesOrderLoading || configureShipmentProps.isLoading
|
|
18756
|
+
isLoading: salesOrderLoading || configureShipmentProps.isLoading || insuranceIsLoading
|
|
18711
18757
|
}, {
|
|
18712
18758
|
children: salesOrder && jsx(ConfigureShipment, Object.assign({
|
|
18713
18759
|
features: features,
|
|
18760
|
+
insuranceAccount: insuranceAccount,
|
|
18714
18761
|
salesOrder: salesOrder
|
|
18715
18762
|
}, configureShipmentProps, props))
|
|
18716
18763
|
}));
|
|
@@ -18779,11 +18826,16 @@ const PurchaseLabelByShipment = _a => {
|
|
|
18779
18826
|
void shipmentProps.refetchShipment();
|
|
18780
18827
|
onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
18781
18828
|
};
|
|
18829
|
+
const {
|
|
18830
|
+
data: insuranceAccount,
|
|
18831
|
+
isLoading: insuranceIsLoading
|
|
18832
|
+
} = useGetInsuranceAccount("shipsurance");
|
|
18782
18833
|
return jsx(SuspendShipment, Object.assign({
|
|
18783
18834
|
shipment: shipment
|
|
18784
18835
|
}, shipmentProps, {
|
|
18785
18836
|
children: shipment && jsx(ConfigureShipment, Object.assign({
|
|
18786
18837
|
errors: shipmentProps.errors,
|
|
18838
|
+
insuranceAccount: insuranceAccount,
|
|
18787
18839
|
isLoading: shipmentProps.isLoading,
|
|
18788
18840
|
onShipmentUpdated: handleShipmentUpdated,
|
|
18789
18841
|
shipment: shipment
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
|
+
itemDescription: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
|
|
3
|
+
display: "flex";
|
|
4
|
+
flexDirection: "column";
|
|
5
|
+
padding: string;
|
|
6
|
+
};
|
|
2
7
|
itemDetail: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
|
|
3
8
|
padding: string;
|
|
9
|
+
verticalAlign: string;
|
|
4
10
|
};
|
|
5
11
|
itemName: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
|
|
6
|
-
|
|
12
|
+
"-webkit-box-orient": string;
|
|
13
|
+
"-webkit-line-clamp": string;
|
|
14
|
+
display: "-webkit-box";
|
|
15
|
+
lineHeight: string;
|
|
16
|
+
maxHeight: string;
|
|
17
|
+
overflow: "hidden";
|
|
18
|
+
textOverflow: "ellipsis";
|
|
19
|
+
whiteSpace: "normal";
|
|
7
20
|
};
|
|
8
21
|
numericCell: () => {
|
|
9
22
|
textAlign: "right";
|
|
@@ -4,6 +4,7 @@ export type RateFormProps = {
|
|
|
4
4
|
carriers?: SE.Carrier[];
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
displayableRateErrors?: string[];
|
|
7
|
+
displayableSaveRateErrors?: string[];
|
|
7
8
|
errors?: SE.CodedError[];
|
|
8
9
|
features?: ConfigureShipmentFeatures;
|
|
9
10
|
isLoading?: boolean;
|
|
@@ -19,4 +20,4 @@ export type RateFormProps = {
|
|
|
19
20
|
rates?: SE.Rate[];
|
|
20
21
|
shipment?: SE.SalesOrderShipment;
|
|
21
22
|
};
|
|
22
|
-
export declare const RateForm: ({ carriers, disabled, displayableRateErrors, errors, features, isLoading, labelErrors, labels, labelsLoading, onSave, onSelectRate, onSubmit, outOfBandDisplayableErrors, preferredRates, preferredServiceCodes, rates, shipment, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const RateForm: ({ carriers, disabled, displayableRateErrors, displayableSaveRateErrors, errors, features, isLoading, labelErrors, labels, labelsLoading, onSave, onSelectRate, onSubmit, outOfBandDisplayableErrors, preferredRates, preferredServiceCodes, rates, shipment, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -637,6 +637,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
637
637
|
};
|
|
638
638
|
unknown: string;
|
|
639
639
|
noRatesAvailable: string;
|
|
640
|
+
saveRateError: string;
|
|
640
641
|
};
|
|
641
642
|
errorTypes: {
|
|
642
643
|
accountStatus: string;
|
|
@@ -644,6 +645,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
644
645
|
integrations: string;
|
|
645
646
|
purchase: string;
|
|
646
647
|
rateInvalid: string;
|
|
648
|
+
saveRate: string;
|
|
647
649
|
security: string;
|
|
648
650
|
shipmentStatus: string;
|
|
649
651
|
system: string;
|
|
@@ -684,8 +686,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
684
686
|
december: string;
|
|
685
687
|
};
|
|
686
688
|
packageCategories: {
|
|
687
|
-
|
|
688
|
-
myCustomPackages: string;
|
|
689
|
+
customPackages: string;
|
|
689
690
|
};
|
|
690
691
|
packageCodes: {
|
|
691
692
|
package: string;
|
|
@@ -41,6 +41,7 @@ export type ConfigureShipmentProps = {
|
|
|
41
41
|
errors?: Templates.ShipmentFormProps["errors"];
|
|
42
42
|
features?: ConfigureShipmentFeatures;
|
|
43
43
|
getPreferredRates?: (shipment: SE.SalesOrderShipment, isInternational: boolean) => Promise<PreferredRatesResponse | undefined>;
|
|
44
|
+
insuranceAccount?: SE.InsuranceAccount;
|
|
44
45
|
isLoading?: Templates.ShipmentFormProps["isLoading"];
|
|
45
46
|
onAddressValidation?: UseShipmentFormProps["onAddressValidation"];
|
|
46
47
|
onApplyPreset?: UseShipmentFormProps["onApplyPreset"];
|
|
@@ -24,6 +24,7 @@ export type UseRatesFormProps = {
|
|
|
24
24
|
export declare const useRatesForm: ({ getPreferredRates, onBeforeRateSaved, onBeforeLabelCreate, onLabelCreateFailure, onLabelCreateSuccess, onRateSaved, onRatesCalculated, onShipmentUpdated, printLabelLayout, shipment, }: UseRatesFormProps) => {
|
|
25
25
|
carriers: SE.Carrier[] | undefined;
|
|
26
26
|
displayableRateErrors: string[] | undefined;
|
|
27
|
+
displayableSaveRateErrors: string[] | undefined;
|
|
27
28
|
errors: SE.CodedError[] | undefined;
|
|
28
29
|
isLoading: boolean;
|
|
29
30
|
labelErrors: string[] | undefined;
|
|
@@ -621,6 +621,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
621
621
|
};
|
|
622
622
|
unknown: string;
|
|
623
623
|
noRatesAvailable: string;
|
|
624
|
+
saveRateError: string;
|
|
624
625
|
};
|
|
625
626
|
errorTypes: {
|
|
626
627
|
accountStatus: string;
|
|
@@ -628,6 +629,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
628
629
|
integrations: string;
|
|
629
630
|
purchase: string;
|
|
630
631
|
rateInvalid: string;
|
|
632
|
+
saveRate: string;
|
|
631
633
|
security: string;
|
|
632
634
|
shipmentStatus: string;
|
|
633
635
|
system: string;
|
|
@@ -668,8 +670,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
668
670
|
december: string;
|
|
669
671
|
};
|
|
670
672
|
packageCategories: {
|
|
671
|
-
|
|
672
|
-
myCustomPackages: string;
|
|
673
|
+
customPackages: string;
|
|
673
674
|
};
|
|
674
675
|
packageCodes: {
|
|
675
676
|
package: string;
|
|
@@ -718,6 +718,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
718
718
|
};
|
|
719
719
|
unknown: string;
|
|
720
720
|
noRatesAvailable: string;
|
|
721
|
+
saveRateError: string;
|
|
721
722
|
};
|
|
722
723
|
errorTypes: {
|
|
723
724
|
accountStatus: string;
|
|
@@ -725,6 +726,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
725
726
|
integrations: string;
|
|
726
727
|
purchase: string;
|
|
727
728
|
rateInvalid: string;
|
|
729
|
+
saveRate: string;
|
|
728
730
|
security: string;
|
|
729
731
|
shipmentStatus: string;
|
|
730
732
|
system: string;
|
|
@@ -762,35 +764,10 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
762
764
|
september: string;
|
|
763
765
|
october: string;
|
|
764
766
|
november: string;
|
|
765
|
-
/**
|
|
766
|
-
* # Purchase Label Component
|
|
767
|
-
*
|
|
768
|
-
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
769
|
-
*
|
|
770
|
-
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
771
|
-
* based or sales order based label purchasing.
|
|
772
|
-
*
|
|
773
|
-
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
774
|
-
* with all the appropriate wrappers.
|
|
775
|
-
*
|
|
776
|
-
* @example
|
|
777
|
-
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
778
|
-
* ```tsx
|
|
779
|
-
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
780
|
-
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
781
|
-
* resources: { en },
|
|
782
|
-
* });
|
|
783
|
-
* ```
|
|
784
|
-
*
|
|
785
|
-
* <br />
|
|
786
|
-
*
|
|
787
|
-
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
788
|
-
*/
|
|
789
767
|
december: string;
|
|
790
768
|
};
|
|
791
769
|
packageCategories: {
|
|
792
|
-
|
|
793
|
-
myCustomPackages: string;
|
|
770
|
+
customPackages: string;
|
|
794
771
|
};
|
|
795
772
|
packageCodes: {
|
|
796
773
|
package: string;
|
|
@@ -641,6 +641,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
641
641
|
};
|
|
642
642
|
unknown: string;
|
|
643
643
|
noRatesAvailable: string;
|
|
644
|
+
saveRateError: string;
|
|
644
645
|
};
|
|
645
646
|
errorTypes: {
|
|
646
647
|
accountStatus: string;
|
|
@@ -648,6 +649,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
648
649
|
integrations: string;
|
|
649
650
|
purchase: string;
|
|
650
651
|
rateInvalid: string;
|
|
652
|
+
saveRate: string;
|
|
651
653
|
security: string;
|
|
652
654
|
shipmentStatus: string;
|
|
653
655
|
system: string;
|
|
@@ -688,8 +690,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
688
690
|
december: string;
|
|
689
691
|
};
|
|
690
692
|
packageCategories: {
|
|
691
|
-
|
|
692
|
-
myCustomPackages: string;
|
|
693
|
+
customPackages: string;
|
|
693
694
|
};
|
|
694
695
|
packageCodes: {
|
|
695
696
|
package: string;
|
|
@@ -637,6 +637,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
637
637
|
};
|
|
638
638
|
unknown: string;
|
|
639
639
|
noRatesAvailable: string;
|
|
640
|
+
saveRateError: string;
|
|
640
641
|
};
|
|
641
642
|
errorTypes: {
|
|
642
643
|
accountStatus: string;
|
|
@@ -644,6 +645,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
644
645
|
integrations: string;
|
|
645
646
|
purchase: string;
|
|
646
647
|
rateInvalid: string;
|
|
648
|
+
saveRate: string;
|
|
647
649
|
security: string;
|
|
648
650
|
shipmentStatus: string;
|
|
649
651
|
system: string;
|
|
@@ -684,8 +686,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
684
686
|
december: string;
|
|
685
687
|
};
|
|
686
688
|
packageCategories: {
|
|
687
|
-
|
|
688
|
-
myCustomPackages: string;
|
|
689
|
+
customPackages: string;
|
|
689
690
|
};
|
|
690
691
|
packageCodes: {
|
|
691
692
|
package: string;
|
|
@@ -509,6 +509,7 @@ declare const _default: {
|
|
|
509
509
|
};
|
|
510
510
|
unknown: string;
|
|
511
511
|
noRatesAvailable: string;
|
|
512
|
+
saveRateError: string;
|
|
512
513
|
};
|
|
513
514
|
errorTypes: {
|
|
514
515
|
accountStatus: string;
|
|
@@ -516,6 +517,7 @@ declare const _default: {
|
|
|
516
517
|
integrations: string;
|
|
517
518
|
purchase: string;
|
|
518
519
|
rateInvalid: string;
|
|
520
|
+
saveRate: string;
|
|
519
521
|
security: string;
|
|
520
522
|
shipmentStatus: string;
|
|
521
523
|
system: string;
|
|
@@ -556,8 +558,7 @@ declare const _default: {
|
|
|
556
558
|
december: string;
|
|
557
559
|
};
|
|
558
560
|
packageCategories: {
|
|
559
|
-
|
|
560
|
-
myCustomPackages: string;
|
|
561
|
+
customPackages: string;
|
|
561
562
|
};
|
|
562
563
|
packageCodes: {
|
|
563
564
|
package: string;
|