@shipengine/elements 0.23.1 → 0.24.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 (46) hide show
  1. package/index.cjs +251 -277
  2. package/index.js +255 -281
  3. package/package.json +1 -1
  4. package/src/components/add-funds-form/add-funds-form.styles.d.ts +21 -5
  5. package/src/components/auto-funding-form/auto-funding-form.styles.d.ts +18 -1
  6. package/src/components/carrier-balance/carrier-balance.styles.d.ts +5 -1
  7. package/src/components/date-range-select/date-range-select.styles.d.ts +7 -1
  8. package/src/components/disclosure/disclosure.styles.d.ts +23 -1
  9. package/src/components/field/rate-card/rate-card.d.ts +1 -2
  10. package/src/components/field/rate-card/rate-card.styles.d.ts +0 -2
  11. package/src/components/field/switch/switch.d.ts +3 -2
  12. package/src/components/fund-and-purchase/fund-and-purchase.styles.d.ts +20 -1
  13. package/src/components/history/history-card/history-card.styles.d.ts +44 -1
  14. package/src/components/inline-label/inline-label.styles.d.ts +8 -1
  15. package/src/components/items-breakdown/items-breakdown.styles.d.ts +21 -1
  16. package/src/components/label/label.styles.d.ts +8 -1
  17. package/src/components/label-layout/label-layout.styles.d.ts +106 -1
  18. package/src/components/section/section.styles.d.ts +33 -1
  19. package/src/components/settings-card/settings-card.styles.d.ts +41 -1
  20. package/src/components/templates/address-form/address-fields.styles.d.ts +27 -1
  21. package/src/components/templates/carrier-recovery-form/carrier-recovery-form.styles.d.ts +11 -1
  22. package/src/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +56 -1
  23. package/src/components/templates/customs-items-display/customs-items-display.styles.d.ts +60 -1
  24. package/src/components/templates/edit-billing-form/edit-billing-form.styles.d.ts +16 -1
  25. package/src/components/templates/label/label.styles.d.ts +12 -1
  26. package/src/components/templates/landing-page/landing-page.styles.d.ts +14 -1
  27. package/src/components/templates/list-carriers/list-carriers.styles.d.ts +25 -1
  28. package/src/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +23 -1
  29. package/src/components/templates/manage-wallet/manage-wallet.styles.d.ts +21 -1
  30. package/src/components/templates/manage-warehouses/manage-warehouse.styles.d.ts +14 -1
  31. package/src/components/templates/onboarding/onboarding.styles.d.ts +21 -1
  32. package/src/components/templates/rate-form/rate-form.d.ts +0 -1
  33. package/src/components/templates/rate-form/rate-form.styles.d.ts +16 -1
  34. package/src/components/templates/wallet-card/wallet-card.styles.d.ts +11 -1
  35. package/src/components/templates/wallet-form/wallet-form.styles.d.ts +5 -1
  36. package/src/elements/list-carriers/list-carriers.d.ts +7 -4
  37. package/src/elements/manage-warehouses/manage-warehouses.d.ts +7 -4
  38. package/src/elements/onboarding/onboarding.d.ts +7 -4
  39. package/src/elements/purchase-label/purchase-label.d.ts +7 -4
  40. package/src/elements/view-shipment/view-shipment.d.ts +7 -4
  41. package/src/elements/void-label/void-label.d.ts +7 -4
  42. package/src/features/wallet-history/wallet-history.styles.d.ts +77 -1
  43. package/src/hooks/options/use-rate-options.d.ts +1 -14
  44. package/src/locales/en/index.d.ts +7 -4
  45. package/src/public-sdk.d.ts +38 -0
  46. package/src/utilities/styles.d.ts +27 -6
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  };
14
14
  };
