@shipengine/elements 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +2019 -577
- package/index.js +2012 -578
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +20 -2
- package/src/components/add-funds-form/add-funds-schema.d.ts +26 -0
- package/src/components/address-preference-context/address-preference-context.d.ts +8 -0
- package/src/components/auto-funding-form/auto-funding-form.d.ts +22 -0
- package/src/components/auto-funding-form/auto-funding-schema.d.ts +17 -0
- package/src/components/button-group/button-group.d.ts +29 -0
- package/src/components/carrier-balance/carrier-balance.d.ts +23 -0
- package/src/components/collapsible-panel/collapsible-panel.d.ts +32 -0
- package/src/components/copy/copy-button.d.ts +4 -0
- package/src/components/cube/cube.d.ts +16 -0
- package/src/components/date-range-combo/date-range-combo.d.ts +14 -0
- package/src/components/date-range-select/date-range-select.d.ts +6 -0
- package/src/components/error-fallback/error-fallback.d.ts +12 -1
- package/src/components/field-label/field-label.d.ts +10 -0
- package/src/components/form-portal/form-portal.d.ts +9 -0
- package/src/components/fund-and-purchase/fund-and-purchase.d.ts +13 -0
- package/src/components/inline-label/inline-label.d.ts +10 -0
- package/src/components/items-breakdown/items-breakdown.d.ts +15 -0
- package/src/components/label-layout/label-layout.d.ts +5 -0
- package/src/components/link-action/link-action.d.ts +10 -0
- package/src/components/loader/loader.d.ts +5 -0
- package/src/components/manage-funding/manage-funding.d.ts +26 -0
- package/src/components/payment-method-settings/payment-method-settings.d.ts +19 -0
- package/src/components/portal/portal.d.ts +10 -1
- package/src/components/powered-by-shipengine/powered-by-shipengine.d.ts +8 -0
- package/src/components/section/section.d.ts +10 -0
- package/src/components/spacer/spacer.d.ts +30 -0
- package/src/components/spread/spread.d.ts +10 -0
- package/src/components/story-notes/story-notes.d.ts +10 -1
- package/src/components/templates/rate-form/rate-form.d.ts +2 -2
- package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
- package/src/components/templates/shipment-form/shipment-schema.d.ts +179 -17
- package/src/components/unit-settings/unit-settings.d.ts +5 -0
- package/src/constants/shipengine/address.d.ts +75 -0
- package/src/elements/account-settings/account-settings.d.ts +136 -1
- package/src/elements/configure-shipment/configure-shipment.d.ts +1 -0
- package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -2
- package/src/elements/configure-shipment/hooks/use-rates-with-cache.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-request-rates.d.ts +1 -1
- package/src/elements/configure-shipment/hooks/use-shipment-form.d.ts +1 -0
- package/src/elements/list-carriers/list-carriers.d.ts +31 -0
- package/src/elements/manage-warehouses/manage-warehouses.d.ts +34 -0
- package/src/elements/onboarding/onboarding.d.ts +93 -2
- package/src/elements/purchase-label/purchase-label.d.ts +191 -7
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +128 -2
- package/src/elements/void-label/void-label.d.ts +134 -3
- package/src/extensions/zod.d.ts +5 -0
- package/src/factories/shipengine/package.d.ts +11 -0
- package/src/features/wallet-history/wallet-history.d.ts +5 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/options/use-confirmation-options.d.ts +7 -0
- package/src/hooks/options/use-country-code-options.d.ts +16 -3
- package/src/hooks/options/use-customs-contents-options.d.ts +7 -0
- package/src/hooks/options/use-customs-non-delivery-options.d.ts +7 -0
- package/src/hooks/options/use-date-range-options.d.ts +22 -1
- package/src/hooks/options/use-expiration-month-options.d.ts +7 -0
- package/src/hooks/options/use-insurance-provider-options.d.ts +7 -0
- package/src/hooks/options/use-package-options.d.ts +7 -0
- package/src/hooks/options/use-rate-options.d.ts +11 -1
- package/src/hooks/options/use-service-code-options.d.ts +7 -0
- package/src/hooks/options/use-shipment-metadata.d.ts +8 -0
- package/src/hooks/options/use-shipping-presets-options.d.ts +10 -0
- package/src/hooks/options/use-state-code-options.d.ts +7 -0
- package/src/hooks/options/use-warehouse-options.d.ts +7 -0
- package/src/hooks/use-address-validation.d.ts +7 -0
- package/src/hooks/use-black-box-detection.d.ts +17 -1
- package/src/hooks/use-carrier-metadata.d.ts +7 -0
- package/src/hooks/use-nested-form.d.ts +9 -0
- package/src/hooks/use-page-layout.d.ts +25 -1
- package/src/hooks/use-root-portal.d.ts +15 -2
- package/src/hooks/use-run-once-on-true.d.ts +5 -1
- package/src/hooks/use-scrub-errors.d.ts +6 -3
- package/src/hooks/use-toggle.d.ts +5 -1
- package/src/locales/en/index.d.ts +8 -1
- package/src/schemas/shipengine/money.d.ts +4 -0
- package/src/schemas/shipengine/phone.d.ts +8 -0
- package/src/types/carrier-metadata.d.ts +20 -0
- package/src/utilities/create-dictionary.d.ts +4 -0
- package/src/utilities/date.d.ts +51 -2
- package/src/utilities/error.d.ts +16 -2
- package/src/utilities/feature-flags.d.ts +181 -0
- package/src/utilities/form-logger.d.ts +4 -0
- package/src/utilities/index.d.ts +1 -1
- package/src/utilities/money.d.ts +25 -0
- package/src/utilities/predicates/isString.d.ts +7 -0
- package/src/utilities/rates.d.ts +22 -1
- package/src/utilities/shipengine/address.d.ts +31 -0
- package/src/utilities/shipengine/carrier.d.ts +21 -0
- package/src/utilities/shipengine/dimensions.d.ts +27 -4
- package/src/utilities/shipengine/package.d.ts +4 -0
- package/src/utilities/shipengine/sales-order.d.ts +26 -0
- package/src/utilities/shipengine/shipment.d.ts +12 -0
- package/src/utilities/shipengine/weight.d.ts +92 -2
- package/src/utilities/string.d.ts +7 -0
- package/src/utilities/styles.d.ts +4 -0
- package/src/utilities/validation.d.ts +8 -0
|
@@ -4,26 +4,171 @@ import { ConfigureShipmentProps } from "../configure-shipment";
|
|
|
4
4
|
import { UseConfigureShipmentProps } from "./hooks";
|
|
5
5
|
import { PurchaseLabelSalesOrderProps } from "./purchase-label-by-sales-order";
|
|
6
6
|
import { PurchaseLabelByShipmentProps } from "./purchase-label-by-shipment";
|
|
7
|
+
/**
|
|
8
|
+
* # Purchase Label Component Props
|
|
9
|
+
*
|
|
10
|
+
* These are the shared props that will be passed into the `<PurchaseLabel.Element />`, and work
|
|
11
|
+
* for either shipment-based or sales order-based label purchasing.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel.Element />`}
|
|
14
|
+
*/
|
|
7
15
|
export type PurchaseLabelCommonProps = {
|
|
16
|
+
/**
|
|
17
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
18
|
+
*/
|
|
8
19
|
features?: ConfigureShipmentProps["features"];
|
|
20
|
+
/**
|
|
21
|
+
* `onAddressValidation` is an async/sync callback function that will be invoked on each Address
|
|
22
|
+
* validation request. For example, whenever you update the `Ship To Address` or
|
|
23
|
+
* `Ship From Address` for a given shipment.
|
|
24
|
+
*/
|
|
9
25
|
onAddressValidation?: ConfigureShipmentProps["onAddressValidation"];
|
|
26
|
+
/**
|
|
27
|
+
* `onApplyPreset` is an async/sync callback function that will be invoked each time a `Preset`
|
|
28
|
+
* has been applied to a shipment.
|
|
29
|
+
*/
|
|
10
30
|
onApplyPreset?: ConfigureShipmentProps["onApplyPreset"];
|
|
31
|
+
/**
|
|
32
|
+
* `onBeforeLabelCreate` is an async/sync callback function that will be invoked before every
|
|
33
|
+
* label purchase.
|
|
34
|
+
*/
|
|
11
35
|
onBeforeLabelCreate?: ConfigureShipmentProps["onBeforeLabelCreate"];
|
|
36
|
+
/**
|
|
37
|
+
* `onChangeAddress` is an async/sync callback function that will be invoked each time a
|
|
38
|
+
* `Ship To Address` or `Ship From Address` has been updated.
|
|
39
|
+
*/
|
|
12
40
|
onChangeAddress?: ConfigureShipmentProps["onChangeAddress"];
|
|
41
|
+
/**
|
|
42
|
+
* `onChangeShipmentFormMode` is an async/sync callback function that will be invoked each time
|
|
43
|
+
* the user toggles the `Shipment Form Mode` between `Browse Rates` and `Selected Rate`.
|
|
44
|
+
*/
|
|
13
45
|
onChangeShipmentFormMode?: ConfigureShipmentProps["onChangeShipmentFormMode"];
|
|
46
|
+
/**
|
|
47
|
+
* `onLabelCreateFailure` is an async/sync callback function that will be invoked each time a
|
|
48
|
+
* label purchase fails.
|
|
49
|
+
*/
|
|
14
50
|
onLabelCreateFailure?: ConfigureShipmentProps["onLabelCreateFailure"];
|
|
51
|
+
/**
|
|
52
|
+
* `onLabelCreateSuccess` is an async/sync callback provided by the client that is invoked if the
|
|
53
|
+
* label is successfully created/purchased.
|
|
54
|
+
*/
|
|
15
55
|
onLabelCreateSuccess?: ConfigureShipmentProps["onLabelCreateSuccess"];
|
|
56
|
+
/**
|
|
57
|
+
* `onLoad` is an async/sync callback provided by the host application that is invoked after the
|
|
58
|
+
* element is loaded. (This may be useful to grab the shipmentId of a one-off label)
|
|
59
|
+
*/
|
|
16
60
|
onLoad?: UseConfigureShipmentProps["onLoad"];
|
|
61
|
+
/**
|
|
62
|
+
* `onRateSaved` is an async/sync callback function that will be invoked each time a rate is
|
|
63
|
+
* saved by the user when rate shopping in the host application.
|
|
64
|
+
*/
|
|
17
65
|
onRateSaved?: ConfigureShipmentProps["onRateSaved"];
|
|
66
|
+
/**
|
|
67
|
+
* `onRatesCalculated` is an async/sync callback function that will be invoked each time rates
|
|
68
|
+
* are calculated for a given shipment.
|
|
69
|
+
*/
|
|
18
70
|
onRatesCalculated?: ConfigureShipmentProps["onRatesCalculated"];
|
|
71
|
+
/**
|
|
72
|
+
* `onShipmentUpdated` is an async/sync callback function that will be invoked each time a
|
|
73
|
+
* shipment is updated with a new `ShipTo/ShipFrom Address`, `rate`, `preset`, etc.
|
|
74
|
+
*/
|
|
19
75
|
onShipmentUpdated?: ConfigureShipmentProps["onShipmentUpdated"];
|
|
76
|
+
/**
|
|
77
|
+
* `onToggleAddressPreferenceDisclosure` is an async/sync callback function that will be invoked
|
|
78
|
+
* each time the user toggles the `Address Preference` disclosure. This disclosure component
|
|
79
|
+
* allows the user to select whether they would like to use the address they entered, or
|
|
80
|
+
* the formatted address that we return after validation.
|
|
81
|
+
*/
|
|
20
82
|
onToggleAddressPreferenceDisclosure?: ConfigureShipmentProps["onToggleAddressPreferenceDisclosure"];
|
|
83
|
+
/**
|
|
84
|
+
* `printLabelLayout` is a string that represents the label layout you would like to use when
|
|
85
|
+
* purchasing a label. e.g. `4x6`
|
|
86
|
+
*/
|
|
21
87
|
printLabelLayout?: ConfigureShipmentProps["printLabelLayout"];
|
|
88
|
+
/**
|
|
89
|
+
* `shippingPresets` is an object that contains configured shipment details/specs
|
|
90
|
+
* (dimensions, shipping service, etc) that can be applied to a shipment when purchasing a label.
|
|
91
|
+
*/
|
|
22
92
|
shippingPresets?: UseShippingPresetsOptionsProps;
|
|
93
|
+
/**
|
|
94
|
+
* `warehouseId` is a string that represents a previously configured warehouse you would
|
|
95
|
+
* like to use as the `Ship From Address` when purchasing a label.
|
|
96
|
+
*/
|
|
23
97
|
warehouseId?: UseConfigureShipmentProps["warehouseId"];
|
|
24
98
|
};
|
|
25
|
-
|
|
99
|
+
/**
|
|
100
|
+
* # PurchaseLabel Element Props
|
|
101
|
+
*
|
|
102
|
+
* - The Purchase Label `ElementProps` is a `union` of the `PurchaseLabelByShipmentProps` and
|
|
103
|
+
* `PurchaseLabelSalesOrderProps` prop types. This is for ease of use when purchasing labels by
|
|
104
|
+
* `shipment` or `sales order`.
|
|
105
|
+
*
|
|
106
|
+
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel />`}
|
|
107
|
+
*/
|
|
108
|
+
export type ElementProps = PurchaseLabelByShipmentProps | PurchaseLabelSalesOrderProps;
|
|
109
|
+
/**
|
|
110
|
+
* # Purchase Label Component
|
|
111
|
+
*
|
|
112
|
+
* The `<PurchaseLabel />` component is used to purchase shipping labels from various carriers
|
|
113
|
+
*
|
|
114
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel />` component for shipment
|
|
115
|
+
* based or sales order based label purchasing.
|
|
116
|
+
*
|
|
117
|
+
* @returns Element An EmotionJSX.Element that will render the `<PurchaseLabel />` component
|
|
118
|
+
* with all the appropriate wrappers.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
122
|
+
* ```tsx
|
|
123
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
124
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
125
|
+
* resources: { en },
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* <br />
|
|
130
|
+
*
|
|
131
|
+
* @see {@link PurchaseLabel.Element | The **Element** created to render `<PurchaseLabel />`}
|
|
132
|
+
*/
|
|
26
133
|
export declare const Component: ({ ...props }: ElementProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
134
|
+
/**
|
|
135
|
+
* # Registered Purchase Label Element
|
|
136
|
+
*
|
|
137
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
138
|
+
* based or sales order based label purchasing.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
142
|
+
* Element directly.
|
|
143
|
+
* ```tsx
|
|
144
|
+
* <PurchaseLabel.Element
|
|
145
|
+
* key={currentSalesOrderId}
|
|
146
|
+
* printLabelLayout='4x6'
|
|
147
|
+
* shippingPresets={presets}
|
|
148
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
149
|
+
* onRateSaved={(
|
|
150
|
+
* shipment: SE.SalesOrderShipment,
|
|
151
|
+
* rate?: SE.Rate,
|
|
152
|
+
* rateOptions?: SE.Rate[]
|
|
153
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
154
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
155
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
156
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
157
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
158
|
+
* warehouseId={defaultWarehouseId}
|
|
159
|
+
* />
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* <br />
|
|
163
|
+
*
|
|
164
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
165
|
+
* associated shipment and pass it into the `<ViewShipment.Element />` Element in order to view
|
|
166
|
+
* the shipment details.
|
|
167
|
+
*
|
|
168
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
169
|
+
*
|
|
170
|
+
* @see {@link ViewShipment.Element | The next step in the label purchase workflow `<ViewShipment.Element />`}
|
|
171
|
+
*/
|
|
27
172
|
export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
28
173
|
resources?: {
|
|
29
174
|
en: {
|
|
@@ -164,12 +309,22 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
164
309
|
currentBalance: string;
|
|
165
310
|
insufficientBalanceCTA: string;
|
|
166
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* # Purchase Label Component Props
|
|
314
|
+
*
|
|
315
|
+
* These are the shared props that will be passed into the `<PurchaseLabel.Element />`, and work
|
|
316
|
+
* for either shipment-based or sales order-based label purchasing.
|
|
317
|
+
*
|
|
318
|
+
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel.Element />`}
|
|
319
|
+
*/
|
|
167
320
|
cta: {
|
|
168
321
|
addPackageDetails: string;
|
|
169
322
|
};
|
|
170
323
|
errorMessages: {
|
|
171
324
|
customsItemsRequired: string;
|
|
172
|
-
invalidAddress: string;
|
|
325
|
+
invalidAddress: string; /**
|
|
326
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
327
|
+
*/
|
|
173
328
|
noRates: string;
|
|
174
329
|
salesOrderNotLoaded: string;
|
|
175
330
|
unsupportedAddress: string;
|
|
@@ -230,6 +385,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
230
385
|
rates: {
|
|
231
386
|
uspsMediaMailAcknowledgement: string;
|
|
232
387
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
388
|
+
dhlExpressTermsAcknowledgement: string;
|
|
233
389
|
};
|
|
234
390
|
shipToAddressFormFields: string;
|
|
235
391
|
sections: {
|
|
@@ -291,6 +447,14 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
291
447
|
status: {
|
|
292
448
|
saving: string;
|
|
293
449
|
saved: string;
|
|
450
|
+
/**
|
|
451
|
+
* # Purchase Label Component Props
|
|
452
|
+
*
|
|
453
|
+
* These are the shared props that will be passed into the `<PurchaseLabel.Element />`, and work
|
|
454
|
+
* for either shipment-based or sales order-based label purchasing.
|
|
455
|
+
*
|
|
456
|
+
* @see {@link PurchaseLabel.Element | This prop types usage in `<PurchaseLabel.Element />`}
|
|
457
|
+
*/
|
|
294
458
|
savingFailed: string;
|
|
295
459
|
};
|
|
296
460
|
units: {
|
|
@@ -304,7 +468,9 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
304
468
|
title: string;
|
|
305
469
|
standard: string;
|
|
306
470
|
g: string;
|
|
307
|
-
kg: string;
|
|
471
|
+
kg: string; /**
|
|
472
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
473
|
+
*/
|
|
308
474
|
};
|
|
309
475
|
};
|
|
310
476
|
};
|
|
@@ -497,7 +663,12 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
497
663
|
fields: {
|
|
498
664
|
contentsType: string;
|
|
499
665
|
countryOfOrigin: string;
|
|
500
|
-
description: string;
|
|
666
|
+
description: string; /**
|
|
667
|
+
* `onToggleAddressPreferenceDisclosure` is an async/sync callback function that will be invoked
|
|
668
|
+
* each time the user toggles the `Address Preference` disclosure. This disclosure component
|
|
669
|
+
* allows the user to select whether they would like to use the address they entered, or
|
|
670
|
+
* the formatted address that we return after validation.
|
|
671
|
+
*/
|
|
501
672
|
harmonizedTariffCode: string;
|
|
502
673
|
ifDeliveryFails: string;
|
|
503
674
|
quantity: string;
|
|
@@ -514,7 +685,10 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
514
685
|
};
|
|
515
686
|
errorMessages: {
|
|
516
687
|
invalidNameOrCompany: string;
|
|
517
|
-
parsingFailure: string;
|
|
688
|
+
parsingFailure: string; /**
|
|
689
|
+
* `shippingPresets` is an object that contains configured shipment details/specs
|
|
690
|
+
* (dimensions, shipping service, etc) that can be applied to a shipment when purchasing a label.
|
|
691
|
+
*/
|
|
518
692
|
noWarehouses: string;
|
|
519
693
|
unableToLoad: {
|
|
520
694
|
accountSettings: string;
|
|
@@ -616,11 +790,16 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
616
790
|
ounces: string;
|
|
617
791
|
pounds_one: string;
|
|
618
792
|
pounds_other: string;
|
|
793
|
+
kilogram: string;
|
|
794
|
+
gram: string;
|
|
619
795
|
};
|
|
620
796
|
units: {
|
|
621
|
-
|
|
797
|
+
inch: string;
|
|
622
798
|
lbs: string;
|
|
623
799
|
oz: string;
|
|
800
|
+
centimeter: string;
|
|
801
|
+
gram: string;
|
|
802
|
+
kilogram: string;
|
|
624
803
|
};
|
|
625
804
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": string;
|
|
626
805
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": string;
|
|
@@ -629,6 +808,7 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
629
808
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
630
809
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
631
810
|
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: string;
|
|
811
|
+
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcHBlciBuYW1l: string;
|
|
632
812
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": string;
|
|
633
813
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": string;
|
|
634
814
|
};
|
|
@@ -648,5 +828,9 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
648
828
|
};
|
|
649
829
|
} | undefined;
|
|
650
830
|
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
831
|
+
/**
|
|
832
|
+
* # Purchase Label Component Props
|
|
833
|
+
*
|
|
834
|
+
* @see {@link PurchaseLabel.Component | The **Common Props** used in the `<PurchaseLabel /> component`}
|
|
835
|
+
*/
|
|
651
836
|
export type ComponentProps = React.ComponentProps<typeof Element>;
|
|
652
|
-
export {};
|
|
@@ -1,12 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { Shipment } from "@shipengine/js-api";
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* # Label Workflow Props
|
|
7
|
+
*
|
|
8
|
+
* - These are the base props that will be passed into the `<LabelWorkflow />` component.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component}
|
|
11
|
+
*/
|
|
12
|
+
export type LabelWorkflowProps = {
|
|
13
|
+
/**
|
|
14
|
+
* `callbacks` is an optional set of callbacks that will be invoked at various points in the
|
|
15
|
+
* label purchasing workflow.
|
|
16
|
+
*/
|
|
3
17
|
callbacks?: {
|
|
18
|
+
/**
|
|
19
|
+
* `onLabelCreateSuccess` is an optional callback function that will be invoked when a label
|
|
20
|
+
* has been successfully purchased.
|
|
21
|
+
*/
|
|
4
22
|
onLabelCreateSuccess?: (label: {
|
|
5
23
|
labelId: string;
|
|
6
24
|
}, shipment: Shipment) => void;
|
|
7
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
28
|
+
*/
|
|
8
29
|
features: any;
|
|
30
|
+
/**
|
|
31
|
+
* `labelId` is the unique identifier for the label you wish to view.
|
|
32
|
+
*/
|
|
9
33
|
labelId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* `multiplexedId` is the unique pattern of props that help index which Element is being displayed.
|
|
36
|
+
*/
|
|
10
37
|
multiplexedId: ({
|
|
11
38
|
orderSourceCode: string;
|
|
12
39
|
} & ({
|
|
@@ -21,5 +48,114 @@ type LabelWorkflowProps = {
|
|
|
21
48
|
oneOff: true;
|
|
22
49
|
};
|
|
23
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*
|
|
54
|
+
* # Label Workflow Component
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* const {
|
|
59
|
+
* labelId,
|
|
60
|
+
* multiplexedId,
|
|
61
|
+
* isVoidingLabel,
|
|
62
|
+
* shipmentId,
|
|
63
|
+
* setLabelId,
|
|
64
|
+
* setShipmentId,
|
|
65
|
+
* setIsVoidingLabel,
|
|
66
|
+
* } = useLabelWorkflow({
|
|
67
|
+
* _labelId,
|
|
68
|
+
* _multiplexedId,
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* <br />
|
|
73
|
+
*
|
|
74
|
+
* @see {@link LabelWorkflow.Element | The `<LabelWorkflow.Element />` component using this hook}
|
|
75
|
+
*/
|
|
76
|
+
export declare const useLabelWorkflow: ({ _multiplexedId, _labelId, }: {
|
|
77
|
+
_callbacks?: {
|
|
78
|
+
/**
|
|
79
|
+
* `onLabelCreateSuccess` is an optional callback function that will be invoked when a label
|
|
80
|
+
* has been successfully purchased.
|
|
81
|
+
*/
|
|
82
|
+
onLabelCreateSuccess?: ((label: {
|
|
83
|
+
labelId: string;
|
|
84
|
+
}, shipment: Shipment) => void) | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
_labelId?: string | undefined;
|
|
87
|
+
_multiplexedId: ({
|
|
88
|
+
orderSourceCode: string;
|
|
89
|
+
} & ({
|
|
90
|
+
externalOrderNumber: string;
|
|
91
|
+
} | {
|
|
92
|
+
externalOrderId: string;
|
|
93
|
+
})) | {
|
|
94
|
+
salesOrderId: string;
|
|
95
|
+
} | {
|
|
96
|
+
shipmentId: string;
|
|
97
|
+
} | {
|
|
98
|
+
oneOff: true;
|
|
99
|
+
};
|
|
100
|
+
}) => {
|
|
101
|
+
isVoidingLabel: boolean;
|
|
102
|
+
labelId: string | undefined;
|
|
103
|
+
multiplexedId: ({
|
|
104
|
+
orderSourceCode: string;
|
|
105
|
+
} & ({
|
|
106
|
+
externalOrderNumber: string;
|
|
107
|
+
} | {
|
|
108
|
+
externalOrderId: string;
|
|
109
|
+
})) | {
|
|
110
|
+
salesOrderId: string;
|
|
111
|
+
} | {
|
|
112
|
+
shipmentId: string;
|
|
113
|
+
} | {
|
|
114
|
+
oneOff: true;
|
|
115
|
+
};
|
|
116
|
+
setIsVoidingLabel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
117
|
+
setLabelId: (nextLabelId: LabelWorkflowProps["labelId"]) => void;
|
|
118
|
+
setMultiplexedId: React.Dispatch<React.SetStateAction<({
|
|
119
|
+
orderSourceCode: string;
|
|
120
|
+
} & ({
|
|
121
|
+
externalOrderNumber: string;
|
|
122
|
+
} | {
|
|
123
|
+
externalOrderId: string;
|
|
124
|
+
})) | {
|
|
125
|
+
salesOrderId: string;
|
|
126
|
+
} | {
|
|
127
|
+
shipmentId: string;
|
|
128
|
+
} | {
|
|
129
|
+
oneOff: true;
|
|
130
|
+
}>>;
|
|
131
|
+
setShipmentId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
132
|
+
shipmentId: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* @internal
|
|
136
|
+
*
|
|
137
|
+
* # Label Workflow Element
|
|
138
|
+
*
|
|
139
|
+
* - The `<LabelWorkflow.Element />` component is a composition of the PurchaseLabel, ViewShipment,
|
|
140
|
+
* and VoidLabel elements that allows users to purchase a label, view the shipment details, and optionally void their shipping label.
|
|
141
|
+
*
|
|
142
|
+
* @param LabelWorkflowProps The props necessary to render the `<LabelWorkflow.Element />` for shipment
|
|
143
|
+
* based or sales order based label purchasing.
|
|
144
|
+
*
|
|
145
|
+
* @returns Element A React Element that will render the `<LabelWorkflow />` component.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* <LabelWorkflow
|
|
150
|
+
* {...elementProps}
|
|
151
|
+
* callbacks={{ onLabelCreateSuccess }}
|
|
152
|
+
* multiplexedId={elementIdProps}
|
|
153
|
+
* />
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* <br />
|
|
157
|
+
*
|
|
158
|
+
* @see {@link LabelWorkflowProps | The props that are passed into the `<LabelWorkflow />` component}
|
|
159
|
+
* @see {@link LabelWorkflow.useLabelWorkflow | The `hook` that is used to manage the state of the `<LabelWorkflow />` component}
|
|
160
|
+
*/
|
|
24
161
|
export declare const Element: ({ multiplexedId: _multiplexedId, labelId: _labelId, features: propFeatures, callbacks, }: LabelWorkflowProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|
|
@@ -1,14 +1,94 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SE } from "@shipengine/alchemy";
|
|
3
3
|
import { Templates } from "../../components";
|
|
4
|
+
/**
|
|
5
|
+
* # View Shipment Component Props
|
|
6
|
+
*
|
|
7
|
+
* - These are the base props that will be passed into the `<ViewShipment />` component.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link ViewShipment.Component | This prop types usage in the `<ViewShipment />` component}
|
|
10
|
+
*/
|
|
4
11
|
export type ComponentProps = {
|
|
12
|
+
/**
|
|
13
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
14
|
+
*/
|
|
5
15
|
features?: Templates.ShipmentFeatures;
|
|
16
|
+
/**
|
|
17
|
+
* `onClickPrintLabel` is a callback function that will be invoked when the user clicks the
|
|
18
|
+
* `Print Label` button.
|
|
19
|
+
*/
|
|
6
20
|
onClickPrintLabel?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* `onClickPurchaseLabel` is a callback function that will be invoked when the user clicks the
|
|
23
|
+
* `Purchase Label` button.
|
|
24
|
+
*/
|
|
7
25
|
onClickPurchaseLabel?: (order: SE.SalesOrder) => void;
|
|
26
|
+
/**
|
|
27
|
+
* `onClickVoidLabel` is a callback function that will be invoked when the user clicks the
|
|
28
|
+
* `Void Label` button.
|
|
29
|
+
*/
|
|
8
30
|
onClickVoidLabel?: (label: SE.Label) => void;
|
|
31
|
+
/**
|
|
32
|
+
* `shipmentId` is the unique identifier for the shipment you wish to view.
|
|
33
|
+
*/
|
|
9
34
|
shipmentId?: string;
|
|
10
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* # View Shipment Component
|
|
38
|
+
*
|
|
39
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
40
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
41
|
+
* previously voided labels for a given shipment using this component.
|
|
42
|
+
*
|
|
43
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
44
|
+
*
|
|
45
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
46
|
+
* with all the appropriate wrappers.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
50
|
+
* ```tsx
|
|
51
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
52
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
53
|
+
* resources: { en },
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* <br />
|
|
58
|
+
*
|
|
59
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
60
|
+
*/
|
|
11
61
|
export declare const Component: ({ features, onClickPrintLabel, onClickPurchaseLabel, onClickVoidLabel, shipmentId, }: ComponentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
62
|
+
/**
|
|
63
|
+
* # Registered View Shipment Element
|
|
64
|
+
*
|
|
65
|
+
* - This is the registered `<ViewShipment />` element that will be used to render the
|
|
66
|
+
* `<ViewShipment.Element />` component.
|
|
67
|
+
*
|
|
68
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
69
|
+
* the `<ViewShipment.Element />` component.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `ViewShipment`
|
|
73
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <ViewShipment.Element
|
|
76
|
+
* onClickPurchaseLabel={({ salesOrderId }) => {
|
|
77
|
+
* console.log('sales order ID', salesOrderId);
|
|
78
|
+
* }}
|
|
79
|
+
* onClickVoidLabel={({ labelId }) => {
|
|
80
|
+
* console.log('voided label', labelId);
|
|
81
|
+
* }}
|
|
82
|
+
* shipmentId="se-1234567"
|
|
83
|
+
* />
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* <br />
|
|
87
|
+
*
|
|
88
|
+
* @see {@link ViewShipment.ComponentProps | The **props** that can be passed into the `<ViewShipment.Element />` component}
|
|
89
|
+
*
|
|
90
|
+
* @see {@link VoidLabel.Element | The next step in the label purchase workflow `<VoidLabel.Element />`}
|
|
91
|
+
**/
|
|
12
92
|
export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
13
93
|
resources?: {
|
|
14
94
|
en: {
|
|
@@ -215,6 +295,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
215
295
|
rates: {
|
|
216
296
|
uspsMediaMailAcknowledgement: string;
|
|
217
297
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
298
|
+
dhlExpressTermsAcknowledgement: string;
|
|
218
299
|
};
|
|
219
300
|
shipToAddressFormFields: string;
|
|
220
301
|
sections: {
|
|
@@ -244,6 +325,10 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
244
325
|
register: string;
|
|
245
326
|
carriers: string;
|
|
246
327
|
addresses: string;
|
|
328
|
+
/**
|
|
329
|
+
* `onClickPrintLabel` is a callback function that will be invoked when the user clicks the
|
|
330
|
+
* `Print Label` button.
|
|
331
|
+
*/
|
|
247
332
|
billing: string;
|
|
248
333
|
};
|
|
249
334
|
warehouse: {
|
|
@@ -282,7 +367,10 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
282
367
|
title: string;
|
|
283
368
|
dimensions: {
|
|
284
369
|
title: string;
|
|
285
|
-
standard: string;
|
|
370
|
+
standard: string; /**
|
|
371
|
+
* `onClickPrintLabel` is a callback function that will be invoked when the user clicks the
|
|
372
|
+
* `Print Label` button.
|
|
373
|
+
*/
|
|
286
374
|
metric: string;
|
|
287
375
|
};
|
|
288
376
|
weight: {
|
|
@@ -418,6 +506,31 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
418
506
|
title: string;
|
|
419
507
|
originalAddress: string;
|
|
420
508
|
matchedAddress: string;
|
|
509
|
+
/**
|
|
510
|
+
* # View Shipment Component
|
|
511
|
+
*
|
|
512
|
+
* - The `<ViewShipment />` component is used to for viewing the shipment's tracking number, printing the label that
|
|
513
|
+
* was created, and the option to void the label. When a label is voided, you can see a list of the
|
|
514
|
+
* previously voided labels for a given shipment using this component.
|
|
515
|
+
*
|
|
516
|
+
* @param ComponentProps The base props that will be passed into the `<ViewShipment />` component.
|
|
517
|
+
*
|
|
518
|
+
* @returns Element An EmotionJSX.Element that will render the `<ViewShipment />` component
|
|
519
|
+
* with all the appropriate wrappers.
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
523
|
+
* ```tsx
|
|
524
|
+
* export const Element = alchemy.createElement(Component, ErrorFallback, {
|
|
525
|
+
* css: { height: "100%", maxWidth: "800px", minWidth: "440px", width: "100%" },
|
|
526
|
+
* resources: { en },
|
|
527
|
+
* });
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* <br />
|
|
531
|
+
*
|
|
532
|
+
* @see {@link ViewShipment.Element | The **Element** created to render `<ViewShipment />`}
|
|
533
|
+
*/
|
|
421
534
|
unableToValidate: string;
|
|
422
535
|
use: {
|
|
423
536
|
originalAddress: string;
|
|
@@ -601,11 +714,16 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
601
714
|
ounces: string;
|
|
602
715
|
pounds_one: string;
|
|
603
716
|
pounds_other: string;
|
|
717
|
+
kilogram: string;
|
|
718
|
+
gram: string;
|
|
604
719
|
};
|
|
605
720
|
units: {
|
|
606
|
-
|
|
721
|
+
inch: string;
|
|
607
722
|
lbs: string;
|
|
608
723
|
oz: string;
|
|
724
|
+
centimeter: string;
|
|
725
|
+
gram: string;
|
|
726
|
+
kilogram: string;
|
|
609
727
|
};
|
|
610
728
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": string;
|
|
611
729
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": string;
|
|
@@ -614,6 +732,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
614
732
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
615
733
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
616
734
|
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: string;
|
|
735
|
+
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcHBlciBuYW1l: string;
|
|
617
736
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": string;
|
|
618
737
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": string;
|
|
619
738
|
};
|
|
@@ -633,4 +752,11 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
633
752
|
};
|
|
634
753
|
} | undefined;
|
|
635
754
|
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
755
|
+
/**
|
|
756
|
+
* # View Shipment Element Props
|
|
757
|
+
*
|
|
758
|
+
* - These are the base props that will be passed into the `<ViewShipment />` element.
|
|
759
|
+
*
|
|
760
|
+
* @see {@link ViewShipment.Element | See the full type that `typeof Element` will return}
|
|
761
|
+
*/
|
|
636
762
|
export type ElementProps = React.ComponentProps<typeof Element>;
|