@shipengine/elements 0.16.0 → 0.16.1
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/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/index.d.ts +0 -1
- package/components/templates/rate-form/rate-form.styles.d.ts +1 -0
- package/elements/components/index.d.ts +0 -1
- package/elements/index.d.ts +0 -1
- package/hooks/use-nested-form.d.ts +2 -2
- package/index.cjs +1018 -771
- package/index.js +1008 -772
- 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/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/elements/components/manage-funding/manage-funding.d.ts +0 -6
- 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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type AddFundsFormProvider = {
|
|
3
|
+
isCustomAmount?: boolean;
|
|
4
|
+
isSubmitted?: boolean;
|
|
5
|
+
isSubmitting?: boolean;
|
|
6
|
+
isValid?: boolean;
|
|
7
|
+
selectedAmount?: number;
|
|
8
|
+
submit?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export type AddFundsFormProps = {
|
|
11
|
+
carrierId: string;
|
|
12
|
+
children?: (addFundsForm: AddFundsFormProvider) => React.ReactElement;
|
|
13
|
+
minimumAmount?: number;
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
onSuccess?: () => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Form for adding funds to a carrier's account.
|
|
19
|
+
*
|
|
20
|
+
* If a render child is provided, external control is assumed and the cancel / submit buttons are hidden.
|
|
21
|
+
*/
|
|
22
|
+
export declare const AddFundsForm: ({ carrierId, children, onCancel, onSuccess, minimumAmount, }: AddFundsFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type GetStylesProps = {
|
|
2
|
+
isDisabled?: boolean;
|
|
3
|
+
isSelected?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const getStyles: ({ isDisabled, isSelected }?: GetStylesProps) => Record<"chip" | "chipList" | "fundsInput", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getAddFundsSchema: (minimumAmount?: number) => z.ZodEffects<z.ZodObject<{
|
|
3
3
|
funds: z.ZodObject<z.extendShape<{
|
|
4
4
|
amount: z.ZodNumber;
|
|
5
5
|
currency: z.ZodNativeEnum<typeof import("@shipengine/api").Currency>;
|
|
@@ -22,6 +22,16 @@ export declare const manualFundingSchema: z.ZodObject<{
|
|
|
22
22
|
amount: number;
|
|
23
23
|
currency: import("@shipengine/api").Currency;
|
|
24
24
|
};
|
|
25
|
+
}>, {
|
|
26
|
+
amount: number;
|
|
27
|
+
currency: import("@shipengine/api").Currency;
|
|
28
|
+
}, {
|
|
29
|
+
funds: {
|
|
30
|
+
amount: number;
|
|
31
|
+
currency: import("@shipengine/api").Currency;
|
|
32
|
+
};
|
|
25
33
|
}>;
|
|
26
|
-
|
|
27
|
-
export type
|
|
34
|
+
type AddFundsFormSchema = ReturnType<typeof getAddFundsSchema>;
|
|
35
|
+
export type AddFundsFormFields = z.input<AddFundsFormSchema>;
|
|
36
|
+
export type AddFundsFormPayload = z.output<AddFundsFormSchema>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type AutoFundingFormProps = {
|
|
2
|
+
carrierId: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* This form that allows users to enable or disable auto funding, and
|
|
6
|
+
* configure auto funding settings in ShipEngine API.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AutoFundingForm: ({ carrierId }: AutoFundingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getStyles: (balance?: number) => Record<"balanceText", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./carrier-balance";
|
|
@@ -10,6 +10,7 @@ export type FieldControllerProps<NP, TFieldValues extends FieldValues = FieldVal
|
|
|
10
10
|
displayErrors?: boolean;
|
|
11
11
|
displayLabel?: boolean;
|
|
12
12
|
errors?: string[];
|
|
13
|
+
hint?: string;
|
|
13
14
|
inputOnly?: boolean;
|
|
14
15
|
isOptional?: boolean;
|
|
15
16
|
label: string;
|
|
@@ -19,7 +20,7 @@ export type FieldControllerProps<NP, TFieldValues extends FieldValues = FieldVal
|
|
|
19
20
|
type FieldControllerOptions = {
|
|
20
21
|
inputOnly?: boolean;
|
|
21
22
|
};
|
|
22
|
-
export declare const createFieldController: <P>(options?: FieldControllerOptions) => <TFieldValues extends FieldValues = FieldValues, TName extends import("react-hook-form").Path<TFieldValues> = import("react-hook-form").Path<TFieldValues>>({ children, control, defaultValue, displayErrors, displayLabel, errors: errorsProp, inputOnly, isOptional, label, labelWeight, name, nativeLabel, rules, shouldUnregister, subLabel, ...formInputProps }: FieldControllerProps<P, TFieldValues, TName>) => JSX.Element;
|
|
23
|
+
export declare const createFieldController: <P>(options?: FieldControllerOptions) => <TFieldValues extends FieldValues = FieldValues, TName extends import("react-hook-form").Path<TFieldValues> = import("react-hook-form").Path<TFieldValues>>({ children, control, defaultValue, displayErrors, displayLabel, errors: errorsProp, hint, inputOnly, isOptional, label, labelWeight, name, nativeLabel, rules, shouldUnregister, subLabel, ...formInputProps }: FieldControllerProps<P, TFieldValues, TName>) => JSX.Element;
|
|
23
24
|
export type ControlledFieldProps = Parameters<ControlledField>[0];
|
|
24
25
|
export type ControlledField<NP = object, CP = object, OK extends string = ""> = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(fieldProps: Omit<FieldControllerProps<NP, TFieldValues, TName>, "children" | OK> & CP) => JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type FundAndPurchaseProps = {
|
|
2
|
+
carrierId?: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
isFundingRequired: boolean;
|
|
6
|
+
onPurchase: () => void;
|
|
7
|
+
onSave: () => Promise<void>;
|
|
8
|
+
purchaseAmount: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fund and Purchase handles the label purchase submission UX, ensuring that a user
|
|
12
|
+
* has the necessary funds available and can add them if not. It allows a single button
|
|
13
|
+
* to submit the funding form followed by the purchase form.
|
|
14
|
+
*/
|
|
15
|
+
export declare const FundAndPurchase: ({ carrierId, className, disabled, isFundingRequired, onSave, purchaseAmount, onPurchase, }: FundAndPurchaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getStyles: (isCustomAmount?: boolean) => Record<"balanceText" | "container" | "formExtension" | "saveRateButton", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./fund-and-purchase";
|
package/components/index.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export * as Templates from "./templates";
|
|
2
2
|
export * from "./accordion";
|
|
3
|
+
export * from "./add-funds-form";
|
|
4
|
+
export * from "./auto-funding-form";
|
|
3
5
|
export * from "./button-group";
|
|
6
|
+
export * from "./carrier-balance";
|
|
4
7
|
export * from "./cube";
|
|
5
8
|
export * from "./error-boundary";
|
|
6
9
|
export * from "./field";
|
|
7
10
|
export * from "./field-label";
|
|
8
11
|
export * from "./form-portal";
|
|
12
|
+
export * from "./fund-and-purchase";
|
|
13
|
+
export * from "./inline-label";
|
|
9
14
|
export * from "./items-breakdown";
|
|
15
|
+
export * from "./link-action";
|
|
10
16
|
export * from "./loader";
|
|
17
|
+
export * from "./manage-funding";
|
|
11
18
|
export * from "./portal";
|
|
12
19
|
export * from "./spacer";
|
|
20
|
+
export * from "./spread";
|
|
21
|
+
export * from "./story-notes";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./inline-label";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./link-action";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconNames } from "@packlink/brands";
|
|
2
|
+
import { ILinkProps } from "@packlink/giger";
|
|
3
|
+
declare const icons: {
|
|
4
|
+
readonly add: IconNames.ADD;
|
|
5
|
+
readonly download: IconNames.DOWNLOAD;
|
|
6
|
+
};
|
|
7
|
+
export type LinkActionProps = {
|
|
8
|
+
icon?: keyof typeof icons;
|
|
9
|
+
title: string;
|
|
10
|
+
} & ILinkProps;
|
|
11
|
+
export declare const LinkAction: ({ css, icon, isDisabled, isLoading, title, ...props }: LinkActionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spread";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./story-notes";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type StoryNotesProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
notes: string[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* For relevant notes about Storybook stories
|
|
8
|
+
*
|
|
9
|
+
* Stopgap until we setup https://storybook.js.org/addons/@storybook/addon-docs
|
|
10
|
+
*/
|
|
11
|
+
export declare const StoryNotes: ({ children, notes }: StoryNotesProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,6 @@ export * from "./address-preference-display";
|
|
|
6
6
|
export * from "./carrier-recovery-form";
|
|
7
7
|
export * from "./carrier-terms-form";
|
|
8
8
|
export * from "./customs-item-form";
|
|
9
|
-
export * from "./funding-methods";
|
|
10
9
|
export * from "./label";
|
|
11
10
|
export * from "./landing-page";
|
|
12
11
|
export * from "./list-carriers";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: Record<"fundAndPurchase" | "ratesInterstitial" | "showMoreOrLessRatesButton", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
|
package/elements/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { Element as ListCarriers } from "./list-carriers";
|
|
2
|
-
export { Element as ManageFunding } from "./manage-funding";
|
|
3
2
|
export { Element as ManageWarehouses } from "./manage-warehouses";
|
|
4
3
|
export { Element as PurchaseLabel } from "./purchase-label";
|
|
5
4
|
export { Element as Onboarding } from "./onboarding";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
export type NestedFormProps<T, U> = {
|
|
3
3
|
formId: string;
|
|
4
4
|
onCancel?: () => void;
|
|
5
|
-
onSubmit: (payload: U) => Promise<void
|
|
5
|
+
onSubmit: (payload: U) => Promise<void> | void;
|
|
6
6
|
} & T;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a nested form element that can be rendered within another form
|
|
@@ -16,7 +16,7 @@ export type NestedFormProps<T, U> = {
|
|
|
16
16
|
export declare const useNestedForm: <T, U>(form: React.FC<NestedFormProps<T, U>>, props: {
|
|
17
17
|
formId: string;
|
|
18
18
|
onCancel?: (() => void) | undefined;
|
|
19
|
-
onSubmit: (payload: U) => Promise<void
|
|
19
|
+
onSubmit: (payload: U) => Promise<void> | void;
|
|
20
20
|
} & T & {
|
|
21
21
|
portalRef?: undefined;
|
|
22
22
|
}) => readonly [import("@emotion/react/jsx-runtime").JSX.Element, boolean, React.DispatchWithoutAction];
|