@ledgerhq/device-management-kit-devtools-rozenite 0.1.1
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 +202 -0
- package/README.md +17 -0
- package/dist/index.html +30 -0
- package/dist/index.js +1413 -0
- package/dist/react-native.cjs +1 -0
- package/dist/react-native.d.ts +2 -0
- package/dist/react-native.js +74 -0
- package/dist/rozenite.config.d.ts +7 -0
- package/dist/rozenite.json +1 -0
- package/dist/src/dashboard-panel/index.d.ts +1 -0
- package/dist/src/shared/PluginEvents.d.ts +8 -0
- package/dist/src/shared/RozeniteConnector.d.ts +32 -0
- package/dist/src/shared/pluginId.d.ts +1 -0
- package/dist/src/shared/useRozeniteConnector.d.ts +2 -0
- package/package.json +44 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@rozenite/plugin-bridge"),r=require("react"),c=require("rxjs"),t=class t{constructor(){this.rozeniteClient=null,this.messagesToSend=new c.ReplaySubject,this.messagesFromDashboard=new c.Subject,this.messagesToSendSubscription=null,this.verbose=!1}static getInstance(){return t.instance||(t.instance=new t),t.instance}static destroyInstance(){t.instance&&(t.instance.destroy(),t.instance=null)}setVerbose(e){this.verbose=e}error(...e){this.verbose&&console.error(...e)}setClient(e){this.messagesToSendSubscription&&(this.messagesToSendSubscription.unsubscribe(),this.messagesToSendSubscription=null),this.rozeniteClient&&this.rozeniteClient.close(),this.rozeniteClient=e,this.initialize().catch(s=>{this.error("[RozeniteConnector] Error initializing",s)})}destroy(){this.messagesToSendSubscription&&(this.messagesToSendSubscription.unsubscribe(),this.messagesToSendSubscription=null),this.rozeniteClient?.close(),this.messagesToSend.complete(),this.messagesFromDashboard.complete()}async initialize(){const e=this.rozeniteClient;if(!e)throw new Error("[RozeniteConnector] Client not set");this.messagesToSendSubscription&&(this.messagesToSendSubscription.unsubscribe(),this.messagesToSendSubscription=null);const s=()=>{this.messagesToSendSubscription&&this.messagesToSendSubscription.unsubscribe(),this.messagesToSendSubscription=this.messagesToSend.subscribe({next:n=>{e.send("message",n)}})};e.onMessage("init",()=>{const n=!!this.messagesToSendSubscription;s(),n||e.send("init","init response")}),e.onMessage("message",({type:n,payload:a})=>{this.messagesFromDashboard.next({type:n,payload:a})}),e.send("init","init message from client")}sendMessage(e,s){this.messagesToSend.next({type:e,payload:s})}listenToMessages(e){return this.messagesFromDashboard.subscribe({next:s=>e(s.type,s.payload)})}};t.instance=null;let i=t;const l="@ledgerhq/device-management-kit-devtools-rozenite",h=l;function g(){const o=u.useRozeniteDevToolsClient({pluginId:h}),[e,s]=r.useState(null);return r.useEffect(()=>{if(o){const n=i.getInstance();n.setClient(o),s(n)}},[o]),e}exports.RozeniteConnector=i;exports.useRozeniteConnector=g;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useRozeniteDevToolsClient as a } from "@rozenite/plugin-bridge";
|
|
2
|
+
import { useState as c, useEffect as l } from "react";
|
|
3
|
+
import { ReplaySubject as u, Subject as h } from "rxjs";
|
|
4
|
+
const t = class t {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.rozeniteClient = null, this.messagesToSend = new u(), this.messagesFromDashboard = new h(), this.messagesToSendSubscription = null, this.verbose = !1;
|
|
7
|
+
}
|
|
8
|
+
static getInstance() {
|
|
9
|
+
return t.instance || (t.instance = new t()), t.instance;
|
|
10
|
+
}
|
|
11
|
+
static destroyInstance() {
|
|
12
|
+
t.instance && (t.instance.destroy(), t.instance = null);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* VERBOSE LOGGING
|
|
16
|
+
*/
|
|
17
|
+
setVerbose(e) {
|
|
18
|
+
this.verbose = e;
|
|
19
|
+
}
|
|
20
|
+
error(...e) {
|
|
21
|
+
this.verbose && console.error(...e);
|
|
22
|
+
}
|
|
23
|
+
setClient(e) {
|
|
24
|
+
this.messagesToSendSubscription && (this.messagesToSendSubscription.unsubscribe(), this.messagesToSendSubscription = null), this.rozeniteClient && this.rozeniteClient.close(), this.rozeniteClient = e, this.initialize().catch((s) => {
|
|
25
|
+
this.error("[RozeniteConnector] Error initializing", s);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
destroy() {
|
|
29
|
+
this.messagesToSendSubscription && (this.messagesToSendSubscription.unsubscribe(), this.messagesToSendSubscription = null), this.rozeniteClient?.close(), this.messagesToSend.complete(), this.messagesFromDashboard.complete();
|
|
30
|
+
}
|
|
31
|
+
async initialize() {
|
|
32
|
+
const e = this.rozeniteClient;
|
|
33
|
+
if (!e)
|
|
34
|
+
throw new Error("[RozeniteConnector] Client not set");
|
|
35
|
+
this.messagesToSendSubscription && (this.messagesToSendSubscription.unsubscribe(), this.messagesToSendSubscription = null);
|
|
36
|
+
const s = () => {
|
|
37
|
+
this.messagesToSendSubscription && this.messagesToSendSubscription.unsubscribe(), this.messagesToSendSubscription = this.messagesToSend.subscribe({
|
|
38
|
+
next: (i) => {
|
|
39
|
+
e.send("message", i);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
e.onMessage("init", () => {
|
|
44
|
+
const i = !!this.messagesToSendSubscription;
|
|
45
|
+
s(), i || e.send("init", "init response");
|
|
46
|
+
}), e.onMessage("message", ({ type: i, payload: r }) => {
|
|
47
|
+
this.messagesFromDashboard.next({ type: i, payload: r });
|
|
48
|
+
}), e.send("init", "init message from client");
|
|
49
|
+
}
|
|
50
|
+
sendMessage(e, s) {
|
|
51
|
+
this.messagesToSend.next({ type: e, payload: s });
|
|
52
|
+
}
|
|
53
|
+
listenToMessages(e) {
|
|
54
|
+
return this.messagesFromDashboard.subscribe({
|
|
55
|
+
next: (s) => e(s.type, s.payload)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
t.instance = null;
|
|
60
|
+
let o = t;
|
|
61
|
+
const m = "@ledgerhq/device-management-kit-devtools-rozenite", b = m;
|
|
62
|
+
function p() {
|
|
63
|
+
const n = a({ pluginId: b }), [e, s] = c(null);
|
|
64
|
+
return l(() => {
|
|
65
|
+
if (n) {
|
|
66
|
+
const i = o.getInstance();
|
|
67
|
+
i.setClient(n), s(i);
|
|
68
|
+
}
|
|
69
|
+
}, [n]), e;
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
o as RozeniteConnector,
|
|
73
|
+
p as useRozeniteConnector
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@ledgerhq/device-management-kit-devtools-rozenite","version":"0.1.1","description":"Inspect and debug your integration of the Device Management Kit","panels":[{"name":"DMK DevTools","source":"/index.html"}]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RozeniteDashboard(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Connector } from '@ledgerhq/device-management-kit-devtools-core';
|
|
2
|
+
import { RozeniteDevToolsClient } from '@rozenite/plugin-bridge';
|
|
3
|
+
import { PluginEvents } from './PluginEvents';
|
|
4
|
+
export declare class RozeniteConnector implements Connector {
|
|
5
|
+
/**
|
|
6
|
+
* STATIC METHODS
|
|
7
|
+
*/
|
|
8
|
+
static instance: RozeniteConnector | null;
|
|
9
|
+
static getInstance(): RozeniteConnector;
|
|
10
|
+
static destroyInstance(): void;
|
|
11
|
+
/**
|
|
12
|
+
* INSTANCE METHODS
|
|
13
|
+
*/
|
|
14
|
+
private rozeniteClient;
|
|
15
|
+
private messagesToSend;
|
|
16
|
+
private messagesFromDashboard;
|
|
17
|
+
private messagesToSendSubscription;
|
|
18
|
+
private verbose;
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* VERBOSE LOGGING
|
|
22
|
+
*/
|
|
23
|
+
setVerbose(verbose: boolean): void;
|
|
24
|
+
private error;
|
|
25
|
+
setClient(rozeniteClient: RozeniteDevToolsClient<PluginEvents>): void;
|
|
26
|
+
private destroy;
|
|
27
|
+
private initialize;
|
|
28
|
+
sendMessage(type: string, payload: string): void;
|
|
29
|
+
listenToMessages(listener: (type: string, payload: string) => void): {
|
|
30
|
+
unsubscribe: () => void;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pluginId: string;
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@rozenite/plugin-bridge": "1.1.0",
|
|
4
|
+
"rxjs": "7.8.2",
|
|
5
|
+
"@ledgerhq/device-management-kit-devtools-ui": "^1.1.1"
|
|
6
|
+
},
|
|
7
|
+
"description": "Inspect and debug your integration of the Device Management Kit",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@rozenite/vite-plugin": "1.1.0",
|
|
10
|
+
"@types/react": "18.3.12",
|
|
11
|
+
"react": "18.3.1",
|
|
12
|
+
"react-dom": "18.3.1",
|
|
13
|
+
"react-native": "0.76.6",
|
|
14
|
+
"react-native-web": "0.21.0",
|
|
15
|
+
"rozenite": "1.1.0",
|
|
16
|
+
"typescript": "5.9.2",
|
|
17
|
+
"vite": "7.1.6",
|
|
18
|
+
"@ledgerhq/device-management-kit-devtools-core": "^1.1.1"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"./dist"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"main": "./dist/react-native.cjs",
|
|
25
|
+
"module": "./dist/react-native.js",
|
|
26
|
+
"name": "@ledgerhq/device-management-kit-devtools-rozenite",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "*",
|
|
29
|
+
"react-native": "*",
|
|
30
|
+
"@ledgerhq/device-management-kit-devtools-core": "^1.1.1"
|
|
31
|
+
},
|
|
32
|
+
"private": false,
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/LedgerHQ/device-sdk-ts.git"
|
|
36
|
+
},
|
|
37
|
+
"type": "module",
|
|
38
|
+
"types": "./dist/react-native.d.ts",
|
|
39
|
+
"version": "0.1.1",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rozenite build",
|
|
42
|
+
"dev": "rozenite dev"
|
|
43
|
+
}
|
|
44
|
+
}
|