@shipengine/elements 0.16.1 → 0.17.3

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.
Files changed (48) hide show
  1. package/components/auto-funding-form/auto-funding-form.d.ts +3 -1
  2. package/components/auto-funding-form/auto-funding-form.styles.d.ts +2 -1
  3. package/components/field/expiration-input/expiration-input.d.ts +3 -0
  4. package/components/field/expiration-input/index.d.ts +1 -0
  5. package/components/field/fields.d.ts +1 -0
  6. package/components/field/switch/switch.d.ts +1 -1
  7. package/components/fund-and-purchase/fund-and-purchase.d.ts +2 -1
  8. package/components/items-breakdown/items-breakdown.d.ts +1 -1
  9. package/components/templates/address-form/address-fields.styles.d.ts +1 -0
  10. package/components/templates/completion-page/completion-page.d.ts +4 -0
  11. package/components/templates/completion-page/index.d.ts +1 -0
  12. package/components/templates/index.d.ts +2 -1
  13. package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -1
  14. package/components/templates/onboarding/onboarding.d.ts +1 -3
  15. package/components/templates/onboarding/onboarding.styles.d.ts +1 -1
  16. package/components/templates/rate-form/rate-form.d.ts +1 -0
  17. package/components/templates/shipment-form/shipment-form.d.ts +1 -1
  18. package/components/templates/suspend-sales-order/index.d.ts +1 -0
  19. package/components/templates/suspend-sales-order/suspend-sales-order.d.ts +8 -0
  20. package/components/templates/suspend-shipment/index.d.ts +1 -0
  21. package/components/templates/suspend-shipment/suspend-shipment.d.ts +8 -0
  22. package/components/templates/wallet-form/wallet-schema.d.ts +7 -12
  23. package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
  24. package/elements/components/configure-shipment/hooks/use-address.d.ts +1 -1
  25. package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +2 -2
  26. package/elements/components/index.d.ts +1 -1
  27. package/elements/components/{sales-order → purchase-label}/hooks/use-configure-shipment.d.ts +1 -1
  28. package/elements/components/purchase-label/hooks/use-load-shipment.d.ts +9 -0
  29. package/elements/components/purchase-label/index.d.ts +3 -0
  30. package/elements/components/{sales-order/sales-order.d.ts → purchase-label/purchase-label-by-sales-order.d.ts} +1 -1
  31. package/elements/components/purchase-label/purchase-label-by-shipment.d.ts +9 -0
  32. package/elements/components/purchase-label/purchase-label.d.ts +6 -0
  33. package/elements/purchase-label.d.ts +3 -1
  34. package/hooks/use-elements.d.ts +2 -1
  35. package/index.cjs +1733 -1548
  36. package/index.js +1734 -1551
  37. package/locales/en/index.d.ts +7 -3
  38. package/mocks/carriers/handlers.d.ts +3 -0
  39. package/mocks/warehouses/handlers.d.ts +12 -1
  40. package/package.json +3 -3
  41. package/utilities/money.d.ts +1 -0
  42. package/utilities/shipengine/sales-order.d.ts +10 -0
  43. package/components/templates/sales-order/index.d.ts +0 -1
  44. package/components/templates/sales-order/sales-order.d.ts +0 -8
  45. package/elements/components/sales-order/index.d.ts +0 -1
  46. /package/elements/components/{sales-order → purchase-label}/hooks/index.d.ts +0 -0
  47. /package/elements/components/{sales-order → purchase-label}/hooks/use-import-sales-order.d.ts +0 -0
  48. /package/elements/components/{sales-order → purchase-label}/hooks/use-pending-shipment.d.ts +0 -0
@@ -3,6 +3,8 @@ export type AutoFundingFormProps = {
3
3
  };
4
4
  /**
5
5
  * This form that allows users to enable or disable auto funding, and
6
- * configure auto funding settings in ShipEngine API.
6
+ * configure auto funding rules in ShipEngine API.
7
+ *
8
+ * @param carrierId The carrierId of the carrier provider you wish to configure auto-funding rules for.
7
9
  */
