@shipengine/elements 0.24.0 → 0.25.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 +430 -103
- package/index.js +431 -104
- package/package.json +4 -3
- package/src/components/error-display/error-display.d.ts +1 -0
- package/src/components/error-display/error-display.styles.d.ts +19 -0
- package/src/components/error-display/index.d.ts +1 -0
- package/src/components/field/rate-card/rate-card.d.ts +1 -1
- package/src/components/history/history-card/history-card.styles.d.ts +12 -14
- package/src/components/history/history-card-extension/history-card-extension.d.ts +1 -0
- package/src/components/history/history-card-extension/history-card-extension.styles.d.ts +26 -0
- package/src/components/history/history-card-extension/index.d.ts +1 -0
- package/src/components/history/index.d.ts +1 -0
- package/src/components/label/label.d.ts +1 -1
- package/src/components/label/label.styles.d.ts +5 -1
- package/src/components/link-action/link-action.d.ts +3 -1
- package/src/components/templates/rate-form/rate-form.d.ts +3 -1
- package/src/components/unit-settings/unit-settings.d.ts +1 -4
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -0
- package/src/elements/list-carriers/list-carriers.d.ts +3 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +3 -0
- package/src/elements/onboarding/onboarding.d.ts +3 -0
- package/src/elements/purchase-label/purchase-label.d.ts +3 -0
- package/src/elements/view-shipment/view-shipment.d.ts +3 -0
- package/src/elements/void-label/void-label.d.ts +3 -0
- package/src/factories/shipengine/wallet-history.d.ts +52 -0
- package/src/features/wallet-history/wallet-history.styles.d.ts +4 -0
- package/src/locales/en/index.d.ts +3 -0
- package/src/mocks/account-settings/handlers.d.ts +8 -0
- package/src/mocks/account-settings/index.d.ts +1 -0
- package/src/mocks/index.d.ts +1 -0
- package/src/utilities/rates.d.ts +1 -1
- package/vite.config.d.ts +2 -0
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useController, get as get$1, set as set$2, useWatch, useFormState, useF
|
|
|
3
3
|
import { useTranslation, Trans } from 'react-i18next';
|
|
4
4
|
import { Typography, FormField, FieldMessageType, Checkbox, Input, Icon, Divider, Link, SelectAutocomplete, Select as Select$1, OptionGroup, Option, Button, Switch as Switch$1, Textarea, ButtonVariant, InlineNotification, NotificationType, ButtonColor, Grid, GridChild, Tag, TagColor, ButtonSize, Spinner, IconSize, Skeleton, SkeletonAnimation, SkeletonVariant, SkeletonBackgroundColor, RadioGroup, Radio, Stepper, Step, SpinnerSize, ChipList, Chip, Table, TableBody, TableBaseRow, TableBodyCell, TableHeader, TableHeaderCell, Popover, DropdownOptionList, BottomSheet, DatePicker as DatePicker$1 } from '@packlink/giger';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import alchemy, { logger, SE, useValidateAddresses, useAddFunds, useGetCarrierById, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment,
|
|
6
|
+
import alchemy, { logger, SE, useValidateAddresses, useAddFunds, useGetCarrierById, useGetAccountSettings, useUpdateAccountSettings, useUpdateAutoFunding, useGetAutoFundingConfiguration, Currency, useListCarriers, useConnectCarrier, useListWarehouses, useUpdateWarehouse, useCreateWarehouse, useDeleteWarehouse, useUpdateSalesOrderShipment, useParseAddress, useListCustomPackageTypes, useCalculateRates, useGetShipmentRates, useListLabels, useCreateLabel, useListSalesOrderShipments, useCreateSalesOrderShipment, useListSalesOrders, useGetSalesOrder, useListOrderSources, useRefreshOrderSource, useGetShipment, useGetSalesOrderShipment, useGetLabel, useVoidLabel } from '@shipengine/alchemy';
|
|
7
7
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import * as React from 'react';
|
|
@@ -2563,10 +2563,15 @@ const formatExpiration = exp => {
|
|
|
2563
2563
|
|
|
2564
2564
|
const isString = x => typeof x === "string";
|
|
2565
2565
|
|
|
2566
|
-
const getRateRequiresAcknowledgement = serviceCode => {
|
|
2566
|
+
const getRateRequiresAcknowledgement = (serviceCode, packageType) => {
|
|
2567
2567
|
switch (serviceCode) {
|
|
2568
2568
|
case "usps_media_mail":
|
|
2569
2569
|
return true;
|
|
2570
|
+
case "usps_first_class_mail":
|
|
2571
|
+
if (packageType === "large_envelope_or_flat") {
|
|
2572
|
+
return true;
|
|
2573
|
+
}
|
|
2574
|
+
return false;
|
|
2570
2575
|
default:
|
|
2571
2576
|
return false;
|
|
2572
2577
|
}
|
|
@@ -4619,7 +4624,7 @@ const getDeliveryDaysLabel = deliveryDays => {
|
|
|
4619
4624
|
}
|
|
4620
4625
|
return `${deliveryDays.toString()} ${deliveryDays === 1 ? "day" : "days"}`;
|
|
4621
4626
|
};
|
|
4622
|
-
const getAcknowledgementLabel = serviceCode => {
|
|
4627
|
+
const getAcknowledgementLabel = (serviceCode, packageType) => {
|
|
4623
4628
|
switch (serviceCode) {
|
|
4624
4629
|
case "usps_media_mail":
|
|
4625
4630
|
return jsxs(Trans, Object.assign({
|
|
@@ -4634,6 +4639,13 @@ const getAcknowledgementLabel = serviceCode => {
|
|
|
4634
4639
|
children: "USPS guidelines for Media Mail®"
|
|
4635
4640
|
}))]
|
|
4636
4641
|
}));
|
|
4642
|
+
case "usps_first_class_mail":
|
|
4643
|
+
if (packageType === "large_envelope_or_flat") {
|
|
4644
|
+
return jsx(Trans, {
|
|
4645
|
+
i18nKey: "purchase-label:rates.uspsFirstClassMailAcknowledgement_leof"
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
return;
|
|
4637
4649
|
default:
|
|
4638
4650
|
return null;
|
|
4639
4651
|
}
|
|
@@ -4656,6 +4668,7 @@ const RateCard = ({
|
|
|
4656
4668
|
requiresAcknowledgement,
|
|
4657
4669
|
selected: _selected = false,
|
|
4658
4670
|
serviceCode,
|
|
4671
|
+
packageType,
|
|
4659
4672
|
serviceType,
|
|
4660
4673
|
shippingAmount,
|
|
4661
4674
|
taxAmount,
|
|
@@ -4728,7 +4741,11 @@ const RateCard = ({
|
|
|
4728
4741
|
css: getFooterListItemStyles,
|
|
4729
4742
|
variant: "body2"
|
|
4730
4743
|
}, {
|
|
4731
|
-
children: msg
|
|
4744
|
+
children: packageType === "large_envelope_or_flat" ? t(msg, {
|
|
4745
|
+
weight: 13
|
|
4746
|
+
}) : t(msg, {
|
|
4747
|
+
weight: 16
|
|
4748
|
+
})
|
|
4732
4749
|
}), index + msg.length))
|
|
4733
4750
|
})), requiresAcknowledgement && onClickAcknowledgement && jsx("div", Object.assign({
|
|
4734
4751
|
css: getCheckboxWrapperStyles
|
|
@@ -4736,7 +4753,7 @@ const RateCard = ({
|
|
|
4736
4753
|
children: jsx(Checkbox, {
|
|
4737
4754
|
checked: isAcknowledged,
|
|
4738
4755
|
css: getAcknowledgmentStyles,
|
|
4739
|
-
label: getAcknowledgementLabel(serviceCode),
|
|
4756
|
+
label: getAcknowledgementLabel(serviceCode, packageType),
|
|
4740
4757
|
onChange: e => onClickAcknowledgement(e.target.checked)
|
|
4741
4758
|
})
|
|
4742
4759
|
}))]
|
|
@@ -5245,7 +5262,7 @@ const useRateOptions = (rates, carriers, shipment, enableGlobalPostFiltering) =>
|
|
|
5245
5262
|
return Object.assign(Object.assign({}, r), {
|
|
5246
5263
|
balance,
|
|
5247
5264
|
messages: r.warningMessages,
|
|
5248
|
-
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode),
|
|
5265
|
+
requiresAcknowledgement: getRateRequiresAcknowledgement(r.serviceCode, r.packageType),
|
|
5249
5266
|
requiresFundedAmount
|
|
5250
5267
|
});
|
|
5251
5268
|
});
|
|
@@ -5909,7 +5926,7 @@ const AddressParser = ({
|
|
|
5909
5926
|
}));
|
|
5910
5927
|
};
|
|
5911
5928
|
|
|
5912
|
-
const styles$
|
|
5929
|
+
const styles$m = createStyles({
|
|
5913
5930
|
grow: {
|
|
5914
5931
|
flexGrow: 1
|
|
5915
5932
|
},
|
|
@@ -6009,13 +6026,13 @@ const AddressFields = ({
|
|
|
6009
6026
|
},
|
|
6010
6027
|
options: countryCodeOptions
|
|
6011
6028
|
}), jsxs("div", Object.assign({
|
|
6012
|
-
css: styles$
|
|
6029
|
+
css: styles$m.stateZipWrapper
|
|
6013
6030
|
}, {
|
|
6014
6031
|
children: [jsx("div", Object.assign({
|
|
6015
|
-
css: styles$
|
|
6032
|
+
css: styles$m.stateWrapper
|
|
6016
6033
|
}, {
|
|
6017
6034
|
children: jsx("div", Object.assign({
|
|
6018
|
-
css: styles$
|
|
6035
|
+
css: styles$m.grow
|
|
6019
6036
|
}, {
|
|
6020
6037
|
children: watchCountryCode === "US" ?
|
|
6021
6038
|
// Domestic States
|
|
@@ -6040,10 +6057,10 @@ const AddressFields = ({
|
|
|
6040
6057
|
})
|
|
6041
6058
|
}))
|
|
6042
6059
|
})), jsx("div", Object.assign({
|
|
6043
|
-
css: styles$
|
|
6060
|
+
css: styles$m.zipWrapper
|
|
6044
6061
|
}, {
|
|
6045
6062
|
children: jsx("div", Object.assign({
|
|
6046
|
-
css: styles$
|
|
6063
|
+
css: styles$m.grow
|
|
6047
6064
|
}, {
|
|
6048
6065
|
children: jsx(TextInput, {
|
|
6049
6066
|
control: form.control,
|
|
@@ -6281,7 +6298,7 @@ const AddressForm = ({
|
|
|
6281
6298
|
}));
|
|
6282
6299
|
};
|
|
6283
6300
|
|
|
6284
|
-
const styles$
|
|
6301
|
+
const styles$l = createStyles({
|
|
6285
6302
|
agreement: {
|
|
6286
6303
|
alignItems: "center",
|
|
6287
6304
|
display: "flex",
|
|
@@ -6351,10 +6368,10 @@ const DisplayCarrierTerms = c => {
|
|
|
6351
6368
|
const listCarrierLinks = () => {
|
|
6352
6369
|
return c.carrierTerms.links.map((term, index) => {
|
|
6353
6370
|
return jsx("li", Object.assign({
|
|
6354
|
-
css: styles$
|
|
6371
|
+
css: styles$l.listItems
|
|
6355
6372
|
}, {
|
|
6356
6373
|
children: jsx(Link, Object.assign({
|
|
6357
|
-
css: styles$
|
|
6374
|
+
css: styles$l.link,
|
|
6358
6375
|
href: term.url,
|
|
6359
6376
|
isExternal: true,
|
|
6360
6377
|
target: "_blank"
|
|
@@ -6370,18 +6387,18 @@ const DisplayCarrierTerms = c => {
|
|
|
6370
6387
|
};
|
|
6371
6388
|
const listCarrierTerms = () => {
|
|
6372
6389
|
return jsxs("div", Object.assign({
|
|
6373
|
-
css: styles$
|
|
6390
|
+
css: styles$l.terms
|
|
6374
6391
|
}, {
|
|
6375
6392
|
children: [jsx(Typography, Object.assign({
|
|
6376
6393
|
variant: "subtitle1"
|
|
6377
6394
|
}, {
|
|
6378
6395
|
children: c.carrierTerms.title
|
|
6379
6396
|
})), jsx("div", Object.assign({
|
|
6380
|
-
css: styles$
|
|
6397
|
+
css: styles$l.terms
|
|
6381
6398
|
}, {
|
|
6382
6399
|
children: listCarrierContent()
|
|
6383
6400
|
})), jsx("ul", Object.assign({
|
|
6384
|
-
css: styles$
|
|
6401
|
+
css: styles$l.links
|
|
6385
6402
|
}, {
|
|
6386
6403
|
children: listCarrierLinks()
|
|
6387
6404
|
}))]
|
|
@@ -6611,7 +6628,7 @@ const AddressDisplay = ({
|
|
|
6611
6628
|
}));
|
|
6612
6629
|
};
|
|
6613
6630
|
|
|
6614
|
-
const styles$
|
|
6631
|
+
const styles$k = createStyles({
|
|
6615
6632
|
container: theme => ({
|
|
6616
6633
|
display: "flex",
|
|
6617
6634
|
gap: theme.spacing()
|
|
@@ -6649,13 +6666,13 @@ const Disclosure = ({
|
|
|
6649
6666
|
}, [open]);
|
|
6650
6667
|
return jsxs(Fragment, {
|
|
6651
6668
|
children: [jsxs("div", Object.assign({
|
|
6652
|
-
css: styles$
|
|
6669
|
+
css: styles$k.container
|
|
6653
6670
|
}, {
|
|
6654
6671
|
children: [jsx("div", {
|
|
6655
6672
|
children: label
|
|
6656
6673
|
}), _showToggle && jsx("button", Object.assign({
|
|
6657
6674
|
"aria-expanded": isOpen,
|
|
6658
|
-
css: styles$
|
|
6675
|
+
css: styles$k.toggle,
|
|
6659
6676
|
onClick: () => {
|
|
6660
6677
|
setIsOpen(!isOpen);
|
|
6661
6678
|
onToggle(!isOpen);
|
|
@@ -6663,12 +6680,12 @@ const Disclosure = ({
|
|
|
6663
6680
|
type: "button"
|
|
6664
6681
|
}, {
|
|
6665
6682
|
children: jsx(Icon, {
|
|
6666
|
-
css: styles$
|
|
6683
|
+
css: styles$k.icon,
|
|
6667
6684
|
name: isOpen ? IconNames.CHEVRON_TOP : IconNames.CHEVRON_BOTTOM
|
|
6668
6685
|
})
|
|
6669
6686
|
}))]
|
|
6670
6687
|
})), isOpen && jsx("div", Object.assign({
|
|
6671
|
-
css: styles$
|
|
6688
|
+
css: styles$k.content
|
|
6672
6689
|
}, {
|
|
6673
6690
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
6674
6691
|
}))]
|
|
@@ -6818,7 +6835,7 @@ const getCarrierRecoverySchema = requiresAddress => z.object({
|
|
|
6818
6835
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
6819
6836
|
});
|
|
6820
6837
|
|
|
6821
|
-
const styles$
|
|
6838
|
+
const styles$j = createStyles({
|
|
6822
6839
|
grid: theme => ({
|
|
6823
6840
|
margin: theme.spacing(4)
|
|
6824
6841
|
}),
|
|
@@ -6861,7 +6878,7 @@ const CarrierRecoveryForm = ({
|
|
|
6861
6878
|
onSubmit: formLogger.capture(handleSubmit)
|
|
6862
6879
|
}, {
|
|
6863
6880
|
children: jsxs(Grid, Object.assign({
|
|
6864
|
-
css: styles$
|
|
6881
|
+
css: styles$j.grid,
|
|
6865
6882
|
noPadding: true
|
|
6866
6883
|
}, {
|
|
6867
6884
|
children: [requiresAddress && jsxs(Fragment, {
|
|
@@ -6869,14 +6886,14 @@ const CarrierRecoveryForm = ({
|
|
|
6869
6886
|
colSpan: 12
|
|
6870
6887
|
}, {
|
|
6871
6888
|
children: jsx(Typography, Object.assign({
|
|
6872
|
-
css: styles$
|
|
6889
|
+
css: styles$j.heading,
|
|
6873
6890
|
variant: "heading4"
|
|
6874
6891
|
}, {
|
|
6875
6892
|
children: t("register-wallet:sections.carriers.title")
|
|
6876
6893
|
}))
|
|
6877
6894
|
})), jsx(GridChild, Object.assign({
|
|
6878
6895
|
colSpan: 12,
|
|
6879
|
-
css: styles$
|
|
6896
|
+
css: styles$j.subtitle
|
|
6880
6897
|
}, {
|
|
6881
6898
|
children: jsx(Typography, Object.assign({
|
|
6882
6899
|
variant: "subtitle1"
|
|
@@ -6962,7 +6979,7 @@ const CarrierTermsForm = ({
|
|
|
6962
6979
|
onSubmit(payload.agreement);
|
|
6963
6980
|
}));
|
|
6964
6981
|
return jsxs("div", Object.assign({
|
|
6965
|
-
css: styles$
|
|
6982
|
+
css: styles$l.termsForm,
|
|
6966
6983
|
"data-testid": "carrier-terms-form"
|
|
6967
6984
|
}, {
|
|
6968
6985
|
children: [jsx(Typography, Object.assign({
|
|
@@ -6978,7 +6995,7 @@ const CarrierTermsForm = ({
|
|
|
6978
6995
|
})), jsx(Spacer, {
|
|
6979
6996
|
multiplier: 1
|
|
6980
6997
|
}), jsx("div", Object.assign({
|
|
6981
|
-
css: styles$
|
|
6998
|
+
css: styles$l.carrierLogos
|
|
6982
6999
|
}, {
|
|
6983
7000
|
children: metadatas.map(({
|
|
6984
7001
|
name,
|
|
@@ -6994,7 +7011,7 @@ const CarrierTermsForm = ({
|
|
|
6994
7011
|
onSubmit: formLogger.capture(handleSubmit)
|
|
6995
7012
|
}, {
|
|
6996
7013
|
children: jsxs("div", Object.assign({
|
|
6997
|
-
css: styles$
|
|
7014
|
+
css: styles$l.agreement
|
|
6998
7015
|
}, {
|
|
6999
7016
|
children: [jsx("div", {
|
|
7000
7017
|
children: jsx(CheckboxInput, {
|
|
@@ -7021,12 +7038,12 @@ const CarrierTermsForm = ({
|
|
|
7021
7038
|
name: "agreement"
|
|
7022
7039
|
})
|
|
7023
7040
|
}), showTerms && jsxs("div", Object.assign({
|
|
7024
|
-
css: styles$
|
|
7041
|
+
css: styles$l.well
|
|
7025
7042
|
}, {
|
|
7026
7043
|
children: [terms.map(t => jsx(DisplayCarrierTerms, {
|
|
7027
7044
|
carrierTerms: t
|
|
7028
7045
|
}, t.title)), jsx("div", Object.assign({
|
|
7029
|
-
css: styles$
|
|
7046
|
+
css: styles$l.close
|
|
7030
7047
|
}, {
|
|
7031
7048
|
children: jsx(Button, Object.assign({
|
|
7032
7049
|
onClick: () => setShowTerms(false),
|
|
@@ -7279,7 +7296,8 @@ const icons = {
|
|
|
7279
7296
|
add: IconNames.ADD,
|
|
7280
7297
|
checkFilled: IconNames.CHECK_FILLED,
|
|
7281
7298
|
copy: IconNames.COPY,
|
|
7282
|
-
download: IconNames.DOWNLOAD
|
|
7299
|
+
download: IconNames.DOWNLOAD,
|
|
7300
|
+
retry: IconNames.CIRCULAR_ARROW
|
|
7283
7301
|
};
|
|
7284
7302
|
const LinkAction = _a => {
|
|
7285
7303
|
var {
|
|
@@ -7287,11 +7305,12 @@ const LinkAction = _a => {
|
|
|
7287
7305
|
icon,
|
|
7288
7306
|
isDisabled,
|
|
7289
7307
|
isLoading,
|
|
7290
|
-
title
|
|
7308
|
+
title,
|
|
7309
|
+
isBold = true
|
|
7291
7310
|
} = _a,
|
|
7292
|
-
props = __rest(_a, ["css", "icon", "isDisabled", "isLoading", "title"]);
|
|
7311
|
+
props = __rest(_a, ["css", "icon", "isDisabled", "isLoading", "title", "isBold"]);
|
|
7293
7312
|
return jsx(Link, Object.assign({}, props, {
|
|
7294
|
-
bold:
|
|
7313
|
+
bold: isBold,
|
|
7295
7314
|
css: theme => [Object.assign(Object.assign({
|
|
7296
7315
|
"&&&": {
|
|
7297
7316
|
textDecoration: "none"
|
|
@@ -7345,7 +7364,7 @@ const CopyButton = ({
|
|
|
7345
7364
|
}));
|
|
7346
7365
|
};
|
|
7347
7366
|
|
|
7348
|
-
const styles$
|
|
7367
|
+
const styles$i = createStyles({
|
|
7349
7368
|
trackingNumber: theme => ({
|
|
7350
7369
|
alignItems: "center",
|
|
7351
7370
|
display: "flex"
|
|
@@ -7391,10 +7410,10 @@ const Label = ({
|
|
|
7391
7410
|
shippingAmount: label.shipmentCost
|
|
7392
7411
|
}, {
|
|
7393
7412
|
children: label.trackingNumber && jsxs("div", Object.assign({
|
|
7394
|
-
css: styles$
|
|
7413
|
+
css: styles$i.trackingNumber
|
|
7395
7414
|
}, {
|
|
7396
7415
|
children: [jsx("div", Object.assign({
|
|
7397
|
-
css: styles$
|
|
7416
|
+
css: styles$i.truncatedTrackingNumber
|
|
7398
7417
|
}, {
|
|
7399
7418
|
children: label.trackingNumber.toString()
|
|
7400
7419
|
})), jsx(CopyButton, {
|
|
@@ -7506,7 +7525,7 @@ const LandingPageForm = ({
|
|
|
7506
7525
|
}));
|
|
7507
7526
|
};
|
|
7508
7527
|
|
|
7509
|
-
const styles$
|
|
7528
|
+
const styles$h = createStyles({
|
|
7510
7529
|
container: theme => ({
|
|
7511
7530
|
padding: theme.spacing(2)
|
|
7512
7531
|
}),
|
|
@@ -7528,11 +7547,11 @@ const LandingPage = ({
|
|
|
7528
7547
|
t
|
|
7529
7548
|
} = useTranslation();
|
|
7530
7549
|
return jsxs("div", Object.assign({
|
|
7531
|
-
css: styles$
|
|
7550
|
+
css: styles$h.container,
|
|
7532
7551
|
"data-testid": "landing-page"
|
|
7533
7552
|
}, {
|
|
7534
7553
|
children: [jsxs("div", Object.assign({
|
|
7535
|
-
css: styles$
|
|
7554
|
+
css: styles$h.header
|
|
7536
7555
|
}, {
|
|
7537
7556
|
children: [jsx(Typography, Object.assign({
|
|
7538
7557
|
variant: "heading4"
|
|
@@ -7550,7 +7569,7 @@ const LandingPage = ({
|
|
|
7550
7569
|
})), jsx(LandingPageForm, {
|
|
7551
7570
|
onSubmit: onSubmit
|
|
7552
7571
|
}), jsxs("div", Object.assign({
|
|
7553
|
-
css: styles$
|
|
7572
|
+
css: styles$h.header
|
|
7554
7573
|
}, {
|
|
7555
7574
|
children: [jsx(Spacer, {
|
|
7556
7575
|
multiplier: 6
|
|
@@ -7561,14 +7580,14 @@ const LandingPage = ({
|
|
|
7561
7580
|
})), jsx(Spacer, {
|
|
7562
7581
|
multiplier: 2
|
|
7563
7582
|
}), jsx(Typography, Object.assign({
|
|
7564
|
-
css: styles$
|
|
7583
|
+
css: styles$h.description,
|
|
7565
7584
|
variant: "body1"
|
|
7566
7585
|
}, {
|
|
7567
7586
|
children: t("onboarding:landing.messageLine1")
|
|
7568
7587
|
})), jsx(Spacer, {
|
|
7569
7588
|
multiplier: 2
|
|
7570
7589
|
}), jsx(Typography, Object.assign({
|
|
7571
|
-
css: styles$
|
|
7590
|
+
css: styles$h.description,
|
|
7572
7591
|
variant: "body1"
|
|
7573
7592
|
}, {
|
|
7574
7593
|
children: t("onboarding:landing.messageLine2")
|
|
@@ -7579,7 +7598,7 @@ const LandingPage = ({
|
|
|
7579
7598
|
}));
|
|
7580
7599
|
};
|
|
7581
7600
|
|
|
7582
|
-
const styles$
|
|
7601
|
+
const styles$g = createStyles({
|
|
7583
7602
|
icon: theme => ({
|
|
7584
7603
|
color: theme.palette.primary.main,
|
|
7585
7604
|
marginRight: theme.spacing(2)
|
|
@@ -7624,10 +7643,10 @@ const Section = _a => {
|
|
|
7624
7643
|
rest = __rest(_a, ["bold", "title", "children", "rightContent"]);
|
|
7625
7644
|
return jsxs(Fragment, {
|
|
7626
7645
|
children: [title && jsx("summary", Object.assign({
|
|
7627
|
-
css: styles$
|
|
7646
|
+
css: styles$g.summary
|
|
7628
7647
|
}, {
|
|
7629
7648
|
children: jsxs("div", Object.assign({
|
|
7630
|
-
css: styles$
|
|
7649
|
+
css: styles$g.summaryWrapper
|
|
7631
7650
|
}, {
|
|
7632
7651
|
children: [jsx(Typography, Object.assign({
|
|
7633
7652
|
bold: bold,
|
|
@@ -7635,20 +7654,20 @@ const Section = _a => {
|
|
|
7635
7654
|
}, {
|
|
7636
7655
|
children: title
|
|
7637
7656
|
})), rightContent && jsx("div", Object.assign({
|
|
7638
|
-
css: styles$
|
|
7657
|
+
css: styles$g.rightContentWrapper
|
|
7639
7658
|
}, {
|
|
7640
7659
|
children: rightContent
|
|
7641
7660
|
}))]
|
|
7642
7661
|
}))
|
|
7643
7662
|
})), jsx("section", Object.assign({
|
|
7644
|
-
css: styles$
|
|
7663
|
+
css: styles$g.section
|
|
7645
7664
|
}, rest, {
|
|
7646
7665
|
children: children
|
|
7647
7666
|
}))]
|
|
7648
7667
|
});
|
|
7649
7668
|
};
|
|
7650
7669
|
|
|
7651
|
-
const styles$
|
|
7670
|
+
const styles$f = createStyles({
|
|
7652
7671
|
container: {
|
|
7653
7672
|
display: "flex",
|
|
7654
7673
|
flexDirection: "column"
|
|
@@ -7708,14 +7727,14 @@ const ListCarriersRow = ({
|
|
|
7708
7727
|
setIsSubmitting(false);
|
|
7709
7728
|
});
|
|
7710
7729
|
return jsxs("div", Object.assign({
|
|
7711
|
-
css: styles$
|
|
7730
|
+
css: styles$f.container,
|
|
7712
7731
|
"data-testid": "carrier-row"
|
|
7713
7732
|
}, {
|
|
7714
7733
|
children: [jsxs("div", Object.assign({
|
|
7715
|
-
css: styles$
|
|
7734
|
+
css: styles$f.rowContainer
|
|
7716
7735
|
}, {
|
|
7717
7736
|
children: [jsxs("div", Object.assign({
|
|
7718
|
-
css: styles$
|
|
7737
|
+
css: styles$f.logoContainer
|
|
7719
7738
|
}, {
|
|
7720
7739
|
children: [jsx("div", {
|
|
7721
7740
|
children: jsx("img", {
|
|
@@ -7733,7 +7752,7 @@ const ListCarriersRow = ({
|
|
|
7733
7752
|
css: _ref
|
|
7734
7753
|
}, {
|
|
7735
7754
|
children: jsx(LinkAction, {
|
|
7736
|
-
css: styles$
|
|
7755
|
+
css: styles$f.getConnectButton(isConnected),
|
|
7737
7756
|
isDisabled: isConnected || showDropDown,
|
|
7738
7757
|
isLoading: isSubmitting,
|
|
7739
7758
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -7751,7 +7770,7 @@ const ListCarriersRow = ({
|
|
|
7751
7770
|
}));
|
|
7752
7771
|
};
|
|
7753
7772
|
|
|
7754
|
-
const styles$
|
|
7773
|
+
const styles$e = createStyles({
|
|
7755
7774
|
carriersList: theme => ({
|
|
7756
7775
|
"& > li:not(:last-of-type)": {
|
|
7757
7776
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -7804,7 +7823,7 @@ const ListCarriers = ({
|
|
|
7804
7823
|
}))
|
|
7805
7824
|
})), jsx(Spacer, {})]
|
|
7806
7825
|
}), jsx("ul", Object.assign({
|
|
7807
|
-
css: styles$
|
|
7826
|
+
css: styles$e.carriersList,
|
|
7808
7827
|
"data-testid": "carriers-list"
|
|
7809
7828
|
}, {
|
|
7810
7829
|
children: isLoading ? jsxs(Fragment, {
|
|
@@ -7826,11 +7845,11 @@ const ListCarriers = ({
|
|
|
7826
7845
|
};
|
|
7827
7846
|
const LoadingSkeletonRow = () => {
|
|
7828
7847
|
return jsxs("div", Object.assign({
|
|
7829
|
-
css: styles$
|
|
7848
|
+
css: styles$e.skeletonRow,
|
|
7830
7849
|
"data-testid": "skeleton-carrier-row"
|
|
7831
7850
|
}, {
|
|
7832
7851
|
children: [jsxs("div", Object.assign({
|
|
7833
|
-
css: styles$
|
|
7852
|
+
css: styles$e.skeletonLogoContainer
|
|
7834
7853
|
}, {
|
|
7835
7854
|
children: [jsx(Skeleton, {
|
|
7836
7855
|
animation: SkeletonAnimation.WAVE,
|
|
@@ -8137,7 +8156,7 @@ const useAddressPreference = () => {
|
|
|
8137
8156
|
return context;
|
|
8138
8157
|
};
|
|
8139
8158
|
|
|
8140
|
-
const styles$
|
|
8159
|
+
const styles$d = createStyles({
|
|
8141
8160
|
body: theme => ({
|
|
8142
8161
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
8143
8162
|
color: theme.palette.black,
|
|
@@ -8188,14 +8207,14 @@ const SettingsCard = ({
|
|
|
8188
8207
|
verticallyAligned
|
|
8189
8208
|
}) => {
|
|
8190
8209
|
return jsxs("div", Object.assign({
|
|
8191
|
-
css: verticallyAligned ? styles$
|
|
8210
|
+
css: verticallyAligned ? styles$d.verticalContainer : styles$d.container,
|
|
8192
8211
|
"data-testid": "settingsCard"
|
|
8193
8212
|
}, {
|
|
8194
8213
|
children: [jsxs("div", Object.assign({
|
|
8195
|
-
css: styles$
|
|
8214
|
+
css: styles$d.header
|
|
8196
8215
|
}, {
|
|
8197
8216
|
children: [jsxs("div", Object.assign({
|
|
8198
|
-
css: styles$
|
|
8217
|
+
css: styles$d.title
|
|
8199
8218
|
}, {
|
|
8200
8219
|
children: [typeof title === "string" ? jsx(Typography, Object.assign({
|
|
8201
8220
|
variant: "subtitle2"
|
|
@@ -8230,7 +8249,7 @@ const SettingsCard = ({
|
|
|
8230
8249
|
}))
|
|
8231
8250
|
}))]
|
|
8232
8251
|
})), children && jsx("div", Object.assign({
|
|
8233
|
-
css: styles$
|
|
8252
|
+
css: styles$d.body
|
|
8234
8253
|
}, {
|
|
8235
8254
|
children: jsxs("div", {
|
|
8236
8255
|
children: [children, accessoryAction && jsx(ButtonGroup, Object.assign({
|
|
@@ -8486,7 +8505,7 @@ const WarehouseForm = ({
|
|
|
8486
8505
|
}));
|
|
8487
8506
|
};
|
|
8488
8507
|
|
|
8489
|
-
const styles$
|
|
8508
|
+
const styles$c = createStyles({
|
|
8490
8509
|
cardSpacing: theme => ({
|
|
8491
8510
|
display: "flex",
|
|
8492
8511
|
flexDirection: "column",
|
|
@@ -8516,9 +8535,9 @@ const ManageWarehouses = ({
|
|
|
8516
8535
|
const [showAddNewWarehouseForm, toggleShowAddNewWarehouseForm] = useToggle(false);
|
|
8517
8536
|
return jsxs(Fragment, {
|
|
8518
8537
|
children: [showAddNewWarehouseForm ? jsx(AddressPreferenceProvider, Object.assign({
|
|
8519
|
-
css: styles$
|
|
8538
|
+
css: styles$c.well,
|
|
8520
8539
|
formHeader: jsxs("div", Object.assign({
|
|
8521
|
-
css: styles$
|
|
8540
|
+
css: styles$c.header
|
|
8522
8541
|
}, {
|
|
8523
8542
|
children: [jsx(Typography, Object.assign({
|
|
8524
8543
|
variant: "subtitle1"
|
|
@@ -8563,14 +8582,14 @@ const ManageWarehouses = ({
|
|
|
8563
8582
|
})]
|
|
8564
8583
|
}))
|
|
8565
8584
|
})), jsx("div", Object.assign({
|
|
8566
|
-
css: styles$
|
|
8585
|
+
css: styles$c.cardSpacing
|
|
8567
8586
|
}, {
|
|
8568
8587
|
children: warehouses.map(warehouse => {
|
|
8569
8588
|
if (editWarehouseId && editWarehouseId === warehouse.warehouseId) {
|
|
8570
8589
|
return jsx(AddressPreferenceProvider, Object.assign({
|
|
8571
|
-
css: styles$
|
|
8590
|
+
css: styles$c.well,
|
|
8572
8591
|
formHeader: jsxs("div", Object.assign({
|
|
8573
|
-
css: styles$
|
|
8592
|
+
css: styles$c.header
|
|
8574
8593
|
}, {
|
|
8575
8594
|
children: [jsx(Typography, Object.assign({
|
|
8576
8595
|
variant: "subtitle1"
|
|
@@ -9748,7 +9767,7 @@ const EditWalletAddressForm = ({
|
|
|
9748
9767
|
}));
|
|
9749
9768
|
};
|
|
9750
9769
|
|
|
9751
|
-
const styles$
|
|
9770
|
+
const styles$b = createStyles({
|
|
9752
9771
|
grid: theme => ({
|
|
9753
9772
|
margin: theme.spacing(4)
|
|
9754
9773
|
})
|
|
@@ -9810,7 +9829,7 @@ const WalletForm = ({
|
|
|
9810
9829
|
onSubmit: formLogger.capture(handleSubmit)
|
|
9811
9830
|
}, {
|
|
9812
9831
|
children: jsxs(Grid, Object.assign({
|
|
9813
|
-
css: styles$
|
|
9832
|
+
css: styles$b.grid,
|
|
9814
9833
|
noPadding: true
|
|
9815
9834
|
}, {
|
|
9816
9835
|
children: [jsx(GridChild, Object.assign({
|
|
@@ -9892,7 +9911,7 @@ const WalletForm = ({
|
|
|
9892
9911
|
}));
|
|
9893
9912
|
};
|
|
9894
9913
|
|
|
9895
|
-
const styles$
|
|
9914
|
+
const styles$a = createStyles({
|
|
9896
9915
|
container: theme => ({
|
|
9897
9916
|
padding: theme.spacing(2)
|
|
9898
9917
|
}),
|
|
@@ -10068,10 +10087,10 @@ const Onboarding = ({
|
|
|
10068
10087
|
const defaultWarehouse = (_a = warehouses.find(w => w.isDefault)) !== null && _a !== void 0 ? _a : warehouses[0];
|
|
10069
10088
|
return jsx(AddressPreferenceProvider, Object.assign({
|
|
10070
10089
|
formHeader: jsxs("div", Object.assign({
|
|
10071
|
-
css: styles$
|
|
10090
|
+
css: styles$a.walletFormHeader
|
|
10072
10091
|
}, {
|
|
10073
10092
|
children: [jsxs("div", Object.assign({
|
|
10074
|
-
css: styles$
|
|
10093
|
+
css: styles$a.walletFormTitle
|
|
10075
10094
|
}, {
|
|
10076
10095
|
children: [jsx(Typography, Object.assign({
|
|
10077
10096
|
variant: "heading4"
|
|
@@ -10148,22 +10167,22 @@ const Onboarding = ({
|
|
|
10148
10167
|
});
|
|
10149
10168
|
};
|
|
10150
10169
|
return jsxs("div", Object.assign({
|
|
10151
|
-
css: styles$
|
|
10170
|
+
css: styles$a.container
|
|
10152
10171
|
}, {
|
|
10153
10172
|
children: [jsxs(Stepper, Object.assign({
|
|
10154
10173
|
currentStep: currentStep
|
|
10155
10174
|
}, {
|
|
10156
10175
|
children: [jsx(Step, {
|
|
10157
|
-
css: styles$
|
|
10176
|
+
css: styles$a.step,
|
|
10158
10177
|
label: t("onboarding:steps.login")
|
|
10159
10178
|
}), jsx(Step, {
|
|
10160
|
-
css: styles$
|
|
10179
|
+
css: styles$a.step,
|
|
10161
10180
|
label: t("onboarding:steps.carriers")
|
|
10162
10181
|
}), jsx(Step, {
|
|
10163
|
-
css: styles$
|
|
10182
|
+
css: styles$a.step,
|
|
10164
10183
|
label: t("onboarding:steps.addresses")
|
|
10165
10184
|
}), jsx(Step, {
|
|
10166
|
-
css: styles$
|
|
10185
|
+
css: styles$a.step,
|
|
10167
10186
|
label: t("onboarding:steps.payment")
|
|
10168
10187
|
})]
|
|
10169
10188
|
})), renderStep()]
|
|
@@ -10297,7 +10316,7 @@ const Loader = props => {
|
|
|
10297
10316
|
}));
|
|
10298
10317
|
};
|
|
10299
10318
|
|
|
10300
|
-
const styles$
|
|
10319
|
+
const styles$9 = createStyles({
|
|
10301
10320
|
chipList: theme => ({
|
|
10302
10321
|
gap: theme.spacing(1)
|
|
10303
10322
|
}),
|
|
@@ -10408,7 +10427,7 @@ const AddFundsForm = ({
|
|
|
10408
10427
|
})), jsx(Spacer, {
|
|
10409
10428
|
multiplier: 2
|
|
10410
10429
|
}), jsx(ChipList, Object.assign({
|
|
10411
|
-
css: styles$
|
|
10430
|
+
css: styles$9.chipList,
|
|
10412
10431
|
onChange: idx => {
|
|
10413
10432
|
const chip = chips[idx];
|
|
10414
10433
|
setSelectedChip(chip);
|
|
@@ -10423,7 +10442,7 @@ const AddFundsForm = ({
|
|
|
10423
10442
|
}
|
|
10424
10443
|
}, {
|
|
10425
10444
|
children: chips.map(chip => jsx(Chip, Object.assign({
|
|
10426
|
-
css: styles$
|
|
10445
|
+
css: styles$9.getChip({
|
|
10427
10446
|
isDisabled: chip.value < _minimumAmount,
|
|
10428
10447
|
isSelected: chip.value === selectedChip.value
|
|
10429
10448
|
}),
|
|
@@ -10440,7 +10459,7 @@ const AddFundsForm = ({
|
|
|
10440
10459
|
multiplier: 1
|
|
10441
10460
|
}), jsx(MoneyInput, {
|
|
10442
10461
|
control: form.control,
|
|
10443
|
-
css: styles$
|
|
10462
|
+
css: styles$9.fundsInput,
|
|
10444
10463
|
defaultValue: {
|
|
10445
10464
|
amount: undefined,
|
|
10446
10465
|
currency: SE.Currency.USD
|
|
@@ -10493,7 +10512,7 @@ const AddFundsForm = ({
|
|
|
10493
10512
|
});
|
|
10494
10513
|
};
|
|
10495
10514
|
|
|
10496
|
-
const styles$
|
|
10515
|
+
const styles$8 = isLabelRight => createStyles({
|
|
10497
10516
|
inlineContainer: theme => ({
|
|
10498
10517
|
alignItems: "center",
|
|
10499
10518
|
display: "flex",
|
|
@@ -10508,14 +10527,14 @@ const InlineLabel = ({
|
|
|
10508
10527
|
isLabelRight,
|
|
10509
10528
|
labelProps: _labelProps = {}
|
|
10510
10529
|
}) => jsxs("div", Object.assign({
|
|
10511
|
-
css: styles$
|
|
10530
|
+
css: styles$8(isLabelRight).inlineContainer
|
|
10512
10531
|
}, {
|
|
10513
10532
|
children: [jsx(Typography, Object.assign({}, _labelProps, {
|
|
10514
10533
|
children: label
|
|
10515
10534
|
})), children]
|
|
10516
10535
|
}));
|
|
10517
10536
|
|
|
10518
|
-
const styles$
|
|
10537
|
+
const styles$7 = createStyles({
|
|
10519
10538
|
getBalanceText: balance => theme => ({
|
|
10520
10539
|
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
10521
10540
|
})
|
|
@@ -10538,7 +10557,7 @@ const CarrierBalance = ({
|
|
|
10538
10557
|
}, {
|
|
10539
10558
|
children: isLoadingCarrier || isRefetchingCarrier ? jsx(Spinner, {}) : jsx(Typography, Object.assign({
|
|
10540
10559
|
bold: true,
|
|
10541
|
-
css: styles$
|
|
10560
|
+
css: styles$7.getBalanceText(balance)
|
|
10542
10561
|
}, {
|
|
10543
10562
|
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
10544
10563
|
amount: balance,
|
|
@@ -10560,7 +10579,7 @@ const Spread = ({
|
|
|
10560
10579
|
children: children
|
|
10561
10580
|
}));
|
|
10562
10581
|
|
|
10563
|
-
const styles$
|
|
10582
|
+
const styles$6 = createStyles({
|
|
10564
10583
|
balanceText: theme => ({
|
|
10565
10584
|
color: theme.palette.secondary.dark
|
|
10566
10585
|
}),
|
|
@@ -10628,7 +10647,7 @@ const FundAndPurchase = ({
|
|
|
10628
10647
|
}, {
|
|
10629
10648
|
children: [jsx(Button, Object.assign({
|
|
10630
10649
|
bold: false,
|
|
10631
|
-
css: styles$
|
|
10650
|
+
css: styles$6.saveRateButton,
|
|
10632
10651
|
disabled: disabled || !carrierId || addFundsForm.isSubmitting || isRateFormSubmitting,
|
|
10633
10652
|
isLoading: isSavingRate,
|
|
10634
10653
|
onClick: handleSaveRate,
|
|
@@ -10648,7 +10667,7 @@ const FundAndPurchase = ({
|
|
|
10648
10667
|
// don't show balance or funding form
|
|
10649
10668
|
if (!isFundingRequired) return jsx("div", Object.assign({
|
|
10650
10669
|
className: className,
|
|
10651
|
-
css: styles$
|
|
10670
|
+
css: styles$6.container
|
|
10652
10671
|
}, {
|
|
10653
10672
|
children: renderActionButtons()
|
|
10654
10673
|
}));
|
|
@@ -10661,7 +10680,7 @@ const FundAndPurchase = ({
|
|
|
10661
10680
|
// show balance, but not the funding form.
|
|
10662
10681
|
if (!isFundingEnabled) return jsxs("div", Object.assign({
|
|
10663
10682
|
className: className,
|
|
10664
|
-
css: styles$
|
|
10683
|
+
css: styles$6.container
|
|
10665
10684
|
}, {
|
|
10666
10685
|
children: [jsx(CarrierBalance, {
|
|
10667
10686
|
carrierId: carrierId
|
|
@@ -10673,7 +10692,7 @@ const FundAndPurchase = ({
|
|
|
10673
10692
|
// show balance and funding form
|
|
10674
10693
|
return jsxs("div", Object.assign({
|
|
10675
10694
|
className: className,
|
|
10676
|
-
css: styles$
|
|
10695
|
+
css: styles$6.container
|
|
10677
10696
|
}, {
|
|
10678
10697
|
children: [jsxs(Spread, {
|
|
10679
10698
|
children: [jsx(CarrierBalance, {
|
|
@@ -10704,13 +10723,13 @@ const FundAndPurchase = ({
|
|
|
10704
10723
|
var _a, _b;
|
|
10705
10724
|
return jsxs(Fragment, {
|
|
10706
10725
|
children: [jsxs("section", Object.assign({
|
|
10707
|
-
css: styles$
|
|
10726
|
+
css: styles$6.getFormExtension(addFundsForm.isCustomAmount)
|
|
10708
10727
|
}, {
|
|
10709
10728
|
children: [jsx(InlineLabel, Object.assign({
|
|
10710
10729
|
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
10711
10730
|
}, {
|
|
10712
10731
|
children: jsx(Typography, Object.assign({
|
|
10713
|
-
css: styles$
|
|
10732
|
+
css: styles$6.balanceText
|
|
10714
10733
|
}, {
|
|
10715
10734
|
children: formatMoney({
|
|
10716
10735
|
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
@@ -10721,7 +10740,7 @@ const FundAndPurchase = ({
|
|
|
10721
10740
|
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
10722
10741
|
}, {
|
|
10723
10742
|
children: jsx(Typography, Object.assign({
|
|
10724
|
-
css: styles$
|
|
10743
|
+
css: styles$6.balanceText
|
|
10725
10744
|
}, {
|
|
10726
10745
|
children: formatMoney({
|
|
10727
10746
|
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
@@ -10748,6 +10767,274 @@ const FundAndPurchase = ({
|
|
|
10748
10767
|
}));
|
|
10749
10768
|
};
|
|
10750
10769
|
|
|
10770
|
+
const LabelLayoutPurchase = ({
|
|
10771
|
+
onChange
|
|
10772
|
+
}) => {
|
|
10773
|
+
const {
|
|
10774
|
+
t
|
|
10775
|
+
} = useTranslation(["common", "manage-defaults"]);
|
|
10776
|
+
const [layout, setLayout] = useState("4x6");
|
|
10777
|
+
return jsxs(Fragment, {
|
|
10778
|
+
children: [jsx(InlineNotification, Object.assign({
|
|
10779
|
+
title: t("manage-defaults:label.purchase.title"),
|
|
10780
|
+
type: NotificationType.INFO
|
|
10781
|
+
}, {
|
|
10782
|
+
children: t("manage-defaults:label.purchase.description")
|
|
10783
|
+
})), jsx(Spacer, {
|
|
10784
|
+
multiplier: 1.5
|
|
10785
|
+
}), jsxs(RadioGroup, Object.assign({
|
|
10786
|
+
name: "labelLayout",
|
|
10787
|
+
onChange: e => {
|
|
10788
|
+
setLayout(e.target.value);
|
|
10789
|
+
onChange(e.target.value);
|
|
10790
|
+
},
|
|
10791
|
+
value: layout
|
|
10792
|
+
}, {
|
|
10793
|
+
children: [jsx(Radio, Object.assign({
|
|
10794
|
+
value: "Letter"
|
|
10795
|
+
}, {
|
|
10796
|
+
children: jsx(Typography, Object.assign({
|
|
10797
|
+
bold: true
|
|
10798
|
+
}, {
|
|
10799
|
+
children: t("manage-defaults:label.letter.title")
|
|
10800
|
+
}))
|
|
10801
|
+
})), jsx(Spacer, {
|
|
10802
|
+
multiplier: 3
|
|
10803
|
+
}), jsx(Radio, Object.assign({
|
|
10804
|
+
value: "4x6"
|
|
10805
|
+
}, {
|
|
10806
|
+
children: jsx(Typography, Object.assign({
|
|
10807
|
+
bold: true
|
|
10808
|
+
}, {
|
|
10809
|
+
children: t("manage-defaults:label.thermal.title")
|
|
10810
|
+
}))
|
|
10811
|
+
}))]
|
|
10812
|
+
}))]
|
|
10813
|
+
});
|
|
10814
|
+
};
|
|
10815
|
+
|
|
10816
|
+
const styles$5 = createStyles({
|
|
10817
|
+
button: theme => ({
|
|
10818
|
+
backgroundColor: "transparent",
|
|
10819
|
+
padding: 0
|
|
10820
|
+
}),
|
|
10821
|
+
buttonContainer: theme => ({
|
|
10822
|
+
alignItems: "center",
|
|
10823
|
+
display: "flex",
|
|
10824
|
+
justifyContent: "left"
|
|
10825
|
+
}),
|
|
10826
|
+
icon: theme => ({
|
|
10827
|
+
color: theme.palette.secondary.main,
|
|
10828
|
+
position: "absolute",
|
|
10829
|
+
right: theme.spacing(1),
|
|
10830
|
+
top: theme.spacing(1)
|
|
10831
|
+
}),
|
|
10832
|
+
letter: theme => ({
|
|
10833
|
+
":hover": {
|
|
10834
|
+
border: `1px solid ${theme.palette.secondary.main}`
|
|
10835
|
+
},
|
|
10836
|
+
alignItems: "center",
|
|
10837
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
10838
|
+
borderRadius: "10px",
|
|
10839
|
+
cursor: "pointer",
|
|
10840
|
+
display: "flex",
|
|
10841
|
+
flexDirection: "column",
|
|
10842
|
+
height: theme.spacing(32),
|
|
10843
|
+
marginRight: theme.spacing(3.5),
|
|
10844
|
+
position: "relative",
|
|
10845
|
+
width: theme.spacing(24)
|
|
10846
|
+
}),
|
|
10847
|
+
letterInner: theme => ({
|
|
10848
|
+
backgroundColor: "white",
|
|
10849
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
10850
|
+
height: theme.spacing(14),
|
|
10851
|
+
marginBottom: theme.spacing(2),
|
|
10852
|
+
marginTop: theme.spacing(6),
|
|
10853
|
+
width: theme.spacing(10)
|
|
10854
|
+
}),
|
|
10855
|
+
letterLabel: theme => ({
|
|
10856
|
+
backgroundColor: "#95C2E0",
|
|
10857
|
+
height: theme.spacing(5),
|
|
10858
|
+
margin: theme.spacing(1.5)
|
|
10859
|
+
}),
|
|
10860
|
+
selectedLetter: theme => ({
|
|
10861
|
+
alignItems: "center",
|
|
10862
|
+
backgroundColor: "#EAF6FF",
|
|
10863
|
+
border: `1px solid ${theme.palette.secondary.main}`,
|
|
10864
|
+
borderRadius: "10px",
|
|
10865
|
+
boxShadow: `0 0 0 3px ${theme.palette.secondary.main}`,
|
|
10866
|
+
boxSizing: "border-box",
|
|
10867
|
+
cursor: "pointer",
|
|
10868
|
+
display: "flex",
|
|
10869
|
+
flexDirection: "column",
|
|
10870
|
+
height: theme.spacing(32),
|
|
10871
|
+
marginRight: theme.spacing(3.5),
|
|
10872
|
+
position: "relative",
|
|
10873
|
+
width: theme.spacing(24)
|
|
10874
|
+
}),
|
|
10875
|
+
selectedThermal: theme => ({
|
|
10876
|
+
alignItems: "center",
|
|
10877
|
+
backgroundColor: "#EAF6FF",
|
|
10878
|
+
border: `1px solid ${theme.palette.secondary.main}`,
|
|
10879
|
+
borderRadius: "10px",
|
|
10880
|
+
boxShadow: `0 0 0 3px ${theme.palette.secondary.main}`,
|
|
10881
|
+
cursor: "pointer",
|
|
10882
|
+
display: "flex",
|
|
10883
|
+
flexDirection: "column",
|
|
10884
|
+
height: theme.spacing(32),
|
|
10885
|
+
position: "relative",
|
|
10886
|
+
width: theme.spacing(24)
|
|
10887
|
+
}),
|
|
10888
|
+
thermal: theme => ({
|
|
10889
|
+
":hover": {
|
|
10890
|
+
border: `1px solid ${theme.palette.secondary.main}`
|
|
10891
|
+
},
|
|
10892
|
+
alignItems: "center",
|
|
10893
|
+
border: `1px solid ${theme.palette.gray.light}`,
|
|
10894
|
+
borderRadius: "10px",
|
|
10895
|
+
cursor: "pointer",
|
|
10896
|
+
display: "flex",
|
|
10897
|
+
flexDirection: "column",
|
|
10898
|
+
height: theme.spacing(32),
|
|
10899
|
+
position: "relative",
|
|
10900
|
+
width: theme.spacing(24)
|
|
10901
|
+
}),
|
|
10902
|
+
thermalIcon: theme => ({
|
|
10903
|
+
backgroundColor: "#95C2E0",
|
|
10904
|
+
height: theme.spacing(8),
|
|
10905
|
+
width: theme.spacing(5)
|
|
10906
|
+
}),
|
|
10907
|
+
thermalInner: theme => ({
|
|
10908
|
+
alignItems: "center",
|
|
10909
|
+
display: "flex",
|
|
10910
|
+
height: theme.spacing(14),
|
|
10911
|
+
justifyContent: "center",
|
|
10912
|
+
marginBottom: theme.spacing(2),
|
|
10913
|
+
marginTop: theme.spacing(6),
|
|
10914
|
+
width: theme.spacing(10)
|
|
10915
|
+
}),
|
|
10916
|
+
thermalLabel: theme => ({
|
|
10917
|
+
backgroundColor: "#95C2E0",
|
|
10918
|
+
height: theme.spacing(8),
|
|
10919
|
+
width: theme.spacing(5)
|
|
10920
|
+
})
|
|
10921
|
+
});
|
|
10922
|
+
|
|
10923
|
+
const LabelLayoutSettings = ({
|
|
10924
|
+
onChange
|
|
10925
|
+
}) => {
|
|
10926
|
+
var _a;
|
|
10927
|
+
const {
|
|
10928
|
+
t
|
|
10929
|
+
} = useTranslation(["common", "manage-defaults"]);
|
|
10930
|
+
const {
|
|
10931
|
+
data: accountSettings
|
|
10932
|
+
} = useGetAccountSettings();
|
|
10933
|
+
const labelLayout = (_a = accountSettings === null || accountSettings === void 0 ? void 0 : accountSettings.defaultLabelLayout) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
10934
|
+
return jsx(Section, Object.assign({
|
|
10935
|
+
bold: true,
|
|
10936
|
+
title: t("manage-defaults:label.title")
|
|
10937
|
+
}, {
|
|
10938
|
+
children: jsxs("div", Object.assign({
|
|
10939
|
+
css: styles$5.buttonContainer
|
|
10940
|
+
}, {
|
|
10941
|
+
children: [jsx("button", Object.assign({
|
|
10942
|
+
css: styles$5.button,
|
|
10943
|
+
id: "letter",
|
|
10944
|
+
onClick: () => {
|
|
10945
|
+
onChange("Letter");
|
|
10946
|
+
},
|
|
10947
|
+
value: "letter"
|
|
10948
|
+
}, {
|
|
10949
|
+
children: jsxs("div", Object.assign({
|
|
10950
|
+
css: labelLayout === "letter" ? styles$5.selectedLetter : styles$5.letter
|
|
10951
|
+
}, {
|
|
10952
|
+
children: [labelLayout === "letter" && jsx(Icon, {
|
|
10953
|
+
css: styles$5.icon,
|
|
10954
|
+
name: IconNames$1.CHECK_FILLED
|
|
10955
|
+
}), jsx("div", Object.assign({
|
|
10956
|
+
css: styles$5.letterInner
|
|
10957
|
+
}, {
|
|
10958
|
+
children: jsx("div", {
|
|
10959
|
+
css: styles$5.letterLabel
|
|
10960
|
+
})
|
|
10961
|
+
})), jsx(Typography, {
|
|
10962
|
+
children: t("manage-defaults:label.letter.title")
|
|
10963
|
+
}), jsx(Spacer, {
|
|
10964
|
+
multiplier: 0.5
|
|
10965
|
+
}), jsx(Typography, Object.assign({
|
|
10966
|
+
css: {
|
|
10967
|
+
color: "#6C757D"
|
|
10968
|
+
}
|
|
10969
|
+
}, {
|
|
10970
|
+
children: t("manage-defaults:label.letter.description")
|
|
10971
|
+
}))]
|
|
10972
|
+
}))
|
|
10973
|
+
})), jsx("button", Object.assign({
|
|
10974
|
+
css: styles$5.button,
|
|
10975
|
+
id: "4x6",
|
|
10976
|
+
onClick: e => {
|
|
10977
|
+
onChange(e.currentTarget.value);
|
|
10978
|
+
},
|
|
10979
|
+
value: "4x6"
|
|
10980
|
+
}, {
|
|
10981
|
+
children: jsxs("div", Object.assign({
|
|
10982
|
+
css: labelLayout === "4x6" ? styles$5.selectedThermal : styles$5.thermal
|
|
10983
|
+
}, {
|
|
10984
|
+
children: [labelLayout === "4x6" && jsx(Icon, {
|
|
10985
|
+
css: styles$5.icon,
|
|
10986
|
+
name: IconNames$1.CHECK_FILLED
|
|
10987
|
+
}), jsx("div", Object.assign({
|
|
10988
|
+
css: styles$5.thermalInner
|
|
10989
|
+
}, {
|
|
10990
|
+
children: jsx("div", {
|
|
10991
|
+
css: styles$5.thermalLabel
|
|
10992
|
+
})
|
|
10993
|
+
})), jsx(Typography, {
|
|
10994
|
+
children: t("manage-defaults:label.thermal.title")
|
|
10995
|
+
}), jsx(Spacer, {
|
|
10996
|
+
multiplier: 0.5
|
|
10997
|
+
}), jsx(Typography, Object.assign({
|
|
10998
|
+
css: {
|
|
10999
|
+
color: "#6C757D"
|
|
11000
|
+
}
|
|
11001
|
+
}, {
|
|
11002
|
+
children: t("manage-defaults:label.thermal.description")
|
|
11003
|
+
}))]
|
|
11004
|
+
}))
|
|
11005
|
+
}))]
|
|
11006
|
+
}))
|
|
11007
|
+
}));
|
|
11008
|
+
};
|
|
11009
|
+
|
|
11010
|
+
const LabelLayout = ({
|
|
11011
|
+
display
|
|
11012
|
+
}) => {
|
|
11013
|
+
const {
|
|
11014
|
+
mutateAsync: updateAccountSettings
|
|
11015
|
+
} = useUpdateAccountSettings();
|
|
11016
|
+
const {
|
|
11017
|
+
refetch: refreshAccountSettings
|
|
11018
|
+
} = useGetAccountSettings();
|
|
11019
|
+
const handleSubmitUpdateAccountSettings = newLabelLayout => __awaiter(void 0, void 0, void 0, function* () {
|
|
11020
|
+
try {
|
|
11021
|
+
yield updateAccountSettings({
|
|
11022
|
+
defaultLabelLayout: newLabelLayout
|
|
11023
|
+
});
|
|
11024
|
+
} catch (error) {
|
|
11025
|
+
console.error(error);
|
|
11026
|
+
}
|
|
11027
|
+
yield refreshAccountSettings();
|
|
11028
|
+
});
|
|
11029
|
+
return jsxs(Fragment, {
|
|
11030
|
+
children: [display === "settings" && jsx(LabelLayoutSettings, {
|
|
11031
|
+
onChange: handleSubmitUpdateAccountSettings
|
|
11032
|
+
}), display === "purchase" && jsx(LabelLayoutPurchase, {
|
|
11033
|
+
onChange: handleSubmitUpdateAccountSettings
|
|
11034
|
+
})]
|
|
11035
|
+
});
|
|
11036
|
+
};
|
|
11037
|
+
|
|
10751
11038
|
const styles$4 = createStyles({
|
|
10752
11039
|
fundAndPurchase: theme => ({
|
|
10753
11040
|
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
@@ -10780,6 +11067,8 @@ const RateForm = ({
|
|
|
10780
11067
|
displayableLabelErrors,
|
|
10781
11068
|
features,
|
|
10782
11069
|
labelErrors,
|
|
11070
|
+
labels,
|
|
11071
|
+
labelsLoading,
|
|
10783
11072
|
isLoading,
|
|
10784
11073
|
onSave,
|
|
10785
11074
|
onSelectRate,
|
|
@@ -10930,6 +11219,12 @@ const RateForm = ({
|
|
|
10930
11219
|
children: [displayableErrors, outOfBandDisplayableErrors, displayableLabelErrors]
|
|
10931
11220
|
})
|
|
10932
11221
|
}))]
|
|
11222
|
+
})), !labelsLoading && !(labels === null || labels === void 0 ? void 0 : labels.length) && jsx(Section, Object.assign({
|
|
11223
|
+
title: t("manage-defaults:label.title")
|
|
11224
|
+
}, {
|
|
11225
|
+
children: jsx(LabelLayout, {
|
|
11226
|
+
display: "purchase"
|
|
11227
|
+
})
|
|
10933
11228
|
})), jsx(FundAndPurchase, {
|
|
10934
11229
|
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
10935
11230
|
control: form.control,
|
|
@@ -12619,7 +12914,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
12619
12914
|
WarehouseForm: WarehouseForm,
|
|
12620
12915
|
VoidLabel: VoidLabel,
|
|
12621
12916
|
WalletForm: WalletForm,
|
|
12622
|
-
styles: styles$
|
|
12917
|
+
styles: styles$b,
|
|
12623
12918
|
billingAddressSchema: billingAddressSchema,
|
|
12624
12919
|
walletSchema: walletSchema,
|
|
12625
12920
|
BillingFields: BillingFields,
|
|
@@ -13166,6 +13461,7 @@ var common = {
|
|
|
13166
13461
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
13167
13462
|
noWarehouses: "You must have an active Ship From Location to use this feature.",
|
|
13168
13463
|
unableToLoad: {
|
|
13464
|
+
accountSettings: "Unable to load account settings",
|
|
13169
13465
|
autoFundingSettings: "Unable to load auto funding settings",
|
|
13170
13466
|
carrier: "Unable to load carrier",
|
|
13171
13467
|
carriers: "Unable to load carriers",
|
|
@@ -13194,6 +13490,7 @@ var common = {
|
|
|
13194
13490
|
thirdParty: "Third Party"
|
|
13195
13491
|
},
|
|
13196
13492
|
loading: {
|
|
13493
|
+
accountSettings: "Loading account settings...",
|
|
13197
13494
|
carrier: "Loading carrier...",
|
|
13198
13495
|
carriers: "Loading carriers...",
|
|
13199
13496
|
data: "Loading...",
|
|
@@ -13507,7 +13804,8 @@ var purchaseLabel$1 = {
|
|
|
13507
13804
|
needToAcknowledge: "Need to accept Rate Compliance Agreement"
|
|
13508
13805
|
},
|
|
13509
13806
|
rates: {
|
|
13510
|
-
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>"
|
|
13807
|
+
uspsMediaMailAcknowledgement: "I confirm that this package is compliant with <1>USPS guidelines for Media Mail®</1>",
|
|
13808
|
+
uspsFirstClassMailAcknowledgement_leof: "I understand the limitations and confirm that this package is compliant with USPS guidelines for First Class Mail Large Envelopes or Flats."
|
|
13511
13809
|
},
|
|
13512
13810
|
shipToAddressFormFields: "Ship To Address Form Fields",
|
|
13513
13811
|
sections: {
|
|
@@ -14117,7 +14415,7 @@ const useScrubErrors = ({
|
|
|
14117
14415
|
};
|
|
14118
14416
|
|
|
14119
14417
|
var usps_first_class_mail = [
|
|
14120
|
-
"First Class Mail
|
|
14418
|
+
"First Class Mail shipments must weigh less than {{weight}} oz. Shipments exceeding the weight entered when buying the label will be charged an adjustment fee by USPS."
|
|
14121
14419
|
];
|
|
14122
14420
|
var usps_media_mail = [
|
|
14123
14421
|
"Media Mail® can only be used for shipping books, sound recordings, manuscripts, printed music, and other media in packages weighing 70 lbs. or less. Packages containing unsupported items may be subject to post-billing adjustment fees or returned to the sender."
|
|
@@ -14157,7 +14455,7 @@ var rateMessages = {
|
|
|
14157
14455
|
"First Class Mail letter is not eligible for USPS tracking nor refund if unused. If the package weight exceeds the weight provided when buying the label, USPS will charge an adjustment fee."
|
|
14158
14456
|
],
|
|
14159
14457
|
"usps_first_class_mail:large_envelope_or_flat": [
|
|
14160
|
-
"
|
|
14458
|
+
"Tracking and refunds are not available for First Class Mail Large Envelopes or Flats labels."
|
|
14161
14459
|
],
|
|
14162
14460
|
usps_first_class_mail: usps_first_class_mail,
|
|
14163
14461
|
usps_media_mail: usps_media_mail,
|
|
@@ -14166,10 +14464,25 @@ var rateMessages = {
|
|
|
14166
14464
|
usps_priority_mail_express: usps_priority_mail_express,
|
|
14167
14465
|
ups_ground: ups_ground,
|
|
14168
14466
|
ups_2nd_day_air: ups_2nd_day_air,
|
|
14467
|
+
"ups_2nd_day_air:Saturday": [
|
|
14468
|
+
"Additional fees may apply post-delivery if picked up on a Saturday."
|
|
14469
|
+
],
|
|
14169
14470
|
ups_next_day_air_saver: ups_next_day_air_saver,
|
|
14471
|
+
"ups_next_day_air_saver:Saturday": [
|
|
14472
|
+
"Additional fees may apply post-delivery if picked up on a Saturday."
|
|
14473
|
+
],
|
|
14170
14474
|
ups_next_day_air: ups_next_day_air,
|
|
14475
|
+
"ups_next_day_air:Saturday": [
|
|
14476
|
+
"Additional fees may apply post-delivery if picked up on a Saturday."
|
|
14477
|
+
],
|
|
14171
14478
|
ups_next_day_air_early_am: ups_next_day_air_early_am,
|
|
14479
|
+
"ups_next_day_air_early_am:Saturday": [
|
|
14480
|
+
"Additional fees may apply post-delivery if picked up on a Saturday."
|
|
14481
|
+
],
|
|
14172
14482
|
ups_2nd_day_air_am: ups_2nd_day_air_am,
|
|
14483
|
+
"ups_2nd_day_air_am:Saturday": [
|
|
14484
|
+
"Additional fees may apply post-delivery if picked up on a Saturday."
|
|
14485
|
+
],
|
|
14173
14486
|
ups_3_day_select: ups_3_day_select
|
|
14174
14487
|
};
|
|
14175
14488
|
|
|
@@ -14203,16 +14516,24 @@ const useRequestRates = ({
|
|
|
14203
14516
|
if (result) yield onRatesCalculated === null || onRatesCalculated === void 0 ? void 0 : onRatesCalculated(result.rateResponse.rates, shipment);
|
|
14204
14517
|
}), [calculateRates, carriers, customPackageTypes, onRatesCalculated]);
|
|
14205
14518
|
let ratesResponse = ratedShipment === null || ratedShipment === void 0 ? void 0 : ratedShipment.rateResponse;
|
|
14519
|
+
const shipDay = useMemo(() => {
|
|
14520
|
+
if (ratedShipment === null || ratedShipment === void 0 ? void 0 : ratedShipment.shipDate) {
|
|
14521
|
+
return omitTime(ratedShipment === null || ratedShipment === void 0 ? void 0 : ratedShipment.shipDate).toLocaleString("en-us", {
|
|
14522
|
+
weekday: "long"
|
|
14523
|
+
});
|
|
14524
|
+
}
|
|
14525
|
+
return;
|
|
14526
|
+
}, [ratedShipment]);
|
|
14206
14527
|
ratesResponse = useMemo(() => ratesResponse && Object.assign(Object.assign({}, ratesResponse), {
|
|
14207
14528
|
rates: ratesResponse.rates.map(rate => {
|
|
14208
|
-
var _a, _b;
|
|
14529
|
+
var _a, _b, _c;
|
|
14209
14530
|
return Object.assign(Object.assign({}, rate), {
|
|
14210
14531
|
warningMessages: [
|
|
14211
|
-
// add additional rateMessages based on combinations of serviceCode and
|
|
14212
|
-
...((_a = rateMessages[`${rate.serviceCode}:${
|
|
14532
|
+
// add additional rateMessages based on combinations of serviceCode, packageType and shipDay
|
|
14533
|
+
...((_a = rateMessages[`${rate.serviceCode}:${shipDay}`]) !== null && _a !== void 0 ? _a : []), ...((_b = rateMessages[`${rate.serviceCode}:${rate.packageType}`]) !== null && _b !== void 0 ? _b : []), ...((_c = rateMessages[rate.serviceCode]) !== null && _c !== void 0 ? _c : []), ...rate.warningMessages]
|
|
14213
14534
|
});
|
|
14214
14535
|
})
|
|
14215
|
-
}), [ratesResponse]);
|
|
14536
|
+
}), [ratesResponse, shipDay]);
|
|
14216
14537
|
return {
|
|
14217
14538
|
ratesCalculating,
|
|
14218
14539
|
ratesErrors,
|
|
@@ -14271,6 +14592,10 @@ const useRatesForm = ({
|
|
|
14271
14592
|
const {
|
|
14272
14593
|
data: carriers
|
|
14273
14594
|
} = useListCarriers();
|
|
14595
|
+
const {
|
|
14596
|
+
data: labels,
|
|
14597
|
+
isLoading: labelsLoading
|
|
14598
|
+
} = useListLabels();
|
|
14274
14599
|
const {
|
|
14275
14600
|
mutateAsync: updateShipment
|
|
14276
14601
|
} = useUpdateSalesOrderShipment();
|
|
@@ -14371,6 +14696,8 @@ const useRatesForm = ({
|
|
|
14371
14696
|
errors: errors.length > 0 ? errors : undefined,
|
|
14372
14697
|
isLoading: ratesCalculating,
|
|
14373
14698
|
labelErrors: (labelErrors === null || labelErrors === void 0 ? void 0 : labelErrors.length) ? labelErrors : undefined,
|
|
14699
|
+
labels,
|
|
14700
|
+
labelsLoading,
|
|
14374
14701
|
onSave: handleSave,
|
|
14375
14702
|
onSubmit: handleSubmit,
|
|
14376
14703
|
rates: ratesResponse === null || ratesResponse === void 0 ? void 0 : ratesResponse.rates,
|