@tiledev/sdk-apptile-live-selling 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attribution.d.ts +2 -16
- package/dist/attribution.d.ts.map +1 -1
- package/dist/attribution.js +4 -10
- package/dist/attribution.js.map +1 -1
- package/dist/auctions.d.ts.map +1 -1
- package/dist/auctions.js +11 -42
- package/dist/auctions.js.map +1 -1
- package/dist/cartAttributes.d.ts +0 -10
- package/dist/cartAttributes.d.ts.map +1 -1
- package/dist/cartAttributes.js +1 -20
- package/dist/cartAttributes.js.map +1 -1
- package/dist/client.d.ts +2 -51
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +23 -123
- package/dist/client.js.map +1 -1
- package/dist/clips.d.ts +1 -12
- package/dist/clips.d.ts.map +1 -1
- package/dist/clips.js +6 -114
- package/dist/clips.js.map +1 -1
- package/dist/commentLinks.d.ts +0 -29
- package/dist/commentLinks.d.ts.map +1 -1
- package/dist/commentLinks.js.map +1 -1
- package/dist/engine.native.d.ts.map +1 -1
- package/dist/engine.native.js +845 -17
- package/dist/engine.native.js.map +1 -1
- package/dist/index.d.ts +4 -48
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -240
- package/dist/index.js.map +1 -1
- package/dist/polls.d.ts.map +1 -1
- package/dist/polls.js +0 -3
- package/dist/polls.js.map +1 -1
- package/dist/react/LiveSellingProvider.d.ts +1 -54
- package/dist/react/LiveSellingProvider.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.js +3 -60
- package/dist/react/LiveSellingProvider.js.map +1 -1
- package/dist/react/LiveVideoTarget.d.ts.map +1 -1
- package/dist/react/LiveVideoTarget.js +3 -41
- package/dist/react/LiveVideoTarget.js.map +1 -1
- package/dist/react/index.d.ts +3 -30
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -79
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.web.d.ts +32 -36
- package/dist/react/index.web.d.ts.map +1 -1
- package/dist/react/index.web.js +122 -102
- package/dist/react/index.web.js.map +1 -1
- package/dist/react/useAuctionBidGate.d.ts +6 -62
- package/dist/react/useAuctionBidGate.d.ts.map +1 -1
- package/dist/react/useAuctionBidGate.js +27 -228
- package/dist/react/useAuctionBidGate.js.map +1 -1
- package/dist/react/useAuctionWins.d.ts +4 -14
- package/dist/react/useAuctionWins.d.ts.map +1 -1
- package/dist/react/useAuctionWins.js +5 -16
- package/dist/react/useAuctionWins.js.map +1 -1
- package/dist/react/useClips.d.ts +1 -7
- package/dist/react/useClips.d.ts.map +1 -1
- package/dist/react/useClips.js +7 -20
- package/dist/react/useClips.js.map +1 -1
- package/dist/react/useLiveSession.d.ts +3 -15
- package/dist/react/useLiveSession.d.ts.map +1 -1
- package/dist/react/useLiveSession.js +199 -612
- package/dist/react/useLiveSession.js.map +1 -1
- package/dist/react/useLiveStreams.d.ts.map +1 -1
- package/dist/react/useLiveStreams.js +2 -6
- package/dist/react/useLiveStreams.js.map +1 -1
- package/dist/react/useOngoingLive.d.ts +0 -1
- package/dist/react/useOngoingLive.d.ts.map +1 -1
- package/dist/react/useOngoingLive.js +1 -7
- package/dist/react/useOngoingLive.js.map +1 -1
- package/dist/react/useReplays.d.ts +0 -12
- package/dist/react/useReplays.d.ts.map +1 -1
- package/dist/react/useReplays.js +24 -56
- package/dist/react/useReplays.js.map +1 -1
- package/dist/react/useStreamInfo.d.ts +2 -13
- package/dist/react/useStreamInfo.d.ts.map +1 -1
- package/dist/react/useStreamInfo.js +8 -36
- package/dist/react/useStreamInfo.js.map +1 -1
- package/dist/replays.d.ts +0 -14
- package/dist/replays.d.ts.map +1 -1
- package/dist/replays.js +22 -68
- package/dist/replays.js.map +1 -1
- package/dist/session.d.ts +6 -39
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +22 -209
- package/dist/session.js.map +1 -1
- package/dist/sessionTypes.d.ts +18 -217
- package/dist/sessionTypes.d.ts.map +1 -1
- package/dist/sessionTypes.js +1 -2
- package/dist/sessionTypes.js.map +1 -1
- package/dist/streams.d.ts +1 -27
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +21 -84
- package/dist/streams.js.map +1 -1
- package/dist/types.d.ts +10 -288
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/wire.d.ts +0 -31
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +0 -25
- package/dist/wire.js.map +1 -1
- package/dist/zego.d.ts +1 -3
- package/dist/zego.d.ts.map +1 -1
- package/dist/zego.js +1 -1
- package/package.json +1 -1
- package/dist/auctionComments.d.ts +0 -25
- package/dist/auctionComments.d.ts.map +0 -1
- package/dist/auctionComments.js +0 -28
- package/dist/auctionComments.js.map +0 -1
- package/dist/auctionRules.d.ts +0 -77
- package/dist/auctionRules.d.ts.map +0 -1
- package/dist/auctionRules.js +0 -107
- package/dist/auctionRules.js.map +0 -1
- package/dist/cartExtension.d.ts +0 -39
- package/dist/cartExtension.d.ts.map +0 -1
- package/dist/cartExtension.js +0 -51
- package/dist/cartExtension.js.map +0 -1
- package/dist/checkoutRefused.d.ts +0 -9
- package/dist/checkoutRefused.d.ts.map +0 -1
- package/dist/checkoutRefused.js +0 -16
- package/dist/checkoutRefused.js.map +0 -1
- package/dist/clipsPage.d.ts +0 -29
- package/dist/clipsPage.d.ts.map +0 -1
- package/dist/clipsPage.js +0 -49
- package/dist/clipsPage.js.map +0 -1
- package/dist/commentHistory.d.ts +0 -70
- package/dist/commentHistory.d.ts.map +0 -1
- package/dist/commentHistory.js +0 -133
- package/dist/commentHistory.js.map +0 -1
- package/dist/commentLinkCards.d.ts +0 -11
- package/dist/commentLinkCards.d.ts.map +0 -1
- package/dist/commentLinkCards.js +0 -70
- package/dist/commentLinkCards.js.map +0 -1
- package/dist/giveawayPrize.d.ts +0 -13
- package/dist/giveawayPrize.d.ts.map +0 -1
- package/dist/giveawayPrize.js +0 -18
- package/dist/giveawayPrize.js.map +0 -1
- package/dist/giveawayPrizeLines.d.ts +0 -120
- package/dist/giveawayPrizeLines.d.ts.map +0 -1
- package/dist/giveawayPrizeLines.js +0 -97
- package/dist/giveawayPrizeLines.js.map +0 -1
- package/dist/giveawayPrizes.d.ts +0 -20
- package/dist/giveawayPrizes.d.ts.map +0 -1
- package/dist/giveawayPrizes.js +0 -50
- package/dist/giveawayPrizes.js.map +0 -1
- package/dist/giveawayRoster.d.ts +0 -53
- package/dist/giveawayRoster.d.ts.map +0 -1
- package/dist/giveawayRoster.js +0 -93
- package/dist/giveawayRoster.js.map +0 -1
- package/dist/heldComments.d.ts +0 -40
- package/dist/heldComments.d.ts.map +0 -1
- package/dist/heldComments.js +0 -75
- package/dist/heldComments.js.map +0 -1
- package/dist/hiddenShows.d.ts +0 -44
- package/dist/hiddenShows.d.ts.map +0 -1
- package/dist/hiddenShows.js +0 -53
- package/dist/hiddenShows.js.map +0 -1
- package/dist/linkLots.d.ts +0 -64
- package/dist/linkLots.d.ts.map +0 -1
- package/dist/linkLots.js +0 -84
- package/dist/linkLots.js.map +0 -1
- package/dist/liveHaptics.d.ts +0 -7
- package/dist/liveHaptics.d.ts.map +0 -1
- package/dist/liveHaptics.js +0 -11
- package/dist/liveHaptics.js.map +0 -1
- package/dist/liveHaptics.native.d.ts +0 -7
- package/dist/liveHaptics.native.d.ts.map +0 -1
- package/dist/liveHaptics.native.js +0 -12
- package/dist/liveHaptics.native.js.map +0 -1
- package/dist/livePages.d.ts +0 -176
- package/dist/livePages.d.ts.map +0 -1
- package/dist/livePages.js +0 -216
- package/dist/livePages.js.map +0 -1
- package/dist/liveRoom.d.ts +0 -21
- package/dist/liveRoom.d.ts.map +0 -1
- package/dist/liveRoom.js +0 -28
- package/dist/liveRoom.js.map +0 -1
- package/dist/liveShow.d.ts +0 -65
- package/dist/liveShow.d.ts.map +0 -1
- package/dist/liveShow.js +0 -65
- package/dist/liveShow.js.map +0 -1
- package/dist/missedPolls.d.ts +0 -27
- package/dist/missedPolls.d.ts.map +0 -1
- package/dist/missedPolls.js +0 -16
- package/dist/missedPolls.js.map +0 -1
- package/dist/pageOptions.d.ts +0 -149
- package/dist/pageOptions.d.ts.map +0 -1
- package/dist/pageOptions.js +0 -123
- package/dist/pageOptions.js.map +0 -1
- package/dist/pageTypes.d.ts +0 -185
- package/dist/pageTypes.d.ts.map +0 -1
- package/dist/pageTypes.js +0 -3
- package/dist/pageTypes.js.map +0 -1
- package/dist/phoneTaps.d.ts +0 -25
- package/dist/phoneTaps.d.ts.map +0 -1
- package/dist/phoneTaps.js +0 -47
- package/dist/phoneTaps.js.map +0 -1
- package/dist/pipWindow.d.ts +0 -85
- package/dist/pipWindow.d.ts.map +0 -1
- package/dist/pipWindow.js +0 -88
- package/dist/pipWindow.js.map +0 -1
- package/dist/react/clocks.d.ts +0 -29
- package/dist/react/clocks.d.ts.map +0 -1
- package/dist/react/clocks.js +0 -124
- package/dist/react/clocks.js.map +0 -1
- package/dist/react/navigation.d.ts +0 -13
- package/dist/react/navigation.d.ts.map +0 -1
- package/dist/react/navigation.js +0 -7
- package/dist/react/navigation.js.map +0 -1
- package/dist/react/platformSession.d.ts +0 -16
- package/dist/react/platformSession.d.ts.map +0 -1
- package/dist/react/platformSession.js +0 -28
- package/dist/react/platformSession.js.map +0 -1
- package/dist/react/platformSession.web.d.ts +0 -35
- package/dist/react/platformSession.web.d.ts.map +0 -1
- package/dist/react/platformSession.web.js +0 -148
- package/dist/react/platformSession.web.js.map +0 -1
- package/dist/react/replayPlayer.d.ts +0 -83
- package/dist/react/replayPlayer.d.ts.map +0 -1
- package/dist/react/replayPlayer.js +0 -315
- package/dist/react/replayPlayer.js.map +0 -1
- package/dist/react/share.d.ts +0 -22
- package/dist/react/share.d.ts.map +0 -1
- package/dist/react/share.js +0 -45
- package/dist/react/share.js.map +0 -1
- package/dist/react/shopifyProviders.d.ts +0 -82
- package/dist/react/shopifyProviders.d.ts.map +0 -1
- package/dist/react/shopifyProviders.js +0 -113
- package/dist/react/shopifyProviders.js.map +0 -1
- package/dist/react/showPages.d.ts +0 -106
- package/dist/react/showPages.d.ts.map +0 -1
- package/dist/react/showPages.js +0 -166
- package/dist/react/showPages.js.map +0 -1
- package/dist/react/showPagesOnDevice.d.ts +0 -18
- package/dist/react/showPagesOnDevice.d.ts.map +0 -1
- package/dist/react/showPagesOnDevice.js +0 -31
- package/dist/react/showPagesOnDevice.js.map +0 -1
- package/dist/react/startSignIn.d.ts +0 -3
- package/dist/react/startSignIn.d.ts.map +0 -1
- package/dist/react/startSignIn.js +0 -19
- package/dist/react/startSignIn.js.map +0 -1
- package/dist/react/systemPictureInPicture.d.ts +0 -34
- package/dist/react/systemPictureInPicture.d.ts.map +0 -1
- package/dist/react/systemPictureInPicture.js +0 -93
- package/dist/react/systemPictureInPicture.js.map +0 -1
- package/dist/react/useAccountName.d.ts +0 -8
- package/dist/react/useAccountName.d.ts.map +0 -1
- package/dist/react/useAccountName.js +0 -49
- package/dist/react/useAccountName.js.map +0 -1
- package/dist/react/useClipsPage.d.ts +0 -47
- package/dist/react/useClipsPage.d.ts.map +0 -1
- package/dist/react/useClipsPage.js +0 -130
- package/dist/react/useClipsPage.js.map +0 -1
- package/dist/react/useCommentLinkCards.d.ts +0 -6
- package/dist/react/useCommentLinkCards.d.ts.map +0 -1
- package/dist/react/useCommentLinkCards.js +0 -67
- package/dist/react/useCommentLinkCards.js.map +0 -1
- package/dist/react/useFeaturedClip.d.ts +0 -15
- package/dist/react/useFeaturedClip.d.ts.map +0 -1
- package/dist/react/useFeaturedClip.js +0 -52
- package/dist/react/useFeaturedClip.js.map +0 -1
- package/dist/react/useGiveawayEntry.d.ts +0 -59
- package/dist/react/useGiveawayEntry.d.ts.map +0 -1
- package/dist/react/useGiveawayEntry.js +0 -170
- package/dist/react/useGiveawayEntry.js.map +0 -1
- package/dist/react/useGiveawayPrize.d.ts +0 -12
- package/dist/react/useGiveawayPrize.d.ts.map +0 -1
- package/dist/react/useGiveawayPrize.js +0 -53
- package/dist/react/useGiveawayPrize.js.map +0 -1
- package/dist/react/useGiveawayPrizes.d.ts +0 -4
- package/dist/react/useGiveawayPrizes.d.ts.map +0 -1
- package/dist/react/useGiveawayPrizes.js +0 -58
- package/dist/react/useGiveawayPrizes.js.map +0 -1
- package/dist/react/useHiddenShows.d.ts +0 -10
- package/dist/react/useHiddenShows.d.ts.map +0 -1
- package/dist/react/useHiddenShows.js +0 -30
- package/dist/react/useHiddenShows.js.map +0 -1
- package/dist/react/useKeepScreenAwake.d.ts +0 -2
- package/dist/react/useKeepScreenAwake.d.ts.map +0 -1
- package/dist/react/useKeepScreenAwake.js +0 -34
- package/dist/react/useKeepScreenAwake.js.map +0 -1
- package/dist/react/useLiveAuction.d.ts +0 -106
- package/dist/react/useLiveAuction.d.ts.map +0 -1
- package/dist/react/useLiveAuction.js +0 -255
- package/dist/react/useLiveAuction.js.map +0 -1
- package/dist/react/useLiveChat.d.ts +0 -110
- package/dist/react/useLiveChat.d.ts.map +0 -1
- package/dist/react/useLiveChat.js +0 -230
- package/dist/react/useLiveChat.js.map +0 -1
- package/dist/react/useLiveGiveawaysAndPolls.d.ts +0 -95
- package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +0 -1
- package/dist/react/useLiveGiveawaysAndPolls.js +0 -225
- package/dist/react/useLiveGiveawaysAndPolls.js.map +0 -1
- package/dist/react/useLivePage.d.ts +0 -136
- package/dist/react/useLivePage.d.ts.map +0 -1
- package/dist/react/useLivePage.js +0 -319
- package/dist/react/useLivePage.js.map +0 -1
- package/dist/react/useLiveShop.d.ts +0 -97
- package/dist/react/useLiveShop.d.ts.map +0 -1
- package/dist/react/useLiveShop.js +0 -197
- package/dist/react/useLiveShop.js.map +0 -1
- package/dist/react/useLiveShow.d.ts +0 -3
- package/dist/react/useLiveShow.d.ts.map +0 -1
- package/dist/react/useLiveShow.js +0 -21
- package/dist/react/useLiveShow.js.map +0 -1
- package/dist/react/useMySilentAuctionBids.d.ts +0 -29
- package/dist/react/useMySilentAuctionBids.d.ts.map +0 -1
- package/dist/react/useMySilentAuctionBids.js +0 -157
- package/dist/react/useMySilentAuctionBids.js.map +0 -1
- package/dist/react/useReplayPage.d.ts +0 -155
- package/dist/react/useReplayPage.d.ts.map +0 -1
- package/dist/react/useReplayPage.js +0 -580
- package/dist/react/useReplayPage.js.map +0 -1
- package/dist/react/useSilentAuctionLot.d.ts +0 -44
- package/dist/react/useSilentAuctionLot.d.ts.map +0 -1
- package/dist/react/useSilentAuctionLot.js +0 -168
- package/dist/react/useSilentAuctionLot.js.map +0 -1
- package/dist/react/useSilentAuctionLots.d.ts +0 -41
- package/dist/react/useSilentAuctionLots.d.ts.map +0 -1
- package/dist/react/useSilentAuctionLots.js +0 -64
- package/dist/react/useSilentAuctionLots.js.map +0 -1
- package/dist/react/useSilentAuctionRounds.d.ts +0 -15
- package/dist/react/useSilentAuctionRounds.d.ts.map +0 -1
- package/dist/react/useSilentAuctionRounds.js +0 -44
- package/dist/react/useSilentAuctionRounds.js.map +0 -1
- package/dist/replayPages.d.ts +0 -31
- package/dist/replayPages.d.ts.map +0 -1
- package/dist/replayPages.js +0 -34
- package/dist/replayPages.js.map +0 -1
- package/dist/shopifyCommerce.d.ts +0 -204
- package/dist/shopifyCommerce.d.ts.map +0 -1
- package/dist/shopifyCommerce.js +0 -217
- package/dist/shopifyCommerce.js.map +0 -1
- package/dist/shopifyIdentity.d.ts +0 -61
- package/dist/shopifyIdentity.d.ts.map +0 -1
- package/dist/shopifyIdentity.js +0 -61
- package/dist/shopifyIdentity.js.map +0 -1
- package/dist/shopifyIds.d.ts +0 -9
- package/dist/shopifyIds.d.ts.map +0 -1
- package/dist/shopifyIds.js +0 -18
- package/dist/shopifyIds.js.map +0 -1
- package/dist/showCredit.d.ts +0 -89
- package/dist/showCredit.d.ts.map +0 -1
- package/dist/showCredit.js +0 -120
- package/dist/showCredit.js.map +0 -1
- package/dist/showLinks.d.ts +0 -24
- package/dist/showLinks.d.ts.map +0 -1
- package/dist/showLinks.js +0 -23
- package/dist/showLinks.js.map +0 -1
- package/dist/showLots.d.ts +0 -44
- package/dist/showLots.d.ts.map +0 -1
- package/dist/showLots.js +0 -70
- package/dist/showLots.js.map +0 -1
- package/dist/showNames.d.ts +0 -77
- package/dist/showNames.d.ts.map +0 -1
- package/dist/showNames.js +0 -143
- package/dist/showNames.js.map +0 -1
- package/dist/showPages.d.ts +0 -56
- package/dist/showPages.d.ts.map +0 -1
- package/dist/showPages.js +0 -48
- package/dist/showPages.js.map +0 -1
- package/dist/silentAuctionFeed.d.ts +0 -49
- package/dist/silentAuctionFeed.d.ts.map +0 -1
- package/dist/silentAuctionFeed.js +0 -242
- package/dist/silentAuctionFeed.js.map +0 -1
- package/dist/silentAuctionRules.d.ts +0 -253
- package/dist/silentAuctionRules.d.ts.map +0 -1
- package/dist/silentAuctionRules.js +0 -489
- package/dist/silentAuctionRules.js.map +0 -1
- package/dist/silentAuctions.d.ts +0 -65
- package/dist/silentAuctions.d.ts.map +0 -1
- package/dist/silentAuctions.js +0 -272
- package/dist/silentAuctions.js.map +0 -1
- package/dist/storeData.d.ts +0 -16
- package/dist/storeData.d.ts.map +0 -1
- package/dist/storeData.js +0 -19
- package/dist/storeData.js.map +0 -1
- package/dist/ui/BubbleFrame.d.ts +0 -38
- package/dist/ui/BubbleFrame.d.ts.map +0 -1
- package/dist/ui/BubbleFrame.js +0 -181
- package/dist/ui/BubbleFrame.js.map +0 -1
- package/dist/ui/LiveBubble.d.ts +0 -43
- package/dist/ui/LiveBubble.d.ts.map +0 -1
- package/dist/ui/LiveBubble.js +0 -116
- package/dist/ui/LiveBubble.js.map +0 -1
- package/dist/ui/ReplayBubble.d.ts +0 -23
- package/dist/ui/ReplayBubble.d.ts.map +0 -1
- package/dist/ui/ReplayBubble.js +0 -71
- package/dist/ui/ReplayBubble.js.map +0 -1
- package/dist/ui.d.ts +0 -27
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -34
- package/dist/ui.js.map +0 -1
- package/dist/unreadRoomMessages.d.ts +0 -26
- package/dist/unreadRoomMessages.d.ts.map +0 -1
- package/dist/unreadRoomMessages.js +0 -62
- package/dist/unreadRoomMessages.js.map +0 -1
- package/dist/viewerRules.d.ts +0 -38
- package/dist/viewerRules.d.ts.map +0 -1
- package/dist/viewerRules.js +0 -46
- package/dist/viewerRules.js.map +0 -1
- package/dist/winsAttribution.d.ts +0 -22
- package/dist/winsAttribution.d.ts.map +0 -1
- package/dist/winsAttribution.js +0 -49
- package/dist/winsAttribution.js.map +0 -1
- package/dist/zegoEngine.d.ts +0 -173
- package/dist/zegoEngine.d.ts.map +0 -1
- package/dist/zegoEngine.js +0 -1069
- package/dist/zegoEngine.js.map +0 -1
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGiveawayEntry = useGiveawayEntry;
|
|
4
|
-
/**
|
|
5
|
-
* `useGiveawayEntry` — the shopper's part in a giveaway, on one screen (0.9.0, "SDK move 8").
|
|
6
|
-
*
|
|
7
|
-
* Every live screen with a giveaway wrote the same flow around `actions.enterGiveaway`, and the copies
|
|
8
|
-
* drifted (Freckled Poppy's Live screen inline, ENG-583; amore-v2's `useLiveGiveawaysAndPolls`):
|
|
9
|
-
*
|
|
10
|
-
* - **The entry sheet:** open and closed by the screen, and closed by the host's draw (an Enter button
|
|
11
|
-
* for a giveaway that is over) or the giveaway going (retracted, the show ended).
|
|
12
|
-
* - **Entering needs a sign-in.** `signInToEnter()` starts the app's sign-in; once the shopper is back
|
|
13
|
-
* on this screen signed in (`isLoggedIn` and `screenOnShow`), the sheet opens again if the giveaway
|
|
14
|
-
* is still open and not drawn, and the shopper taps Enter themselves. Back on show still signed out
|
|
15
|
-
* (a Sign In page closed, a system sheet dismissed: `screenOnShow` false, then true), nothing reopens,
|
|
16
|
-
* and a later sign-in elsewhere doesn't raise it.
|
|
17
|
-
* - **The entry** (`enter`): `entering` while it goes, `entryFailed` when the host didn't take it. With
|
|
18
|
-
* a name the shopper typed ("Entering As:"), the name is saved first and the entry goes once the
|
|
19
|
-
* session holds it, as the session sends the entry under the name it holds at that moment.
|
|
20
|
-
* - **The draw** (`draw`): handed over once its roster is ready (the session waits for it, ENG-705), the
|
|
21
|
-
* same object until another winner; `youWon` from the session (`giveaway.result.isYou`). A draw already
|
|
22
|
-
* on the session as the screen opens happened while the shopper was elsewhere: it is let go rather
|
|
23
|
-
* than played late.
|
|
24
|
-
*
|
|
25
|
-
* It takes the session as a value rather than reading it, as the clocks take a number: a test drives it
|
|
26
|
-
* with a plain object, and it loads where the native session can't (an app's test runner, the web).
|
|
27
|
-
* The screen decides when a sheet can show (`screenOnShow`): a sheet is a `Modal`, which can't open
|
|
28
|
-
* over a Sign In page or while another sheet is still going.
|
|
29
|
-
*/
|
|
30
|
-
const react_1 = require("react");
|
|
31
|
-
const client_1 = require("../client");
|
|
32
|
-
const sessionTypes_1 = require("../sessionTypes");
|
|
33
|
-
const startSignIn_1 = require("./startSignIn");
|
|
34
|
-
function useGiveawayEntry(options) {
|
|
35
|
-
var _a, _b, _c, _d, _e;
|
|
36
|
-
const { session, canEnter, isLoggedIn } = options;
|
|
37
|
-
const screenOnShow = (_a = options.screenOnShow) !== null && _a !== void 0 ? _a : true;
|
|
38
|
-
const giveaway = (_b = session.giveaway) !== null && _b !== void 0 ? _b : sessionTypes_1.IDLE_GIVEAWAY;
|
|
39
|
-
const { dismissGiveawayResult } = session.actions;
|
|
40
|
-
const result = giveaway.result;
|
|
41
|
-
const drawn = !!result;
|
|
42
|
-
const open = canEnter && ((_c = giveaway.active) === null || _c === void 0 ? void 0 : _c.status) === 'active' && !drawn ? giveaway.active : null;
|
|
43
|
-
/** What the actions read when they run, as it is now. */
|
|
44
|
-
const latest = (0, react_1.useRef)({ options, actions: session.actions });
|
|
45
|
-
latest.current = { options, actions: session.actions };
|
|
46
|
-
const mounted = (0, react_1.useRef)(true);
|
|
47
|
-
(0, react_1.useEffect)(() => () => {
|
|
48
|
-
mounted.current = false;
|
|
49
|
-
}, []);
|
|
50
|
-
// ─── The entry sheet ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
-
const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
|
|
52
|
-
const [entering, setEntering] = (0, react_1.useState)(false);
|
|
53
|
-
const [entryFailed, setEntryFailed] = (0, react_1.useState)(false);
|
|
54
|
-
// The host's draw closes the sheet (an Enter button for a giveaway that is over), and so does the
|
|
55
|
-
// giveaway going (retracted, or the show ending).
|
|
56
|
-
(0, react_1.useEffect)(() => {
|
|
57
|
-
if (drawn || !open)
|
|
58
|
-
setSheetOpen(false);
|
|
59
|
-
}, [drawn, open]);
|
|
60
|
-
const openSheet = (0, react_1.useCallback)(() => {
|
|
61
|
-
setEntryFailed(false);
|
|
62
|
-
setSheetOpen(true);
|
|
63
|
-
}, []);
|
|
64
|
-
const closeSheet = (0, react_1.useCallback)(() => setSheetOpen(false), []);
|
|
65
|
-
// ─── Entering ────────────────────────────────────────────────────────────────────────────────────
|
|
66
|
-
const enterNow = (0, react_1.useCallback)(async () => {
|
|
67
|
-
var _a;
|
|
68
|
-
setEntryFailed(false);
|
|
69
|
-
setEntering(true);
|
|
70
|
-
let entered = false;
|
|
71
|
-
try {
|
|
72
|
-
const answer = await latest.current.actions.enterGiveaway((_a = latest.current.options.cartId) !== null && _a !== void 0 ? _a : null);
|
|
73
|
-
entered = (answer === null || answer === void 0 ? void 0 : answer.entered) === true;
|
|
74
|
-
}
|
|
75
|
-
catch (caught) {
|
|
76
|
-
(0, client_1.getLogger)().error(caught, { at: 'giveawayEntry.enter' });
|
|
77
|
-
}
|
|
78
|
-
if (!mounted.current)
|
|
79
|
-
return;
|
|
80
|
-
setEntering(false);
|
|
81
|
-
if (!entered)
|
|
82
|
-
setEntryFailed(true);
|
|
83
|
-
}, []);
|
|
84
|
-
// "Entering As:": the name is saved first, and the entry goes once the session holds it.
|
|
85
|
-
const named = !!((_d = session.viewerName) === null || _d === void 0 ? void 0 : _d.trim());
|
|
86
|
-
const [enterOnceNamed, setEnterOnceNamed] = (0, react_1.useState)(false);
|
|
87
|
-
(0, react_1.useEffect)(() => {
|
|
88
|
-
if (!enterOnceNamed || !named)
|
|
89
|
-
return;
|
|
90
|
-
setEnterOnceNamed(false);
|
|
91
|
-
void enterNow();
|
|
92
|
-
}, [enterOnceNamed, named, enterNow]);
|
|
93
|
-
const enter = (0, react_1.useCallback)((typedName) => {
|
|
94
|
-
if (!typedName) {
|
|
95
|
-
void enterNow();
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
setEntryFailed(false);
|
|
99
|
-
setEntering(true);
|
|
100
|
-
void (async () => {
|
|
101
|
-
const saved = await latest.current.actions.chooseViewerName(typedName).catch(() => null);
|
|
102
|
-
if (!mounted.current)
|
|
103
|
-
return;
|
|
104
|
-
if (saved)
|
|
105
|
-
setEnterOnceNamed(true);
|
|
106
|
-
else {
|
|
107
|
-
setEntering(false);
|
|
108
|
-
setEntryFailed(true);
|
|
109
|
-
}
|
|
110
|
-
})();
|
|
111
|
-
}, [enterNow]);
|
|
112
|
-
// ─── Signing in to enter, then back to the sheet ─────────────────────────────────────────────────
|
|
113
|
-
/** The shopper asked to enter signed out: once they are back here signed in, the sheet opens again. */
|
|
114
|
-
const [reopenAfterSignIn, setReopenAfterSignIn] = (0, react_1.useState)(false);
|
|
115
|
-
const signInToEnter = (0, react_1.useCallback)(() => {
|
|
116
|
-
setReopenAfterSignIn(true);
|
|
117
|
-
(0, startSignIn_1.startTheSignIn)(latest.current.options.startSignIn, 'giveawayEntry.startSignIn');
|
|
118
|
-
}, []);
|
|
119
|
-
const wasOnShow = (0, react_1.useRef)(screenOnShow);
|
|
120
|
-
(0, react_1.useEffect)(() => {
|
|
121
|
-
const cameBackOnShow = screenOnShow && !wasOnShow.current;
|
|
122
|
-
wasOnShow.current = screenOnShow;
|
|
123
|
-
if (!reopenAfterSignIn)
|
|
124
|
-
return;
|
|
125
|
-
// Drawn, retracted or ended meanwhile: there is nothing to enter any more.
|
|
126
|
-
if (!open)
|
|
127
|
-
setReopenAfterSignIn(false);
|
|
128
|
-
else if (isLoggedIn && screenOnShow) {
|
|
129
|
-
setReopenAfterSignIn(false);
|
|
130
|
-
openSheet();
|
|
131
|
-
}
|
|
132
|
-
// Back on show without signing in: nothing reopens, now or after a later sign-in elsewhere.
|
|
133
|
-
else if (!isLoggedIn && cameBackOnShow)
|
|
134
|
-
setReopenAfterSignIn(false);
|
|
135
|
-
}, [reopenAfterSignIn, open, isLoggedIn, screenOnShow, openSheet]);
|
|
136
|
-
// ─── The draw ────────────────────────────────────────────────────────────────────────────────────
|
|
137
|
-
const ready = !!result && result.entrantNamesReady;
|
|
138
|
-
const winnerName = (_e = result === null || result === void 0 ? void 0 : result.winnerName) !== null && _e !== void 0 ? _e : null;
|
|
139
|
-
const resultNow = (0, react_1.useRef)(result);
|
|
140
|
-
resultNow.current = result;
|
|
141
|
-
const draw = (0, react_1.useMemo)(() => {
|
|
142
|
-
const drawnNow = resultNow.current;
|
|
143
|
-
return ready && drawnNow ? { winnerName: drawnNow.winnerName, entrantNames: drawnNow.entrantNames } : null;
|
|
144
|
-
// A new draw only for a new winner or readiness: the roster never changes once ready (the session's
|
|
145
|
-
// promise), and the session hands over a new `result` object on every read of the record.
|
|
146
|
-
}, [ready, winnerName]);
|
|
147
|
-
const youWon = !!draw && !!(result === null || result === void 0 ? void 0 : result.isYou);
|
|
148
|
-
// A draw already on the session as the screen opens happened while the shopper was elsewhere.
|
|
149
|
-
const drawOnArrival = (0, react_1.useRef)(drawn);
|
|
150
|
-
(0, react_1.useEffect)(() => {
|
|
151
|
-
if (!drawOnArrival.current)
|
|
152
|
-
return;
|
|
153
|
-
drawOnArrival.current = false;
|
|
154
|
-
dismissGiveawayResult();
|
|
155
|
-
}, [dismissGiveawayResult]);
|
|
156
|
-
return {
|
|
157
|
-
open,
|
|
158
|
-
sheetOpen: sheetOpen && !!open,
|
|
159
|
-
openSheet,
|
|
160
|
-
closeSheet,
|
|
161
|
-
enter,
|
|
162
|
-
entering,
|
|
163
|
-
entryFailed,
|
|
164
|
-
signInToEnter,
|
|
165
|
-
draw,
|
|
166
|
-
youWon,
|
|
167
|
-
drawDone: dismissGiveawayResult,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=useGiveawayEntry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGiveawayEntry.js","sourceRoot":"","sources":["../../src/react/useGiveawayEntry.ts"],"names":[],"mappings":";;AA8FA,4CA2IC;AAzOD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iCAA0E;AAE1E,sCAAsC;AACtC,kDAAgD;AAGhD,+CAA+C;AA8D/C,SAAgB,gBAAgB,CAAC,OAAgC;;IAC/D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,IAAI,CAAC;IAClD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,4BAAa,CAAC;IACnD,MAAM,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAElD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IACvB,MAAM,IAAI,GAAG,QAAQ,IAAI,CAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM,MAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjG,yDAAyD;IACzD,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,MAAM,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,E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J,SAAS,EAAE,SAAS,IAAI,CAAC,CAAC,IAAI;QAC9B,SAAS;QACT,UAAU;QACV,KAAK;QACL,QAAQ;QACR,WAAW;QACX,aAAa;QACb,IAAI;QACJ,MAAM;QACN,QAAQ,EAAE,qBAAqB;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { LiveProduct, LiveProductVariant } from '../sessionTypes';
|
|
2
|
-
import type { LiveGiveaway } from '../types';
|
|
3
|
-
export interface UseGiveawayPrizeState<TRaw = unknown> {
|
|
4
|
-
/** The prize as the adapter reads it (your own product on `raw`); null until it answers, or if it can't. */
|
|
5
|
-
product: LiveProduct<TRaw> | null;
|
|
6
|
-
/** The variant given away, among the product's; null when the record names none or it's gone. */
|
|
7
|
-
variant: LiveProductVariant | null;
|
|
8
|
-
/** The read's failure, or null. Not logged. */
|
|
9
|
-
readError: unknown;
|
|
10
|
-
}
|
|
11
|
-
export declare function useGiveawayPrize<TRaw = unknown>(giveaway: Pick<LiveGiveaway, 'storeProductId' | 'variantId'> | null | undefined): UseGiveawayPrizeState<TRaw>;
|
|
12
|
-
//# sourceMappingURL=useGiveawayPrize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGiveawayPrize.d.ts","sourceRoot":"","sources":["../../src/react/useGiveawayPrize.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,OAAO;IACnD,4GAA4G;IAC5G,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClC,iGAAiG;IACjG,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAG,OAAO,EAC7C,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9E,qBAAqB,CAAC,IAAI,CAAC,CA4B7B"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGiveawayPrize = useGiveawayPrize;
|
|
4
|
-
/**
|
|
5
|
-
* `useGiveawayPrize(giveaway)` — the giveaway's prize in the catalogue (0.9.0, "SDK move 8").
|
|
6
|
-
*
|
|
7
|
-
* The host picks a prize from the whole catalogue, kept apart from the show's lots, so it is usually
|
|
8
|
-
* not one of `session.products`. The record names it, its variant, its price and its photo (0.9.0), so
|
|
9
|
-
* a sheet is complete enough to enter from at once; the catalogue adds the description and the
|
|
10
|
-
* variant's price now. Freckled Poppy and amore-v2 each read it by hand.
|
|
11
|
-
*
|
|
12
|
-
* One `productsByIds` read through the configured commerce adapter when the prize changes. Cleared
|
|
13
|
-
* first, because the host can change the prize and the last prize's photo mustn't stand in for the new
|
|
14
|
-
* one; an answer for an earlier prize is dropped. `variant` is the one given away, the record's bare id
|
|
15
|
-
* matched to the catalogue's (`isTheVariant`). A failed read comes back in `readError`, for the app to
|
|
16
|
-
* report, as `streams.destinationFor`'s does; nothing is logged here. No adapter: nothing is read.
|
|
17
|
-
*/
|
|
18
|
-
const react_1 = require("react");
|
|
19
|
-
const client_1 = require("../client");
|
|
20
|
-
const giveawayPrize_1 = require("../giveawayPrize");
|
|
21
|
-
function useGiveawayPrize(giveaway) {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
const prizeId = (_a = giveaway === null || giveaway === void 0 ? void 0 : giveaway.storeProductId) !== null && _a !== void 0 ? _a : null;
|
|
24
|
-
const recordVariantId = (_b = giveaway === null || giveaway === void 0 ? void 0 : giveaway.variantId) !== null && _b !== void 0 ? _b : null;
|
|
25
|
-
const [answer, setAnswer] = (0, react_1.useState)(null);
|
|
26
|
-
const [readError, setReadError] = (0, react_1.useState)(null);
|
|
27
|
-
(0, react_1.useEffect)(() => {
|
|
28
|
-
setAnswer(null);
|
|
29
|
-
setReadError(null);
|
|
30
|
-
const commerce = (0, client_1.getCommerce)();
|
|
31
|
-
if (!prizeId || !commerce)
|
|
32
|
-
return;
|
|
33
|
-
let stillWanted = true;
|
|
34
|
-
commerce
|
|
35
|
-
.productsByIds([prizeId])
|
|
36
|
-
.then(([product]) => {
|
|
37
|
-
var _a;
|
|
38
|
-
if (stillWanted)
|
|
39
|
-
setAnswer({ prizeId, product: (_a = product) !== null && _a !== void 0 ? _a : null });
|
|
40
|
-
})
|
|
41
|
-
.catch((caught) => {
|
|
42
|
-
if (stillWanted)
|
|
43
|
-
setReadError(caught);
|
|
44
|
-
});
|
|
45
|
-
return () => {
|
|
46
|
-
stillWanted = false;
|
|
47
|
-
};
|
|
48
|
-
}, [prizeId]);
|
|
49
|
-
const product = answer && answer.prizeId === prizeId ? answer.product : null;
|
|
50
|
-
const variant = (0, react_1.useMemo)(() => (0, giveawayPrize_1.givenAwayVariant)(product, recordVariantId), [product, recordVariantId]);
|
|
51
|
-
return (0, react_1.useMemo)(() => ({ product, variant, readError }), [product, variant, readError]);
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=useGiveawayPrize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGiveawayPrize.js","sourceRoot":"","sources":["../../src/react/useGiveawayPrize.ts"],"names":[],"mappings":";;AA8BA,4CA8BC;AA5DD;;;;;;;;;;;;;GAaG;AACH,iCAAqD;AAErD,sCAAwC;AACxC,oDAAoD;AAapD,SAAgB,gBAAgB,CAC9B,QAA+E;;IAE/E,MAAM,OAAO,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,mCAAI,IAAI,CAAC;IACjD,MAAM,eAAe,GAAG,MAAA,QAAQ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Ae,CAAC,CAAC,CAAC;IACtG,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGiveawayPrizes.d.ts","sourceRoot":"","sources":["../../src/react/useGiveawayPrizes.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,IAAI,CAqC1E"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGiveawayPrizes = useGiveawayPrizes;
|
|
4
|
-
/**
|
|
5
|
-
* `useGiveawayPrizes({ active })` — collects the signed-in shopper's giveaway prizes into their cart each
|
|
6
|
-
* time the cart comes on screen (0.16.0, `collectGiveawayPrizes`), and re-reads the cart when one landed.
|
|
7
|
-
* Owed something with no cart yet, it makes one, adopts it, and collects into it. At most once per 5 s.
|
|
8
|
-
* `active` defaults to the screen's focus, so a cart tab that stays mounted collects on every visit (as
|
|
9
|
-
* 33.2.0 did); pass it to decide yourself.
|
|
10
|
-
*/
|
|
11
|
-
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
12
|
-
const navigation_1 = require("./navigation");
|
|
13
|
-
const react_1 = require("react");
|
|
14
|
-
const giveawayPrizes_1 = require("../giveawayPrizes");
|
|
15
|
-
const MIN_GAP_MS = 5000;
|
|
16
|
-
function useGiveawayPrizes(options = {}) {
|
|
17
|
-
var _a, _b, _c, _d, _e;
|
|
18
|
-
const focused = (0, navigation_1.useIsFocused)();
|
|
19
|
-
const active = (_a = options.active) !== null && _a !== void 0 ? _a : focused;
|
|
20
|
-
const { ready } = (0, sdk_shopify_1.useShopify)();
|
|
21
|
-
const { cart, adopt, refresh, loading } = (0, sdk_shopify_1.useCart)();
|
|
22
|
-
const customer = (0, sdk_shopify_1.useCustomer)();
|
|
23
|
-
const customerId = customer.loggedIn ? (_c = (_b = customer.customer) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : null : null;
|
|
24
|
-
// Read through refs, so a line changing while the cart is open doesn't collect again.
|
|
25
|
-
const latest = (0, react_1.useRef)({ cartId: (_d = cart === null || cart === void 0 ? void 0 : cart.id) !== null && _d !== void 0 ? _d : null, adopt, refresh });
|
|
26
|
-
latest.current = { cartId: (_e = cart === null || cart === void 0 ? void 0 : cart.id) !== null && _e !== void 0 ? _e : null, adopt, refresh };
|
|
27
|
-
const lastAt = (0, react_1.useRef)(0);
|
|
28
|
-
const busy = (0, react_1.useRef)(false);
|
|
29
|
-
// "No cart" is only true once the saved cart has been restored.
|
|
30
|
-
const settled = ready && !loading;
|
|
31
|
-
const collect = (0, react_1.useCallback)(async () => {
|
|
32
|
-
if (!customerId || !settled || busy.current || Date.now() - lastAt.current < MIN_GAP_MS)
|
|
33
|
-
return;
|
|
34
|
-
busy.current = true;
|
|
35
|
-
try {
|
|
36
|
-
let result = await (0, giveawayPrizes_1.collectGiveawayPrizes)(customerId, latest.current.cartId);
|
|
37
|
-
if (result && result.pending > 0 && !latest.current.cartId) {
|
|
38
|
-
const created = await sdk_shopify_1.shopify.cart.create({});
|
|
39
|
-
await latest.current.adopt(created.id);
|
|
40
|
-
result = await (0, giveawayPrizes_1.collectGiveawayPrizes)(customerId, created.id);
|
|
41
|
-
}
|
|
42
|
-
if (result === null || result === void 0 ? void 0 : result.delivered.length)
|
|
43
|
-
await latest.current.refresh();
|
|
44
|
-
lastAt.current = Date.now();
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// A prize that didn't arrive arrives next time.
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
busy.current = false;
|
|
51
|
-
}
|
|
52
|
-
}, [customerId, settled]);
|
|
53
|
-
(0, react_1.useEffect)(() => {
|
|
54
|
-
if (active)
|
|
55
|
-
void collect();
|
|
56
|
-
}, [active, collect]);
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=useGiveawayPrizes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGiveawayPrizes.js","sourceRoot":"","sources":["../../src/react/useGiveawayPrizes.ts"],"names":[],"mappings":";;AAeA,8CAqCC;AApDD;;;;;;GAMG;AACH,sDAAiF;AACjF,6CAA4C;AAC5C,iCAAuD;AAEvD,sDAA0D;AAE1D,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,SAAgB,iBAAiB,CAAC,UAAgC,EAAE;;IAClE,MAAM,OAAO,GAAG,IAAA,yBAAY,GAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,OAAO,CAAC;IACzC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,wBAAU,GAAE,CAAC;IAC/B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAO,GAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAA,MAAA,QAAQ,CAAC,QAAQ,0CAAE,EAAE,mCAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,sFAAsF;IACtF,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,EAAE,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,mCAAI,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACpE,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,mCAAI,I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;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAE1B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,MAAM;YAAE,KAAK,OAAO,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface HiddenShowsForViewer {
|
|
2
|
-
isHidden: (show: {
|
|
3
|
-
title: string;
|
|
4
|
-
} | null | undefined) => boolean;
|
|
5
|
-
visible: <Show extends {
|
|
6
|
-
title: string;
|
|
7
|
-
}>(shows: Show[]) => Show[];
|
|
8
|
-
}
|
|
9
|
-
export declare function useHiddenShows(): HiddenShowsForViewer;
|
|
10
|
-
//# sourceMappingURL=useHiddenShows.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHiddenShows.d.ts","sourceRoot":"","sources":["../../src/react/useHiddenShows.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,KAAK,OAAO,CAAC;IAClE,OAAO,EAAE,CAAC,IAAI,SAAS;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;CACpE;AAED,wBAAgB,cAAc,IAAI,oBAAoB,CAYrD"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useHiddenShows = useHiddenShows;
|
|
4
|
-
/**
|
|
5
|
-
* `useHiddenShows()` — the shows this viewer may see (0.9.0), for the hooks that hand out shows
|
|
6
|
-
* (`useReplays`, `useOngoingLive`, `useLiveStreams`, `useStreamInfo`) and an app's own lists: the viewer
|
|
7
|
-
* from `LiveSellingProvider`'s `viewerEmail`, the rule from the config's `hiddenShows`.
|
|
8
|
-
*
|
|
9
|
-
* `isHidden(show)` is true for a show they must not be shown; `visible(shows)` leaves those out, in the
|
|
10
|
-
* same order (the same array when none is). The object changes only when the viewer or the rule does,
|
|
11
|
-
* so a memo that depends on it filters again on a sign-in or sign-out, and not otherwise.
|
|
12
|
-
*
|
|
13
|
-
* Its own file rather than the provider's, so a test that stands in for the provider module
|
|
14
|
-
* (`useLiveSelling` alone) still gets it.
|
|
15
|
-
*/
|
|
16
|
-
const react_1 = require("react");
|
|
17
|
-
const client_1 = require("../client");
|
|
18
|
-
const hiddenShows_1 = require("../hiddenShows");
|
|
19
|
-
const LiveSellingProvider_1 = require("./LiveSellingProvider");
|
|
20
|
-
function useHiddenShows() {
|
|
21
|
-
const { ready, viewerEmail } = (0, LiveSellingProvider_1.useLiveSelling)();
|
|
22
|
-
// Read once the client is configured; before that nothing is handed out anyway.
|
|
23
|
-
const rule = ready ? (0, client_1.hiddenShowsRule)() : null;
|
|
24
|
-
const email = viewerEmail !== null && viewerEmail !== void 0 ? viewerEmail : null;
|
|
25
|
-
return (0, react_1.useMemo)(() => ({
|
|
26
|
-
isHidden: (show) => (0, hiddenShows_1.isHiddenFrom)(show, email, rule),
|
|
27
|
-
visible: (shows) => (0, hiddenShows_1.withoutHiddenShows)(shows, email, rule),
|
|
28
|
-
}), [email, rule]);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=useHiddenShows.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHiddenShows.js","sourceRoot":"","sources":["../../src/react/useHiddenShows.ts"],"names":[],"mappings":";;AAuBA,wCAYC;AAnCD;;;;;;;;;;;GAWG;AACH,iCAAgC;AAEhC,sCAA4C;AAC5C,gDAAkE;AAClE,+DAAuD;AAOvD,SAAgB,cAAc;IAC5B,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IAChD,gFAAgF;IAChF,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,wBAAe,GAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9C,MAAM,KAAK,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,CAAC;IAClC,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAY,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC;QACnD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,gCAAkB,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;KAC3D,CAAC,EACF,CAAC,KAAK,EAAE,IAAI,CAAC,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useKeepScreenAwake.d.ts","sourceRoot":"","sources":["../../src/react/useKeepScreenAwake.ts"],"names":[],"mappings":"AAmBA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAWrE"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useKeepScreenAwake = useKeepScreenAwake;
|
|
4
|
-
/**
|
|
5
|
-
* `useKeepScreenAwake(active, tag)` (0.14.0, moved from amore-v2's `src/core/hooks/useKeepScreenAwake.ts`,
|
|
6
|
-
* Freckled Poppy's before it): keeps the phone's screen on while `active` is true. A live show runs for
|
|
7
|
-
* an hour and is watched without a touch, so the phone's idle timer would put it to sleep mid-show.
|
|
8
|
-
*
|
|
9
|
-
* - **Driven by a condition, not by the screen being mounted** (expo-keep-awake's own `useKeepAwake`):
|
|
10
|
-
* the Live screen stays mounted under the Cart and the variant page, where it has no claim on the
|
|
11
|
-
* screen.
|
|
12
|
-
* - **One `tag` per caller.** expo-keep-awake releases by tag, so the Live screen and the live bubble
|
|
13
|
-
* holding the same tag would release each other's hold as the show moves between them.
|
|
14
|
-
* - The release waits for the hold to have been taken: both cross to native, and a condition that turns
|
|
15
|
-
* off as soon as it turned on would otherwise release a hold not yet made, leaving it on for good.
|
|
16
|
-
* - A hold or release that fails goes to `LiveSellingProvider`'s `onWarning`.
|
|
17
|
-
*/
|
|
18
|
-
const expo_keep_awake_1 = require("expo-keep-awake");
|
|
19
|
-
const react_1 = require("react");
|
|
20
|
-
const pageOptions_1 = require("../pageOptions");
|
|
21
|
-
function useKeepScreenAwake(active, tag) {
|
|
22
|
-
(0, react_1.useEffect)(() => {
|
|
23
|
-
if (!active)
|
|
24
|
-
return;
|
|
25
|
-
const holding = (0, expo_keep_awake_1.activateKeepAwakeAsync)(tag);
|
|
26
|
-
holding.catch((error) => (0, pageOptions_1.reportLiveWarning)(error, { at: 'useKeepScreenAwake.activate', tag }));
|
|
27
|
-
return () => {
|
|
28
|
-
holding
|
|
29
|
-
.then(() => (0, expo_keep_awake_1.deactivateKeepAwake)(tag))
|
|
30
|
-
.catch((error) => (0, pageOptions_1.reportLiveWarning)(error, { at: 'useKeepScreenAwake.deactivate', tag }));
|
|
31
|
-
};
|
|
32
|
-
}, [active, tag]);
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=useKeepScreenAwake.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useKeepScreenAwake.js","sourceRoot":"","sources":["../../src/react/useKeepScreenAwake.ts"],"names":[],"mappings":";;AAmBA,gDAWC;AA9BD;;;;;;;;;;;;;GAaG;AACH,qDAA8E;AAC9E,iCAAkC;AAElC,gDAAmD;AAEnD,SAAgB,kBAAkB,CAAC,MAAe,EAAE,GAAW;IAC7D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,OAAO,GAAG,IAAA,wCAAsB,EAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,IAAA,+BAAiB,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,6BAA6B,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACxG,OAAO,GAAG,EAAE;YACV,OAAO;iBACJ,IAAI,CAAC,GAAG,EAAE,CAAC,IAAA,qCAAmB,EAAC,GAAG,CAAC,CAAC;iBACpC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,IAAA,+BAAiB,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Live screen's auction (0.14.0, moved from amore-v2's `src/core/hooks/useLiveAuction.ts`: phase 4
|
|
3
|
-
* of its "Live player plan", bidding). The routes and the store's name are the app's
|
|
4
|
-
* (`LiveSellingProvider`'s `routes` and `shopName`); the route's `streamId` param is read here.
|
|
5
|
-
*/
|
|
6
|
-
import { type Product } from '@tiledev/sdk-shopify';
|
|
7
|
-
import type { LiveAuctionLot, LiveAuctionRound, LiveAuctionWinner, LiveBidRefusal, LiveBidStep, LiveShopLink } from '../pageTypes';
|
|
8
|
-
/** What the Live screen hands the auction. */
|
|
9
|
-
export interface LiveAuctionScreen {
|
|
10
|
-
/**
|
|
11
|
-
* Opens Items You Won over the show, as the header's cart does on an auction show (`useLivePage`'s
|
|
12
|
-
* `header.onCart`, which shrinks a show on air into the bubble first): the unpaid-wins sheet's
|
|
13
|
-
* "Checkout now".
|
|
14
|
-
*/
|
|
15
|
-
openItemsYouWon: () => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The Live screen's auction, so the screen stays plain tiles. The session never ticks: it gives when
|
|
19
|
-
* the round closes (`auction.closesAt`, on the phone's clock), and the bid bar and the final countdown
|
|
20
|
-
* count down to it themselves (`useAuctionCountdown`), so the screen is never drawn on the round's
|
|
21
|
-
* clock.
|
|
22
|
-
*
|
|
23
|
-
* - **The session does the auction:** the round, the leader, the clock, the hammer and whether it is the
|
|
24
|
-
* shopper's (`session.auction`, `lastWin.isYou`), the bid itself (`actions.placeBid`), and everything
|
|
25
|
-
* in front of a bid (`useAuctionBidGate`: signed in, nothing unpaid from another show, the rules
|
|
26
|
-
* accepted once per phone, a variant chosen once a round). Nothing here repeats them.
|
|
27
|
-
* - **The bid gate's sheets are the bid bar's** (decided, amore-v2's Head of Engineering): `step` tells
|
|
28
|
-
* the bid bar which one to show. Signing in is sdk-shopify's `useSignIn` (Shopify's sheet, or the
|
|
29
|
-
* app's Sign In page: `routes.openSignIn`), as bidding needs a Shopify sign-in (the win is written to
|
|
30
|
-
* the customer).
|
|
31
|
-
* - **Back to the bid after signing in** (the gate's `startSignIn`): the bid waits; once the shopper is
|
|
32
|
-
* a bidder, and if bidding on that lot is still open, it goes through the gate again (unpaid wins,
|
|
33
|
-
* read fresh first, then the rules, the variant). Dropped when bidding on the lot closes, when the
|
|
34
|
-
* shopper asks for another bid, or when this screen is back on show still signed out (the Sign In
|
|
35
|
-
* page closed). Shopify's own sign-in sheet doesn't leave the screen: closed without signing in, the
|
|
36
|
-
* bid waits until bidding on its lot closes. Signed in with the customer still loading, no sign-in
|
|
37
|
-
* opens: the bid waits for them (`signInLoading`).
|
|
38
|
-
* - **A bid goes out at the amount the shopper saw** (the gate's `atAmountShown`): the slide's "Bid
|
|
39
|
-
* $25.00", or the amount typed. The last look before it goes: the round still open with time on the
|
|
40
|
-
* clock, at most the host's ceiling, at least the next bid. If the room moved past it (a sheet was
|
|
41
|
-
* open meanwhile), it isn't sent and the bar says so (`refusal`), rather than going out at a price
|
|
42
|
-
* nobody showed. After a bid goes the bar takes no other for 1.2 s (`bidOnItsWay`). The session sends
|
|
43
|
-
* nothing when it knows no moderator for the round (L3), and a send can fail: `placeBid` says so
|
|
44
|
-
* (`{ sent: false }`), and the bar says the bid didn't go through in the place of the outbid line,
|
|
45
|
-
* and takes a bid again at once (decided 2026-10-06: "Bid didn't go through"). The bar's line goes
|
|
46
|
-
* with the next bid or the round.
|
|
47
|
-
* - **The winner is told** (`win`): everyone sees who won; the shopper sees "You" when they held the
|
|
48
|
-
* highest bid as the round closed and the winning bid is theirs (`lastWin.isYou`). The room sends only
|
|
49
|
-
* the winner's name, not who they are. No name is handed out as an email. The win itself reaches the
|
|
50
|
-
* cart's Items You Won from the server; that page reads it each time it opens.
|
|
51
|
-
* - **The lots** for the Shop button's sheet and the card (`lotStateFor`): open (the round is on it),
|
|
52
|
-
* closed (won: on the show's record, or seen here), else upcoming. A link the host added (0.15.0,
|
|
53
|
-
* `showLinkOf`) sits among them with its price and no state, and a featured link has no round on the
|
|
54
|
-
* card: it is opened, never bid on (`useLiveShop` opens it).
|
|
55
|
-
* - **The store's name** in the bidding rules is `shopName` (old Amore's took the host's, which can be
|
|
56
|
-
* a person's).
|
|
57
|
-
* - **Nothing shows** until the session holds this show's record (`useLiveShow`; never a hidden show the
|
|
58
|
-
* shopper can't see), or on a show that isn't an auction. The web's session is always "ended":
|
|
59
|
-
* nothing draws there.
|
|
60
|
-
*/
|
|
61
|
-
export declare function useLiveAuction({ openItemsYouWon }: LiveAuctionScreen): {
|
|
62
|
-
bidBar: {
|
|
63
|
-
visible: boolean;
|
|
64
|
-
currencyCode: string;
|
|
65
|
-
highestBid: number;
|
|
66
|
-
nextBid: number;
|
|
67
|
-
closesAt: number | null;
|
|
68
|
-
extended: boolean;
|
|
69
|
-
extendedSeconds: number;
|
|
70
|
-
isLeading: boolean;
|
|
71
|
-
bidCap: number | null;
|
|
72
|
-
busy: boolean;
|
|
73
|
-
step: LiveBidStep | null;
|
|
74
|
-
shopName: string | undefined;
|
|
75
|
-
lotProduct: Product | null;
|
|
76
|
-
refusal: LiveBidRefusal | null;
|
|
77
|
-
onBid: (amount: number) => void;
|
|
78
|
-
onAcceptTerms: () => void;
|
|
79
|
-
onChooseVariant: (variantId: string) => void;
|
|
80
|
-
onCloseStep: () => void;
|
|
81
|
-
onSeeWins: () => void;
|
|
82
|
-
};
|
|
83
|
-
finalCountdown: {
|
|
84
|
-
visible: boolean;
|
|
85
|
-
closesAt: number | null;
|
|
86
|
-
};
|
|
87
|
-
biddingWar: {
|
|
88
|
-
active: boolean;
|
|
89
|
-
onDone: () => void;
|
|
90
|
-
};
|
|
91
|
-
win: {
|
|
92
|
-
winner: LiveAuctionWinner | null;
|
|
93
|
-
onDone: () => void;
|
|
94
|
-
};
|
|
95
|
-
/** The auction part of the featured card; `useLiveShop` gives the rest. */
|
|
96
|
-
productCard: {
|
|
97
|
-
auctionRound: LiveAuctionRound | null;
|
|
98
|
-
};
|
|
99
|
-
/** The auction part of the Shop button: its sheet lists the lots. */
|
|
100
|
-
shopButton: {
|
|
101
|
-
lots: (LiveShopLink | LiveAuctionLot)[] | null;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
/** What `useLiveAuction` hands the Live screen's auction tiles. */
|
|
105
|
-
export type LiveAuction = ReturnType<typeof useLiveAuction>;
|
|
106
|
-
//# sourceMappingURL=useLiveAuction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveAuction.d.ts","sourceRoot":"","sources":["../../src/react/useLiveAuction.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAuC,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMzF,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAiBnI,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,cAAc,CAAC,EAAE,eAAe,EAAE,EAAE,iBAAiB;;;;;;;;;;;;;;;;wBAsFxD,MAAM;;;;;;;;;;;;;;;;;;IA0Gf,2EAA2E;;;;IAE3E,qEAAqE;;;;EAGxE;AAED,mEAAmE;AACnE,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|