8
10
  export declare const AutoFundingForm: ({ carrierId }: AutoFundingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +1,2 @@
1
- export declare const styles: Record<"form", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
1
+ import { Theme } from "@packlink/brands";
2
+ export declare const getStyles: (showForm: boolean) => Record<"edit" | "form" | "input" | "marginLeft", import("@emotion/serialize").Interpolation<Theme>>;
@@ -0,0 +1,3 @@
1
+ import { InputProps as NativeInputProps } from "@packlink/giger";
2
+ import { ControlledField } from "../create-field-controller";
3
+ export declare const ExpirationInput: ControlledField<NativeInputProps>;
@@ -0,0 +1 @@
1
+ export * from "./expiration-input";
@@ -1,6 +1,7 @@
1
1
  export * from "./credit-card-input";
2
2
  export * from "./checkbox-input";
3
3
  export * from "./date-picker";
4
+ export * from "./expiration-input";
4
5
  export * from "./input-group";
5
6
  export * from "./money-input";
6
7
  export * from "./number-input";
@@ -3,7 +3,7 @@ import { ISwitchProps } from "@packlink/giger";
3
3
  export type SwitchProps = {
4
4
  children?: React.ReactNode;
5
5
  defaultChecked?: boolean;
6
- label: string;
6
+ label?: string;
7
7
  shouldUnmount?: boolean;
8
8
  } & Omit<ISwitchProps, "children">;
9
9
  export declare const Switch: ({ defaultChecked, children, shouldUnmount, label, onChange, ...props }: SwitchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ export type FundAndPurchaseProps = {
2
2
  carrierId?: string;
3
3
  className?: string;
4
4
  disabled?: boolean;
5
+ isFundingEnabled?: boolean;
5
6
  isFundingRequired: boolean;
6
7
  onPurchase: () => void;
7
8
  onSave: () => Promise<void>;
@@ -12,4 +13,4 @@ export type FundAndPurchaseProps = {
12
13
  * has the necessary funds available and can add them if not. It allows a single button
13
14
  * to submit the funding form followed by the purchase form.
14
15
  */
15
- export declare const FundAndPurchase: ({ carrierId, className, disabled, isFundingRequired, onSave, purchaseAmount, onPurchase, }: FundAndPurchaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export declare const FundAndPurchase: ({ carrierId, className, disabled, isFundingEnabled, isFundingRequired, onSave, purchaseAmount, onPurchase, }: FundAndPurchaseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ export type Item = {
6
6
  subDetail?: string;
7
7
  subDetailValue?: SE.Money;
8
8
  totalValue?: SE.Money;
9
- value: SE.Money;
9
+ value?: SE.Money;
10
10
  };
11
11
  export type ItemsBreakdownProps = {
12
12
  items: Item[];
@@ -0,0 +1 @@
1
+ export declare const styles: Record<"grow" | "stateWrapper" | "stateZipWrapper" | "zipWrapper", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
@@ -0,0 +1,4 @@
1
+ export type CompletionPageProps = {
2
+ onContinue: () => void;
3
+ };
4
+ export declare const CompletionPage: ({ onContinue }: CompletionPageProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./completion-page";
@@ -12,9 +12,10 @@ export * from "./list-carriers";
12
12
  export * from "./manage-warehouses";
13
13
  export * from "./onboarding";
14
14
  export * from "./rate-form";
15
- export * from "./sales-order";
15
+ export * from "./suspend-sales-order";
16
16
  export * from "./shipment-form";
17
17
  export * from "./shipment";
18
+ export * from "./suspend-shipment";
18
19
  export * from "./warehouse-form";
19
20
  export * from "./void-label";
20
21
  export * from "./wallet-form";
@@ -1 +1 @@
1
- export declare const styles: Record<"carrierTypography" | "container" | "loadingButtonContainer" | "logoContainer" | "rowContainer" | "statusChipConnected" | "statusChipNotConnected", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
1
+ export declare const getStyles: (isConnected?: boolean) => Record<"connectButton" | "container" | "logoContainer" | "rowContainer", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
@@ -2,8 +2,6 @@ import { SE } from "@shipengine/api";
2
2
  export type OnboardingProps = {
3
3
  carriers: SE.Carrier[];
4
4
  createWarehouse: (payload: Partial<SE.Warehouse>) => Promise<SE.Warehouse>;
5
- isLoadingDhl: boolean;
6
- isLoadingUps: boolean;
7
5
  onCarrierCreated: () => Promise<void>;
8
6
  onCompleteOnboarding: () => void;
9
7
  onWarehouseCreated: () => Promise<void>;
@@ -15,4 +13,4 @@ export type OnboardingProps = {
15
13
  registerUpsCarrierErrors: SE.CodedError[] | null;
16
14
  warehouses: SE.Warehouse[];
17
15
  };
18
- export declare const Onboarding: ({ carriers, createWarehouse, onCarrierCreated, onWarehouseCreated, isLoadingDhl, isLoadingUps, onCompleteOnboarding, registerDhlCarrier, registerDhlCarrierErrors, registerStampsCarrier, registerStampsCarrierErrors, registerUpsCarrier, registerUpsCarrierErrors, warehouses, }: OnboardingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export declare const Onboarding: ({ carriers, createWarehouse, onCarrierCreated, onWarehouseCreated, onCompleteOnboarding, registerDhlCarrier, registerDhlCarrierErrors, registerStampsCarrier, registerStampsCarrierErrors, registerUpsCarrier, registerUpsCarrierErrors, warehouses, }: OnboardingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const styles: Record<"lastStep" | "step", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
1
+ export declare const styles: Record<"step" | "wrapper", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
@@ -1,5 +1,6 @@
1
1
  import { SE } from "@shipengine/api";
2
2
  export type RateFormFeatures = {
3
+ enableFunding?: boolean;
3
4
  enableGlobalPostFiltering?: boolean;
4
5
  includeRecommendedRates?: boolean;
5
6
  nicknameRate?: boolean;
@@ -30,7 +30,7 @@ export type ShipmentFormProps = {
30
30
  onSubmitParseShipTo: (payload: AddressParserPayload) => Promise<SE.AddressExtraction | undefined>;
31
31
  onToggleAddressPreferenceDisclosure?: AddressPreferenceDisplayProps["onToggleDisclosure"];
32
32
  onUpdateCustoms?: (customs: SE.Customs) => Promise<SE.SalesOrderShipment | undefined>;
33
- salesOrder: SE.SalesOrder;
33
+ salesOrder?: SE.SalesOrder;
34
34
  shipment?: SE.SalesOrderShipment;
35
35
  shippingPresets?: UseShippingPresetsOptionsProps;
36
36
  warehouseId?: string;
@@ -0,0 +1 @@
1
+ export * from "./suspend-sales-order";
@@ -0,0 +1,8 @@
1
+ import { WithChildrenCommonProps } from "@packlink/giger";
2
+ import { SE } from "@shipengine/api";
3
+ export type SuspendSalesOrderProps = WithChildrenCommonProps<{
4
+ errors?: SE.CodedError[];
5
+ isLoading?: boolean;
6
+ salesOrder?: SE.SalesOrder;
7
+ }>;
8
+ export declare const SuspendSalesOrder: ({ children, errors, isLoading, salesOrder, }: SuspendSalesOrderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./suspend-shipment";
@@ -0,0 +1,8 @@
1
+ import { WithChildrenCommonProps } from "@packlink/giger";
2
+ import { SE } from "@shipengine/api";
3
+ export type SuspendShipmentProps = WithChildrenCommonProps<{
4
+ errors?: SE.CodedError[];
5
+ isLoading?: boolean;
6
+ shipment?: SE.SalesOrderShipment;
7
+ }>;
8
+ export declare const SuspendShipment: ({ children, errors, isLoading, shipment, }: SuspendShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -197,24 +197,21 @@ export declare const walletSchema: z.ZodObject<{
197
197
  }>;
198
198
  creditCard: z.ZodEffects<z.ZodObject<{
199
199
  cvv: z.ZodEffects<z.ZodString, string, string>;
200
- expirationMonth: z.ZodEnum<["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]>;
201
- expirationYear: z.ZodEffects<z.ZodString, string, string>;
200
+ expiration: z.ZodEffects<z.ZodString, string, string>;
202
201
  name: z.ZodString;
203
202
  number: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
204
203
  }, "strip", z.ZodTypeAny, {
205
204
  number: string;
206
205
  name: string;
207
206
  cvv: string;
208
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
209
- expirationYear: string;
207
+ expiration: string;
210
208
  }, {
211
209
  number: string;
212
210
  name: string;
213
211
  cvv: string;
214
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
215
- expirationYear: string;
212
+ expiration: string;
216
213
  }>, {
217
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
214
+ expirationMonth: string;
218
215
  expirationYear: string;
219
216
  name: string;
220
217
  number: string;
@@ -223,8 +220,7 @@ export declare const walletSchema: z.ZodObject<{
223
220
  number: string;
224
221
  name: string;
225
222
  cvv: string;
226
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
227
- expirationYear: string;
223
+ expiration: string;
228
224
  }>;
229
225
  }, "strip", z.ZodTypeAny, {
230
226
  address: {
@@ -239,7 +235,7 @@ export declare const walletSchema: z.ZodObject<{
239
235
  stateProvince: string;
240
236
  };
241
237
  creditCard: {
242
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
238
+ expirationMonth: string;
243
239
  expirationYear: string;
244
240
  name: string;
245
241
  number: string;
@@ -261,8 +257,7 @@ export declare const walletSchema: z.ZodObject<{
261
257
  number: string;
262
258
  name: string;
263
259
  cvv: string;
264
- expirationMonth: "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
265
- expirationYear: string;
260
+ expiration: string;
266
261
  };
267
262
  }>;
268
263
  export type WalletFormFields = z.input<typeof walletSchema>;
@@ -24,7 +24,7 @@ export type ConfigureShipmentProps = {
24
24
  onShipmentUpdated: UseShipmentFormProps["onShipmentUpdated"];
25
25
  onToggleAddressPreferenceDisclosure?: Templates.ShipmentFormProps["onToggleAddressPreferenceDisclosure"];
26
26
  printLabelLayout?: UseRatesFormProps["printLabelLayout"];
27
- salesOrder: SE.SalesOrder;
27
+ salesOrder?: SE.SalesOrder;
28
28
  shipment?: SE.SalesOrderShipment;
29
29
  shippingPresets?: UseShippingPresetsOptionsProps;
30
30
  warehouseId?: string;
@@ -5,7 +5,7 @@ export type UseAddressProps = {
5
5
  compatibleCountryCodes?: CountryCode[];
6
6
  onChange?: (oldShipment: SE.SalesOrderShipment, updatedShipment: SE.SalesOrderShipment) => Promise<void> | void;
7
7
  onValidation?: (addressPreference: Templates.AddressPreference) => Promise<void> | void;
8
- salesOrder: SE.SalesOrder;
8
+ salesOrder?: SE.SalesOrder;
9
9
  shipment?: SE.SalesOrderShipment;
10
10
  };
11
11
  export declare const useAddress: ({ compatibleCountryCodes, onChange, onValidation, salesOrder, shipment, }: UseAddressProps) => {
@@ -9,7 +9,7 @@ export type UseShipmentFormProps = {
9
9
  onChangeAddress?: UseAddressProps["onChange"];
10
10
  onShipmentUpdated?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
11
11
  onSubmit?: (shipment: SE.SalesOrderShipment) => Promise<void> | void;
12
- salesOrder: SE.SalesOrder;
12
+ salesOrder?: SE.SalesOrder;
13
13
  shipment?: SE.SalesOrderShipment;
14
14
  };
15
15
  export declare const useShipmentForm: ({ compatibleCountryCodes, onAddressValidation, onApplyPreset, onChangeAddress, onShipmentUpdated, onSubmit, salesOrder, shipment, }: UseShipmentFormProps) => {
@@ -25,7 +25,7 @@ export declare const useShipmentForm: ({ compatibleCountryCodes, onAddressValida
25
25
  fullAddress: string;
26
26
  }) => Promise<SE.AddressExtraction>;
27
27
  onUpdateCustoms: (customs: SE.Customs) => Promise<SE.SalesOrderShipment>;
28
- salesOrder: SE.SalesOrder;
28
+ salesOrder: SE.SalesOrder | undefined;
29
29
  shipment: SE.SalesOrderShipment | undefined;
30
30
  warehouses: SE.Warehouse[] | undefined;
31
31
  };
@@ -2,6 +2,6 @@ export * from "./configure-shipment";
2
2
  export * from "./list-carriers";
3
3
  export * from "./manage-warehouses";
4
4
  export * from "./onboarding";
5
- export * from "./sales-order";
5
+ export * from "./purchase-label";
6
6
  export * from "./shipment";
7
7
  export * from "./void-label";
@@ -8,7 +8,7 @@ export type UseConfigureShipmentProps = {
8
8
  salesOrder?: SE.SalesOrder;
9
9
  warehouseId?: UsePendingShipmentProps["warehouseId"];
10
10
  };
11
- export declare const useConfigureShipment: ({ onLoad, onShipmentUpdated, salesOrder, warehouseId, }: UseConfigureShipmentProps) => {
11
+ export declare const useConfigureShipment: ({ onLoad, onShipmentUpdated, salesOrder, warehouseId, printLabelLayout, }: UseConfigureShipmentProps) => {
12
12
  errors: SE.CodedError[] | undefined;
13
13
  isLoading: boolean;
14
14
  onShipmentUpdated: (shipment: SE.SalesOrderShipment) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ export type UseLoadShipmentProps = {
2
+ shipmentId: string;
3
+ };
4
+ export declare const useLoadShipment: ({ shipmentId }: UseLoadShipmentProps) => {
5
+ errors: import("@shipengine/api").CodedError[] | undefined;
6
+ isLoading: boolean;
7
+ refetchShipment: <TPageData>(options?: (import("react-query").RefetchOptions & import("react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("react-query").QueryObserverResult<import("@shipengine/api").SalesOrderShipment, import("@shipengine/api").CodedError[]>>;
8
+ shipment: import("@shipengine/api").SalesOrderShipment | undefined;
9
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./purchase-label-by-sales-order";
2
+ export * from "./purchase-label";
3
+ export * from "./purchase-label-by-shipment";
@@ -23,4 +23,4 @@ export type SalesOrderProps = {
23
23
  shippingPresets?: UseShippingPresetsOptionsProps;
24
24
  warehouseId?: UseConfigureShipmentProps["warehouseId"];
25
25
  };
26
- export declare const SalesOrder: ({ features, externalOrderId, externalOrderNumber, onLoad, onShipmentUpdated, orderSourceCode, salesOrderId, warehouseId, printLabelLayout, ...props }: SalesOrderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
26
+ export declare const PurchaseLabelBySalesOrder: ({ features, externalOrderId, externalOrderNumber, onLoad, onShipmentUpdated, orderSourceCode, salesOrderId, warehouseId, printLabelLayout, ...props }: SalesOrderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ import { SalesOrderProps } from "./purchase-label-by-sales-order";
3
+ type ShipmentOrderProps = {
4
+ children?: ReactNode;
5
+ shipmentId: string;
6
+ };
7
+ type PurchaseLabelByShipmentProps = Partial<SalesOrderProps> & ShipmentOrderProps;
8
+ export declare const PurchaseLabelByShipment: ({ shipmentId, onLoad, onShipmentUpdated, features, ...props }: PurchaseLabelByShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ import { SalesOrderProps } from "./purchase-label-by-sales-order";
2
+ type PurchaseLabelProps = SalesOrderProps & {
3
+ shipmentId?: string;
4
+ };
5
+ export declare const PurchaseLabel: ({ shipmentId, ...props }: PurchaseLabelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1,3 @@
1
- export declare const Element: (props: import("./components/sales-order").SalesOrderProps & Record<string, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
1
+ export declare const Element: (props: import("./components").SalesOrderProps & {
2
+ shipmentId?: string | undefined;
3
+ } & Record<string, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { ShipEngineProviderProps } from "@shipengine/react";
2
3
  export type ElementsEnvironment = `dde:${string}` | "development" | "staging" | "production";
3
4
  export type ElementsErrorHandler = (err: Error, context: {
4
5
  componentStack: string;
@@ -18,7 +19,7 @@ export interface ElementsProviderProps {
18
19
  brandName?: string;
19
20
  children: JSX.Element;
20
21
  environment?: ElementsEnvironment;
21
- getToken: () => string;
22
+ getToken: ShipEngineProviderProps["getToken"];
22
23
  onError?: ElementsErrorHandler;
23
24
  proxyTarget?: string;
24
25
  }