@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
package/dist/attribution.d.ts
CHANGED
|
@@ -6,27 +6,13 @@ export type AttributionSource = {
|
|
|
6
6
|
} | {
|
|
7
7
|
type: 'replay';
|
|
8
8
|
showId: string;
|
|
9
|
-
} | {
|
|
10
|
-
type: 'auction';
|
|
11
|
-
showId: string;
|
|
12
|
-
} | {
|
|
13
|
-
type: 'auction-replay';
|
|
14
|
-
showId: string;
|
|
15
|
-
} | {
|
|
16
|
-
type: 'silent-auction';
|
|
17
|
-
showId: string;
|
|
18
9
|
} | {
|
|
19
10
|
type: 'app';
|
|
20
11
|
};
|
|
21
|
-
/** A show on air: `auction` for an auction show (`isAuction`), else `live`; by its streamingId. */
|
|
22
12
|
export declare function liveAttributionSourceFor(stream: {
|
|
23
13
|
streamingId: string;
|
|
24
14
|
status: LiveStreamStatus;
|
|
25
|
-
isAuction?: boolean;
|
|
26
15
|
} | null): AttributionSource | null;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
* auction show's recording, else `replay`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function replayAttributionSourceFor(showStreamingId: string | null, isAuction?: boolean): AttributionSource | null;
|
|
16
|
+
/** Takes the streamingId of the show the replay is of, never the replay feed id. */
|
|
17
|
+
export declare function replayAttributionSourceFor(showStreamingId: string | null): AttributionSource | null;
|
|
32
18
|
//# sourceMappingURL=attribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,uGAAuG;AACvG,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,uGAAuG;AACvG,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpB,wBAAgB,wBAAwB,CACtC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,GAC/D,iBAAiB,GAAG,IAAI,CAE1B;AAED,oFAAoF;AACpF,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAEnG"}
|
package/dist/attribution.js
CHANGED
|
@@ -2,17 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.liveAttributionSourceFor = liveAttributionSourceFor;
|
|
4
4
|
exports.replayAttributionSourceFor = replayAttributionSourceFor;
|
|
5
|
-
/** A show on air: `auction` for an auction show (`isAuction`), else `live`; by its streamingId. */
|
|
6
5
|
function liveAttributionSourceFor(stream) {
|
|
7
|
-
|
|
8
|
-
return null;
|
|
9
|
-
return { type: stream.isAuction ? 'auction' : 'live', showId: stream.streamingId };
|
|
6
|
+
return (stream === null || stream === void 0 ? void 0 : stream.status) === 'live' ? { type: 'live', showId: stream.streamingId } : null;
|
|
10
7
|
}
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
function replayAttributionSourceFor(showStreamingId, isAuction = false) {
|
|
16
|
-
return showStreamingId ? { type: isAuction ? 'auction-replay' : 'replay', showId: showStreamingId } : null;
|
|
8
|
+
/** Takes the streamingId of the show the replay is of, never the replay feed id. */
|
|
9
|
+
function replayAttributionSourceFor(showStreamingId) {
|
|
10
|
+
return showStreamingId ? { type: 'replay', showId: showStreamingId } : null;
|
|
17
11
|
}
|
|
18
12
|
//# sourceMappingURL=attribution.js.map
|
package/dist/attribution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":";;AAQA,4DAIC;AAGD,gEAEC;AATD,SAAgB,wBAAwB,CACtC,MAAgE;IAEhE,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,MAAK,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzF,CAAC;AAED,oFAAoF;AACpF,SAAgB,0BAA0B,CAAC,eAA8B;IACvE,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9E,CAAC"}
|
package/dist/auctions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctions.d.ts","sourceRoot":"","sources":["../src/auctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auctions.d.ts","sourceRoot":"","sources":["../src/auctions.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA+B,WAAW,EAAE,MAAM,SAAS,CAAC;AAuExE,eAAO,MAAM,QAAQ,EAAE,WAoFtB,CAAC"}
|
package/dist/auctions.js
CHANGED
|
@@ -13,7 +13,6 @@ exports.auctions = void 0;
|
|
|
13
13
|
* token and so goes through the injected `customerAccountRequest`.
|
|
14
14
|
*/
|
|
15
15
|
const client_1 = require("./client");
|
|
16
|
-
const cartAttributes_1 = require("./cartAttributes");
|
|
17
16
|
const TERMS_KEY = 'auction.termsAccepted';
|
|
18
17
|
// ─── Unpaid wins (customer-account metafield) ────────────────────────────────
|
|
19
18
|
const UNPAID_WINS_QUERY = /* GraphQL */ `
|
|
@@ -25,8 +24,6 @@ const UNPAID_WINS_QUERY = /* GraphQL */ `
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
`;
|
|
28
|
-
/** A silent auction's wins are recorded under a key of their own, `silent_…` (0.12.0). */
|
|
29
|
-
const SILENT_KEY_PREFIX = cartAttributes_1.SILENT_AUCTION_KEY_PREFIX;
|
|
30
27
|
async function fetchWinnerMetafield() {
|
|
31
28
|
var _a, _b;
|
|
32
29
|
const customerAccountRequest = (0, client_1.getCustomerAccountRequest)();
|
|
@@ -62,22 +59,6 @@ function isPayable(raw) {
|
|
|
62
59
|
* The error is deliberately one-sided. Skipping an unpayable key can at worst let through a bid the
|
|
63
60
|
* host refuses; counting one blocks a paying customer permanently.
|
|
64
61
|
*/
|
|
65
|
-
/**
|
|
66
|
-
* The streams whose unpaid wins block bidding elsewhere (0.12.0): every stream with something payable,
|
|
67
|
-
* save a silent auction's (`silent_…`) whose payment deadlines haven't passed. A silent win's winner
|
|
68
|
-
* has until its `purchaseDeadline` to pay and is expected to go on shopping and bidding meanwhile; one
|
|
69
|
-
* with no deadline never becomes overdue, so never blocks (Sparkl's rule). Live wins are unchanged.
|
|
70
|
-
*/
|
|
71
|
-
function blockingStreamIds(parsed, nowMs) {
|
|
72
|
-
return payableStreamIds(parsed).filter((streamingId) => {
|
|
73
|
-
if (!streamingId.startsWith(SILENT_KEY_PREFIX))
|
|
74
|
-
return true;
|
|
75
|
-
return parsed[streamingId].filter(isPayable).some((raw) => {
|
|
76
|
-
const deadline = raw.purchaseDeadline ? Date.parse(raw.purchaseDeadline) : Number.NaN;
|
|
77
|
-
return Number.isFinite(deadline) && deadline < nowMs;
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
62
|
function payableStreamIds(parsed) {
|
|
82
63
|
return Object.keys(parsed).filter((streamingId) => {
|
|
83
64
|
const entries = parsed[streamingId];
|
|
@@ -125,7 +106,7 @@ exports.auctions = {
|
|
|
125
106
|
async unpaidStreamIds() {
|
|
126
107
|
try {
|
|
127
108
|
const parsed = await fetchWinnerMetafield();
|
|
128
|
-
return parsed ?
|
|
109
|
+
return parsed ? payableStreamIds(parsed) : [];
|
|
129
110
|
}
|
|
130
111
|
catch {
|
|
131
112
|
// A metafield read failing must not lock a customer out of bidding.
|
|
@@ -137,27 +118,19 @@ exports.auctions = {
|
|
|
137
118
|
if (!parsed)
|
|
138
119
|
return null;
|
|
139
120
|
/**
|
|
140
|
-
*
|
|
121
|
+
* The first stream with something payable, rather than the first key.
|
|
141
122
|
*
|
|
142
|
-
*
|
|
143
|
-
* on a second stream while the first is unpaid
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* reached the cart (production's DEL-2569). Each item keeps the stream it was won on.
|
|
147
|
-
*
|
|
148
|
-
* `streamingId` stays one stream — the first with something payable, not the first key, so a
|
|
149
|
-
* leftover empty key cannot hide a real win behind it — because `auction_id` is a single cart
|
|
150
|
-
* attribute and there is no honest value for a cart spanning two shows. That is a limitation, not
|
|
151
|
-
* a solved problem: per production's note on DEL-2569, the host marks that one stream's tab settled,
|
|
152
|
-
* so wins carried over from another stay flagged unpaid until it catches up. Accepted there for the
|
|
153
|
-
* same reason it is here: a prize the shopper paid for and can see beats one that silently does not
|
|
154
|
-
* exist, and the alternative (a cart per stream) needs a checkout that can open more than one.
|
|
123
|
+
* One tab per checkout is the host's model — the cart carries a single `auction_id` and the gate
|
|
124
|
+
* stops a customer accruing wins on a second stream while the first is unpaid — so in practice
|
|
125
|
+
* there is one. Taking `Object.keys()[0]` regardless meant a leftover empty key hid a real win
|
|
126
|
+
* sitting behind it, and the customer was blocked by the very win the tab refused to show.
|
|
155
127
|
*/
|
|
156
|
-
const
|
|
157
|
-
const [streamingId] = streamingIds;
|
|
128
|
+
const [streamingId] = payableStreamIds(parsed);
|
|
158
129
|
if (!streamingId)
|
|
159
130
|
return null;
|
|
160
|
-
const items =
|
|
131
|
+
const items = (Array.isArray(parsed[streamingId]) ? parsed[streamingId] : [])
|
|
132
|
+
.filter(isPayable)
|
|
133
|
+
.map((raw) => {
|
|
161
134
|
var _a;
|
|
162
135
|
return ({
|
|
163
136
|
productGid: `gid://shopify/Product/${raw.productId}`,
|
|
@@ -165,12 +138,8 @@ exports.auctions = {
|
|
|
165
138
|
winningBid: Number(raw.winningBid) || 0,
|
|
166
139
|
isGiveaway: !!raw.isGiveaway,
|
|
167
140
|
discountCode: (_a = raw.discountCode) !== null && _a !== void 0 ? _a : null,
|
|
168
|
-
streamingId: stream,
|
|
169
|
-
// A silent auction's two fields, only when it has them, so a live win is as it was.
|
|
170
|
-
...(typeof raw.lotNumber === 'number' ? { lotNumber: raw.lotNumber } : {}),
|
|
171
|
-
...(raw.purchaseDeadline ? { purchaseDeadline: raw.purchaseDeadline } : {}),
|
|
172
141
|
});
|
|
173
|
-
})
|
|
142
|
+
});
|
|
174
143
|
return items.length ? { streamingId, items } : null;
|
|
175
144
|
},
|
|
176
145
|
isBiddingBlocked(unpaidStreamIds, streamingId) {
|
package/dist/auctions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctions.js","sourceRoot":"","sources":["../src/auctions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,qCAOkB;
|
|
1
|
+
{"version":3,"file":"auctions.js","sourceRoot":"","sources":["../src/auctions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,qCAOkB;AAKlB,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C,gFAAgF;AAEhF,MAAM,iBAAiB,GAAG,aAAa,CAAC;;;;;;;;CAQvC,CAAC;AAYF,KAAK,UAAU,oBAAoB;;IACjC,MAAM,sBAAsB,GAAG,IAAA,kCAAyB,GAAE,CAAC;IAC3D,IAAI,CAAC,sBAAsB;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,IAAI,GAAG,MAAM,sBAAsB,CAAiB,iBAAiB,CAAC,CAAC;IAC7E,MAAM,KAAK,GAAG,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,SAAS,0CAAE,KAAK,CAAC;IAC9C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAiC,CAAC;IACjE,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAE,GAAkB,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,gBAAgB,CAAC,MAAoC;IAC5D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,E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M,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;gBACvF,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;gBACvC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU;gBAC5B,YAAY,EAAE,MAAA,GAAG,CAAC,YAAY,mCAAI,IAAI;aACvC,CAAC,CAAA;SAAA,CAAC,CAAC;QAEN,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAE,EAAE,WAAW,EAAE,KAAK,EAAyB,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,CAAC;IAED,gBAAgB,CAAC,eAAyB,EAAE,WAA0B;QACpE,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;CACF,CAAC"}
|
package/dist/cartAttributes.d.ts
CHANGED
|
@@ -7,21 +7,11 @@ import type { CartLineAttribute, CommerceAdapter } from './sessionTypes';
|
|
|
7
7
|
import type { LiveStreamStatus } from './types';
|
|
8
8
|
export declare const LIVE_STREAM_ID_ATTRIBUTE = "_stream_id";
|
|
9
9
|
export declare const REPLAY_ID_ATTRIBUTE = "_replay_id";
|
|
10
|
-
/** A silent auction's win, by the auction's id (its `silent_…` key without the prefix). */
|
|
11
|
-
export declare const SILENT_AUCTION_ID_ATTRIBUTE = "_silent_auction_id";
|
|
12
10
|
/** Gates on the record's own status, not the session's derived one: only a show on air earns the tag. */
|
|
13
11
|
export declare function liveCartAttributesFor(stream: {
|
|
14
12
|
streamingId: string;
|
|
15
13
|
status: LiveStreamStatus;
|
|
16
14
|
} | null): CartLineAttribute[];
|
|
17
|
-
/** A silent auction's wins are recorded under a key of their own, `silent_…` (0.12.0): no live show. */
|
|
18
|
-
export declare const SILENT_AUCTION_KEY_PREFIX = "silent_";
|
|
19
|
-
/**
|
|
20
|
-
* Where a won lot came from, for its line of the wins cart (0.16.0), so the order says what sold it: the
|
|
21
|
-
* live show's `_stream_id`, as an add during the show carries it, or a silent auction's
|
|
22
|
-
* `_silent_auction_id`. None without either.
|
|
23
|
-
*/
|
|
24
|
-
export declare function wonLotAttributesFor(streamingId: string | null | undefined): CartLineAttribute[];
|
|
25
15
|
export declare function replayCartAttributesFor(replayId: string | null): CartLineAttribute[];
|
|
26
16
|
export declare function addLiveLine(adapter: CommerceAdapter<unknown> | null, stream: {
|
|
27
17
|
streamingId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartAttributes.d.ts","sourceRoot":"","sources":["../src/cartAttributes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,wBAAwB,eAAe,CAAC;AACrD,eAAO,MAAM,mBAAmB,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cartAttributes.d.ts","sourceRoot":"","sources":["../src/cartAttributes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,wBAAwB,eAAe,CAAC;AACrD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,yGAAyG;AACzG,wBAAgB,qBAAqB,CACnC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,GAC/D,iBAAiB,EAAE,CAIrB;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,EAAE,CAEpF;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,IAAI,EACxC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,EAChE,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
package/dist/cartAttributes.js
CHANGED
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.REPLAY_ID_ATTRIBUTE = exports.LIVE_STREAM_ID_ATTRIBUTE = void 0;
|
|
4
4
|
exports.liveCartAttributesFor = liveCartAttributesFor;
|
|
5
|
-
exports.wonLotAttributesFor = wonLotAttributesFor;
|
|
6
5
|
exports.replayCartAttributesFor = replayCartAttributesFor;
|
|
7
6
|
exports.addLiveLine = addLiveLine;
|
|
8
7
|
exports.LIVE_STREAM_ID_ATTRIBUTE = '_stream_id';
|
|
9
8
|
exports.REPLAY_ID_ATTRIBUTE = '_replay_id';
|
|
10
|
-
/** A silent auction's win, by the auction's id (its `silent_…` key without the prefix). */
|
|
11
|
-
exports.SILENT_AUCTION_ID_ATTRIBUTE = '_silent_auction_id';
|
|
12
9
|
/** Gates on the record's own status, not the session's derived one: only a show on air earns the tag. */
|
|
13
10
|
function liveCartAttributesFor(stream) {
|
|
14
11
|
return (stream === null || stream === void 0 ? void 0 : stream.status) === 'live'
|
|
15
12
|
? [{ key: exports.LIVE_STREAM_ID_ATTRIBUTE, value: stream.streamingId }]
|
|
16
13
|
: [];
|
|
17
14
|
}
|
|
18
|
-
/** A silent auction's wins are recorded under a key of their own, `silent_…` (0.12.0): no live show. */
|
|
19
|
-
exports.SILENT_AUCTION_KEY_PREFIX = 'silent_';
|
|
20
|
-
/**
|
|
21
|
-
* Where a won lot came from, for its line of the wins cart (0.16.0), so the order says what sold it: the
|
|
22
|
-
* live show's `_stream_id`, as an add during the show carries it, or a silent auction's
|
|
23
|
-
* `_silent_auction_id`. None without either.
|
|
24
|
-
*/
|
|
25
|
-
function wonLotAttributesFor(streamingId) {
|
|
26
|
-
const id = streamingId === null || streamingId === void 0 ? void 0 : streamingId.trim();
|
|
27
|
-
if (!id)
|
|
28
|
-
return [];
|
|
29
|
-
if (!id.startsWith(exports.SILENT_AUCTION_KEY_PREFIX))
|
|
30
|
-
return [{ key: exports.LIVE_STREAM_ID_ATTRIBUTE, value: id }];
|
|
31
|
-
const auctionId = id.slice(exports.SILENT_AUCTION_KEY_PREFIX.length).trim();
|
|
32
|
-
return auctionId ? [{ key: exports.SILENT_AUCTION_ID_ATTRIBUTE, value: auctionId }] : [];
|
|
33
|
-
}
|
|
34
15
|
function replayCartAttributesFor(replayId) {
|
|
35
16
|
return replayId ? [{ key: exports.REPLAY_ID_ATTRIBUTE, value: replayId }] : [];
|
|
36
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartAttributes.js","sourceRoot":"","sources":["../src/cartAttributes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cartAttributes.js","sourceRoot":"","sources":["../src/cartAttributes.ts"],"names":[],"mappings":";;;AAYA,sDAMC;AAED,0DAEC;AAED,kCAOC;AAvBY,QAAA,wBAAwB,GAAG,YAAY,CAAC;AACxC,QAAA,mBAAmB,GAAG,YAAY,CAAC;AAEhD,yGAAyG;AACzG,SAAgB,qBAAqB,CACnC,MAAgE;IAEhE,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,MAAK,MAAM;QAC9B,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,gCAAwB,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QAChE,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAgB,uBAAuB,CAAC,QAAuB;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,2BAAmB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzE,CAAC;AAEM,KAAK,UAAU,WAAW,CAC/B,OAAwC,EACxC,MAAgE,EAChE,SAAiB;IAEjB,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAA;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Replaces the app's `APP_CONFIG.liveSelling` / `LIVE_CONFIG` globals with an explicit `configure`.
|
|
11
11
|
*/
|
|
12
|
-
import type { CustomerAccountRequest,
|
|
12
|
+
import type { CustomerAccountRequest, LiveSellingConfig, Logger, StorageAdapter } from './types';
|
|
13
13
|
import type { CommerceAdapter, IdentityAdapter } from './sessionTypes';
|
|
14
14
|
/** The service stores bare numeric Shopify ids; everything downstream speaks GIDs. */
|
|
15
15
|
export declare function toProductGid(id: string): string;
|
|
@@ -23,28 +23,6 @@ export declare class LiveSellingError extends Error {
|
|
|
23
23
|
readonly status: number;
|
|
24
24
|
constructor(status: number);
|
|
25
25
|
}
|
|
26
|
-
/** How long a request may take before it is given up on, unless `requestTimeoutMs` says otherwise. */
|
|
27
|
-
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 10000;
|
|
28
|
-
/**
|
|
29
|
-
* A request that took longer than `requestTimeoutMs` and was given up on.
|
|
30
|
-
*
|
|
31
|
-
* Its own class rather than a `LiveSellingError`, because there is no HTTP status to carry: the server
|
|
32
|
-
* never answered. A caller tells the two apart with `instanceof`; `url` says which call it was.
|
|
33
|
-
*
|
|
34
|
-
* Before 0.9.0 nothing had a timeout, so a request on a dead connection never settled — a join waiting
|
|
35
|
-
* on its room token, or a record read, hung for as long as the OS kept the socket open.
|
|
36
|
-
*/
|
|
37
|
-
export declare class LiveSellingTimeoutError extends Error {
|
|
38
|
-
readonly url: string;
|
|
39
|
-
readonly timeoutMs: number;
|
|
40
|
-
constructor(url: string, timeoutMs: number);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* A store that keeps things only in memory, for as long as the app runs. Used until `configure` is
|
|
44
|
-
* called (which requires the app's own `storage`), and by the tests. Not on the package's root: an app
|
|
45
|
-
* passes real storage.
|
|
46
|
-
*/
|
|
47
|
-
export declare function memoryStorage(): StorageAdapter;
|
|
48
26
|
export declare function setConfig(config: LiveSellingConfig): void;
|
|
49
27
|
export declare function getConfig(): LiveSellingConfig;
|
|
50
28
|
export declare function isConfigured(): boolean;
|
|
@@ -70,38 +48,11 @@ export declare function getCommerce(): CommerceAdapter<unknown> | null;
|
|
|
70
48
|
* answers before `configure()` has run instead of throwing.
|
|
71
49
|
*/
|
|
72
50
|
export declare function strictActiveProduct(): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* The shows to keep from shoppers (`hiddenShows` on the config), or null when the app hides none.
|
|
75
|
-
* Read through here so it answers before `configure()` has run instead of throwing.
|
|
76
|
-
*/
|
|
77
|
-
export declare function hiddenShowsRule(): HiddenShows | null;
|
|
78
|
-
/** How long the session waits with nothing on air before it calls the show ended. */
|
|
79
|
-
export declare const DEFAULT_OFF_AIR_GRACE_MS = 4000;
|
|
80
|
-
/** `offAirGraceMs` from the config, or 4 seconds. Same fallback rules as `requestTimeoutMs`. */
|
|
81
|
-
export declare function offAirGraceMs(): number;
|
|
82
51
|
/** Null when nobody is identified beyond the per-install viewer id — bidding is then never offered. */
|
|
83
52
|
export declare function getIdentity(): IdentityAdapter | null;
|
|
84
|
-
/**
|
|
85
|
-
* The timeout every request gets: `requestTimeoutMs` from the config, or 10 seconds.
|
|
86
|
-
*
|
|
87
|
-
* Read through here so it answers before `configure()` has run (the CDN comment file needs no config)
|
|
88
|
-
* and so a nonsense value — zero, negative, not a number — falls back rather than making every request
|
|
89
|
-
* fail at once.
|
|
90
|
-
*/
|
|
91
|
-
export declare function requestTimeoutMs(): number;
|
|
92
|
-
/**
|
|
93
|
-
* Runs one HTTP exchange — the fetch AND reading its body — under a deadline.
|
|
94
|
-
*
|
|
95
|
-
* The deadline covers the body too, because a server can send headers and then stall. Two things
|
|
96
|
-
* enforce it: an `AbortController`, so the socket is actually released, and a timer that rejects on
|
|
97
|
-
* its own, because a `fetch` that ignores `signal` (an old polyfill, a test double) would otherwise
|
|
98
|
-
* still hang. Either way the caller sees a `LiveSellingTimeoutError`, never a bare `AbortError`.
|
|
99
|
-
*/
|
|
100
|
-
export declare function withRequestTimeout<T>(url: string, exchange: (signal: AbortSignal | undefined) => Promise<T>, timeoutMs?: number): Promise<T>;
|
|
101
53
|
/**
|
|
102
54
|
* The gateway request. The company header is the only credential; a body implies JSON. `X-Request-Source`
|
|
103
|
-
* marks the traffic as first-party app rather than a web widget.
|
|
104
|
-
* `withRequestTimeout`.
|
|
55
|
+
* marks the traffic as first-party app rather than a web widget.
|
|
105
56
|
*/
|
|
106
57
|
export declare function liveSellingRequest<T>(path: string, options?: {
|
|
107
58
|
params?: Record<string, string | number>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;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,MAAM,CAM5C;AAED,2FAA2F;AAC3F,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEpE;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1E"}
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LiveSellingError = void 0;
|
|
4
4
|
exports.toProductGid = toProductGid;
|
|
5
|
-
exports.memoryStorage = memoryStorage;
|
|
6
5
|
exports.setConfig = setConfig;
|
|
7
6
|
exports.getConfig = getConfig;
|
|
8
7
|
exports.isConfigured = isConfigured;
|
|
@@ -13,11 +12,7 @@ exports.logWarning = logWarning;
|
|
|
13
12
|
exports.getCustomerAccountRequest = getCustomerAccountRequest;
|
|
14
13
|
exports.getCommerce = getCommerce;
|
|
15
14
|
exports.strictActiveProduct = strictActiveProduct;
|
|
16
|
-
exports.hiddenShowsRule = hiddenShowsRule;
|
|
17
|
-
exports.offAirGraceMs = offAirGraceMs;
|
|
18
15
|
exports.getIdentity = getIdentity;
|
|
19
|
-
exports.requestTimeoutMs = requestTimeoutMs;
|
|
20
|
-
exports.withRequestTimeout = withRequestTimeout;
|
|
21
16
|
exports.liveSellingRequest = liveSellingRequest;
|
|
22
17
|
exports.randomId = randomId;
|
|
23
18
|
exports.storageGet = storageGet;
|
|
@@ -41,33 +36,12 @@ class LiveSellingError extends Error {
|
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
38
|
exports.LiveSellingError = LiveSellingError;
|
|
44
|
-
/** How long a request may take before it is given up on, unless `requestTimeoutMs` says otherwise. */
|
|
45
|
-
exports.DEFAULT_REQUEST_TIMEOUT_MS = 10000;
|
|
46
|
-
/**
|
|
47
|
-
* A request that took longer than `requestTimeoutMs` and was given up on.
|
|
48
|
-
*
|
|
49
|
-
* Its own class rather than a `LiveSellingError`, because there is no HTTP status to carry: the server
|
|
50
|
-
* never answered. A caller tells the two apart with `instanceof`; `url` says which call it was.
|
|
51
|
-
*
|
|
52
|
-
* Before 0.9.0 nothing had a timeout, so a request on a dead connection never settled — a join waiting
|
|
53
|
-
* on its room token, or a record read, hung for as long as the OS kept the socket open.
|
|
54
|
-
*/
|
|
55
|
-
class LiveSellingTimeoutError extends Error {
|
|
56
|
-
constructor(url, timeoutMs) {
|
|
57
|
-
super(`Live-selling request timed out after ${timeoutMs}ms: ${url}`);
|
|
58
|
-
this.url = url;
|
|
59
|
-
this.timeoutMs = timeoutMs;
|
|
60
|
-
this.name = 'LiveSellingTimeoutError';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.LiveSellingTimeoutError = LiveSellingTimeoutError;
|
|
64
39
|
const SILENT = { error: () => undefined };
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function memoryStorage() {
|
|
40
|
+
/** Prefers `window.localStorage`; falls back to a process-lifetime in-memory map. */
|
|
41
|
+
function defaultStorage() {
|
|
42
|
+
const ls = globalThis.localStorage;
|
|
43
|
+
if (ls && typeof ls.getItem === 'function')
|
|
44
|
+
return ls;
|
|
71
45
|
const mem = new Map();
|
|
72
46
|
return {
|
|
73
47
|
getItem: (key) => (mem.has(key) ? mem.get(key) : null),
|
|
@@ -79,20 +53,16 @@ function memoryStorage() {
|
|
|
79
53
|
},
|
|
80
54
|
};
|
|
81
55
|
}
|
|
82
|
-
const state = { config: null, storage:
|
|
56
|
+
const state = { config: null, storage: defaultStorage(), logger: SILENT };
|
|
83
57
|
function setConfig(config) {
|
|
84
|
-
var _a;
|
|
58
|
+
var _a, _b;
|
|
85
59
|
if (!config.apiUrl)
|
|
86
60
|
throw new Error('liveSelling.configure: apiUrl is required');
|
|
87
61
|
if (!config.companyId)
|
|
88
62
|
throw new Error('liveSelling.configure: companyId is required');
|
|
89
|
-
// Required since 0.9.0: without it a phone forgot poll votes (counted twice), the viewer's name and
|
|
90
|
-
// the accepted terms on every relaunch. AsyncStorage on a phone, window.localStorage on the web.
|
|
91
|
-
if (!config.storage)
|
|
92
|
-
throw new Error('liveSelling.configure: storage is required (AsyncStorage on a phone, localStorage on the web)');
|
|
93
63
|
state.config = config;
|
|
94
|
-
state.storage = config.storage;
|
|
95
|
-
state.logger = (
|
|
64
|
+
state.storage = (_a = config.storage) !== null && _a !== void 0 ? _a : defaultStorage();
|
|
65
|
+
state.logger = (_b = config.logger) !== null && _b !== void 0 ? _b : SILENT;
|
|
96
66
|
}
|
|
97
67
|
function getConfig() {
|
|
98
68
|
if (!state.config)
|
|
@@ -146,103 +116,33 @@ function strictActiveProduct() {
|
|
|
146
116
|
var _a;
|
|
147
117
|
return ((_a = state.config) === null || _a === void 0 ? void 0 : _a.strictActiveProduct) === true;
|
|
148
118
|
}
|
|
149
|
-
/**
|
|
150
|
-
* The shows to keep from shoppers (`hiddenShows` on the config), or null when the app hides none.
|
|
151
|
-
* Read through here so it answers before `configure()` has run instead of throwing.
|
|
152
|
-
*/
|
|
153
|
-
function hiddenShowsRule() {
|
|
154
|
-
var _a, _b;
|
|
155
|
-
return (_b = (_a = state.config) === null || _a === void 0 ? void 0 : _a.hiddenShows) !== null && _b !== void 0 ? _b : null;
|
|
156
|
-
}
|
|
157
|
-
/** How long the session waits with nothing on air before it calls the show ended. */
|
|
158
|
-
exports.DEFAULT_OFF_AIR_GRACE_MS = 4000;
|
|
159
|
-
/** `offAirGraceMs` from the config, or 4 seconds. Same fallback rules as `requestTimeoutMs`. */
|
|
160
|
-
function offAirGraceMs() {
|
|
161
|
-
var _a;
|
|
162
|
-
const configured = (_a = state.config) === null || _a === void 0 ? void 0 : _a.offAirGraceMs;
|
|
163
|
-
return typeof configured === 'number' && Number.isFinite(configured) && configured > 0
|
|
164
|
-
? configured
|
|
165
|
-
: exports.DEFAULT_OFF_AIR_GRACE_MS;
|
|
166
|
-
}
|
|
167
119
|
/** Null when nobody is identified beyond the per-install viewer id — bidding is then never offered. */
|
|
168
120
|
function getIdentity() {
|
|
169
121
|
var _a, _b;
|
|
170
122
|
return (_b = (_a = state.config) === null || _a === void 0 ? void 0 : _a.identity) !== null && _b !== void 0 ? _b : null;
|
|
171
123
|
}
|
|
172
|
-
/**
|
|
173
|
-
* The timeout every request gets: `requestTimeoutMs` from the config, or 10 seconds.
|
|
174
|
-
*
|
|
175
|
-
* Read through here so it answers before `configure()` has run (the CDN comment file needs no config)
|
|
176
|
-
* and so a nonsense value — zero, negative, not a number — falls back rather than making every request
|
|
177
|
-
* fail at once.
|
|
178
|
-
*/
|
|
179
|
-
function requestTimeoutMs() {
|
|
180
|
-
var _a;
|
|
181
|
-
const configured = (_a = state.config) === null || _a === void 0 ? void 0 : _a.requestTimeoutMs;
|
|
182
|
-
return typeof configured === 'number' && Number.isFinite(configured) && configured > 0
|
|
183
|
-
? configured
|
|
184
|
-
: exports.DEFAULT_REQUEST_TIMEOUT_MS;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Runs one HTTP exchange — the fetch AND reading its body — under a deadline.
|
|
188
|
-
*
|
|
189
|
-
* The deadline covers the body too, because a server can send headers and then stall. Two things
|
|
190
|
-
* enforce it: an `AbortController`, so the socket is actually released, and a timer that rejects on
|
|
191
|
-
* its own, because a `fetch` that ignores `signal` (an old polyfill, a test double) would otherwise
|
|
192
|
-
* still hang. Either way the caller sees a `LiveSellingTimeoutError`, never a bare `AbortError`.
|
|
193
|
-
*/
|
|
194
|
-
async function withRequestTimeout(url, exchange, timeoutMs = requestTimeoutMs()) {
|
|
195
|
-
const controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
196
|
-
let timer = null;
|
|
197
|
-
let timedOut = false;
|
|
198
|
-
const deadline = new Promise((_, reject) => {
|
|
199
|
-
timer = setTimeout(() => {
|
|
200
|
-
timedOut = true;
|
|
201
|
-
controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
202
|
-
reject(new LiveSellingTimeoutError(url, timeoutMs));
|
|
203
|
-
}, timeoutMs);
|
|
204
|
-
});
|
|
205
|
-
try {
|
|
206
|
-
return await Promise.race([exchange(controller === null || controller === void 0 ? void 0 : controller.signal), deadline]);
|
|
207
|
-
}
|
|
208
|
-
catch (caught) {
|
|
209
|
-
// The abort above makes `fetch` reject with an `AbortError` of its own; that IS the timeout.
|
|
210
|
-
if (timedOut)
|
|
211
|
-
throw new LiveSellingTimeoutError(url, timeoutMs);
|
|
212
|
-
throw caught;
|
|
213
|
-
}
|
|
214
|
-
finally {
|
|
215
|
-
if (timer)
|
|
216
|
-
clearTimeout(timer);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
124
|
/**
|
|
220
125
|
* The gateway request. The company header is the only credential; a body implies JSON. `X-Request-Source`
|
|
221
|
-
* marks the traffic as first-party app rather than a web widget.
|
|
222
|
-
* `withRequestTimeout`.
|
|
126
|
+
* marks the traffic as first-party app rather than a web widget.
|
|
223
127
|
*/
|
|
224
128
|
async function liveSellingRequest(path, options) {
|
|
129
|
+
var _a, _b;
|
|
225
130
|
const config = getConfig();
|
|
226
131
|
const query = (options === null || options === void 0 ? void 0 : options.params)
|
|
227
132
|
? `?${new URLSearchParams(Object.entries(options.params).map(([k, v]) => [k, String(v)]))}`
|
|
228
133
|
: '';
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
...((options === null || options === void 0 ? void 0 : options.body) ? { 'Content-Type': 'application/json' } : {}),
|
|
238
|
-
},
|
|
239
|
-
body: (options === null || options === void 0 ? void 0 : options.body) ? JSON.stringify(options.body) : undefined,
|
|
240
|
-
signal,
|
|
241
|
-
});
|
|
242
|
-
if (!response.ok)
|
|
243
|
-
throw new LiveSellingError(response.status);
|
|
244
|
-
return (await response.json());
|
|
134
|
+
const response = await fetch(`${config.apiUrl}${path}${query}`, {
|
|
135
|
+
method: (_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : 'GET',
|
|
136
|
+
headers: {
|
|
137
|
+
'x-company-id': config.companyId,
|
|
138
|
+
'X-Request-Source': (_b = config.requestSource) !== null && _b !== void 0 ? _b : 'APPTILE',
|
|
139
|
+
...((options === null || options === void 0 ? void 0 : options.body) ? { 'Content-Type': 'application/json' } : {}),
|
|
140
|
+
},
|
|
141
|
+
body: (options === null || options === void 0 ? void 0 : options.body) ? JSON.stringify(options.body) : undefined,
|
|
245
142
|
});
|
|
143
|
+
if (!response.ok)
|
|
144
|
+
throw new LiveSellingError(response.status);
|
|
145
|
+
return (await response.json());
|
|
246
146
|
}
|
|
247
147
|
/**
|
|
248
148
|
* A stable random id. Uses the platform `crypto.randomUUID` when present (browsers, modern React
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAiBA,oCAEC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAiBA,oCAEC;AAyCD,8BAMC;AAED,8BAGC;AAED,oCAEC;AAED,oCAEC;AAED,gCAEC;AAED,8BAEC;AASD,gCAIC;AAED,8DAEC;AAGD,kCAEC;AASD,kDAEC;AAGD,kCAEC;AAMD,gDAuBC;AAOD,4BAMC;AAGD,gCAEC;AAED,gCAEC;AAlKD,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AAErD,sFAAsF;AACtF,SAAgB,YAAY,CAAC,EAAU;IACrC,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,mBAAmB,GAAG,EAAE,EAAE,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACzC,Y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, or the gateway's `{ data: rows }`): the first ranked 1
|
|
4
|
-
* (`pdp_rank` 1 or "1"; the gateway puts it first), active, with a playlist and an id; null when the merchant
|
|
5
|
-
* has featured none. Its window, products and poster as above; `recordingId` / `streamingId` open it on
|
|
6
|
-
* Replay with its chat (0.16.0). Pure, for tests.
|
|
7
|
-
*/
|
|
8
|
-
export declare function featuredClipOf(rows: unknown): ClipItem | null;
|
|
9
|
-
/** A Shopify product video is the clip worker's copy of `clip` (its alt names the clip), so not shown twice. */
|
|
10
|
-
export declare function isCopyOfClip(media: {
|
|
11
|
-
alt?: string | null;
|
|
12
|
-
} | null | undefined, clip: Pick<ClipItem, 'id'> | null | undefined): boolean;
|
|
1
|
+
import type { ClipsAPI } from './types';
|
|
13
2
|
export declare const clips: ClipsAPI;
|
|
14
3
|
//# sourceMappingURL=clips.d.ts.map
|
package/dist/clips.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clips.d.ts","sourceRoot":"","sources":["../src/clips.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"clips.d.ts","sourceRoot":"","sources":["../src/clips.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwBlD,eAAO,MAAM,KAAK,EAAE,QAyBnB,CAAC"}
|