@solarpunkltd/swarm-id 0.8.1 → 0.9.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/messages.d.ts +2 -2
- package/dist/chunks/{chat-binding-DO5aGhPl.js → chat-binding-BirKsDU3.js} +9 -9
- package/dist/chunks/{chat-binding-DO5aGhPl.js.map → chat-binding-BirKsDU3.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/internal.d.ts +3 -2
- package/dist/internal.esm.js +1 -1
- package/dist/internal.esm.js.map +1 -1
- package/dist/schemas.d.ts +12 -5
- 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 +36 -47
- package/dist/swarm-id.esm.js +1 -1
- package/dist/swarm-id.esm.js.map +1 -1
- package/dist/sync/device-state.d.ts +2 -1
- package/dist/types.d.ts +346 -64
- package/dist/utils/button-view.d.ts +16 -0
- package/dist/utils/postage-stamp-association.d.ts +4 -3
- package/dist/utils/storage-probe.d.ts +20 -10
- package/package.json +24 -23
|
@@ -43,8 +43,9 @@ export declare const DeviceStateSnapshotSchemaV1: z.ZodObject<{
|
|
|
43
43
|
appDescription: z.ZodOptional<z.ZodString>;
|
|
44
44
|
connectedUntil: z.ZodOptional<z.ZodNumber>;
|
|
45
45
|
appSecret: z.ZodOptional<z.ZodString>;
|
|
46
|
-
postageStampBatchID: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<BatchId, string
|
|
46
|
+
postageStampBatchID: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodPipe<z.ZodString, z.ZodTransform<BatchId, string>>]>>;
|
|
47
47
|
postageStampBatchIDAt: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
48
49
|
revokedAt: z.ZodOptional<z.ZodNumber>;
|
|
49
50
|
disconnectedAt: z.ZodOptional<z.ZodNumber>;
|
|
50
51
|
chatBinding: z.ZodOptional<z.ZodObject<{
|
package/dist/types.d.ts
CHANGED
|
@@ -537,8 +537,10 @@ 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
|
|
541
|
-
* name
|
|
540
|
+
* - `no-stamp`: the site has no stamp to use. The account has no drive (or
|
|
541
|
+
* its pointers name only drives that are gone), the person set this site to
|
|
542
|
+
* no drive, or the person has not yet confirmed the site's drive in the
|
|
543
|
+
* connect window since the site signed in.
|
|
542
544
|
* - `stamper-failed` — the stamp resolved and the stamper still did not build.
|
|
543
545
|
* `initializeStamper` logs and returns rather than throwing, so without this
|
|
544
546
|
* the symptom is indistinguishable from having no stamp at all.
|
|
@@ -654,6 +656,7 @@ export declare const ConnectionInfoSchema: z.ZodObject<{
|
|
|
654
656
|
signature: z.ZodString;
|
|
655
657
|
}, z.core.$strip>>;
|
|
656
658
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
659
|
+
postageBatchId: z.ZodOptional<z.ZodString>;
|
|
657
660
|
}, z.core.$strip>;
|
|
658
661
|
export type ConnectionInfo = z.infer<typeof ConnectionInfoSchema>;
|
|
659
662
|
export declare const AppMetadataSchema: z.ZodObject<{
|
|
@@ -662,52 +665,357 @@ export declare const AppMetadataSchema: z.ZodObject<{
|
|
|
662
665
|
icon: z.ZodOptional<z.ZodString>;
|
|
663
666
|
}, z.core.$strip>;
|
|
664
667
|
export type AppMetadata = z.infer<typeof AppMetadataSchema>;
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
668
|
+
/**
|
|
669
|
+
* What a mounted Swarm ID button does. Both open the connect window: signed
|
|
670
|
+
* out it signs the person in, signed in it is where they change the stamp the
|
|
671
|
+
* site uses, which the window asks for on every connect.
|
|
672
|
+
*/
|
|
673
|
+
export declare const ButtonActionSchema: z.ZodEnum<{
|
|
674
|
+
"sign-in": "sign-in";
|
|
675
|
+
"change-stamp": "change-stamp";
|
|
676
|
+
}>;
|
|
677
|
+
export type ButtonAction = z.infer<typeof ButtonActionSchema>;
|
|
678
|
+
/**
|
|
679
|
+
* A font file's URL: https, or http on a loopback host for local work, with
|
|
680
|
+
* no user name or password in it. The button frame takes loopback http only
|
|
681
|
+
* in a development build.
|
|
682
|
+
*/
|
|
683
|
+
export declare function isButtonFontUrl(value: string): boolean;
|
|
684
|
+
export declare const ButtonFontFaceSchema: z.ZodObject<{
|
|
685
|
+
family: z.ZodString;
|
|
686
|
+
url: z.ZodString;
|
|
687
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
688
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
689
|
+
normal: "normal";
|
|
690
|
+
italic: "italic";
|
|
691
|
+
oblique: "oblique";
|
|
692
|
+
}>>;
|
|
693
|
+
}, z.core.$strip>;
|
|
694
|
+
/**
|
|
695
|
+
* A font file the button frame loads itself, so the label can use a family
|
|
696
|
+
* the site serves. It is fetched cross-origin from Swarm ID's frame, so the
|
|
697
|
+
* site serves it with an `Access-Control-Allow-Origin` that names Swarm ID's
|
|
698
|
+
* origin. Name `family` in `fontFamily` too, ahead of a fallback.
|
|
699
|
+
*/
|
|
700
|
+
export type ButtonFontFace = z.infer<typeof ButtonFontFaceSchema>;
|
|
701
|
+
export declare const ButtonConfigSchema: z.ZodObject<{
|
|
702
|
+
text: z.ZodOptional<z.ZodString>;
|
|
703
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
704
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
705
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
706
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
669
707
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
670
708
|
color: z.ZodOptional<z.ZodString>;
|
|
671
709
|
borderRadius: z.ZodOptional<z.ZodString>;
|
|
710
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
711
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
712
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
713
|
+
solid: "solid";
|
|
714
|
+
dashed: "dashed";
|
|
715
|
+
dotted: "dotted";
|
|
716
|
+
double: "double";
|
|
717
|
+
}>>;
|
|
672
718
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
673
719
|
fontSize: z.ZodOptional<z.ZodString>;
|
|
674
720
|
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
675
|
-
|
|
721
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
722
|
+
family: z.ZodString;
|
|
723
|
+
url: z.ZodString;
|
|
724
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
725
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
726
|
+
normal: "normal";
|
|
727
|
+
italic: "italic";
|
|
728
|
+
oblique: "oblique";
|
|
729
|
+
}>>;
|
|
730
|
+
}, z.core.$strip>>>;
|
|
731
|
+
}, z.core.$strip>;
|
|
732
|
+
/**
|
|
733
|
+
* How a mounted Swarm ID button looks and reads. It is painted inside Swarm
|
|
734
|
+
* ID's own frame, where the site's CSS cannot reach, so everything the site
|
|
735
|
+
* wants it to match is said here. The button fills the frame, which fills the
|
|
736
|
+
* site's container, and text that does not fit ends in an ellipsis.
|
|
737
|
+
*/
|
|
676
738
|
export interface ButtonConfig {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
739
|
+
/** The label. Default: "Sign in with Swarm ID", or "Change stamp in Swarm ID" */
|
|
740
|
+
text?: string;
|
|
741
|
+
/** The label while the connect window is open or `busy` is set. Default: "Waiting for Swarm ID" */
|
|
742
|
+
busyText?: string;
|
|
743
|
+
/** The accessible name, where the label alone does not say what the button does. Default: the label */
|
|
744
|
+
ariaLabel?: string;
|
|
745
|
+
/** Shown but not clickable */
|
|
746
|
+
disabled?: boolean;
|
|
747
|
+
/** Shown as working and not clickable, for a step of the site's own, such as signing out */
|
|
748
|
+
busy?: boolean;
|
|
749
|
+
/** CSS colour. Default: "#dd7200" */
|
|
680
750
|
backgroundColor?: string;
|
|
751
|
+
/** CSS colour of the label. Default: "white" */
|
|
681
752
|
color?: string;
|
|
753
|
+
/** CSS border-radius of the button and its frame. Default: "0" */
|
|
682
754
|
borderRadius?: string;
|
|
755
|
+
/**
|
|
756
|
+
* CSS colour of a border, for a secondary style. Naming this or
|
|
757
|
+
* `borderWidth` draws one, kept in the busy and disabled looks. Default: the
|
|
758
|
+
* label's colour
|
|
759
|
+
*/
|
|
760
|
+
borderColor?: string;
|
|
761
|
+
/** CSS width of the border. Default: "1px" once a border is drawn */
|
|
762
|
+
borderWidth?: string;
|
|
763
|
+
/** Default: "solid" */
|
|
764
|
+
borderStyle?: "solid" | "dashed" | "dotted" | "double";
|
|
765
|
+
/** CSS font-family. A stack falls back to the first family the frame has, not the page. Default: the frame's own */
|
|
683
766
|
fontFamily?: string;
|
|
767
|
+
/** CSS font-size. Default: "14px" */
|
|
684
768
|
fontSize?: string;
|
|
769
|
+
/** CSS font-weight, a keyword or a number. Default: "600" */
|
|
685
770
|
fontWeight?: string | number;
|
|
771
|
+
/**
|
|
772
|
+
* Font files the frame loads for the label, at most 8. A file that does not
|
|
773
|
+
* load leaves the label in the next family of `fontFamily`, and the frame
|
|
774
|
+
* says so once in the console
|
|
775
|
+
*/
|
|
776
|
+
fontFaces?: ButtonFontFace[];
|
|
686
777
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
778
|
+
/** Where a mounted button's connect window is. `blocked`: the browser refused to open it */
|
|
779
|
+
export declare const ButtonWindowStateSchema: z.ZodEnum<{
|
|
780
|
+
open: "open";
|
|
781
|
+
closed: "closed";
|
|
782
|
+
blocked: "blocked";
|
|
783
|
+
}>;
|
|
784
|
+
export type ButtonWindowState = z.infer<typeof ButtonWindowStateSchema>;
|
|
785
|
+
/** What `SwarmIdClient.mountButton` takes */
|
|
786
|
+
export interface MountButtonOptions {
|
|
787
|
+
action: ButtonAction;
|
|
788
|
+
config?: ButtonConfig;
|
|
789
|
+
/**
|
|
790
|
+
* Called when the button's connect window opens, closes or is blocked, for
|
|
791
|
+
* example to say that the browser blocked it.
|
|
792
|
+
*/
|
|
793
|
+
onWindowChange?: (state: ButtonWindowState) => void;
|
|
794
|
+
}
|
|
795
|
+
/** A mounted Swarm ID button */
|
|
796
|
+
export interface MountedButton {
|
|
797
|
+
/**
|
|
798
|
+
* Resolves once the button is shown. Rejects with `init-failed` when Swarm
|
|
799
|
+
* ID refuses the site or the frame does not answer in time.
|
|
800
|
+
*/
|
|
801
|
+
ready: Promise<void>;
|
|
802
|
+
/** Change what the button does or how it looks, in place. Does nothing once unmounted */
|
|
803
|
+
update(options: {
|
|
804
|
+
action?: ButtonAction;
|
|
805
|
+
config?: ButtonConfig;
|
|
806
|
+
}): void;
|
|
807
|
+
/** Remove the button. The session stays as it is, and `onWindowChange` is not called again */
|
|
808
|
+
unmount(): void;
|
|
809
|
+
}
|
|
810
|
+
export declare const ButtonIdentifyMessageSchema: z.ZodObject<{
|
|
811
|
+
type: z.ZodLiteral<"buttonIdentify">;
|
|
812
|
+
action: z.ZodEnum<{
|
|
813
|
+
"sign-in": "sign-in";
|
|
814
|
+
"change-stamp": "change-stamp";
|
|
815
|
+
}>;
|
|
816
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
817
|
+
text: z.ZodOptional<z.ZodString>;
|
|
818
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
819
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
820
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
821
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
822
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
823
|
+
color: z.ZodOptional<z.ZodString>;
|
|
824
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
825
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
826
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
827
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
828
|
+
solid: "solid";
|
|
829
|
+
dashed: "dashed";
|
|
830
|
+
dotted: "dotted";
|
|
831
|
+
double: "double";
|
|
832
|
+
}>>;
|
|
833
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
834
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
835
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
836
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
837
|
+
family: z.ZodString;
|
|
838
|
+
url: z.ZodString;
|
|
839
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
840
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
841
|
+
normal: "normal";
|
|
842
|
+
italic: "italic";
|
|
843
|
+
oblique: "oblique";
|
|
844
|
+
}>>;
|
|
845
|
+
}, z.core.$strip>>>;
|
|
846
|
+
}, z.core.$strip>>;
|
|
847
|
+
metadata: z.ZodObject<{
|
|
848
|
+
name: z.ZodString;
|
|
849
|
+
description: z.ZodOptional<z.ZodString>;
|
|
850
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
851
|
+
}, z.core.$strip>;
|
|
691
852
|
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
692
853
|
popup: "popup";
|
|
693
854
|
window: "window";
|
|
694
855
|
}>>;
|
|
856
|
+
}, z.core.$strip>;
|
|
857
|
+
export declare const ButtonUpdateMessageSchema: z.ZodObject<{
|
|
858
|
+
type: z.ZodLiteral<"buttonUpdate">;
|
|
859
|
+
action: z.ZodEnum<{
|
|
860
|
+
"sign-in": "sign-in";
|
|
861
|
+
"change-stamp": "change-stamp";
|
|
862
|
+
}>;
|
|
863
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
864
|
+
text: z.ZodOptional<z.ZodString>;
|
|
865
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
866
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
867
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
868
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
869
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
870
|
+
color: z.ZodOptional<z.ZodString>;
|
|
871
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
872
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
873
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
874
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
875
|
+
solid: "solid";
|
|
876
|
+
dashed: "dashed";
|
|
877
|
+
dotted: "dotted";
|
|
878
|
+
double: "double";
|
|
879
|
+
}>>;
|
|
880
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
881
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
882
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
883
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
884
|
+
family: z.ZodString;
|
|
885
|
+
url: z.ZodString;
|
|
886
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
887
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
888
|
+
normal: "normal";
|
|
889
|
+
italic: "italic";
|
|
890
|
+
oblique: "oblique";
|
|
891
|
+
}>>;
|
|
892
|
+
}, z.core.$strip>>>;
|
|
893
|
+
}, z.core.$strip>>;
|
|
894
|
+
}, z.core.$strip>;
|
|
895
|
+
export declare const ParentToButtonMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
896
|
+
type: z.ZodLiteral<"buttonIdentify">;
|
|
897
|
+
action: z.ZodEnum<{
|
|
898
|
+
"sign-in": "sign-in";
|
|
899
|
+
"change-stamp": "change-stamp";
|
|
900
|
+
}>;
|
|
901
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
902
|
+
text: z.ZodOptional<z.ZodString>;
|
|
903
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
904
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
905
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
906
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
907
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
908
|
+
color: z.ZodOptional<z.ZodString>;
|
|
909
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
910
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
911
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
912
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
913
|
+
solid: "solid";
|
|
914
|
+
dashed: "dashed";
|
|
915
|
+
dotted: "dotted";
|
|
916
|
+
double: "double";
|
|
917
|
+
}>>;
|
|
918
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
919
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
920
|
+
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
921
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
922
|
+
family: z.ZodString;
|
|
923
|
+
url: z.ZodString;
|
|
924
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
925
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
926
|
+
normal: "normal";
|
|
927
|
+
italic: "italic";
|
|
928
|
+
oblique: "oblique";
|
|
929
|
+
}>>;
|
|
930
|
+
}, z.core.$strip>>>;
|
|
931
|
+
}, z.core.$strip>>;
|
|
695
932
|
metadata: z.ZodObject<{
|
|
696
933
|
name: z.ZodString;
|
|
697
934
|
description: z.ZodOptional<z.ZodString>;
|
|
698
935
|
icon: z.ZodOptional<z.ZodString>;
|
|
699
936
|
}, z.core.$strip>;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
937
|
+
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
938
|
+
popup: "popup";
|
|
939
|
+
window: "window";
|
|
940
|
+
}>>;
|
|
941
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
942
|
+
type: z.ZodLiteral<"buttonUpdate">;
|
|
943
|
+
action: z.ZodEnum<{
|
|
944
|
+
"sign-in": "sign-in";
|
|
945
|
+
"change-stamp": "change-stamp";
|
|
946
|
+
}>;
|
|
947
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
948
|
+
text: z.ZodOptional<z.ZodString>;
|
|
949
|
+
busyText: z.ZodOptional<z.ZodString>;
|
|
950
|
+
ariaLabel: z.ZodOptional<z.ZodString>;
|
|
951
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
952
|
+
busy: z.ZodOptional<z.ZodBoolean>;
|
|
704
953
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
705
954
|
color: z.ZodOptional<z.ZodString>;
|
|
706
955
|
borderRadius: z.ZodOptional<z.ZodString>;
|
|
956
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
957
|
+
borderWidth: z.ZodOptional<z.ZodString>;
|
|
958
|
+
borderStyle: z.ZodOptional<z.ZodEnum<{
|
|
959
|
+
solid: "solid";
|
|
960
|
+
dashed: "dashed";
|
|
961
|
+
dotted: "dotted";
|
|
962
|
+
double: "double";
|
|
963
|
+
}>>;
|
|
707
964
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
708
965
|
fontSize: z.ZodOptional<z.ZodString>;
|
|
709
966
|
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
967
|
+
fontFaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
968
|
+
family: z.ZodString;
|
|
969
|
+
url: z.ZodString;
|
|
970
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
971
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
972
|
+
normal: "normal";
|
|
973
|
+
italic: "italic";
|
|
974
|
+
oblique: "oblique";
|
|
975
|
+
}>>;
|
|
976
|
+
}, z.core.$strip>>>;
|
|
710
977
|
}, z.core.$strip>>;
|
|
978
|
+
}, z.core.$strip>], "type">;
|
|
979
|
+
export type ParentToButtonMessage = z.infer<typeof ParentToButtonMessageSchema>;
|
|
980
|
+
export declare const ButtonToParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
981
|
+
type: z.ZodLiteral<"buttonReady">;
|
|
982
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
983
|
+
type: z.ZodLiteral<"buttonInitError">;
|
|
984
|
+
error: z.ZodString;
|
|
985
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
986
|
+
type: z.ZodLiteral<"buttonWindowChanged">;
|
|
987
|
+
state: z.ZodEnum<{
|
|
988
|
+
open: "open";
|
|
989
|
+
closed: "closed";
|
|
990
|
+
blocked: "blocked";
|
|
991
|
+
}>;
|
|
992
|
+
}, z.core.$strip>], "type">;
|
|
993
|
+
export type ButtonToParentMessage = z.infer<typeof ButtonToParentMessageSchema>;
|
|
994
|
+
/**
|
|
995
|
+
* The button frame telling the session frames beside it that it opened a
|
|
996
|
+
* connect window under this challenge, so the handover that comes back under
|
|
997
|
+
* it is theirs to take.
|
|
998
|
+
*/
|
|
999
|
+
export declare const ConnectWindowOpenedMessageSchema: z.ZodObject<{
|
|
1000
|
+
type: z.ZodLiteral<"connectWindowOpened">;
|
|
1001
|
+
challenge: z.ZodString;
|
|
1002
|
+
}, z.core.$strip>;
|
|
1003
|
+
export type ConnectWindowOpenedMessage = z.infer<typeof ConnectWindowOpenedMessageSchema>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Sent by the button frame on a wildcard origin the moment it loads, before
|
|
1006
|
+
* the parent has identified itself, so outside the unions above, as
|
|
1007
|
+
* `proxyInitialized` is.
|
|
1008
|
+
*/
|
|
1009
|
+
export declare const BUTTON_FRAME_LOADED = "buttonFrameLoaded";
|
|
1010
|
+
export declare const ParentIdentifyMessageSchema: z.ZodObject<{
|
|
1011
|
+
type: z.ZodLiteral<"parentIdentify">;
|
|
1012
|
+
requestId: z.ZodString;
|
|
1013
|
+
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
metadata: z.ZodObject<{
|
|
1015
|
+
name: z.ZodString;
|
|
1016
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1017
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1018
|
+
}, z.core.$strip>;
|
|
711
1019
|
subsidisedGatewayUrl: z.ZodOptional<z.ZodString>;
|
|
712
1020
|
}, z.core.$strip>;
|
|
713
1021
|
export declare const CheckAuthMessageSchema: z.ZodObject<{
|
|
@@ -1292,38 +1600,15 @@ export declare const GetPostageBatchMessageSchema: z.ZodObject<{
|
|
|
1292
1600
|
type: z.ZodLiteral<"getPostageBatch">;
|
|
1293
1601
|
requestId: z.ZodString;
|
|
1294
1602
|
}, z.core.$strip>;
|
|
1295
|
-
export declare const ConnectMessageSchema: z.ZodObject<{
|
|
1296
|
-
type: z.ZodLiteral<"connect">;
|
|
1297
|
-
requestId: z.ZodString;
|
|
1298
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1299
|
-
popup: "popup";
|
|
1300
|
-
window: "window";
|
|
1301
|
-
}>>;
|
|
1302
|
-
}, z.core.$strip>;
|
|
1303
1603
|
export declare const ParentToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1304
1604
|
type: z.ZodLiteral<"parentIdentify">;
|
|
1305
1605
|
requestId: z.ZodString;
|
|
1306
1606
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
1307
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1308
|
-
popup: "popup";
|
|
1309
|
-
window: "window";
|
|
1310
|
-
}>>;
|
|
1311
1607
|
metadata: z.ZodObject<{
|
|
1312
1608
|
name: z.ZodString;
|
|
1313
1609
|
description: z.ZodOptional<z.ZodString>;
|
|
1314
1610
|
icon: z.ZodOptional<z.ZodString>;
|
|
1315
1611
|
}, z.core.$strip>;
|
|
1316
|
-
buttonConfig: z.ZodOptional<z.ZodObject<{
|
|
1317
|
-
connectText: z.ZodOptional<z.ZodString>;
|
|
1318
|
-
disconnectText: z.ZodOptional<z.ZodString>;
|
|
1319
|
-
loadingText: z.ZodOptional<z.ZodString>;
|
|
1320
|
-
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1321
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1322
|
-
borderRadius: z.ZodOptional<z.ZodString>;
|
|
1323
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1324
|
-
fontSize: z.ZodOptional<z.ZodString>;
|
|
1325
|
-
fontWeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1326
|
-
}, z.core.$strip>>;
|
|
1327
1612
|
subsidisedGatewayUrl: z.ZodOptional<z.ZodString>;
|
|
1328
1613
|
}, z.core.$strip>, z.ZodObject<{
|
|
1329
1614
|
type: z.ZodLiteral<"checkAuth">;
|
|
@@ -1832,13 +2117,6 @@ export declare const ParentToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
1832
2117
|
}, z.core.$strip>, z.ZodObject<{
|
|
1833
2118
|
type: z.ZodLiteral<"getPostageBatch">;
|
|
1834
2119
|
requestId: z.ZodString;
|
|
1835
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1836
|
-
type: z.ZodLiteral<"connect">;
|
|
1837
|
-
requestId: z.ZodString;
|
|
1838
|
-
popupMode: z.ZodOptional<z.ZodEnum<{
|
|
1839
|
-
popup: "popup";
|
|
1840
|
-
window: "window";
|
|
1841
|
-
}>>;
|
|
1842
2120
|
}, z.core.$strip>], "type">;
|
|
1843
2121
|
export type ParentIdentifyMessage = z.infer<typeof ParentIdentifyMessageSchema>;
|
|
1844
2122
|
export type CheckAuthMessage = z.infer<typeof CheckAuthMessageSchema>;
|
|
@@ -1883,7 +2161,6 @@ export type ActAddGranteesMessage = z.infer<typeof ActAddGranteesMessageSchema>;
|
|
|
1883
2161
|
export type ActRevokeGranteesMessage = z.infer<typeof ActRevokeGranteesMessageSchema>;
|
|
1884
2162
|
export type ActGetGranteesMessage = z.infer<typeof ActGetGranteesMessageSchema>;
|
|
1885
2163
|
export type GetPostageBatchMessage = z.infer<typeof GetPostageBatchMessageSchema>;
|
|
1886
|
-
export type ConnectMessage = z.infer<typeof ConnectMessageSchema>;
|
|
1887
2164
|
export type ParentToIframeMessage = z.infer<typeof ParentToIframeMessageSchema>;
|
|
1888
2165
|
export declare const ProxyReadyMessageSchema: z.ZodObject<{
|
|
1889
2166
|
type: z.ZodLiteral<"proxyReady">;
|
|
@@ -2027,6 +2304,7 @@ export declare const SwarmIdErrorCodeSchema: z.ZodEnum<{
|
|
|
2027
2304
|
"invalid-state": "invalid-state";
|
|
2028
2305
|
"init-failed": "init-failed";
|
|
2029
2306
|
"popup-blocked": "popup-blocked";
|
|
2307
|
+
"button-required": "button-required";
|
|
2030
2308
|
internal: "internal";
|
|
2031
2309
|
}>;
|
|
2032
2310
|
export type SwarmIdErrorCode = z.infer<typeof SwarmIdErrorCodeSchema>;
|
|
@@ -2045,6 +2323,7 @@ export declare const WireErrorSchema: z.ZodObject<{
|
|
|
2045
2323
|
"invalid-state": "invalid-state";
|
|
2046
2324
|
"init-failed": "init-failed";
|
|
2047
2325
|
"popup-blocked": "popup-blocked";
|
|
2326
|
+
"button-required": "button-required";
|
|
2048
2327
|
internal: "internal";
|
|
2049
2328
|
}>>;
|
|
2050
2329
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2078,6 +2357,7 @@ export declare const ErrorMessageSchema: z.ZodObject<{
|
|
|
2078
2357
|
"invalid-state": "invalid-state";
|
|
2079
2358
|
"init-failed": "init-failed";
|
|
2080
2359
|
"popup-blocked": "popup-blocked";
|
|
2360
|
+
"button-required": "button-required";
|
|
2081
2361
|
internal: "internal";
|
|
2082
2362
|
}>>;
|
|
2083
2363
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2143,11 +2423,7 @@ export declare const ConnectionInfoChangedMessageSchema: z.ZodObject<{
|
|
|
2143
2423
|
signature: z.ZodString;
|
|
2144
2424
|
}, z.core.$strip>>;
|
|
2145
2425
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
2146
|
-
|
|
2147
|
-
export declare const ConnectResponseMessageSchema: z.ZodObject<{
|
|
2148
|
-
type: z.ZodLiteral<"connectResponse">;
|
|
2149
|
-
requestId: z.ZodString;
|
|
2150
|
-
success: z.ZodBoolean;
|
|
2426
|
+
postageBatchId: z.ZodOptional<z.ZodString>;
|
|
2151
2427
|
}, z.core.$strip>;
|
|
2152
2428
|
export declare const IsConnectedResponseMessageSchema: z.ZodObject<{
|
|
2153
2429
|
type: z.ZodLiteral<"isConnectedResponse">;
|
|
@@ -2447,6 +2723,7 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
2447
2723
|
"invalid-state": "invalid-state";
|
|
2448
2724
|
"init-failed": "init-failed";
|
|
2449
2725
|
"popup-blocked": "popup-blocked";
|
|
2726
|
+
"button-required": "button-required";
|
|
2450
2727
|
internal: "internal";
|
|
2451
2728
|
}>>;
|
|
2452
2729
|
reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
@@ -2511,10 +2788,7 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
2511
2788
|
signature: z.ZodString;
|
|
2512
2789
|
}, z.core.$strip>>;
|
|
2513
2790
|
beeApiUrl: z.ZodOptional<z.ZodString>;
|
|
2514
|
-
|
|
2515
|
-
type: z.ZodLiteral<"connectResponse">;
|
|
2516
|
-
requestId: z.ZodString;
|
|
2517
|
-
success: z.ZodBoolean;
|
|
2791
|
+
postageBatchId: z.ZodOptional<z.ZodString>;
|
|
2518
2792
|
}, z.core.$strip>, z.ZodObject<{
|
|
2519
2793
|
type: z.ZodLiteral<"isConnectedResponse">;
|
|
2520
2794
|
requestId: z.ZodString;
|
|
@@ -2709,7 +2983,6 @@ export type DownloadChunkResponseMessage = z.infer<typeof DownloadChunkResponseM
|
|
|
2709
2983
|
export type UploadProgressMessage = z.infer<typeof UploadProgressMessageSchema>;
|
|
2710
2984
|
export type ErrorMessage = z.infer<typeof ErrorMessageSchema>;
|
|
2711
2985
|
export type ConnectionInfoChangedMessage = z.infer<typeof ConnectionInfoChangedMessageSchema>;
|
|
2712
|
-
export type ConnectResponseMessage = z.infer<typeof ConnectResponseMessageSchema>;
|
|
2713
2986
|
export type IsConnectedResponseMessage = z.infer<typeof IsConnectedResponseMessageSchema>;
|
|
2714
2987
|
export type GetNodeInfoResponseMessage = z.infer<typeof GetNodeInfoResponseMessageSchema>;
|
|
2715
2988
|
export type GsocMineResponseMessage = z.infer<typeof GsocMineResponseMessageSchema>;
|
|
@@ -2766,8 +3039,9 @@ export declare const AuthDataSchema: z.ZodObject<{
|
|
|
2766
3039
|
appDescription: z.ZodOptional<z.ZodString>;
|
|
2767
3040
|
connectedUntil: z.ZodOptional<z.ZodNumber>;
|
|
2768
3041
|
appSecret: z.ZodOptional<z.ZodString>;
|
|
2769
|
-
postageStampBatchID: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string
|
|
3042
|
+
postageStampBatchID: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string>>]>>;
|
|
2770
3043
|
postageStampBatchIDAt: z.ZodOptional<z.ZodNumber>;
|
|
3044
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2771
3045
|
revokedAt: z.ZodOptional<z.ZodNumber>;
|
|
2772
3046
|
disconnectedAt: z.ZodOptional<z.ZodNumber>;
|
|
2773
3047
|
chatBinding: z.ZodOptional<z.ZodObject<{
|
|
@@ -2806,6 +3080,7 @@ export declare const AuthDataSchema: z.ZodObject<{
|
|
|
2806
3080
|
message: z.ZodString;
|
|
2807
3081
|
signature: z.ZodString;
|
|
2808
3082
|
}, z.core.$strip>>;
|
|
3083
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2809
3084
|
}, z.core.$strip>;
|
|
2810
3085
|
export type AuthData = z.infer<typeof AuthDataSchema>;
|
|
2811
3086
|
/**
|
|
@@ -2879,8 +3154,9 @@ export declare const SetSecretMessageSchema: z.ZodObject<{
|
|
|
2879
3154
|
appDescription: z.ZodOptional<z.ZodString>;
|
|
2880
3155
|
connectedUntil: z.ZodOptional<z.ZodNumber>;
|
|
2881
3156
|
appSecret: z.ZodOptional<z.ZodString>;
|
|
2882
|
-
postageStampBatchID: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string
|
|
3157
|
+
postageStampBatchID: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string>>]>>;
|
|
2883
3158
|
postageStampBatchIDAt: z.ZodOptional<z.ZodNumber>;
|
|
3159
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2884
3160
|
revokedAt: z.ZodOptional<z.ZodNumber>;
|
|
2885
3161
|
disconnectedAt: z.ZodOptional<z.ZodNumber>;
|
|
2886
3162
|
chatBinding: z.ZodOptional<z.ZodObject<{
|
|
@@ -2919,8 +3195,14 @@ export declare const SetSecretMessageSchema: z.ZodObject<{
|
|
|
2919
3195
|
message: z.ZodString;
|
|
2920
3196
|
signature: z.ZodString;
|
|
2921
3197
|
}, z.core.$strip>>;
|
|
3198
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2922
3199
|
}, z.core.$strip>;
|
|
2923
3200
|
}, z.core.$strip>;
|
|
3201
|
+
/**
|
|
3202
|
+
* What the connect popup posts to the session frame. The popup was opened by
|
|
3203
|
+
* the button frame, and posts to the Swarm ID frames beside its opener
|
|
3204
|
+
* (`ui/src/lib/handover-targets.ts`).
|
|
3205
|
+
*/
|
|
2924
3206
|
export declare const PopupToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2925
3207
|
type: z.ZodLiteral<"setSecret">;
|
|
2926
3208
|
appOrigin: z.ZodString;
|
|
@@ -2954,8 +3236,9 @@ export declare const PopupToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
2954
3236
|
appDescription: z.ZodOptional<z.ZodString>;
|
|
2955
3237
|
connectedUntil: z.ZodOptional<z.ZodNumber>;
|
|
2956
3238
|
appSecret: z.ZodOptional<z.ZodString>;
|
|
2957
|
-
postageStampBatchID: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string
|
|
3239
|
+
postageStampBatchID: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodPipe<z.ZodString, z.ZodTransform<import("@ethersphere/core-sdk").BatchId, string>>]>>;
|
|
2958
3240
|
postageStampBatchIDAt: z.ZodOptional<z.ZodNumber>;
|
|
3241
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2959
3242
|
revokedAt: z.ZodOptional<z.ZodNumber>;
|
|
2960
3243
|
disconnectedAt: z.ZodOptional<z.ZodNumber>;
|
|
2961
3244
|
chatBinding: z.ZodOptional<z.ZodObject<{
|
|
@@ -2994,6 +3277,7 @@ export declare const PopupToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
2994
3277
|
message: z.ZodString;
|
|
2995
3278
|
signature: z.ZodString;
|
|
2996
3279
|
}, z.core.$strip>>;
|
|
3280
|
+
stampPending: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2997
3281
|
}, z.core.$strip>;
|
|
2998
3282
|
}, z.core.$strip>], "type">;
|
|
2999
3283
|
export type SetSecretMessage = z.infer<typeof SetSecretMessageSchema>;
|
|
@@ -3013,8 +3297,6 @@ export interface ClientOptions {
|
|
|
3013
3297
|
onConnectionChange?: (info: ConnectionInfo) => void;
|
|
3014
3298
|
popupMode?: "popup" | "window";
|
|
3015
3299
|
metadata: AppMetadata;
|
|
3016
|
-
buttonConfig?: ButtonConfig;
|
|
3017
|
-
containerId?: string;
|
|
3018
3300
|
/** URL of a subsidised gateway for users without postage stamps. Gateway handles stamping server-side. */
|
|
3019
3301
|
subsidisedGatewayUrl?: string;
|
|
3020
3302
|
/**
|
|
@@ -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;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ConnectedApp, type PostageStamp, type SignedInAccount } from "../schemas";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve which postage stamp an app should upload with.
|
|
4
4
|
*
|
|
5
5
|
* An app may carry its own batch override (`postageStampBatchID`); otherwise it
|
|
6
6
|
* falls back to the account's default stamp. The account owns the stamp set, so
|
|
7
|
-
* these pointers are the single source of truth.
|
|
7
|
+
* these pointers are the single source of truth. An app set to
|
|
8
|
+
* `NO_POSTAGE_STAMP` resolves to no stamp, the default included.
|
|
8
9
|
*
|
|
9
10
|
* The lookup is existence-checked: a pointer whose stamp is missing (e.g. a
|
|
10
11
|
* removed or replaced batch) is skipped so resolution falls through to the next
|
|
@@ -36,4 +37,4 @@ export declare function resolveStampForApp(app: Pick<ConnectedApp, "postageStamp
|
|
|
36
37
|
* cannot upload at all. Tombstones its pointers still name are kept too — a
|
|
37
38
|
* tombstone is how the session learns the stamp it was spending is deleted.
|
|
38
39
|
*/
|
|
39
|
-
export declare function stampsReachableByApp(app: Pick<ConnectedApp, "postageStampBatchID">, account: Pick<SignedInAccount, "defaultPostageStampBatchID">, stamps: PostageStamp[]): PostageStamp[];
|
|
40
|
+
export declare function stampsReachableByApp(app: Pick<ConnectedApp, "postageStampBatchID" | "stampPending">, account: Pick<SignedInAccount, "defaultPostageStampBatchID">, stamps: PostageStamp[]): PostageStamp[];
|