@shipengine/elements 0.33.0 → 0.35.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 +1975 -493
- package/index.js +1970 -496
- package/package.json +1 -1
- package/src/components/add-funds-form/add-funds-form.d.ts +22 -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/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
- package/src/components/templates/landing-page/landing-page.d.ts +2 -1
- package/src/components/templates/onboarding/onboarding.d.ts +3 -1
- package/src/components/templates/onboarding/onboarding.styles.d.ts +10 -0
- 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/templates/warehouse-form/warehouse-form.d.ts +1 -1
- 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 +139 -3
- 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 +99 -5
- package/src/elements/purchase-label/purchase-label.d.ts +194 -9
- package/src/elements/shipengine-workflow/label-workflow.d.ts +138 -2
- package/src/elements/view-shipment/view-shipment.d.ts +131 -4
- package/src/elements/void-label/void-label.d.ts +137 -5
- 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 +11 -3
- 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
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Nested Form Hook Props
|
|
6
|
+
*/
|
|
2
7
|
export type NestedFormProps<T, U> = {
|
|
3
8
|
formId: string;
|
|
4
9
|
onCancel?: () => void;
|
|
5
10
|
onSubmit: (payload: U) => Promise<void> | void;
|
|
6
11
|
} & T;
|
|
7
12
|
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*
|
|
15
|
+
* # Nested Form Hook Component
|
|
16
|
+
*
|
|
8
17
|
* Returns a nested form element that can be rendered within another form
|
|
9
18
|
*
|
|
10
19
|
* Handles closing the form on cancel or submission
|
|
@@ -3,9 +3,33 @@ type PageLayoutContextValue = {
|
|
|
3
3
|
FooterPortal: React.FC<PropsWithChildren>;
|
|
4
4
|
HeaderPortal: React.FC<PropsWithChildren>;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*
|
|
9
|
+
* # Page Layout Props
|
|
10
|
+
*
|
|
11
|
+
* @see {@link PageLayoutProvider | The `<PageLayoutProvider />` component}
|
|
12
|
+
*/
|
|
13
|
+
export type PageLayoutProviderProps = {
|
|
14
|
+
/**
|
|
15
|
+
* `children` are the elements that will be rendered inside the page layout.
|
|
16
|
+
*/
|
|
7
17
|
children: React.ReactNode;
|
|
8
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* # Page Layout Component
|
|
23
|
+
*
|
|
24
|
+
* @see {@link PageLayoutProviderProps | The props passed into the `<PageLayoutProvider />` component}
|
|
25
|
+
*/
|
|
9
26
|
export declare const PageLayoutProvider: ({ children }: PageLayoutProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*
|
|
30
|
+
* # Page Layout Hook
|
|
31
|
+
*
|
|
32
|
+
* @category Hooks
|
|
33
|
+
*/
|
|
10
34
|
export declare const usePageLayout: () => PageLayoutContextValue;
|
|
11
35
|
export {};
|
|
@@ -3,17 +3,30 @@ type RootPortalProviderProps = {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*
|
|
8
|
+
* # Root Portal Provider
|
|
9
|
+
*
|
|
6
10
|
* Provides access to a top-level 'root-portal' DOM node, adjacent the app 'root' div
|
|
7
11
|
*
|
|
8
12
|
* @category Providers
|
|
9
13
|
*
|
|
10
|
-
* @see {@link
|
|
14
|
+
* @see {@link useRootPortal | The associated `hook` for this provider}
|
|
11
15
|
*/
|
|
12
16
|
export declare const RootPortalProvider: ({ children }: RootPortalProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
20
|
+
* # Root Portal Provider Hook
|
|
21
|
+
*
|
|
22
|
+
* The `useRootPortal` hook provides access to a top-level 'root-portal' DOM node, adjacent
|
|
23
|
+
* the app 'root' div.
|
|
24
|
+
*
|
|
25
|
+
* - Must be used within {@link RootPortalProvider | a `<RootPortalProvider />`}
|
|
15
26
|
*
|
|
16
27
|
* @category Elements Hooks
|
|
28
|
+
*
|
|
29
|
+
* @see {@link RootPortalProvider | The associated `provider` for this hook}
|
|
17
30
|
*/
|
|
18
31
|
export declare const useRootPortal: () => HTMLDivElement;
|
|
19
32
|
export {};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @internal
|
|
3
|
+
*
|
|
4
|
+
* # Run Once On True Hook
|
|
5
|
+
*
|
|
6
|
+
* - Runs a callback once and only once when a condition is true.
|
|
3
7
|
*
|
|
4
8
|
* @param conditionalEffect A logical expression ending with a callback
|
|
5
9
|
* @example useRunOnceOnTrue(testValue && anotherTestValue && (() => console.log("Hello world!")));
|
|
@@ -5,10 +5,13 @@ type UseScrubErrorsProps = {
|
|
|
5
5
|
scrubber: (e: SE.CodedError) => string;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*
|
|
10
|
+
* # Scrub Errors Hook
|
|
11
|
+
*
|
|
8
12
|
* Generic error pretty printer
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* @param scrubber
|
|
13
|
+
*
|
|
14
|
+
* @category Hooks
|
|
12
15
|
*/
|
|
13
16
|
export declare const useScrubErrors: ({ scrubber, errors, predicate }: UseScrubErrorsProps) => string[] | undefined;
|
|
14
17
|
export {};
|
|
@@ -202,6 +202,7 @@ declare const _default: {
|
|
|
202
202
|
rates: {
|
|
203
203
|
uspsMediaMailAcknowledgement: string;
|
|
204
204
|
uspsFirstClassMailAcknowledgement_leof: string;
|
|
205
|
+
dhlExpressTermsAcknowledgement: string;
|
|
205
206
|
};
|
|
206
207
|
shipToAddressFormFields: string;
|
|
207
208
|
sections: {
|
|
@@ -224,13 +225,14 @@ declare const _default: {
|
|
|
224
225
|
subtitle: string;
|
|
225
226
|
welcome: string;
|
|
226
227
|
messageLine1: string;
|
|
228
|
+
partnerMessageLine1: string;
|
|
227
229
|
messageLine2: string;
|
|
228
230
|
};
|
|
229
231
|
steps: {
|
|
230
|
-
|
|
232
|
+
register: string;
|
|
231
233
|
carriers: string;
|
|
232
234
|
addresses: string;
|
|
233
|
-
|
|
235
|
+
billing: string;
|
|
234
236
|
};
|
|
235
237
|
warehouse: {
|
|
236
238
|
title: string;
|
|
@@ -587,11 +589,16 @@ declare const _default: {
|
|
|
587
589
|
ounces: string;
|
|
588
590
|
pounds_one: string;
|
|
589
591
|
pounds_other: string;
|
|
592
|
+
kilogram: string;
|
|
593
|
+
gram: string;
|
|
590
594
|
};
|
|
591
595
|
units: {
|
|
592
|
-
|
|
596
|
+
inch: string;
|
|
593
597
|
lbs: string;
|
|
594
598
|
oz: string;
|
|
599
|
+
centimeter: string;
|
|
600
|
+
gram: string;
|
|
601
|
+
kilogram: string;
|
|
595
602
|
};
|
|
596
603
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkMTAwLgo=": string;
|
|
597
604
|
"VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": string;
|
|
@@ -600,6 +607,7 @@ declare const _default: {
|
|
|
600
607
|
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
|
|
601
608
|
UGxlYXNlIGFkZCBhIFN0YW1wcy5jb20gYWNjb3VudCB0byBTaGlwRW5naW5lIGluIG9yZGVyIHRvIGNyZWF0ZSBzaGlwcGluZyBsYWJlbHMu: string;
|
|
602
609
|
QSBzaGlwcGluZyBlcnJvciBvY2N1cnJlZDogTWlzc2luZyBvciBpbnZhbGlkIHNoaXBwZXIgbnVtYmVy: string;
|
|
610
|
+
QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcHBlciBuYW1l: string;
|
|
603
611
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBNaXNzaW5nIG9yIGludmFsaWQgc2hpcCB0byBTdGF0ZVByb3ZpbmNlQ29kZQ==": string;
|
|
604
612
|
"QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnZhbGlkIHNvbGQgdG8gc3RhdGUgcHJvdmluY2UgY29kZS4gVmFsaWQgbGVuZ3RoIGlzIDAgdG8gNSBhbHBoYW51bWVyaWM=": string;
|
|
605
613
|
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { CountryCode } from "libphonenumber-js/min";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*
|
|
6
|
+
* # Phone utils
|
|
7
|
+
*
|
|
4
8
|
* @category Form Validation
|
|
5
9
|
*/
|
|
6
10
|
export declare const phoneSchema: (defaultCountryCode?: CountryCode) => z.ZodEffects<z.ZodString, string, string>;
|
|
7
11
|
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*
|
|
14
|
+
* # Phone utils
|
|
15
|
+
*
|
|
8
16
|
* @category Form Validation
|
|
9
17
|
*/
|
|
10
18
|
export declare const phoneSchemaUnvalidated: z.ZodString;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { CarrierConnection, SE } from "@shipengine/alchemy";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Carrier Metadata - Terms
|
|
6
|
+
*/
|
|
2
7
|
export type CarrierTerm = {
|
|
3
8
|
description: string;
|
|
4
9
|
name: string;
|
|
@@ -6,11 +11,21 @@ export type CarrierTerm = {
|
|
|
6
11
|
url: string;
|
|
7
12
|
version: string;
|
|
8
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* # Carrier Metadata - Terms
|
|
18
|
+
*/
|
|
9
19
|
export type CarrierTerms = {
|
|
10
20
|
content: string[];
|
|
11
21
|
links: CarrierTerm[];
|
|
12
22
|
title: string;
|
|
13
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*
|
|
27
|
+
* # Carrier Metadata
|
|
28
|
+
*/
|
|
14
29
|
export type CarrierMetadata = {
|
|
15
30
|
carrierCode: CarrierConnection["carrierCode"];
|
|
16
31
|
logo: string;
|
|
@@ -20,6 +35,11 @@ export type CarrierMetadata = {
|
|
|
20
35
|
shortname: string;
|
|
21
36
|
terms?: CarrierTerms;
|
|
22
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*
|
|
41
|
+
* # Carrier Metadata - Features
|
|
42
|
+
*/
|
|
23
43
|
export type CarriersFeatures = {
|
|
24
44
|
enabledCarriers?: SE.Carrier["carrierCode"][];
|
|
25
45
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*
|
|
4
|
+
* # Create Dictionary Utility Function
|
|
5
|
+
*
|
|
2
6
|
* @category Utilities
|
|
3
7
|
*/
|
|
4
8
|
export declare const createDictionary: <T extends object, U>(items: T[] | undefined, getEntry: (item: T, partialResults: Record<string, U | undefined>) => Record<string, U | undefined>) => Record<string, U | undefined>;
|
package/src/utilities/date.d.ts
CHANGED
|
@@ -1,42 +1,92 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*
|
|
4
|
+
* # Date Utils - getDaysInMonth
|
|
5
|
+
*
|
|
2
6
|
* @category Utilities
|
|
3
7
|
*/
|
|
4
8
|
export declare const formatDate: (date: string, locale?: string) => string;
|
|
5
9
|
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*
|
|
12
|
+
* # Date Utils - formatDateDDMMYY
|
|
13
|
+
*
|
|
6
14
|
* @category Utilities
|
|
7
15
|
*/
|
|
8
16
|
export declare const formatDateDDMMYY: (date: string, locale?: string) => string;
|
|
9
17
|
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
20
|
+
* # Date Utils - getDaysInMonth
|
|
21
|
+
*
|
|
10
22
|
* @category Utilities
|
|
11
23
|
*/
|
|
12
24
|
export declare const daysAfter: (days: number, date?: Date) => Date;
|
|
13
25
|
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*
|
|
28
|
+
* # Date Utils - getDaysInMonth
|
|
29
|
+
*
|
|
14
30
|
* @category Utilities
|
|
15
31
|
*/
|
|
16
32
|
export declare const nextDayCutoff: (cutoff: number, date?: Date) => Date;
|
|
17
33
|
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*
|
|
36
|
+
* # Date Utils - getDaysInMonth
|
|
37
|
+
*
|
|
18
38
|
* @category Utilities
|
|
19
39
|
*/
|
|
20
40
|
export declare const mostRecent: (...dates: Date[]) => Date;
|
|
21
41
|
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*
|
|
44
|
+
* # Date Utils - getDaysInMonth
|
|
45
|
+
*
|
|
22
46
|
* @category Utilities
|
|
23
47
|
*/
|
|
24
48
|
export declare const omitTime: (shipDate?: string) => Date;
|
|
25
49
|
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*
|
|
52
|
+
* # Date Utils - getExpirationYears
|
|
53
|
+
*
|
|
26
54
|
* @category Utilities
|
|
27
55
|
*/
|
|
28
56
|
export declare const getExpirationYears: (yearsValid: number) => string[];
|
|
29
57
|
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*
|
|
60
|
+
* # Date Utilities - HasCreationDate Type
|
|
61
|
+
*
|
|
30
62
|
* @category Utilities
|
|
31
63
|
*/
|
|
32
|
-
type HasCreationDate = {
|
|
64
|
+
export type HasCreationDate = {
|
|
33
65
|
createdAt: string;
|
|
34
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*
|
|
70
|
+
* # Date Utilities - sortByCreationDate
|
|
71
|
+
*
|
|
72
|
+
* @category Utilities
|
|
73
|
+
*/
|
|
35
74
|
export declare const sortByCreationDate: (a: HasCreationDate, b: HasCreationDate, order?: "asc" | "desc") => number;
|
|
36
75
|
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*
|
|
78
|
+
* # Date Utilities - isNowOrInTheFuture
|
|
79
|
+
*
|
|
37
80
|
* @category Utilities
|
|
38
81
|
*/
|
|
39
82
|
export declare const isNowOrInTheFuture: (shipDate?: string) => boolean;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*
|
|
86
|
+
* # Date Utilities - getRelativeDates
|
|
87
|
+
*
|
|
88
|
+
* @category Utilities
|
|
89
|
+
*/
|
|
40
90
|
export declare const getRelativeDates: (from?: Date) => {
|
|
41
91
|
firstDayOfMonth: Date;
|
|
42
92
|
lastDayOfTheMonth: Date;
|
|
@@ -45,4 +95,3 @@ export declare const getRelativeDates: (from?: Date) => {
|
|
|
45
95
|
previousMonthLastDay: Date;
|
|
46
96
|
thirtyDaysAgo: Date;
|
|
47
97
|
};
|
|
48
|
-
export {};
|
package/src/utilities/error.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Create Coded Errors Utlity Function
|
|
6
|
+
*
|
|
7
|
+
* - This function extracts errors from our `Axios Responses`.
|
|
8
|
+
*
|
|
3
9
|
* @category Utilities
|
|
4
10
|
*/
|
|
5
11
|
export declare const createCodedErrors: (err: any) => any;
|
|
@@ -7,11 +13,19 @@ type HasMessage = {
|
|
|
7
13
|
message: string;
|
|
8
14
|
};
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
16
|
+
* @internal
|
|
17
|
+
*
|
|
18
|
+
* - Joins a list of error-like object's messages and throws them as a single error.
|
|
19
|
+
*
|
|
20
|
+
* @category Utilities
|
|
11
21
|
*/
|
|
12
22
|
export declare function throwJoinedMessages(errors: HasMessage[]): never;
|
|
13
23
|
/**
|
|
14
|
-
*
|
|
24
|
+
* @internal
|
|
25
|
+
*
|
|
26
|
+
* - If any CodedErrors exist, throw them all as a single error, otherwise assert errors is null.
|
|
27
|
+
*
|
|
28
|
+
* @category Utilities
|
|
15
29
|
*/
|
|
16
30
|
export declare function throwAny(errors: SE.CodedError[] | null): asserts errors is null;
|
|
17
31
|
export {};
|
|
@@ -1,3 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @namespace featureFlags
|
|
3
|
+
*
|
|
4
|
+
* - The `featureFlags` namespace contains all the feature flags available throughout the
|
|
5
|
+
* application. All features are scoped by name to the component they are intended for.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* export const featureFlags = {
|
|
10
|
+
* ConfigureSalesOrderShipment: {
|
|
11
|
+
* compatibleCountryCodes: ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"],
|
|
12
|
+
* rateForm: {
|
|
13
|
+
* enableFunding: false,
|
|
14
|
+
* enableGlobalPostFiltering: false,
|
|
15
|
+
* labelLayout: false,
|
|
16
|
+
* nicknameRate: true,
|
|
17
|
+
* saveRate: true,
|
|
18
|
+
* },
|
|
19
|
+
* shipmentForm: {
|
|
20
|
+
* browseRates: true,
|
|
21
|
+
* includeShipsuranceInsurance: true,
|
|
22
|
+
* includeThirdPartyInsurance: true,
|
|
23
|
+
* selectService: true,
|
|
24
|
+
* shippingPresets: false,
|
|
25
|
+
* },
|
|
26
|
+
* },
|
|
27
|
+
* Global: {
|
|
28
|
+
* carriers: {
|
|
29
|
+
* enabledCarriers: ["stamps_com", "ups", "dhl_express_walleted"],
|
|
30
|
+
* },
|
|
31
|
+
* presentation: {
|
|
32
|
+
* poweredByShipEngine: false,
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* ViewShipment: {
|
|
36
|
+
* shipment: {
|
|
37
|
+
* schedulePickup: true,
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* } as const;
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const featureFlags: {
|
|
44
|
+
/**
|
|
45
|
+
* `ConfigureSalesOrderShipment` all scoped feature flags for the shipment configuration
|
|
46
|
+
* section of the `<PurchaseLabel />` element.
|
|
47
|
+
*/
|
|
48
|
+
readonly ConfigureSalesOrderShipment: {
|
|
49
|
+
/**
|
|
50
|
+
* `compatibleCountryCodes` is a list of all supported `countries` available in ShipEngine
|
|
51
|
+
* Elements.
|
|
52
|
+
*/
|
|
53
|
+
readonly compatibleCountryCodes: readonly ["AU", "CA", "FR", "DE", "GB", "IL", "IT", "NO", "ES", "SE", "US"];
|
|
54
|
+
/**
|
|
55
|
+
* `rateForm` all scoped feature flags for the `rate form` section of the `<PurchaseLabel />`
|
|
56
|
+
* element.
|
|
57
|
+
*/
|
|
58
|
+
readonly rateForm: {
|
|
59
|
+
/**
|
|
60
|
+
* `enableFunding` enables the `funding` section of the rate form.
|
|
61
|
+
*/
|
|
62
|
+
readonly enableFunding: false;
|
|
63
|
+
/**
|
|
64
|
+
* `enableGlobalPostFiltering` enables the `global post filtering` on all rates fetched
|
|
65
|
+
* in the rates form.
|
|
66
|
+
*/
|
|
67
|
+
readonly enableGlobalPostFiltering: false;
|
|
68
|
+
/**
|
|
69
|
+
* `labelLayout` enables the `label layout` section of the `<PurchaseLabel /> element.
|
|
70
|
+
*/
|
|
71
|
+
readonly labelLayout: false;
|
|
72
|
+
/**
|
|
73
|
+
* `nicknameRate` enables showing the `carrier nickname` when rates are fetched.
|
|
74
|
+
*/
|
|
75
|
+
readonly nicknameRate: true;
|
|
76
|
+
readonly requireDhlTermsAcknowledgement: false;
|
|
77
|
+
/**
|
|
78
|
+
* `saveRate` enables the `save rate` button in the rate form. This allows users to save a
|
|
79
|
+
* `rateId` for a shipment to be purchased later.
|
|
80
|
+
*/
|
|
81
|
+
readonly saveRate: true;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* `shipmentForm` all scoped feature flags for the `shipment form` section of the
|
|
85
|
+
* `<PurchaseLabel />` element.
|
|
86
|
+
*/
|
|
87
|
+
readonly shipmentForm: {
|
|
88
|
+
/**
|
|
89
|
+
* `browseRates` enables the `browse rates` button in the shipment form. This allows users
|
|
90
|
+
* to browse rates for a shipment with varying shipment configurations. This is useful for
|
|
91
|
+
* rate shopping.
|
|
92
|
+
*/
|
|
93
|
+
readonly browseRates: true;
|
|
94
|
+
/**
|
|
95
|
+
* `includeShipsuranceInsurance` enables the `shipsurance insurance` feature, allowing users
|
|
96
|
+
* to select Shipsurance when insuring their shipment.
|
|
97
|
+
*/
|
|
98
|
+
readonly includeShipsuranceInsurance: true;
|
|
99
|
+
/**
|
|
100
|
+
* `includeThirdPartyInsurance` enables the `third party insurance` feature, allowing users
|
|
101
|
+
* to opt for third party insurance when insuring their shipment.
|
|
102
|
+
*/
|
|
103
|
+
readonly includeThirdPartyInsurance: true;
|
|
104
|
+
/**
|
|
105
|
+
* `selectService` enables the `select service` feature, allowing users to select a service
|
|
106
|
+
* when rate shopping across multiple carrier providers.
|
|
107
|
+
*/
|
|
108
|
+
readonly selectService: true;
|
|
109
|
+
/**
|
|
110
|
+
* `shippingPresets` enables the `shipping presets` feature, allowing users to pass in a set
|
|
111
|
+
* of shipping presets they wish to use within the shipment form of the `<PurchaseLabel />`
|
|
112
|
+
* element.
|
|
113
|
+
*/
|
|
114
|
+
readonly shippingPresets: false;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* `Global` all feature flags that are intended for use anywhere in ShipEngine Elements.
|
|
119
|
+
*/
|
|
120
|
+
readonly Global: {
|
|
121
|
+
/**
|
|
122
|
+
* All global `carrier` related feature flags.
|
|
123
|
+
*/
|
|
124
|
+
readonly carriers: {
|
|
125
|
+
/**
|
|
126
|
+
* `enabledCarriers` is a list of all `carriers` that are enabled for use in ShipEngine
|
|
127
|
+
* Elements.
|
|
128
|
+
*/
|
|
129
|
+
readonly enabledCarriers: readonly ["stamps_com", "ups", "dhl_express_walleted"];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* All global `presentation` related feature flags.
|
|
133
|
+
*/
|
|
134
|
+
readonly presentation: {
|
|
135
|
+
/**
|
|
136
|
+
* `poweredByShipEngine` enables the `powered by ShipEngine` logo in the footer various
|
|
137
|
+
* elements.
|
|
138
|
+
*/
|
|
139
|
+
readonly poweredByShipEngine: false;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* `ViewShipment` all scoped feature flags for the `<ViewShipment />` element.
|
|
144
|
+
*/
|
|
145
|
+
readonly ViewShipment: {
|
|
146
|
+
/**
|
|
147
|
+
* `shipment` all shipment related features available in the `<ViewShipment />` element.
|
|
148
|
+
*/
|
|
149
|
+
readonly shipment: {
|
|
150
|
+
/**
|
|
151
|
+
* `schedulePickup` enables the `schedule pickup` button in the `<ViewShipment />` element,
|
|
152
|
+
* allowing users to schedule pick-ups for their shipments.
|
|
153
|
+
*/
|
|
154
|
+
readonly schedulePickup: true;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* @internal
|
|
160
|
+
*
|
|
161
|
+
* # Feature Flags - featureFlagComponentNameLookup
|
|
162
|
+
*/
|
|
1
163
|
export declare const featureFlagComponentNameLookup: (componentName: string) => string;
|
|
164
|
+
/**
|
|
165
|
+
* @internal
|
|
166
|
+
*
|
|
167
|
+
* # Feature Flags - getFeatures
|
|
168
|
+
*/
|
|
2
169
|
export declare const getFeatures: (...element: string[]) => any;
|
|
170
|
+
/**
|
|
171
|
+
* # Feature Flags - useFeatures
|
|
172
|
+
*
|
|
173
|
+
* - The `useFeatures` hook is used to retrieve the feature flags for a given component.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* const features = useFeatures("Global");
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* <br />
|
|
181
|
+
*
|
|
182
|
+
* @see {@link featureFlags | All available `Feature Flags`}
|
|
183
|
+
*/
|
|
3
184
|
export declare const useFeatures: (...element: string[]) => any;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { FieldValues, ResolverResult, UseFormHandleSubmit } from "react-hook-form";
|
|
2
2
|
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Form Logger
|
|
6
|
+
*
|
|
3
7
|
* @description
|
|
4
8
|
* This will log the values that are submitted to the validation resolver
|
|
5
9
|
* (only REGISTERED form fields) and the results of that validation.
|
package/src/utilities/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./create-dictionary";
|
|
2
2
|
export * from "./date";
|
|
3
3
|
export * from "./error";
|
|
4
|
+
export * from "./feature-flags";
|
|
4
5
|
export * from "./form-logger";
|
|
5
6
|
export * from "./money";
|
|
6
7
|
export * from "./predicates";
|
|
@@ -9,4 +10,3 @@ export * from "./shipengine";
|
|
|
9
10
|
export * from "./string";
|
|
10
11
|
export * from "./styles";
|
|
11
12
|
export * from "./validation";
|
|
12
|
-
export * from "./feature-flags";
|
package/src/utilities/money.d.ts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Money Utils - currency Symbol
|
|
6
|
+
*/
|
|
2
7
|
export declare const currencySymbol: Record<SE.Currency, string>;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*
|
|
11
|
+
* # Money Utils - formatMoney
|
|
12
|
+
*/
|
|
3
13
|
export declare const formatMoney: (value: SE.Money, locale?: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* # Money Utils - calculateTotal
|
|
18
|
+
*/
|
|
4
19
|
export declare const calculateTotal: (...values: SE.Money[]) => number;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*
|
|
23
|
+
* # Money Utils - formatCreditCardNumber
|
|
24
|
+
*/
|
|
5
25
|
export declare const formatCreditCardNumber: (cc: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* # Money Utils - formatExpiration
|
|
30
|
+
*/
|
|
6
31
|
export declare const formatExpiration: (exp: string) => string;
|
package/src/utilities/rates.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { SE } from "@shipengine/alchemy";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* # Rates Utilities - getRateRequiresAcknowledgement
|
|
6
|
+
*
|
|
7
|
+
* @category Utilities
|
|
8
|
+
*/
|
|
9
|
+
export declare const getRateRequiresAcknowledgement: (serviceCode: string, packageType: string, requireDhlTermsAcknowledgement: boolean) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* # Rates Utilities - getTotalRateAmount
|
|
14
|
+
*
|
|
15
|
+
* @category Utilities
|
|
16
|
+
*/
|
|
3
17
|
export declare const getTotalRateAmount: (rateCosts?: {
|
|
4
18
|
confirmationAmount?: SE.Money;
|
|
5
19
|
insuranceAmount?: SE.Money;
|
|
@@ -7,4 +21,11 @@ export declare const getTotalRateAmount: (rateCosts?: {
|
|
|
7
21
|
shippingAmount?: SE.Money;
|
|
8
22
|
taxAmount?: SE.Money;
|
|
9
23
|
}) => number;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*
|
|
27
|
+
* # Rates Utilities - overrideCarrierCodes
|
|
28
|
+
*
|
|
29
|
+
* @category Utilities
|
|
30
|
+
*/
|
|
10
31
|
export declare const overrideCarrierCodes: (carrier: string, overrides: object) => never;
|