@shopfront/bridge 3.0.5 → 3.0.6

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.
package/README.md CHANGED
@@ -38,3 +38,17 @@ export const execute = application.communicator.execute;
38
38
  export const registerSendMessage = application.communicator.registerSendMessage;
39
39
  export const onReceiveMessage = application.communicator.onReceiveMessage;
40
40
  ```
41
+
42
+ Alternatively, you can export the application as the default item and Shopfront will automatically infer the functions
43
+ from it.
44
+
45
+ ```javascript
46
+ import { Bridge } from "@shopfront/bridge";
47
+
48
+ const application = Bridge.createApplication({
49
+ id : "<< my client id >>",
50
+ communicator: "javascript",
51
+ });
52
+
53
+ export default application;
54
+ ```
package/lib/Bridge.d.ts CHANGED
@@ -17,11 +17,10 @@ type JavaScriptSendMessageCallback = (message: {
17
17
  data: unknown;
18
18
  id?: string;
19
19
  }) => void;
20
- export type JavaScriptReceiveMessageCallback = (type: keyof FromShopfront | keyof FromShopfrontInternal, data: Record<string, unknown>, id: string) => void;
21
20
  export interface JavaScriptCommunicatorExports {
22
21
  execute: () => void;
23
22
  registerSendMessage: (callback: JavaScriptSendMessageCallback) => void;
24
- onReceiveMessage: JavaScriptReceiveMessageCallback;
23
+ onReceiveMessage: (type: keyof FromShopfront | keyof FromShopfrontInternal, data: Record<string, unknown>, id: string) => void;
25
24
  }
26
25
  export declare class Bridge extends BaseBridge {
27
26
  protected communicateVia: "frame" | "javascript";