@shipengine/elements 0.24.0 → 0.25.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.
Files changed (32) hide show
  1. package/index.cjs +430 -103
  2. package/index.js +431 -104
  3. package/package.json +4 -3
  4. package/src/components/error-display/error-display.d.ts +1 -0
  5. package/src/components/error-display/error-display.styles.d.ts +19 -0
  6. package/src/components/error-display/index.d.ts +1 -0
  7. package/src/components/field/rate-card/rate-card.d.ts +1 -1
  8. package/src/components/history/history-card/history-card.styles.d.ts +12 -14
  9. package/src/components/history/history-card-extension/history-card-extension.d.ts +1 -0
  10. package/src/components/history/history-card-extension/history-card-extension.styles.d.ts +26 -0
  11. package/src/components/history/history-card-extension/index.d.ts +1 -0
  12. package/src/components/history/index.d.ts +1 -0
  13. package/src/components/label/label.d.ts +1 -1
  14. package/src/components/label/label.styles.d.ts +5 -1
  15. package/src/components/link-action/link-action.d.ts +3 -1
  16. package/src/components/templates/rate-form/rate-form.d.ts +3 -1
  17. package/src/components/unit-settings/unit-settings.d.ts +1 -4
  18. package/src/elements/configure-shipment/hooks/use-rates-form.d.ts +2 -0
  19. package/src/elements/list-carriers/list-carriers.d.ts +3 -0
  20. package/src/elements/manage-warehouses/manage-warehouses.d.ts +3 -0
  21. package/src/elements/onboarding/onboarding.d.ts +3 -0
  22. package/src/elements/purchase-label/purchase-label.d.ts +3 -0
  23. package/src/elements/view-shipment/view-shipment.d.ts +3 -0
  24. package/src/elements/void-label/void-label.d.ts +3 -0
  25. package/src/factories/shipengine/wallet-history.d.ts +52 -0
  26. package/src/features/wallet-history/wallet-history.styles.d.ts +4 -0
  27. package/src/locales/en/index.d.ts +3 -0
  28. package/src/mocks/account-settings/handlers.d.ts +8 -0
  29. package/src/mocks/account-settings/index.d.ts +1 -0
  30. package/src/mocks/index.d.ts +1 -0
  31. package/src/utilities/rates.d.ts +1 -1
  32. package/vite.config.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -29,10 +29,11 @@
29
29
  "@hookform/resolvers": "2.9.1",
30
30
  "@packlink/brands": "3.24.0",
31
31
  "@packlink/giger-theme": "1.3.1",
32
- "@shipengine/alchemy": "0.4.13",
33
- "@shipengine/js-api": "0.7.0",
32
+ "@shipengine/alchemy": "0.4.14",
33
+ "@shipengine/js-api": "0.7.1",
34
34
  "@storybook/manager-api": "7.0.0-rc.1",
35
35
  "@storybook/theming": "7.0.0-rc.1",
36
+ "@vitejs/plugin-react": "1.3.2",
36
37
  "axios": "0.26.1",
37
38
  "card-validator": "8.1.1",
38
39
  "copy-to-clipboard": "3.3.3",
@@ -0,0 +1 @@
1
+ export declare const ErrorDisplay: () => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ export declare const styles: {
2
+ errorContainer: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
3
+ alignItems: "center";
4
+ backgroundColor: string;
5
+ display: "flex";
6
+ flexDirection: "column";
7
+ paddingBottom: number;
8
+ paddingTop: number;
9
+ rowGap: number;
10
+ };
11
+ errorCTA: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
12
+ color: string;
13
+ fontSize: string;
14
+ lineHeight: string;
15
+ };
16
+ errorHeading: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
17
+ fontSize: string;
18
+ };
19
+ };
@@ -0,0 +1 @@
1
+ export * from "./error-display";
@@ -8,4 +8,4 @@ export type RateCardProps = Partial<RateOption> & WithCommonProps<{
8
8
  voided?: boolean;
9
9
  voidedAt?: string;
10
10
  }>;
