@solarpunkltd/swarm-id 0.8.2 → 0.10.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.
- package/README.md +17 -7
- package/dist/bus/account-bus.d.ts +12 -0
- package/dist/bus/messages.d.ts +12 -0
- package/dist/bus/signaling-transport.d.ts +2 -0
- package/dist/chunks/ccip-BEanftc1.js +2 -0
- package/dist/chunks/ccip-BEanftc1.js.map +1 -0
- package/dist/chunks/{chat-binding-DgECjSWW.js → chat-binding-gSvKTm5l.js} +15 -15
- package/dist/chunks/chat-binding-gSvKTm5l.js.map +1 -0
- package/dist/chunks/index-BbRV2bja.js +2 -0
- package/dist/chunks/index-BbRV2bja.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/internal.d.ts +3 -1
- package/dist/internal.esm.js +1 -1
- package/dist/internal.esm.js.map +1 -1
- package/dist/schemas.d.ts +59 -0
- package/dist/swarm-id-button-frame.d.ts +77 -0
- package/dist/swarm-id-client.d.ts +64 -69
- package/dist/swarm-id-proxy.d.ts +47 -55
- package/dist/swarm-id.esm.js +1 -1
- package/dist/swarm-id.esm.js.map +1 -1
- package/dist/sync/device-state.d.ts +16 -7
- package/dist/sync/index.d.ts +2 -1
- package/dist/sync/published-wallet-link.d.ts +27 -0
- package/dist/types.d.ts +374 -64
- package/dist/utils/button-view.d.ts +16 -0
- package/dist/utils/ens-name.d.ts +33 -0
- package/dist/utils/ens.d.ts +13 -0
- package/dist/utils/json-rpc.d.ts +5 -0
- package/dist/utils/personal-sign.d.ts +17 -0
- package/dist/utils/postage-stamp-association.d.ts +24 -25
- package/dist/utils/site-allow-list.d.ts +0 -4
- package/dist/utils/storage-probe.d.ts +20 -10
- package/dist/utils/wallet-link.d.ts +70 -0
- package/package.json +2 -1
- package/dist/chunks/chat-binding-DgECjSWW.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -537,10 +537,11 @@ export type UploadMode = z.infer<typeof UploadModeSchema>;
|
|
|
537
537
|
/**
|
|
538
538
|
* Why a session cannot upload, when `uploadMode` is `"unavailable"`.
|
|
539
539
|
*
|
|
540
|
-
* - `no-stamp`: the site has no stamp to use. The
|
|
541
|
-
*
|
|
542
|
-
* no drive, or
|
|
543
|
-
*
|
|
540
|
+
* - `no-stamp`: the site has no stamp to use. The person has not picked a
|
|
541
|
+
* drive for this site, the drive they picked is gone, they set this site to
|
|
542
|
+
* no drive, or they have not yet confirmed the site's drive in the connect
|
|
543
|
+
* window since the site signed in. The account's default drive never
|
|
544
|
+
* stands in for a missing pick.
|
|
544
545
|
* - `stamper-failed` — the stamp resolved and the stamper still did not build.
|
|
545
546
|
* `initializeStamper` logs and returns rather than throwing, so without this
|
|
546
547
|
* the symptom is indistinguishable from having no stamp at all.
|
|
@@ -610,6 +611,11 @@ export declare const ConnectionIdentitySchema: z.ZodObject<{
|
|
|
610
611
|
}>;
|
|
611
612
|
url: z.ZodString;
|
|
612
613
|
}, z.core.$strip>;
|
|
614
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
615
|
+
message: z.ZodString;
|
|
616
|
+
walletSignature: z.ZodString;
|
|
617
|
+
accountSignature: z.ZodString;
|
|
618
|
+
}, z.core.$strip>>;
|
|
613
619
|
}, z.core.$strip>;
|
|
614
620
|
export type ConnectionIdentity = z.infer<typeof ConnectionIdentitySchema>;
|
|
615
621
|
export declare const ConnectionInfoSchema: z.ZodObject<{
|
|
@@ -646,6 +652,11 @@ export declare const ConnectionInfoSchema: z.ZodObject<{
|
|
|
646
652
|
}>;
|
|
647
653
|
url: z.ZodString;
|
|
648
654
|
}, z.core.$strip>;
|
|
655
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
656
|
+
message: z.ZodString;
|
|
657
|
+
walletSignature: z.ZodString;
|
|
658
|
+
accountSignature: z.ZodString;
|
|
659
|
+
}, z.core.$strip>>;
|
|
649
660
|
}, z.core.$strip>>;
|
|
650
661
|
appKey: z.ZodOptional<z.ZodObject<{
|
|
651
662
|
address: z.ZodString;
|
|
@@ -665,52 +676,357 @@ export declare const AppMetadataSchema: z.ZodObject<{
|
|
|
665
676
|
icon: z.ZodOptional<z.ZodString>;
|
|
666
677
|
}, z.core.$strip>;
|
|
667
678
|
export type AppMetadata = z.infer<typeof AppMetadataSchema>;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
679
|
+
/**
|
|
680
|
+
* What a mounted Swarm ID button does. Both open the connect window: signed
|
|
681
|
+
* out it signs the person in, signed in it is where they change the stamp the
|
|
682
|
+
* site uses, which the window asks for on every connect.
|
|
683
|
+
*/
|
|
684
|
+
export declare const ButtonActionSchema: z.ZodEnum<{
|
|
685
|
+
"sign-in": "sign-in";
|
|
686
|
+
"change-stamp": "change-stamp";
|
|
687
|
+
}>;
|
|
688
|
+
export type ButtonAction = z.infer<typeof ButtonActionSchema>;
|
|
689
|
+
/**
|
|
690
|
+
* A font file's URL: https, or http on a loopback host for local work, with
|
|
691
|
+
* no user name or password in it. The button frame takes loopback http only
|
|
692
|
+
* in a development build.
|
|
693
|
+
*/
|
|
694
|
+
export declare function isButtonFontUrl(value: string): boolean;
|
|
695
|
+
export declare const ButtonFontFaceSchema: z.ZodObject<{
|
|
696
|
+
family: z.ZodString;
|
|
697
|
+
url: z.ZodString;
|
|
698
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
699
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
700
|
+
normal: "normal";
|
|
701
|
+
italic: "italic";
|
|
702
|
+
oblique: "oblique";
|
|
703
|
+
}>>;
|
|
704
|
+
}, z.core.$strip>;
|
|
705
|
+
/**
|
|
706
|
+
* A font file the button frame loads itself, so the label can use a family
|
|
707
|
+
* the site serves. It is fetched cross-origin from Swarm ID's frame, so the
|
|
708
|
+
* site serves it with an `Access-Control-Allow-Origin` that names Swarm ID's
|
|
709
|
+
* origin. Name `family` in `fontFamily` too, ahead of a fallback.
|
|
710
|
+
*/
|
|
711
|
+
export type ButtonFontFace = z.infer<typeof ButtonFontFaceSchema>;
|
|
712
|
+
export declare const ButtonConfigSchema: z.ZodObject<{
|
|
713
|
+
text: z.ZodOptional<z.ZodString>;
|
|
714
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
715
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
716
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
717
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
672
718
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
673
719
|
color: z.ZodOptional<z.ZodString>;
|
|
674
720
|
borderRadius: z.ZodOptional<z.ZodString>;
|
|
721
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
722
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
723
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
724
|
+
solid: "solid";
|
|
725
|
+
dashed: "dashed";
|
|
726
|
+
dotted: "dotted";
|
|
727
|
+
double: "double";
|
|
728
|
+
}>>;
|
|
675
729
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
676
730
|
fontSize: z.ZodOptional<z.ZodString>;
|
|
677
731
|
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
678
|
-
|
|
732
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
733
|
+
family: z.ZodString;
|
|
734
|
+
url: z.ZodString;
|
|
735
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
736
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
737
|
+
normal: "normal";
|
|
738
|
+
italic: "italic";
|
|
739
|
+
oblique: "oblique";
|
|
740
|
+
}>>;
|
|
741
|
+
}, z.core.$strip>>>;
|
|
742
|
+
}, z.core.$strip>;
|
|
743
|
+
/**
|
|
744
|
+
* How a mounted Swarm ID button looks and reads. It is painted inside Swarm
|
|
745
|
+
* ID's own frame, where the site's CSS cannot reach, so everything the site
|
|
746
|
+
* wants it to match is said here. The button fills the frame, which fills the
|
|
747
|
+
* site's container, and text that does not fit ends in an ellipsis.
|
|
748
|
+
*/
|
|
679
749
|
export interface ButtonConfig {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
750
|
+
/** The label. Default: "Sign in with Swarm ID", or "Change stamp in Swarm ID" */
|
|
751
|
+
text?: string;
|
|
752
|
+
/** The label while the connect window is open or `busy` is set. Default: "Waiting for Swarm ID" */
|
|
753
|
+
busyText?: string;
|
|
754
|
+
/** The accessible name, where the label alone does not say what the button does. Default: the label */
|
|
755
|
+
ariaLabel?: string;
|
|
756
|
+
/** Shown but not clickable */
|
|
757
|
+
disabled?: boolean;
|
|
758
|
+
/** Shown as working and not clickable, for a step of the site's own, such as signing out */
|
|
759
|
+
busy?: boolean;
|
|
760
|
+
/** CSS colour. Default: "#dd7200" */
|
|
683
761
|
backgroundColor?: string;
|
|
762
|
+
/** CSS colour of the label. Default: "white" */
|
|
684
763
|
color?: string;
|
|
764
|
+
/** CSS border-radius of the button and its frame. Default: "0" */
|
|
685
765
|
borderRadius?: string;
|
|
766
|
+
/**
|
|
767
|
+
* CSS colour of a border, for a secondary style. Naming this or
|
|
768
|
+
* `borderWidth` draws one, kept in the busy and disabled looks. Default: the
|
|
769
|
+
* label's colour
|
|
770
|
+
*/
|
|
771
|
+
borderColor?: string;
|
|
772
|
+
/** CSS width of the border. Default: "1px" once a border is drawn */
|
|
773
|
+
borderWidth?: string;
|
|
774
|
+
/** Default: "solid" */
|
|
775
|
+
borderStyle?: "solid" | "dashed" | "dotted" | "double";
|
|
776
|
+
/** CSS font-family. A stack falls back to the first family the frame has, not the page. Default: the frame's own */
|
|
686
777
|
fontFamily?: string;
|
|
778
|
+
/** CSS font-size. Default: "14px" */
|
|
687
779
|
fontSize?: string;
|
|
780
|
+
/** CSS font-weight, a keyword or a number. Default: "600" */
|
|
688
781
|
fontWeight?: string | number;
|
|
782
|
+
/**
|
|
783
|
+
* Font files the frame loads for the label, at most 8. A file that does not
|
|
784
|
+
* load leaves the label in the next family of `fontFamily`, and the frame
|
|
785
|
+
* says so once in the console
|
|
786
|
+
*/
|
|
787
|
+
fontFaces?: ButtonFontFace[];
|
|
689
788
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
789
|
+
/** Where a mounted button's connect window is. `blocked`: the browser refused to open it */
|
|
790
|
+
export declare const ButtonWindowStateSchema: z.ZodEnum<{
|
|
791
|
+
open: "open";
|
|
792
|
+
closed: "closed";
|
|
793
|
+
blocked: "blocked";
|
|
794
|
+
}>;
|
|
795
|
+
export type ButtonWindowState = z.infer<typeof ButtonWindowStateSchema>;
|
|
796
|
+
/** What `SwarmIdClient.mountButton` takes */
|
|
797
|
+
export interface MountButtonOptions {
|
|
798
|
+
action: ButtonAction;
|
|
799
|
+
config?: ButtonConfig;
|
|
800
|
+
/**
|
|
801
|
+
* Called when the button's connect window opens, closes or is blocked, for
|
|
802
|
+
* example to say that the browser blocked it.
|
|
803
|
+
*/
|
|
804
|
+
onWindowChange?: (state: ButtonWindowState) => void;
|
|
805
|
+
}
|
|
806
|
+
/** A mounted Swarm ID button */
|
|
807
|
+
export interface MountedButton {
|
|
808
|
+
/**
|
|
809
|
+
* Resolves once the button is shown. Rejects with `init-failed` when Swarm
|
|
810
|
+
* ID refuses the site or the frame does not answer in time.
|
|
811
|
+
*/
|
|
812
|
+
ready: Promise<void>;
|
|
813
|
+
/** Change what the button does or how it looks, in place. Does nothing once unmounted */
|
|
814
|
+
update(options: {
|
|
815
|
+
action?: ButtonAction;
|
|
816
|
+
config?: ButtonConfig;
|
|
817
|
+
}): void;
|
|
818
|
+
/** Remove the button. The session stays as it is, and `onWindowChange` is not called again */
|
|
819
|
+
unmount(): void;
|
|
820
|
+
}
|
|
821
|
+
export declare const ButtonIdentifyMessageSchema: z.ZodObject<{
|
|
822
|
+
type: z.ZodLiteral<"buttonIdentify">;
|
|
823
|
+
action: z.ZodEnum<{
|
|
824
|
+
"sign-in": "sign-in";
|
|
825
|
+
"change-stamp": "change-stamp";
|
|
826
|
+
}>;
|
|
827
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
828
|
+
text: z.ZodOptional<z.ZodString>;
|
|
829
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
830
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
831
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
832
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
833
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
834
|
+
color: z.ZodOptional<z.ZodString>;
|
|
835
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
836
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
837
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
838
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
839
|
+
solid: "solid";
|
|
840
|
+
dashed: "dashed";
|
|
841
|
+
dotted: "dotted";
|
|
842
|
+
double: "double";
|
|
843
|
+
}>>;
|
|
844
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
845
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
846
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
847
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
848
|
+
family: z.ZodString;
|
|
849
|
+
url: z.ZodString;
|
|
850
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
851
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
852
|
+
normal: "normal";
|
|
853
|
+
italic: "italic";
|
|
854
|
+
oblique: "oblique";
|
|
855
|
+
}>>;
|
|
856
|
+
}, z.core.$strip>>>;
|
|
857
|
+
}, z.core.$strip>>;
|
|
858
|
+
metadata: z.ZodObject<{
|
|
859
|
+
name: z.ZodString;
|
|
860
|
+
description: z.ZodOptional<z.ZodString>;
|
|
861
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
862
|
+
}, z.core.$strip>;
|
|
694
863
|
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
695
864
|
popup: "popup";
|
|
696
865
|
window: "window";
|
|
697
866
|
}>>;
|
|
867
|
+
}, z.core.$strip>;
|
|
868
|
+
export declare const ButtonUpdateMessageSchema: z.ZodObject<{
|
|
869
|
+
type: z.ZodLiteral<"buttonUpdate">;
|
|
870
|
+
action: z.ZodEnum<{
|
|
871
|
+
"sign-in": "sign-in";
|
|
872
|
+
"change-stamp": "change-stamp";
|
|
873
|
+
}>;
|
|
874
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
875
|
+
text: z.ZodOptional<z.ZodString>;
|
|
876
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
877
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
878
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
879
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
880
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
881
|
+
color: z.ZodOptional<z.ZodString>;
|
|
882
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
883
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
884
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
885
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
886
|
+
solid: "solid";
|
|
887
|
+
dashed: "dashed";
|
|
888
|
+
dotted: "dotted";
|
|
889
|
+
double: "double";
|
|
890
|
+
}>>;
|
|
891
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
892
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
893
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
894
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
895
|
+
family: z.ZodString;
|
|
896
|
+
url: z.ZodString;
|
|
897
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
898
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
899
|
+
normal: "normal";
|
|
900
|
+
italic: "italic";
|
|
901
|
+
oblique: "oblique";
|
|
902
|
+
}>>;
|
|
903
|
+
}, z.core.$strip>>>;
|
|
904
|
+
}, z.core.$strip>>;
|
|
905
|
+
}, z.core.$strip>;
|
|
906
|
+
export declare const ParentToButtonMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
907
|
+
type: z.ZodLiteral<"buttonIdentify">;
|
|
908
|
+
action: z.ZodEnum<{
|
|
909
|
+
"sign-in": "sign-in";
|
|
910
|
+
"change-stamp": "change-stamp";
|
|
911
|
+
}>;
|
|
912
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
913
|
+
text: z.ZodOptional<z.ZodString>;
|
|
914
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
915
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
916
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
917
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
918
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
919
|
+
color: z.ZodOptional<z.ZodString>;
|
|
920
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
921
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
922
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
923
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
924
|
+
solid: "solid";
|
|
925
|
+
dashed: "dashed";
|
|
926
|
+
dotted: "dotted";
|
|
927
|
+
double: "double";
|
|
928
|
+
}>>;
|
|
929
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
930
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
931
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
932
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
933
|
+
family: z.ZodString;
|
|
934
|
+
url: z.ZodString;
|
|
935
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
936
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
937
|
+
normal: "normal";
|
|
938
|
+
italic: "italic";
|
|
939
|
+
oblique: "oblique";
|
|
940
|
+
}>>;
|
|
941
|
+
}, z.core.$strip>>>;
|
|
942
|
+
}, z.core.$strip>>;
|
|
698
943
|
metadata: z.ZodObject<{
|
|
699
944
|
name: z.ZodString;
|
|
700
945
|
description: z.ZodOptional<z.ZodString>;
|
|
701
946
|
icon: z.ZodOptional<z.ZodString>;
|
|
702
947
|
}, z.core.$strip>;
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
948
|
+
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
949
|
+
popup: "popup";
|
|
950
|
+
window: "window";
|
|
951
|
+
}>>;
|
|
952
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
953
|
+
type: z.ZodLiteral<"buttonUpdate">;
|
|
954
|
+
action: z.ZodEnum<{
|
|
955
|
+
"sign-in": "sign-in";
|
|
956
|
+
"change-stamp": "change-stamp";
|
|
957
|
+
}>;
|
|
958
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
959
|
+
text: z.ZodOptional<z.ZodString>;
|
|
960
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
961
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
962
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
963
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
707
964
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
708
965
|
color: z.ZodOptional<z.ZodString>;
|
|
709
966
|
borderRadius: z.ZodOptional<z.ZodString>;
|
|
967
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
968
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
969
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
970
|
+
solid: "solid";
|
|
971
|
+
dashed: "dashed";
|
|
972
|
+
dotted: "dotted";
|
|
973
|
+
double: "double";
|
|
974
|
+
}>>;
|
|
710
975
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
711
976
|
fontSize: z.ZodOptional<z.ZodString>;
|
|
712
977
|
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
978
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
979
|
+
family: z.ZodString;
|
|
980
|
+
url: z.ZodString;
|
|
981
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
982
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
983
|
+
normal: "normal";
|
|
984
|
+
italic: "italic";
|
|
985
|
+
oblique: "oblique";
|
|
986
|
+
}>>;
|
|
987
|
+
}, z.core.$strip>>>;
|
|
713
988
|
}, z.core.$strip>>;
|
|
989
|
+
}, z.core.$strip>], "type">;
|
|
990
|
+
export type ParentToButtonMessage = z.infer<typeof ParentToButtonMessageSchema>;
|
|
991
|
+
export declare const ButtonToParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
992
|
+
type: z.ZodLiteral<"buttonReady">;
|
|
993
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
994
|
+
type: z.ZodLiteral<"buttonInitError">;
|
|
995
|
+
error: z.ZodString;
|
|
996
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
997
|
+
type: z.ZodLiteral<"buttonWindowChanged">;
|
|
998
|
+
state: z.ZodEnum<{
|
|
999
|
+
open: "open";
|
|
1000
|
+
closed: "closed";
|
|
1001
|
+
blocked: "blocked";
|
|
1002
|
+
}>;
|
|
1003
|
+
}, z.core.$strip>], "type">;
|
|
1004
|
+
export type ButtonToParentMessage = z.infer<typeof ButtonToParentMessageSchema>;
|
|
1005
|
+
/**
|
|
1006
|
+
* The button frame telling the session frames beside it that it opened a
|
|
1007
|
+
* connect window under this challenge, so the handover that comes back under
|
|
1008
|
+
* it is theirs to take.
|
|
1009
|
+
*/
|
|
1010
|
+
export declare const ConnectWindowOpenedMessageSchema: z.ZodObject<{
|
|
1011
|
+
type: z.ZodLiteral<"connectWindowOpened">;
|
|
1012
|
+
challenge: z.ZodString;
|
|
1013
|
+
}, z.core.$strip>;
|
|
1014
|
+
export type ConnectWindowOpenedMessage = z.infer<typeof ConnectWindowOpenedMessageSchema>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Sent by the button frame on a wildcard origin the moment it loads, before
|
|
1017
|
+
* the parent has identified itself, so outside the unions above, as
|
|
1018
|
+
* `proxyInitialized` is.
|
|
1019
|
+
*/
|
|
1020
|
+
export declare const BUTTON_FRAME_LOADED = "buttonFrameLoaded";
|
|
1021
|
+
export declare const ParentIdentifyMessageSchema: z.ZodObject<{
|
|
1022
|
+
type: z.ZodLiteral<"parentIdentify">;
|
|
1023
|
+
requestId: z.ZodString;
|
|
1024
|
+
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
1025
|
+
metadata: z.ZodObject<{
|
|
1026
|
+
name: z.ZodString;
|
|
1027
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1028
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1029
|
+
}, z.core.$strip>;
|
|
714
1030
|
subsidisedGatewayUrl: z.ZodOptional<z.ZodString>;
|
|
715
1031
|
}, z.core.$strip>;
|
|
716
1032
|
export declare const CheckAuthMessageSchema: z.ZodObject<{
|
|
@@ -1295,38 +1611,15 @@ export declare const GetPostageBatchMessageSchema: z.ZodObject<{
|
|
|
1295
1611
|
type: z.ZodLiteral<"getPostageBatch">;
|
|
1296
1612
|
requestId: z.ZodString;
|
|
1297
1613
|
}, z.core.$strip>;
|
|
1298
|
-
export declare const ConnectMessageSchema: z.ZodObject<{
|
|
1299
|
-
type: z.ZodLiteral<"connect">;
|
|
1300
|
-
requestId: z.ZodString;
|
|
1301
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1302
|
-
popup: "popup";
|
|
1303
|
-
window: "window";
|
|
1304
|
-
}>>;
|
|
1305
|
-
}, z.core.$strip>;
|
|
1306
1614
|
export declare const ParentToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1307
1615
|
type: z.ZodLiteral<"parentIdentify">;
|
|
1308
1616
|
requestId: z.ZodString;
|
|
1309
1617
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
1310
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1311
|
-
popup: "popup";
|
|
1312
|
-
window: "window";
|
|
1313
|
-
}>>;
|
|
1314
1618
|
metadata: z.ZodObject<{
|
|
1315
1619
|
name: z.ZodString;
|
|
1316
1620
|
description: z.ZodOptional<z.ZodString>;
|
|
1317
1621
|
icon: z.ZodOptional<z.ZodString>;
|
|
1318
1622
|
}, z.core.$strip>;
|
|
1319
|
-
buttonConfig: z.ZodOptional<z.ZodObject<{
|
|
1320
|
-
connectText: z.ZodOptional<z.ZodString>;
|
|
1321
|
-
disconnectText: z.ZodOptional<z.ZodString>;
|
|
1322
|
-
loadingText: z.ZodOptional<z.ZodString>;
|
|
1323
|
-
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1324
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1325
|
-
borderRadius: z.ZodOptional<z.ZodString>;
|
|
1326
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1327
|
-
fontSize: z.ZodOptional<z.ZodString>;
|
|
1328
|
-
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1329
|
-
}, z.core.$strip>>;
|
|
1330
1623
|
subsidisedGatewayUrl: z.ZodOptional<z.ZodString>;
|
|
1331
1624
|
}, z.core.$strip>, z.ZodObject<{
|
|
1332
1625
|
type: z.ZodLiteral<"checkAuth">;
|
|
@@ -1835,13 +2128,6 @@ export declare const ParentToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
1835
2128
|
}, z.core.$strip>, z.ZodObject<{
|
|
1836
2129
|
type: z.ZodLiteral<"getPostageBatch">;
|
|
1837
2130
|
requestId: z.ZodString;
|
|
1838
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1839
|
-
type: z.ZodLiteral<"connect">;
|
|
1840
|
-
requestId: z.ZodString;
|
|
1841
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1842
|
-
popup: "popup";
|
|
1843
|
-
window: "window";
|
|
1844
|
-
}>>;
|
|
1845
2131
|
}, z.core.$strip>], "type">;
|
|
1846
2132
|
export type ParentIdentifyMessage = z.infer<typeof ParentIdentifyMessageSchema>;
|
|
1847
2133
|
export type CheckAuthMessage = z.infer<typeof CheckAuthMessageSchema>;
|
|
@@ -1886,7 +2172,6 @@ export type ActAddGranteesMessage = z.infer<typeof ActAddGranteesMessageSchema>;
|
|
|
1886
2172
|
export type ActRevokeGranteesMessage = z.infer<typeof ActRevokeGranteesMessageSchema>;
|
|
1887
2173
|
export type ActGetGranteesMessage = z.infer<typeof ActGetGranteesMessageSchema>;
|
|
1888
2174
|
export type GetPostageBatchMessage = z.infer<typeof GetPostageBatchMessageSchema>;
|
|
1889
|
-
export type ConnectMessage = z.infer<typeof ConnectMessageSchema>;
|
|
1890
2175
|
export type ParentToIframeMessage = z.infer<typeof ParentToIframeMessageSchema>;
|
|
1891
2176
|
export declare const ProxyReadyMessageSchema: z.ZodObject<{
|
|
1892
2177
|
type: z.ZodLiteral<"proxyReady">;
|
|
@@ -2030,6 +2315,7 @@ export declare const SwarmIdErrorCodeSchema: z.ZodEnum<{
|
|
|
2030
2315
|
"invalid-state": "invalid-state";
|
|
2031
2316
|
"init-failed": "init-failed";
|
|
2032
2317
|
"popup-blocked": "popup-blocked";
|
|
2318
|
+
"button-required": "button-required";
|
|
2033
2319
|
internal: "internal";
|
|
2034
2320
|
}>;
|
|
2035
2321
|
export type SwarmIdErrorCode = z.infer<typeof SwarmIdErrorCodeSchema>;
|
|
@@ -2048,6 +2334,7 @@ export declare const WireErrorSchema: z.ZodObject<{
|
|
|
2048
2334
|
"invalid-state": "invalid-state";
|
|
2049
2335
|
"init-failed": "init-failed";
|
|
2050
2336
|
"popup-blocked": "popup-blocked";
|
|
2337
|
+
"button-required": "button-required";
|
|
2051
2338
|
internal: "internal";
|
|
2052
2339
|
}>>;
|
|
2053
2340
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2081,6 +2368,7 @@ export declare const ErrorMessageSchema: z.ZodObject<{
|
|
|
2081
2368
|
"invalid-state": "invalid-state";
|
|
2082
2369
|
"init-failed": "init-failed";
|
|
2083
2370
|
"popup-blocked": "popup-blocked";
|
|
2371
|
+
"button-required": "button-required";
|
|
2084
2372
|
internal: "internal";
|
|
2085
2373
|
}>>;
|
|
2086
2374
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2135,6 +2423,11 @@ export declare const ConnectionInfoChangedMessageSchema: z.ZodObject<{
|
|
|
2135
2423
|
}>;
|
|
2136
2424
|
url: z.ZodString;
|
|
2137
2425
|
}, z.core.$strip>;
|
|
2426
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
2427
|
+
message: z.ZodString;
|
|
2428
|
+
walletSignature: z.ZodString;
|
|
2429
|
+
accountSignature: z.ZodString;
|
|
2430
|
+
}, z.core.$strip>>;
|
|
2138
2431
|
}, z.core.$strip>>;
|
|
2139
2432
|
appKey: z.ZodOptional<z.ZodObject<{
|
|
2140
2433
|
address: z.ZodString;
|
|
@@ -2148,11 +2441,6 @@ export declare const ConnectionInfoChangedMessageSchema: z.ZodObject<{
|
|
|
2148
2441
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
2149
2442
|
postageBatchId: z.ZodOptional<z.ZodString>;
|
|
2150
2443
|
}, z.core.$strip>;
|
|
2151
|
-
export declare const ConnectResponseMessageSchema: z.ZodObject<{
|
|
2152
|
-
type: z.ZodLiteral<"connectResponse">;
|
|
2153
|
-
requestId: z.ZodString;
|
|
2154
|
-
success: z.ZodBoolean;
|
|
2155
|
-
}, z.core.$strip>;
|
|
2156
2444
|
export declare const IsConnectedResponseMessageSchema: z.ZodObject<{
|
|
2157
2445
|
type: z.ZodLiteral<"isConnectedResponse">;
|
|
2158
2446
|
requestId: z.ZodString;
|
|
@@ -2451,6 +2739,7 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
2451
2739
|
"invalid-state": "invalid-state";
|
|
2452
2740
|
"init-failed": "init-failed";
|
|
2453
2741
|
"popup-blocked": "popup-blocked";
|
|
2742
|
+
"button-required": "button-required";
|
|
2454
2743
|
internal: "internal";
|
|
2455
2744
|
}>>;
|
|
2456
2745
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2504,6 +2793,11 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
2504
2793
|
}>;
|
|
2505
2794
|
url: z.ZodString;
|
|
2506
2795
|
}, z.core.$strip>;
|
|
2796
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
2797
|
+
message: z.ZodString;
|
|
2798
|
+
walletSignature: z.ZodString;
|
|
2799
|
+
accountSignature: z.ZodString;
|
|
2800
|
+
}, z.core.$strip>>;
|
|
2507
2801
|
}, z.core.$strip>>;
|
|
2508
2802
|
appKey: z.ZodOptional<z.ZodObject<{
|
|
2509
2803
|
address: z.ZodString;
|
|
@@ -2516,10 +2810,6 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
2516
2810
|
}, z.core.$strip>>;
|
|
2517
2811
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
2518
2812
|
postageBatchId: z.ZodOptional<z.ZodString>;
|
|
2519
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
2520
|
-
type: z.ZodLiteral<"connectResponse">;
|
|
2521
|
-
requestId: z.ZodString;
|
|
2522
|
-
success: z.ZodBoolean;
|
|
2523
2813
|
}, z.core.$strip>, z.ZodObject<{
|
|
2524
2814
|
type: z.ZodLiteral<"isConnectedResponse">;
|
|
2525
2815
|
requestId: z.ZodString;
|
|
@@ -2714,7 +3004,6 @@ export type DownloadChunkResponseMessage = z.infer<typeof DownloadChunkResponseM
|
|
|
2714
3004
|
export type UploadProgressMessage = z.infer<typeof UploadProgressMessageSchema>;
|
|
2715
3005
|
export type ErrorMessage = z.infer<typeof ErrorMessageSchema>;
|
|
2716
3006
|
export type ConnectionInfoChangedMessage = z.infer<typeof ConnectionInfoChangedMessageSchema>;
|
|
2717
|
-
export type ConnectResponseMessage = z.infer<typeof ConnectResponseMessageSchema>;
|
|
2718
3007
|
export type IsConnectedResponseMessage = z.infer<typeof IsConnectedResponseMessageSchema>;
|
|
2719
3008
|
export type GetNodeInfoResponseMessage = z.infer<typeof GetNodeInfoResponseMessageSchema>;
|
|
2720
3009
|
export type GsocMineResponseMessage = z.infer<typeof GsocMineResponseMessageSchema>;
|
|
@@ -2802,9 +3091,15 @@ export declare const AuthDataSchema: z.ZodObject<{
|
|
|
2802
3091
|
settings: z.ZodOptional<z.ZodObject<{
|
|
2803
3092
|
appSessionDuration: z.ZodOptional<z.ZodNumber>;
|
|
2804
3093
|
}, z.core.$strip>>;
|
|
3094
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
3095
|
+
message: z.ZodString;
|
|
3096
|
+
walletSignature: z.ZodString;
|
|
3097
|
+
accountSignature: z.ZodString;
|
|
3098
|
+
}, z.core.$strip>>;
|
|
2805
3099
|
accountNameAt: z.ZodOptional<z.ZodNumber>;
|
|
2806
3100
|
defaultStampAt: z.ZodOptional<z.ZodNumber>;
|
|
2807
3101
|
settingsAt: z.ZodOptional<z.ZodNumber>;
|
|
3102
|
+
walletLinkAt: z.ZodOptional<z.ZodNumber>;
|
|
2808
3103
|
lastModified: z.ZodOptional<z.ZodNumber>;
|
|
2809
3104
|
partitionCount: z.ZodOptional<z.ZodNumber>;
|
|
2810
3105
|
}, z.core.$strip>;
|
|
@@ -2917,9 +3212,15 @@ export declare const SetSecretMessageSchema: z.ZodObject<{
|
|
|
2917
3212
|
settings: z.ZodOptional<z.ZodObject<{
|
|
2918
3213
|
appSessionDuration: z.ZodOptional<z.ZodNumber>;
|
|
2919
3214
|
}, z.core.$strip>>;
|
|
3215
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
3216
|
+
message: z.ZodString;
|
|
3217
|
+
walletSignature: z.ZodString;
|
|
3218
|
+
accountSignature: z.ZodString;
|
|
3219
|
+
}, z.core.$strip>>;
|
|
2920
3220
|
accountNameAt: z.ZodOptional<z.ZodNumber>;
|
|
2921
3221
|
defaultStampAt: z.ZodOptional<z.ZodNumber>;
|
|
2922
3222
|
settingsAt: z.ZodOptional<z.ZodNumber>;
|
|
3223
|
+
walletLinkAt: z.ZodOptional<z.ZodNumber>;
|
|
2923
3224
|
lastModified: z.ZodOptional<z.ZodNumber>;
|
|
2924
3225
|
partitionCount: z.ZodOptional<z.ZodNumber>;
|
|
2925
3226
|
}, z.core.$strip>;
|
|
@@ -2930,6 +3231,11 @@ export declare const SetSecretMessageSchema: z.ZodObject<{
|
|
|
2930
3231
|
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2931
3232
|
}, z.core.$strip>;
|
|
2932
3233
|
}, z.core.$strip>;
|
|
3234
|
+
/**
|
|
3235
|
+
* What the connect popup posts to the session frame. The popup was opened by
|
|
3236
|
+
* the button frame, and posts to the Swarm ID frames beside its opener
|
|
3237
|
+
* (`ui/src/lib/handover-targets.ts`).
|
|
3238
|
+
*/
|
|
2933
3239
|
export declare const PopupToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2934
3240
|
type: z.ZodLiteral<"setSecret">;
|
|
2935
3241
|
appOrigin: z.ZodString;
|
|
@@ -2994,9 +3300,15 @@ export declare const PopupToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
2994
3300
|
settings: z.ZodOptional<z.ZodObject<{
|
|
2995
3301
|
appSessionDuration: z.ZodOptional<z.ZodNumber>;
|
|
2996
3302
|
}, z.core.$strip>>;
|
|
3303
|
+
walletLink: z.ZodOptional<z.ZodObject<{
|
|
3304
|
+
message: z.ZodString;
|
|
3305
|
+
walletSignature: z.ZodString;
|
|
3306
|
+
accountSignature: z.ZodString;
|
|
3307
|
+
}, z.core.$strip>>;
|
|
2997
3308
|
accountNameAt: z.ZodOptional<z.ZodNumber>;
|
|
2998
3309
|
defaultStampAt: z.ZodOptional<z.ZodNumber>;
|
|
2999
3310
|
settingsAt: z.ZodOptional<z.ZodNumber>;
|
|
3311
|
+
walletLinkAt: z.ZodOptional<z.ZodNumber>;
|
|
3000
3312
|
lastModified: z.ZodOptional<z.ZodNumber>;
|
|
3001
3313
|
partitionCount: z.ZodOptional<z.ZodNumber>;
|
|
3002
3314
|
}, z.core.$strip>;
|
|
@@ -3016,7 +3328,7 @@ export interface ClientOptions {
|
|
|
3016
3328
|
initializationTimeout?: number;
|
|
3017
3329
|
/**
|
|
3018
3330
|
* Invoked whenever the dApp-visible ConnectionInfo changes (identity rename,
|
|
3019
|
-
*
|
|
3331
|
+
* the site's drive changed, local↔synced account migration, postage stamp added,
|
|
3020
3332
|
* auth transitions, etc.). Fires once on initial auth check, then on every
|
|
3021
3333
|
* effective change. The current snapshot is also available synchronously
|
|
3022
3334
|
* via `client.connectionInfo`.
|
|
@@ -3024,8 +3336,6 @@ export interface ClientOptions {
|
|
|
3024
3336
|
onConnectionChange?: (info: ConnectionInfo) => void;
|
|
3025
3337
|
popupMode?: "popup" | "window";
|
|
3026
3338
|
metadata: AppMetadata;
|
|
3027
|
-
buttonConfig?: ButtonConfig;
|
|
3028
|
-
containerId?: string;
|
|
3029
3339
|
/** URL of a subsidised gateway for users without postage stamps. Gateway handles stamping server-side. */
|
|
3030
3340
|
subsidisedGatewayUrl?: string;
|
|
3031
3341
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonAction, ButtonConfig } from "../types";
|
|
2
|
+
/** What the button frame paints, worked out from what the site asked for */
|
|
3
|
+
export interface ButtonView {
|
|
4
|
+
text: string;
|
|
5
|
+
/** Set only when the site gave one, so the label is the name otherwise */
|
|
6
|
+
ariaLabel: string | undefined;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
busy: boolean;
|
|
9
|
+
style: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The button for `action` as `config` asks, busy while its connect window is
|
|
13
|
+
* open or the site says so. A busy button stays focusable and ignores clicks,
|
|
14
|
+
* a disabled one is out of the tab order.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buttonView(action: ButtonAction, config: ButtonConfig, windowOpen: boolean): ButtonView;
|