@1sat/permission-module-ui 0.0.43 → 0.0.44
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PromptRequest, type VerificationServices } from '@1sat/permission-module';
|
|
2
2
|
export type Theme = 'light' | 'dark' | 'auto';
|
|
3
3
|
export interface OneSatPermissionPromptProps {
|
|
4
4
|
/** The structured request handed to the wallet's promptHandler. */
|
|
@@ -9,6 +9,13 @@ export interface OneSatPermissionPromptProps {
|
|
|
9
9
|
onReject: () => void;
|
|
10
10
|
/** Theme override. Defaults to 'auto' (matches `prefers-color-scheme`). */
|
|
11
11
|
theme?: Theme;
|
|
12
|
+
/**
|
|
13
|
+
* Lookup clients used to re-check a purchase card's claims against a live
|
|
14
|
+
* service. Supplied by the host that renders the prompt, because the request
|
|
15
|
+
* payload may have crossed a process boundary to get here and cannot carry
|
|
16
|
+
* anything but data. Omit to render the module's initial trust state only.
|
|
17
|
+
*/
|
|
18
|
+
services?: VerificationServices;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Drop-in component for rendering 1Sat permission prompts.
|
|
@@ -18,5 +25,5 @@ export interface OneSatPermissionPromptProps {
|
|
|
18
25
|
* Layout mirrors `docs/plans/mockups/p1sat-permissions.pen` — 1Sat coin
|
|
19
26
|
* badge, intent title, asset detail card, network/fee, approve/reject.
|
|
20
27
|
*/
|
|
21
|
-
export declare function OneSatPermissionPrompt({ request, onApprove, onReject, theme, }: OneSatPermissionPromptProps): import("react").JSX.Element;
|
|
28
|
+
export declare function OneSatPermissionPrompt({ request, onApprove, onReject, theme, services, }: OneSatPermissionPromptProps): import("react").JSX.Element;
|
|
22
29
|
//# sourceMappingURL=OneSatPermissionPrompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneSatPermissionPrompt.d.ts","sourceRoot":"","sources":["../src/OneSatPermissionPrompt.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"OneSatPermissionPrompt.d.ts","sourceRoot":"","sources":["../src/OneSatPermissionPrompt.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGN,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAEzB,MAAM,yBAAyB,CAAA;AAUhC,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,2BAA2B;IAC3C,mEAAmE;IACnE,OAAO,EAAE,aAAa,CAAA;IACtB,yFAAyF;IACzF,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,yFAAyF;IACzF,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAC/B;AAkED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,EACtC,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAc,EACd,QAAQ,GACR,EAAE,2BAA2B,+BAiM7B"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
// src/OneSatPermissionPrompt.tsx
|
|
4
|
+
import {
|
|
5
|
+
verifyIntent
|
|
6
|
+
} from "@1sat/permission-module";
|
|
7
|
+
|
|
3
8
|
// ../types/dist/constants.js
|
|
4
9
|
var ORDINALS_BASKET = "p 1sat ordinals";
|
|
5
10
|
var BSV21_BASKET = "p 1sat bsv21";
|
|
@@ -405,18 +410,21 @@ function OneSatPermissionPrompt({
|
|
|
405
410
|
request,
|
|
406
411
|
onApprove,
|
|
407
412
|
onReject,
|
|
408
|
-
theme = "auto"
|
|
413
|
+
theme = "auto",
|
|
414
|
+
services: services2
|
|
409
415
|
}) {
|
|
410
416
|
const resolvedTheme = useResolvedTheme(theme);
|
|
411
417
|
const base = summarizeRequest(request);
|
|
412
418
|
const [busy, setBusy] = useState(false);
|
|
413
419
|
const [verified, setVerified] = useState(undefined);
|
|
414
|
-
const
|
|
420
|
+
const intent = request.intent;
|
|
421
|
+
const trustState = intent?.trust?.state;
|
|
422
|
+
const p1satIntent = intent?.p1satIntent;
|
|
415
423
|
useEffect(() => {
|
|
416
|
-
if (!
|
|
424
|
+
if (!services2 || !trustState || !p1satIntent || !intent)
|
|
417
425
|
return;
|
|
418
426
|
let live = true;
|
|
419
|
-
|
|
427
|
+
verifyIntent(services2, p1satIntent, intent.inputs, intent.outputs, services2.ordfs?.getContentUrl).then((res) => {
|
|
420
428
|
if (live && res)
|
|
421
429
|
setVerified(res);
|
|
422
430
|
}).catch(() => {
|
|
@@ -425,7 +433,7 @@ function OneSatPermissionPrompt({
|
|
|
425
433
|
return () => {
|
|
426
434
|
live = false;
|
|
427
435
|
};
|
|
428
|
-
}, [
|
|
436
|
+
}, [services2, trustState, p1satIntent, intent]);
|
|
429
437
|
const summary = verified ? applyVerification(base, verified) : base;
|
|
430
438
|
const handle = (action) => () => {
|
|
431
439
|
if (busy)
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"name": "@1sat/permission-module-ui",
|
|
3
|
+
"version": "0.0.44",
|
|
4
|
+
"description": "React component for the 1Sat permission module's prompt UX",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "bun run build.ts && tsc --emitDeclarationOnly",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"clean": "rm -rf dist"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"1sat",
|
|
24
|
+
"bsv",
|
|
25
|
+
"wallet",
|
|
26
|
+
"permissions",
|
|
27
|
+
"react"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@1sat/permission-module": "0.0.49",
|
|
32
|
+
"@1sat/types": "0.0.39"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/react": "^19.0.0",
|
|
39
|
+
"react": "^19.0.0",
|
|
40
|
+
"typescript": "^5.9.3"
|
|
41
|
+
}
|
|
42
42
|
}
|