15
15
  "void-label": {
16
+ title: string;
16
17
  actions: {
17
18
  complete: string;
18
19
  confirmVoid: string;
@@ -31,6 +32,7 @@ declare const _default: {
31
32
  voidedOn: string;
32
33
  };
33
34
  "view-shipment": {
35
+ title: string;
34
36
  actions: {
35
37
  buyAnotherLabel: string;
36
38
  hideItems: string;
@@ -110,6 +112,7 @@ declare const _default: {
110
112
  agreeToTerms: string;
111
113
  };
112
114
  "purchase-label": {
115
+ title: string;
113
116
  actions: {
114
117
  calculateRates_one: string;
115
118
  calculateRates_other: string;
@@ -167,6 +170,7 @@ declare const _default: {
167
170
  fractional: string;
168
171
  };
169
172
  weightGroup: string;
173
+ today: string;
170
174
  };
171
175
  hints: {
172
176
  contentDescription: string;
@@ -179,10 +183,6 @@ declare const _default: {
179
183
  selectService: string;
180
184
  };
181
185
  multipleShippingServices: string;
182
- recommendedRates: {
183
- recommended: string;
184
- stayInformed: string;
185
- };
186
186
  schemaErrors: {
187
187
  shipFromUnitedStatesOnly: string;
188
188
  shipFromAddressRequired: string;
@@ -200,6 +200,7 @@ declare const _default: {
200
200
  };
201
201
  };
202
202
  onboarding: {
203
+ title: string;
203
204
  inlineTitle: string;
204
205
  landing: {
205
206
  action: string;
@@ -258,6 +259,7 @@ declare const _default: {
258
259
  };
259
260
  };
260
261
  "manage-warehouses": {
262
+ title: string;
261
263
  addNew: string;
262
264
  editWarehouse: string;
263
265
  contactName: string;
@@ -321,6 +323,7 @@ declare const _default: {
321
323
  maximumBalanceAmount: string;
322
324
  };
323
325
  "list-carriers": {
326
+ title: string;
324
327
  headers: {
325
328
  accountCarriers: string;
326
329
  carriers: string;
@@ -0,0 +1,38 @@
1
+ import { DialogProps, ISidePanelDefaultHeaderProps, SidePanelProps } from "@packlink/giger";
2
+ import { AlchemyProps } from "@shipengine/alchemy";
3
+ import * as JsApi from "@shipengine/js-api";
4
+ import { ManageWarehouses, Onboarding, PurchaseLabel, ViewShipment, VoidLabel } from "./elements";
5
+ type DialogSDKProps = Omit<DialogProps, "isOpen">;
6
+ type SidePanelSDKProps = Omit<SidePanelProps, "isOpen">;
7
+ type ElementsSDKOptions = Omit<AlchemyProps, "getToken" | "children">;
8
+ export declare class ElementsSDK {
9
+ #private;
10
+ getClient(token: string, config: JsApi.ShipEngineAPIConfig): {
11
+ readonly token: never;
12
+ readonly accountSettings: Omit<JsApi.AccountSettingsAPI, "client">;
13
+ readonly addresses: Omit<JsApi.AddressesAPI, "client">;
14
+ readonly carriers: Omit<JsApi.CarriersAPI, "client">;
15
+ readonly customPackages: Omit<JsApi.CustomPackagesAPI, "client">;
16
+ readonly insurance: Omit<JsApi.InsuranceAPI, "client">;
17
+ readonly labels: Omit<JsApi.LabelsAPI, "client">;
18
+ readonly orderSources: Omit<JsApi.OrderSourcesAPI, "client">;
19
+ readonly rates: Omit<JsApi.RatesAPI, "client">;
20
+ readonly salesOrderShipments: Omit<JsApi.SalesOrderShipmentsAPI, "client">;
21
+ readonly salesOrders: Omit<JsApi.SalesOrdersAPI, "client">;
22
+ readonly shipments: Omit<JsApi.ShipmentsAPI, "client">;
23
+ readonly warehouses: Omit<JsApi.WarehousesAPI, "client">;
24
+ };
25
+ constructor(getToken: AlchemyProps["getToken"], options?: ElementsSDKOptions);
26
+ unmount(): void;
27
+ closeDialog(): void;
28
+ closeSidePanel(): void;
29
+ onboardUser(props: Onboarding.ComponentProps, dialogProps: DialogSDKProps): void;
30
+ purchaseLabel(props: PurchaseLabel.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: ISidePanelDefaultHeaderProps): void;
31
+ listCarriers(dialogProps: DialogSDKProps): void;
32
+ manageWarehouses(props: ManageWarehouses.ComponentProps, dialogProps: DialogSDKProps): void;
33
+ viewShipment(props: ViewShipment.ComponentProps, dialogProps: DialogSDKProps): void;
34
+ voidLabel(props: VoidLabel.ComponentProps & {
35
+ labelId: string;
36
+ }, dialogProps: DialogSDKProps): void;
37
+ }
38
+ export {};
@@ -1,18 +1,39 @@
1
1
  import { Interpolation } from "@emotion/serialize";
2
2
  import { Theme } from "@packlink/giger-theme";
3
3
  /**
4
- * Creates a Record of Emotion styles.
4
+ * The verbose typing is necessary to get around TypeScript's limitations on contextual inference
5
+ * with generics. https://stackoverflow.com/questions/75999792/ide-autocompletion-broken-with-typescript-mapped-type-conditionals
6
+ */
7
+ type GetterKey = `get${Capitalize<string>}`;
8
+ type GetterFunction = (...args: any[]) => Interpolation<Theme>;
9
+ type LowerLetters = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
10
+ type Letters = LowerLetters | Uppercase<LowerLetters>;
11
+ type NotG = Exclude<Letters, "g">;
12
+ type NotGE = `g${Exclude<Letters, "e">}`;
13
+ type NotGET = `ge${Exclude<Letters, "t">}`;
14
+ type NotGETUP = `get${Uncapitalize<string>}`;
15
+ type NotGetterKey = NotG | NotGE | NotGET | NotGETUP;
16
+ type StylesConstraint = Record<GetterKey, GetterFunction> & Record<`${NotGetterKey}${string}`, Interpolation<Theme>>;
17
+ /**
18
+ * Creates a Record of Emotion styles; eliminating the need to explicitly type styles
19
+ * while remaining fully typesafe w/ autocomplete.
5
20
  *
6
- * Values may be any variant that a `css` prop can accept (a CSSObject, SerializedStyles, a FunctionInterpolation with theme, etc).
21
+ * Keys prefixed with `get` are assumed to be getters and support arbitrary props.
7
22
  *
8
- * Eliminates the need to explicitly type styles (while remaining fully typed w/ autocomplete).
23
+ * Values may be any variant of `Interpolation` that the `css` prop can accept:
24
+ * a `CSSObject`, `SerializedStyles`, a `FunctionInterpolation` with theme, etc.
9
25
  *
10
26
  * @example
11
27
  * ```
12
28
  * const styles = createStyles({
13
- * container: (theme) => ({ backgroundColor: theme.colors.primary }),
14
- * icon: { color: 'red' },
29
+ * basicObject: { color: "red" },
30
+ * withTheme: (theme) => ({ backgroundColor: theme.palette.primary.main }),
31
+ *
32
+ * getWithArbitraryPropsAndTheme: (disabled?: boolean) => (theme) => ({
33
+ * color: theme.palette[disabled ? 'primary' : 'gray'].main,
34
+ * }),
15
35
  * });
16
36
  * ```
17
37
  */
18
- export declare const createStyles: <T extends string>(styles: Record<T, Interpolation<Theme>>) => Record<T, Interpolation<Theme>>;
38
+ export declare const createStyles: <T extends StylesConstraint>(styles: T) => T;
39
+ export {};