@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.
Files changed (54) hide show
  1. package/components/add-funds-form/add-funds-form.d.ts +22 -0
  2. package/components/add-funds-form/add-funds-form.styles.d.ts +6 -0
  3. package/components/{organisms/manual-funding-form/manual-funding-schema.d.ts → add-funds-form/add-funds-schema.d.ts} +13 -3
  4. package/components/add-funds-form/index.d.ts +2 -0
  5. package/components/auto-funding-form/auto-funding-form.d.ts +8 -0
  6. package/components/auto-funding-form/index.d.ts +2 -0
  7. package/components/carrier-balance/carrier-balance.d.ts +4 -0
  8. package/components/carrier-balance/carrier-balance.styles.d.ts +1 -0
  9. package/components/carrier-balance/index.d.ts +1 -0
  10. package/components/field/create-field-controller.d.ts +2 -1
  11. package/components/fund-and-purchase/fund-and-purchase.d.ts +15 -0
  12. package/components/fund-and-purchase/fund-and-purchase.styles.d.ts +1 -0
  13. package/components/fund-and-purchase/index.d.ts +1 -0
  14. package/components/index.d.ts +9 -0
  15. package/components/inline-label/index.d.ts +1 -0
  16. package/components/inline-label/inline-label.d.ts +6 -0
  17. package/components/link-action/index.d.ts +1 -0
  18. package/components/link-action/link-action.d.ts +12 -0
  19. package/components/manage-funding/manage-funding.d.ts +4 -0
  20. package/components/spread/index.d.ts +1 -0
  21. package/components/spread/spread.d.ts +5 -0
  22. package/components/story-notes/index.d.ts +1 -0
  23. package/components/story-notes/story-notes.d.ts +11 -0
  24. package/components/templates/index.d.ts +0 -1
  25. package/components/templates/rate-form/rate-form.styles.d.ts +1 -0
  26. package/elements/components/index.d.ts +0 -1
  27. package/elements/index.d.ts +0 -1
  28. package/hooks/use-nested-form.d.ts +2 -2
  29. package/index.cjs +1018 -771
  30. package/index.js +1008 -772
  31. package/locales/en/index.d.ts +19 -6
  32. package/mocks/carriers/handlers.d.ts +12 -1
  33. package/mocks/carriers/index.d.ts +1 -0
  34. package/mocks/index.d.ts +2 -0
  35. package/mocks/server.d.ts +2 -0
  36. package/mocks/warehouses/handlers.d.ts +1 -0
  37. package/mocks/warehouses/index.d.ts +1 -0
  38. package/package.json +5 -4
  39. package/testing/render.d.ts +5 -0
  40. package/utilities/rates.d.ts +1 -1
  41. package/components/organisms/auto-funding-form/auto-funding-form.d.ts +0 -16
  42. package/components/organisms/auto-funding-form/index.d.ts +0 -1
  43. package/components/organisms/index.d.ts +0 -2
  44. package/components/organisms/manual-funding-form/index.d.ts +0 -2
  45. package/components/organisms/manual-funding-form/manual-funding-form.d.ts +0 -18
  46. package/components/templates/funding-methods/funding-methods.d.ts +0 -18
  47. package/components/templates/funding-methods/funding-methods.styles.d.ts +0 -1
  48. package/components/templates/funding-methods/index.d.ts +0 -1
  49. package/elements/components/manage-funding/manage-funding.d.ts +0 -6
  50. package/elements/manage-funding.d.ts +0 -1
  51. package/mocks/handlers.d.ts +0 -12
  52. /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-form.styles.d.ts +0 -0
  53. /package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-schema.d.ts +0 -0
  54. /package/{elements/components → components}/manage-funding/index.d.ts +0 -0
@@ -222,11 +222,11 @@ declare const _default: {
222
222
  };