11
- export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, requiresAcknowledgement, selected, serviceCode, serviceType, shippingAmount, taxAmount, voided, voidedAt, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export declare const RateCard: ({ carrierCode, carrierFriendlyName, carrierNickname, children, className, confirmationAmount, deliveryDays, insuranceAmount, isAcknowledged, messages, onClick, onClickAcknowledgement, otherAmount, rateId, requiresAcknowledgement, selected, serviceCode, packageType, serviceType, shippingAmount, taxAmount, voided, voidedAt, }: RateCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,9 +1,4 @@
1
- export declare const styles: (isReload?: boolean) => {
2
- amountTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
3
- color: string;
4
- fontSize: string;
5
- marginLeft: string;
6
- };
1
+ export declare const styles: {
7
2
  balanceTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
8
3
  color: string;
9
4
  marginLeft: string;
@@ -12,6 +7,7 @@ export declare const styles: (isReload?: boolean) => {
12
7
  "&:last-child": {
13
8
  alignItems: "flex-end";
14
9
  };
10
+ alignItems: "flex-start";
15
11
  display: "flex";
16
12
  flexDirection: "column";
17
13
  justifyContent: "space-between";
@@ -20,10 +16,6 @@ export declare const styles: (isReload?: boolean) => {
20
16
  cardContainer: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
21
17
  display: "flex";
22
18
  justifyContent: "space-between";
23
- padding: string;
24
- };
25
- carrierRow: {
26
- display: "flex";
27
19
  };
28
20
  carrierTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
29
21
  color: string;
@@ -33,12 +25,18 @@ export declare const styles: (isReload?: boolean) => {
33
25
  dateTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
34
26
  color: string;
35
27
  };
36
- providerTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
28
+ getAmountTypography: (isReload?: boolean) => (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
37
29
  color: string;
38
- fontWeight: number;
30
+ fontSize: string;
31
+ marginLeft: string;
39
32
  };
40
- tagText: {
41
- textAlign: "center";
33
+ getTransactionTypeTypography: (transactionType?: string) => (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
34
+ color: string;
42
35
  textTransform: "capitalize";
43
36
  };
37
+ transactionDetails: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
38
+ alignItems: "center";
39
+ columnGap: number;
40
+ display: "flex";
41
+ };
44
42
  };
@@ -0,0 +1 @@
1
+ export declare const HistoryCardExtension: () => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ export declare const styles: {
2
+ chevronTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
3
+ color: string;
4
+ };
5
+ detailsBottomContainer: {
6
+ backgroundColor: "#f4f6f8";
7
+ padding: string;
8
+ };
9
+ detailsRow: {
10
+ display: "flex";
11
+ justifyContent: "space-between";
12
+ };
13
+ detailsTypography: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
14
+ color: string;
15
+ };
16
+ headingContainer: {
17
+ alignItems: "center";
18
+ display: "flex";
19
+ justifyContent: "space-between";
20
+ };
21
+ loadingStateContainer: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
22
+ display: "flex";
23
+ flexDirection: "column";
24
+ rowGap: number;
25
+ };
26
+ };
@@ -0,0 +1 @@
1
+ export * from "./history-card-extension";
@@ -1 +1,2 @@
1
1
  export * from "./history-card";
2
+ export * from "./history-card-extension";
@@ -1,7 +1,7 @@
1
1
  import { WithConditionalCSSProp } from "@emotion/react/types/jsx-namespace";
2
2
  import { ITypographyProps, WithChildrenCommonProps } from "@packlink/giger";
