@shipengine/elements 0.16.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/add-funds-form/add-funds-form.d.ts +22 -0
- package/components/add-funds-form/add-funds-form.styles.d.ts +6 -0
- package/components/{organisms/manual-funding-form/manual-funding-schema.d.ts → add-funds-form/add-funds-schema.d.ts} +13 -3
- package/components/add-funds-form/index.d.ts +2 -0
- package/components/auto-funding-form/auto-funding-form.d.ts +8 -0
- package/components/auto-funding-form/index.d.ts +2 -0
- package/components/carrier-balance/carrier-balance.d.ts +4 -0
- package/components/carrier-balance/carrier-balance.styles.d.ts +1 -0
- package/components/carrier-balance/index.d.ts +1 -0
- package/components/field/create-field-controller.d.ts +2 -1
- package/components/fund-and-purchase/fund-and-purchase.d.ts +15 -0
- package/components/fund-and-purchase/fund-and-purchase.styles.d.ts +1 -0
- package/components/fund-and-purchase/index.d.ts +1 -0
- package/components/index.d.ts +9 -0
- package/components/inline-label/index.d.ts +1 -0
- package/components/inline-label/inline-label.d.ts +6 -0
- package/components/items-breakdown/items-breakdown.d.ts +1 -1
- package/components/link-action/index.d.ts +1 -0
- package/components/link-action/link-action.d.ts +12 -0
- package/components/manage-funding/manage-funding.d.ts +4 -0
- package/components/spread/index.d.ts +1 -0
- package/components/spread/spread.d.ts +5 -0
- package/components/story-notes/index.d.ts +1 -0
- package/components/story-notes/story-notes.d.ts +11 -0
- package/components/templates/completion-page/completion-page.d.ts +4 -0
- package/components/templates/completion-page/index.d.ts +1 -0
- package/components/templates/index.d.ts +2 -2
- package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -1
- package/components/templates/rate-form/rate-form.styles.d.ts +1 -0
- package/components/templates/shipment-form/shipment-form.d.ts +1 -1
- package/components/templates/suspend-sales-order/index.d.ts +1 -0
- package/components/templates/suspend-sales-order/suspend-sales-order.d.ts +8 -0
- package/components/templates/suspend-shipment/index.d.ts +1 -0
- package/components/templates/suspend-shipment/suspend-shipment.d.ts +8 -0
- package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-address.d.ts +1 -1
- package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -2
- package/elements/components/index.d.ts +1 -2
- package/elements/components/{sales-order → purchase-label}/hooks/use-configure-shipment.d.ts +1 -1
- package/elements/components/purchase-label/hooks/use-load-shipment.d.ts +9 -0
- package/elements/components/purchase-label/index.d.ts +3 -0
- package/elements/components/{sales-order/sales-order.d.ts → purchase-label/purchase-label-by-sales-order.d.ts} +1 -1
- package/elements/components/purchase-label/purchase-label-by-shipment.d.ts +9 -0
- package/elements/components/purchase-label/purchase-label.d.ts +6 -0
- package/elements/index.d.ts +0 -1
- package/elements/purchase-label.d.ts +3 -1
- package/hooks/use-elements.d.ts +2 -1
- package/hooks/use-nested-form.d.ts +2 -2
- package/index.cjs +1326 -947
- package/index.js +1315 -948
- package/locales/en/index.d.ts +19 -6
- package/mocks/carriers/handlers.d.ts +12 -1
- package/mocks/carriers/index.d.ts +1 -0
- package/mocks/index.d.ts +2 -0
- package/mocks/server.d.ts +2 -0
- package/mocks/warehouses/handlers.d.ts +1 -0
- package/mocks/warehouses/index.d.ts +1 -0
- package/package.json +5 -4
- package/testing/render.d.ts +5 -0
- package/utilities/rates.d.ts +1 -1
- package/utilities/shipengine/sales-order.d.ts +10 -0
- package/components/organisms/auto-funding-form/auto-funding-form.d.ts +0 -16
- package/components/organisms/auto-funding-form/index.d.ts +0 -1
- package/components/organisms/index.d.ts +0 -2
- package/components/organisms/manual-funding-form/index.d.ts +0 -2
- package/components/organisms/manual-funding-form/manual-funding-form.d.ts +0 -18
- package/components/templates/funding-methods/funding-methods.d.ts +0 -18
- package/components/templates/funding-methods/funding-methods.styles.d.ts +0 -1
- package/components/templates/funding-methods/index.d.ts +0 -1
- package/components/templates/sales-order/index.d.ts +0 -1
- package/components/templates/sales-order/sales-order.d.ts +0 -8
- package/elements/components/manage-funding/manage-funding.d.ts +0 -6
- package/elements/components/sales-order/index.d.ts +0 -1
- package/elements/manage-funding.d.ts +0 -1
- package/mocks/handlers.d.ts +0 -12
- /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-form.styles.d.ts +0 -0
- /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-schema.d.ts +0 -0
- /package/{elements/components → components}/manage-funding/index.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/index.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-import-sales-order.d.ts +0 -0
- /package/elements/components/{sales-order → purchase-label}/hooks/use-pending-shipment.d.ts +0 -0
package/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var reactDom = require('react-dom');
|
|
|
21
21
|
var min$4 = require('libphonenumber-js/min');
|
|
22
22
|
var cardValidator = require('card-validator');
|
|
23
23
|
var jsBase64 = require('js-base64');
|
|
24
|
+
var reactQuery = require('react-query');
|
|
24
25
|
var stylis = require('stylis');
|
|
25
26
|
var i18n = require('i18next');
|
|
26
27
|
var languageDetector = require('i18next-browser-languagedetector');
|
|
@@ -2039,7 +2040,7 @@ const getRateRequiresAcknowledgement = serviceCode => {
|
|
|
2039
2040
|
return false;
|
|
2040
2041
|
}
|
|
2041
2042
|
};
|
|
2042
|
-
const getTotalRateAmount = rateCosts => calculateTotal(...Object.values(rateCosts));
|
|
2043
|
+
const getTotalRateAmount = (rateCosts = {}) => calculateTotal(...Object.values(rateCosts));
|
|
2043
2044
|
|
|
2044
2045
|
var anObject$9 = anObject$f;
|
|
2045
2046
|
|
|
@@ -2531,6 +2532,25 @@ const getRequestedServices = salesOrder => {
|
|
|
2531
2532
|
var _a;
|
|
2532
2533
|
return Array.from(new Set((_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems) === null || _a === void 0 ? void 0 : _a.filter(item => !!item.requestedShippingOptions.shippingService).map(item => item.requestedShippingOptions.shippingService)));
|
|
2533
2534
|
};
|
|
2535
|
+
const getSalesOrderItemsFromSalesOrderOrShipment = ({
|
|
2536
|
+
salesOrder,
|
|
2537
|
+
shipment
|
|
2538
|
+
}) => {
|
|
2539
|
+
var _a, _b;
|
|
2540
|
+
return (_b = (_a = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.salesOrderItems.map(item => ({
|
|
2541
|
+
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
2542
|
+
name: item.lineItemDetails.name,
|
|
2543
|
+
quantity: item.quantity,
|
|
2544
|
+
subDetail: item.requestedShippingOptions.shippingService,
|
|
2545
|
+
subDetailValue: item.priceSummary.estimatedShipping,
|
|
2546
|
+
totalValue: item.priceSummary.total,
|
|
2547
|
+
value: item.priceSummary.unitPrice
|
|
2548
|
+
}))) !== null && _a !== void 0 ? _a : shipment === null || shipment === void 0 ? void 0 : shipment.items.map((item, i) => ({
|
|
2549
|
+
detail: `SKU ${item.sku}`,
|
|
2550
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `ITEM ${i}`,
|
|
2551
|
+
quantity: item.quantity
|
|
2552
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
2553
|
+
};
|
|
2534
2554
|
|
|
2535
2555
|
var tryToString$3 = tryToString$5;
|
|
2536
2556
|
|
|
@@ -3327,8 +3347,8 @@ const FieldLabel = ({
|
|
|
3327
3347
|
}, {
|
|
3328
3348
|
children: [label && jsxRuntime.jsxs("div", Object.assign({
|
|
3329
3349
|
css: theme => ({
|
|
3330
|
-
|
|
3331
|
-
|
|
3350
|
+
paddingTop: _withInput ? theme.spacing(subLabel ? 1 : 2) : undefined,
|
|
3351
|
+
width: theme.spacing(12.5)
|
|
3332
3352
|
})
|
|
3333
3353
|
}, {
|
|
3334
3354
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -3361,6 +3381,7 @@ const createFieldController = (options = {}) => function FieldController(_a) {
|
|
|
3361
3381
|
displayErrors = true,
|
|
3362
3382
|
displayLabel = true,
|
|
3363
3383
|
errors: errorsProp,
|
|
3384
|
+
hint,
|
|
3364
3385
|
inputOnly,
|
|
3365
3386
|
isOptional,
|
|
3366
3387
|
label,
|
|
@@ -3371,7 +3392,7 @@ const createFieldController = (options = {}) => function FieldController(_a) {
|
|
|
3371
3392
|
shouldUnregister,
|
|
3372
3393
|
subLabel
|
|
3373
3394
|
} = _a,
|
|
3374
|
-
formInputProps = __rest(_a, ["children", "control", "defaultValue", "displayErrors", "displayLabel", "errors", "inputOnly", "isOptional", "label", "labelWeight", "name", "nativeLabel", "rules", "shouldUnregister", "subLabel"]);
|
|
3395
|
+
formInputProps = __rest(_a, ["children", "control", "defaultValue", "displayErrors", "displayLabel", "errors", "hint", "inputOnly", "isOptional", "label", "labelWeight", "name", "nativeLabel", "rules", "shouldUnregister", "subLabel"]);
|
|
3375
3396
|
const {
|
|
3376
3397
|
field,
|
|
3377
3398
|
fieldState
|
|
@@ -3447,6 +3468,9 @@ const createFieldController = (options = {}) => function FieldController(_a) {
|
|
|
3447
3468
|
message: displayErrors && mergedErrorMessages.length > 0 ? {
|
|
3448
3469
|
content: mergedErrorMessages.join(", "),
|
|
3449
3470
|
type: giger.FieldMessageType.ERROR
|
|
3471
|
+
} : hint ? {
|
|
3472
|
+
content: hint,
|
|
3473
|
+
type: giger.FieldMessageType.HINT
|
|
3450
3474
|
} : undefined
|
|
3451
3475
|
}, {
|
|
3452
3476
|
children: input
|
|
@@ -22001,9 +22025,10 @@ const SubmitButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(func
|
|
|
22001
22025
|
children,
|
|
22002
22026
|
control,
|
|
22003
22027
|
disabled,
|
|
22028
|
+
isLoading,
|
|
22004
22029
|
requireDirty
|
|
22005
22030
|
} = _a,
|
|
22006
|
-
props = __rest(_a, ["alwaysRequireValidity", "children", "control", "disabled", "requireDirty"]);
|
|
22031
|
+
props = __rest(_a, ["alwaysRequireValidity", "children", "control", "disabled", "isLoading", "requireDirty"]);
|
|
22007
22032
|
const {
|
|
22008
22033
|
isDirty,
|
|
22009
22034
|
isValid,
|
|
@@ -22017,7 +22042,7 @@ const SubmitButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(func
|
|
|
22017
22042
|
disabled: disabled || !isDirty && requireDirty || !isValid && (alwaysRequireValidity || isSubmitted) || isSubmitting,
|
|
22018
22043
|
formNoValidate // Bypass all browser validations on form inputs
|
|
22019
22044
|
: true,
|
|
22020
|
-
isLoading: isSubmitting,
|
|
22045
|
+
isLoading: isLoading || isSubmitting,
|
|
22021
22046
|
ref: forwardedRef,
|
|
22022
22047
|
type: "submit"
|
|
22023
22048
|
}, props, {
|
|
@@ -23148,7 +23173,7 @@ const AddressForm = ({
|
|
|
23148
23173
|
}));
|
|
23149
23174
|
};
|
|
23150
23175
|
|
|
23151
|
-
const styles$
|
|
23176
|
+
const styles$a = createStyles({
|
|
23152
23177
|
agreement: {
|
|
23153
23178
|
alignItems: "center",
|
|
23154
23179
|
display: "flex",
|
|
@@ -23218,10 +23243,10 @@ const DisplayCarrierTerms = c => {
|
|
|
23218
23243
|
const listCarrierLinks = () => {
|
|
23219
23244
|
return c.carrierTerms.links.map((term, index) => {
|
|
23220
23245
|
return jsxRuntime.jsx("li", Object.assign({
|
|
23221
|
-
css: styles$
|
|
23246
|
+
css: styles$a.listItems
|
|
23222
23247
|
}, {
|
|
23223
23248
|
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23224
|
-
css: styles$
|
|
23249
|
+
css: styles$a.link,
|
|
23225
23250
|
href: term.url,
|
|
23226
23251
|
isExternal: true,
|
|
23227
23252
|
target: "_blank"
|
|
@@ -23237,18 +23262,18 @@ const DisplayCarrierTerms = c => {
|
|
|
23237
23262
|
};
|
|
23238
23263
|
const listCarrierTerms = () => {
|
|
23239
23264
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23240
|
-
css: styles$
|
|
23265
|
+
css: styles$a.terms
|
|
23241
23266
|
}, {
|
|
23242
23267
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23243
23268
|
variant: "subtitle1"
|
|
23244
23269
|
}, {
|
|
23245
23270
|
children: c.carrierTerms.title
|
|
23246
23271
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
23247
|
-
css: styles$
|
|
23272
|
+
css: styles$a.terms
|
|
23248
23273
|
}, {
|
|
23249
23274
|
children: listCarrierContent()
|
|
23250
23275
|
})), jsxRuntime.jsx("ul", Object.assign({
|
|
23251
|
-
css: styles$
|
|
23276
|
+
css: styles$a.links
|
|
23252
23277
|
}, {
|
|
23253
23278
|
children: listCarrierLinks()
|
|
23254
23279
|
}))]
|
|
@@ -23478,7 +23503,7 @@ const AddressDisplay = ({
|
|
|
23478
23503
|
}));
|
|
23479
23504
|
};
|
|
23480
23505
|
|
|
23481
|
-
const styles$
|
|
23506
|
+
const styles$9 = createStyles({
|
|
23482
23507
|
container: theme => ({
|
|
23483
23508
|
display: "flex",
|
|
23484
23509
|
gap: theme.spacing()
|
|
@@ -23516,13 +23541,13 @@ const Disclosure = ({
|
|
|
23516
23541
|
}, [open]);
|
|
23517
23542
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23518
23543
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23519
|
-
css: styles$
|
|
23544
|
+
css: styles$9.container
|
|
23520
23545
|
}, {
|
|
23521
23546
|
children: [jsxRuntime.jsx("div", {
|
|
23522
23547
|
children: label
|
|
23523
23548
|
}), _showToggle && jsxRuntime.jsx("button", Object.assign({
|
|
23524
23549
|
"aria-expanded": isOpen,
|
|
23525
|
-
css: styles$
|
|
23550
|
+
css: styles$9.toggle,
|
|
23526
23551
|
onClick: () => {
|
|
23527
23552
|
setIsOpen(!isOpen);
|
|
23528
23553
|
onToggle(!isOpen);
|
|
@@ -23530,12 +23555,12 @@ const Disclosure = ({
|
|
|
23530
23555
|
type: "button"
|
|
23531
23556
|
}, {
|
|
23532
23557
|
children: jsxRuntime.jsx(giger.Icon, {
|
|
23533
|
-
css: styles$
|
|
23558
|
+
css: styles$9.icon,
|
|
23534
23559
|
name: isOpen ? brands.IconNames.CHEVRON_TOP : brands.IconNames.CHEVRON_BOTTOM
|
|
23535
23560
|
})
|
|
23536
23561
|
}))]
|
|
23537
23562
|
})), isOpen && jsxRuntime.jsx("div", Object.assign({
|
|
23538
|
-
css: styles$
|
|
23563
|
+
css: styles$9.content
|
|
23539
23564
|
}, {
|
|
23540
23565
|
children: typeof children === "function" ? children(() => setIsOpen(!isOpen)) : children
|
|
23541
23566
|
}))]
|
|
@@ -23675,7 +23700,7 @@ const getCarrierRecoverySchema = requiresAddress => zod.z.object({
|
|
|
23675
23700
|
address: requiresAddress ? baseSchema : baseSchema.optional()
|
|
23676
23701
|
});
|
|
23677
23702
|
|
|
23678
|
-
const styles$
|
|
23703
|
+
const styles$8 = createStyles({
|
|
23679
23704
|
grid: theme => ({
|
|
23680
23705
|
margin: theme.spacing(4)
|
|
23681
23706
|
}),
|
|
@@ -23718,7 +23743,7 @@ const CarrierRecoveryForm = ({
|
|
|
23718
23743
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23719
23744
|
}, {
|
|
23720
23745
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
23721
|
-
css: styles$
|
|
23746
|
+
css: styles$8.grid,
|
|
23722
23747
|
noPadding: true
|
|
23723
23748
|
}, {
|
|
23724
23749
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
@@ -23739,14 +23764,14 @@ const CarrierRecoveryForm = ({
|
|
|
23739
23764
|
colSpan: 12
|
|
23740
23765
|
}, {
|
|
23741
23766
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23742
|
-
css: styles$
|
|
23767
|
+
css: styles$8.heading,
|
|
23743
23768
|
variant: "heading4"
|
|
23744
23769
|
}, {
|
|
23745
23770
|
children: t("register-wallet:sections.carriers.title")
|
|
23746
23771
|
}))
|
|
23747
23772
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
23748
23773
|
colSpan: 12,
|
|
23749
|
-
css: styles$
|
|
23774
|
+
css: styles$8.subtitle
|
|
23750
23775
|
}, {
|
|
23751
23776
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23752
23777
|
variant: "subtitle1"
|
|
@@ -23826,7 +23851,7 @@ const CarrierTerms = ({
|
|
|
23826
23851
|
switch (carrierCode) {
|
|
23827
23852
|
case "ups":
|
|
23828
23853
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23829
|
-
css: styles$
|
|
23854
|
+
css: styles$a.terms
|
|
23830
23855
|
}, {
|
|
23831
23856
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23832
23857
|
variant: "subtitle1"
|
|
@@ -23849,7 +23874,7 @@ const CarrierTerms = ({
|
|
|
23849
23874
|
text,
|
|
23850
23875
|
url
|
|
23851
23876
|
}, idx) => jsxRuntime.jsx("li", Object.assign({
|
|
23852
|
-
css: styles$
|
|
23877
|
+
css: styles$a.listItems
|
|
23853
23878
|
}, {
|
|
23854
23879
|
children: jsxRuntime.jsx(giger.Link, Object.assign({
|
|
23855
23880
|
href: url,
|
|
@@ -23897,7 +23922,7 @@ const CarrierTermsForm = ({
|
|
|
23897
23922
|
onSubmit(payload.agreement);
|
|
23898
23923
|
}));
|
|
23899
23924
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
23900
|
-
css: styles$
|
|
23925
|
+
css: styles$a.termsForm,
|
|
23901
23926
|
"data-testid": "carrier-terms-form"
|
|
23902
23927
|
}, {
|
|
23903
23928
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -23913,7 +23938,7 @@ const CarrierTermsForm = ({
|
|
|
23913
23938
|
})), jsxRuntime.jsx(Spacer, {
|
|
23914
23939
|
multiplier: 1
|
|
23915
23940
|
}), jsxRuntime.jsx("div", Object.assign({
|
|
23916
|
-
css: styles$
|
|
23941
|
+
css: styles$a.carrierLogos
|
|
23917
23942
|
}, {
|
|
23918
23943
|
children: metadatas.map(({
|
|
23919
23944
|
name,
|
|
@@ -23929,7 +23954,7 @@ const CarrierTermsForm = ({
|
|
|
23929
23954
|
onSubmit: formLogger.capture(handleSubmit)
|
|
23930
23955
|
}, {
|
|
23931
23956
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
23932
|
-
css: styles$
|
|
23957
|
+
css: styles$a.agreement
|
|
23933
23958
|
}, {
|
|
23934
23959
|
children: [jsxRuntime.jsx("div", {
|
|
23935
23960
|
children: jsxRuntime.jsx(CheckboxInput, {
|
|
@@ -23956,10 +23981,10 @@ const CarrierTermsForm = ({
|
|
|
23956
23981
|
name: "agreement"
|
|
23957
23982
|
})
|
|
23958
23983
|
}), showTerms && jsxRuntime.jsxs("div", Object.assign({
|
|
23959
|
-
css: styles$
|
|
23984
|
+
css: styles$a.well
|
|
23960
23985
|
}, {
|
|
23961
23986
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
23962
|
-
css: styles$
|
|
23987
|
+
css: styles$a.terms
|
|
23963
23988
|
}, {
|
|
23964
23989
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
23965
23990
|
variant: "heading5"
|
|
@@ -23971,7 +23996,7 @@ const CarrierTermsForm = ({
|
|
|
23971
23996
|
carrierCode: carrierCode
|
|
23972
23997
|
}, carrierCode))]
|
|
23973
23998
|
})), jsxRuntime.jsx("div", Object.assign({
|
|
23974
|
-
css: styles$
|
|
23999
|
+
css: styles$a.close
|
|
23975
24000
|
}, {
|
|
23976
24001
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
23977
24002
|
onClick: () => setShowTerms(false),
|
|
@@ -24220,522 +24245,138 @@ const CustomsItemForm = ({
|
|
|
24220
24245
|
}));
|
|
24221
24246
|
};
|
|
24222
24247
|
|
|
24223
|
-
const
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
display: "flex",
|
|
24228
|
-
flexDirection: "column",
|
|
24229
|
-
height: "100%",
|
|
24230
|
-
justifyContent: "center",
|
|
24231
|
-
textAlign: "center",
|
|
24232
|
-
width: "100%"
|
|
24233
|
-
}
|
|
24234
|
-
}, {
|
|
24235
|
-
children: jsxRuntime.jsx(giger.Spinner, Object.assign({}, props, {
|
|
24236
|
-
size: giger.SpinnerSize.SIZE_LARGE
|
|
24237
|
-
}))
|
|
24238
|
-
}));
|
|
24239
|
-
};
|
|
24240
|
-
|
|
24241
|
-
const styles$8 = createStyles({
|
|
24242
|
-
form: theme => ({
|
|
24243
|
-
backgroundColor: theme.palette.gray.megaLight,
|
|
24244
|
-
display: "flex",
|
|
24245
|
-
flexDirection: "column",
|
|
24246
|
-
gap: theme.spacing(2),
|
|
24247
|
-
padding: theme.spacing(2)
|
|
24248
|
-
})
|
|
24249
|
-
});
|
|
24250
|
-
|
|
24251
|
-
const autoFundingSchema = zod.z.object({
|
|
24252
|
-
isEnabled: zod.z.boolean(),
|
|
24253
|
-
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
24254
|
-
amount: zod.z.number().min(25)
|
|
24255
|
-
}),
|
|
24256
|
-
maximumPurchasesPerDay: zod.z.number().min(1),
|
|
24257
|
-
purchaseAmount: moneySchema.extend({
|
|
24258
|
-
amount: zod.z.number().min(10).max(10000)
|
|
24259
|
-
})
|
|
24260
|
-
});
|
|
24261
|
-
|
|
24262
|
-
/**
|
|
24263
|
-
* This form that allows users to enable or disable auto funding, and
|
|
24264
|
-
* configure auto funding settings in ShipEngine API.
|
|
24265
|
-
*/
|
|
24266
|
-
const AutoFundingForm = ({
|
|
24267
|
-
defaultValues,
|
|
24268
|
-
errorMessage,
|
|
24269
|
-
hasError,
|
|
24270
|
-
isInteger,
|
|
24271
|
-
isLoading,
|
|
24272
|
-
onSubmit,
|
|
24273
|
-
onToggle
|
|
24248
|
+
const Label = ({
|
|
24249
|
+
label,
|
|
24250
|
+
onClickVoid,
|
|
24251
|
+
onClickPrintLabel
|
|
24274
24252
|
}) => {
|
|
24253
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24275
24254
|
const {
|
|
24276
24255
|
t
|
|
24277
|
-
} = reactI18next.useTranslation();
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
}));
|
|
24290
|
-
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
24291
|
-
message: t("manage-funding:autoFunding.isLoading")
|
|
24292
|
-
});
|
|
24256
|
+
} = reactI18next.useTranslation(["common", "view-shipment"]);
|
|
24257
|
+
const insuranceOrConfirmationMessages = [];
|
|
24258
|
+
if (label.insuredValue && label.insuredValue.amount !== 0) {
|
|
24259
|
+
insuranceOrConfirmationMessages.push(t("view-shipment:fields.insuredValue", {
|
|
24260
|
+
insuredValue: formatMoney(label.insuredValue)
|
|
24261
|
+
}));
|
|
24262
|
+
}
|
|
24263
|
+
if (label.deliveryConfirmation && label.deliveryConfirmation !== "none") {
|
|
24264
|
+
insuranceOrConfirmationMessages.push(t("view-shipment:fields.deliveryConfirmation", {
|
|
24265
|
+
deliveryConfirmation: t(`common:confirmationTypes.${humps.camelize(label.deliveryConfirmation)}`)
|
|
24266
|
+
}));
|
|
24267
|
+
}
|
|
24293
24268
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24294
|
-
children: [jsxRuntime.jsx(
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
value: true
|
|
24305
|
-
}), watchIsEnabled && jsxRuntime.jsxs("form", Object.assign({
|
|
24306
|
-
css: styles$8.form,
|
|
24307
|
-
id: "auto-funding-form",
|
|
24308
|
-
onSubmit: formLogger.capture(handleSubmit)
|
|
24269
|
+
children: [["processing", "completed"].includes(label.status) ? jsxRuntime.jsx(RateCard, Object.assign({
|
|
24270
|
+
carrierCode: (_a = label.carrier) === null || _a === void 0 ? void 0 : _a.carrierCode,
|
|
24271
|
+
carrierFriendlyName: (_b = label.carrier) === null || _b === void 0 ? void 0 : _b.friendlyName,
|
|
24272
|
+
// TODO: LMNT-418 Enable Nickname via FF
|
|
24273
|
+
// carrierNickname={label.carrier?.nickname}
|
|
24274
|
+
insuranceAmount: label.insuranceCost,
|
|
24275
|
+
messages: insuranceOrConfirmationMessages,
|
|
24276
|
+
selected: true,
|
|
24277
|
+
serviceType: (_c = label.service) === null || _c === void 0 ? void 0 : _c.name,
|
|
24278
|
+
shippingAmount: label.shipmentCost
|
|
24309
24279
|
}, {
|
|
24310
|
-
children:
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
onClick: () =>
|
|
24333
|
-
|
|
24280
|
+
children: label.trackingNumber && jsxRuntime.jsx("div", {
|
|
24281
|
+
children: label.trackingNumber.toString()
|
|
24282
|
+
})
|
|
24283
|
+
})) : jsxRuntime.jsx(RateCard, {
|
|
24284
|
+
carrierCode: (_d = label.carrier) === null || _d === void 0 ? void 0 : _d.carrierCode,
|
|
24285
|
+
carrierFriendlyName: (_e = label.carrier) === null || _e === void 0 ? void 0 : _e.friendlyName,
|
|
24286
|
+
// TODO: LMNT-418 Enable Nickname via FF
|
|
24287
|
+
// carrierNickname={label.carrier?.nickname}
|
|
24288
|
+
insuranceAmount: label.insuranceCost,
|
|
24289
|
+
selected: true,
|
|
24290
|
+
serviceType: (_f = label.service) === null || _f === void 0 ? void 0 : _f.name,
|
|
24291
|
+
shippingAmount: label.shipmentCost,
|
|
24292
|
+
voided: label.voided
|
|
24293
|
+
}), label.status === "completed" && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24294
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
24295
|
+
multiplier: 2
|
|
24296
|
+
}), jsxRuntime.jsxs(ButtonGroup, {
|
|
24297
|
+
children: [onClickVoid && label.status === "completed" && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24298
|
+
bold: false,
|
|
24299
|
+
css: {
|
|
24300
|
+
whiteSpace: "nowrap"
|
|
24301
|
+
},
|
|
24302
|
+
onClick: () => onClickVoid(label),
|
|
24303
|
+
type: "submit",
|
|
24304
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
24334
24305
|
}, {
|
|
24335
|
-
children: t("actions.
|
|
24336
|
-
})), jsxRuntime.jsx(
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24306
|
+
children: t("view-shipment:actions.void")
|
|
24307
|
+
})), label.formDownload && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24308
|
+
bold: false,
|
|
24309
|
+
css: {
|
|
24310
|
+
whiteSpace: "nowrap"
|
|
24311
|
+
},
|
|
24312
|
+
onClick: () => {
|
|
24313
|
+
window.open(label.formDownload.href, "_blank", "noopener, noreferrer");
|
|
24314
|
+
},
|
|
24341
24315
|
variant: giger.ButtonVariant.OUTLINED
|
|
24342
24316
|
}, {
|
|
24343
|
-
children: t("
|
|
24317
|
+
children: t("view-shipment:actions.printForms")
|
|
24318
|
+
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24319
|
+
bold: false,
|
|
24320
|
+
css: {
|
|
24321
|
+
whiteSpace: "nowrap"
|
|
24322
|
+
},
|
|
24323
|
+
isFullWidth: true,
|
|
24324
|
+
onClick: () => {
|
|
24325
|
+
onClickPrintLabel === null || onClickPrintLabel === void 0 ? void 0 : onClickPrintLabel();
|
|
24326
|
+
window.open(label.labelDownload.href, "_blank", "noopener, noreferrer");
|
|
24327
|
+
// window.open(label.labelFormat, "_blank", "noopener, noreferrer");
|
|
24328
|
+
}
|
|
24329
|
+
}, {
|
|
24330
|
+
children: t("view-shipment:actions.printLabel")
|
|
24344
24331
|
}))]
|
|
24345
|
-
})
|
|
24346
|
-
})), hasError && errorMessage && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24347
|
-
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
24348
|
-
title: t("manage-funding:autoFunding.error.title"),
|
|
24349
|
-
type: giger.NotificationType.ERROR
|
|
24350
|
-
}, {
|
|
24351
|
-
children: errorMessage
|
|
24352
|
-
})), jsxRuntime.jsx(Spacer, {})]
|
|
24332
|
+
})]
|
|
24353
24333
|
})]
|
|
24354
24334
|
});
|
|
24355
24335
|
};
|
|
24356
24336
|
|
|
24357
|
-
const
|
|
24358
|
-
|
|
24359
|
-
amount: zod.z.number().min(10)
|
|
24360
|
-
})
|
|
24337
|
+
const landingPageFormSchema = zod.z.object({
|
|
24338
|
+
email: zod.z.string().trim().email()
|
|
24361
24339
|
});
|
|
24362
24340
|
|
|
24363
|
-
const
|
|
24364
|
-
|
|
24365
|
-
errorMessage,
|
|
24366
|
-
formId,
|
|
24367
|
-
hasError,
|
|
24368
|
-
isLoading,
|
|
24369
|
-
onCancel,
|
|
24370
|
-
onSubmit,
|
|
24371
|
-
portalRef,
|
|
24372
|
-
requiredAmount
|
|
24341
|
+
const LandingPageForm = ({
|
|
24342
|
+
onSubmit
|
|
24373
24343
|
}) => {
|
|
24374
|
-
var _a;
|
|
24375
24344
|
const {
|
|
24376
24345
|
t
|
|
24377
24346
|
} = reactI18next.useTranslation();
|
|
24378
|
-
const fundingRecommendations = React.useMemo(() => ["$20", "$50", "$100", t("manage-funding:actions.other")], [t]);
|
|
24379
|
-
const suggestedAmount = Math.max(requiredAmount !== null && requiredAmount !== void 0 ? requiredAmount : 0, 10);
|
|
24380
|
-
const [selectedFundingAmountIndex, setSelectedFundingAmountIndex] = React.useState(requiredAmount ? 3 : 0);
|
|
24381
|
-
const [showFormInput, toggleShowFormInput] = useToggle(!!requiredAmount);
|
|
24382
|
-
const getSelectedFundingValue = value => {
|
|
24383
|
-
return Number(value.replace(/[^0-9.-]+/g, ""));
|
|
24384
|
-
};
|
|
24385
24347
|
const form = reactHookForm.useForm({
|
|
24386
24348
|
defaultValues: {
|
|
24387
|
-
|
|
24388
|
-
amount: suggestedAmount,
|
|
24389
|
-
currency: api.SE.Currency.USD
|
|
24390
|
-
}
|
|
24349
|
+
email: ""
|
|
24391
24350
|
},
|
|
24392
|
-
resolver: validationResolver(
|
|
24351
|
+
resolver: validationResolver(landingPageFormSchema)
|
|
24393
24352
|
});
|
|
24394
|
-
const
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24353
|
+
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
24354
|
+
const payload = values;
|
|
24355
|
+
onSubmit(payload.email);
|
|
24356
|
+
}));
|
|
24357
|
+
return jsxRuntime.jsxs("form", Object.assign({
|
|
24358
|
+
id: "landing-page-form",
|
|
24359
|
+
onSubmit: formLogger.capture(handleSubmit)
|
|
24400
24360
|
}, {
|
|
24401
|
-
children: [jsxRuntime.jsx(
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
} else {
|
|
24414
|
-
toggleShowFormInput(false);
|
|
24415
|
-
form.reset({
|
|
24416
|
-
funds: {
|
|
24417
|
-
amount: getSelectedFundingValue(fundingRecommendations[idx]),
|
|
24418
|
-
currency: api.SE.Currency.USD
|
|
24419
|
-
}
|
|
24420
|
-
});
|
|
24421
|
-
}
|
|
24422
|
-
}
|
|
24361
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
24362
|
+
control: form.control,
|
|
24363
|
+
"data-testid": "fields.email",
|
|
24364
|
+
form: "landing-page-form",
|
|
24365
|
+
label: t("address.fields.email"),
|
|
24366
|
+
labelWeight: "normal",
|
|
24367
|
+
name: "email",
|
|
24368
|
+
nativeLabel: true
|
|
24369
|
+
}), jsxRuntime.jsx(Spacer, {
|
|
24370
|
+
multiplier: 4
|
|
24371
|
+
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
24372
|
+
justify: "center"
|
|
24423
24373
|
}, {
|
|
24424
|
-
children:
|
|
24425
|
-
|
|
24426
|
-
backgroundColor: idx !== selectedFundingAmountIndex ? theme.palette.white : theme.palette.primary.main,
|
|
24427
|
-
color: idx !== selectedFundingAmountIndex ? theme.palette.gray.main : theme.palette.white
|
|
24428
|
-
}),
|
|
24429
|
-
isSelected: idx === selectedFundingAmountIndex
|
|
24430
|
-
}, {
|
|
24431
|
-
children: item
|
|
24432
|
-
}), idx))
|
|
24433
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
24434
|
-
multiplier: 1
|
|
24435
|
-
}), showFormInput && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24436
|
-
children: [jsxRuntime.jsx(MoneyInput, {
|
|
24374
|
+
children: jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
24375
|
+
alwaysRequireValidity: true,
|
|
24437
24376
|
control: form.control,
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
},
|
|
24442
|
-
label: t("manage-funding:otp.labels.amount"),
|
|
24443
|
-
name: "funds",
|
|
24444
|
-
placeholder: "Amount",
|
|
24445
|
-
showCurrencySymbol: true,
|
|
24446
|
-
subLabel: "Minimum purchase $10.00"
|
|
24447
|
-
}), jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
24448
|
-
label: t("manage-funding:otp.labels.resultingBalance")
|
|
24449
|
-
}, {
|
|
24450
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24451
|
-
variant: "body1"
|
|
24452
|
-
}, {
|
|
24453
|
-
children: formatMoney({
|
|
24454
|
-
amount: resultingBalance,
|
|
24455
|
-
currency: api.SE.Currency.USD
|
|
24456
|
-
})
|
|
24457
|
-
})), jsxRuntime.jsx(Spacer, {})]
|
|
24458
|
-
}))]
|
|
24459
|
-
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
24460
|
-
justify: "end"
|
|
24461
|
-
}, {
|
|
24462
|
-
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24463
|
-
onClick: onCancel,
|
|
24464
|
-
variant: giger.ButtonVariant.TEXT
|
|
24465
|
-
}, {
|
|
24466
|
-
children: t("actions.cancel")
|
|
24467
|
-
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
24468
|
-
control: form.control,
|
|
24469
|
-
form: formId,
|
|
24470
|
-
variant: giger.ButtonVariant.OUTLINED
|
|
24471
|
-
}, {
|
|
24472
|
-
children: t(formId ? "actions.purchase" : "manage-funding:actions.addNow")
|
|
24473
|
-
}))]
|
|
24474
|
-
}))]
|
|
24475
|
-
}));
|
|
24476
|
-
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
24477
|
-
message: t("manage-funding:otp.isLoading")
|
|
24478
|
-
});
|
|
24479
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24480
|
-
children: [jsxRuntime.jsx("form", Object.assign({
|
|
24481
|
-
id: formId,
|
|
24482
|
-
onSubmit: formLogger.capture(form.handleSubmit(onSubmit))
|
|
24483
|
-
}, {
|
|
24484
|
-
children: portalRef !== undefined ?
|
|
24485
|
-
// Nested form in a well
|
|
24486
|
-
jsxRuntime.jsx(Portal, Object.assign({
|
|
24487
|
-
target: portalRef
|
|
24488
|
-
}, {
|
|
24489
|
-
children: jsxRuntime.jsx("section", Object.assign({
|
|
24490
|
-
css: theme => ({
|
|
24491
|
-
backgroundColor: theme.palette.gray.megaLight,
|
|
24492
|
-
padding: theme.spacing(2)
|
|
24493
|
-
})
|
|
24494
|
-
}, {
|
|
24495
|
-
children: formInterface
|
|
24496
|
-
}))
|
|
24497
|
-
})) :
|
|
24498
|
-
// Standalone form
|
|
24499
|
-
formInterface
|
|
24500
|
-
})), hasError && errorMessage && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24501
|
-
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
24502
|
-
title: t("manage-funding:otp.error.title"),
|
|
24503
|
-
type: giger.NotificationType.ERROR
|
|
24504
|
-
}, {
|
|
24505
|
-
children: errorMessage
|
|
24506
|
-
})), jsxRuntime.jsx(Spacer, {})]
|
|
24507
|
-
})]
|
|
24508
|
-
});
|
|
24509
|
-
};
|
|
24510
|
-
|
|
24511
|
-
const styles$7 = createStyles({
|
|
24512
|
-
addFundsButton: theme => ({
|
|
24513
|
-
alignItems: "center",
|
|
24514
|
-
display: "flex",
|
|
24515
|
-
gap: theme.spacing(1)
|
|
24516
|
-
}),
|
|
24517
|
-
balanceText: theme => ({
|
|
24518
|
-
color: theme.palette.success.main
|
|
24519
|
-
}),
|
|
24520
|
-
header: theme => ({
|
|
24521
|
-
display: "flex",
|
|
24522
|
-
gap: theme.spacing(2),
|
|
24523
|
-
justifyContent: "space-between"
|
|
24524
|
-
}),
|
|
24525
|
-
negativeBalanceText: theme => ({
|
|
24526
|
-
color: theme.palette.error.main
|
|
24527
|
-
})
|
|
24528
|
-
});
|
|
24529
|
-
|
|
24530
|
-
const FundingMethods = ({
|
|
24531
|
-
addFundsErrorMessage,
|
|
24532
|
-
autoFundingData,
|
|
24533
|
-
autoFundingErrorMessage,
|
|
24534
|
-
fundingMethod,
|
|
24535
|
-
hasAutoFundingError,
|
|
24536
|
-
hasManualFundingError,
|
|
24537
|
-
isAutoFundingLoading,
|
|
24538
|
-
isManualFundingLoading,
|
|
24539
|
-
manualFundingCurrentBalance,
|
|
24540
|
-
manualFundingRequiredAmount,
|
|
24541
|
-
onSubmitAutoFunding,
|
|
24542
|
-
onSubmitManualFunding,
|
|
24543
|
-
onToggleAutoFunding
|
|
24544
|
-
}) => {
|
|
24545
|
-
const {
|
|
24546
|
-
t
|
|
24547
|
-
} = reactI18next.useTranslation();
|
|
24548
|
-
const [showFundingMethods, toggleShowFundingMethods] = useToggle(false);
|
|
24549
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24550
|
-
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24551
|
-
css: styles$7.header
|
|
24552
|
-
}, {
|
|
24553
|
-
children: [jsxRuntime.jsxs("div", {
|
|
24554
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24555
|
-
variant: "body1"
|
|
24556
|
-
}, {
|
|
24557
|
-
children: t("manage-funding:currentBalance")
|
|
24558
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24559
|
-
bold: true,
|
|
24560
|
-
css: manualFundingCurrentBalance >= 0 ? styles$7.balanceText : styles$7.negativeBalanceText,
|
|
24561
|
-
variant: "body1"
|
|
24562
|
-
}, {
|
|
24563
|
-
children: formatMoney({
|
|
24564
|
-
amount: manualFundingCurrentBalance,
|
|
24565
|
-
currency: api.SE.Currency.USD
|
|
24566
|
-
})
|
|
24567
|
-
}))]
|
|
24568
|
-
}), jsxRuntime.jsxs(giger.Link, Object.assign({
|
|
24569
|
-
bold: true,
|
|
24570
|
-
css: styles$7.addFundsButton,
|
|
24571
|
-
onClick: toggleShowFundingMethods,
|
|
24572
|
-
size: giger.ButtonSize.MEDIUM
|
|
24573
|
-
}, {
|
|
24574
|
-
children: [t("manage-funding:addFunds"), jsxRuntime.jsx(giger.Icon, {
|
|
24575
|
-
name: brands.IconNames.ADD,
|
|
24576
|
-
size: giger.IconSize.SIZE_MEDIUM,
|
|
24577
|
-
title: "Add Funds"
|
|
24578
|
-
})]
|
|
24579
|
-
}))]
|
|
24580
|
-
})), jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx("div", Object.assign({
|
|
24581
|
-
css: theme => Object.assign(Object.assign({}, !showFundingMethods && {
|
|
24582
|
-
display: "none"
|
|
24583
|
-
}), {
|
|
24584
|
-
marginBottom: theme.spacing(2)
|
|
24585
|
-
})
|
|
24586
|
-
}, {
|
|
24587
|
-
children: ["manual", "both"].includes(fundingMethod) && jsxRuntime.jsx(ManualFundingForm, {
|
|
24588
|
-
currentBalance: manualFundingCurrentBalance,
|
|
24589
|
-
errorMessage: addFundsErrorMessage,
|
|
24590
|
-
hasError: hasManualFundingError,
|
|
24591
|
-
isLoading: isManualFundingLoading,
|
|
24592
|
-
onCancel: toggleShowFundingMethods,
|
|
24593
|
-
onSubmit: onSubmitManualFunding,
|
|
24594
|
-
requiredAmount: manualFundingRequiredAmount
|
|
24595
|
-
})
|
|
24596
|
-
})), ["auto", "both"].includes(fundingMethod) && jsxRuntime.jsx(AutoFundingForm, {
|
|
24597
|
-
defaultValues: autoFundingData,
|
|
24598
|
-
errorMessage: autoFundingErrorMessage,
|
|
24599
|
-
hasError: hasAutoFundingError,
|
|
24600
|
-
isLoading: isAutoFundingLoading,
|
|
24601
|
-
onSubmit: onSubmitAutoFunding,
|
|
24602
|
-
onToggle: onToggleAutoFunding
|
|
24603
|
-
})]
|
|
24604
|
-
});
|
|
24605
|
-
};
|
|
24606
|
-
|
|
24607
|
-
const Label = ({
|
|
24608
|
-
label,
|
|
24609
|
-
onClickVoid,
|
|
24610
|
-
onClickPrintLabel
|
|
24611
|
-
}) => {
|
|
24612
|
-
var _a, _b, _c, _d, _e, _f;
|
|
24613
|
-
const {
|
|
24614
|
-
t
|
|
24615
|
-
} = reactI18next.useTranslation(["common", "view-shipment"]);
|
|
24616
|
-
const insuranceOrConfirmationMessages = [];
|
|
24617
|
-
if (label.insuredValue && label.insuredValue.amount !== 0) {
|
|
24618
|
-
insuranceOrConfirmationMessages.push(t("view-shipment:fields.insuredValue", {
|
|
24619
|
-
insuredValue: formatMoney(label.insuredValue)
|
|
24620
|
-
}));
|
|
24621
|
-
}
|
|
24622
|
-
if (label.deliveryConfirmation && label.deliveryConfirmation !== "none") {
|
|
24623
|
-
insuranceOrConfirmationMessages.push(t("view-shipment:fields.deliveryConfirmation", {
|
|
24624
|
-
deliveryConfirmation: t(`common:confirmationTypes.${humps.camelize(label.deliveryConfirmation)}`)
|
|
24625
|
-
}));
|
|
24626
|
-
}
|
|
24627
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24628
|
-
children: [["processing", "completed"].includes(label.status) ? jsxRuntime.jsx(RateCard, Object.assign({
|
|
24629
|
-
carrierCode: (_a = label.carrier) === null || _a === void 0 ? void 0 : _a.carrierCode,
|
|
24630
|
-
carrierFriendlyName: (_b = label.carrier) === null || _b === void 0 ? void 0 : _b.friendlyName,
|
|
24631
|
-
// TODO: LMNT-418 Enable Nickname via FF
|
|
24632
|
-
// carrierNickname={label.carrier?.nickname}
|
|
24633
|
-
insuranceAmount: label.insuranceCost,
|
|
24634
|
-
messages: insuranceOrConfirmationMessages,
|
|
24635
|
-
selected: true,
|
|
24636
|
-
serviceType: (_c = label.service) === null || _c === void 0 ? void 0 : _c.name,
|
|
24637
|
-
shippingAmount: label.shipmentCost
|
|
24638
|
-
}, {
|
|
24639
|
-
children: label.trackingNumber && jsxRuntime.jsx("div", {
|
|
24640
|
-
children: label.trackingNumber.toString()
|
|
24641
|
-
})
|
|
24642
|
-
})) : jsxRuntime.jsx(RateCard, {
|
|
24643
|
-
carrierCode: (_d = label.carrier) === null || _d === void 0 ? void 0 : _d.carrierCode,
|
|
24644
|
-
carrierFriendlyName: (_e = label.carrier) === null || _e === void 0 ? void 0 : _e.friendlyName,
|
|
24645
|
-
// TODO: LMNT-418 Enable Nickname via FF
|
|
24646
|
-
// carrierNickname={label.carrier?.nickname}
|
|
24647
|
-
insuranceAmount: label.insuranceCost,
|
|
24648
|
-
selected: true,
|
|
24649
|
-
serviceType: (_f = label.service) === null || _f === void 0 ? void 0 : _f.name,
|
|
24650
|
-
shippingAmount: label.shipmentCost,
|
|
24651
|
-
voided: label.voided
|
|
24652
|
-
}), label.status === "completed" && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24653
|
-
children: [jsxRuntime.jsx(Spacer, {
|
|
24654
|
-
multiplier: 2
|
|
24655
|
-
}), jsxRuntime.jsxs(ButtonGroup, {
|
|
24656
|
-
children: [onClickVoid && label.status === "completed" && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24657
|
-
bold: false,
|
|
24658
|
-
css: {
|
|
24659
|
-
whiteSpace: "nowrap"
|
|
24660
|
-
},
|
|
24661
|
-
onClick: () => onClickVoid(label),
|
|
24662
|
-
type: "submit",
|
|
24663
|
-
variant: giger.ButtonVariant.OUTLINED
|
|
24664
|
-
}, {
|
|
24665
|
-
children: t("view-shipment:actions.void")
|
|
24666
|
-
})), label.formDownload && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24667
|
-
bold: false,
|
|
24668
|
-
css: {
|
|
24669
|
-
whiteSpace: "nowrap"
|
|
24670
|
-
},
|
|
24671
|
-
onClick: () => {
|
|
24672
|
-
window.open(label.formDownload.href, "_blank", "noopener, noreferrer");
|
|
24673
|
-
},
|
|
24674
|
-
variant: giger.ButtonVariant.OUTLINED
|
|
24675
|
-
}, {
|
|
24676
|
-
children: t("view-shipment:actions.printForms")
|
|
24677
|
-
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24678
|
-
bold: false,
|
|
24679
|
-
css: {
|
|
24680
|
-
whiteSpace: "nowrap"
|
|
24681
|
-
},
|
|
24682
|
-
isFullWidth: true,
|
|
24683
|
-
onClick: () => {
|
|
24684
|
-
onClickPrintLabel === null || onClickPrintLabel === void 0 ? void 0 : onClickPrintLabel();
|
|
24685
|
-
window.open(label.labelDownload.href, "_blank", "noopener, noreferrer");
|
|
24686
|
-
// window.open(label.labelFormat, "_blank", "noopener, noreferrer");
|
|
24687
|
-
}
|
|
24688
|
-
}, {
|
|
24689
|
-
children: t("view-shipment:actions.printLabel")
|
|
24690
|
-
}))]
|
|
24691
|
-
})]
|
|
24692
|
-
})]
|
|
24693
|
-
});
|
|
24694
|
-
};
|
|
24695
|
-
|
|
24696
|
-
const landingPageFormSchema = zod.z.object({
|
|
24697
|
-
email: zod.z.string().trim().email()
|
|
24698
|
-
});
|
|
24699
|
-
|
|
24700
|
-
const LandingPageForm = ({
|
|
24701
|
-
onSubmit
|
|
24702
|
-
}) => {
|
|
24703
|
-
const {
|
|
24704
|
-
t
|
|
24705
|
-
} = reactI18next.useTranslation();
|
|
24706
|
-
const form = reactHookForm.useForm({
|
|
24707
|
-
defaultValues: {
|
|
24708
|
-
email: ""
|
|
24709
|
-
},
|
|
24710
|
-
resolver: validationResolver(landingPageFormSchema)
|
|
24711
|
-
});
|
|
24712
|
-
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
24713
|
-
const payload = values;
|
|
24714
|
-
onSubmit(payload.email);
|
|
24715
|
-
}));
|
|
24716
|
-
return jsxRuntime.jsxs("form", Object.assign({
|
|
24717
|
-
id: "landing-page-form",
|
|
24718
|
-
onSubmit: formLogger.capture(handleSubmit)
|
|
24719
|
-
}, {
|
|
24720
|
-
children: [jsxRuntime.jsx(TextInput, {
|
|
24721
|
-
control: form.control,
|
|
24722
|
-
"data-testid": "fields.email",
|
|
24723
|
-
form: "landing-page-form",
|
|
24724
|
-
label: t("address.fields.email"),
|
|
24725
|
-
labelWeight: "normal",
|
|
24726
|
-
name: "email",
|
|
24727
|
-
nativeLabel: true
|
|
24728
|
-
}), jsxRuntime.jsx(Spacer, {
|
|
24729
|
-
multiplier: 4
|
|
24730
|
-
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
24731
|
-
justify: "center"
|
|
24732
|
-
}, {
|
|
24733
|
-
children: jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
24734
|
-
alwaysRequireValidity: true,
|
|
24735
|
-
control: form.control,
|
|
24736
|
-
"data-testid": "onboarding:landing.action",
|
|
24737
|
-
form: "landing-page-form",
|
|
24738
|
-
variant: giger.ButtonVariant.FILLED
|
|
24377
|
+
"data-testid": "onboarding:landing.action",
|
|
24378
|
+
form: "landing-page-form",
|
|
24379
|
+
variant: giger.ButtonVariant.FILLED
|
|
24739
24380
|
}, {
|
|
24740
24381
|
children: t("onboarding:landing.action")
|
|
24741
24382
|
}))
|
|
@@ -24743,7 +24384,7 @@ const LandingPageForm = ({
|
|
|
24743
24384
|
}));
|
|
24744
24385
|
};
|
|
24745
24386
|
|
|
24746
|
-
const styles$
|
|
24387
|
+
const styles$7 = createStyles({
|
|
24747
24388
|
container: theme => ({
|
|
24748
24389
|
padding: theme.spacing(2)
|
|
24749
24390
|
}),
|
|
@@ -24764,11 +24405,11 @@ const LandingPage = ({
|
|
|
24764
24405
|
t
|
|
24765
24406
|
} = reactI18next.useTranslation();
|
|
24766
24407
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24767
|
-
css: styles$
|
|
24408
|
+
css: styles$7.container,
|
|
24768
24409
|
"data-testid": "landing-page"
|
|
24769
24410
|
}, {
|
|
24770
24411
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24771
|
-
css: styles$
|
|
24412
|
+
css: styles$7.header
|
|
24772
24413
|
}, {
|
|
24773
24414
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24774
24415
|
variant: "heading4"
|
|
@@ -24786,7 +24427,7 @@ const LandingPage = ({
|
|
|
24786
24427
|
})), jsxRuntime.jsx(LandingPageForm, {
|
|
24787
24428
|
onSubmit: onSubmit
|
|
24788
24429
|
}), jsxRuntime.jsxs("div", Object.assign({
|
|
24789
|
-
css: styles$
|
|
24430
|
+
css: styles$7.header
|
|
24790
24431
|
}, {
|
|
24791
24432
|
children: [jsxRuntime.jsx(Spacer, {
|
|
24792
24433
|
multiplier: 6
|
|
@@ -24797,7 +24438,7 @@ const LandingPage = ({
|
|
|
24797
24438
|
})), jsxRuntime.jsx(Spacer, {
|
|
24798
24439
|
multiplier: 2
|
|
24799
24440
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24800
|
-
css: styles$
|
|
24441
|
+
css: styles$7.description,
|
|
24801
24442
|
variant: "body1"
|
|
24802
24443
|
}, {
|
|
24803
24444
|
children: t("onboarding:landing.description")
|
|
@@ -24878,18 +24519,17 @@ const Accordion = _a => {
|
|
|
24878
24519
|
});
|
|
24879
24520
|
};
|
|
24880
24521
|
|
|
24881
|
-
const
|
|
24882
|
-
|
|
24883
|
-
|
|
24884
|
-
}
|
|
24522
|
+
const getStyles$3 = (isConnected = false) => createStyles({
|
|
24523
|
+
connectButton: theme => [{
|
|
24524
|
+
padding: `0 ${theme.spacing(.5)}px`
|
|
24525
|
+
}, isConnected && {
|
|
24526
|
+
backgroundColor: theme.palette.success.main,
|
|
24527
|
+
color: theme.palette.white
|
|
24528
|
+
}],
|
|
24885
24529
|
container: {
|
|
24886
24530
|
display: "flex",
|
|
24887
24531
|
flexDirection: "column"
|
|
24888
24532
|
},
|
|
24889
|
-
loadingButtonContainer: {
|
|
24890
|
-
alignItems: "center",
|
|
24891
|
-
display: "flex"
|
|
24892
|
-
},
|
|
24893
24533
|
logoContainer: theme => ({
|
|
24894
24534
|
alignItems: "center",
|
|
24895
24535
|
columnGap: `${theme.spacing(1)}px`,
|
|
@@ -24900,31 +24540,6 @@ const styles$5 = createStyles({
|
|
|
24900
24540
|
display: "flex",
|
|
24901
24541
|
justifyContent: "space-between",
|
|
24902
24542
|
padding: `${theme.spacing(2)}px`
|
|
24903
|
-
}),
|
|
24904
|
-
statusChipConnected: theme => ({
|
|
24905
|
-
alignItems: 'center',
|
|
24906
|
-
background: theme.palette.success.main,
|
|
24907
|
-
borderRadius: theme.borderRadius.S,
|
|
24908
|
-
color: theme.palette.white,
|
|
24909
|
-
display: 'flex',
|
|
24910
|
-
flex: 'none',
|
|
24911
|
-
flexDirection: 'row',
|
|
24912
|
-
fontSize: theme.typography.fontSize.S,
|
|
24913
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24914
|
-
gap: `${theme.spacing(1)}px}`,
|
|
24915
|
-
height: '20px',
|
|
24916
|
-
justifyContent: 'center',
|
|
24917
|
-
lineHeight: `${theme.spacing(2.5)} px`,
|
|
24918
|
-
order: '0',
|
|
24919
|
-
padding: `${theme.spacing(.5)} px`,
|
|
24920
|
-
width: '81px'
|
|
24921
|
-
}),
|
|
24922
|
-
statusChipNotConnected: theme => ({
|
|
24923
|
-
background: 'none',
|
|
24924
|
-
color: theme.palette.secondary.main,
|
|
24925
|
-
fontSize: theme.typography.fontSize.M,
|
|
24926
|
-
fontWeight: theme.typography.fontWeight.bold,
|
|
24927
|
-
lineHeight: `${theme.spacing(3)} px`
|
|
24928
24543
|
})
|
|
24929
24544
|
});
|
|
24930
24545
|
|
|
@@ -24935,7 +24550,7 @@ var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
|
24935
24550
|
} : {
|
|
24936
24551
|
name: "111ty02-css",
|
|
24937
24552
|
styles: "align-items:center;display:flex;label:css;",
|
|
24938
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
24553
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpc3QtY2FycmllcnMtcm93LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtQmllIiwiZmlsZSI6Imxpc3QtY2FycmllcnMtcm93LnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IF9fYXdhaXRlciB9IGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBqc3ggYXMgX2pzeCwganN4cyBhcyBfanN4cyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdC9qc3gtcnVudGltZVwiO1xyXG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlU3RhdGUgfSBmcm9tIFwicmVhY3RcIjtcclxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xyXG5pbXBvcnQgeyBCdXR0b24sIEJ1dHRvbkNvbG9yLCBCdXR0b25WYXJpYW50LCBUeXBvZ3JhcGh5IH0gZnJvbSBcIkBwYWNrbGluay9naWdlclwiO1xyXG5pbXBvcnQgeyBUZW1wbGF0ZXMgfSBmcm9tIFwiLi4vLi4vLi4vY29tcG9uZW50c1wiO1xyXG5pbXBvcnQgeyBnZXRTdHlsZXMgfSBmcm9tIFwiLi9saXN0LWNhcnJpZXJzLXJvdy5zdHlsZXNcIjtcclxuZXhwb3J0IGNvbnN0IExpc3RDYXJyaWVyc1JvdyA9ICh7IGNvbm5lY3RlZENhcnJpZXI6IHsgY2FycmllciwgaXNDb25uZWN0ZWQgfSwgcmVnaXN0ZXJDYXJyaWVyLCByZWdpc3RlckNhcnJpZXJFcnJvcnMsIH0pID0+IHtcclxuICAgIGNvbnN0IHsgc2hvcnRuYW1lOiBuYW1lLCBsb2dvLCByZXF1aXJlZEZpZWxkcyB9ID0gY2FycmllcjtcclxuICAgIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oW1wibGlzdC1jYXJyaWVyc1wiXSk7XHJcbiAgICBjb25zdCBbc2hvd0Ryb3BEb3duLCBzZXRTaG93RHJvcERvd25dID0gdXNlU3RhdGUoZmFsc2UpO1xyXG4gICAgY29uc3QgW2lzU3VibWl0dGluZywgc2V0SXNTdWJtaXR0aW5nXSA9IHVzZVN0YXRlKGZhbHNlKTtcclxuICAgIGNvbnN0IGhhbmRsZVJlZ2lzdGVyID0gKHZhbHVlcykgPT4gX19hd2FpdGVyKHZvaWQgMCwgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uKiAoKSB7XHJcbiAgICAgICAgc2V0SXNTdWJtaXR0aW5nKHRydWUpO1xyXG4gICAgICAgIHlpZWxkIHJlZ2lzdGVyQ2Fycmllcih2YWx1ZXMpO1xyXG4gICAgICAgIHNob3dEcm9wRG93biAmJiBzZXRTaG93RHJvcERvd24oZmFsc2UpO1xyXG4gICAgICAgIHNldElzU3VibWl0dGluZyhmYWxzZSk7XHJcbiAgICB9KTtcclxuICAgIHJldHVybiAoX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkuY29udGFpbmVyLCBcImRhdGEtdGVzdGlkXCI6IFwiY2Fycmllci1yb3dcIiB9LCB7IGNoaWxkcmVuOiBbX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNzczogZ2V0U3R5bGVzKCkucm93Q29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY3NzOiBnZXRTdHlsZXMoKS5sb2dvQ29udGFpbmVyIH0sIHsgY2hpbGRyZW46IFtfanN4KFwiZGl2XCIsIHsgY2hpbGRyZW46IF9qc3goXCJpbWdcIiwgeyBhbHQ6IGAke25hbWV9LWxvZ29gLCBoZWlnaHQ6IDQwLCBzcmM6IGxvZ28sIHdpZHRoOiA0MCB9KSB9KSwgX2pzeChUeXBvZ3JhcGh5LCBPYmplY3QuYXNzaWduKHsgdmFyaWFudDogXCJzdWJ0aXRsZTFcIiB9LCB7IGNoaWxkcmVuOiBuYW1lIH0pKV0gfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjc3M6IGNzcyh7IGFsaWduSXRlbXM6IFwiY2VudGVyXCIsIGRpc3BsYXk6IFwiZmxleFwiIH0pIH0sIHsgY2hpbGRyZW46IF9qc3goQnV0dG9uLCBPYmplY3QuYXNzaWduKHsgY29sb3I6IEJ1dHRvbkNvbG9yLlNFQ09OREFSWSwgY3NzOiBnZXRTdHlsZXMoaXNDb25uZWN0ZWQpLmNvbm5lY3RCdXR0b24sIGRpc2FibGVkOiBpc0Nvbm5lY3RlZCB8fCBzaG93RHJvcERvd24sIGlzTG9hZGluZzogaXNTdWJtaXR0aW5nLCBvbkNsaWNrOiAoKSA9PiBfX2F3YWl0ZXIodm9pZCAwLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVxdWlyZWRGaWVsZHMgPT09IG51bGwgfHwgcmVxdWlyZWRGaWVsZHMgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHJlcXVpcmVkRmllbGRzLmluY2x1ZGVzKFwiYWRkcmVzc1wiKSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0Ryb3BEb3duKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgaGFuZGxlUmVnaXN0ZXIoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2YXJpYW50OiBCdXR0b25WYXJpYW50LlRFWFQgfSwgeyBjaGlsZHJlbjogaXNDb25uZWN0ZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHQoXCJsaXN0LWNhcnJpZXJzOmFjdGlvbnMuc3RhdHVzLmNvbm5lY3RlZFwiKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdChcImxpc3QtY2FycmllcnM6YWN0aW9ucy5zdGF0dXMubm90Q29ubmVjdGVkXCIpIH0pKSB9KSldIH0pKSwgc2hvd0Ryb3BEb3duICYmIChfanN4KFRlbXBsYXRlcy5BZGRDYXJyaWVyRm9ybSwgeyBjYXJyaWVyVGVybXM6IGNhcnJpZXIudGVybXMgJiYgY2Fycmllci50ZXJtcywgb25DYW5jZWw6ICgpID0+IHNldFNob3dEcm9wRG93bihmYWxzZSksIG9uU3VibWl0OiAodmFsdWVzKSA9PiBoYW5kbGVSZWdpc3Rlcih2YWx1ZXMpLCByZWdpc3RlckNhcnJpZXJFcnJvcnM6IHJlZ2lzdGVyQ2FycmllckVycm9ycyB9KSldIH0pKSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWxpc3QtY2FycmllcnMtcm93LmpzLm1hcCJdfQ== */",
|
|
24939
24554
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
24940
24555
|
};
|
|
24941
24556
|
const ListCarriersRow = ({
|
|
@@ -24947,7 +24562,7 @@ const ListCarriersRow = ({
|
|
|
24947
24562
|
registerCarrierErrors
|
|
24948
24563
|
}) => {
|
|
24949
24564
|
const {
|
|
24950
|
-
name,
|
|
24565
|
+
shortname: name,
|
|
24951
24566
|
logo,
|
|
24952
24567
|
requiredFields
|
|
24953
24568
|
} = carrier;
|
|
@@ -24963,20 +24578,21 @@ const ListCarriersRow = ({
|
|
|
24963
24578
|
setIsSubmitting(false);
|
|
24964
24579
|
});
|
|
24965
24580
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
24966
|
-
css:
|
|
24581
|
+
css: getStyles$3().container,
|
|
24582
|
+
"data-testid": "carrier-row"
|
|
24967
24583
|
}, {
|
|
24968
24584
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24969
|
-
css:
|
|
24585
|
+
css: getStyles$3().rowContainer
|
|
24970
24586
|
}, {
|
|
24971
24587
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
24972
|
-
css:
|
|
24588
|
+
css: getStyles$3().logoContainer
|
|
24973
24589
|
}, {
|
|
24974
24590
|
children: [jsxRuntime.jsx("div", {
|
|
24975
24591
|
children: jsxRuntime.jsx("img", {
|
|
24976
24592
|
alt: `${name}-logo`,
|
|
24977
|
-
height:
|
|
24593
|
+
height: 40,
|
|
24978
24594
|
src: logo,
|
|
24979
|
-
width:
|
|
24595
|
+
width: 40
|
|
24980
24596
|
})
|
|
24981
24597
|
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
24982
24598
|
variant: "subtitle1"
|
|
@@ -24987,6 +24603,8 @@ const ListCarriersRow = ({
|
|
|
24987
24603
|
css: _ref$1
|
|
24988
24604
|
}, {
|
|
24989
24605
|
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
24606
|
+
color: giger.ButtonColor.SECONDARY,
|
|
24607
|
+
css: getStyles$3(isConnected).connectButton,
|
|
24990
24608
|
disabled: isConnected || showDropDown,
|
|
24991
24609
|
isLoading: isSubmitting,
|
|
24992
24610
|
onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -25006,7 +24624,7 @@ const ListCarriersRow = ({
|
|
|
25006
24624
|
}));
|
|
25007
24625
|
};
|
|
25008
24626
|
|
|
25009
|
-
const styles$
|
|
24627
|
+
const styles$6 = createStyles({
|
|
25010
24628
|
listContainer: theme => ({
|
|
25011
24629
|
"& > li:not(:last-of-type)": {
|
|
25012
24630
|
borderBottom: `1px solid ${theme.palette.gray.light}`
|
|
@@ -25053,7 +24671,7 @@ const ListCarriers$1 = ({
|
|
|
25053
24671
|
children: t("list-carriers:headers.accountCarriers")
|
|
25054
24672
|
}))
|
|
25055
24673
|
}), jsxRuntime.jsx("ul", Object.assign({
|
|
25056
|
-
css: styles$
|
|
24674
|
+
css: styles$6.listContainer
|
|
25057
24675
|
}, {
|
|
25058
24676
|
children: isLoading ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25059
24677
|
children: [jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {}), jsxRuntime.jsx(LoadingSkeletonRow, {})]
|
|
@@ -25074,10 +24692,10 @@ const ListCarriers$1 = ({
|
|
|
25074
24692
|
};
|
|
25075
24693
|
const LoadingSkeletonRow = () => {
|
|
25076
24694
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
25077
|
-
css: styles$
|
|
24695
|
+
css: styles$6.skeletonRow
|
|
25078
24696
|
}, {
|
|
25079
24697
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
25080
|
-
css: styles$
|
|
24698
|
+
css: styles$6.skeletonLogoContainer
|
|
25081
24699
|
}, {
|
|
25082
24700
|
children: [jsxRuntime.jsx(giger.Skeleton, {
|
|
25083
24701
|
animation: giger.SkeletonAnimation.WAVE,
|
|
@@ -25101,7 +24719,7 @@ const LoadingSkeletonRow = () => {
|
|
|
25101
24719
|
}));
|
|
25102
24720
|
};
|
|
25103
24721
|
|
|
25104
|
-
const styles$
|
|
24722
|
+
const styles$5 = createStyles({
|
|
25105
24723
|
body: theme => ({
|
|
25106
24724
|
borderTop: `1px solid ${theme.palette.gray.light}`,
|
|
25107
24725
|
color: theme.palette.black,
|
|
@@ -25152,14 +24770,14 @@ const SettingsCard = ({
|
|
|
25152
24770
|
verticallyAligned
|
|
25153
24771
|
}) => {
|
|
25154
24772
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
25155
|
-
css: verticallyAligned ? styles$
|
|
24773
|
+
css: verticallyAligned ? styles$5.verticalContainer : styles$5.container,
|
|
25156
24774
|
"data-testid": "settingsCard"
|
|
25157
24775
|
}, {
|
|
25158
24776
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
25159
|
-
css: styles$
|
|
24777
|
+
css: styles$5.header
|
|
25160
24778
|
}, {
|
|
25161
24779
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
25162
|
-
css: styles$
|
|
24780
|
+
css: styles$5.title
|
|
25163
24781
|
}, {
|
|
25164
24782
|
children: [typeof title === "string" ? jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25165
24783
|
variant: "subtitle2"
|
|
@@ -25194,7 +24812,7 @@ const SettingsCard = ({
|
|
|
25194
24812
|
}))
|
|
25195
24813
|
}))]
|
|
25196
24814
|
})), children && jsxRuntime.jsx("div", Object.assign({
|
|
25197
|
-
css: styles$
|
|
24815
|
+
css: styles$5.body
|
|
25198
24816
|
}, {
|
|
25199
24817
|
children: jsxRuntime.jsxs("div", {
|
|
25200
24818
|
children: [children, accessoryAction && jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
@@ -25311,7 +24929,7 @@ const warehouseSchema = zod.z.discriminatedUnion("returnToAddressIsDifferent", [
|
|
|
25311
24929
|
});
|
|
25312
24930
|
});
|
|
25313
24931
|
|
|
25314
|
-
const styles$
|
|
24932
|
+
const styles$4 = createStyles({
|
|
25315
24933
|
header: {
|
|
25316
24934
|
textAlign: "center"
|
|
25317
24935
|
},
|
|
@@ -25363,12 +24981,12 @@ const WarehouseForm = ({
|
|
|
25363
24981
|
}
|
|
25364
24982
|
}));
|
|
25365
24983
|
return jsxRuntime.jsxs("div", Object.assign({
|
|
25366
|
-
css: _isOnboarding ? styles$
|
|
24984
|
+
css: _isOnboarding ? styles$4.onboardingWell : styles$4.well,
|
|
25367
24985
|
"data-testid": "warehouse-form"
|
|
25368
24986
|
}, {
|
|
25369
24987
|
children: [_isOnboarding && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25370
24988
|
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
25371
|
-
css: styles$
|
|
24989
|
+
css: styles$4.header
|
|
25372
24990
|
}, {
|
|
25373
24991
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
25374
24992
|
variant: "heading4"
|
|
@@ -26572,21 +26190,84 @@ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
26572
26190
|
}
|
|
26573
26191
|
});
|
|
26574
26192
|
|
|
26575
|
-
const
|
|
26576
|
-
|
|
26193
|
+
const CompletionPage = ({
|
|
26194
|
+
onContinue
|
|
26577
26195
|
}) => {
|
|
26578
26196
|
const {
|
|
26579
26197
|
t
|
|
26580
|
-
} = reactI18next.useTranslation();
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26584
|
-
|
|
26198
|
+
} = reactI18next.useTranslation(["common", "onboarding"]);
|
|
26199
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
26200
|
+
css: {
|
|
26201
|
+
alignItems: "center",
|
|
26202
|
+
display: "flex",
|
|
26203
|
+
flexDirection: "column"
|
|
26204
|
+
},
|
|
26205
|
+
"data-testid": "onboarding-complete"
|
|
26206
|
+
}, {
|
|
26207
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26208
|
+
variant: "heading4"
|
|
26585
26209
|
}, {
|
|
26586
|
-
children:
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26210
|
+
children: t("onboarding:success.title")
|
|
26211
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26212
|
+
multiplier: 2
|
|
26213
|
+
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26214
|
+
variant: "subtitle1"
|
|
26215
|
+
}, {
|
|
26216
|
+
children: t("onboarding:success.subtitle")
|
|
26217
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26218
|
+
multiplier: 10
|
|
26219
|
+
}), jsxRuntime.jsxs("svg", Object.assign({
|
|
26220
|
+
fill: "none",
|
|
26221
|
+
height: "86",
|
|
26222
|
+
viewBox: "0 0 86 86",
|
|
26223
|
+
width: "86",
|
|
26224
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
26225
|
+
}, {
|
|
26226
|
+
children: [jsxRuntime.jsx("circle", {
|
|
26227
|
+
cx: "43",
|
|
26228
|
+
cy: "43.3379",
|
|
26229
|
+
fill: "#E8F6FF",
|
|
26230
|
+
r: "42.5"
|
|
26231
|
+
}), jsxRuntime.jsx("path", {
|
|
26232
|
+
d: "M56.6583 26.4724C57.2882 25.8425 58.3095 25.8425 58.9393 26.4724L64.1038 31.6369C64.7337 32.2668 64.7337 33.288 64.1038 33.9179L37.8303 60.1915L30.3848 52.746L56.6583 26.4724Z",
|
|
26233
|
+
fill: "#006FBB"
|
|
26234
|
+
}), jsxRuntime.jsx("path", {
|
|
26235
|
+
d: "M21.4724 43.8446C20.8425 43.2147 20.8425 42.1935 21.4724 41.5636L26.4689 36.5671C27.0988 35.9372 28.12 35.9372 28.7499 36.5671L45.1032 52.9204L37.8257 60.1979L21.4724 43.8446Z",
|
|
26236
|
+
fill: "#006FBB"
|
|
26237
|
+
})]
|
|
26238
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
26239
|
+
multiplier: 10
|
|
26240
|
+
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
26241
|
+
justify: "center"
|
|
26242
|
+
}, {
|
|
26243
|
+
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
26244
|
+
bold: false,
|
|
26245
|
+
color: giger.ButtonColor.PRIMARY,
|
|
26246
|
+
onClick: onContinue,
|
|
26247
|
+
type: "button",
|
|
26248
|
+
variant: giger.ButtonVariant.FILLED
|
|
26249
|
+
}, {
|
|
26250
|
+
children: t("onboarding:success.action")
|
|
26251
|
+
}))
|
|
26252
|
+
}))]
|
|
26253
|
+
}));
|
|
26254
|
+
};
|
|
26255
|
+
|
|
26256
|
+
const BillingFields = ({
|
|
26257
|
+
form
|
|
26258
|
+
}) => {
|
|
26259
|
+
const {
|
|
26260
|
+
t
|
|
26261
|
+
} = reactI18next.useTranslation();
|
|
26262
|
+
const expirationMonthOptions = useExpirationMonthOptions();
|
|
26263
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
26264
|
+
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26265
|
+
colSpan: 12
|
|
26266
|
+
}, {
|
|
26267
|
+
children: jsxRuntime.jsx(TextInput, {
|
|
26268
|
+
control: form.control,
|
|
26269
|
+
label: t("billing.fields.name"),
|
|
26270
|
+
labelWeight: "normal",
|
|
26590
26271
|
name: "creditCard.name",
|
|
26591
26272
|
nativeLabel: true
|
|
26592
26273
|
})
|
|
@@ -26757,7 +26438,7 @@ const EditWalletAddressForm = ({
|
|
|
26757
26438
|
}));
|
|
26758
26439
|
};
|
|
26759
26440
|
|
|
26760
|
-
const styles$
|
|
26441
|
+
const styles$3 = createStyles({
|
|
26761
26442
|
grid: theme => ({
|
|
26762
26443
|
margin: theme.spacing(4)
|
|
26763
26444
|
}),
|
|
@@ -26805,21 +26486,21 @@ const WalletForm = ({
|
|
|
26805
26486
|
onSubmit: formLogger.capture(handleSubmit)
|
|
26806
26487
|
}, {
|
|
26807
26488
|
children: jsxRuntime.jsxs(giger.Grid, Object.assign({
|
|
26808
|
-
css: styles$
|
|
26489
|
+
css: styles$3.grid,
|
|
26809
26490
|
noPadding: true
|
|
26810
26491
|
}, {
|
|
26811
26492
|
children: [jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26812
26493
|
colSpan: 12
|
|
26813
26494
|
}, {
|
|
26814
26495
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26815
|
-
css: styles$
|
|
26496
|
+
css: styles$3.heading,
|
|
26816
26497
|
variant: "heading4"
|
|
26817
26498
|
}, {
|
|
26818
26499
|
children: t("register-wallet:sections.billing.title")
|
|
26819
26500
|
}))
|
|
26820
26501
|
})), jsxRuntime.jsx(giger.GridChild, Object.assign({
|
|
26821
26502
|
colSpan: 12,
|
|
26822
|
-
css: styles$
|
|
26503
|
+
css: styles$3.subtitle
|
|
26823
26504
|
}, {
|
|
26824
26505
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26825
26506
|
variant: "subtitle1"
|
|
@@ -26841,7 +26522,7 @@ const WalletForm = ({
|
|
|
26841
26522
|
colSpan: 12
|
|
26842
26523
|
}, {
|
|
26843
26524
|
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
26844
|
-
css: styles$
|
|
26525
|
+
css: styles$3.subtitle,
|
|
26845
26526
|
variant: "subtitle1"
|
|
26846
26527
|
}, {
|
|
26847
26528
|
children: t("register-wallet:sections.billing.addressSubTitle")
|
|
@@ -26908,7 +26589,7 @@ const WalletForm = ({
|
|
|
26908
26589
|
}));
|
|
26909
26590
|
};
|
|
26910
26591
|
|
|
26911
|
-
const styles = createStyles({
|
|
26592
|
+
const styles$2 = createStyles({
|
|
26912
26593
|
lastStep: {
|
|
26913
26594
|
"& > span::first-of-type": {
|
|
26914
26595
|
"::after": {
|
|
@@ -27013,40 +26694,9 @@ const Onboarding$1 = ({
|
|
|
27013
26694
|
var _a;
|
|
27014
26695
|
// Step 5: Onboarding Complete
|
|
27015
26696
|
if (hasCompletedOnboarding) {
|
|
27016
|
-
return jsxRuntime.
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
display: "flex",
|
|
27020
|
-
flexDirection: "column"
|
|
27021
|
-
},
|
|
27022
|
-
"data-testid": "onboarding-complete"
|
|
27023
|
-
}, {
|
|
27024
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27025
|
-
variant: "heading4"
|
|
27026
|
-
}, {
|
|
27027
|
-
children: t("onboarding:success.title")
|
|
27028
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
27029
|
-
multiplier: 2
|
|
27030
|
-
}), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27031
|
-
variant: "subtitle1"
|
|
27032
|
-
}, {
|
|
27033
|
-
children: t("onboarding:success.subtitle")
|
|
27034
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
27035
|
-
multiplier: 48
|
|
27036
|
-
}), jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
27037
|
-
justify: "center"
|
|
27038
|
-
}, {
|
|
27039
|
-
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27040
|
-
bold: false,
|
|
27041
|
-
color: giger.ButtonColor.PRIMARY,
|
|
27042
|
-
onClick: onCompleteOnboarding,
|
|
27043
|
-
type: "button",
|
|
27044
|
-
variant: giger.ButtonVariant.FILLED
|
|
27045
|
-
}, {
|
|
27046
|
-
children: t("onboarding:success.action")
|
|
27047
|
-
}))
|
|
27048
|
-
}))]
|
|
27049
|
-
}));
|
|
26697
|
+
return jsxRuntime.jsx(CompletionPage, {
|
|
26698
|
+
onContinue: onCompleteOnboarding
|
|
26699
|
+
});
|
|
27050
26700
|
}
|
|
27051
26701
|
// Step 1: Landing Page
|
|
27052
26702
|
if (!email) return jsxRuntime.jsx(LandingPage, {
|
|
@@ -27122,16 +26772,16 @@ const Onboarding$1 = ({
|
|
|
27122
26772
|
currentStep: currentStep
|
|
27123
26773
|
}, {
|
|
27124
26774
|
children: [jsxRuntime.jsx(giger.Step, {
|
|
27125
|
-
css: styles.step,
|
|
26775
|
+
css: styles$2.step,
|
|
27126
26776
|
label: t("onboarding:steps.login")
|
|
27127
26777
|
}), jsxRuntime.jsx(giger.Step, {
|
|
27128
|
-
css: styles.step,
|
|
26778
|
+
css: styles$2.step,
|
|
27129
26779
|
label: t("onboarding:steps.carriers")
|
|
27130
26780
|
}), jsxRuntime.jsx(giger.Step, {
|
|
27131
|
-
css: styles.step,
|
|
26781
|
+
css: styles$2.step,
|
|
27132
26782
|
label: t("onboarding:steps.addresses")
|
|
27133
26783
|
}), jsxRuntime.jsx(giger.Step, {
|
|
27134
|
-
css: styles.lastStep,
|
|
26784
|
+
css: styles$2.lastStep,
|
|
27135
26785
|
label: t("onboarding:steps.payment")
|
|
27136
26786
|
})]
|
|
27137
26787
|
})), renderStep()]
|
|
@@ -27185,24 +26835,567 @@ const Cube = _a => {
|
|
|
27185
26835
|
}, props, {
|
|
27186
26836
|
role: "status"
|
|
27187
26837
|
}, {
|
|
27188
|
-
children: jsxRuntime.jsx("svg", Object.assign({
|
|
27189
|
-
css: styles.content,
|
|
27190
|
-
height: "100%",
|
|
27191
|
-
viewBox: "0 0 489 489",
|
|
27192
|
-
width: "100%"
|
|
26838
|
+
children: jsxRuntime.jsx("svg", Object.assign({
|
|
26839
|
+
css: styles.content,
|
|
26840
|
+
height: "100%",
|
|
26841
|
+
viewBox: "0 0 489 489",
|
|
26842
|
+
width: "100%"
|
|
26843
|
+
}, {
|
|
26844
|
+
children: jsxRuntime.jsx("g", {
|
|
26845
|
+
children: jsxRuntime.jsx("g", {
|
|
26846
|
+
children: jsxRuntime.jsx("path", {
|
|
26847
|
+
d: "M483.674,101.836C483.61,101.604 483.506,101.396 483.418,101.18C483.242,100.724 483.05,100.284 482.794,99.868C482.65,99.636 482.498,99.428 482.33,99.212C482.058,98.844 481.754,98.508 481.41,98.196C481.21,98.004 481.01,97.828 480.786,97.66C480.658,97.564 480.562,97.444 480.434,97.356C480.138,97.156 479.81,97.044 479.498,96.884C479.338,96.804 479.218,96.684 479.05,96.612L247.05,0.612C245.082,-0.204 242.89,-0.204 240.922,0.612L8.922,96.612C8.754,96.684 8.626,96.804 8.466,96.884C8.154,97.036 7.834,97.156 7.546,97.348C7.418,97.436 7.322,97.556 7.194,97.652C6.97,97.82 6.778,98.004 6.578,98.188C6.242,98.5 5.938,98.836 5.658,99.204C5.49,99.42 5.338,99.628 5.194,99.86C4.938,100.276 4.746,100.716 4.57,101.172C4.482,101.396 4.378,101.596 4.314,101.828C4.13,102.532 4.002,103.26 4.002,104.004L4.002,384.004C4.002,387.244 5.954,390.164 8.938,391.396L240.938,487.396C241.042,487.436 241.154,487.42 241.258,487.46C242.146,487.788 243.058,488.004 244.002,488.004C244.946,488.004 245.858,487.788 246.746,487.46C246.85,487.42 246.962,487.436 247.066,487.396L479.066,391.396C482.05,390.164 484.002,387.244 484.002,384.004L484.002,104.004C484.002,103.26 483.874,102.532 483.674,101.836ZM236.002,468.028L20.002,378.66L20.002,115.972L236.002,205.348L236.002,468.028ZM244.002,191.348L32.922,104.004L244.002,16.66L455.082,104.004L244.002,191.348ZM468.002,378.66L252.002,468.036L252.002,205.348L468.002,115.972L468.002,378.66Z",
|
|
26848
|
+
fill: theme.palette.primary.main
|
|
26849
|
+
})
|
|
26850
|
+
})
|
|
26851
|
+
})
|
|
26852
|
+
}))
|
|
26853
|
+
}));
|
|
26854
|
+
};
|
|
26855
|
+
|
|
26856
|
+
/**
|
|
26857
|
+
* A drop-in replacement for the `<form>` tag that allows nested forms.
|
|
26858
|
+
*
|
|
26859
|
+
* Via portals, the <form> tag is mounted as a sibling of the app root. The form's
|
|
26860
|
+
* interface is then mounted back at the point of use.
|
|
26861
|
+
*/
|
|
26862
|
+
const FormPortal = ({
|
|
26863
|
+
css,
|
|
26864
|
+
children,
|
|
26865
|
+
id,
|
|
26866
|
+
onSubmit,
|
|
26867
|
+
variant
|
|
26868
|
+
}) => {
|
|
26869
|
+
const rootTarget = useRootPortal();
|
|
26870
|
+
const [interfaceTarget, setInterfaceTarget] = React.useState(null);
|
|
26871
|
+
const onMountInterfaceTarget = React.useCallback(element => {
|
|
26872
|
+
if (element) setInterfaceTarget(element);
|
|
26873
|
+
}, []);
|
|
26874
|
+
const formStyle = [variant === "well" && (theme => ({
|
|
26875
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
26876
|
+
padding: theme.spacing(2)
|
|
26877
|
+
})), css];
|
|
26878
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
26879
|
+
children: [jsxRuntime.jsx(Portal, Object.assign({
|
|
26880
|
+
target: rootTarget
|
|
26881
|
+
}, {
|
|
26882
|
+
children: jsxRuntime.jsx("form", Object.assign({
|
|
26883
|
+
id: id,
|
|
26884
|
+
onSubmit: onSubmit
|
|
26885
|
+
}, {
|
|
26886
|
+
children: jsxRuntime.jsx(Portal, Object.assign({
|
|
26887
|
+
target: interfaceTarget
|
|
26888
|
+
}, {
|
|
26889
|
+
children: children
|
|
26890
|
+
}))
|
|
26891
|
+
}))
|
|
26892
|
+
})), jsxRuntime.jsx("section", {
|
|
26893
|
+
css: formStyle,
|
|
26894
|
+
id: id + "-interface",
|
|
26895
|
+
ref: onMountInterfaceTarget
|
|
26896
|
+
})]
|
|
26897
|
+
});
|
|
26898
|
+
};
|
|
26899
|
+
|
|
26900
|
+
const Loader = props => {
|
|
26901
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
26902
|
+
css: {
|
|
26903
|
+
alignItems: "center",
|
|
26904
|
+
display: "flex",
|
|
26905
|
+
flexDirection: "column",
|
|
26906
|
+
height: "100%",
|
|
26907
|
+
justifyContent: "center",
|
|
26908
|
+
textAlign: "center",
|
|
26909
|
+
width: "100%"
|
|
26910
|
+
}
|
|
26911
|
+
}, {
|
|
26912
|
+
children: jsxRuntime.jsx(giger.Spinner, Object.assign({}, props, {
|
|
26913
|
+
size: giger.SpinnerSize.SIZE_LARGE
|
|
26914
|
+
}))
|
|
26915
|
+
}));
|
|
26916
|
+
};
|
|
26917
|
+
|
|
26918
|
+
const getStyles$2 = ({
|
|
26919
|
+
isDisabled,
|
|
26920
|
+
isSelected
|
|
26921
|
+
} = {}) => createStyles({
|
|
26922
|
+
chip: theme => [isSelected ? {
|
|
26923
|
+
backgroundColor: theme.palette.secondary.ultraLight,
|
|
26924
|
+
color: theme.palette.secondary.main
|
|
26925
|
+
} : {
|
|
26926
|
+
backgroundColor: theme.palette.white,
|
|
26927
|
+
color: theme.palette.gray.main
|
|
26928
|
+
},
|
|
26929
|
+
// TODO [LMNT-663] - Giger's Chip component needs support added for an isDisabled prop
|
|
26930
|
+
isDisabled && {
|
|
26931
|
+
backgroundColor: theme.palette.gray.light,
|
|
26932
|
+
cursor: "none",
|
|
26933
|
+
pointerEvents: "none"
|
|
26934
|
+
}],
|
|
26935
|
+
chipList: theme => ({
|
|
26936
|
+
gap: theme.spacing(1)
|
|
26937
|
+
}),
|
|
26938
|
+
fundsInput: theme => ({
|
|
26939
|
+
maxWidth: theme.spacing(24)
|
|
26940
|
+
})
|
|
26941
|
+
});
|
|
26942
|
+
|
|
26943
|
+
const getAddFundsSchema = (minimumAmount = 10) => zod.z.object({
|
|
26944
|
+
funds: moneySchema.extend({
|
|
26945
|
+
amount: zod.z.number().min(minimumAmount)
|
|
26946
|
+
})
|
|
26947
|
+
}).transform(data => data.funds);
|
|
26948
|
+
|
|
26949
|
+
/**
|
|
26950
|
+
* Form for adding funds to a carrier's account.
|
|
26951
|
+
*
|
|
26952
|
+
* If a render child is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
26953
|
+
*/
|
|
26954
|
+
const AddFundsForm = ({
|
|
26955
|
+
carrierId,
|
|
26956
|
+
children,
|
|
26957
|
+
onCancel,
|
|
26958
|
+
onSuccess,
|
|
26959
|
+
minimumAmount: _minimumAmount = 0
|
|
26960
|
+
}) => {
|
|
26961
|
+
const {
|
|
26962
|
+
t
|
|
26963
|
+
} = reactI18next.useTranslation();
|
|
26964
|
+
const addFunds = react.useAddFunds(carrierId);
|
|
26965
|
+
const carrier = react.useGetCarrierById(carrierId);
|
|
26966
|
+
const chips = [{
|
|
26967
|
+
label: "$20",
|
|
26968
|
+
value: 20
|
|
26969
|
+
}, {
|
|
26970
|
+
label: "$50",
|
|
26971
|
+
value: 50
|
|
26972
|
+
}, {
|
|
26973
|
+
label: "$100",
|
|
26974
|
+
value: 100
|
|
26975
|
+
}, {
|
|
26976
|
+
label: t("manage-funding:addFunds.custom"),
|
|
26977
|
+
value: "custom"
|
|
26978
|
+
}];
|
|
26979
|
+
const [selectedChip, setSelectedChip] = React.useState(_minimumAmount > 0 ? chips[3] : chips[0]);
|
|
26980
|
+
_minimumAmount = Math.max(_minimumAmount, 10);
|
|
26981
|
+
const form = reactHookForm.useForm({
|
|
26982
|
+
defaultValues: {
|
|
26983
|
+
funds: {
|
|
26984
|
+
amount: selectedChip.value === "custom" ? _minimumAmount : selectedChip.value,
|
|
26985
|
+
currency: api.SE.Currency.USD
|
|
26986
|
+
}
|
|
26987
|
+
},
|
|
26988
|
+
resolver: validationResolver(getAddFundsSchema(_minimumAmount))
|
|
26989
|
+
});
|
|
26990
|
+
const {
|
|
26991
|
+
isSubmitted,
|
|
26992
|
+
isValid
|
|
26993
|
+
} = form.formState;
|
|
26994
|
+
const watchAmount = form.watch("funds").amount;
|
|
26995
|
+
const formId = "add-funds-form";
|
|
26996
|
+
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
26997
|
+
const payload = values;
|
|
26998
|
+
addFunds.mutate(payload, {
|
|
26999
|
+
onSuccess: () => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess()
|
|
27000
|
+
});
|
|
27001
|
+
}));
|
|
27002
|
+
if (carrier.isLoading) return jsxRuntime.jsx(Loader, {
|
|
27003
|
+
message: t("loading.carrier")
|
|
27004
|
+
});
|
|
27005
|
+
if (!carrier.data) throw new Error("errorMessages.unableToLoad.carrier");
|
|
27006
|
+
const balance = carrier.data.balance;
|
|
27007
|
+
if (balance === undefined) return jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
27008
|
+
type: giger.NotificationType.ERROR
|
|
27009
|
+
}, {
|
|
27010
|
+
children: t("manage-funding:errors.unableToFindBalance")
|
|
27011
|
+
}));
|
|
27012
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27013
|
+
children: [jsxRuntime.jsxs(FormPortal, Object.assign({
|
|
27014
|
+
id: formId,
|
|
27015
|
+
onSubmit: handleSubmit,
|
|
27016
|
+
variant: "well"
|
|
27017
|
+
}, {
|
|
27018
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27019
|
+
bold: true
|
|
27020
|
+
}, {
|
|
27021
|
+
children: t("manage-funding:actions.addFunds")
|
|
27022
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
27023
|
+
multiplier: 2
|
|
27024
|
+
}), jsxRuntime.jsx(giger.ChipList, Object.assign({
|
|
27025
|
+
css: getStyles$2().chipList,
|
|
27026
|
+
onChange: idx => {
|
|
27027
|
+
const chip = chips[idx];
|
|
27028
|
+
setSelectedChip(chip);
|
|
27029
|
+
if (chip.value !== "custom") {
|
|
27030
|
+
form.reset({
|
|
27031
|
+
funds: {
|
|
27032
|
+
amount: chip.value,
|
|
27033
|
+
currency: api.SE.Currency.USD
|
|
27034
|
+
}
|
|
27035
|
+
});
|
|
27036
|
+
}
|
|
27037
|
+
}
|
|
27038
|
+
}, {
|
|
27039
|
+
children: chips.map(chip => jsxRuntime.jsx(giger.Chip, Object.assign({
|
|
27040
|
+
css: getStyles$2({
|
|
27041
|
+
isDisabled: chip.value < _minimumAmount,
|
|
27042
|
+
isSelected: chip.value === selectedChip.value
|
|
27043
|
+
}).chip,
|
|
27044
|
+
isSelected: chip.value === selectedChip.value
|
|
27045
|
+
}, {
|
|
27046
|
+
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27047
|
+
variant: "small"
|
|
27048
|
+
}, {
|
|
27049
|
+
children: chip.label
|
|
27050
|
+
}))
|
|
27051
|
+
}), chip.label))
|
|
27052
|
+
})), selectedChip.value === "custom" && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27053
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
27054
|
+
multiplier: 1
|
|
27055
|
+
}), jsxRuntime.jsx(MoneyInput, {
|
|
27056
|
+
control: form.control,
|
|
27057
|
+
css: getStyles$2().fundsInput,
|
|
27058
|
+
defaultValue: {
|
|
27059
|
+
amount: undefined,
|
|
27060
|
+
currency: api.SE.Currency.USD
|
|
27061
|
+
},
|
|
27062
|
+
form: formId,
|
|
27063
|
+
hint: t("manage-funding:addFunds.minimumPurchaseAmount"),
|
|
27064
|
+
label: t("manage-funding:addFunds.labels.amount"),
|
|
27065
|
+
name: "funds",
|
|
27066
|
+
nativeLabel: true,
|
|
27067
|
+
showCurrencySymbol: true
|
|
27068
|
+
})]
|
|
27069
|
+
}), !children && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27070
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
27071
|
+
multiplier: selectedChip.value !== "custom" ? 1.5 : 1
|
|
27072
|
+
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
27073
|
+
justify: "end"
|
|
27074
|
+
}, {
|
|
27075
|
+
children: [onCancel && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27076
|
+
onClick: onCancel,
|
|
27077
|
+
variant: giger.ButtonVariant.TEXT
|
|
27078
|
+
}, {
|
|
27079
|
+
children: t("actions.cancel")
|
|
27080
|
+
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
27081
|
+
control: form.control,
|
|
27082
|
+
form: formId,
|
|
27083
|
+
isLoading: addFunds.isLoading,
|
|
27084
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
27085
|
+
}, {
|
|
27086
|
+
children: t("manage-funding:actions.addNow")
|
|
27087
|
+
}))]
|
|
27088
|
+
}))]
|
|
27089
|
+
})]
|
|
27090
|
+
})), addFunds.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27091
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
27092
|
+
multiplier: 1
|
|
27093
|
+
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
27094
|
+
title: t("manage-funding:addFunds.error.title"),
|
|
27095
|
+
type: giger.NotificationType.ERROR
|
|
27096
|
+
}, {
|
|
27097
|
+
children: addFunds.error[0].message
|
|
27098
|
+
}))]
|
|
27099
|
+
}), children === null || children === void 0 ? void 0 : children({
|
|
27100
|
+
isCustomAmount: selectedChip.value === "custom",
|
|
27101
|
+
isSubmitted,
|
|
27102
|
+
isSubmitting: addFunds.isLoading,
|
|
27103
|
+
isValid,
|
|
27104
|
+
selectedAmount: watchAmount,
|
|
27105
|
+
submit: handleSubmit
|
|
27106
|
+
})]
|
|
27107
|
+
});
|
|
27108
|
+
};
|
|
27109
|
+
|
|
27110
|
+
const InlineLabel = ({
|
|
27111
|
+
children,
|
|
27112
|
+
label
|
|
27113
|
+
}) => jsxRuntime.jsxs("div", Object.assign({
|
|
27114
|
+
css: theme => ({
|
|
27115
|
+
alignItems: "center",
|
|
27116
|
+
display: "flex",
|
|
27117
|
+
gap: theme.spacing(1)
|
|
27118
|
+
})
|
|
27119
|
+
}, {
|
|
27120
|
+
children: [jsxRuntime.jsx(giger.Typography, {
|
|
27121
|
+
children: label
|
|
27122
|
+
}), children]
|
|
27123
|
+
}));
|
|
27124
|
+
|
|
27125
|
+
const getStyles$1 = balance => createStyles({
|
|
27126
|
+
balanceText: theme => ({
|
|
27127
|
+
color: balance === undefined ? theme.palette.alert.main : balance >= 0 ? theme.palette.secondary.dark : theme.palette.error.main
|
|
27128
|
+
})
|
|
27129
|
+
});
|
|
27130
|
+
|
|
27131
|
+
const CarrierBalance = ({
|
|
27132
|
+
carrierId
|
|
27133
|
+
}) => {
|
|
27134
|
+
const {
|
|
27135
|
+
t
|
|
27136
|
+
} = reactI18next.useTranslation();
|
|
27137
|
+
const {
|
|
27138
|
+
data: carrier,
|
|
27139
|
+
isLoading: isLoadingCarrier,
|
|
27140
|
+
isRefetching: isRefetchingCarrier
|
|
27141
|
+
} = react.useGetCarrierById(carrierId);
|
|
27142
|
+
const balance = carrier === null || carrier === void 0 ? void 0 : carrier.balance;
|
|
27143
|
+
return jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
27144
|
+
label: t("manage-funding:currentBalance")
|
|
27145
|
+
}, {
|
|
27146
|
+
children: isLoadingCarrier || isRefetchingCarrier ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27147
|
+
bold: true,
|
|
27148
|
+
css: getStyles$1(balance).balanceText
|
|
27149
|
+
}, {
|
|
27150
|
+
children: balance === undefined ? t("manage-funding:errors.balanceUnknown") : formatMoney({
|
|
27151
|
+
amount: balance,
|
|
27152
|
+
currency: api.SE.Currency.USD
|
|
27153
|
+
})
|
|
27154
|
+
}))
|
|
27155
|
+
}));
|
|
27156
|
+
};
|
|
27157
|
+
|
|
27158
|
+
const icons = {
|
|
27159
|
+
add: brands.IconNames.ADD,
|
|
27160
|
+
download: brands.IconNames.DOWNLOAD
|
|
27161
|
+
};
|
|
27162
|
+
const LinkAction = _a => {
|
|
27163
|
+
var {
|
|
27164
|
+
css,
|
|
27165
|
+
icon,
|
|
27166
|
+
isDisabled,
|
|
27167
|
+
isLoading,
|
|
27168
|
+
title
|
|
27169
|
+
} = _a,
|
|
27170
|
+
props = __rest(_a, ["css", "icon", "isDisabled", "isLoading", "title"]);
|
|
27171
|
+
return jsxRuntime.jsx(giger.Link, Object.assign({}, props, {
|
|
27172
|
+
bold: true,
|
|
27173
|
+
css: theme => [{
|
|
27174
|
+
alignItems: "center",
|
|
27175
|
+
display: "flex",
|
|
27176
|
+
gap: theme.spacing(1)
|
|
27177
|
+
},
|
|
27178
|
+
// TODO [LMNT-663] - Giger's Link component does not render isDisabled state unless isButton is true
|
|
27179
|
+
(isDisabled || isLoading) && {
|
|
27180
|
+
color: theme.palette.gray.main,
|
|
27181
|
+
cursor: "none",
|
|
27182
|
+
pointerEvents: "none"
|
|
27183
|
+
}, css],
|
|
27184
|
+
isDisabled: isDisabled,
|
|
27185
|
+
size: giger.ButtonSize.MEDIUM
|
|
27186
|
+
}, {
|
|
27187
|
+
children: isLoading ? jsxRuntime.jsx(giger.Spinner, {}) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27188
|
+
children: [title, icon && jsxRuntime.jsx(giger.Icon, {
|
|
27189
|
+
name: icons[icon],
|
|
27190
|
+
size: giger.IconSize.SIZE_MEDIUM,
|
|
27191
|
+
title: title
|
|
27192
|
+
})]
|
|
27193
|
+
})
|
|
27194
|
+
}));
|
|
27195
|
+
};
|
|
27196
|
+
|
|
27197
|
+
const Spread = ({
|
|
27198
|
+
children
|
|
27199
|
+
}) => jsxRuntime.jsx("div", Object.assign({
|
|
27200
|
+
css: theme => ({
|
|
27201
|
+
display: "flex",
|
|
27202
|
+
gap: theme.spacing(2),
|
|
27203
|
+
justifyContent: "space-between"
|
|
27204
|
+
})
|
|
27205
|
+
}, {
|
|
27206
|
+
children: children
|
|
27207
|
+
}));
|
|
27208
|
+
|
|
27209
|
+
const getStyles = isCustomAmount => createStyles({
|
|
27210
|
+
balanceText: theme => ({
|
|
27211
|
+
color: theme.palette.secondary.dark
|
|
27212
|
+
}),
|
|
27213
|
+
container: theme => ({
|
|
27214
|
+
padding: theme.spacing(3)
|
|
27215
|
+
}),
|
|
27216
|
+
formExtension: theme => ({
|
|
27217
|
+
backgroundColor: theme.palette.gray.ultraLight,
|
|
27218
|
+
display: "flex",
|
|
27219
|
+
flexDirection: "column",
|
|
27220
|
+
gap: theme.spacing(1),
|
|
27221
|
+
// Negative margin is to compensate for the padding on AddFundsForm, since we want this
|
|
27222
|
+
// section to seemlessly extend the form's well.
|
|
27223
|
+
marginTop: theme.spacing(isCustomAmount ? -1.5 : -1),
|
|
27224
|
+
padding: theme.spacing(2),
|
|
27225
|
+
paddingTop: 0
|
|
27226
|
+
}),
|
|
27227
|
+
saveRateButton: {
|
|
27228
|
+
whiteSpace: "nowrap"
|
|
27229
|
+
}
|
|
27230
|
+
});
|
|
27231
|
+
|
|
27232
|
+
/**
|
|
27233
|
+
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
27234
|
+
* has the necessary funds available and can add them if not. It allows a single button
|
|
27235
|
+
* to submit the funding form followed by the purchase form.
|
|
27236
|
+
*/
|
|
27237
|
+
const FundAndPurchase = ({
|
|
27238
|
+
carrierId,
|
|
27239
|
+
className,
|
|
27240
|
+
disabled,
|
|
27241
|
+
isFundingRequired,
|
|
27242
|
+
onSave,
|
|
27243
|
+
purchaseAmount,
|
|
27244
|
+
onPurchase
|
|
27245
|
+
}) => {
|
|
27246
|
+
const {
|
|
27247
|
+
t
|
|
27248
|
+
} = reactI18next.useTranslation();
|
|
27249
|
+
const [isAddFundsFormOpen, setIsAddFundsFormOpen] = React.useState(false);
|
|
27250
|
+
const {
|
|
27251
|
+
data: carrier,
|
|
27252
|
+
isLoading: isLoadingCarrier
|
|
27253
|
+
} = react.useGetCarrierById(carrierId);
|
|
27254
|
+
const isAddingFunds = !!reactQuery.useIsMutating({
|
|
27255
|
+
mutationKey: ["useAddFunds"]
|
|
27256
|
+
});
|
|
27257
|
+
const isCreatingLabel = !!reactQuery.useIsMutating({
|
|
27258
|
+
mutationKey: ["useCreateLabel"]
|
|
27259
|
+
});
|
|
27260
|
+
const [isSavingRate, setIsSavingRate] = React.useState(false);
|
|
27261
|
+
const handleSaveRate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27262
|
+
setIsSavingRate(true);
|
|
27263
|
+
yield onSave();
|
|
27264
|
+
setIsSavingRate(false);
|
|
27265
|
+
});
|
|
27266
|
+
// Automatically open the Add Funds form if the carrier's balance is insufficient.
|
|
27267
|
+
React.useEffect(() => {
|
|
27268
|
+
if (isFundingRequired && (carrier === null || carrier === void 0 ? void 0 : carrier.balance) !== undefined && carrier.balance < purchaseAmount) setIsAddFundsFormOpen(true);
|
|
27269
|
+
}, [carrier === null || carrier === void 0 ? void 0 : carrier.balance, isFundingRequired, purchaseAmount]);
|
|
27270
|
+
const renderActionButtons = (addFundsForm = {}) => jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
27271
|
+
justify: "end"
|
|
27272
|
+
}, {
|
|
27273
|
+
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27274
|
+
bold: false,
|
|
27275
|
+
css: getStyles().saveRateButton,
|
|
27276
|
+
disabled: disabled || !carrierId || isAddingFunds || isCreatingLabel,
|
|
27277
|
+
isLoading: isSavingRate,
|
|
27278
|
+
onClick: handleSaveRate,
|
|
27279
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
27280
|
+
}, {
|
|
27281
|
+
children: t("purchase-label:actions.saveRate")
|
|
27282
|
+
})), jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27283
|
+
"data-testid": "submit-fund-and-purchase",
|
|
27284
|
+
disabled: disabled || !carrierId || isFundingRequired && isAddFundsFormOpen && addFundsForm.isSubmitted && !addFundsForm.isValid,
|
|
27285
|
+
isLoading: addFundsForm.isSubmitting || isAddingFunds || isCreatingLabel,
|
|
27286
|
+
onClick: isAddFundsFormOpen ? addFundsForm.submit : onPurchase
|
|
27287
|
+
}, {
|
|
27288
|
+
children: isAddFundsFormOpen ? t("manage-funding:actions.addFundsAndPurchase") : t("purchase-label:actions.purchaseNow")
|
|
27289
|
+
}))]
|
|
27290
|
+
}));
|
|
27291
|
+
if (!isFundingRequired) return jsxRuntime.jsx("div", Object.assign({
|
|
27292
|
+
className: className,
|
|
27293
|
+
css: getStyles().container
|
|
27294
|
+
}, {
|
|
27295
|
+
children: renderActionButtons()
|
|
27296
|
+
}));
|
|
27297
|
+
if (isLoadingCarrier) return jsxRuntime.jsx(Loader, {
|
|
27298
|
+
message: t("loading.carrier")
|
|
27299
|
+
});
|
|
27300
|
+
if (!carrier || !carrierId) throw new Error("errorMessages.unableToLoad.carrier");
|
|
27301
|
+
const balance = carrier.balance;
|
|
27302
|
+
const handleAddFundsSuccess = () => {
|
|
27303
|
+
setIsAddFundsFormOpen(false);
|
|
27304
|
+
onPurchase();
|
|
27305
|
+
};
|
|
27306
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
27307
|
+
className: className,
|
|
27308
|
+
css: getStyles().container
|
|
27309
|
+
}, {
|
|
27310
|
+
children: [jsxRuntime.jsxs(Spread, {
|
|
27311
|
+
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
27312
|
+
carrierId: carrierId
|
|
27313
|
+
}), jsxRuntime.jsx(LinkAction, {
|
|
27314
|
+
icon: "add",
|
|
27315
|
+
isDisabled: isAddFundsFormOpen || isAddingFunds || isCreatingLabel,
|
|
27316
|
+
onClick: () => setIsAddFundsFormOpen(true),
|
|
27317
|
+
title: t("manage-funding:actions.addFunds")
|
|
27318
|
+
})]
|
|
27319
|
+
}), jsxRuntime.jsx(Spacer, {
|
|
27320
|
+
multiplier: 2
|
|
27321
|
+
}), balance < purchaseAmount && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27322
|
+
children: [jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
27323
|
+
title: t(`manage-funding:fundAndPurchase.${balance < 0 ? "negativeBalanceTitle" : "insufficientFundsTitle"}`),
|
|
27324
|
+
type: giger.NotificationType.ALERT
|
|
27325
|
+
}, {
|
|
27326
|
+
children: t(`manage-funding:fundAndPurchase.${balance < 0 ? "negativeBalance" : "insufficientFunds"}`)
|
|
27327
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
27328
|
+
multiplier: 2
|
|
27329
|
+
})]
|
|
27330
|
+
}), isAddFundsFormOpen ? jsxRuntime.jsx(AddFundsForm, Object.assign({
|
|
27331
|
+
carrierId: carrierId,
|
|
27332
|
+
minimumAmount: purchaseAmount - balance,
|
|
27333
|
+
onSuccess: handleAddFundsSuccess
|
|
27193
27334
|
}, {
|
|
27194
|
-
children:
|
|
27195
|
-
|
|
27196
|
-
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
}
|
|
27200
|
-
|
|
27201
|
-
|
|
27202
|
-
|
|
27335
|
+
children: addFundsForm => {
|
|
27336
|
+
var _a, _b;
|
|
27337
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27338
|
+
children: [jsxRuntime.jsxs("section", Object.assign({
|
|
27339
|
+
css: getStyles(addFundsForm.isCustomAmount).formExtension
|
|
27340
|
+
}, {
|
|
27341
|
+
children: [jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
27342
|
+
label: t("manage-funding:fundAndPurchase.newBalance")
|
|
27343
|
+
}, {
|
|
27344
|
+
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27345
|
+
css: getStyles().balanceText
|
|
27346
|
+
}, {
|
|
27347
|
+
children: formatMoney({
|
|
27348
|
+
amount: balance + ((_a = addFundsForm.selectedAmount) !== null && _a !== void 0 ? _a : 0),
|
|
27349
|
+
currency: api.SE.Currency.USD
|
|
27350
|
+
})
|
|
27351
|
+
}))
|
|
27352
|
+
})), jsxRuntime.jsx(InlineLabel, Object.assign({
|
|
27353
|
+
label: t("manage-funding:fundAndPurchase.finalBalance")
|
|
27354
|
+
}, {
|
|
27355
|
+
children: jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27356
|
+
css: getStyles().balanceText
|
|
27357
|
+
}, {
|
|
27358
|
+
children: formatMoney({
|
|
27359
|
+
amount: balance + ((_b = addFundsForm.selectedAmount) !== null && _b !== void 0 ? _b : 0) - purchaseAmount,
|
|
27360
|
+
currency: api.SE.Currency.USD
|
|
27361
|
+
})
|
|
27362
|
+
}))
|
|
27363
|
+
})), balance >= purchaseAmount && jsxRuntime.jsx(ButtonGroup, Object.assign({
|
|
27364
|
+
justify: "end"
|
|
27365
|
+
}, {
|
|
27366
|
+
children: jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27367
|
+
onClick: () => setIsAddFundsFormOpen(false),
|
|
27368
|
+
variant: giger.ButtonVariant.TEXT
|
|
27369
|
+
}, {
|
|
27370
|
+
children: t("actions.cancel")
|
|
27371
|
+
}))
|
|
27372
|
+
}))]
|
|
27373
|
+
})), jsxRuntime.jsx(Spacer, {
|
|
27374
|
+
multiplier: 2
|
|
27375
|
+
}), renderActionButtons(addFundsForm)]
|
|
27376
|
+
});
|
|
27377
|
+
}
|
|
27378
|
+
})) : renderActionButtons()]
|
|
27203
27379
|
}));
|
|
27204
27380
|
};
|
|
27205
27381
|
|
|
27382
|
+
const styles$1 = createStyles({
|
|
27383
|
+
fundAndPurchase: theme => ({
|
|
27384
|
+
borderTop: `1px solid ${theme.palette.gray.ultraLight}`
|
|
27385
|
+
}),
|
|
27386
|
+
ratesInterstitial: {
|
|
27387
|
+
alignItems: "center",
|
|
27388
|
+
display: "flex",
|
|
27389
|
+
flexDirection: "column",
|
|
27390
|
+
justifyContent: "center",
|
|
27391
|
+
textAlign: "center"
|
|
27392
|
+
},
|
|
27393
|
+
showMoreOrLessRatesButton: {
|
|
27394
|
+
alignItems: "center",
|
|
27395
|
+
display: "flex"
|
|
27396
|
+
}
|
|
27397
|
+
});
|
|
27398
|
+
|
|
27206
27399
|
const rateSchema = zod.z.object({
|
|
27207
27400
|
rate: zod.z.object({
|
|
27208
27401
|
isAcknowledged: zod.z.boolean().refine(v => v === true, "purchase-label:schemaErrors.needToAcknowledge"),
|
|
@@ -27231,7 +27424,7 @@ const RateForm = ({
|
|
|
27231
27424
|
}, features !== null && features !== void 0 ? features : {});
|
|
27232
27425
|
const {
|
|
27233
27426
|
t
|
|
27234
|
-
} = reactI18next.useTranslation(
|
|
27427
|
+
} = reactI18next.useTranslation();
|
|
27235
27428
|
const rateFormScrollToRef = React.useRef(null);
|
|
27236
27429
|
const [showHiddenRates, setShowHiddenRates] = React.useState(false);
|
|
27237
27430
|
const form = reactHookForm.useForm({
|
|
@@ -27244,16 +27437,13 @@ const RateForm = ({
|
|
|
27244
27437
|
mode: "onChange",
|
|
27245
27438
|
resolver: validationResolver(rateSchema)
|
|
27246
27439
|
});
|
|
27247
|
-
const {
|
|
27248
|
-
isDirty
|
|
27249
|
-
} = form.formState;
|
|
27250
27440
|
const {
|
|
27251
27441
|
rateId: selectedRateId
|
|
27252
27442
|
} = form.watch("rate");
|
|
27253
|
-
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
27443
|
+
const handleSubmit = formLogger.capture(form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
27254
27444
|
const rateId = values;
|
|
27255
27445
|
yield onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(rateId);
|
|
27256
|
-
}));
|
|
27446
|
+
})));
|
|
27257
27447
|
const rateOptions = useRateOptions(rates, carriers, shipment, features.enableGlobalPostFiltering
|
|
27258
27448
|
// TODO: LMNT-677: fix RecommendedRate logic
|
|
27259
27449
|
// {
|
|
@@ -27275,13 +27465,10 @@ const RateForm = ({
|
|
|
27275
27465
|
);
|
|
27276
27466
|
|
|
27277
27467
|
const selectedRate = React.useMemo(() => rateOptions === null || rateOptions === void 0 ? void 0 : rateOptions.find(r => r.rateId === selectedRateId), [rateOptions, selectedRateId]);
|
|
27278
|
-
const [isRateSaving, setIsRateSaving] = React.useState(false);
|
|
27279
27468
|
const handleSaveRate = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
27280
27469
|
const isValid = yield form.trigger();
|
|
27281
27470
|
if (!isValid) return;
|
|
27282
|
-
setIsRateSaving(true);
|
|
27283
27471
|
if (selectedRate) yield onSave === null || onSave === void 0 ? void 0 : onSave(selectedRate);
|
|
27284
|
-
setIsRateSaving(false);
|
|
27285
27472
|
// sets the form to not be dirty, so that Save is disabled
|
|
27286
27473
|
form.reset(form.getValues());
|
|
27287
27474
|
}), [form, onSave, selectedRate]);
|
|
@@ -27310,15 +27497,6 @@ const RateForm = ({
|
|
|
27310
27497
|
}, 0);
|
|
27311
27498
|
}
|
|
27312
27499
|
}, [form, rateOptions, errors === null || errors === void 0 ? void 0 : errors.length]);
|
|
27313
|
-
const formatFundingAmount = selectedRate => {
|
|
27314
|
-
var _a;
|
|
27315
|
-
const totalRateAmount = getTotalRateAmount(selectedRate);
|
|
27316
|
-
const walletBalance = (_a = selectedRate.balance) !== null && _a !== void 0 ? _a : 0;
|
|
27317
|
-
return formatMoney({
|
|
27318
|
-
amount: Math.max(totalRateAmount - walletBalance, 0),
|
|
27319
|
-
currency: api.SE.Currency.USD
|
|
27320
|
-
});
|
|
27321
|
-
};
|
|
27322
27500
|
return jsxRuntime.jsxs("form", Object.assign({
|
|
27323
27501
|
id: "rate-form",
|
|
27324
27502
|
onSubmit: handleSubmit,
|
|
@@ -27340,10 +27518,7 @@ const RateForm = ({
|
|
|
27340
27518
|
onClick: onSelectRate,
|
|
27341
27519
|
options: showHiddenRates ? rateOptions : filteredRateOptions
|
|
27342
27520
|
}), rateOptions.some(option => option.requiresAcknowledgement) && rateOptions.length > 5 && jsxRuntime.jsx(giger.Link, Object.assign({
|
|
27343
|
-
css:
|
|
27344
|
-
alignItems: "center",
|
|
27345
|
-
display: "flex"
|
|
27346
|
-
},
|
|
27521
|
+
css: styles$1.showMoreOrLessRatesButton,
|
|
27347
27522
|
onClick: () => {
|
|
27348
27523
|
var _a;
|
|
27349
27524
|
setShowHiddenRates(!showHiddenRates);
|
|
@@ -27364,13 +27539,7 @@ const RateForm = ({
|
|
|
27364
27539
|
}))
|
|
27365
27540
|
}))]
|
|
27366
27541
|
}) : !isLoading && errors && !!errors.length ? null : jsxRuntime.jsxs("article", Object.assign({
|
|
27367
|
-
css:
|
|
27368
|
-
alignItems: "center",
|
|
27369
|
-
display: "flex",
|
|
27370
|
-
flexDirection: "column",
|
|
27371
|
-
justifyContent: "center",
|
|
27372
|
-
textAlign: "center"
|
|
27373
|
-
},
|
|
27542
|
+
css: styles$1.ratesInterstitial,
|
|
27374
27543
|
role: "presentation"
|
|
27375
27544
|
}, {
|
|
27376
27545
|
children: [jsxRuntime.jsx(Cube, {
|
|
@@ -27388,63 +27557,19 @@ const RateForm = ({
|
|
|
27388
27557
|
}))]
|
|
27389
27558
|
}))]
|
|
27390
27559
|
})]
|
|
27391
|
-
})), jsxRuntime.
|
|
27392
|
-
|
|
27393
|
-
css:
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27401
|
-
variant: "body1"
|
|
27402
|
-
}, {
|
|
27403
|
-
children: t("purchase-label:balance.currentBalance")
|
|
27404
|
-
})), jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
27405
|
-
color: selectedRate.balance < 0 ? "error.main" : undefined
|
|
27406
|
-
}, {
|
|
27407
|
-
children: ` ${formatMoney({
|
|
27408
|
-
amount: selectedRate.balance,
|
|
27409
|
-
currency: api.SE.Currency.USD
|
|
27410
|
-
})}`
|
|
27411
|
-
})), jsxRuntime.jsx(Spacer, {
|
|
27412
|
-
multiplier: 2
|
|
27413
|
-
})]
|
|
27414
|
-
}), jsxRuntime.jsx("div", Object.assign({
|
|
27415
|
-
"data-testid": "actions"
|
|
27416
|
-
}, {
|
|
27417
|
-
children: jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
27418
|
-
"data-testid": "actions"
|
|
27419
|
-
}, {
|
|
27420
|
-
children: [(features === null || features === void 0 ? void 0 : features.saveRate) && jsxRuntime.jsx(giger.Button, Object.assign({
|
|
27421
|
-
bold: false,
|
|
27422
|
-
css: {
|
|
27423
|
-
whiteSpace: "nowrap"
|
|
27424
|
-
},
|
|
27425
|
-
disabled: !isDirty || disabled,
|
|
27426
|
-
isLoading: isRateSaving,
|
|
27427
|
-
onClick: handleSaveRate,
|
|
27428
|
-
variant: giger.ButtonVariant.OUTLINED
|
|
27429
|
-
}, {
|
|
27430
|
-
children: t("purchase-label:actions.saveRate")
|
|
27431
|
-
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
27432
|
-
alwaysRequireValidity: true,
|
|
27433
|
-
control: form.control,
|
|
27434
|
-
"data-testid": "purchaseLabel",
|
|
27435
|
-
disabled: !selectedRate || disabled,
|
|
27436
|
-
form: "rate-form",
|
|
27437
|
-
isFullWidth: true
|
|
27438
|
-
}, {
|
|
27439
|
-
children: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) ? `${t("purchase-label:actions.purchaseNow")} - ${formatFundingAmount(selectedRate)}` : t("purchase-label:actions.purchaseNow")
|
|
27440
|
-
}))]
|
|
27441
|
-
}))
|
|
27442
|
-
}))]
|
|
27443
|
-
}))]
|
|
27560
|
+
})), jsxRuntime.jsx(FundAndPurchase, {
|
|
27561
|
+
carrierId: selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.carrierId,
|
|
27562
|
+
css: styles$1.fundAndPurchase,
|
|
27563
|
+
disabled: disabled,
|
|
27564
|
+
isFundingRequired: (selectedRate === null || selectedRate === void 0 ? void 0 : selectedRate.balance) !== undefined && !!selectedRate.requiresFundedAmount,
|
|
27565
|
+
onPurchase: handleSubmit,
|
|
27566
|
+
onSave: handleSaveRate,
|
|
27567
|
+
purchaseAmount: getTotalRateAmount(selectedRate)
|
|
27568
|
+
})]
|
|
27444
27569
|
}));
|
|
27445
27570
|
};
|
|
27446
27571
|
|
|
27447
|
-
const
|
|
27572
|
+
const SuspendSalesOrder = ({
|
|
27448
27573
|
children,
|
|
27449
27574
|
errors,
|
|
27450
27575
|
isLoading,
|
|
@@ -27489,17 +27614,20 @@ const getTableWrapperStyles = theme => /*#__PURE__*/react$1.css({
|
|
|
27489
27614
|
}
|
|
27490
27615
|
}, process.env.NODE_ENV === "production" ? "" : ";label:getTableWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2dEIiwiZmlsZSI6Iml0ZW1zLWJyZWFrZG93bi5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcclxuZXhwb3J0IGNvbnN0IGdldE51bWVyaWNDZWxsU3R5bGUgPSAodGhlbWUpID0+IGNzcyh7XHJcbiAgICB0ZXh0QWxpZ246IFwicmlnaHRcIixcclxuICAgIHdpZHRoOiBcIjEwMHB4XCIsXHJcbn0pO1xyXG5leHBvcnQgY29uc3QgZ2V0VGFibGVXcmFwcGVyU3R5bGVzID0gKHRoZW1lKSA9PiBjc3Moe1xyXG4gICAgXCImJiA+IGRpdlwiOiB7XHJcbiAgICAgICAgYm94U2hhZG93OiBcIm5vbmVcIixcclxuICAgIH0sXHJcbiAgICBcIiYmID4gZGl2IHRhYmxlIHRoZWFkIHRoXCI6IHtcclxuICAgICAgICBmb250U3R5bGU6IFwiaXRhbGljXCIsXHJcbiAgICAgICAgZm9udFdlaWdodDogdGhlbWUudHlwb2dyYXBoeS5mb250V2VpZ2h0Lm5vcm1hbCxcclxuICAgIH0sXHJcbn0pO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1pdGVtcy1icmVha2Rvd24uc3R5bGVzLmpzLm1hcCJdfQ== */");
|
|
27491
27616
|
|
|
27492
|
-
const ItemsBreakdownTableHeader = (
|
|
27617
|
+
const ItemsBreakdownTableHeader = ({
|
|
27618
|
+
hasValue,
|
|
27619
|
+
hasTotal
|
|
27620
|
+
}) => jsxRuntime.jsx(giger.TableHeader, {
|
|
27493
27621
|
children: jsxRuntime.jsxs(giger.TableBaseRow, {
|
|
27494
27622
|
children: [jsxRuntime.jsx(giger.TableHeaderCell, {}), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27495
27623
|
css: getNumericCellStyle
|
|
27496
27624
|
}, {
|
|
27497
27625
|
children: "Qty"
|
|
27498
|
-
})), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27626
|
+
})), hasValue && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27499
27627
|
css: getNumericCellStyle
|
|
27500
27628
|
}, {
|
|
27501
27629
|
children: "$/ea"
|
|
27502
|
-
})), jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27630
|
+
})), hasTotal && jsxRuntime.jsx(giger.TableHeaderCell, Object.assign({
|
|
27503
27631
|
css: getNumericCellStyle
|
|
27504
27632
|
}, {
|
|
27505
27633
|
children: "$ Total"
|
|
@@ -27509,11 +27637,16 @@ const ItemsBreakdownTableHeader = () => jsxRuntime.jsx(giger.TableHeader, {
|
|
|
27509
27637
|
const ItemsBreakdown = ({
|
|
27510
27638
|
items
|
|
27511
27639
|
}) => {
|
|
27640
|
+
const hasValue = items.some(item => item.value !== undefined);
|
|
27641
|
+
const hasTotal = items.some(item => item.totalValue !== undefined);
|
|
27512
27642
|
return jsxRuntime.jsx("div", Object.assign({
|
|
27513
27643
|
css: getTableWrapperStyles
|
|
27514
27644
|
}, {
|
|
27515
27645
|
children: jsxRuntime.jsx(giger.Table, Object.assign({
|
|
27516
|
-
header: jsxRuntime.jsx(ItemsBreakdownTableHeader, {
|
|
27646
|
+
header: jsxRuntime.jsx(ItemsBreakdownTableHeader, {
|
|
27647
|
+
hasTotal: hasTotal,
|
|
27648
|
+
hasValue: hasValue
|
|
27649
|
+
})
|
|
27517
27650
|
}, {
|
|
27518
27651
|
children: jsxRuntime.jsx(giger.TableBody, {
|
|
27519
27652
|
children: items.map(({
|
|
@@ -27533,11 +27666,11 @@ const ItemsBreakdown = ({
|
|
|
27533
27666
|
css: getNumericCellStyle
|
|
27534
27667
|
}, {
|
|
27535
27668
|
children: quantity
|
|
27536
|
-
})), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27669
|
+
})), hasValue && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27537
27670
|
css: getNumericCellStyle
|
|
27538
27671
|
}, {
|
|
27539
|
-
children: formatMoney(value)
|
|
27540
|
-
})), jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27672
|
+
children: value && formatMoney(value)
|
|
27673
|
+
})), hasTotal && jsxRuntime.jsx(giger.TableBodyCell, Object.assign({
|
|
27541
27674
|
css: getNumericCellStyle
|
|
27542
27675
|
}, {
|
|
27543
27676
|
children: totalValue && formatMoney(totalValue)
|
|
@@ -27950,7 +28083,7 @@ const ShipmentForm = ({
|
|
|
27950
28083
|
warehouseId,
|
|
27951
28084
|
warehouses
|
|
27952
28085
|
}) => {
|
|
27953
|
-
var _a, _b, _c, _d;
|
|
28086
|
+
var _a, _b, _c, _d, _e;
|
|
27954
28087
|
features = Object.assign({
|
|
27955
28088
|
browseRates: true,
|
|
27956
28089
|
includeShipsuranceInsurance: true,
|
|
@@ -28123,8 +28256,8 @@ const ShipmentForm = ({
|
|
|
28123
28256
|
}
|
|
28124
28257
|
}, [form]);
|
|
28125
28258
|
const handleSubmit = form.handleSubmit(values => __awaiter(void 0, void 0, void 0, function* () {
|
|
28126
|
-
const
|
|
28127
|
-
payload = __rest(
|
|
28259
|
+
const _f = values,
|
|
28260
|
+
payload = __rest(_f, ["__mode"]);
|
|
28128
28261
|
const updatedShipment = yield onSubmit(Object.assign(Object.assign({}, shipment || {}), payload));
|
|
28129
28262
|
// Defer shipment hydration to the task queue so that the submission promise resolves first, otherwise the
|
|
28130
28263
|
// submission count will increment after hydration resets the form, keeping it in revalidate mode
|
|
@@ -28238,6 +28371,10 @@ const ShipmentForm = ({
|
|
|
28238
28371
|
} = form.getValues();
|
|
28239
28372
|
form.setValue("__mode", (features === null || features === void 0 ? void 0 : features.selectService) ? __mode : "browse_rates");
|
|
28240
28373
|
}, [form, features === null || features === void 0 ? void 0 : features.selectService]);
|
|
28374
|
+
const salesOrderItems = React.useMemo(() => getSalesOrderItemsFromSalesOrderOrShipment({
|
|
28375
|
+
salesOrder,
|
|
28376
|
+
shipment
|
|
28377
|
+
}), [salesOrder, shipment]);
|
|
28241
28378
|
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
28242
28379
|
message: t("loading.shipment")
|
|
28243
28380
|
});
|
|
@@ -28300,7 +28437,7 @@ const ShipmentForm = ({
|
|
|
28300
28437
|
}), jsxRuntime.jsx(Spacer, {
|
|
28301
28438
|
displayOn: isEditShipFormToOpen ? "tablet" : undefined,
|
|
28302
28439
|
multiplier: 2
|
|
28303
|
-
}), editShipToForm, jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28440
|
+
}), editShipToForm, (salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.orderDate) && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28304
28441
|
label: t("purchase-label:fields.orderDate")
|
|
28305
28442
|
}, {
|
|
28306
28443
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28308,7 +28445,7 @@ const ShipmentForm = ({
|
|
|
28308
28445
|
}, {
|
|
28309
28446
|
children: formatDate(salesOrder.orderDate)
|
|
28310
28447
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28311
|
-
})), jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28448
|
+
})), ((_b = salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.paymentDetails) === null || _b === void 0 ? void 0 : _b.grandTotal) && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28312
28449
|
label: t("purchase-label:fields.orderValue")
|
|
28313
28450
|
}, {
|
|
28314
28451
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28324,7 +28461,7 @@ const ShipmentForm = ({
|
|
|
28324
28461
|
}, {
|
|
28325
28462
|
children: requestedServices.length > 1 ? t("purchase-label:multipleShippingServices") : requestedServices[0].toString()
|
|
28326
28463
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28327
|
-
})), salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28464
|
+
})), salesOrder && salesOrder.paymentDetails.estimatedShipping.amount > 0 && jsxRuntime.jsxs(FieldLabel, Object.assign({
|
|
28328
28465
|
label: t("purchase-label:fields.estimatedShipping")
|
|
28329
28466
|
}, {
|
|
28330
28467
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
@@ -28332,7 +28469,7 @@ const ShipmentForm = ({
|
|
|
28332
28469
|
}, {
|
|
28333
28470
|
children: formatMoney(salesOrder.paymentDetails.estimatedShipping)
|
|
28334
28471
|
})), jsxRuntime.jsx(Spacer, {})]
|
|
28335
|
-
})),
|
|
28472
|
+
})), salesOrderItems.length > 0 && jsxRuntime.jsx(FieldLabel, Object.assign({
|
|
28336
28473
|
label: t("purchase-label:fields.items")
|
|
28337
28474
|
}, {
|
|
28338
28475
|
children: jsxRuntime.jsxs("div", Object.assign({
|
|
@@ -28344,7 +28481,7 @@ const ShipmentForm = ({
|
|
|
28344
28481
|
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
28345
28482
|
variant: "body2"
|
|
28346
28483
|
}, {
|
|
28347
|
-
children:
|
|
28484
|
+
children: salesOrderItems.length.toString()
|
|
28348
28485
|
})), jsxRuntime.jsxs(giger.Link, Object.assign({
|
|
28349
28486
|
css: theme => ({
|
|
28350
28487
|
alignItems: "center",
|
|
@@ -28363,15 +28500,7 @@ const ShipmentForm = ({
|
|
|
28363
28500
|
}))]
|
|
28364
28501
|
}))
|
|
28365
28502
|
})), showItems && jsxRuntime.jsx(ItemsBreakdown, {
|
|
28366
|
-
items:
|
|
28367
|
-
detail: `SKU ${item.lineItemDetails.sku}`,
|
|
28368
|
-
name: item.lineItemDetails.name,
|
|
28369
|
-
quantity: item.quantity,
|
|
28370
|
-
subDetail: item.requestedShippingOptions.shippingService,
|
|
28371
|
-
subDetailValue: item.priceSummary.estimatedShipping,
|
|
28372
|
-
totalValue: item.priceSummary.total,
|
|
28373
|
-
value: item.priceSummary.unitPrice
|
|
28374
|
-
}))
|
|
28503
|
+
items: salesOrderItems
|
|
28375
28504
|
})]
|
|
28376
28505
|
})), jsxRuntime.jsx("div", {
|
|
28377
28506
|
ref: customsItemErrorScrollToRef
|
|
@@ -28395,7 +28524,7 @@ const ShipmentForm = ({
|
|
|
28395
28524
|
}), jsxRuntime.jsx(CustomsItemsDisplay, {
|
|
28396
28525
|
onUpdate: handleUpdateCustomsItems,
|
|
28397
28526
|
shipment: shipment
|
|
28398
|
-
}), ((
|
|
28527
|
+
}), ((_c = customsErrors === null || customsErrors === void 0 ? void 0 : customsErrors.customsItems) === null || _c === void 0 ? void 0 : _c.type) === "too_small" && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
28399
28528
|
children: [jsxRuntime.jsx(Spacer, {}), jsxRuntime.jsx(giger.InlineNotification, {
|
|
28400
28529
|
title: t("purchase-label:errorMessages.customsItemsRequired"),
|
|
28401
28530
|
type: giger.NotificationType.ERROR
|
|
@@ -28555,7 +28684,7 @@ const ShipmentForm = ({
|
|
|
28555
28684
|
label: "purchase-label:fields.addOns"
|
|
28556
28685
|
}, {
|
|
28557
28686
|
children: [jsxRuntime.jsx(Switch, Object.assign({
|
|
28558
|
-
defaultChecked: ((
|
|
28687
|
+
defaultChecked: ((_d = shipment === null || shipment === void 0 ? void 0 : shipment.confirmation) !== null && _d !== void 0 ? _d : "none") !== "none",
|
|
28559
28688
|
label: t("purchase-label:fields.confirmation"),
|
|
28560
28689
|
name: "confirmationEnabled",
|
|
28561
28690
|
shouldUnmount: true,
|
|
@@ -28571,7 +28700,7 @@ const ShipmentForm = ({
|
|
|
28571
28700
|
shouldUnregister: true
|
|
28572
28701
|
})
|
|
28573
28702
|
})), jsxRuntime.jsxs(Switch, Object.assign({
|
|
28574
|
-
defaultChecked: ((
|
|
28703
|
+
defaultChecked: ((_e = shipment === null || shipment === void 0 ? void 0 : shipment.insuranceProvider) !== null && _e !== void 0 ? _e : "none") !== "none",
|
|
28575
28704
|
label: t("purchase-label:fields.insurance"),
|
|
28576
28705
|
name: "insuranceEnabled",
|
|
28577
28706
|
onChange: () => setInsuranceEnabled(true),
|
|
@@ -28860,6 +28989,30 @@ const Shipment$1 = ({
|
|
|
28860
28989
|
});
|
|
28861
28990
|
};
|
|
28862
28991
|
|
|
28992
|
+
const SuspendShipment = ({
|
|
28993
|
+
children,
|
|
28994
|
+
errors,
|
|
28995
|
+
isLoading,
|
|
28996
|
+
shipment
|
|
28997
|
+
}) => {
|
|
28998
|
+
const {
|
|
28999
|
+
t
|
|
29000
|
+
} = reactI18next.useTranslation(["common", "purchase-label"]);
|
|
29001
|
+
if (isLoading) return jsxRuntime.jsx(Loader, {
|
|
29002
|
+
message: t("loading.shipment")
|
|
29003
|
+
});
|
|
29004
|
+
if (errors) throw new Error(errors.map(e => e.message).join(", "));
|
|
29005
|
+
if (!shipment) throw new Error("errorMessages.unableToLoad.shipment");
|
|
29006
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
29007
|
+
css: {
|
|
29008
|
+
height: "100%",
|
|
29009
|
+
width: "100%"
|
|
29010
|
+
}
|
|
29011
|
+
}, {
|
|
29012
|
+
children: children
|
|
29013
|
+
}));
|
|
29014
|
+
};
|
|
29015
|
+
|
|
28863
29016
|
const VoidLabel$1 = ({
|
|
28864
29017
|
onComplete,
|
|
28865
29018
|
onSubmit,
|
|
@@ -28990,26 +29143,155 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
28990
29143
|
CarrierTermsForm: CarrierTermsForm,
|
|
28991
29144
|
CustomsItemForm: CustomsItemForm,
|
|
28992
29145
|
getCustomsItemFormSchema: getCustomsItemFormSchema,
|
|
28993
|
-
FundingMethods: FundingMethods,
|
|
28994
29146
|
Label: Label,
|
|
28995
29147
|
LandingPage: LandingPage,
|
|
28996
29148
|
ListCarriers: ListCarriers$1,
|
|
28997
29149
|
ManageWarehouses: ManageWarehouses$1,
|
|
28998
29150
|
Onboarding: Onboarding$1,
|
|
28999
29151
|
RateForm: RateForm,
|
|
29000
|
-
|
|
29152
|
+
SuspendSalesOrder: SuspendSalesOrder,
|
|
29001
29153
|
ShipmentForm: ShipmentForm,
|
|
29002
29154
|
schedulePickupForCarrier: schedulePickupForCarrier,
|
|
29003
29155
|
Shipment: Shipment$1,
|
|
29156
|
+
SuspendShipment: SuspendShipment,
|
|
29004
29157
|
WarehouseForm: WarehouseForm,
|
|
29005
29158
|
VoidLabel: VoidLabel$1,
|
|
29006
29159
|
WalletForm: WalletForm,
|
|
29007
|
-
styles: styles$
|
|
29160
|
+
styles: styles$3,
|
|
29008
29161
|
billingAddressSchema: billingAddressSchema,
|
|
29009
29162
|
walletSchema: walletSchema,
|
|
29010
29163
|
BillingFields: BillingFields
|
|
29011
29164
|
});
|
|
29012
29165
|
|
|
29166
|
+
const styles = createStyles({
|
|
29167
|
+
form: theme => ({
|
|
29168
|
+
backgroundColor: theme.palette.gray.megaLight,
|
|
29169
|
+
display: "flex",
|
|
29170
|
+
flexDirection: "column",
|
|
29171
|
+
gap: theme.spacing(2),
|
|
29172
|
+
padding: theme.spacing(2)
|
|
29173
|
+
})
|
|
29174
|
+
});
|
|
29175
|
+
|
|
29176
|
+
const autoFundingSchema = zod.z.object({
|
|
29177
|
+
isEnabled: zod.z.boolean(),
|
|
29178
|
+
lowBalancePurchaseThreshold: moneySchema.extend({
|
|
29179
|
+
amount: zod.z.number().min(25)
|
|
29180
|
+
}),
|
|
29181
|
+
maximumPurchasesPerDay: zod.z.number().min(1),
|
|
29182
|
+
purchaseAmount: moneySchema.extend({
|
|
29183
|
+
amount: zod.z.number().min(10).max(10000)
|
|
29184
|
+
})
|
|
29185
|
+
});
|
|
29186
|
+
|
|
29187
|
+
/**
|
|
29188
|
+
* This form that allows users to enable or disable auto funding, and
|
|
29189
|
+
* configure auto funding settings in ShipEngine API.
|
|
29190
|
+
*/
|
|
29191
|
+
const AutoFundingForm = ({
|
|
29192
|
+
carrierId
|
|
29193
|
+
}) => {
|
|
29194
|
+
const {
|
|
29195
|
+
t
|
|
29196
|
+
} = reactI18next.useTranslation();
|
|
29197
|
+
const updateAutoFunding = react.useUpdateAutoFunding(carrierId);
|
|
29198
|
+
const autoFundingConfiguration = react.useGetAutoFundingConfiguration();
|
|
29199
|
+
const form = reactHookForm.useForm({
|
|
29200
|
+
// TODO - [LMNT-663] We should probably make a hydration effect for autoFundingConfiguration.data
|
|
29201
|
+
defaultValues: autoFundingConfiguration.data,
|
|
29202
|
+
resolver: validationResolver(autoFundingSchema)
|
|
29203
|
+
});
|
|
29204
|
+
const {
|
|
29205
|
+
isDirty
|
|
29206
|
+
} = form.formState;
|
|
29207
|
+
const watchIsEnabled = form.watch("isEnabled");
|
|
29208
|
+
const handleSubmit = formLogger.capture(form.handleSubmit(values => {
|
|
29209
|
+
const payload = values;
|
|
29210
|
+
updateAutoFunding.mutate(payload, {
|
|
29211
|
+
onSuccess: () => autoFundingConfiguration.refetch()
|
|
29212
|
+
});
|
|
29213
|
+
}));
|
|
29214
|
+
const handleToggle = isEnabled => {
|
|
29215
|
+
form.reset(values => Object.assign(Object.assign({}, values), {
|
|
29216
|
+
isEnabled
|
|
29217
|
+
}));
|
|
29218
|
+
if (autoFundingConfiguration.data) {
|
|
29219
|
+
updateAutoFunding.mutate(Object.assign(Object.assign({}, autoFundingConfiguration.data), {
|
|
29220
|
+
isEnabled
|
|
29221
|
+
}), {
|
|
29222
|
+
onSuccess: x => autoFundingConfiguration.refetch()
|
|
29223
|
+
});
|
|
29224
|
+
} else {
|
|
29225
|
+
// TODO - [LMNT-663] Should this throw?
|
|
29226
|
+
react.logger.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
29227
|
+
}
|
|
29228
|
+
};
|
|
29229
|
+
if (autoFundingConfiguration.isLoading) return jsxRuntime.jsx(Loader, {
|
|
29230
|
+
message: t("manage-funding:autoFunding.isLoading")
|
|
29231
|
+
});
|
|
29232
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29233
|
+
children: [jsxRuntime.jsx(Switch, {
|
|
29234
|
+
defaultChecked: false,
|
|
29235
|
+
// defaultChecked={autoFundingConfiguration.data?.isEnabled}
|
|
29236
|
+
label: t("manage-funding:autoFunding.addFundsAutomatically"),
|
|
29237
|
+
name: "isEnabled",
|
|
29238
|
+
onChange: e => handleToggle(e.target.checked),
|
|
29239
|
+
value: true
|
|
29240
|
+
}), watchIsEnabled && jsxRuntime.jsxs("form", Object.assign({
|
|
29241
|
+
css: styles.form,
|
|
29242
|
+
id: "auto-funding-form",
|
|
29243
|
+
onSubmit: handleSubmit
|
|
29244
|
+
}, {
|
|
29245
|
+
children: [jsxRuntime.jsx(MoneyInput, {
|
|
29246
|
+
control: form.control,
|
|
29247
|
+
disabled: !watchIsEnabled,
|
|
29248
|
+
label: t("manage-funding:autoFunding.purchaseAmount"),
|
|
29249
|
+
name: "purchaseAmount",
|
|
29250
|
+
showCurrencySymbol: true
|
|
29251
|
+
}), jsxRuntime.jsx(MoneyInput, {
|
|
29252
|
+
control: form.control,
|
|
29253
|
+
disabled: !watchIsEnabled,
|
|
29254
|
+
label: t("manage-funding:autoFunding.lowBalancePurchaseThreshold"),
|
|
29255
|
+
name: "lowBalancePurchaseThreshold",
|
|
29256
|
+
showCurrencySymbol: true
|
|
29257
|
+
}), jsxRuntime.jsx(NumberInput, {
|
|
29258
|
+
control: form.control,
|
|
29259
|
+
disabled: !watchIsEnabled,
|
|
29260
|
+
isInteger: true,
|
|
29261
|
+
label: t("manage-funding:autoFunding.maximumPurchasesPerDay"),
|
|
29262
|
+
name: "maximumPurchasesPerDay"
|
|
29263
|
+
}), jsxRuntime.jsxs(ButtonGroup, Object.assign({
|
|
29264
|
+
justify: "end"
|
|
29265
|
+
}, {
|
|
29266
|
+
children: [jsxRuntime.jsx(giger.Button, Object.assign({
|
|
29267
|
+
disabled: !isDirty,
|
|
29268
|
+
onClick: () => form.reset(),
|
|
29269
|
+
variant: giger.ButtonVariant.TEXT
|
|
29270
|
+
}, {
|
|
29271
|
+
children: t("actions.cancel")
|
|
29272
|
+
})), jsxRuntime.jsx(SubmitButton, Object.assign({
|
|
29273
|
+
control: form.control,
|
|
29274
|
+
"data-testid": "submit-auto-funding",
|
|
29275
|
+
disabled: !watchIsEnabled,
|
|
29276
|
+
requireDirty: true,
|
|
29277
|
+
variant: giger.ButtonVariant.OUTLINED
|
|
29278
|
+
}, {
|
|
29279
|
+
children: t("manage-funding:actions.saveRule")
|
|
29280
|
+
}))]
|
|
29281
|
+
}))]
|
|
29282
|
+
})), autoFundingConfiguration.error && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29283
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
29284
|
+
multiplier: 1
|
|
29285
|
+
}), jsxRuntime.jsx(giger.InlineNotification, Object.assign({
|
|
29286
|
+
title: t("manage-funding:autoFunding.error.title"),
|
|
29287
|
+
type: giger.NotificationType.ERROR
|
|
29288
|
+
}, {
|
|
29289
|
+
children: autoFundingConfiguration.error[0].message
|
|
29290
|
+
}))]
|
|
29291
|
+
})]
|
|
29292
|
+
});
|
|
29293
|
+
};
|
|
29294
|
+
|
|
29013
29295
|
/**
|
|
29014
29296
|
* Captures errors thrown within an Element, logs them and displays a fallback component
|
|
29015
29297
|
*
|
|
@@ -29073,49 +29355,82 @@ class ErrorBoundary extends React__namespace.Component {
|
|
|
29073
29355
|
}
|
|
29074
29356
|
}
|
|
29075
29357
|
|
|
29358
|
+
const ManageFunding = ({
|
|
29359
|
+
carrierId
|
|
29360
|
+
}) => {
|
|
29361
|
+
const {
|
|
29362
|
+
t
|
|
29363
|
+
} = reactI18next.useTranslation();
|
|
29364
|
+
const {
|
|
29365
|
+
isLoading: isLoadingCarrier
|
|
29366
|
+
} = react.useGetCarrierById(carrierId);
|
|
29367
|
+
const [isAddFundsFormOpen, setIsAddFundsFormOpen] = React.useState(false);
|
|
29368
|
+
if (isLoadingCarrier) return jsxRuntime.jsx(Loader, {
|
|
29369
|
+
message: t("loading.carrier")
|
|
29370
|
+
});
|
|
29371
|
+
return jsxRuntime.jsxs("section", {
|
|
29372
|
+
children: [jsxRuntime.jsxs(Spread, {
|
|
29373
|
+
children: [jsxRuntime.jsx(CarrierBalance, {
|
|
29374
|
+
carrierId: carrierId
|
|
29375
|
+
}), jsxRuntime.jsx(LinkAction, {
|
|
29376
|
+
icon: "add",
|
|
29377
|
+
isDisabled: isAddFundsFormOpen,
|
|
29378
|
+
onClick: () => setIsAddFundsFormOpen(true),
|
|
29379
|
+
title: t("manage-funding:actions.addFunds")
|
|
29380
|
+
})]
|
|
29381
|
+
}), isAddFundsFormOpen && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29382
|
+
children: [jsxRuntime.jsx(Spacer, {
|
|
29383
|
+
multiplier: 2
|
|
29384
|
+
}), jsxRuntime.jsx(AddFundsForm, {
|
|
29385
|
+
carrierId: carrierId,
|
|
29386
|
+
onCancel: () => setIsAddFundsFormOpen(false)
|
|
29387
|
+
})]
|
|
29388
|
+
}), jsxRuntime.jsx(Spacer, {
|
|
29389
|
+
multiplier: 2
|
|
29390
|
+
})]
|
|
29391
|
+
});
|
|
29392
|
+
};
|
|
29393
|
+
|
|
29076
29394
|
/**
|
|
29077
|
-
*
|
|
29395
|
+
* For relevant notes about Storybook stories
|
|
29078
29396
|
*
|
|
29079
|
-
*
|
|
29080
|
-
* interface is then mounted back at the point of use.
|
|
29397
|
+
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
29081
29398
|
*/
|
|
29082
|
-
const
|
|
29083
|
-
css,
|
|
29399
|
+
const StoryNotes = ({
|
|
29084
29400
|
children,
|
|
29085
|
-
|
|
29086
|
-
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
})), css];
|
|
29098
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29099
|
-
children: [jsxRuntime.jsx(Portal, Object.assign({
|
|
29100
|
-
target: rootTarget
|
|
29401
|
+
notes
|
|
29402
|
+
}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29403
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
29404
|
+
css: () => ({
|
|
29405
|
+
backgroundColor: "lightsteelblue",
|
|
29406
|
+
marginBottom: "16px",
|
|
29407
|
+
padding: "16px",
|
|
29408
|
+
paddingLeft: "32px"
|
|
29409
|
+
})
|
|
29410
|
+
}, {
|
|
29411
|
+
children: [jsxRuntime.jsx(giger.Typography, Object.assign({
|
|
29412
|
+
variant: "heading5"
|
|
29101
29413
|
}, {
|
|
29102
|
-
children:
|
|
29103
|
-
|
|
29104
|
-
|
|
29105
|
-
|
|
29106
|
-
|
|
29107
|
-
|
|
29108
|
-
|
|
29109
|
-
|
|
29110
|
-
|
|
29111
|
-
|
|
29112
|
-
|
|
29113
|
-
|
|
29114
|
-
|
|
29115
|
-
|
|
29116
|
-
|
|
29117
|
-
|
|
29118
|
-
|
|
29414
|
+
children: "Story notes:"
|
|
29415
|
+
})), jsxRuntime.jsx("ul", Object.assign({
|
|
29416
|
+
css: theme => ({
|
|
29417
|
+
"> li": {
|
|
29418
|
+
marginTop: theme.spacing(1)
|
|
29419
|
+
}
|
|
29420
|
+
})
|
|
29421
|
+
}, {
|
|
29422
|
+
children: notes.map(n => jsxRuntime.jsx("li", {
|
|
29423
|
+
children: n
|
|
29424
|
+
}, n))
|
|
29425
|
+
}))]
|
|
29426
|
+
})), jsxRuntime.jsx("hr", {
|
|
29427
|
+
css: () => ({
|
|
29428
|
+
backgroundColor: "transparent",
|
|
29429
|
+
borderTop: "1px dotted lightgrey",
|
|
29430
|
+
marginBottom: "16px"
|
|
29431
|
+
})
|
|
29432
|
+
}), children]
|
|
29433
|
+
});
|
|
29119
29434
|
|
|
29120
29435
|
var $$2 = _export;
|
|
29121
29436
|
var uncurryThis = functionUncurryThisClause;
|
|
@@ -30122,6 +30437,7 @@ var common = {
|
|
|
30122
30437
|
invalidNameOrCompany: "Recipient name and company name (if provided) must have two characters in first and last name.",
|
|
30123
30438
|
noWarehouses: "You must have an active warehouse in order to use this feature",
|
|
30124
30439
|
unableToLoad: {
|
|
30440
|
+
carrier: "Unable to load carrier",
|
|
30125
30441
|
carriers: "Unable to load carriers",
|
|
30126
30442
|
salesOrder: "Unable to load order",
|
|
30127
30443
|
shipment: "Unable to load shipment",
|
|
@@ -30148,6 +30464,7 @@ var common = {
|
|
|
30148
30464
|
thirdParty: "Third Party"
|
|
30149
30465
|
},
|
|
30150
30466
|
loading: {
|
|
30467
|
+
carrier: "Loading carrier...",
|
|
30151
30468
|
carriers: "Loading carriers...",
|
|
30152
30469
|
data: "Loading...",
|
|
30153
30470
|
importingSalesOrder: "Importing order...",
|
|
@@ -30244,11 +30561,11 @@ var listCarriers = {
|
|
|
30244
30561
|
var manageFunding = {
|
|
30245
30562
|
"manage-funding": {
|
|
30246
30563
|
actions: {
|
|
30564
|
+
addFunds: "Add Funds",
|
|
30565
|
+
addFundsAndPurchase: "Add Funds & Purchase",
|
|
30247
30566
|
addNow: "Add Now",
|
|
30248
|
-
saveRule: "Save Rule"
|
|
30249
|
-
other: "Other..."
|
|
30567
|
+
saveRule: "Save Rule"
|
|
30250
30568
|
},
|
|
30251
|
-
addFunds: "Add Funds",
|
|
30252
30569
|
autoFunding: {
|
|
30253
30570
|
addFundsAutomatically: "Add Funds Automatically",
|
|
30254
30571
|
error: {
|
|
@@ -30261,20 +30578,31 @@ var manageFunding = {
|
|
|
30261
30578
|
maximumPurchasesPerDay: "Maximum Purchases Per Day",
|
|
30262
30579
|
purchaseAmount: "Purchase Amount"
|
|
30263
30580
|
},
|
|
30264
|
-
|
|
30265
|
-
|
|
30581
|
+
addFunds: {
|
|
30582
|
+
custom: "Custom...",
|
|
30266
30583
|
error: {
|
|
30267
30584
|
title: "Manual-Funding Error",
|
|
30268
30585
|
message: "An error occurred while trying add funds to your ShipEngine wallet."
|
|
30269
30586
|
},
|
|
30270
30587
|
isLoading: "Adding funds to your ShipEngine wallet...",
|
|
30271
30588
|
labels: {
|
|
30272
|
-
amount: "Amount"
|
|
30273
|
-
currentBalance: "Current Balance",
|
|
30274
|
-
resultingBalance: "Resulting Balance"
|
|
30589
|
+
amount: "Amount"
|
|
30275
30590
|
},
|
|
30276
30591
|
minimumPurchaseAmount: "Minimum Purchase $10.00"
|
|
30277
30592
|
},
|
|
30593
|
+
fundAndPurchase: {
|
|
30594
|
+
finalBalance: "Final balance after payment:",
|
|
30595
|
+
insufficientFunds: "Add funds below to purchase label.",
|
|
30596
|
+
insufficientFundsTitle: "Not enough money in your account",
|
|
30597
|
+
negativeBalance: "You will be charged this amount in addition to the label cost.",
|
|
30598
|
+
negativeBalanceTitle: "Negative balance (due to adjustments)",
|
|
30599
|
+
newBalance: "New balance after adding funds:"
|
|
30600
|
+
},
|
|
30601
|
+
errors: {
|
|
30602
|
+
balanceUnknown: "Unknown",
|
|
30603
|
+
unableToFindBalance: "There was a problem retrieving your balance. Please try again later."
|
|
30604
|
+
},
|
|
30605
|
+
currentBalance: "Current balance:",
|
|
30278
30606
|
maximumBalanceAmount: "Balance may not exceed $10,000.00"
|
|
30279
30607
|
}
|
|
30280
30608
|
};
|
|
@@ -30792,7 +31120,75 @@ const ListCarriers = () => {
|
|
|
30792
31120
|
});
|
|
30793
31121
|
};
|
|
30794
31122
|
|
|
30795
|
-
const Element$
|
|
31123
|
+
const Element$5 = registerElement("list-carriers", ListCarriers);
|
|
31124
|
+
|
|
31125
|
+
const ManageWarehouses = () => {
|
|
31126
|
+
const {
|
|
31127
|
+
t
|
|
31128
|
+
} = reactI18next.useTranslation();
|
|
31129
|
+
const {
|
|
31130
|
+
data: warehouses,
|
|
31131
|
+
error: listWarehouseErrors,
|
|
31132
|
+
isLoading: isLoadingWarehouses,
|
|
31133
|
+
refetch: refreshListWarehouses
|
|
31134
|
+
} = react.useListWarehouses();
|
|
31135
|
+
const {
|
|
31136
|
+
error: updateWarehouseErrors,
|
|
31137
|
+
mutateAsync: updateWarehouse
|
|
31138
|
+
} = react.useUpdateWarehouse();
|
|
31139
|
+
const {
|
|
31140
|
+
error: createWarehouseErrors,
|
|
31141
|
+
mutateAsync: createWarehouse
|
|
31142
|
+
} = react.useCreateWarehouse();
|
|
31143
|
+
const {
|
|
31144
|
+
error: deleteWarehouseErrors,
|
|
31145
|
+
mutateAsync: deleteWarehouse
|
|
31146
|
+
} = react.useDeleteWarehouse();
|
|
31147
|
+
const handleDeleteWarehouse = warehouseId => __awaiter(void 0, void 0, void 0, function* () {
|
|
31148
|
+
yield deleteWarehouse({
|
|
31149
|
+
warehouseId
|
|
31150
|
+
});
|
|
31151
|
+
void refreshListWarehouses();
|
|
31152
|
+
});
|
|
31153
|
+
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
31154
|
+
const result = yield createWarehouse(payload);
|
|
31155
|
+
if (result) void refreshListWarehouses();
|
|
31156
|
+
});
|
|
31157
|
+
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31158
|
+
yield updateWarehouse({
|
|
31159
|
+
name: payload.name,
|
|
31160
|
+
originAddress: payload.originAddress,
|
|
31161
|
+
returnAddress: payload.returnAddress,
|
|
31162
|
+
warehouseId: warehouseId
|
|
31163
|
+
});
|
|
31164
|
+
void refreshListWarehouses();
|
|
31165
|
+
});
|
|
31166
|
+
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31167
|
+
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31168
|
+
isDefault: true,
|
|
31169
|
+
warehouseId
|
|
31170
|
+
}));
|
|
31171
|
+
void refreshListWarehouses();
|
|
31172
|
+
});
|
|
31173
|
+
if (isLoadingWarehouses) return jsxRuntime.jsx(Loader, {
|
|
31174
|
+
message: t("loading.warehouses")
|
|
31175
|
+
});
|
|
31176
|
+
if (!warehouses) {
|
|
31177
|
+
if (listWarehouseErrors) throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
31178
|
+
throw new Error("errorMessages.unableToLoad.warehouses");
|
|
31179
|
+
}
|
|
31180
|
+
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
31181
|
+
return jsxRuntime.jsx(ManageWarehouses$1, {
|
|
31182
|
+
errors: errors,
|
|
31183
|
+
onAdd: handleSubmitAddNewWarehouse,
|
|
31184
|
+
onDelete: handleDeleteWarehouse,
|
|
31185
|
+
onEdit: handleSubmitEditWarehouse,
|
|
31186
|
+
onSetDefault: handleSetDefault,
|
|
31187
|
+
warehouses: warehouses
|
|
31188
|
+
});
|
|
31189
|
+
};
|
|
31190
|
+
|
|
31191
|
+
const Element$4 = registerElement("manage-warehouses", ManageWarehouses);
|
|
30796
31192
|
|
|
30797
31193
|
const useAddress = ({
|
|
30798
31194
|
compatibleCountryCodes,
|
|
@@ -30918,7 +31314,7 @@ const useAddress = ({
|
|
|
30918
31314
|
}), [handleValidateAddress, onChange, shipment, updateShipment]);
|
|
30919
31315
|
React.useEffect(() => {
|
|
30920
31316
|
if (!addressPreference && (shipment === null || shipment === void 0 ? void 0 : shipment.shipTo)) {
|
|
30921
|
-
handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
31317
|
+
void handleValidateAddress(shipment === null || shipment === void 0 ? void 0 : shipment.shipTo, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo);
|
|
30922
31318
|
}
|
|
30923
31319
|
}, [addressPreference, handleValidateAddress, salesOrder === null || salesOrder === void 0 ? void 0 : salesOrder.shipTo, shipment === null || shipment === void 0 ? void 0 : shipment.shipTo]);
|
|
30924
31320
|
const charsetWarning = React.useMemo(() => Object.keys((addressPreference === null || addressPreference === void 0 ? void 0 : addressPreference.selection) || {}).reduce((warning, key) => {
|
|
@@ -31398,135 +31794,6 @@ const ConfigureShipment = _a => {
|
|
|
31398
31794
|
});
|
|
31399
31795
|
};
|
|
31400
31796
|
|
|
31401
|
-
const ManageFunding = ({
|
|
31402
|
-
carrierId,
|
|
31403
|
-
fundingMethod,
|
|
31404
|
-
requiredAmount
|
|
31405
|
-
}) => {
|
|
31406
|
-
// const { data: carriersData, loading, error } = useListCarriers();
|
|
31407
|
-
var _a, _b;
|
|
31408
|
-
const {
|
|
31409
|
-
data: addFundsData,
|
|
31410
|
-
error: addFundsErrors,
|
|
31411
|
-
mutateAsync: addFunds,
|
|
31412
|
-
isLoading: isAddFundsLoading,
|
|
31413
|
-
reset: addFundsRefresh
|
|
31414
|
-
} = react.useAddFunds();
|
|
31415
|
-
const {
|
|
31416
|
-
data: autoFundingData,
|
|
31417
|
-
error: autoFundingErrors,
|
|
31418
|
-
isLoading: isAutoFundingLoading,
|
|
31419
|
-
refetch: refreshAutoFundingConfiguration
|
|
31420
|
-
} = react.useGetAutoFundingConfiguration();
|
|
31421
|
-
const {
|
|
31422
|
-
mutateAsync: configureAutoFunding
|
|
31423
|
-
} = react.useUpdateAutoFunding();
|
|
31424
|
-
const handleSubmitManualFunding = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
31425
|
-
const result = yield addFunds({
|
|
31426
|
-
amount: payload.funds,
|
|
31427
|
-
carrierId
|
|
31428
|
-
});
|
|
31429
|
-
if (result) void addFundsRefresh();
|
|
31430
|
-
});
|
|
31431
|
-
const handleSubmitAutoFunding = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
31432
|
-
const result = yield configureAutoFunding(Object.assign({
|
|
31433
|
-
carrierId
|
|
31434
|
-
}, payload));
|
|
31435
|
-
if (result) void refreshAutoFundingConfiguration();
|
|
31436
|
-
});
|
|
31437
|
-
const handleToggleAutoFunding = isEnabled => __awaiter(void 0, void 0, void 0, function* () {
|
|
31438
|
-
if (autoFundingData) {
|
|
31439
|
-
const result = yield configureAutoFunding(Object.assign(Object.assign({}, autoFundingData), {
|
|
31440
|
-
carrierId,
|
|
31441
|
-
isEnabled
|
|
31442
|
-
}));
|
|
31443
|
-
if (result) void refreshAutoFundingConfiguration();
|
|
31444
|
-
} else {
|
|
31445
|
-
console.error("Toggling auto-funding failed because autoFundingData is undefined.");
|
|
31446
|
-
}
|
|
31447
|
-
});
|
|
31448
|
-
return jsxRuntime.jsx(FundingMethods, {
|
|
31449
|
-
autoFundingData: autoFundingData,
|
|
31450
|
-
autoFundingErrorMessage: autoFundingErrors ? (_a = autoFundingErrors[0]) === null || _a === void 0 ? void 0 : _a.message : undefined,
|
|
31451
|
-
fundingMethod: fundingMethod !== null && fundingMethod !== void 0 ? fundingMethod : "both",
|
|
31452
|
-
hasAutoFundingError: !!(autoFundingErrors === null || autoFundingErrors === void 0 ? void 0 : autoFundingErrors.length),
|
|
31453
|
-
hasManualFundingError: !!(addFundsErrors === null || addFundsErrors === void 0 ? void 0 : addFundsErrors.length),
|
|
31454
|
-
isAutoFundingLoading: isAutoFundingLoading,
|
|
31455
|
-
isManualFundingLoading: isAddFundsLoading,
|
|
31456
|
-
manualFundingCurrentBalance: (_b = addFundsData === null || addFundsData === void 0 ? void 0 : addFundsData.balance.amount) !== null && _b !== void 0 ? _b : 0,
|
|
31457
|
-
manualFundingRequiredAmount: requiredAmount,
|
|
31458
|
-
onSubmitAutoFunding: handleSubmitAutoFunding,
|
|
31459
|
-
onSubmitManualFunding: handleSubmitManualFunding,
|
|
31460
|
-
onToggleAutoFunding: handleToggleAutoFunding
|
|
31461
|
-
});
|
|
31462
|
-
};
|
|
31463
|
-
|
|
31464
|
-
const ManageWarehouses = () => {
|
|
31465
|
-
const {
|
|
31466
|
-
t
|
|
31467
|
-
} = reactI18next.useTranslation();
|
|
31468
|
-
const {
|
|
31469
|
-
data: warehouses,
|
|
31470
|
-
error: listWarehouseErrors,
|
|
31471
|
-
isLoading: isLoadingWarehouses,
|
|
31472
|
-
refetch: refreshListWarehouses
|
|
31473
|
-
} = react.useListWarehouses();
|
|
31474
|
-
const {
|
|
31475
|
-
error: updateWarehouseErrors,
|
|
31476
|
-
mutateAsync: updateWarehouse
|
|
31477
|
-
} = react.useUpdateWarehouse();
|
|
31478
|
-
const {
|
|
31479
|
-
error: createWarehouseErrors,
|
|
31480
|
-
mutateAsync: createWarehouse
|
|
31481
|
-
} = react.useCreateWarehouse();
|
|
31482
|
-
const {
|
|
31483
|
-
error: deleteWarehouseErrors,
|
|
31484
|
-
mutateAsync: deleteWarehouse
|
|
31485
|
-
} = react.useDeleteWarehouse();
|
|
31486
|
-
const handleDeleteWarehouse = warehouseId => __awaiter(void 0, void 0, void 0, function* () {
|
|
31487
|
-
yield deleteWarehouse({
|
|
31488
|
-
warehouseId
|
|
31489
|
-
});
|
|
31490
|
-
void refreshListWarehouses();
|
|
31491
|
-
});
|
|
31492
|
-
const handleSubmitAddNewWarehouse = payload => __awaiter(void 0, void 0, void 0, function* () {
|
|
31493
|
-
const result = yield createWarehouse(payload);
|
|
31494
|
-
if (result) void refreshListWarehouses();
|
|
31495
|
-
});
|
|
31496
|
-
const handleSubmitEditWarehouse = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31497
|
-
yield updateWarehouse({
|
|
31498
|
-
name: payload.name,
|
|
31499
|
-
originAddress: payload.originAddress,
|
|
31500
|
-
returnAddress: payload.returnAddress,
|
|
31501
|
-
warehouseId: warehouseId
|
|
31502
|
-
});
|
|
31503
|
-
void refreshListWarehouses();
|
|
31504
|
-
});
|
|
31505
|
-
const handleSetDefault = (payload, warehouseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31506
|
-
yield updateWarehouse(Object.assign(Object.assign({}, payload), {
|
|
31507
|
-
isDefault: true,
|
|
31508
|
-
warehouseId
|
|
31509
|
-
}));
|
|
31510
|
-
void refreshListWarehouses();
|
|
31511
|
-
});
|
|
31512
|
-
if (isLoadingWarehouses) return jsxRuntime.jsx(Loader, {
|
|
31513
|
-
message: t("loading.warehouses")
|
|
31514
|
-
});
|
|
31515
|
-
if (!warehouses) {
|
|
31516
|
-
if (listWarehouseErrors) throw new Error(listWarehouseErrors.map(e => e.message).join(", "));
|
|
31517
|
-
throw new Error("errorMessages.unableToLoad.warehouses");
|
|
31518
|
-
}
|
|
31519
|
-
const errors = [...(updateWarehouseErrors !== null && updateWarehouseErrors !== void 0 ? updateWarehouseErrors : []), ...(createWarehouseErrors !== null && createWarehouseErrors !== void 0 ? createWarehouseErrors : []), ...(deleteWarehouseErrors !== null && deleteWarehouseErrors !== void 0 ? deleteWarehouseErrors : [])];
|
|
31520
|
-
return jsxRuntime.jsx(ManageWarehouses$1, {
|
|
31521
|
-
errors: errors,
|
|
31522
|
-
onAdd: handleSubmitAddNewWarehouse,
|
|
31523
|
-
onDelete: handleDeleteWarehouse,
|
|
31524
|
-
onEdit: handleSubmitEditWarehouse,
|
|
31525
|
-
onSetDefault: handleSetDefault,
|
|
31526
|
-
warehouses: warehouses
|
|
31527
|
-
});
|
|
31528
|
-
};
|
|
31529
|
-
|
|
31530
31797
|
const Onboarding = ({
|
|
31531
31798
|
onCompleteOnboarding
|
|
31532
31799
|
}) => {
|
|
@@ -31659,7 +31926,8 @@ const useConfigureShipment = ({
|
|
|
31659
31926
|
onLoad,
|
|
31660
31927
|
onShipmentUpdated,
|
|
31661
31928
|
salesOrder,
|
|
31662
|
-
warehouseId
|
|
31929
|
+
warehouseId,
|
|
31930
|
+
printLabelLayout
|
|
31663
31931
|
}) => {
|
|
31664
31932
|
var _a, _b;
|
|
31665
31933
|
const {
|
|
@@ -31676,12 +31944,12 @@ const useConfigureShipment = ({
|
|
|
31676
31944
|
yield reloadPendingShipment();
|
|
31677
31945
|
yield onShipmentUpdated === null || onShipmentUpdated === void 0 ? void 0 : onShipmentUpdated(shipment);
|
|
31678
31946
|
}), [onShipmentUpdated, reloadPendingShipment]);
|
|
31679
|
-
const
|
|
31947
|
+
const labelLayoutSetting = (_b = (_a = react.useGetAccountSettings().data) === null || _a === void 0 ? void 0 : _a.defaultLabelLayout) !== null && _b !== void 0 ? _b : "4x6";
|
|
31680
31948
|
return {
|
|
31681
31949
|
errors: pendingShipmentErrors,
|
|
31682
31950
|
isLoading: isPendingShipmentLoading,
|
|
31683
31951
|
onShipmentUpdated: handleShipmentUpdated,
|
|
31684
|
-
printLabelLayout,
|
|
31952
|
+
printLabelLayout: printLabelLayout ? printLabelLayout : labelLayoutSetting,
|
|
31685
31953
|
shipment: pendingShipment,
|
|
31686
31954
|
warehouseId
|
|
31687
31955
|
};
|
|
@@ -31740,7 +32008,7 @@ const useImportSalesOrder = ({
|
|
|
31740
32008
|
};
|
|
31741
32009
|
};
|
|
31742
32010
|
|
|
31743
|
-
const
|
|
32011
|
+
const PurchaseLabelBySalesOrder = _a => {
|
|
31744
32012
|
var {
|
|
31745
32013
|
features,
|
|
31746
32014
|
externalOrderId,
|
|
@@ -31770,7 +32038,7 @@ const SalesOrder = _a => {
|
|
|
31770
32038
|
salesOrder,
|
|
31771
32039
|
warehouseId
|
|
31772
32040
|
});
|
|
31773
|
-
return jsxRuntime.jsx(
|
|
32041
|
+
return jsxRuntime.jsx(SuspendSalesOrder, Object.assign({
|
|
31774
32042
|
salesOrder: salesOrder
|
|
31775
32043
|
}, salesOrderProps, {
|
|
31776
32044
|
children: salesOrder && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
@@ -31780,6 +32048,79 @@ const SalesOrder = _a => {
|
|
|
31780
32048
|
}));
|
|
31781
32049
|
};
|
|
31782
32050
|
|
|
32051
|
+
const useLoadShipment = ({
|
|
32052
|
+
shipmentId
|
|
32053
|
+
}) => {
|
|
32054
|
+
const {
|
|
32055
|
+
data: shipment,
|
|
32056
|
+
error: loadShipmentErrors,
|
|
32057
|
+
refetch: refetchShipment,
|
|
32058
|
+
isLoading
|
|
32059
|
+
} = react.useGetShipment(shipmentId);
|
|
32060
|
+
const errors = [...(loadShipmentErrors !== null && loadShipmentErrors !== void 0 ? loadShipmentErrors : [])];
|
|
32061
|
+
return {
|
|
32062
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
32063
|
+
isLoading: isLoading,
|
|
32064
|
+
refetchShipment,
|
|
32065
|
+
shipment
|
|
32066
|
+
};
|
|
32067
|
+
};
|
|
32068
|
+
|
|
32069
|
+
const PurchaseLabelByShipment = _a => {
|
|
32070
|
+
var {
|
|
32071
|
+
shipmentId,
|
|
32072
|
+
onLoad,
|
|
32073
|
+
onShipmentUpdated,
|
|
32074
|
+
features
|
|
32075
|
+
} = _a,
|
|
32076
|
+
props = __rest(_a, ["shipmentId", "onLoad", "onShipmentUpdated", "features"]);
|
|
32077
|
+
const _b = useLoadShipment({
|
|
32078
|
+
shipmentId
|
|
32079
|
+
}),
|
|
32080
|
+
{
|
|
32081
|
+
shipment
|
|
32082
|
+
} = _b,
|
|
32083
|
+
shipmentProps = __rest(_b, ["shipment"]);
|
|
32084
|
+
return jsxRuntime.jsx(SuspendShipment, Object.assign({
|
|
32085
|
+
shipment: shipment
|
|
32086
|
+
}, shipmentProps, {
|
|
32087
|
+
children: shipment && jsxRuntime.jsx(ConfigureShipment, Object.assign({
|
|
32088
|
+
errors: shipmentProps.errors,
|
|
32089
|
+
features: features,
|
|
32090
|
+
isLoading: shipmentProps.isLoading,
|
|
32091
|
+
onAddressValidation: props.onAddressValidation,
|
|
32092
|
+
onApplyPreset: props.onApplyPreset,
|
|
32093
|
+
onBeforeLabelCreate: props.onBeforeLabelCreate,
|
|
32094
|
+
onChangeAddress: props.onChangeAddress,
|
|
32095
|
+
onChangeShipmentFormMode: props.onChangeShipmentFormMode,
|
|
32096
|
+
onLabelCreateFailure: props.onLabelCreateFailure,
|
|
32097
|
+
onLabelCreateSuccess: props.onLabelCreateSuccess,
|
|
32098
|
+
onRateSaved: props.onRateSaved,
|
|
32099
|
+
onRatesCalculated: props.onRatesCalculated,
|
|
32100
|
+
onShipmentUpdated: onShipmentUpdated,
|
|
32101
|
+
onToggleAddressPreferenceDisclosure: props.onToggleAddressPreferenceDisclosure,
|
|
32102
|
+
printLabelLayout: props.printLabelLayout,
|
|
32103
|
+
shipment: shipment,
|
|
32104
|
+
shippingPresets: props.shippingPresets,
|
|
32105
|
+
warehouseId: props.warehouseId
|
|
32106
|
+
}, props))
|
|
32107
|
+
}));
|
|
32108
|
+
};
|
|
32109
|
+
|
|
32110
|
+
const PurchaseLabel = _a => {
|
|
32111
|
+
var {
|
|
32112
|
+
shipmentId
|
|
32113
|
+
} = _a,
|
|
32114
|
+
props = __rest(_a, ["shipmentId"]);
|
|
32115
|
+
if (shipmentId) {
|
|
32116
|
+
return jsxRuntime.jsx(PurchaseLabelByShipment, Object.assign({
|
|
32117
|
+
shipmentId: shipmentId
|
|
32118
|
+
}, props));
|
|
32119
|
+
} else {
|
|
32120
|
+
return jsxRuntime.jsx(PurchaseLabelBySalesOrder, Object.assign({}, props));
|
|
32121
|
+
}
|
|
32122
|
+
};
|
|
32123
|
+
|
|
31783
32124
|
const Shipment = ({
|
|
31784
32125
|
features,
|
|
31785
32126
|
onClickPrintLabel,
|
|
@@ -31848,11 +32189,7 @@ const VoidLabel = ({
|
|
|
31848
32189
|
});
|
|
31849
32190
|
};
|
|
31850
32191
|
|
|
31851
|
-
const Element$
|
|
31852
|
-
|
|
31853
|
-
const Element$4 = registerElement("manage-warehouses", ManageWarehouses);
|
|
31854
|
-
|
|
31855
|
-
const Element$3 = registerElement("purchase-label", SalesOrder);
|
|
32192
|
+
const Element$3 = registerElement("purchase-label", PurchaseLabel);
|
|
31856
32193
|
|
|
31857
32194
|
const Element$2 = registerElement("onboarding", Onboarding);
|
|
31858
32195
|
|
|
@@ -32542,9 +32879,42 @@ const renderWithProviders = component => {
|
|
|
32542
32879
|
})
|
|
32543
32880
|
});
|
|
32544
32881
|
};
|
|
32882
|
+
/**
|
|
32883
|
+
* Wraps the test with all of the usual Shipengine / Giger / i18 / etc providers that a full, registered "Element" would have.
|
|
32884
|
+
* This allows components to simulate usage in an Element via `decorators: [withAllProviders]`
|
|
32885
|
+
**/
|
|
32886
|
+
const renderWithAllProviders = component => {
|
|
32887
|
+
const theme = brands.createTheme(brands.BrandName.FALLBACK);
|
|
32888
|
+
return react$2.render(component, {
|
|
32889
|
+
wrapper: ({
|
|
32890
|
+
children
|
|
32891
|
+
}) => jsxRuntime.jsx(react.ShipEngineProvider, Object.assign({
|
|
32892
|
+
baseURL: "/api",
|
|
32893
|
+
getToken: () => {
|
|
32894
|
+
var _a;
|
|
32895
|
+
return (_a = process.env.STORYBOOK_TOKEN) !== null && _a !== void 0 ? _a : "none";
|
|
32896
|
+
}
|
|
32897
|
+
}, {
|
|
32898
|
+
children: jsxRuntime.jsx(RootPortalProvider, {
|
|
32899
|
+
children: jsxRuntime.jsx(giger.GigerConfigProvider, Object.assign({
|
|
32900
|
+
resolveIcon: name => `<svg>${name}</svg>`
|
|
32901
|
+
}, {
|
|
32902
|
+
children: jsxRuntime.jsx(react$1.ThemeProvider, Object.assign({
|
|
32903
|
+
theme: brands.deserialize(theme)
|
|
32904
|
+
}, {
|
|
32905
|
+
children: children
|
|
32906
|
+
}))
|
|
32907
|
+
}))
|
|
32908
|
+
})
|
|
32909
|
+
}))
|
|
32910
|
+
});
|
|
32911
|
+
};
|
|
32545
32912
|
|
|
32546
32913
|
exports.Accordion = Accordion;
|
|
32914
|
+
exports.AddFundsForm = AddFundsForm;
|
|
32915
|
+
exports.AutoFundingForm = AutoFundingForm;
|
|
32547
32916
|
exports.ButtonGroup = ButtonGroup;
|
|
32917
|
+
exports.CarrierBalance = CarrierBalance;
|
|
32548
32918
|
exports.Country = Country;
|
|
32549
32919
|
exports.Cube = Cube;
|
|
32550
32920
|
exports.ElementsContext = ElementsContext;
|
|
@@ -32554,11 +32924,14 @@ exports.ErrorFallback = ErrorFallback;
|
|
|
32554
32924
|
exports.Field = fields;
|
|
32555
32925
|
exports.FieldLabel = FieldLabel;
|
|
32556
32926
|
exports.FormPortal = FormPortal;
|
|
32927
|
+
exports.FundAndPurchase = FundAndPurchase;
|
|
32557
32928
|
exports.GigerProvider = GigerProvider;
|
|
32929
|
+
exports.InlineLabel = InlineLabel;
|
|
32558
32930
|
exports.ItemsBreakdown = ItemsBreakdown;
|
|
32559
|
-
exports.
|
|
32931
|
+
exports.LinkAction = LinkAction;
|
|
32932
|
+
exports.ListCarriers = Element$5;
|
|
32560
32933
|
exports.Loader = Loader;
|
|
32561
|
-
exports.ManageFunding =
|
|
32934
|
+
exports.ManageFunding = ManageFunding;
|
|
32562
32935
|
exports.ManageWarehouses = Element$4;
|
|
32563
32936
|
exports.Onboarding = Element$2;
|
|
32564
32937
|
exports.PageLayoutProvider = PageLayoutProvider;
|
|
@@ -32566,6 +32939,8 @@ exports.Portal = Portal;
|
|
|
32566
32939
|
exports.PurchaseLabel = Element$3;
|
|
32567
32940
|
exports.RootPortalProvider = RootPortalProvider;
|
|
32568
32941
|
exports.Spacer = Spacer;
|
|
32942
|
+
exports.Spread = Spread;
|
|
32943
|
+
exports.StoryNotes = StoryNotes;
|
|
32569
32944
|
exports.Templates = index$1;
|
|
32570
32945
|
exports.UsState = UsState;
|
|
32571
32946
|
exports.UsaCity = UsaCity;
|
|
@@ -32574,6 +32949,7 @@ exports.VoidLabel = Element;
|
|
|
32574
32949
|
exports.addressFactory = addressFactory;
|
|
32575
32950
|
exports.addressPreferenceFactory = addressPreferenceFactory;
|
|
32576
32951
|
exports.addressValidationFactory = addressValidationFactory;
|
|
32952
|
+
exports.autoFundingSchema = autoFundingSchema;
|
|
32577
32953
|
exports.calculateTotal = calculateTotal;
|
|
32578
32954
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
32579
32955
|
exports.carrierFactory = carrierFactory;
|
|
@@ -32598,6 +32974,7 @@ exports.formatDate = formatDate;
|
|
|
32598
32974
|
exports.formatFractionalWeight = formatFractionalWeight;
|
|
32599
32975
|
exports.formatMoney = formatMoney;
|
|
32600
32976
|
exports.fractionalWeightFactory = fractionalWeightFactory;
|
|
32977
|
+
exports.getAddFundsSchema = getAddFundsSchema;
|
|
32601
32978
|
exports.getCustomsFromSalesOrder = getCustomsFromSalesOrder;
|
|
32602
32979
|
exports.getExpirationYears = getExpirationYears;
|
|
32603
32980
|
exports.getIsCustomsRequiredForSalesOrder = getIsCustomsRequiredForSalesOrder;
|
|
@@ -32606,6 +32983,7 @@ exports.getIsInternationalShipment = getIsInternationalShipment;
|
|
|
32606
32983
|
exports.getPendingShipment = getPendingShipment;
|
|
32607
32984
|
exports.getRateRequiresAcknowledgement = getRateRequiresAcknowledgement;
|
|
32608
32985
|
exports.getRequestedServices = getRequestedServices;
|
|
32986
|
+
exports.getSalesOrderItemsFromSalesOrderOrShipment = getSalesOrderItemsFromSalesOrderOrShipment;
|
|
32609
32987
|
exports.getTotalRateAmount = getTotalRateAmount;
|
|
32610
32988
|
exports.isDomesticAddress = isDomesticAddress;
|
|
32611
32989
|
exports.isFlatRatePackageCode = isFlatRatePackageCode;
|
|
@@ -32638,6 +33016,7 @@ exports.randomShipengineId = randomShipengineId;
|
|
|
32638
33016
|
exports.randomShipengineSlug = randomShipengineSlug;
|
|
32639
33017
|
exports.randomWeightUnit = randomWeightUnit;
|
|
32640
33018
|
exports.registerElement = registerElement;
|
|
33019
|
+
exports.renderWithAllProviders = renderWithAllProviders;
|
|
32641
33020
|
exports.renderWithProviders = renderWithProviders;
|
|
32642
33021
|
exports.salesOrderFactory = salesOrderFactory;
|
|
32643
33022
|
exports.salesOrderItemFactory = salesOrderItemFactory;
|