223
223
  "manage-funding": {
224
224
  actions: {
225
+ addFunds: string;
226
+ addFundsAndPurchase: string;
225
227
  addNow: string;
226
228
  saveRule: string;
227
- other: string;
228
229
  };
229
- addFunds: string;
230
230
  autoFunding: {
231
231
  addFundsAutomatically: string;
232
232
  error: {
@@ -239,8 +239,8 @@ declare const _default: {
239
239
  maximumPurchasesPerDay: string;
240
240
  purchaseAmount: string;
241
241
  };
242
- currentBalance: string;
243
- otp: {
242
+ addFunds: {
243
+ custom: string;
244
244
  error: {
245
245
  title: string;
246
246
  message: string;
@@ -248,11 +248,22 @@ declare const _default: {
248
248
  isLoading: string;
249
249
  labels: {
250
250
  amount: string;
251
- currentBalance: string;
252
- resultingBalance: string;
253
251
  };
254
252
  minimumPurchaseAmount: string;
255
253
  };
254
+ fundAndPurchase: {
255
+ finalBalance: string;
256
+ insufficientFunds: string;
257
+ insufficientFundsTitle: string;
258
+ negativeBalance: string;
259
+ negativeBalanceTitle: string;
260
+ newBalance: string;
261
+ };
262
+ errors: {
263
+ balanceUnknown: string;
264
+ unableToFindBalance: string;
265
+ };
266
+ currentBalance: string;
256
267
  maximumBalanceAmount: string;
257
268
  };
258
269
  "list-carriers": {
@@ -393,6 +404,7 @@ declare const _default: {
393
404
  invalidNameOrCompany: string;
394
405
  noWarehouses: string;
395
406
  unableToLoad: {
407
+ carrier: string;
396
408
  carriers: string;
397
409
  salesOrder: string;
398
410
  shipment: string;
@@ -419,6 +431,7 @@ declare const _default: {
419
431
  thirdParty: string;
420
432
  };
421
433
  loading: {
434
+ carrier: string;
422
435
  carriers: string;
423
436
  data: string;
424
437
  importingSalesOrder: string;
@@ -1 +1,12 @@
1
- export declare const carrierHandlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
1
+ import { DeepPartial } from "fishery";
2
+ import { SE } from "@shipengine/api";
3
+ export type CreateCarrierHandlersParams = {
4
+ get?: DeepPartial<SE.Carrier>;
5
+ list?: [count: number, listParams?: DeepPartial<SE.Carrier>];
6
+ };
7
+ export declare const createCarrierHandlers: (params?: CreateCarrierHandlersParams) => {
8
+ database: {
9
+ balanceAmount: number;
10
+ };
11
+ handlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
12
+ };
@@ -0,0 +1 @@
1
+ export * from "./handlers";
@@ -0,0 +1,2 @@
1
+ export * from "./carriers";
2
+ export * from "./warehouses";
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw/lib/SetupServerApi-39df862c").S;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const warehouseHandlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
@@ -0,0 +1 @@
1
+ export * from "./handlers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -22,13 +22,14 @@
22
22
  "react": "^18.2.0",
23
23
  "@emotion/react": "^11.10.0",
24
24
  "@packlink/brands": "^3.18.0",
25
- "@shipengine/react": "0.16.0",
26
25
  "react-hook-form": "^7.31.2",
26
+ "@shipengine/api": "0.16.1",
27
+ "@shipengine/react": "0.16.1",
28
+ "zod": "^3.17.3",
27
29
  "@emotion/css": "^11.10.5",
28
30
  "humps": "^2.0.1",
29
31
  "react-datepicker": "^4.8.0",
30
- "@shipengine/api": "0.16.0",
31
- "zod": "^3.17.3",
32
+ "react-query": "^3.39.3",
32
33
  "react-dom": "^18.2.0",
33
34
  "libphonenumber-js": "^1.10.14",
34
35
  "@faker-js/faker": "^7.3.0",
@@ -1 +1,6 @@
1
1
  export declare const renderWithProviders: (component: any) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
2
+ /**
3
+ * Wraps the test with all of the usual Shipengine / Giger / i18 / etc providers that a full, registered "Element" would have.
4
+ * This allows components to simulate usage in an Element via `decorators: [withAllProviders]`
5
+ **/
6
+ export declare const renderWithAllProviders: (component: any) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
@@ -1,6 +1,6 @@
1
1
  import { SE } from "@shipengine/api";
2
2
  export declare const getRateRequiresAcknowledgement: (serviceCode: string) => boolean;
3
- export declare const getTotalRateAmount: (rateCosts: {
3
+ export declare const getTotalRateAmount: (rateCosts?: {
4
4
  confirmationAmount?: SE.Money;
5
5
  insuranceAmount?: SE.Money;
6
6
  otherAmount?: SE.Money;
@@ -1,16 +0,0 @@
1
- import { SE } from "@shipengine/api";
2
- import { AutoFundingFormPayload } from "./auto-funding-schema";
3
- export type AutoFundingFormProps = {
4
- defaultValues?: SE.CarrierAutoFundingSettings;
5
- errorMessage?: string;
6
- hasError: boolean;
7
- isInteger?: boolean;
8
- isLoading: boolean;
9
- onSubmit: (payload: AutoFundingFormPayload) => Promise<void> | void;
10
- onToggle: (enabled: boolean) => Promise<void> | void;
11
- };
12
- /**
13
- * This form that allows users to enable or disable auto funding, and
14
- * configure auto funding settings in ShipEngine API.
15
- */
16
- export declare const AutoFundingForm: ({ defaultValues, errorMessage, hasError, isInteger, isLoading, onSubmit, onToggle, }: AutoFundingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./auto-funding-form";
@@ -1,2 +0,0 @@
1
- export * from "./auto-funding-form";
2
- export * from "./manual-funding-form";
@@ -1,2 +0,0 @@
1
- export * from "./manual-funding-form";
2
- export * from "./manual-funding-schema";
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { ManualFundingFormPayload } from "./manual-funding-schema";
3
- export type ManualFundingFormProps<T = undefined> = {
4
- currentBalance: number;
5
- errorMessage?: string;
6
- hasError: boolean;
7
- isLoading: boolean;
8
- onCancel: () => Promise<void> | void;
9
- onSubmit: (payload: ManualFundingFormPayload) => Promise<void> | void;
10
- requiredAmount?: number;
11
- } & ({
12
- formId: string;
13
- portalRef: React.RefObject<T>;
14
- } | {
15
- formId?: string;
16
- portalRef?: never;
17
- });
18
- export declare const ManualFundingForm: <T extends Element>({ currentBalance, errorMessage, formId, hasError, isLoading, onCancel, onSubmit, portalRef, requiredAmount, }: ManualFundingFormProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import { SE } from "@shipengine/api";
2
- import { ManualFundingFormPayload } from "../../organisms";
3
- export type FundingMethodsProps = {
4
- addFundsErrorMessage?: string;
5
- autoFundingData?: SE.CarrierAutoFundingSettings;
6
- autoFundingErrorMessage?: string;
7
- fundingMethod: "manual" | "auto" | "both";
8
- hasAutoFundingError: boolean;
9
- hasManualFundingError: boolean;
10
- isAutoFundingLoading: boolean;
11
- isManualFundingLoading: boolean;
12
- manualFundingCurrentBalance: number;
13
- manualFundingRequiredAmount?: number;
14
- onSubmitAutoFunding: (payload: SE.CarrierAutoFundingSettings) => Promise<void> | void;
15
- onSubmitManualFunding: (payload: ManualFundingFormPayload) => Promise<void> | void;
16
- onToggleAutoFunding: (enabled: boolean) => Promise<void> | void;
17
- };
18
- export declare const FundingMethods: ({ addFundsErrorMessage, autoFundingData, autoFundingErrorMessage, fundingMethod, hasAutoFundingError, hasManualFundingError, isAutoFundingLoading, isManualFundingLoading, manualFundingCurrentBalance, manualFundingRequiredAmount, onSubmitAutoFunding, onSubmitManualFunding, onToggleAutoFunding, }: FundingMethodsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export declare const styles: Record<"addFundsButton" | "balanceText" | "header" | "negativeBalanceText", import("@emotion/serialize").Interpolation<import("@packlink/brands/dist/js/theme/Theme").Theme>>;
@@ -1 +0,0 @@
1
- export * from "./funding-methods";
@@ -1,6 +0,0 @@
1
- export type ManageFundingProps = {
2
- carrierId: string;
3
- fundingMethod?: "manual" | "auto" | "both";
4
- requiredAmount?: number;
5
- };
6
- export declare const ManageFunding: ({ carrierId, fundingMethod, requiredAmount }: ManageFundingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export declare const Element: (props: import("./components").ManageFundingProps & Record<string, unknown>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- /**
2
- * These are the global Storybook mock handlers; add your default handlers here.
3
- *
4
- * Any handler can be overridden at the story level via the story's `parameters.msw.handlers.yourHandler`.
5
- *
6
- * Please match the `libs/shipengine-api/src` folder structure (sorted by domain)
7
- *
8
- * https://storybook.js.org/addons/msw-storybook-addon
9
- */
10
- export declare const storybookHandlers: {
11
- carriers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
12
- };