@shipengine/elements-sdk 0.9.0 → 1.0.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.
@@ -0,0 +1,23 @@
1
+ import { ISidePanelDefaultHeaderProps, SidePanelProps } from "@shipengine/giger";
2
+ import { ElementsProviderProps } from "@shipengine/elements";
3
+ export type SidePanelHeaderProps = ISidePanelDefaultHeaderProps & {
4
+ title: string;
5
+ };
6
+ export type SidePanelSDKProps = Omit<SidePanelProps, "isOpen">;
7
+ export type ElementsEvent = {
8
+ Element: any;
9
+ props: any;
10
+ container?: Element;
11
+ id: string;
12
+ sidePanelHeaderProps?: SidePanelHeaderProps;
13
+ sidePanelProps?: SidePanelSDKProps;
14
+ };
15
+ export type UnmountElementsEvent = {
16
+ id: string;
17
+ };
18
+ export type UpdateElementsEvent = Pick<ElementsEvent, "props" | "id">;
19
+ export type ElementsRegistry = Record<string, Omit<ElementsEvent, "id">>;
20
+ export declare const MOUNT_ELEMENTS_EVENT = "se.lmnt.mountElement";
21
+ export declare const UNMOUNT_ELEMENTS_EVENT = "se.lmnt.unmountElement";
22
+ export declare const UPDATE_ELEMENTS_EVENT = "se.lmnt.updateElement";
23
+ export declare const ElementsRoot: (providerProps: Omit<ElementsProviderProps, "children">) => import("@emotion/react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements-sdk",
3
- "version": "0.9.0",
3
+ "version": "1.0.0",
4
4
  "types": "./public-sdk.d.ts",
5
5
  "module": "shipengine-elements-sdk.mjs",
6
6
  "peerDependencies": {
package/public-sdk.d.ts CHANGED
@@ -1,50 +1,129 @@
1
- import { ISidePanelDefaultHeaderProps, SidePanelProps } from "@shipengine/giger";
2
- import { AlchemyProviderProps } from "@shipengine/alchemy";
3
- import * as JsApi from "@shipengine/js-api";
4
- import { AccountSettings, ExternalCarriers, Onboarding, PurchaseLabel, PurchaseLabelWorkflow, ViewShipment, VoidLabel, ConnectCarrier } from "@shipengine/elements";
5
- type SidePanelHeaderProps = ISidePanelDefaultHeaderProps & {
6
- title: string;
1
+ import { ShipEngineElement } from "./shipengine-element";
2
+ import { ShipEngineAPIConfig } from "@shipengine/js-api";
3
+ import { SidePanelHeaderProps, SidePanelSDKProps } from "./elements-root";
4
+ import { ElementsProviderProps, PurchaseLabel, AccountSettings, LabelWorkflow, ConnectExternalCarrier, Onboarding, ShipmentSummary, VoidLabel, ManageExternalCarriers } from "@shipengine/elements";
5
+ export type ElementsSDKOptions = Omit<ElementsProviderProps, "getToken" | "children" | "container">;
6
+ export type ElementProps = {
7
+ accountSettings: AccountSettings.ComponentProps;
8
+ carrierServices: {};
9
+ connectExternalCarrier: ConnectExternalCarrier.ComponentProps;
10
+ labelLayout: {};
11
+ labelWorkFlow: LabelWorkflow.LabelWorkflowProps;
12
+ manageCarriers: {};
13
+ manageExternalCarriers: ManageExternalCarriers.ComponentProps;
14
+ manageFunding: {};
15
+ manageWarehouses: {};
16
+ onboarding: Onboarding.ComponentProps;
17
+ paymentMethodSettings: {};
18
+ purchaseLabel: PurchaseLabel.PurchaseLabelCommonProps;
19
+ shipmentSummary: ShipmentSummary.ComponentProps;
20
+ transactionHistory: {};
21
+ unitSettings: {};
22
+ voidLabel: VoidLabel.ComponentProps;
7
23
  };
8
- type SidePanelSDKProps = Omit<SidePanelProps, "isOpen">;
9
- type ElementsSDKOptions = Omit<AlchemyProviderProps, "getToken" | "children">;
24
+ export type AvailableElements = keyof ElementProps;
10
25
  export declare class ElementsSDK {
11
26
  #private;
12
- getClient(token: string, config: JsApi.ShipEngineAPIConfig): {
27
+ constructor(getToken: ElementsProviderProps["getToken"], options?: ElementsSDKOptions, container?: HTMLElement | string);
28
+ getClient(token: string, config: ShipEngineAPIConfig): {
13
29
  readonly token: never;
14
- readonly accountSettings: Omit<JsApi.AccountSettingsAPI, "client">;
30
+ readonly accountSettings: Omit<import("@shipengine/js-api").AccountSettingsAPI, "client">;
15
31
  readonly accountBillingPlan: Omit<import("@shipengine/js-api/account-billing-plan").AccountBillingPlanAPI, "client">;
16
- readonly addresses: Omit<JsApi.AddressesAPI, "client">;
17
- readonly carriers: Omit<JsApi.CarriersAPI, "client">;
18
- readonly connections: Omit<JsApi.ConnectionsAPI, "client">;
19
- readonly customPackages: Omit<JsApi.CustomPackagesAPI, "client">;
20
- readonly fundingSources: Omit<JsApi.FundingSourcesAPI, "client">;
21
- readonly insurance: Omit<JsApi.InsuranceAPI, "client">;
22
- readonly labels: Omit<JsApi.LabelsAPI, "client">;
23
- readonly orderSources: Omit<JsApi.OrderSourcesAPI, "client">;
24
- readonly rateCards: Omit<JsApi.RateCardsAPI, "client">;
25
- readonly rates: Omit<JsApi.RatesAPI, "client">;
26
- readonly salesOrderShipments: Omit<JsApi.SalesOrderShipmentsAPI, "client">;
27
- readonly salesOrders: Omit<JsApi.SalesOrdersAPI, "client">;
28
- readonly servicePoints: Omit<JsApi.ServicePointsAPI, "client">;
29
- readonly shipments: Omit<JsApi.ShipmentsAPI, "client">;
30
- readonly themes: Omit<JsApi.ThemesAPI, "client">;
31
- readonly warehouses: Omit<JsApi.WarehousesAPI, "client">;
32
- readonly shippingRules: Omit<JsApi.ShippingRulesAPI, "client">;
33
- readonly webhooks: Omit<JsApi.WebhooksAPI, "client">;
34
- readonly sellers: Omit<JsApi.SellersAPI, "client">;
32
+ readonly addresses: Omit<import("@shipengine/js-api").AddressesAPI, "client">;
33
+ readonly carriers: Omit<import("@shipengine/js-api").CarriersAPI, "client">;
34
+ readonly connections: Omit<import("@shipengine/js-api").ConnectionsAPI, "client">;
35
+ readonly customPackages: Omit<import("@shipengine/js-api").CustomPackagesAPI, "client">;
36
+ readonly fundingSources: Omit<import("@shipengine/js-api").FundingSourcesAPI, "client">;
37
+ readonly insurance: Omit<import("@shipengine/js-api").InsuranceAPI, "client">;
38
+ readonly labels: Omit<import("@shipengine/js-api").LabelsAPI, "client">;
39
+ readonly orderSources: Omit<import("@shipengine/js-api").OrderSourcesAPI, "client">;
40
+ readonly rateCards: Omit<import("@shipengine/js-api").RateCardsAPI, "client">;
41
+ readonly rates: Omit<import("@shipengine/js-api").RatesAPI, "client">;
42
+ readonly salesOrderShipments: Omit<import("@shipengine/js-api").SalesOrderShipmentsAPI, "client">;
43
+ readonly salesOrders: Omit<import("@shipengine/js-api").SalesOrdersAPI, "client">;
44
+ readonly servicePoints: Omit<import("@shipengine/js-api").ServicePointsAPI, "client">;
45
+ readonly shipments: Omit<import("@shipengine/js-api").ShipmentsAPI, "client">;
46
+ readonly themes: Omit<import("@shipengine/js-api").ThemesAPI, "client">;
47
+ readonly warehouses: Omit<import("@shipengine/js-api").WarehousesAPI, "client">;
48
+ readonly shippingRules: Omit<import("@shipengine/js-api").ShippingRulesAPI, "client">;
49
+ readonly webhooks: Omit<import("@shipengine/js-api").WebhooksAPI, "client">;
50
+ readonly sellers: Omit<import("@shipengine/js-api").SellersAPI, "client">;
35
51
  };
36
- constructor(getToken: AlchemyProviderProps["getToken"], options?: ElementsSDKOptions);
37
- unmount(): void;
38
- closeSidePanel(): void;
39
- connectExternalCarrier(props: ConnectCarrier.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
40
- manageAccountSettings(props: AccountSettings.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
41
- manageExternalCarriers(props: ExternalCarriers.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
42
- onboardUser(props: Onboarding.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
43
- purchaseLabel(props: PurchaseLabel.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
44
- purchaseLabelWorkflow(props: PurchaseLabelWorkflow.PurchaseLabelWorkflowProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
45
- viewShipment(props: ViewShipment.ComponentProps, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
46
- voidLabel(props: VoidLabel.ComponentProps & {
47
- labelId: string;
48
- }, sidePanelProps: SidePanelSDKProps, sidePanelHeaderProps: SidePanelHeaderProps): void;
52
+ create<Key extends AvailableElements>(type: AvailableElements, props?: any): ShipEngineElement<ElementProps[Key]>;
53
+ destroy(): void;
54
+ /**
55
+ * @deprecated since SDK version 2.0
56
+ *
57
+ * Please use the create method and render the Element using the renderInSidePanel method
58
+ */
59
+ closeSidePanel(type: AvailableElements): void;
60
+ /**
61
+ * @deprecated since SDK version 2.0
62
+ *
63
+ * Please use the create method and render the Element using the renderInSidePanel method
64
+ */
65
+ manageAccountSettings(props: {
66
+ elementProps: ElementProps["accountSettings"];
67
+ sidePanelProps: SidePanelSDKProps;
68
+ sidePanelHeaderProps: SidePanelHeaderProps;
69
+ }): void;
70
+ /**
71
+ * @deprecated since SDK version 2.0
72
+ *
73
+ * Please use the create method and render the Element using the renderInSidePanel method
74
+ */
75
+ manageExternalCarriers(props: {
76
+ sidePanelProps: SidePanelSDKProps;
77
+ sidePanelHeaderProps: SidePanelHeaderProps;
78
+ }): void;
79
+ /**
80
+ * @deprecated since SDK version 2.0
81
+ *
82
+ * Please use the create method and render the Element using the renderInSidePanel method
83
+ */
84
+ onboardUser(props: {
85
+ elementProps: ElementProps["onboarding"];
86
+ sidePanelHeaderProps?: SidePanelHeaderProps;
87
+ sidePanelProps?: SidePanelSDKProps;
88
+ }): void;
89
+ /**
90
+ * @deprecated since SDK version 2.0
91
+ *
92
+ * Please use the create method and render the Element using the renderInSidePanel method
93
+ */
94
+ labelWorkflow(props: {
95
+ elementProps: ElementProps["labelWorkFlow"];
96
+ sidePanelHeaderProps?: SidePanelHeaderProps;
97
+ sidePanelProps?: SidePanelSDKProps;
98
+ }): void;
99
+ /**
100
+ * @deprecated since SDK version 2.0
101
+ *
102
+ * Please use the create method and render the Element using the renderInSidePanel method
103
+ */
104
+ purchaseLabel(props: {
105
+ elementProps: ElementProps["purchaseLabel"];
106
+ sidePanelHeaderProps?: SidePanelHeaderProps;
107
+ sidePanelProps?: SidePanelSDKProps;
108
+ }): void;
109
+ /**
110
+ * @deprecated since SDK version 2.0
111
+ *
112
+ * Please use the create method and render the Element using the renderInSidePanel method
113
+ */
114
+ shipmentSummary(props: {
115
+ elementProps: ElementProps["shipmentSummary"];
116
+ sidePanelHeaderProps?: SidePanelHeaderProps;
117
+ sidePanelProps?: SidePanelSDKProps;
118
+ }): void;
119
+ /**
120
+ * @deprecated since SDK version 2.0
121
+ *
122
+ * Please use the create method and render the Element using the renderInSidePanel method
123
+ */
124
+ voidLabel(props: {
125
+ elementProps: ElementProps["voidLabel"];
126
+ sidePanelHeaderProps?: SidePanelHeaderProps;
127
+ sidePanelProps?: SidePanelSDKProps;
128
+ }): void;
49
129
  }
50
- export {};
@@ -0,0 +1,14 @@
1
+ import { SidePanelHeaderProps, SidePanelSDKProps } from "./elements-root";
2
+ export declare class ShipEngineElement<Props> {
3
+ #private;
4
+ constructor(component: any, id?: string, props?: Props);
5
+ mount(node: HTMLElement | string, props?: Props): void;
6
+ unmount(): void;
7
+ update(props: Props): void;
8
+ renderSidePanel({ elementProps, sidePanelHeaderProps, sidePanelProps, }: {
9
+ elementProps?: Props;
10
+ sidePanelHeaderProps?: SidePanelHeaderProps;
11
+ sidePanelProps?: SidePanelSDKProps;
12
+ }): void;
13
+ closeSidePanel(): void;
14
+ }