@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,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The commerce adapter for a store on `@tiledev/sdk-shopify`: products from the Storefront API, and
|
|
3
|
-
* the cart that pays for the auction wins.
|
|
4
|
-
*
|
|
5
|
-
* Built on the app's own sdk-shopify client, passed in as `shopify`. Nothing here imports sdk-shopify,
|
|
6
|
-
* so the main entry loads none of it on the web or on a phone. An app can hold two copies of
|
|
7
|
-
* sdk-shopify (the Tile preview loads the npm version beside an unpublished build the app is testing),
|
|
8
|
-
* and the copy the app didn't configure has no store. The shapes below are the few fields this file
|
|
9
|
-
* reads; sdk-shopify's `shopify` client and `Product` have them (checked against sdk-shopify 0.10), and
|
|
10
|
-
* the app's own compiler checks that where it passes them in.
|
|
11
|
-
*/
|
|
12
|
-
import type { AuctionWinItem } from './types';
|
|
13
|
-
import type { LiveProduct } from './sessionTypes';
|
|
14
|
-
import type { CommentLinkCard, StoreCommentLink } from './commentLinks';
|
|
15
|
-
/** An amount of money, as Shopify sends it: a decimal string and an ISO 4217 code. */
|
|
16
|
-
export interface ShopifyMoney {
|
|
17
|
-
amount: string;
|
|
18
|
-
currencyCode: string;
|
|
19
|
-
}
|
|
20
|
-
/** A key and value on a cart or on one of its lines. */
|
|
21
|
-
export interface ShopifyAttribute {
|
|
22
|
-
key: string;
|
|
23
|
-
value: string;
|
|
24
|
-
}
|
|
25
|
-
/** The photo size to ask Shopify for (sdk-shopify's `ImageTransform`). */
|
|
26
|
-
export interface ShopifyImageTransform {
|
|
27
|
-
maxWidth?: number;
|
|
28
|
-
maxHeight?: number;
|
|
29
|
-
crop?: 'CENTER' | 'TOP' | 'BOTTOM' | 'LEFT' | 'RIGHT';
|
|
30
|
-
scale?: number;
|
|
31
|
-
preferredContentType?: 'WEBP' | 'JPG' | 'PNG';
|
|
32
|
-
}
|
|
33
|
-
/** The parts of a Shopify product this adapter reads (sdk-shopify's `Product` has them all). */
|
|
34
|
-
export interface ShopifyProductForLive {
|
|
35
|
-
/** The product GID. */
|
|
36
|
-
id: string;
|
|
37
|
-
title: string;
|
|
38
|
-
priceRange: {
|
|
39
|
-
min: ShopifyMoney;
|
|
40
|
-
};
|
|
41
|
-
featuredImage?: {
|
|
42
|
-
url: string;
|
|
43
|
-
} | null;
|
|
44
|
-
variants: {
|
|
45
|
-
/** The variant GID. */
|
|
46
|
-
id: string;
|
|
47
|
-
title: string;
|
|
48
|
-
price: ShopifyMoney;
|
|
49
|
-
availableForSale: boolean;
|
|
50
|
-
/** The variant's own photo, when it has one (0.9.0: `LiveProductVariant.imageUrl`). */
|
|
51
|
-
image?: {
|
|
52
|
-
url: string;
|
|
53
|
-
} | null;
|
|
54
|
-
}[];
|
|
55
|
-
}
|
|
56
|
-
/** One line of the wins cart. */
|
|
57
|
-
export interface ShopifyCartLineInput {
|
|
58
|
-
/** The variant GID. */
|
|
59
|
-
merchandiseId: string;
|
|
60
|
-
quantity: number;
|
|
61
|
-
attributes: ShopifyAttribute[];
|
|
62
|
-
}
|
|
63
|
-
/** Who pays for the wins cart: the signed-in customer's access token, and their email when known. */
|
|
64
|
-
export interface ShopifyBuyer {
|
|
65
|
-
customerAccessToken: string;
|
|
66
|
-
email?: string;
|
|
67
|
-
}
|
|
68
|
-
/** A collection, as far as a comment's card reads it (sdk-shopify's `Collection` has it). */
|
|
69
|
-
export interface ShopifyCollectionForCard {
|
|
70
|
-
title: string;
|
|
71
|
-
image: {
|
|
72
|
-
url: string;
|
|
73
|
-
} | null;
|
|
74
|
-
}
|
|
75
|
-
/** The calls this adapter makes. sdk-shopify's `shopify` client is one of these. */
|
|
76
|
-
export interface ShopifyProductsAndCart {
|
|
77
|
-
products: {
|
|
78
|
-
byIds(ids: string[], options?: {
|
|
79
|
-
imageTransform?: ShopifyImageTransform;
|
|
80
|
-
}): Promise<ShopifyProductForLive[]>;
|
|
81
|
-
/** A comment's product link (0.12.0). Optional: without it, product links get no card. */
|
|
82
|
-
byHandle?(handle: string, options?: {
|
|
83
|
-
imageTransform?: ShopifyImageTransform;
|
|
84
|
-
}): Promise<ShopifyProductForLive | null>;
|
|
85
|
-
};
|
|
86
|
-
/** A comment's collection link (0.12.0). Optional: without it, collection links get no card. */
|
|
87
|
-
collections?: {
|
|
88
|
-
byHandle(handle: string, options?: {
|
|
89
|
-
imageTransform?: ShopifyImageTransform;
|
|
90
|
-
}): Promise<ShopifyCollectionForCard | null>;
|
|
91
|
-
/** Only for the first product's photo, when the collection has none of its own. */
|
|
92
|
-
products(handle: string, options?: {
|
|
93
|
-
first?: number;
|
|
94
|
-
imageTransform?: ShopifyImageTransform;
|
|
95
|
-
}): Promise<{
|
|
96
|
-
nodes: {
|
|
97
|
-
featuredImage?: {
|
|
98
|
-
url: string;
|
|
99
|
-
} | null;
|
|
100
|
-
}[];
|
|
101
|
-
}>;
|
|
102
|
-
};
|
|
103
|
-
cart: {
|
|
104
|
-
create(input: {
|
|
105
|
-
lines: ShopifyCartLineInput[];
|
|
106
|
-
discountCodes: string[];
|
|
107
|
-
attributes: ShopifyAttribute[];
|
|
108
|
-
buyerIdentity?: ShopifyBuyer;
|
|
109
|
-
}): Promise<{
|
|
110
|
-
id: string;
|
|
111
|
-
checkoutUrl: string;
|
|
112
|
-
}>;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
export interface ShopifyLiveCommerceOptions {
|
|
116
|
-
/** The app's own sdk-shopify client (`shopify`), the one it configured. */
|
|
117
|
-
shopify: ShopifyProductsAndCart;
|
|
118
|
-
/** `source_name` on the wins cart: which app the order came from. */
|
|
119
|
-
cartSourceName: string;
|
|
120
|
-
/**
|
|
121
|
-
* The line attribute that marks a prize in the wins cart, the one this store's cart transform reads
|
|
122
|
-
* to make the line free: `_isGiveawayItem` on Amore's store. No default: a wrong key gets the prize
|
|
123
|
-
* charged at full price.
|
|
124
|
-
*/
|
|
125
|
-
prizeWriteKey: string;
|
|
126
|
-
/** Who pays: the signed-in customer, or null for a guest cart. `createShopifyLiveIdentity(...).buyer`. */
|
|
127
|
-
buyer: () => Promise<ShopifyBuyer | null>;
|
|
128
|
-
/** The products' photo size, passed to `products.byIds`. Omitted: the original photos. */
|
|
129
|
-
imageTransform?: ShopifyImageTransform;
|
|
130
|
-
/** The line attribute the store's cart transform reprices a won line by. Default `_winningBid`. 0.16.0. */
|
|
131
|
-
winningBidKey?: string;
|
|
132
|
-
/** More attributes for each win's line, after the adapter's own (a final-sale stamp, say). */
|
|
133
|
-
extraLineAttributes?: (win: AuctionWinItem) => ShopifyAttribute[];
|
|
134
|
-
/** More attributes for the cart, after the adapter's own (an attribution record, say). */
|
|
135
|
-
extraCartAttributes?: (lines: ShopifyCartLineInput[]) => ShopifyAttribute[];
|
|
136
|
-
/** A comment card's photo size (0.12.0). Omitted: 120px, enough for a 44pt thumbnail on a 2x screen. */
|
|
137
|
-
commentLinkCardImage?: ShopifyImageTransform;
|
|
138
|
-
}
|
|
139
|
-
/** The adapter: hand it to `LiveSellingConfig.commerce`, with your own `addLine` beside it if you have one. */
|
|
140
|
-
export interface ShopifyLiveCommerce {
|
|
141
|
-
/** The lots as products, in the order asked; a product the store doesn't serve is left out. */
|
|
142
|
-
productsByIds: (storeProductIds: string[]) => Promise<LiveProduct<ShopifyProductForLive>[]>;
|
|
143
|
-
/** A cart of its own for the wins, and its checkout link. Throws when nothing can be checked out. */
|
|
144
|
-
createAuctionCheckout: (wins: AuctionWinItem[], auctionId: string) => Promise<{
|
|
145
|
-
checkoutUrl: string;
|
|
146
|
-
cartId: string;
|
|
147
|
-
}>;
|
|
148
|
-
/** A store link in a comment as a card (0.12.0); null when the link doesn't resolve. */
|
|
149
|
-
commentLinkCard: (link: StoreCommentLink) => Promise<CommentLinkCard | null>;
|
|
150
|
-
}
|
|
151
|
-
/** The attributes the order webhook matches on (`source_type`, `auction_id`). They must never change. */
|
|
152
|
-
export declare const AUCTION_CART_SOURCE_TYPE = "auction";
|
|
153
|
-
/** The line attribute the store's cart transform reprices a won lot to. */
|
|
154
|
-
export declare const WINNING_BID_KEY = "_winningBid";
|
|
155
|
-
/** The line attribute that keeps two identical wins on two lines. */
|
|
156
|
-
export declare const WIN_INDEX_KEY = "_winIndex";
|
|
157
|
-
/** The line attribute a silent auction's win carries its lot number in (0.16.0, the store-data standard). */
|
|
158
|
-
export declare const LOT_NUMBER_KEY = "_lotNumber";
|
|
159
|
-
/**
|
|
160
|
-
* The cart's `auction_id` (0.16.0, the store-data standard): every show the cart's lines were won on, in
|
|
161
|
-
* order, comma-joined with no space, so the order webhook clears each. None: the tab's `fallback`.
|
|
162
|
-
*/
|
|
163
|
-
export declare function auctionIdsOf(wins: readonly Pick<AuctionWinItem, 'streamingId'>[], fallback: string): string;
|
|
164
|
-
/** A Shopify product as the session's thinner shape, with the product itself kept on `raw`. */
|
|
165
|
-
export declare function liveProductFromShopify(product: ShopifyProductForLive): LiveProduct<ShopifyProductForLive>;
|
|
166
|
-
/**
|
|
167
|
-
* The variant a win is charged on, chosen as `useAuctionWins` chooses the one it shows: the recorded
|
|
168
|
-
* one when it belongs to the product, else the first that can be sold, else the first. The checkout
|
|
169
|
-
* can be handed the raw ledger, so it chooses again rather than trusting the id. Null when the product
|
|
170
|
-
* is gone from the store.
|
|
171
|
-
*/
|
|
172
|
-
export declare function chargedVariantId(product: ShopifyProductForLive | undefined, win: AuctionWinItem): string | null;
|
|
173
|
-
/**
|
|
174
|
-
* The commerce adapter for a store on `@tiledev/sdk-shopify`.
|
|
175
|
-
*
|
|
176
|
-
* - **`productsByIds`:** one `products.byIds` read, the bare ids made into product GIDs, the photos at
|
|
177
|
-
* `imageTransform`.
|
|
178
|
-
* - **`createAuctionCheckout`:** a cart of its own for the wins, never the shopping cart, so a stepper
|
|
179
|
-
* can't change a settled price.
|
|
180
|
-
* - **Each win is a line of one,** stamped for the store's cart transform: `_winningBid` (the bid it
|
|
181
|
-
* reprices the line to; `winningBidKey`) or `prizeWriteKey` (a prize), plus `_winIndex`, which stops
|
|
182
|
-
* Shopify merging two identical wins into one line (the same lot won twice must cost twice), and a
|
|
183
|
-
* silent auction's `_lotNumber`.
|
|
184
|
-
* - **The giveaway discount codes** go on the cart.
|
|
185
|
-
* - **The cart says what it is:** `source_name`, `source_type: "auction"` and `auction_id` (every show
|
|
186
|
-
* its lines were won on, comma-joined: `auctionIdsOf`), which the order webhook matches to clear the
|
|
187
|
-
* winner's record. A checkout it can't match leaves the shopper blocked from bidding after paying.
|
|
188
|
-
* - **The buyer** is attached when there is one, so the checkout is theirs; a guest cart when there
|
|
189
|
-
* isn't, or when reading it fails.
|
|
190
|
-
* - **Refused, never guessed** (0.16.0, `CheckoutRefusedError`, as 33.2.0): a won item that can't be
|
|
191
|
-
* bought any more (it would be left off, and its show still settled), a win with no winning price
|
|
192
|
-
* above 0, or no auction id to settle; its message tells the shopper what to do.
|
|
193
|
-
* - **`commentLinkCard`** (0.12.0): a store link in a comment as a card, from `products.byHandle` or
|
|
194
|
-
* `collections.byHandle`.
|
|
195
|
-
* - **A product link:** its title, photo and lowest price; never sold out, since a whole product
|
|
196
|
-
* isn't one thing to buy.
|
|
197
|
-
* - **A variant link** (`?variant=`): that variant's title, price, photo (else the product's) and
|
|
198
|
-
* whether it can be sold. A variant that no longer exists (a deleted size) falls back to the
|
|
199
|
-
* product, since the handle is still good.
|
|
200
|
-
* - **A collection link:** its title and photo, else its first product's photo.
|
|
201
|
-
* - **Null** for a handle the store doesn't know. A failed read throws, so it is asked again.
|
|
202
|
-
*/
|
|
203
|
-
export declare function createShopifyLiveCommerce(options: ShopifyLiveCommerceOptions): ShopifyLiveCommerce;
|
|
204
|
-
//# sourceMappingURL=shopifyCommerce.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyCommerce.d.ts","sourceRoot":"","sources":["../src/shopifyCommerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKxE,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC/C;AAED,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IACpC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE;QAAE,GAAG,EAAE,YAAY,CAAA;KAAE,CAAC;IAClC,aAAa,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;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,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CA6HlG"}
|
package/dist/shopifyCommerce.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LOT_NUMBER_KEY = exports.WIN_INDEX_KEY = exports.WINNING_BID_KEY = exports.AUCTION_CART_SOURCE_TYPE = void 0;
|
|
4
|
-
exports.auctionIdsOf = auctionIdsOf;
|
|
5
|
-
exports.liveProductFromShopify = liveProductFromShopify;
|
|
6
|
-
exports.chargedVariantId = chargedVariantId;
|
|
7
|
-
exports.createShopifyLiveCommerce = createShopifyLiveCommerce;
|
|
8
|
-
const cartAttributes_1 = require("./cartAttributes");
|
|
9
|
-
const shopifyIds_1 = require("./shopifyIds");
|
|
10
|
-
const checkoutRefused_1 = require("./checkoutRefused");
|
|
11
|
-
/** A comment card's photo when the app sets none: drawn at 44pt, so 120px covers a 2x screen. */
|
|
12
|
-
const COMMENT_CARD_IMAGE = { maxWidth: 120, maxHeight: 120 };
|
|
13
|
-
/** Shopify names a single-variant product's only variant "Default Title"; showing that is noise. */
|
|
14
|
-
function variantLabel(title) {
|
|
15
|
-
const clean = (title !== null && title !== void 0 ? title : '').trim();
|
|
16
|
-
return !clean || clean.toLowerCase() === 'default title' ? null : clean;
|
|
17
|
-
}
|
|
18
|
-
/** The attributes the order webhook matches on (`source_type`, `auction_id`). They must never change. */
|
|
19
|
-
exports.AUCTION_CART_SOURCE_TYPE = 'auction';
|
|
20
|
-
/** The line attribute the store's cart transform reprices a won lot to. */
|
|
21
|
-
exports.WINNING_BID_KEY = '_winningBid';
|
|
22
|
-
/** The line attribute that keeps two identical wins on two lines. */
|
|
23
|
-
exports.WIN_INDEX_KEY = '_winIndex';
|
|
24
|
-
/** The line attribute a silent auction's win carries its lot number in (0.16.0, the store-data standard). */
|
|
25
|
-
exports.LOT_NUMBER_KEY = '_lotNumber';
|
|
26
|
-
/**
|
|
27
|
-
* The cart's `auction_id` (0.16.0, the store-data standard): every show the cart's lines were won on, in
|
|
28
|
-
* order, comma-joined with no space, so the order webhook clears each. None: the tab's `fallback`.
|
|
29
|
-
*/
|
|
30
|
-
function auctionIdsOf(wins, fallback) {
|
|
31
|
-
const ids = [...new Set(wins.map((win) => { var _a; return (_a = win.streamingId) === null || _a === void 0 ? void 0 : _a.trim(); }).filter((id) => !!id))];
|
|
32
|
-
return ids.length > 0 ? ids.join(',') : fallback;
|
|
33
|
-
}
|
|
34
|
-
/** A Shopify product as the session's thinner shape, with the product itself kept on `raw`. */
|
|
35
|
-
function liveProductFromShopify(product) {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
return {
|
|
38
|
-
id: product.id,
|
|
39
|
-
storeProductId: (0, shopifyIds_1.bareId)(product.id),
|
|
40
|
-
title: product.title,
|
|
41
|
-
price: product.priceRange.min.amount,
|
|
42
|
-
currencyCode: product.priceRange.min.currencyCode,
|
|
43
|
-
imageUrl: (_b = (_a = product.featuredImage) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : null,
|
|
44
|
-
variants: product.variants.map((variant) => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
return ({
|
|
47
|
-
id: variant.id,
|
|
48
|
-
title: variant.title,
|
|
49
|
-
price: variant.price.amount,
|
|
50
|
-
available: variant.availableForSale,
|
|
51
|
-
imageUrl: (_b = (_a = variant.image) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : null,
|
|
52
|
-
});
|
|
53
|
-
}),
|
|
54
|
-
raw: product,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The variant a win is charged on, chosen as `useAuctionWins` chooses the one it shows: the recorded
|
|
59
|
-
* one when it belongs to the product, else the first that can be sold, else the first. The checkout
|
|
60
|
-
* can be handed the raw ledger, so it chooses again rather than trusting the id. Null when the product
|
|
61
|
-
* is gone from the store.
|
|
62
|
-
*/
|
|
63
|
-
function chargedVariantId(product, win) {
|
|
64
|
-
var _a, _b, _c;
|
|
65
|
-
if (!product)
|
|
66
|
-
return null;
|
|
67
|
-
if (win.variantId) {
|
|
68
|
-
const wanted = (0, shopifyIds_1.bareId)(String(win.variantId));
|
|
69
|
-
const recorded = product.variants.find((variant) => (0, shopifyIds_1.bareId)(variant.id) === wanted);
|
|
70
|
-
if (recorded)
|
|
71
|
-
return recorded.id;
|
|
72
|
-
}
|
|
73
|
-
return (_c = (_b = ((_a = product.variants.find((variant) => variant.availableForSale)) !== null && _a !== void 0 ? _a : product.variants[0])) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : null;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The commerce adapter for a store on `@tiledev/sdk-shopify`.
|
|
77
|
-
*
|
|
78
|
-
* - **`productsByIds`:** one `products.byIds` read, the bare ids made into product GIDs, the photos at
|
|
79
|
-
* `imageTransform`.
|
|
80
|
-
* - **`createAuctionCheckout`:** a cart of its own for the wins, never the shopping cart, so a stepper
|
|
81
|
-
* can't change a settled price.
|
|
82
|
-
* - **Each win is a line of one,** stamped for the store's cart transform: `_winningBid` (the bid it
|
|
83
|
-
* reprices the line to; `winningBidKey`) or `prizeWriteKey` (a prize), plus `_winIndex`, which stops
|
|
84
|
-
* Shopify merging two identical wins into one line (the same lot won twice must cost twice), and a
|
|
85
|
-
* silent auction's `_lotNumber`.
|
|
86
|
-
* - **The giveaway discount codes** go on the cart.
|
|
87
|
-
* - **The cart says what it is:** `source_name`, `source_type: "auction"` and `auction_id` (every show
|
|
88
|
-
* its lines were won on, comma-joined: `auctionIdsOf`), which the order webhook matches to clear the
|
|
89
|
-
* winner's record. A checkout it can't match leaves the shopper blocked from bidding after paying.
|
|
90
|
-
* - **The buyer** is attached when there is one, so the checkout is theirs; a guest cart when there
|
|
91
|
-
* isn't, or when reading it fails.
|
|
92
|
-
* - **Refused, never guessed** (0.16.0, `CheckoutRefusedError`, as 33.2.0): a won item that can't be
|
|
93
|
-
* bought any more (it would be left off, and its show still settled), a win with no winning price
|
|
94
|
-
* above 0, or no auction id to settle; its message tells the shopper what to do.
|
|
95
|
-
* - **`commentLinkCard`** (0.12.0): a store link in a comment as a card, from `products.byHandle` or
|
|
96
|
-
* `collections.byHandle`.
|
|
97
|
-
* - **A product link:** its title, photo and lowest price; never sold out, since a whole product
|
|
98
|
-
* isn't one thing to buy.
|
|
99
|
-
* - **A variant link** (`?variant=`): that variant's title, price, photo (else the product's) and
|
|
100
|
-
* whether it can be sold. A variant that no longer exists (a deleted size) falls back to the
|
|
101
|
-
* product, since the handle is still good.
|
|
102
|
-
* - **A collection link:** its title and photo, else its first product's photo.
|
|
103
|
-
* - **Null** for a handle the store doesn't know. A failed read throws, so it is asked again.
|
|
104
|
-
*/
|
|
105
|
-
function createShopifyLiveCommerce(options) {
|
|
106
|
-
const { shopify, cartSourceName, prizeWriteKey, buyer, imageTransform, extraLineAttributes, extraCartAttributes, commentLinkCardImage = COMMENT_CARD_IMAGE, winningBidKey = exports.WINNING_BID_KEY, } = options;
|
|
107
|
-
async function productsByIds(storeProductIds) {
|
|
108
|
-
if (storeProductIds.length === 0)
|
|
109
|
-
return [];
|
|
110
|
-
const products = await shopify.products.byIds(storeProductIds.map(shopifyIds_1.productGid), imageTransform ? { imageTransform } : undefined);
|
|
111
|
-
return products.map(liveProductFromShopify);
|
|
112
|
-
}
|
|
113
|
-
async function createAuctionCheckout(wins, auctionId) {
|
|
114
|
-
if (wins.length === 0)
|
|
115
|
-
throw new Error('Nothing to check out');
|
|
116
|
-
const products = await shopify.products.byIds([...new Set(wins.map((win) => (0, shopifyIds_1.productGid)(win.productGid)))]);
|
|
117
|
-
const productsById = new Map(products.map((product) => [(0, shopifyIds_1.bareId)(product.id), product]));
|
|
118
|
-
const discountCodes = new Set();
|
|
119
|
-
const lines = [];
|
|
120
|
-
/** The wins that became lines: only their shows are settled by this cart. */
|
|
121
|
-
const charged = [];
|
|
122
|
-
wins.forEach((win, index) => {
|
|
123
|
-
const product = productsById.get((0, shopifyIds_1.bareId)(win.productGid));
|
|
124
|
-
const name = (product === null || product === void 0 ? void 0 : product.title) ? `“${product.title}”` : 'One of your lots';
|
|
125
|
-
const variantId = chargedVariantId(product, win);
|
|
126
|
-
// Never left out quietly: the cart would settle its show, and the lot would be marked paid unpaid.
|
|
127
|
-
if (!variantId)
|
|
128
|
-
throw new checkoutRefused_1.CheckoutRefusedError(`${name} is no longer available to buy. Please contact support to pay for it.`);
|
|
129
|
-
// A price of 0 would be charged as 0 (or, without the key, at the catalogue price).
|
|
130
|
-
if (!win.isGiveaway && !(Number.isFinite(win.winningBid) && win.winningBid > 0)) {
|
|
131
|
-
throw new checkoutRefused_1.CheckoutRefusedError(`We could not confirm the winning price for ${name}. Please contact support before paying so you are not charged the wrong amount.`);
|
|
132
|
-
}
|
|
133
|
-
charged.push(win);
|
|
134
|
-
if (win.discountCode)
|
|
135
|
-
discountCodes.add(win.discountCode);
|
|
136
|
-
lines.push({
|
|
137
|
-
merchandiseId: variantId,
|
|
138
|
-
quantity: 1,
|
|
139
|
-
attributes: [
|
|
140
|
-
win.isGiveaway
|
|
141
|
-
? { key: prizeWriteKey, value: 'true' }
|
|
142
|
-
: { key: winningBidKey, value: String(win.winningBid) },
|
|
143
|
-
{ key: exports.WIN_INDEX_KEY, value: String(index) },
|
|
144
|
-
...(win.lotNumber != null ? [{ key: exports.LOT_NUMBER_KEY, value: String(win.lotNumber) }] : []),
|
|
145
|
-
// The show it was won on (`_stream_id`), as a line added during the show carries it.
|
|
146
|
-
...(0, cartAttributes_1.wonLotAttributesFor)(win.streamingId),
|
|
147
|
-
...(extraLineAttributes ? extraLineAttributes(win) : []),
|
|
148
|
-
],
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
if (lines.length === 0)
|
|
152
|
-
throw new Error('None of the won items can be sold');
|
|
153
|
-
// No auction to settle: the order webhook could never mark these lots paid.
|
|
154
|
-
const auctionIds = auctionIdsOf(charged, auctionId.trim());
|
|
155
|
-
if (!auctionIds)
|
|
156
|
-
throw new checkoutRefused_1.CheckoutRefusedError('We could not tell which auction this is for. Please reopen the auction cart and try again.');
|
|
157
|
-
const buyerIdentity = await buyer().catch(() => null);
|
|
158
|
-
const cart = await shopify.cart.create({
|
|
159
|
-
lines,
|
|
160
|
-
discountCodes: [...discountCodes],
|
|
161
|
-
attributes: [
|
|
162
|
-
{ key: 'source_name', value: cartSourceName },
|
|
163
|
-
{ key: 'source_type', value: exports.AUCTION_CART_SOURCE_TYPE },
|
|
164
|
-
{ key: 'auction_id', value: auctionIds },
|
|
165
|
-
...(extraCartAttributes ? extraCartAttributes(lines) : []),
|
|
166
|
-
],
|
|
167
|
-
...(buyerIdentity ? { buyerIdentity } : {}),
|
|
168
|
-
});
|
|
169
|
-
return { checkoutUrl: cart.checkoutUrl, cartId: cart.id };
|
|
170
|
-
}
|
|
171
|
-
async function commentLinkCard(link) {
|
|
172
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
173
|
-
const options = { imageTransform: commentLinkCardImage };
|
|
174
|
-
if (link.kind === 'product') {
|
|
175
|
-
if (!shopify.products.byHandle)
|
|
176
|
-
return null;
|
|
177
|
-
const product = await shopify.products.byHandle(link.handle, options);
|
|
178
|
-
if (!product)
|
|
179
|
-
return null;
|
|
180
|
-
const wanted = link.variantId ? (0, shopifyIds_1.bareId)(link.variantId) : null;
|
|
181
|
-
const variant = wanted ? product.variants.find((candidate) => (0, shopifyIds_1.bareId)(candidate.id) === wanted) : undefined;
|
|
182
|
-
if (variant) {
|
|
183
|
-
return {
|
|
184
|
-
url: link.url,
|
|
185
|
-
kind: 'product',
|
|
186
|
-
title: product.title,
|
|
187
|
-
variantTitle: variantLabel(variant.title),
|
|
188
|
-
price: variant.price,
|
|
189
|
-
imageUrl: (_d = (_b = (_a = variant.image) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : (_c = product.featuredImage) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : null,
|
|
190
|
-
available: variant.availableForSale,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
url: link.url,
|
|
195
|
-
kind: 'product',
|
|
196
|
-
title: product.title,
|
|
197
|
-
variantTitle: null,
|
|
198
|
-
price: product.priceRange.min,
|
|
199
|
-
imageUrl: (_f = (_e = product.featuredImage) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : null,
|
|
200
|
-
available: true,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
if (!shopify.collections)
|
|
204
|
-
return null;
|
|
205
|
-
const collection = await shopify.collections.byHandle(link.handle, options);
|
|
206
|
-
if (!collection)
|
|
207
|
-
return null;
|
|
208
|
-
let imageUrl = (_h = (_g = collection.image) === null || _g === void 0 ? void 0 : _g.url) !== null && _h !== void 0 ? _h : null;
|
|
209
|
-
if (!imageUrl) {
|
|
210
|
-
const first = await shopify.collections.products(link.handle, { first: 1, ...options });
|
|
211
|
-
imageUrl = (_l = (_k = (_j = first.nodes[0]) === null || _j === void 0 ? void 0 : _j.featuredImage) === null || _k === void 0 ? void 0 : _k.url) !== null && _l !== void 0 ? _l : null;
|
|
212
|
-
}
|
|
213
|
-
return { url: link.url, kind: 'collection', title: collection.title, variantTitle: null, price: null, imageUrl, available: true };
|
|
214
|
-
}
|
|
215
|
-
return { productsByIds, createAuctionCheckout, commentLinkCard };
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=shopifyCommerce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyCommerce.js","sourceRoot":"","sources":["../src/shopifyCommerce.ts"],"names":[],"mappings":";;;AAgKA,oCAGC;AAGD,wDAiBC;AAQD,4CAQC;AAgCD,8DA6HC;AAtVD,qDAAuD;AACvD,6CAAkD;AAClD,uDAAyD;AA0HzD,iGAAiG;AACjG,MAAM,kBAAkB,GAA0B,EAAE,QAAQ,EAAE,GAAG,EAAE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;QACD,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACpI,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Who is watching, bidding and paying, for an app signed in through `@tiledev/sdk-shopify`.
|
|
3
|
-
*
|
|
4
|
-
* A function the app calls with a reader, not a hook: a hook would have to call sdk-shopify's
|
|
5
|
-
* `useCustomer()` itself, from whichever copy of sdk-shopify this package found, which may not be the
|
|
6
|
-
* one the app signed in with (see `shopifyCommerce.ts`). The app keeps its own `useCustomer()` result
|
|
7
|
-
* in a ref and passes `() => ref.current`.
|
|
8
|
-
*/
|
|
9
|
-
import type { CustomerAccountRequest } from './types';
|
|
10
|
-
import type { IdentityAdapter } from './sessionTypes';
|
|
11
|
-
import type { ShopifyBuyer } from './shopifyCommerce';
|
|
12
|
-
/** The parts of sdk-shopify's `useCustomer()` result this file reads. */
|
|
13
|
-
export interface ShopifyCustomerSession {
|
|
14
|
-
loggedIn: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Reading a stored sign-in on app open, as distinct from signed out. Optional, so a hand-made
|
|
17
|
-
* session without it reads as finished.
|
|
18
|
-
*/
|
|
19
|
-
restoring?: boolean;
|
|
20
|
-
/** How the shopper signed in: `'shopify'` (Shopify's own sign-in) or `'password'`; null when signed out. */
|
|
21
|
-
sessionKind: string | null;
|
|
22
|
-
customer: {
|
|
23
|
-
id: string;
|
|
24
|
-
email: string | null;
|
|
25
|
-
firstName: string | null;
|
|
26
|
-
lastName: string | null;
|
|
27
|
-
} | null;
|
|
28
|
-
/** A usable access token, refreshed when needed; null when signed out. */
|
|
29
|
-
getAccessToken(): Promise<string | null>;
|
|
30
|
-
/** A Customer Account API call for the signed-in shopper. */
|
|
31
|
-
request<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
32
|
-
}
|
|
33
|
-
export interface ShopifyLiveIdentity {
|
|
34
|
-
/** For `LiveSellingConfig.identity`. */
|
|
35
|
-
identity: Required<IdentityAdapter>;
|
|
36
|
-
/** For `LiveSellingConfig.customerAccountRequest`: the customer's own `request`. */
|
|
37
|
-
customerAccountRequest: CustomerAccountRequest;
|
|
38
|
-
/** For `createShopifyLiveCommerce`'s `buyer`: the customer's access token and email; null when signed out. */
|
|
39
|
-
buyer: () => Promise<ShopifyBuyer | null>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The identity, the Customer Account transport and the buyer, from the signed-in customer.
|
|
43
|
-
*
|
|
44
|
-
* `readCustomer` is called each time the SDK asks, so each answer is about the customer as they are
|
|
45
|
-
* then: sign in or out and the next bid, entry or checkout sees it.
|
|
46
|
-
*
|
|
47
|
-
* - **The bidder** is the customer's bare numeric id, the id the host's broadcast echoes back, and the
|
|
48
|
-
* customer reference is their GID. Both only for a Shopify sign-in: the winner's record is on the
|
|
49
|
-
* Customer Account API, so an email-and-password session can't bid or enter.
|
|
50
|
-
* - **The name** is first and last name, else whichever of the two they gave (`viewerNameFor`); null
|
|
51
|
-
* when their account has no name, and when signed out. Never the email nor any part of it (0.13.0):
|
|
52
|
-
* from 0.9.0 a customer with no name was called by the part of their email before the @, and before
|
|
53
|
-
* 0.9.0 a first name typed as an email was published whole.
|
|
54
|
-
* - **The buyer** is the customer's access token and email, for the wins cart.
|
|
55
|
-
* - **Still loading** while sdk-shopify reads the stored sign-in on app open (`restoring`), so the
|
|
56
|
-
* session enters a show's room under the shopper's name, not "Anonymous" (0.9.2); and, since 0.13.0,
|
|
57
|
-
* while a shopper who has just signed in has no profile yet (`loggedIn` with no `customer`), so a
|
|
58
|
-
* comment sent in that moment waits for their name rather than going out under another.
|
|
59
|
-
*/
|
|
60
|
-
export declare function createShopifyLiveIdentity(readCustomer: () => ShopifyCustomerSession): ShopifyLiveIdentity;
|
|
61
|
-
//# sourceMappingURL=shopifyIdentity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyIdentity.d.ts","sourceRoot":"","sources":["../src/shopifyIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,yEAAyE;AACzE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4GAA4G;IAC5G,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACzG,0EAA0E;IAC1E,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,6DAA6D;IAC7D,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACpC,oFAAoF;IACpF,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,8GAA8G;IAC9G,KAAK,EAAE,MAAM,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,sBAAsB,GAAG,mBAAmB,CAkCzG"}
|
package/dist/shopifyIdentity.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createShopifyLiveIdentity = createShopifyLiveIdentity;
|
|
4
|
-
const shopifyIds_1 = require("./shopifyIds");
|
|
5
|
-
const showNames_1 = require("./showNames");
|
|
6
|
-
/**
|
|
7
|
-
* The identity, the Customer Account transport and the buyer, from the signed-in customer.
|
|
8
|
-
*
|
|
9
|
-
* `readCustomer` is called each time the SDK asks, so each answer is about the customer as they are
|
|
10
|
-
* then: sign in or out and the next bid, entry or checkout sees it.
|
|
11
|
-
*
|
|
12
|
-
* - **The bidder** is the customer's bare numeric id, the id the host's broadcast echoes back, and the
|
|
13
|
-
* customer reference is their GID. Both only for a Shopify sign-in: the winner's record is on the
|
|
14
|
-
* Customer Account API, so an email-and-password session can't bid or enter.
|
|
15
|
-
* - **The name** is first and last name, else whichever of the two they gave (`viewerNameFor`); null
|
|
16
|
-
* when their account has no name, and when signed out. Never the email nor any part of it (0.13.0):
|
|
17
|
-
* from 0.9.0 a customer with no name was called by the part of their email before the @, and before
|
|
18
|
-
* 0.9.0 a first name typed as an email was published whole.
|
|
19
|
-
* - **The buyer** is the customer's access token and email, for the wins cart.
|
|
20
|
-
* - **Still loading** while sdk-shopify reads the stored sign-in on app open (`restoring`), so the
|
|
21
|
-
* session enters a show's room under the shopper's name, not "Anonymous" (0.9.2); and, since 0.13.0,
|
|
22
|
-
* while a shopper who has just signed in has no profile yet (`loggedIn` with no `customer`), so a
|
|
23
|
-
* comment sent in that moment waits for their name rather than going out under another.
|
|
24
|
-
*/
|
|
25
|
-
function createShopifyLiveIdentity(readCustomer) {
|
|
26
|
-
const signedInWithShopify = () => {
|
|
27
|
-
const current = readCustomer();
|
|
28
|
-
return current.loggedIn && current.sessionKind === 'shopify';
|
|
29
|
-
};
|
|
30
|
-
function customerAccountRequest(query, variables) {
|
|
31
|
-
return readCustomer().request(query, variables);
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
identity: {
|
|
35
|
-
bidderId: () => {
|
|
36
|
-
const customer = readCustomer().customer;
|
|
37
|
-
return signedInWithShopify() && customer ? (0, shopifyIds_1.bareId)(customer.id) : null;
|
|
38
|
-
},
|
|
39
|
-
customerRef: () => { var _a, _b; return (signedInWithShopify() ? (_b = (_a = readCustomer().customer) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null : null); },
|
|
40
|
-
customerName: () => (0, showNames_1.viewerNameFor)(readCustomer().customer),
|
|
41
|
-
customerEmail: () => { var _a, _b; return (_b = (_a = readCustomer().customer) === null || _a === void 0 ? void 0 : _a.email) !== null && _b !== void 0 ? _b : null; },
|
|
42
|
-
customerLoading: () => {
|
|
43
|
-
const current = readCustomer();
|
|
44
|
-
return current.restoring === true || (current.loggedIn && !current.customer);
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
customerAccountRequest,
|
|
48
|
-
buyer: async () => {
|
|
49
|
-
var _a;
|
|
50
|
-
const current = readCustomer();
|
|
51
|
-
if (!current.loggedIn)
|
|
52
|
-
return null;
|
|
53
|
-
const token = await current.getAccessToken();
|
|
54
|
-
if (!token)
|
|
55
|
-
return null;
|
|
56
|
-
const email = (_a = current.customer) === null || _a === void 0 ? void 0 : _a.email;
|
|
57
|
-
return { customerAccessToken: token, ...(email ? { email } : {}) };
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=shopifyIdentity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyIdentity.js","sourceRoot":"","sources":["../src/shopifyIdentity.ts"],"names":[],"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AAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC/E,CAAC;SACF;QACD,sBAAsB;QACtB,KAAK,EAAE,KAAK,IAAI,EAAE;;YAChB,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAC;YACnC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;YAC7C,IAAI,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAC;YACxB,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,QAAQ,0CAAE,KAAK,CAAC;YACtC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACrE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/shopifyIds.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shopify ids, in the two forms they arrive in. The gateway and the host's dashboard use the bare
|
|
3
|
-
* number (`42`); the Storefront API uses the GID (`gid://shopify/Product/42`).
|
|
4
|
-
*/
|
|
5
|
-
/** The bare number at the end of an id, whichever form it arrives in: `gid://shopify/Product/42` and `42` are both `42`. */
|
|
6
|
-
export declare function bareId(id: string): string;
|
|
7
|
-
/** A product GID, from a bare id or a GID. */
|
|
8
|
-
export declare function productGid(id: string): string;
|
|
9
|
-
//# sourceMappingURL=shopifyIds.d.ts.map
|
package/dist/shopifyIds.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyIds.d.ts","sourceRoot":"","sources":["../src/shopifyIds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4HAA4H;AAC5H,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED,8CAA8C;AAC9C,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
package/dist/shopifyIds.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shopify ids, in the two forms they arrive in. The gateway and the host's dashboard use the bare
|
|
4
|
-
* number (`42`); the Storefront API uses the GID (`gid://shopify/Product/42`).
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.bareId = bareId;
|
|
8
|
-
exports.productGid = productGid;
|
|
9
|
-
/** The bare number at the end of an id, whichever form it arrives in: `gid://shopify/Product/42` and `42` are both `42`. */
|
|
10
|
-
function bareId(id) {
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = id.split('/').pop()) !== null && _a !== void 0 ? _a : id;
|
|
13
|
-
}
|
|
14
|
-
/** A product GID, from a bare id or a GID. */
|
|
15
|
-
function productGid(id) {
|
|
16
|
-
return id.startsWith('gid://') ? id : `gid://shopify/Product/${bareId(id)}`;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=shopifyIds.js.map
|
package/dist/shopifyIds.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shopifyIds.js","sourceRoot":"","sources":["../src/shopifyIds.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAGH,wBAEC;AAGD,gCAEC;AARD,4HAA4H;AAC5H,SAAgB,MAAM,CAAC,EAAU;;IAC/B,OAAO,MAAA,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,mCAAI,EAAE,CAAC;AACnC,CAAC;AAED,8CAA8C;AAC9C,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,yBAAyB,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|