@openpeepshq/react 0.2.3
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 +21 -0
- package/README.md +1 -0
- package/dist/auth/credentials/index.d.ts +11 -0
- package/dist/auth/credentials/index.js +57 -0
- package/dist/auth/credentials/types.d.ts +6 -0
- package/dist/auth/credentials/types.js +1 -0
- package/dist/components/accounts/SignUpLoginModal.d.ts +9 -0
- package/dist/components/accounts/SignUpLoginModal.js +19 -0
- package/dist/components/accounts/SignUpLoginModalContext.d.ts +10 -0
- package/dist/components/accounts/SignUpLoginModalContext.js +16 -0
- package/dist/components/accounts/index.d.ts +3 -0
- package/dist/components/accounts/index.js +2 -0
- package/dist/components/configuration/ConfigurationCategory.d.ts +12 -0
- package/dist/components/configuration/ConfigurationCategory.js +61 -0
- package/dist/components/configuration/ConfigurationList.d.ts +10 -0
- package/dist/components/configuration/ConfigurationList.js +30 -0
- package/dist/components/configuration/ConfigurationTree.d.ts +8 -0
- package/dist/components/configuration/ConfigurationTree.js +20 -0
- package/dist/components/configuration/ConfigurationValueEditor.d.ts +11 -0
- package/dist/components/configuration/ConfigurationValueEditor.js +45 -0
- package/dist/components/configuration/index.d.ts +4 -0
- package/dist/components/configuration/index.js +4 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +4 -0
- package/dist/components/conversations/ConversationMessageBubble.js +10 -0
- package/dist/components/conversations/CreateNewConversation.d.ts +8 -0
- package/dist/components/conversations/CreateNewConversation.js +62 -0
- package/dist/components/conversations/CreateNewConversationContext.d.ts +15 -0
- package/dist/components/conversations/CreateNewConversationContext.js +18 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.d.ts +1 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.js +10 -0
- package/dist/components/conversations/MessageInThread.d.ts +13 -0
- package/dist/components/conversations/MessageInThread.js +41 -0
- package/dist/components/conversations/index.d.ts +8 -0
- package/dist/components/conversations/index.js +5 -0
- package/dist/components/form/HeaderAvatarInput.d.ts +13 -0
- package/dist/components/form/HeaderAvatarInput.js +16 -0
- package/dist/components/form/ImageEditModal.d.ts +23 -0
- package/dist/components/form/ImageEditModal.js +75 -0
- package/dist/components/form/ImageInput.d.ts +32 -0
- package/dist/components/form/ImageInput.js +65 -0
- package/dist/components/form/LocationInput.d.ts +20 -0
- package/dist/components/form/LocationInput.js +59 -0
- package/dist/components/form/index.d.ts +8 -0
- package/dist/components/form/index.js +4 -0
- package/dist/components/groups/AddGroupMemberModal.d.ts +6 -0
- package/dist/components/groups/AddGroupMemberModal.js +40 -0
- package/dist/components/groups/AddGroupMembersButton.d.ts +5 -0
- package/dist/components/groups/AddGroupMembersButton.js +17 -0
- package/dist/components/groups/ChangeGroupRolesModal.d.ts +7 -0
- package/dist/components/groups/ChangeGroupRolesModal.js +45 -0
- package/dist/components/groups/ConfirmGroupExitModal.d.ts +6 -0
- package/dist/components/groups/ConfirmGroupExitModal.js +35 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.d.ts +7 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.js +33 -0
- package/dist/components/groups/DeleteGroupModal.d.ts +6 -0
- package/dist/components/groups/DeleteGroupModal.js +34 -0
- package/dist/components/groups/GroupAvatar.d.ts +14 -0
- package/dist/components/groups/GroupAvatar.js +32 -0
- package/dist/components/groups/GroupCard.d.ts +19 -0
- package/dist/components/groups/GroupCard.js +12 -0
- package/dist/components/groups/GroupFeed.d.ts +9 -0
- package/dist/components/groups/GroupFeed.js +14 -0
- package/dist/components/groups/GroupForm.d.ts +7 -0
- package/dist/components/groups/GroupForm.js +73 -0
- package/dist/components/groups/GroupHeader.d.ts +5 -0
- package/dist/components/groups/GroupHeader.js +14 -0
- package/dist/components/groups/GroupMembersList.d.ts +5 -0
- package/dist/components/groups/GroupMembersList.js +38 -0
- package/dist/components/groups/GroupOptionsMenu.d.ts +5 -0
- package/dist/components/groups/GroupOptionsMenu.js +61 -0
- package/dist/components/groups/GroupShareMenu.d.ts +5 -0
- package/dist/components/groups/GroupShareMenu.js +29 -0
- package/dist/components/groups/JoinGroupButton.d.ts +6 -0
- package/dist/components/groups/JoinGroupButton.js +28 -0
- package/dist/components/groups/index.d.ts +30 -0
- package/dist/components/groups/index.js +15 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +15 -0
- package/dist/components/jams/CreateNewJam.d.ts +4 -0
- package/dist/components/jams/CreateNewJam.js +138 -0
- package/dist/components/jams/CreateNewJamContext.d.ts +9 -0
- package/dist/components/jams/CreateNewJamContext.js +16 -0
- package/dist/components/jams/JamAnimatedEmoji.d.ts +4 -0
- package/dist/components/jams/JamAnimatedEmoji.js +12 -0
- package/dist/components/jams/JamCallParticipant.d.ts +15 -0
- package/dist/components/jams/JamCallParticipant.js +101 -0
- package/dist/components/jams/JamCapacityGate.d.ts +7 -0
- package/dist/components/jams/JamCapacityGate.js +30 -0
- package/dist/components/jams/JamChatDrawer.d.ts +6 -0
- package/dist/components/jams/JamChatDrawer.js +88 -0
- package/dist/components/jams/JamChatMessage.d.ts +5 -0
- package/dist/components/jams/JamChatMessage.js +35 -0
- package/dist/components/jams/JamConference.d.ts +8 -0
- package/dist/components/jams/JamConference.js +38 -0
- package/dist/components/jams/JamContext.d.ts +20 -0
- package/dist/components/jams/JamContext.js +24 -0
- package/dist/components/jams/JamDetailsDrawer.d.ts +9 -0
- package/dist/components/jams/JamDetailsDrawer.js +39 -0
- package/dist/components/jams/JamDeviceSelectors.d.ts +12 -0
- package/dist/components/jams/JamDeviceSelectors.js +71 -0
- package/dist/components/jams/JamEventsContext.d.ts +14 -0
- package/dist/components/jams/JamEventsContext.js +143 -0
- package/dist/components/jams/JamFooter.d.ts +18 -0
- package/dist/components/jams/JamFooter.js +171 -0
- package/dist/components/jams/JamGuestForm.d.ts +1 -0
- package/dist/components/jams/JamGuestForm.js +55 -0
- package/dist/components/jams/JamLobby.d.ts +17 -0
- package/dist/components/jams/JamLobby.js +159 -0
- package/dist/components/jams/JamObserverShell.d.ts +6 -0
- package/dist/components/jams/JamObserverShell.js +11 -0
- package/dist/components/jams/JamParticipantConference.d.ts +7 -0
- package/dist/components/jams/JamParticipantConference.js +80 -0
- package/dist/components/jams/JamPeopleDrawer.d.ts +10 -0
- package/dist/components/jams/JamPeopleDrawer.js +76 -0
- package/dist/components/jams/JamReactionMenu.d.ts +12 -0
- package/dist/components/jams/JamReactionMenu.js +79 -0
- package/dist/components/jams/JamRequestJoin.d.ts +9 -0
- package/dist/components/jams/JamRequestJoin.js +34 -0
- package/dist/components/jams/JamRoom.d.ts +21 -0
- package/dist/components/jams/JamRoom.js +166 -0
- package/dist/components/jams/JamRoomIndicators.d.ts +10 -0
- package/dist/components/jams/JamRoomIndicators.js +39 -0
- package/dist/components/jams/JamVideoCall.d.ts +15 -0
- package/dist/components/jams/JamVideoCall.js +18 -0
- package/dist/components/jams/JamVideoLayout.d.ts +13 -0
- package/dist/components/jams/JamVideoLayout.js +68 -0
- package/dist/components/jams/LeaveCloseButton.d.ts +6 -0
- package/dist/components/jams/LeaveCloseButton.js +58 -0
- package/dist/components/jams/LiveJamsSection.d.ts +1 -0
- package/dist/components/jams/LiveJamsSection.js +16 -0
- package/dist/components/jams/animateEmoji.d.ts +1 -0
- package/dist/components/jams/animateEmoji.js +48 -0
- package/dist/components/jams/blurProcessor.d.ts +8 -0
- package/dist/components/jams/blurProcessor.js +28 -0
- package/dist/components/jams/constants.d.ts +10 -0
- package/dist/components/jams/constants.js +44 -0
- package/dist/components/jams/index.d.ts +24 -0
- package/dist/components/jams/index.js +19 -0
- package/dist/components/jams/jamEventActions.d.ts +26 -0
- package/dist/components/jams/jamEventActions.js +76 -0
- package/dist/components/jams/jamLocalSettings.d.ts +17 -0
- package/dist/components/jams/jamLocalSettings.js +53 -0
- package/dist/components/jams/jamReactionPreferences.d.ts +15 -0
- package/dist/components/jams/jamReactionPreferences.js +53 -0
- package/dist/components/jams/jamRecordingState.d.ts +10 -0
- package/dist/components/jams/jamRecordingState.js +25 -0
- package/dist/components/jams/reactionEmojis.d.ts +30 -0
- package/dist/components/jams/reactionEmojis.js +73 -0
- package/dist/components/jams/useJamHands.d.ts +7 -0
- package/dist/components/jams/useJamHands.js +39 -0
- package/dist/components/jams/useJamLiveKitTheme.d.ts +3 -0
- package/dist/components/jams/useJamLiveKitTheme.js +10 -0
- package/dist/components/layout/AccessDenied.d.ts +14 -0
- package/dist/components/layout/AccessDenied.js +28 -0
- package/dist/components/layout/AccessDeniedLoader.d.ts +16 -0
- package/dist/components/layout/AccessDeniedLoader.js +12 -0
- package/dist/components/layout/Auth.d.ts +22 -0
- package/dist/components/layout/Auth.js +82 -0
- package/dist/components/layout/IdentityContext.d.ts +17 -0
- package/dist/components/layout/IdentityContext.js +38 -0
- package/dist/components/layout/Infos.d.ts +5 -0
- package/dist/components/layout/Infos.js +42 -0
- package/dist/components/layout/OpenpeepsContextProvider.d.ts +10 -0
- package/dist/components/layout/OpenpeepsContextProvider.js +63 -0
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +11 -0
- package/dist/components/layout/OpenpeepsThemeProvider.js +47 -0
- package/dist/components/layout/ProfileGuard.d.ts +14 -0
- package/dist/components/layout/ProfileGuard.js +38 -0
- package/dist/components/layout/ProfileProvider.d.ts +10 -0
- package/dist/components/layout/ProfileProvider.js +60 -0
- package/dist/components/layout/Root.d.ts +16 -0
- package/dist/components/layout/Root.js +36 -0
- package/dist/components/layout/ToastProvider.d.ts +22 -0
- package/dist/components/layout/ToastProvider.js +37 -0
- package/dist/components/layout/index.d.ts +21 -0
- package/dist/components/layout/index.js +11 -0
- package/dist/components/markdown/CompiledMarkdown.d.ts +5 -0
- package/dist/components/markdown/CompiledMarkdown.js +3 -0
- package/dist/components/markdown/OpenpeepsMarkdown.d.ts +16 -0
- package/dist/components/markdown/OpenpeepsMarkdown.js +66 -0
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/compileMarkdown.d.ts +5 -0
- package/dist/components/markdown/compileMarkdown.js +36 -0
- package/dist/components/markdown/index.d.ts +11 -0
- package/dist/components/markdown/index.js +7 -0
- package/dist/components/markdown/linkTargets.d.ts +3 -0
- package/dist/components/markdown/linkTargets.js +27 -0
- package/dist/components/markdown/staticRender.d.ts +16 -0
- package/dist/components/markdown/staticRender.js +17 -0
- package/dist/components/navigation/ContentHeader.d.ts +1 -0
- package/dist/components/navigation/ContentHeader.js +18 -0
- package/dist/components/navigation/FooterMobile.d.ts +5 -0
- package/dist/components/navigation/FooterMobile.js +8 -0
- package/dist/components/navigation/HeaderMobile.d.ts +11 -0
- package/dist/components/navigation/HeaderMobile.js +26 -0
- package/dist/components/navigation/MobileMenuItem.d.ts +7 -0
- package/dist/components/navigation/MobileMenuItem.js +13 -0
- package/dist/components/navigation/PageHeaderAction.d.ts +5 -0
- package/dist/components/navigation/PageHeaderAction.js +7 -0
- package/dist/components/navigation/PlusButton.d.ts +1 -0
- package/dist/components/navigation/PlusButton.js +11 -0
- package/dist/components/navigation/SideBar.d.ts +16 -0
- package/dist/components/navigation/SideBar.js +24 -0
- package/dist/components/navigation/SidebarNavContext.d.ts +3 -0
- package/dist/components/navigation/SidebarNavContext.js +4 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +10 -0
- package/dist/components/navigation/breadcrumbs/Crumb.d.ts +5 -0
- package/dist/components/navigation/breadcrumbs/Crumb.js +4 -0
- package/dist/components/navigation/index.d.ts +17 -0
- package/dist/components/navigation/index.js +11 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +4 -0
- package/dist/components/navigation/sideBarNavLinkClass.js +3 -0
- package/dist/components/notifications/NotificationErrorBoundary.d.ts +16 -0
- package/dist/components/notifications/NotificationErrorBoundary.js +21 -0
- package/dist/components/notifications/NotificationHeaderActions.d.ts +6 -0
- package/dist/components/notifications/NotificationHeaderActions.js +35 -0
- package/dist/components/notifications/NotificationItem.d.ts +5 -0
- package/dist/components/notifications/NotificationItem.js +6 -0
- package/dist/components/notifications/NotificationWrapper.d.ts +10 -0
- package/dist/components/notifications/NotificationWrapper.js +6 -0
- package/dist/components/notifications/NotificationsList.d.ts +12 -0
- package/dist/components/notifications/NotificationsList.js +88 -0
- package/dist/components/notifications/TypedNotification.d.ts +4 -0
- package/dist/components/notifications/TypedNotification.js +201 -0
- package/dist/components/notifications/index.d.ts +7 -0
- package/dist/components/notifications/index.js +5 -0
- package/dist/components/post/Feed.d.ts +20 -0
- package/dist/components/post/Feed.js +63 -0
- package/dist/components/post/FeedPost.d.ts +17 -0
- package/dist/components/post/FeedPost.js +31 -0
- package/dist/components/post/FeedPostContent.d.ts +5 -0
- package/dist/components/post/FeedPostContent.js +22 -0
- package/dist/components/post/FullPostLayout.d.ts +7 -0
- package/dist/components/post/FullPostLayout.js +23 -0
- package/dist/components/post/Markdown.d.ts +2 -0
- package/dist/components/post/Markdown.js +1 -0
- package/dist/components/post/NewEventButton.d.ts +14 -0
- package/dist/components/post/NewEventButton.js +39 -0
- package/dist/components/post/NewNoteButton.d.ts +14 -0
- package/dist/components/post/NewNoteButton.js +38 -0
- package/dist/components/post/PinnedPost.d.ts +5 -0
- package/dist/components/post/PinnedPost.js +15 -0
- package/dist/components/post/PostDetail.d.ts +4 -0
- package/dist/components/post/PostDetail.js +31 -0
- package/dist/components/post/ReplyBox.d.ts +5 -0
- package/dist/components/post/ReplyBox.js +30 -0
- package/dist/components/post/VideoPlayOverlay.d.ts +5 -0
- package/dist/components/post/VideoPlayOverlay.js +8 -0
- package/dist/components/post/attachmentPreview.d.ts +5 -0
- package/dist/components/post/attachmentPreview.js +14 -0
- package/dist/components/post/feed/events/EventsFeed.d.ts +7 -0
- package/dist/components/post/feed/events/EventsFeed.js +44 -0
- package/dist/components/post/feed/threaded/ThreadPost.d.ts +9 -0
- package/dist/components/post/feed/threaded/ThreadPost.js +19 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +10 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.js +8 -0
- package/dist/components/post/helpers.d.ts +6 -0
- package/dist/components/post/helpers.js +24 -0
- package/dist/components/post/index.d.ts +78 -0
- package/dist/components/post/index.js +57 -0
- package/dist/components/post/pieces/Attachments.d.ts +5 -0
- package/dist/components/post/pieces/Attachments.js +44 -0
- package/dist/components/post/pieces/EventLocation.d.ts +7 -0
- package/dist/components/post/pieces/EventLocation.js +28 -0
- package/dist/components/post/pieces/EventMenu.d.ts +6 -0
- package/dist/components/post/pieces/EventMenu.js +35 -0
- package/dist/components/post/pieces/EventRsvpButton.d.ts +5 -0
- package/dist/components/post/pieces/EventRsvpButton.js +60 -0
- package/dist/components/post/pieces/FeedPostStats.d.ts +5 -0
- package/dist/components/post/pieces/FeedPostStats.js +27 -0
- package/dist/components/post/pieces/GalleryModal.d.ts +7 -0
- package/dist/components/post/pieces/GalleryModal.js +16 -0
- package/dist/components/post/pieces/ParticipantsCard.d.ts +8 -0
- package/dist/components/post/pieces/ParticipantsCard.js +13 -0
- package/dist/components/post/pieces/PollContent.d.ts +5 -0
- package/dist/components/post/pieces/PollContent.js +109 -0
- package/dist/components/post/pieces/PostActions.d.ts +6 -0
- package/dist/components/post/pieces/PostActions.js +63 -0
- package/dist/components/post/pieces/PostInfoHeader.d.ts +7 -0
- package/dist/components/post/pieces/PostInfoHeader.js +8 -0
- package/dist/components/post/pieces/PostMenu.d.ts +6 -0
- package/dist/components/post/pieces/PostMenu.js +77 -0
- package/dist/components/post/pieces/PostReactionHeader.d.ts +12 -0
- package/dist/components/post/pieces/PostReactionHeader.js +31 -0
- package/dist/components/post/pieces/ShareMenu.d.ts +6 -0
- package/dist/components/post/pieces/ShareMenu.js +46 -0
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +9 -0
- package/dist/components/post/pieces/UnreadPostIndicator.js +6 -0
- package/dist/components/post/pieces/VideoPlayer.d.ts +16 -0
- package/dist/components/post/pieces/VideoPlayer.js +127 -0
- package/dist/components/post/pieces/modals/DeletePostModal.d.ts +8 -0
- package/dist/components/post/pieces/modals/DeletePostModal.js +20 -0
- package/dist/components/post/pieces/modals/ReactionsModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/ReactionsModal.js +11 -0
- package/dist/components/post/pieces/modals/RepostModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/RepostModal.js +13 -0
- package/dist/components/post/post-form/ArticleForm.d.ts +7 -0
- package/dist/components/post/post-form/ArticleForm.js +45 -0
- package/dist/components/post/post-form/AttachmentCard.d.ts +29 -0
- package/dist/components/post/post-form/AttachmentCard.js +120 -0
- package/dist/components/post/post-form/ComposeAttachments.d.ts +25 -0
- package/dist/components/post/post-form/ComposeAttachments.js +137 -0
- package/dist/components/post/post-form/ComposePreviewLinks.d.ts +4 -0
- package/dist/components/post/post-form/ComposePreviewLinks.js +9 -0
- package/dist/components/post/post-form/DescriptionEditModal.d.ts +13 -0
- package/dist/components/post/post-form/DescriptionEditModal.js +22 -0
- package/dist/components/post/post-form/EditPostModal.d.ts +6 -0
- package/dist/components/post/post-form/EditPostModal.js +81 -0
- package/dist/components/post/post-form/EditPostModalContext.d.ts +10 -0
- package/dist/components/post/post-form/EditPostModalContext.js +18 -0
- package/dist/components/post/post-form/EventForm.d.ts +7 -0
- package/dist/components/post/post-form/EventForm.js +104 -0
- package/dist/components/post/post-form/EventTypeSwitcher.d.ts +8 -0
- package/dist/components/post/post-form/EventTypeSwitcher.js +165 -0
- package/dist/components/post/post-form/NewPostModal.d.ts +13 -0
- package/dist/components/post/post-form/NewPostModal.js +272 -0
- package/dist/components/post/post-form/NewPostModalContext.d.ts +15 -0
- package/dist/components/post/post-form/NewPostModalContext.js +20 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.d.ts +19 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +65 -0
- package/dist/components/post/post-form/PollComposerFields.d.ts +12 -0
- package/dist/components/post/post-form/PollComposerFields.js +19 -0
- package/dist/components/post/post-form/PostAudienceSelector.d.ts +12 -0
- package/dist/components/post/post-form/PostAudienceSelector.js +83 -0
- package/dist/components/post/post-form/PostTypeSwitcher.d.ts +16 -0
- package/dist/components/post/post-form/PostTypeSwitcher.js +22 -0
- package/dist/components/post/post-form/ReplyModal.d.ts +6 -0
- package/dist/components/post/post-form/ReplyModal.js +202 -0
- package/dist/components/post/post-form/ReplyModalContext.d.ts +10 -0
- package/dist/components/post/post-form/ReplyModalContext.js +18 -0
- package/dist/components/post/post-form/VisibilitySelector.d.ts +8 -0
- package/dist/components/post/post-form/VisibilitySelector.js +35 -0
- package/dist/components/post/post-form/audienceChoices.d.ts +14 -0
- package/dist/components/post/post-form/audienceChoices.js +66 -0
- package/dist/components/post/types/Article.d.ts +5 -0
- package/dist/components/post/types/Article.js +14 -0
- package/dist/components/post/types/Event.d.ts +5 -0
- package/dist/components/post/types/Event.js +19 -0
- package/dist/components/post/types/Note.d.ts +5 -0
- package/dist/components/post/types/Note.js +10 -0
- package/dist/components/post/types/Poll.d.ts +7 -0
- package/dist/components/post/types/Poll.js +11 -0
- package/dist/components/post/types/article/FullArticle.d.ts +5 -0
- package/dist/components/post/types/article/FullArticle.js +8 -0
- package/dist/components/post/types/event/CardEvent.d.ts +5 -0
- package/dist/components/post/types/event/CardEvent.js +45 -0
- package/dist/components/post/types/event/FullEvent.d.ts +5 -0
- package/dist/components/post/types/event/FullEvent.js +161 -0
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +5 -0
- package/dist/components/post/types/event/ProfileEventRelationship.js +31 -0
- package/dist/components/post/types/note/FullNote.d.ts +5 -0
- package/dist/components/post/types/note/FullNote.js +5 -0
- package/dist/components/post/types/poll/FullPoll.d.ts +5 -0
- package/dist/components/post/types/poll/FullPoll.js +7 -0
- package/dist/components/post/visibility.d.ts +7 -0
- package/dist/components/post/visibility.js +10 -0
- package/dist/components/preview-link/LocalPreviewLink.d.ts +4 -0
- package/dist/components/preview-link/LocalPreviewLink.js +12 -0
- package/dist/components/preview-link/PreviewLink.d.ts +4 -0
- package/dist/components/preview-link/PreviewLink.js +11 -0
- package/dist/components/preview-link/RemotePreviewLink.d.ts +4 -0
- package/dist/components/preview-link/RemotePreviewLink.js +21 -0
- package/dist/components/preview-link/helpers.d.ts +7 -0
- package/dist/components/preview-link/helpers.js +31 -0
- package/dist/components/preview-link/index.d.ts +3 -0
- package/dist/components/preview-link/index.js +2 -0
- package/dist/components/preview-link/local/GroupPreview.d.ts +4 -0
- package/dist/components/preview-link/local/GroupPreview.js +15 -0
- package/dist/components/preview-link/local/JamPreview.d.ts +9 -0
- package/dist/components/preview-link/local/JamPreview.js +20 -0
- package/dist/components/preview-link/local/PostPreview.d.ts +4 -0
- package/dist/components/preview-link/local/PostPreview.js +15 -0
- package/dist/components/profile/Avatar.d.ts +17 -0
- package/dist/components/profile/Avatar.js +36 -0
- package/dist/components/profile/AvatarWithName.d.ts +5 -0
- package/dist/components/profile/AvatarWithName.js +5 -0
- package/dist/components/profile/FollowUnfollowButton.d.ts +8 -0
- package/dist/components/profile/FollowUnfollowButton.js +27 -0
- package/dist/components/profile/ProfileBadge.d.ts +7 -0
- package/dist/components/profile/ProfileBadge.js +12 -0
- package/dist/components/profile/ProfileCard.d.ts +24 -0
- package/dist/components/profile/ProfileCard.js +12 -0
- package/dist/components/profile/ProfileFromId.d.ts +6 -0
- package/dist/components/profile/ProfileFromId.js +15 -0
- package/dist/components/profile/ProfileHeader.d.ts +10 -0
- package/dist/components/profile/ProfileHeader.js +16 -0
- package/dist/components/profile/ProfileLink.d.ts +9 -0
- package/dist/components/profile/ProfileLink.js +9 -0
- package/dist/components/profile/ProfilePageAction.d.ts +6 -0
- package/dist/components/profile/ProfilePageAction.js +35 -0
- package/dist/components/profile/ProfilePostsAndReplies.d.ts +9 -0
- package/dist/components/profile/ProfilePostsAndReplies.js +24 -0
- package/dist/components/profile/ProfileSelector.d.ts +14 -0
- package/dist/components/profile/ProfileSelector.js +72 -0
- package/dist/components/profile/ProfileStats.d.ts +5 -0
- package/dist/components/profile/ProfileStats.js +6 -0
- package/dist/components/profile/ProfileWithActionCard.d.ts +5 -0
- package/dist/components/profile/ProfileWithActionCard.js +6 -0
- package/dist/components/profile/ProfilesInput.d.ts +15 -0
- package/dist/components/profile/ProfilesInput.js +31 -0
- package/dist/components/profile/ReportProfileOrPostModal.d.ts +9 -0
- package/dist/components/profile/ReportProfileOrPostModal.js +75 -0
- package/dist/components/profile/index.d.ts +30 -0
- package/dist/components/profile/index.js +15 -0
- package/dist/components/registry/ErrorComponent.d.ts +6 -0
- package/dist/components/registry/ErrorComponent.js +7 -0
- package/dist/components/registry/PluginLoader.d.ts +3 -0
- package/dist/components/registry/PluginLoader.js +51 -0
- package/dist/components/registry/PluginRegistryProvider.d.ts +23 -0
- package/dist/components/registry/PluginRegistryProvider.js +57 -0
- package/dist/components/registry/PluginSlot.d.ts +7 -0
- package/dist/components/registry/PluginSlot.js +31 -0
- package/dist/components/registry/index.d.ts +10 -0
- package/dist/components/registry/index.js +16 -0
- package/dist/components/server-data/ServerDataProvider.d.ts +8 -0
- package/dist/components/server-data/ServerDataProvider.js +30 -0
- package/dist/components/server-data/context.d.ts +121 -0
- package/dist/components/server-data/context.js +10 -0
- package/dist/components/server-data/index.d.ts +4 -0
- package/dist/components/server-data/index.js +2 -0
- package/dist/components/server-data/types.d.ts +5 -0
- package/dist/components/server-data/types.js +1 -0
- package/dist/contexts/credentialsStore/index.d.ts +8 -0
- package/dist/contexts/credentialsStore/index.js +13 -0
- package/dist/contexts/credentialsStore/types.d.ts +4 -0
- package/dist/contexts/credentialsStore/types.js +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +3 -0
- package/dist/contexts/openpeeps/helpers.d.ts +93 -0
- package/dist/contexts/openpeeps/helpers.js +311 -0
- package/dist/contexts/openpeeps/hooks/accounts.d.ts +302 -0
- package/dist/contexts/openpeeps/hooks/accounts.js +17 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +17177 -0
- package/dist/contexts/openpeeps/hooks/admin.js +115 -0
- package/dist/contexts/openpeeps/hooks/auth.d.ts +55 -0
- package/dist/contexts/openpeeps/hooks/auth.js +22 -0
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +9815 -0
- package/dist/contexts/openpeeps/hooks/conversations.js +6 -0
- package/dist/contexts/openpeeps/hooks/groups.d.ts +319 -0
- package/dist/contexts/openpeeps/hooks/groups.js +31 -0
- package/dist/contexts/openpeeps/hooks/index.d.ts +18 -0
- package/dist/contexts/openpeeps/hooks/index.js +26 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +3318 -0
- package/dist/contexts/openpeeps/hooks/jams.js +32 -0
- package/dist/contexts/openpeeps/hooks/other.d.ts +239 -0
- package/dist/contexts/openpeeps/hooks/other.js +89 -0
- package/dist/contexts/openpeeps/hooks/payments.d.ts +36 -0
- package/dist/contexts/openpeeps/hooks/payments.js +10 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +26001 -0
- package/dist/contexts/openpeeps/hooks/posts.js +139 -0
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +6896 -0
- package/dist/contexts/openpeeps/hooks/profiles.js +43 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +9620 -0
- package/dist/contexts/openpeeps/hooks/search.js +24 -0
- package/dist/contexts/openpeeps/hooks/streaming.d.ts +26 -0
- package/dist/contexts/openpeeps/hooks/streaming.js +10 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.d.ts +2 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.js +35 -0
- package/dist/contexts/openpeeps/index.d.ts +21 -0
- package/dist/contexts/openpeeps/index.js +180 -0
- package/dist/contexts/openpeeps/types.d.ts +11 -0
- package/dist/contexts/openpeeps/types.js +1 -0
- package/dist/contexts/router/index.d.ts +28 -0
- package/dist/contexts/router/index.js +69 -0
- package/dist/email/index.d.ts +13 -0
- package/dist/email/index.js +10 -0
- package/dist/i18n/I18nProvider.d.ts +19 -0
- package/dist/i18n/I18nProvider.js +33 -0
- package/dist/i18n/context.d.ts +8 -0
- package/dist/i18n/context.js +10 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +23 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/lib/apiErrorMessage.d.ts +3 -0
- package/dist/lib/apiErrorMessage.js +14 -0
- package/dist/lib/canvasUtils.d.ts +12 -0
- package/dist/lib/canvasUtils.js +104 -0
- package/dist/lib/configuration/helpers.d.ts +7 -0
- package/dist/lib/configuration/helpers.js +83 -0
- package/dist/lib/configuration/resolveSchema.d.ts +3 -0
- package/dist/lib/configuration/resolveSchema.js +8 -0
- package/dist/lib/groupCapabilityHelpers.d.ts +24 -0
- package/dist/lib/groupCapabilityHelpers.js +119 -0
- package/dist/lib/notificationBadge.d.ts +5 -0
- package/dist/lib/notificationBadge.js +25 -0
- package/dist/lib/postUnread.d.ts +2 -0
- package/dist/lib/postUnread.js +1 -0
- package/dist/lib/postViewCounter.d.ts +17 -0
- package/dist/lib/postViewCounter.js +162 -0
- package/dist/lib/threadHelpers.d.ts +5 -0
- package/dist/lib/threadHelpers.js +23 -0
- package/dist/lib/unseenCountsOptimistic.d.ts +15 -0
- package/dist/lib/unseenCountsOptimistic.js +43 -0
- package/dist/log/index.d.ts +11 -0
- package/dist/log/index.js +14 -0
- package/dist/push/index.d.ts +16 -0
- package/dist/push/index.js +145 -0
- package/dist/push/usePushSubscription.d.ts +18 -0
- package/dist/push/usePushSubscription.js +102 -0
- package/dist/push/vapid.d.ts +6 -0
- package/dist/push/vapid.js +12 -0
- package/dist/pwa/InstallPrompt.d.ts +13 -0
- package/dist/pwa/InstallPrompt.js +17 -0
- package/dist/pwa/NotificationPermissionPrompt.d.ts +22 -0
- package/dist/pwa/NotificationPermissionPrompt.js +56 -0
- package/dist/pwa/PwaProvider.d.ts +16 -0
- package/dist/pwa/PwaProvider.js +56 -0
- package/dist/pwa/UpdatePrompt.d.ts +14 -0
- package/dist/pwa/UpdatePrompt.js +14 -0
- package/dist/pwa/index.d.ts +18 -0
- package/dist/pwa/index.js +16 -0
- package/dist/pwa/navigationUrl.d.ts +16 -0
- package/dist/pwa/navigationUrl.js +51 -0
- package/dist/pwa/pushInvalidate.d.ts +7 -0
- package/dist/pwa/pushInvalidate.js +29 -0
- package/dist/pwa/registration.d.ts +28 -0
- package/dist/pwa/registration.js +71 -0
- package/dist/pwa/sw-types.d.ts +14 -0
- package/dist/pwa/sw-types.js +1 -0
- package/dist/pwa/sw.d.ts +2 -0
- package/dist/pwa/sw.js +171 -0
- package/dist/pwa/useInstallPrompt.d.ts +10 -0
- package/dist/pwa/useInstallPrompt.js +45 -0
- package/dist/pwa/useNotificationBadgeSync.d.ts +2 -0
- package/dist/pwa/useNotificationBadgeSync.js +23 -0
- package/dist/pwa/useServiceWorker.d.ts +19 -0
- package/dist/pwa/useServiceWorker.js +49 -0
- package/dist/pwa/vite.d.ts +50 -0
- package/dist/pwa/vite.js +53 -0
- package/dist/react-native.d.ts +11 -0
- package/dist/react-native.js +11 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +5 -0
- package/dist/stores/breadcrumbs.d.ts +5 -0
- package/dist/stores/breadcrumbs.js +5 -0
- package/dist/stores/createStore.d.ts +19 -0
- package/dist/stores/createStore.js +63 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +9 -0
- package/dist/stores/newPosts.d.ts +591 -0
- package/dist/stores/newPosts.js +191 -0
- package/dist/stores/pageHeader.d.ts +15 -0
- package/dist/stores/pageHeader.js +22 -0
- package/dist/stores/plusButton.d.ts +5 -0
- package/dist/stores/plusButton.js +13 -0
- package/dist/stores/types.d.ts +35 -0
- package/dist/stores/types.js +1 -0
- package/dist/streaming.d.ts +6 -0
- package/dist/streaming.js +6 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.js +1 -0
- package/package.json +72 -0
- package/src/pwa/navigationUrl.ts +61 -0
- package/src/pwa/sw-types.ts +9 -0
- package/src/pwa/sw.ts +228 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NotificationStats } from '@openpeepshq/common/types';
|
|
2
|
+
export type PushInvalidateMessage = {
|
|
3
|
+
keys: readonly (readonly string[])[];
|
|
4
|
+
notificationStats?: NotificationStats;
|
|
5
|
+
};
|
|
6
|
+
export declare const normalizePushInvalidateMessage: (message: unknown) => PushInvalidateMessage;
|
|
7
|
+
export declare const dedupeQueryKeys: (keys: readonly (readonly string[])[]) => (readonly string[])[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const isQueryKey = (value) => Array.isArray(value) && value.every((part) => typeof part === 'string');
|
|
2
|
+
export const normalizePushInvalidateMessage = (message) => {
|
|
3
|
+
if (Array.isArray(message)) {
|
|
4
|
+
return {
|
|
5
|
+
keys: message.filter(isQueryKey),
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
if (message && typeof message === 'object') {
|
|
9
|
+
const record = message;
|
|
10
|
+
const keys = Array.isArray(record.keys)
|
|
11
|
+
? record.keys.filter(isQueryKey)
|
|
12
|
+
: [];
|
|
13
|
+
return {
|
|
14
|
+
keys,
|
|
15
|
+
notificationStats: record.notificationStats,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return { keys: [] };
|
|
19
|
+
};
|
|
20
|
+
export const dedupeQueryKeys = (keys) => {
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
return keys.filter((key) => {
|
|
23
|
+
const serialized = JSON.stringify(key);
|
|
24
|
+
if (seen.has(serialized))
|
|
25
|
+
return false;
|
|
26
|
+
seen.add(serialized);
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PushInvalidateMessage } from './pushInvalidate';
|
|
2
|
+
export interface RegisterServiceWorkerOptions {
|
|
3
|
+
/** URL of the service worker (defaults to `/sw.js`). */
|
|
4
|
+
swUrl?: string;
|
|
5
|
+
/** Scope (defaults to `/`). */
|
|
6
|
+
scope?: string;
|
|
7
|
+
/** Called when an update is found and installation completes (waiting). */
|
|
8
|
+
onUpdateAvailable?: (registration: ServiceWorkerRegistration) => void;
|
|
9
|
+
/** Called when a new SW takes control (after `clients.claim`). */
|
|
10
|
+
onControllerChange?: () => void;
|
|
11
|
+
/** Called for inbound `NAVIGATE_TO` messages. */
|
|
12
|
+
onNavigate?: (url: string) => void;
|
|
13
|
+
/** Called when the SW posts query keys to invalidate. */
|
|
14
|
+
onInvalidateQueries?: (message: PushInvalidateMessage | unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface ServiceWorkerHandle {
|
|
17
|
+
registration: ServiceWorkerRegistration | null;
|
|
18
|
+
unregister: () => Promise<boolean>;
|
|
19
|
+
update: () => Promise<void>;
|
|
20
|
+
/** Tell the SW to skipWaiting and become active. */
|
|
21
|
+
skipWaiting: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Registers the OpenPeeps service worker, wires up the
|
|
25
|
+
* INVALIDATE_QUERIES_PORT bridge, and listens for inbound NAVIGATE_TO
|
|
26
|
+
* notifications from the SW.
|
|
27
|
+
*/
|
|
28
|
+
export declare const registerServiceWorker: (options?: RegisterServiceWorkerOptions) => Promise<ServiceWorkerHandle>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { logger } from '../log/index.js';
|
|
3
|
+
const log = logger('pwa');
|
|
4
|
+
/**
|
|
5
|
+
* Registers the OpenPeeps service worker, wires up the
|
|
6
|
+
* INVALIDATE_QUERIES_PORT bridge, and listens for inbound NAVIGATE_TO
|
|
7
|
+
* notifications from the SW.
|
|
8
|
+
*/
|
|
9
|
+
export const registerServiceWorker = async (options = {}) => {
|
|
10
|
+
const handle = {
|
|
11
|
+
registration: null,
|
|
12
|
+
unregister: async () => false,
|
|
13
|
+
update: async () => undefined,
|
|
14
|
+
skipWaiting: () => undefined,
|
|
15
|
+
};
|
|
16
|
+
if (typeof window === 'undefined' || !('serviceWorker' in navigator)) {
|
|
17
|
+
return handle;
|
|
18
|
+
}
|
|
19
|
+
const swUrl = options.swUrl ?? '/sw.js';
|
|
20
|
+
const scope = options.scope ?? '/';
|
|
21
|
+
try {
|
|
22
|
+
const registration = await navigator.serviceWorker.register(swUrl, {
|
|
23
|
+
scope,
|
|
24
|
+
});
|
|
25
|
+
handle.registration = registration;
|
|
26
|
+
handle.unregister = () => registration.unregister();
|
|
27
|
+
handle.update = () => registration.update().then(() => undefined);
|
|
28
|
+
handle.skipWaiting = () => registration.waiting?.postMessage({ type: 'SKIP_WAITING' });
|
|
29
|
+
if (options.onUpdateAvailable) {
|
|
30
|
+
registration.addEventListener('updatefound', () => {
|
|
31
|
+
const installing = registration.installing;
|
|
32
|
+
installing?.addEventListener('statechange', () => {
|
|
33
|
+
if (installing.state === 'installed' &&
|
|
34
|
+
navigator.serviceWorker.controller) {
|
|
35
|
+
options.onUpdateAvailable?.(registration);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (options.onControllerChange) {
|
|
41
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
42
|
+
options.onControllerChange?.();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
navigator.serviceWorker.addEventListener('message', (event) => {
|
|
46
|
+
const data = (event?.data || {});
|
|
47
|
+
if (data?.type === 'NAVIGATE_TO' && typeof data.url === 'string') {
|
|
48
|
+
options.onNavigate?.(data.url);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// INVALIDATE_QUERIES_PORT bridge — equivalent to the +layout.svelte logic.
|
|
52
|
+
if (navigator.serviceWorker.controller && options.onInvalidateQueries) {
|
|
53
|
+
const channel = new MessageChannel();
|
|
54
|
+
navigator.serviceWorker.controller.postMessage({ type: 'INVALIDATE_QUERIES_PORT' }, [channel.port2]);
|
|
55
|
+
// Do not post SKIP_WAITING to the *active* controller on every load: that
|
|
56
|
+
// can spuriously drive skipWaiting → controllerchange → page reload loops
|
|
57
|
+
// when combined with useServiceWorker({ autoReload: true }).
|
|
58
|
+
channel.port1.onmessage = (event) => {
|
|
59
|
+
log.debug('Invalidating queries for keys:', event.data);
|
|
60
|
+
options.onInvalidateQueries?.(event.data);
|
|
61
|
+
};
|
|
62
|
+
navigator.serviceWorker.controller.postMessage({
|
|
63
|
+
type: 'GET_PENDING_DEEPLINK',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
log.error('Service worker registration failed', err);
|
|
69
|
+
}
|
|
70
|
+
return handle;
|
|
71
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message types exchanged between the page and the OpenPeeps service worker.
|
|
3
|
+
*/
|
|
4
|
+
export type SWMessageFromPage = {
|
|
5
|
+
type: 'SKIP_WAITING';
|
|
6
|
+
} | {
|
|
7
|
+
type: 'INVALIDATE_QUERIES_PORT';
|
|
8
|
+
} | {
|
|
9
|
+
type: 'GET_PENDING_DEEPLINK';
|
|
10
|
+
};
|
|
11
|
+
export type SWMessageToPage = {
|
|
12
|
+
type: 'NAVIGATE_TO';
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/pwa/sw.d.ts
ADDED
package/dist/pwa/sw.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/// <reference no-default-lib="true" />
|
|
2
|
+
/// <reference lib="esnext" />
|
|
3
|
+
/// <reference lib="webworker" />
|
|
4
|
+
import { resolveGotoTarget } from './navigationUrl.js';
|
|
5
|
+
const PUSH_BASE_INVALIDATE_KEYS = [
|
|
6
|
+
['profiles', 'current', 'notifications', 'stats'],
|
|
7
|
+
['profiles', 'current', 'notifications'],
|
|
8
|
+
];
|
|
9
|
+
const dedupeQueryKeys = (keys) => {
|
|
10
|
+
const seen = new Set();
|
|
11
|
+
return keys.filter((key) => {
|
|
12
|
+
const serialized = JSON.stringify(key);
|
|
13
|
+
if (seen.has(serialized))
|
|
14
|
+
return false;
|
|
15
|
+
seen.add(serialized);
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const log = (level, ...args) => console.log(`serviceWorker - ${level}`, ...args);
|
|
20
|
+
// `BASE_URL` is replaced at build time by vite-plugin-pwa or rolldown injection.
|
|
21
|
+
// We fall back to `self.registration.scope` at runtime when not present.
|
|
22
|
+
const base = (() => {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
const fromEnv = self.__OPENPEEPS_BASE__;
|
|
25
|
+
if (fromEnv)
|
|
26
|
+
return fromEnv;
|
|
27
|
+
try {
|
|
28
|
+
return new URL(self.registration.scope).pathname;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return '/';
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
34
|
+
let refreshPort;
|
|
35
|
+
let pendingDeepLink;
|
|
36
|
+
self.addEventListener('message', (event) => {
|
|
37
|
+
const data = event.data;
|
|
38
|
+
if (data?.type === 'SKIP_WAITING') {
|
|
39
|
+
void self.skipWaiting();
|
|
40
|
+
}
|
|
41
|
+
if (data?.type === 'INVALIDATE_QUERIES_PORT') {
|
|
42
|
+
refreshPort = event.ports[0];
|
|
43
|
+
}
|
|
44
|
+
if (data?.type === 'GET_PENDING_DEEPLINK') {
|
|
45
|
+
if (pendingDeepLink) {
|
|
46
|
+
try {
|
|
47
|
+
event.source?.postMessage({
|
|
48
|
+
type: 'NAVIGATE_TO',
|
|
49
|
+
url: pendingDeepLink,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
pendingDeepLink = undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
self.addEventListener('push', (event) => {
|
|
59
|
+
event.waitUntil((async () => {
|
|
60
|
+
const message = (await event?.data?.json()) ?? {};
|
|
61
|
+
const { notification, notificationStats } = message;
|
|
62
|
+
if (refreshPort) {
|
|
63
|
+
refreshPort.postMessage({
|
|
64
|
+
keys: dedupeQueryKeys([
|
|
65
|
+
...PUSH_BASE_INVALIDATE_KEYS,
|
|
66
|
+
...(notification?.invalidateQueries ?? []),
|
|
67
|
+
]),
|
|
68
|
+
notificationStats,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (notificationStats?.unseen !== undefined &&
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
typeof self.navigator.setAppBadge === 'function') {
|
|
74
|
+
try {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
await self.navigator.setAppBadge(notificationStats.unseen);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
log('warn', 'setAppBadge failed', err);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (notification) {
|
|
83
|
+
await self.registration.showNotification(notification.title ?? '', notification.options);
|
|
84
|
+
}
|
|
85
|
+
})());
|
|
86
|
+
});
|
|
87
|
+
self.addEventListener('notificationclick', (event) => {
|
|
88
|
+
const action = event.action ||
|
|
89
|
+
event.notification?.actions?.[0]
|
|
90
|
+
?.action ||
|
|
91
|
+
'';
|
|
92
|
+
event.notification.close();
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
if (!action.startsWith('goto:'))
|
|
95
|
+
return;
|
|
96
|
+
const origin = self.location.origin;
|
|
97
|
+
// Absolute URL for openWindow / Client.navigate; path-only for in-page
|
|
98
|
+
// NAVIGATE_TO — React Router treats scheme URLs as relative pathnames.
|
|
99
|
+
const { absoluteUrl, routerPath } = resolveGotoTarget(action, origin, base ?? '/');
|
|
100
|
+
pendingDeepLink = routerPath;
|
|
101
|
+
event.waitUntil(self.clients
|
|
102
|
+
.matchAll({ type: 'window', includeUncontrolled: true })
|
|
103
|
+
.then(async (clientList) => {
|
|
104
|
+
for (const client of clientList) {
|
|
105
|
+
if (client.url &&
|
|
106
|
+
client.url.startsWith(origin) &&
|
|
107
|
+
'focus' in client) {
|
|
108
|
+
try {
|
|
109
|
+
try {
|
|
110
|
+
client.postMessage({
|
|
111
|
+
type: 'NAVIGATE_TO',
|
|
112
|
+
url: routerPath,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// ignore
|
|
117
|
+
}
|
|
118
|
+
if (client.url !== absoluteUrl && 'navigate' in client) {
|
|
119
|
+
const c = await client
|
|
120
|
+
.navigate(absoluteUrl)
|
|
121
|
+
.catch(() => undefined);
|
|
122
|
+
return (c ?? client).focus();
|
|
123
|
+
}
|
|
124
|
+
return client.focus();
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// try next candidate
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (self.clients.openWindow) {
|
|
132
|
+
await self.clients.openWindow(absoluteUrl).catch(() => undefined);
|
|
133
|
+
}
|
|
134
|
+
const start = Date.now();
|
|
135
|
+
const timeoutMs = 3000;
|
|
136
|
+
const intervalMs = 300;
|
|
137
|
+
async function tryNotifyClient() {
|
|
138
|
+
const list = await self.clients.matchAll({
|
|
139
|
+
type: 'window',
|
|
140
|
+
includeUncontrolled: true,
|
|
141
|
+
});
|
|
142
|
+
for (const c of list) {
|
|
143
|
+
if (c.url && c.url.startsWith(origin)) {
|
|
144
|
+
try {
|
|
145
|
+
c.postMessage({
|
|
146
|
+
type: 'NAVIGATE_TO',
|
|
147
|
+
url: routerPath,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// ignore
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
await c.focus();
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// ignore
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (Date.now() - start < timeoutMs) {
|
|
163
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
164
|
+
return tryNotifyClient();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return tryNotifyClient();
|
|
168
|
+
})
|
|
169
|
+
.catch(() => undefined));
|
|
170
|
+
});
|
|
171
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UseInstallPromptResult {
|
|
2
|
+
/** True when the browser has fired beforeinstallprompt. */
|
|
3
|
+
canInstall: boolean;
|
|
4
|
+
/** Trigger the native install prompt. Returns the user's choice. */
|
|
5
|
+
promptInstall: () => Promise<'accepted' | 'dismissed' | 'unavailable'>;
|
|
6
|
+
/** True when the app is already running in standalone (installed) mode. */
|
|
7
|
+
isStandalone: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** React hook for the PWA "Add to Home Screen" install prompt. */
|
|
10
|
+
export declare function useInstallPrompt(): UseInstallPromptResult;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
const detectStandalone = () => {
|
|
4
|
+
if (typeof window === 'undefined')
|
|
5
|
+
return false;
|
|
6
|
+
if (window.matchMedia?.('(display-mode: standalone)').matches)
|
|
7
|
+
return true;
|
|
8
|
+
// iOS Safari
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
if (window.navigator.standalone)
|
|
11
|
+
return true;
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
/** React hook for the PWA "Add to Home Screen" install prompt. */
|
|
15
|
+
export function useInstallPrompt() {
|
|
16
|
+
const [event, setEvent] = useState(null);
|
|
17
|
+
const [isStandalone, setIsStandalone] = useState(detectStandalone());
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (typeof window === 'undefined')
|
|
20
|
+
return;
|
|
21
|
+
const onBeforeInstall = (e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
setEvent(e);
|
|
24
|
+
};
|
|
25
|
+
const onInstalled = () => {
|
|
26
|
+
setEvent(null);
|
|
27
|
+
setIsStandalone(true);
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener('beforeinstallprompt', onBeforeInstall);
|
|
30
|
+
window.addEventListener('appinstalled', onInstalled);
|
|
31
|
+
return () => {
|
|
32
|
+
window.removeEventListener('beforeinstallprompt', onBeforeInstall);
|
|
33
|
+
window.removeEventListener('appinstalled', onInstalled);
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
const promptInstall = useCallback(async () => {
|
|
37
|
+
if (!event)
|
|
38
|
+
return 'unavailable';
|
|
39
|
+
await event.prompt();
|
|
40
|
+
const choice = await event.userChoice;
|
|
41
|
+
setEvent(null);
|
|
42
|
+
return choice.outcome;
|
|
43
|
+
}, [event]);
|
|
44
|
+
return { canInstall: !!event, promptInstall, isStandalone };
|
|
45
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { NOTIFICATION_STATS_QUERY_KEY, syncAppBadgeCount, } from '../lib/notificationBadge.js';
|
|
4
|
+
const matchesQueryKey = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
5
|
+
/** Keeps the OS app badge aligned with notification stats in React Query. */
|
|
6
|
+
export const useNotificationBadgeSync = () => {
|
|
7
|
+
const queryClient = useQueryClient();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const syncFromCache = () => {
|
|
10
|
+
const stats = queryClient.getQueryData(NOTIFICATION_STATS_QUERY_KEY);
|
|
11
|
+
if (stats?.unseen === undefined)
|
|
12
|
+
return;
|
|
13
|
+
void syncAppBadgeCount(stats.unseen);
|
|
14
|
+
};
|
|
15
|
+
syncFromCache();
|
|
16
|
+
return queryClient.getQueryCache().subscribe((event) => {
|
|
17
|
+
if (!matchesQueryKey(event.query.queryKey, NOTIFICATION_STATS_QUERY_KEY)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
syncFromCache();
|
|
21
|
+
});
|
|
22
|
+
}, [queryClient]);
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RegisterServiceWorkerOptions } from './registration';
|
|
2
|
+
export interface UseServiceWorkerResult {
|
|
3
|
+
isRegistered: boolean;
|
|
4
|
+
isUpdateAvailable: boolean;
|
|
5
|
+
registration: ServiceWorkerRegistration | null;
|
|
6
|
+
/** Skip the waiting SW and reload the page. */
|
|
7
|
+
applyUpdate: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseServiceWorkerOptions extends RegisterServiceWorkerOptions {
|
|
10
|
+
/** Disable registration (e.g. dev mode). */
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/** Reload the page automatically when a new SW takes control. Defaults to true. */
|
|
13
|
+
autoReload?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* React hook wrapper around {@link registerServiceWorker}. Tracks
|
|
17
|
+
* `isUpdateAvailable` so apps can render an "update available" banner.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useServiceWorker({ enabled, autoReload, onUpdateAvailable, onControllerChange, ...options }?: UseServiceWorkerOptions): UseServiceWorkerResult;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { registerServiceWorker, } from './registration.js';
|
|
4
|
+
/**
|
|
5
|
+
* React hook wrapper around {@link registerServiceWorker}. Tracks
|
|
6
|
+
* `isUpdateAvailable` so apps can render an "update available" banner.
|
|
7
|
+
*/
|
|
8
|
+
export function useServiceWorker({ enabled = true, autoReload = true, onUpdateAvailable, onControllerChange, ...options } = {}) {
|
|
9
|
+
const handleRef = useRef(null);
|
|
10
|
+
const [registration, setRegistration] = useState(null);
|
|
11
|
+
const [isUpdateAvailable, setIsUpdateAvailable] = useState(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!enabled || typeof window === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
void registerServiceWorker({
|
|
17
|
+
...options,
|
|
18
|
+
onUpdateAvailable: (reg) => {
|
|
19
|
+
if (cancelled)
|
|
20
|
+
return;
|
|
21
|
+
setIsUpdateAvailable(true);
|
|
22
|
+
onUpdateAvailable?.(reg);
|
|
23
|
+
},
|
|
24
|
+
onControllerChange: () => {
|
|
25
|
+
onControllerChange?.();
|
|
26
|
+
if (autoReload && typeof window !== 'undefined') {
|
|
27
|
+
window.location.reload();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
}).then((handle) => {
|
|
31
|
+
handleRef.current = handle;
|
|
32
|
+
if (!cancelled)
|
|
33
|
+
setRegistration(handle.registration);
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
cancelled = true;
|
|
37
|
+
};
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, [enabled]);
|
|
40
|
+
const applyUpdate = () => {
|
|
41
|
+
handleRef.current?.skipWaiting();
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
isRegistered: !!registration,
|
|
45
|
+
isUpdateAvailable,
|
|
46
|
+
registration,
|
|
47
|
+
applyUpdate,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper that returns a `VitePWAOptions` object pre-wired for the OpenPeeps
|
|
3
|
+
* service worker. Apps install `vite-plugin-pwa` themselves and import this
|
|
4
|
+
* helper to plug in the shared SW + a default web app manifest.
|
|
5
|
+
*
|
|
6
|
+
* This module never imports `vite-plugin-pwa` at runtime so it stays optional
|
|
7
|
+
* for apps that ship their own SW pipeline.
|
|
8
|
+
*/
|
|
9
|
+
export interface OpenpeepsPwaPluginOptions {
|
|
10
|
+
/** Application name (`name` in the manifest). */
|
|
11
|
+
appName: string;
|
|
12
|
+
/** Short application name. Defaults to `appName`. */
|
|
13
|
+
shortName?: string;
|
|
14
|
+
/** App description. */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** Theme color for the manifest. */
|
|
17
|
+
themeColor?: string;
|
|
18
|
+
/** Background color for the manifest. */
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/** Override scope/start URL (defaults to `/`). */
|
|
21
|
+
scope?: string;
|
|
22
|
+
startUrl?: string;
|
|
23
|
+
/** Path to ship the SW under. Defaults to `sw.js`. */
|
|
24
|
+
filename?: string;
|
|
25
|
+
/** Enable in dev mode. */
|
|
26
|
+
devOptions?: {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Add or override icons. */
|
|
30
|
+
icons?: Array<{
|
|
31
|
+
src: string;
|
|
32
|
+
sizes: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
purpose?: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Replace the default manifest entirely. */
|
|
37
|
+
manifest?: Record<string, unknown>;
|
|
38
|
+
/** When false, skip emitting a static web manifest (use `/pwa/manifest.json`). */
|
|
39
|
+
generateManifest?: boolean;
|
|
40
|
+
/** Replace the default workbox `injectManifest` config. */
|
|
41
|
+
injectManifest?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns a config object compatible with `VitePWA({ ... })`.
|
|
45
|
+
*
|
|
46
|
+
* Pass it to `VitePWA(openpeepsPwaPluginConfig({...}))` from
|
|
47
|
+
* `vite-plugin-pwa`. Uses `injectManifest` so the OpenPeeps SW can be the
|
|
48
|
+
* source of truth for push / deep-link / invalidation logic.
|
|
49
|
+
*/
|
|
50
|
+
export declare const openpeepsPwaPluginConfig: (options: OpenpeepsPwaPluginOptions) => Record<string, unknown>;
|
package/dist/pwa/vite.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper that returns a `VitePWAOptions` object pre-wired for the OpenPeeps
|
|
3
|
+
* service worker. Apps install `vite-plugin-pwa` themselves and import this
|
|
4
|
+
* helper to plug in the shared SW + a default web app manifest.
|
|
5
|
+
*
|
|
6
|
+
* This module never imports `vite-plugin-pwa` at runtime so it stays optional
|
|
7
|
+
* for apps that ship their own SW pipeline.
|
|
8
|
+
*/
|
|
9
|
+
const defaultIcons = [
|
|
10
|
+
{ src: '/pwa/icon-192.png', sizes: '192x192', type: 'image/png' },
|
|
11
|
+
{ src: '/pwa/icon-512.png', sizes: '512x512', type: 'image/png' },
|
|
12
|
+
{
|
|
13
|
+
src: '/pwa/icon-maskable.png',
|
|
14
|
+
sizes: '512x512',
|
|
15
|
+
type: 'image/png',
|
|
16
|
+
purpose: 'maskable',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Returns a config object compatible with `VitePWA({ ... })`.
|
|
21
|
+
*
|
|
22
|
+
* Pass it to `VitePWA(openpeepsPwaPluginConfig({...}))` from
|
|
23
|
+
* `vite-plugin-pwa`. Uses `injectManifest` so the OpenPeeps SW can be the
|
|
24
|
+
* source of truth for push / deep-link / invalidation logic.
|
|
25
|
+
*/
|
|
26
|
+
export const openpeepsPwaPluginConfig = (options) => {
|
|
27
|
+
const { appName, shortName = appName, description = appName, themeColor = '#0f172a', backgroundColor = '#ffffff', scope = '/', startUrl = '/', filename = 'sw.js', devOptions, icons = defaultIcons, manifest, generateManifest = true, injectManifest, } = options;
|
|
28
|
+
const resolvedManifest = generateManifest === false
|
|
29
|
+
? false
|
|
30
|
+
: (manifest ?? {
|
|
31
|
+
name: appName,
|
|
32
|
+
short_name: shortName,
|
|
33
|
+
description,
|
|
34
|
+
theme_color: themeColor,
|
|
35
|
+
background_color: backgroundColor,
|
|
36
|
+
display: 'standalone',
|
|
37
|
+
scope,
|
|
38
|
+
start_url: startUrl,
|
|
39
|
+
icons,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
strategies: 'injectManifest',
|
|
43
|
+
registerType: 'prompt',
|
|
44
|
+
filename,
|
|
45
|
+
srcDir: 'node_modules/@openpeepshq/react/dist/pwa',
|
|
46
|
+
manifest: resolvedManifest,
|
|
47
|
+
injectManifest: {
|
|
48
|
+
injectionPoint: undefined,
|
|
49
|
+
...injectManifest,
|
|
50
|
+
},
|
|
51
|
+
devOptions: devOptions ?? { enabled: false },
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native entry: shared hooks/providers only — no web UI components.
|
|
3
|
+
* Metro resolves this via the package `react-native` export condition.
|
|
4
|
+
*/
|
|
5
|
+
export * from './auth/credentials';
|
|
6
|
+
export * from './contexts';
|
|
7
|
+
export { vodMasterPlaylistUrl } from './streaming';
|
|
8
|
+
export * from './lib/postViewCounter';
|
|
9
|
+
export * from './lib/unseenCountsOptimistic';
|
|
10
|
+
export * from './lib/postUnread';
|
|
11
|
+
export * from './lib/notificationBadge';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native entry: shared hooks/providers only — no web UI components.
|
|
3
|
+
* Metro resolves this via the package `react-native` export condition.
|
|
4
|
+
*/
|
|
5
|
+
export * from './auth/credentials/index.js';
|
|
6
|
+
export * from './contexts/index.js';
|
|
7
|
+
export { vodMasterPlaylistUrl } from './streaming.js';
|
|
8
|
+
export * from './lib/postViewCounter.js';
|
|
9
|
+
export * from './lib/unseenCountsOptimistic.js';
|
|
10
|
+
export * from './lib/postUnread.js';
|
|
11
|
+
export * from './lib/notificationBadge.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Crumb } from './types';
|
|
2
|
+
/** Process-wide breadcrumbs store. */
|
|
3
|
+
export declare const breadcrumbsStore: import("./createStore").ReactStore<Crumb[]>;
|
|
4
|
+
export declare const setBreadcrumbs: (crumbs: Crumb[]) => void;
|
|
5
|
+
export declare const useBreadcrumbs: () => Crumb[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createStore, useStore } from './createStore.js';
|
|
2
|
+
/** Process-wide breadcrumbs store. */
|
|
3
|
+
export const breadcrumbsStore = createStore([]);
|
|
4
|
+
export const setBreadcrumbs = (crumbs) => breadcrumbsStore.set(crumbs);
|
|
5
|
+
export const useBreadcrumbs = () => useStore(breadcrumbsStore);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny pub/sub used as a React-friendly equivalent of svelte/store's writable.
|
|
3
|
+
* Lets us replicate the store semantics from @openpeepshq/svelte without
|
|
4
|
+
* requiring zustand/jotai/etc as a runtime dep.
|
|
5
|
+
*/
|
|
6
|
+
export interface ReactStore<T> {
|
|
7
|
+
get: () => T;
|
|
8
|
+
set: (value: T | ((prev: T) => T)) => void;
|
|
9
|
+
subscribe: (listener: () => void) => () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createStore<T>(initial: T): ReactStore<T>;
|
|
12
|
+
export declare function useStore<T>(store: ReactStore<T>): T;
|
|
13
|
+
/**
|
|
14
|
+
* `localStorage`-backed store. Mirrors svelte-persisted-state — value is read
|
|
15
|
+
* synchronously on construction and written on every set.
|
|
16
|
+
*/
|
|
17
|
+
export declare function persistedStore<T>(key: string, initial: T): ReactStore<T> & {
|
|
18
|
+
reset: () => void;
|
|
19
|
+
};
|