3
3
  export type LabelProps = WithChildrenCommonProps<{
4
- spacing?: number;
4
+ spacing?: number | "spread";
5
5
  text: string;
6
6
  textProps?: WithConditionalCSSProp<ITypographyProps<"span">>;
7
7
  variant?: LabelVariant;
@@ -1,9 +1,13 @@
1
1
  import { LabelProps } from "./label";
2
- export declare const styles: (variant?: LabelProps["variant"], spacing?: number) => {
2
+ export declare const styles: ({ variant, spacing, }: {
3
+ spacing: LabelProps["spacing"];
4
+ variant: LabelProps["variant"];
5
+ }) => {
3
6
  labelContainer: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
4
7
  alignItems: "center";
5
8
  display: "flex";
6
9
  flexDirection: "column" | "row" | "row-reverse";
7
10
  gap: number;
11
+ justifyContent: "flex-start" | "space-between;";
8
12
  };
9
13
  };
@@ -5,10 +5,12 @@ declare const icons: {
5
5
  readonly checkFilled: IconNames.CHECK_FILLED;
6
6
  readonly copy: IconNames.COPY;
7
7
  readonly download: IconNames.DOWNLOAD;
8
+ readonly retry: IconNames.CIRCULAR_ARROW;
8
9
  };
9
10
  export type LinkActionProps = {
10
11
  icon?: keyof typeof icons;
12
+ isBold?: boolean;
11
13
  title: string;
12
14
  } & ILinkProps;
13
- export declare const LinkAction: ({ css, icon, isDisabled, isLoading, title, ...props }: LinkActionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export declare const LinkAction: ({ css, icon, isDisabled, isLoading, title, isBold, ...props }: LinkActionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
16
  export {};
@@ -14,6 +14,8 @@ export type RateFormProps = {
14
14
  features?: RateFormFeatures;
15
15
  isLoading?: boolean;
16
16
  labelErrors?: SE.CodedError[];
17
+ labels?: SE.Label[];
18
+ labelsLoading?: boolean;
17
19
  onSave?: (rate: Pick<SE.Rate, "carrierId" | "serviceCode">) => Promise<void> | void;
18
20
  onSelectRate?: (rateId: string) => void;
19
21
  onSubmit?: (rateId: string) => Promise<void> | void;
@@ -21,4 +23,4 @@ export type RateFormProps = {
21
23
  rates?: SE.Rate[];
22
24
  shipment?: SE.SalesOrderShipment;
23
25
  };
24
- export declare const RateForm: ({ carriers, disabled, errors, displayableErrors, displayableLabelErrors, features, labelErrors, isLoading, onSave, onSelectRate, onSubmit, rates, shipment, outOfBandDisplayableErrors, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
26
+ export declare const RateForm: ({ carriers, disabled, errors, displayableErrors, displayableLabelErrors, features, labelErrors, labels, labelsLoading, isLoading, onSave, onSelectRate, onSubmit, rates, shipment, outOfBandDisplayableErrors, }: RateFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,4 +1 @@
1
- export type UnitSettingsProps = {
2
- onChange?: () => void;
3
- };
4
- export declare const UnitSettings: ({ onChange }: UnitSettingsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
1
+ export declare const UnitSettings: () => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -17,6 +17,8 @@ export declare const useRatesForm: ({ onBeforeLabelCreate, onLabelCreateFailure,
17
17
  errors: SE.CodedError[] | undefined;
18
18
  isLoading: boolean;
19
19
  labelErrors: SE.CodedError[] | undefined;
20
+ labels: SE.Label[] | undefined;
21
+ labelsLoading: boolean;
20
22
  onSave: ({ carrierId, serviceCode }: Pick<SE.Rate, "carrierId" | "serviceCode">) => Promise<void>;
21
23
  onSubmit: (rateId: string) => Promise<void>;
22
24
  rates: SE.Rate[] | undefined;
@@ -194,6 +194,7 @@ export declare const Element: ({ resources, ...props }: object & {
194
194
  };
195
195
  rates: {
196
196
  uspsMediaMailAcknowledgement: string;
197
+ uspsFirstClassMailAcknowledgement_leof: string;
197
198
  };
198
199
  shipToAddressFormFields: string;
199
200
  sections: {
@@ -470,6 +471,7 @@ export declare const Element: ({ resources, ...props }: object & {
470
471
  invalidNameOrCompany: string;
471
472
  noWarehouses: string;
472
473
  unableToLoad: {
474
+ accountSettings: string;
473
475
  autoFundingSettings: string;
474
476
  carrier: string;
475
477
  carriers: string;
@@ -498,6 +500,7 @@ export declare const Element: ({ resources, ...props }: object & {
498
500
  thirdParty: string;
499
501
  };
500
502
  loading: {
503
+ accountSettings: string;
501
504
  carrier: string;
502
505
  carriers: string;
503
506
  data: string;
@@ -198,6 +198,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
198
198
  };
199
199
  rates: {
200
200
  uspsMediaMailAcknowledgement: string;
201
+ uspsFirstClassMailAcknowledgement_leof: string;
201
202
  };
202
203
  shipToAddressFormFields: string;
203
204
  sections: {
@@ -474,6 +475,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
474
475
  invalidNameOrCompany: string;
475
476
  noWarehouses: string;
476
477
  unableToLoad: {
478
+ accountSettings: string;
477
479
  autoFundingSettings: string;
478
480
  carrier: string;
479
481
  carriers: string;
@@ -502,6 +504,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
502
504
  thirdParty: string;
503
505
  };
504
506
  loading: {
507
+ accountSettings: string;
505
508
  carrier: string;
506
509
  carriers: string;
507
510
  data: string;
@@ -197,6 +197,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
197
197
  };
198
198
  rates: {
199
199
  uspsMediaMailAcknowledgement: string;
200
+ uspsFirstClassMailAcknowledgement_leof: string;
200
201
  };
201
202
  shipToAddressFormFields: string;
202
203
  sections: {
@@ -473,6 +474,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
473
474
  invalidNameOrCompany: string;
474
475
  noWarehouses: string;
475
476
  unableToLoad: {
477
+ accountSettings: string;
476
478
  autoFundingSettings: string;
477
479
  carrier: string;
478
480
  carriers: string;
@@ -501,6 +503,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
501
503
  thirdParty: string;
502
504
  };
503
505
  loading: {
506
+ accountSettings: string;
504
507
  carrier: string;
505
508
  carriers: string;
506
509
  data: string;
@@ -200,6 +200,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
200
200
  };
201
201
  rates: {
202
202
  uspsMediaMailAcknowledgement: string;
203
+ uspsFirstClassMailAcknowledgement_leof: string;
203
204
  };
204
205
  shipToAddressFormFields: string;
205
206
  sections: {
@@ -476,6 +477,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
476
477
  invalidNameOrCompany: string;
477
478
  noWarehouses: string;
478
479
  unableToLoad: {
480
+ accountSettings: string;
479
481
  autoFundingSettings: string;
480
482
  carrier: string;
481
483
  carriers: string;
@@ -504,6 +506,7 @@ export declare const Element: ({ resources, ...props }: SalesOrderProps & {
504
506
  thirdParty: string;
505
507
  };
506
508
  loading: {
509
+ accountSettings: string;
507
510
  carrier: string;
508
511
  carriers: string;
509
512
  data: string;
@@ -206,6 +206,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
206
206
  };
207
207
  rates: {
208
208
  uspsMediaMailAcknowledgement: string;
209
+ uspsFirstClassMailAcknowledgement_leof: string;
209
210
  };
210
211
  shipToAddressFormFields: string;
211
212
  sections: {
@@ -482,6 +483,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
482
483
  invalidNameOrCompany: string;
483
484
  noWarehouses: string;
484
485
  unableToLoad: {
486
+ accountSettings: string;
485
487
  autoFundingSettings: string;
486
488
  carrier: string;
487
489
  carriers: string;
@@ -510,6 +512,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
510
512
  thirdParty: string;
511
513
  };
512
514
  loading: {
515
+ accountSettings: string;
513
516
  carrier: string;
514
517
  carriers: string;
515
518
  data: string;
@@ -201,6 +201,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
201
201
  };
202
202
  rates: {
203
203
  uspsMediaMailAcknowledgement: string;
204
+ uspsFirstClassMailAcknowledgement_leof: string;
204
205
  };
205
206
  shipToAddressFormFields: string;
206
207
  sections: {
@@ -477,6 +478,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
477
478
  invalidNameOrCompany: string;
478
479
  noWarehouses: string;
479
480
  unableToLoad: {
481
+ accountSettings: string;
480
482
  autoFundingSettings: string;
481
483
  carrier: string;
482
484
  carriers: string;
@@ -505,6 +507,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
505
507
  thirdParty: string;
506
508
  };
507
509
  loading: {
510
+ accountSettings: string;
508
511
  carrier: string;
509
512
  carriers: string;
510
513
  data: string;
@@ -12,3 +12,55 @@ export declare const walletTransactionFactory: Factory<SE.WalletTransaction, any
12
12
  * @category Factories
13
13
  */
14
14
  export declare const walletHistoryFactory: (currentPage?: number, count?: number) => Factory<SE.WalletTransactionHistory, any, SE.WalletTransactionHistory>;
15
+ export type WalletAdjustment = {
16
+ actualShipment: TransactionShipment;
17
+ adjustment: TransactionCost;
18
+ adjustmentId: string;
19
+ originalShipment: TransactionShipment;
20
+ trackingNumber: string;
21
+ transactionId: string;
22
+ };
23
+ type TransactionShipment = {
24
+ dimensions: {
25
+ height: number;
26
+ length: number;
27
+ unit: string;
28
+ width: number;
29
+ };
30
+ insuranceCost: TransactionCost;
31
+ packageCode: string;
32
+ rateDetails: TransactionRateDetail[];
33
+ serviceCode: string;
34
+ shipFrom: TransactionShipDestination;
35
+ shipmentCost: TransactionCost;
36
+ shipTo: TransactionShipDestination;
37
+ weight: {
38
+ unit: string;
39
+ value: number;
40
+ };
41
+ };
42
+ type TransactionShipDestination = {
43
+ addressLine1: string;
44
+ addressLine2: string;
45
+ addressResidentialIndicator: "yes" | "no";
46
+ cityLocality: string;
47
+ companyName: string;
48
+ countryCode: string;
49
+ name: string;
50
+ phone: string;
51
+ postalCode: string;
52
+ stateProvince: string;
53
+ };
54
+ type TransactionRateDetail = {
55
+ amount: TransactionCost;
56
+ carrierBillingCode: string;
57
+ carrierDescription: string;
58
+ carrierMemo: string | null;
59
+ rateDetailType: string;
60
+ };
61
+ type TransactionCost = {
62
+ amount: number;
63
+ currency: string;
64
+ };
65
+ export declare const walletAdjustmentFactory: Factory<WalletAdjustment, any, WalletAdjustment>;
66
+ export {};
@@ -66,6 +66,10 @@ export declare const styles: {
66
66
  columnGap: number;
67
67
  display: "flex";
68
68
  };
69
+ skeletonCardTransactionRow: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
70
+ columnGap: string;
71
+ display: "flex";
72
+ };
69
73
  skeletonPagination: (theme: import("@packlink/giger-theme/dist/lib/Theme").Theme) => {
70
74
  alignItems: "center";
71
75
  display: "flex";
@@ -190,6 +190,7 @@ declare const _default: {
190
190
  };
191
191
  rates: {
192
192
  uspsMediaMailAcknowledgement: string;
193
+ uspsFirstClassMailAcknowledgement_leof: string;
193
194
  };
194
195
  shipToAddressFormFields: string;
195
196
  sections: {
@@ -466,6 +467,7 @@ declare const _default: {
466
467
  invalidNameOrCompany: string;
467
468
  noWarehouses: string;
468
469
  unableToLoad: {
470
+ accountSettings: string;
469
471
  autoFundingSettings: string;
470
472
  carrier: string;
471
473
  carriers: string;
@@ -494,6 +496,7 @@ declare const _default: {
494
496
  thirdParty: string;
495
497
  };
496
498
  loading: {
499
+ accountSettings: string;
497
500
  carrier: string;
498
501
  carriers: string;
499
502
  data: string;
@@ -0,0 +1,8 @@
1
+ export declare const createAccountSettingsHandlers: () => {
2
+ database: {
3
+ default_label_layout: string;
4
+ dimensions_unit: string;
5
+ weight_unit: string;
6
+ };
7
+ handlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
8
+ };
@@ -0,0 +1 @@
1
+ export * from "./handlers";
@@ -1,2 +1,3 @@
1
1
  export * from "./carriers";
2
2
  export * from "./warehouses";
3
+ export * from "./account-settings";
@@ -1,5 +1,5 @@
1
1
  import { SE } from "@shipengine/alchemy";
2
- export declare const getRateRequiresAcknowledgement: (serviceCode: string) => boolean;
2
+ export declare const getRateRequiresAcknowledgement: (serviceCode: string, packageType: string) => boolean;
3
3
  export declare const getTotalRateAmount: (rateCosts?: {
4
4
  confirmationAmount?: SE.Money;
5
5
  insuranceAmount?: SE.Money;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfigExport;
2
+ export default _default;