@getflip/bridge 0.0.0-beta-20260114160010
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/LICENSE.md +25 -0
- package/README.md +569 -0
- package/dist/dialog/dialog.d.ts +10 -0
- package/dist/dialog/dialog.js +45 -0
- package/dist/dialog/dialog.js.map +1 -0
- package/dist/dialog/dialog.spec.d.ts +1 -0
- package/dist/dialog/dialog.spec.js +83 -0
- package/dist/dialog/dialog.spec.js.map +1 -0
- package/dist/dialog/dialog.types.d.ts +33 -0
- package/dist/dialog/dialog.types.js +2 -0
- package/dist/dialog/dialog.types.js.map +1 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +3 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/download/download.d.ts +1 -0
- package/dist/download/download.js +17 -0
- package/dist/download/download.js.map +1 -0
- package/dist/download/download.spec.d.ts +1 -0
- package/dist/download/download.spec.js +39 -0
- package/dist/download/download.spec.js.map +1 -0
- package/dist/download/download.types.d.ts +9 -0
- package/dist/download/download.types.js +2 -0
- package/dist/download/download.types.js.map +1 -0
- package/dist/download/index.d.ts +2 -0
- package/dist/download/index.js +3 -0
- package/dist/download/index.js.map +1 -0
- package/dist/events/events.d.ts +3 -0
- package/dist/events/events.js +44 -0
- package/dist/events/events.js.map +1 -0
- package/dist/events/events.spec.d.ts +1 -0
- package/dist/events/events.spec.js +64 -0
- package/dist/events/events.spec.js.map +1 -0
- package/dist/events/events.types.d.ts +29 -0
- package/dist/events/events.types.js +10 -0
- package/dist/events/events.types.js.map +1 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -0
- package/dist/i18n/i18n.d.ts +3 -0
- package/dist/i18n/i18n.js +18 -0
- package/dist/i18n/i18n.js.map +1 -0
- package/dist/i18n/i18n.spec.d.ts +1 -0
- package/dist/i18n/i18n.spec.js +27 -0
- package/dist/i18n/i18n.spec.js.map +1 -0
- package/dist/i18n/i18n.types.d.ts +6 -0
- package/dist/i18n/i18n.types.js +2 -0
- package/dist/i18n/i18n.types.js.map +1 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.cjs.js +329 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +310 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.spec.d.ts +1 -0
- package/dist/index.spec.js +20 -0
- package/dist/index.spec.js.map +1 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +2 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logging.d.ts +1 -0
- package/dist/logging/logging.js +8 -0
- package/dist/logging/logging.js.map +1 -0
- package/dist/logging/logging.spec.d.ts +1 -0
- package/dist/logging/logging.spec.js +19 -0
- package/dist/logging/logging.spec.js.map +1 -0
- package/dist/messaging/index.d.ts +2 -0
- package/dist/messaging/index.js +3 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/messaging.d.ts +15 -0
- package/dist/messaging/messaging.js +70 -0
- package/dist/messaging/messaging.js.map +1 -0
- package/dist/messaging/messaging.spec.d.ts +1 -0
- package/dist/messaging/messaging.spec.js +59 -0
- package/dist/messaging/messaging.spec.js.map +1 -0
- package/dist/messaging/messaging.types.d.ts +11 -0
- package/dist/messaging/messaging.types.js +2 -0
- package/dist/messaging/messaging.types.js.map +1 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +3 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/modal/modal.d.ts +10 -0
- package/dist/modal/modal.js +45 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/modal/modal.spec.d.ts +1 -0
- package/dist/modal/modal.spec.js +81 -0
- package/dist/modal/modal.spec.js.map +1 -0
- package/dist/modal/modal.types.d.ts +30 -0
- package/dist/modal/modal.types.js +2 -0
- package/dist/modal/modal.types.js.map +1 -0
- package/dist/navigation/index.d.ts +2 -0
- package/dist/navigation/index.js +3 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/navigation.d.ts +1 -0
- package/dist/navigation/navigation.js +12 -0
- package/dist/navigation/navigation.js.map +1 -0
- package/dist/navigation/navigation.spec.d.ts +1 -0
- package/dist/navigation/navigation.spec.js +22 -0
- package/dist/navigation/navigation.spec.js.map +1 -0
- package/dist/navigation/navigation.types.d.ts +6 -0
- package/dist/navigation/navigation.types.js +2 -0
- package/dist/navigation/navigation.types.js.map +1 -0
- package/dist/theming/index.d.ts +2 -0
- package/dist/theming/index.js +3 -0
- package/dist/theming/index.js.map +1 -0
- package/dist/theming/theming.d.ts +4 -0
- package/dist/theming/theming.js +19 -0
- package/dist/theming/theming.js.map +1 -0
- package/dist/theming/theming.spec.d.ts +1 -0
- package/dist/theming/theming.spec.js +30 -0
- package/dist/theming/theming.spec.js.map +1 -0
- package/dist/theming/theming.types.d.ts +12 -0
- package/dist/theming/theming.types.js +2 -0
- package/dist/theming/theming.types.js.map +1 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +3 -0
- package/dist/toast/index.js.map +1 -0
- package/dist/toast/toast.d.ts +2 -0
- package/dist/toast/toast.js +12 -0
- package/dist/toast/toast.js.map +1 -0
- package/dist/toast/toast.spec.d.ts +1 -0
- package/dist/toast/toast.spec.js +32 -0
- package/dist/toast/toast.spec.js.map +1 -0
- package/dist/toast/toast.types.d.ts +11 -0
- package/dist/toast/toast.types.js +2 -0
- package/dist/toast/toast.types.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.js +26 -0
- package/dist/types.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
import { makeRequest } from "../messaging";
|
|
3
|
+
import { BridgeMethod } from "../types";
|
|
4
|
+
export function getTheme() {
|
|
5
|
+
const request = {
|
|
6
|
+
id: uuidv4(),
|
|
7
|
+
method: BridgeMethod.GET_THEME,
|
|
8
|
+
};
|
|
9
|
+
return makeRequest(request);
|
|
10
|
+
}
|
|
11
|
+
export function setTheme(theme) {
|
|
12
|
+
const request = {
|
|
13
|
+
id: uuidv4(),
|
|
14
|
+
method: BridgeMethod.SET_THEME,
|
|
15
|
+
params: { theme },
|
|
16
|
+
};
|
|
17
|
+
return makeRequest(request);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=theming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theming.js","sourceRoot":"","sources":["../../src/theming/theming.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQxC,MAAM,UAAU,QAAQ;IACtB,MAAM,OAAO,GAAoB;QAC/B,EAAE,EAAE,MAAM,EAAE;QACZ,MAAM,EAAE,YAAY,CAAC,SAAS;KAC/B,CAAC;IAEF,OAAO,WAAW,CAAiB,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAmB;IAC1C,MAAM,OAAO,GAAoB;QAC/B,EAAE,EAAE,MAAM,EAAE;QACZ,MAAM,EAAE,YAAY,CAAC,SAAS;QAC9B,MAAM,EAAE,EAAE,KAAK,EAAE;KAClB,CAAC;IAEF,OAAO,WAAW,CAAiB,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { makeRequest } from "../messaging";
|
|
2
|
+
import { getTheme, setTheme } from "./theming";
|
|
3
|
+
jest.mock("../messaging", () => ({
|
|
4
|
+
makeRequest: jest.fn(),
|
|
5
|
+
}));
|
|
6
|
+
describe("theming", () => {
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
global.flipBridgeOptions = { hostAppOrigin: "http://localhost" };
|
|
9
|
+
});
|
|
10
|
+
test("'getTheme' sends correct request", async () => {
|
|
11
|
+
await getTheme();
|
|
12
|
+
const makeRequestMock = makeRequest;
|
|
13
|
+
expect(makeRequestMock).toHaveBeenCalledWith({
|
|
14
|
+
id: makeRequestMock.mock.calls[0][0].id,
|
|
15
|
+
method: "GET_THEME",
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
test("'setTheme' sends correct request", async () => {
|
|
19
|
+
await setTheme("dark");
|
|
20
|
+
const makeRequestMock = makeRequest;
|
|
21
|
+
expect(makeRequestMock).toHaveBeenCalledWith({
|
|
22
|
+
id: makeRequestMock.mock.calls[0][0].id,
|
|
23
|
+
method: "SET_THEME",
|
|
24
|
+
params: {
|
|
25
|
+
theme: "dark",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=theming.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theming.spec.js","sourceRoot":"","sources":["../../src/theming/theming.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/B,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;CACvB,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,SAAS,CAAC,GAAG,EAAE;QACZ,MAAc,CAAC,iBAAiB,GAAG,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,QAAQ,EAAE,CAAC;QAEjB,MAAM,eAAe,GAAG,WAEvB,CAAC;QAEF,MAAM,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC;YAC3C,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACvC,MAAM,EAAE,WAAW;SACpB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEvB,MAAM,eAAe,GAAG,WAEvB,CAAC;QAEF,MAAM,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC;YAC3C,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACvC,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE;gBACN,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SwirlOSTheme } from "@getflip/swirl-components/dist/types/components/swirl-theme-provider/swirl-theme-provider.types";
|
|
2
|
+
import { BridgeRequest } from "../messaging/messaging.types";
|
|
3
|
+
import { BridgeMethod } from "../types";
|
|
4
|
+
export type GetThemeRequest = BridgeRequest<BridgeMethod.GET_THEME, undefined>;
|
|
5
|
+
export type GetThemeResult = {
|
|
6
|
+
activeTheme: SwirlOSTheme;
|
|
7
|
+
preferredTheme: SwirlOSTheme | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type SetThemeRequest = BridgeRequest<BridgeMethod.SET_THEME, {
|
|
10
|
+
theme: SwirlOSTheme | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type SetThemeResult = SwirlOSTheme | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theming.types.js","sourceRoot":"","sources":["../../src/theming/theming.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
import { makeRequest } from "../messaging";
|
|
3
|
+
import { BridgeMethod } from "../types";
|
|
4
|
+
export async function showToast(params) {
|
|
5
|
+
const request = {
|
|
6
|
+
id: uuidv4(),
|
|
7
|
+
method: BridgeMethod.SHOW_TOAST,
|
|
8
|
+
params,
|
|
9
|
+
};
|
|
10
|
+
return await makeRequest(request);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/toast/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAOxC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAA8B;IAC5D,MAAM,OAAO,GAAqB;QAChC,EAAE,EAAE,MAAM,EAAE;QACZ,MAAM,EAAE,YAAY,CAAC,UAAU;QAC/B,MAAM;KACP,CAAC;IAEF,OAAO,MAAM,WAAW,CAAkB,OAAO,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BridgeMethod } from "../types";
|
|
2
|
+
import { showToast } from "./toast";
|
|
3
|
+
jest.mock("../messaging", () => {
|
|
4
|
+
const originalModule = jest.requireActual("../messaging");
|
|
5
|
+
return Object.assign(Object.assign({ __esModule: true }, originalModule), { makeRequest: async (request) => {
|
|
6
|
+
originalModule.makeRequest(request);
|
|
7
|
+
return true;
|
|
8
|
+
} });
|
|
9
|
+
});
|
|
10
|
+
describe("toast", () => {
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
global.flipBridgeOptions = { hostAppOrigin: "http://localhost" };
|
|
13
|
+
});
|
|
14
|
+
test("'showToast' sends correct request", async () => {
|
|
15
|
+
const params = {
|
|
16
|
+
text: "My toast",
|
|
17
|
+
duration: 5000,
|
|
18
|
+
icon: "icon",
|
|
19
|
+
intent: "success",
|
|
20
|
+
};
|
|
21
|
+
const spy = jest.fn();
|
|
22
|
+
window.top.postMessage = spy;
|
|
23
|
+
const response = await showToast(params);
|
|
24
|
+
expect(spy).toHaveBeenCalledWith({
|
|
25
|
+
id: spy.mock.calls[0][0].id,
|
|
26
|
+
method: BridgeMethod.SHOW_TOAST,
|
|
27
|
+
params,
|
|
28
|
+
}, "http://localhost");
|
|
29
|
+
expect(response).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=toast.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.spec.js","sourceRoot":"","sources":["../../src/toast/toast.spec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;IAC7B,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAE1D,qCACE,UAAU,EAAE,IAAI,IACb,cAAc,KACjB,WAAW,EAAE,KAAK,EAAE,OAAsB,EAAE,EAAE;YAC5C,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC,IACD;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,SAAS,CAAC,GAAG,EAAE;QACZ,MAAc,CAAC,iBAAiB,GAAG,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,MAAM,GAA2B;YACrC,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,SAAS;SAClB,CAAC;QAEF,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAErB,MAAM,CAAC,GAAW,CAAC,WAAW,GAAG,GAAG,CAAC;QAEtC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAC9B;YACE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YAC3B,MAAM,EAAE,YAAY,CAAC,UAAU;YAC/B,MAAM;SACP,EACD,kBAAkB,CACnB,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BridgeRequest } from "../messaging";
|
|
2
|
+
import { BridgeMethod } from "../types";
|
|
3
|
+
import { SwirlToastIntent } from "@getflip/swirl-components/loader";
|
|
4
|
+
export type ShowToastRequestParams = {
|
|
5
|
+
text: string;
|
|
6
|
+
duration?: number;
|
|
7
|
+
icon?: string;
|
|
8
|
+
intent?: SwirlToastIntent;
|
|
9
|
+
};
|
|
10
|
+
export type ShowToastRequest = BridgeRequest<BridgeMethod.SHOW_TOAST, ShowToastRequestParams>;
|
|
11
|
+
export type ShowToastResult = boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.types.js","sourceRoot":"","sources":["../../src/toast/toast.types.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CloseDialogResult, CreateDialogResult, DestroyDialogResult, OpenDialogResult } from "./dialog";
|
|
2
|
+
import { DownloadResult } from "./download";
|
|
3
|
+
import { SubscribeResult, UnsubscribeResult } from "./events/events.types";
|
|
4
|
+
import { GetAvailableLangsResult, GetLangResult } from "./i18n";
|
|
5
|
+
import { CloseModalResult, CreateModalResult, DestroyModalResult, OpenModalResult } from "./modal";
|
|
6
|
+
import { NavigateResult } from "./navigation";
|
|
7
|
+
import { GetThemeResult, SetThemeResult } from "./theming";
|
|
8
|
+
import { ShowToastResult } from "./toast";
|
|
9
|
+
export type BridgeOptions = {
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
hostAppOrigin: string;
|
|
12
|
+
};
|
|
13
|
+
export type BridgeError = {
|
|
14
|
+
code: BridgeErrorCode;
|
|
15
|
+
};
|
|
16
|
+
export declare enum BridgeErrorCode {
|
|
17
|
+
FORBIDDEN_ORIGIN = "FORBIDDEN_ORIGIN",
|
|
18
|
+
INVALID_REQUEST = "INVALID_REQUEST"
|
|
19
|
+
}
|
|
20
|
+
export declare enum BridgeMethod {
|
|
21
|
+
CLOSE_DIALOG = "CLOSE_DIALOG",
|
|
22
|
+
CLOSE_MODAL = "CLOSE_MODAL",
|
|
23
|
+
CREATE_DIALOG = "CREATE_DIALOG",
|
|
24
|
+
CREATE_MODAL = "CREATE_MODAL",
|
|
25
|
+
DESTROY_DIALOG = "DESTROY_DIALOG",
|
|
26
|
+
DESTROY_MODAL = "DESTROY_MODAL",
|
|
27
|
+
GET_AVAILABLE_LANGS = "GET_AVAILABLE_LANGS",
|
|
28
|
+
GET_LANG = "GET_LANG",
|
|
29
|
+
GET_THEME = "GET_THEME",
|
|
30
|
+
NAVIGATE = "NAVIGATE",
|
|
31
|
+
OPEN_DIALOG = "OPEN_DIALOG",
|
|
32
|
+
OPEN_MODAL = "OPEN_MODAL",
|
|
33
|
+
SET_THEME = "SET_THEME",
|
|
34
|
+
SHOW_TOAST = "SHOW_TOAST",
|
|
35
|
+
SUBSCRIBE = "SUBSCRIBE",
|
|
36
|
+
UNSUBSCRIBE = "UNSUBSCRIBE",
|
|
37
|
+
DOWNLOAD = "DOWNLOAD"
|
|
38
|
+
}
|
|
39
|
+
export type BridgeMethodResultMapping = {
|
|
40
|
+
[BridgeMethod.CLOSE_DIALOG]: CloseDialogResult;
|
|
41
|
+
[BridgeMethod.CLOSE_MODAL]: CloseModalResult;
|
|
42
|
+
[BridgeMethod.CREATE_DIALOG]: CreateDialogResult;
|
|
43
|
+
[BridgeMethod.CREATE_MODAL]: CreateModalResult;
|
|
44
|
+
[BridgeMethod.DESTROY_DIALOG]: DestroyDialogResult;
|
|
45
|
+
[BridgeMethod.DESTROY_MODAL]: DestroyModalResult;
|
|
46
|
+
[BridgeMethod.GET_AVAILABLE_LANGS]: GetAvailableLangsResult;
|
|
47
|
+
[BridgeMethod.GET_LANG]: GetLangResult;
|
|
48
|
+
[BridgeMethod.GET_THEME]: GetThemeResult;
|
|
49
|
+
[BridgeMethod.NAVIGATE]: NavigateResult;
|
|
50
|
+
[BridgeMethod.OPEN_DIALOG]: OpenDialogResult;
|
|
51
|
+
[BridgeMethod.OPEN_MODAL]: OpenModalResult;
|
|
52
|
+
[BridgeMethod.SET_THEME]: SetThemeResult;
|
|
53
|
+
[BridgeMethod.SHOW_TOAST]: ShowToastResult;
|
|
54
|
+
[BridgeMethod.SUBSCRIBE]: SubscribeResult;
|
|
55
|
+
[BridgeMethod.UNSUBSCRIBE]: UnsubscribeResult;
|
|
56
|
+
[BridgeMethod.DOWNLOAD]: DownloadResult;
|
|
57
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var BridgeErrorCode;
|
|
2
|
+
(function (BridgeErrorCode) {
|
|
3
|
+
BridgeErrorCode["FORBIDDEN_ORIGIN"] = "FORBIDDEN_ORIGIN";
|
|
4
|
+
BridgeErrorCode["INVALID_REQUEST"] = "INVALID_REQUEST";
|
|
5
|
+
})(BridgeErrorCode || (BridgeErrorCode = {}));
|
|
6
|
+
export var BridgeMethod;
|
|
7
|
+
(function (BridgeMethod) {
|
|
8
|
+
BridgeMethod["CLOSE_DIALOG"] = "CLOSE_DIALOG";
|
|
9
|
+
BridgeMethod["CLOSE_MODAL"] = "CLOSE_MODAL";
|
|
10
|
+
BridgeMethod["CREATE_DIALOG"] = "CREATE_DIALOG";
|
|
11
|
+
BridgeMethod["CREATE_MODAL"] = "CREATE_MODAL";
|
|
12
|
+
BridgeMethod["DESTROY_DIALOG"] = "DESTROY_DIALOG";
|
|
13
|
+
BridgeMethod["DESTROY_MODAL"] = "DESTROY_MODAL";
|
|
14
|
+
BridgeMethod["GET_AVAILABLE_LANGS"] = "GET_AVAILABLE_LANGS";
|
|
15
|
+
BridgeMethod["GET_LANG"] = "GET_LANG";
|
|
16
|
+
BridgeMethod["GET_THEME"] = "GET_THEME";
|
|
17
|
+
BridgeMethod["NAVIGATE"] = "NAVIGATE";
|
|
18
|
+
BridgeMethod["OPEN_DIALOG"] = "OPEN_DIALOG";
|
|
19
|
+
BridgeMethod["OPEN_MODAL"] = "OPEN_MODAL";
|
|
20
|
+
BridgeMethod["SET_THEME"] = "SET_THEME";
|
|
21
|
+
BridgeMethod["SHOW_TOAST"] = "SHOW_TOAST";
|
|
22
|
+
BridgeMethod["SUBSCRIBE"] = "SUBSCRIBE";
|
|
23
|
+
BridgeMethod["UNSUBSCRIBE"] = "UNSUBSCRIBE";
|
|
24
|
+
BridgeMethod["DOWNLOAD"] = "DOWNLOAD";
|
|
25
|
+
})(BridgeMethod || (BridgeMethod = {}));
|
|
26
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,wDAAqC,CAAA;IACrC,sDAAmC,CAAA;AACrC,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,MAAM,CAAN,IAAY,YAkBX;AAlBD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,2CAA2B,CAAA;IAC3B,+CAA+B,CAAA;IAC/B,6CAA6B,CAAA;IAC7B,iDAAiC,CAAA;IACjC,+CAA+B,CAAA;IAC/B,2DAA2C,CAAA;IAC3C,qCAAqB,CAAA;IACrB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,2CAA2B,CAAA;IAC3B,qCAAqB,CAAA;AACvB,CAAC,EAlBW,YAAY,KAAZ,YAAY,QAkBvB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getflip/bridge",
|
|
3
|
+
"version": "0.0.0-beta-20260114160010",
|
|
4
|
+
"description": "Flip JavaScript Bridge for external integrations.",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": "https://github.com/getflip/swirl",
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "rimraf dist && tsc && rollup -c rollup.config.mjs",
|
|
15
|
+
"dev": "tsc -w",
|
|
16
|
+
"start": "yarn dev",
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"test:coverage": "jest --coverage --no-cache",
|
|
19
|
+
"test:watch": "jest --watchAll"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@getflip/swirl-components": "0.0.0-beta-20260114160010",
|
|
23
|
+
"uuid": "9.0.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@babel/core": "7.20.12",
|
|
27
|
+
"@babel/preset-env": "7.20.2",
|
|
28
|
+
"@babel/preset-typescript": "7.18.6",
|
|
29
|
+
"@rollup/plugin-typescript": "10.0.1",
|
|
30
|
+
"@types/jest": "27.5.2",
|
|
31
|
+
"@types/uuid": "8.3.4",
|
|
32
|
+
"babel-jest": "29.7.0",
|
|
33
|
+
"jest": "27.5.1",
|
|
34
|
+
"rimraf": "3.0.2",
|
|
35
|
+
"rollup": "3.29.4",
|
|
36
|
+
"typescript": "4.9.5"
|
|
37
|
+
}
|
|
38
|
+
}
|