@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.
Files changed (410) hide show
  1. package/dist/attribution.d.ts +2 -16
  2. package/dist/attribution.d.ts.map +1 -1
  3. package/dist/attribution.js +4 -10
  4. package/dist/attribution.js.map +1 -1
  5. package/dist/auctions.d.ts.map +1 -1
  6. package/dist/auctions.js +11 -42
  7. package/dist/auctions.js.map +1 -1
  8. package/dist/cartAttributes.d.ts +0 -10
  9. package/dist/cartAttributes.d.ts.map +1 -1
  10. package/dist/cartAttributes.js +1 -20
  11. package/dist/cartAttributes.js.map +1 -1
  12. package/dist/client.d.ts +2 -51
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/client.js +23 -123
  15. package/dist/client.js.map +1 -1
  16. package/dist/clips.d.ts +1 -12
  17. package/dist/clips.d.ts.map +1 -1
  18. package/dist/clips.js +6 -114
  19. package/dist/clips.js.map +1 -1
  20. package/dist/commentLinks.d.ts +0 -29
  21. package/dist/commentLinks.d.ts.map +1 -1
  22. package/dist/commentLinks.js.map +1 -1
  23. package/dist/engine.native.d.ts.map +1 -1
  24. package/dist/engine.native.js +845 -17
  25. package/dist/engine.native.js.map +1 -1
  26. package/dist/index.d.ts +4 -48
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +3 -240
  29. package/dist/index.js.map +1 -1
  30. package/dist/polls.d.ts.map +1 -1
  31. package/dist/polls.js +0 -3
  32. package/dist/polls.js.map +1 -1
  33. package/dist/react/LiveSellingProvider.d.ts +1 -54
  34. package/dist/react/LiveSellingProvider.d.ts.map +1 -1
  35. package/dist/react/LiveSellingProvider.js +3 -60
  36. package/dist/react/LiveSellingProvider.js.map +1 -1
  37. package/dist/react/LiveVideoTarget.d.ts.map +1 -1
  38. package/dist/react/LiveVideoTarget.js +3 -41
  39. package/dist/react/LiveVideoTarget.js.map +1 -1
  40. package/dist/react/index.d.ts +3 -30
  41. package/dist/react/index.d.ts.map +1 -1
  42. package/dist/react/index.js +1 -79
  43. package/dist/react/index.js.map +1 -1
  44. package/dist/react/index.web.d.ts +32 -36
  45. package/dist/react/index.web.d.ts.map +1 -1
  46. package/dist/react/index.web.js +122 -102
  47. package/dist/react/index.web.js.map +1 -1
  48. package/dist/react/useAuctionBidGate.d.ts +6 -62
  49. package/dist/react/useAuctionBidGate.d.ts.map +1 -1
  50. package/dist/react/useAuctionBidGate.js +27 -228
  51. package/dist/react/useAuctionBidGate.js.map +1 -1
  52. package/dist/react/useAuctionWins.d.ts +4 -14
  53. package/dist/react/useAuctionWins.d.ts.map +1 -1
  54. package/dist/react/useAuctionWins.js +5 -16
  55. package/dist/react/useAuctionWins.js.map +1 -1
  56. package/dist/react/useClips.d.ts +1 -7
  57. package/dist/react/useClips.d.ts.map +1 -1
  58. package/dist/react/useClips.js +7 -20
  59. package/dist/react/useClips.js.map +1 -1
  60. package/dist/react/useLiveSession.d.ts +3 -15
  61. package/dist/react/useLiveSession.d.ts.map +1 -1
  62. package/dist/react/useLiveSession.js +199 -612
  63. package/dist/react/useLiveSession.js.map +1 -1
  64. package/dist/react/useLiveStreams.d.ts.map +1 -1
  65. package/dist/react/useLiveStreams.js +2 -6
  66. package/dist/react/useLiveStreams.js.map +1 -1
  67. package/dist/react/useOngoingLive.d.ts +0 -1
  68. package/dist/react/useOngoingLive.d.ts.map +1 -1
  69. package/dist/react/useOngoingLive.js +1 -7
  70. package/dist/react/useOngoingLive.js.map +1 -1
  71. package/dist/react/useReplays.d.ts +0 -12
  72. package/dist/react/useReplays.d.ts.map +1 -1
  73. package/dist/react/useReplays.js +24 -56
  74. package/dist/react/useReplays.js.map +1 -1
  75. package/dist/react/useStreamInfo.d.ts +2 -13
  76. package/dist/react/useStreamInfo.d.ts.map +1 -1
  77. package/dist/react/useStreamInfo.js +8 -36
  78. package/dist/react/useStreamInfo.js.map +1 -1
  79. package/dist/replays.d.ts +0 -14
  80. package/dist/replays.d.ts.map +1 -1
  81. package/dist/replays.js +22 -68
  82. package/dist/replays.js.map +1 -1
  83. package/dist/session.d.ts +6 -39
  84. package/dist/session.d.ts.map +1 -1
  85. package/dist/session.js +22 -209
  86. package/dist/session.js.map +1 -1
  87. package/dist/sessionTypes.d.ts +18 -217
  88. package/dist/sessionTypes.d.ts.map +1 -1
  89. package/dist/sessionTypes.js +1 -2
  90. package/dist/sessionTypes.js.map +1 -1
  91. package/dist/streams.d.ts +1 -27
  92. package/dist/streams.d.ts.map +1 -1
  93. package/dist/streams.js +21 -84
  94. package/dist/streams.js.map +1 -1
  95. package/dist/types.d.ts +10 -288
  96. package/dist/types.d.ts.map +1 -1
  97. package/dist/types.js +1 -2
  98. package/dist/types.js.map +1 -1
  99. package/dist/wire.d.ts +0 -31
  100. package/dist/wire.d.ts.map +1 -1
  101. package/dist/wire.js +0 -25
  102. package/dist/wire.js.map +1 -1
  103. package/dist/zego.d.ts +1 -3
  104. package/dist/zego.d.ts.map +1 -1
  105. package/dist/zego.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/auctionComments.d.ts +0 -25
  108. package/dist/auctionComments.d.ts.map +0 -1
  109. package/dist/auctionComments.js +0 -28
  110. package/dist/auctionComments.js.map +0 -1
  111. package/dist/auctionRules.d.ts +0 -77
  112. package/dist/auctionRules.d.ts.map +0 -1
  113. package/dist/auctionRules.js +0 -107
  114. package/dist/auctionRules.js.map +0 -1
  115. package/dist/cartExtension.d.ts +0 -39
  116. package/dist/cartExtension.d.ts.map +0 -1
  117. package/dist/cartExtension.js +0 -51
  118. package/dist/cartExtension.js.map +0 -1
  119. package/dist/checkoutRefused.d.ts +0 -9
  120. package/dist/checkoutRefused.d.ts.map +0 -1
  121. package/dist/checkoutRefused.js +0 -16
  122. package/dist/checkoutRefused.js.map +0 -1
  123. package/dist/clipsPage.d.ts +0 -29
  124. package/dist/clipsPage.d.ts.map +0 -1
  125. package/dist/clipsPage.js +0 -49
  126. package/dist/clipsPage.js.map +0 -1
  127. package/dist/commentHistory.d.ts +0 -70
  128. package/dist/commentHistory.d.ts.map +0 -1
  129. package/dist/commentHistory.js +0 -133
  130. package/dist/commentHistory.js.map +0 -1
  131. package/dist/commentLinkCards.d.ts +0 -11
  132. package/dist/commentLinkCards.d.ts.map +0 -1
  133. package/dist/commentLinkCards.js +0 -70
  134. package/dist/commentLinkCards.js.map +0 -1
  135. package/dist/giveawayPrize.d.ts +0 -13
  136. package/dist/giveawayPrize.d.ts.map +0 -1
  137. package/dist/giveawayPrize.js +0 -18
  138. package/dist/giveawayPrize.js.map +0 -1
  139. package/dist/giveawayPrizeLines.d.ts +0 -120
  140. package/dist/giveawayPrizeLines.d.ts.map +0 -1
  141. package/dist/giveawayPrizeLines.js +0 -97
  142. package/dist/giveawayPrizeLines.js.map +0 -1
  143. package/dist/giveawayPrizes.d.ts +0 -20
  144. package/dist/giveawayPrizes.d.ts.map +0 -1
  145. package/dist/giveawayPrizes.js +0 -50
  146. package/dist/giveawayPrizes.js.map +0 -1
  147. package/dist/giveawayRoster.d.ts +0 -53
  148. package/dist/giveawayRoster.d.ts.map +0 -1
  149. package/dist/giveawayRoster.js +0 -93
  150. package/dist/giveawayRoster.js.map +0 -1
  151. package/dist/heldComments.d.ts +0 -40
  152. package/dist/heldComments.d.ts.map +0 -1
  153. package/dist/heldComments.js +0 -75
  154. package/dist/heldComments.js.map +0 -1
  155. package/dist/hiddenShows.d.ts +0 -44
  156. package/dist/hiddenShows.d.ts.map +0 -1
  157. package/dist/hiddenShows.js +0 -53
  158. package/dist/hiddenShows.js.map +0 -1
  159. package/dist/linkLots.d.ts +0 -64
  160. package/dist/linkLots.d.ts.map +0 -1
  161. package/dist/linkLots.js +0 -84
  162. package/dist/linkLots.js.map +0 -1
  163. package/dist/liveHaptics.d.ts +0 -7
  164. package/dist/liveHaptics.d.ts.map +0 -1
  165. package/dist/liveHaptics.js +0 -11
  166. package/dist/liveHaptics.js.map +0 -1
  167. package/dist/liveHaptics.native.d.ts +0 -7
  168. package/dist/liveHaptics.native.d.ts.map +0 -1
  169. package/dist/liveHaptics.native.js +0 -12
  170. package/dist/liveHaptics.native.js.map +0 -1
  171. package/dist/livePages.d.ts +0 -176
  172. package/dist/livePages.d.ts.map +0 -1
  173. package/dist/livePages.js +0 -216
  174. package/dist/livePages.js.map +0 -1
  175. package/dist/liveRoom.d.ts +0 -21
  176. package/dist/liveRoom.d.ts.map +0 -1
  177. package/dist/liveRoom.js +0 -28
  178. package/dist/liveRoom.js.map +0 -1
  179. package/dist/liveShow.d.ts +0 -65
  180. package/dist/liveShow.d.ts.map +0 -1
  181. package/dist/liveShow.js +0 -65
  182. package/dist/liveShow.js.map +0 -1
  183. package/dist/missedPolls.d.ts +0 -27
  184. package/dist/missedPolls.d.ts.map +0 -1
  185. package/dist/missedPolls.js +0 -16
  186. package/dist/missedPolls.js.map +0 -1
  187. package/dist/pageOptions.d.ts +0 -149
  188. package/dist/pageOptions.d.ts.map +0 -1
  189. package/dist/pageOptions.js +0 -123
  190. package/dist/pageOptions.js.map +0 -1
  191. package/dist/pageTypes.d.ts +0 -185
  192. package/dist/pageTypes.d.ts.map +0 -1
  193. package/dist/pageTypes.js +0 -3
  194. package/dist/pageTypes.js.map +0 -1
  195. package/dist/phoneTaps.d.ts +0 -25
  196. package/dist/phoneTaps.d.ts.map +0 -1
  197. package/dist/phoneTaps.js +0 -47
  198. package/dist/phoneTaps.js.map +0 -1
  199. package/dist/pipWindow.d.ts +0 -85
  200. package/dist/pipWindow.d.ts.map +0 -1
  201. package/dist/pipWindow.js +0 -88
  202. package/dist/pipWindow.js.map +0 -1
  203. package/dist/react/clocks.d.ts +0 -29
  204. package/dist/react/clocks.d.ts.map +0 -1
  205. package/dist/react/clocks.js +0 -124
  206. package/dist/react/clocks.js.map +0 -1
  207. package/dist/react/navigation.d.ts +0 -13
  208. package/dist/react/navigation.d.ts.map +0 -1
  209. package/dist/react/navigation.js +0 -7
  210. package/dist/react/navigation.js.map +0 -1
  211. package/dist/react/platformSession.d.ts +0 -16
  212. package/dist/react/platformSession.d.ts.map +0 -1
  213. package/dist/react/platformSession.js +0 -28
  214. package/dist/react/platformSession.js.map +0 -1
  215. package/dist/react/platformSession.web.d.ts +0 -35
  216. package/dist/react/platformSession.web.d.ts.map +0 -1
  217. package/dist/react/platformSession.web.js +0 -148
  218. package/dist/react/platformSession.web.js.map +0 -1
  219. package/dist/react/replayPlayer.d.ts +0 -83
  220. package/dist/react/replayPlayer.d.ts.map +0 -1
  221. package/dist/react/replayPlayer.js +0 -315
  222. package/dist/react/replayPlayer.js.map +0 -1
  223. package/dist/react/share.d.ts +0 -22
  224. package/dist/react/share.d.ts.map +0 -1
  225. package/dist/react/share.js +0 -45
  226. package/dist/react/share.js.map +0 -1
  227. package/dist/react/shopifyProviders.d.ts +0 -82
  228. package/dist/react/shopifyProviders.d.ts.map +0 -1
  229. package/dist/react/shopifyProviders.js +0 -113
  230. package/dist/react/shopifyProviders.js.map +0 -1
  231. package/dist/react/showPages.d.ts +0 -106
  232. package/dist/react/showPages.d.ts.map +0 -1
  233. package/dist/react/showPages.js +0 -166
  234. package/dist/react/showPages.js.map +0 -1
  235. package/dist/react/showPagesOnDevice.d.ts +0 -18
  236. package/dist/react/showPagesOnDevice.d.ts.map +0 -1
  237. package/dist/react/showPagesOnDevice.js +0 -31
  238. package/dist/react/showPagesOnDevice.js.map +0 -1
  239. package/dist/react/startSignIn.d.ts +0 -3
  240. package/dist/react/startSignIn.d.ts.map +0 -1
  241. package/dist/react/startSignIn.js +0 -19
  242. package/dist/react/startSignIn.js.map +0 -1
  243. package/dist/react/systemPictureInPicture.d.ts +0 -34
  244. package/dist/react/systemPictureInPicture.d.ts.map +0 -1
  245. package/dist/react/systemPictureInPicture.js +0 -93
  246. package/dist/react/systemPictureInPicture.js.map +0 -1
  247. package/dist/react/useAccountName.d.ts +0 -8
  248. package/dist/react/useAccountName.d.ts.map +0 -1
  249. package/dist/react/useAccountName.js +0 -49
  250. package/dist/react/useAccountName.js.map +0 -1
  251. package/dist/react/useClipsPage.d.ts +0 -47
  252. package/dist/react/useClipsPage.d.ts.map +0 -1
  253. package/dist/react/useClipsPage.js +0 -130
  254. package/dist/react/useClipsPage.js.map +0 -1
  255. package/dist/react/useCommentLinkCards.d.ts +0 -6
  256. package/dist/react/useCommentLinkCards.d.ts.map +0 -1
  257. package/dist/react/useCommentLinkCards.js +0 -67
  258. package/dist/react/useCommentLinkCards.js.map +0 -1
  259. package/dist/react/useFeaturedClip.d.ts +0 -15
  260. package/dist/react/useFeaturedClip.d.ts.map +0 -1
  261. package/dist/react/useFeaturedClip.js +0 -52
  262. package/dist/react/useFeaturedClip.js.map +0 -1
  263. package/dist/react/useGiveawayEntry.d.ts +0 -59
  264. package/dist/react/useGiveawayEntry.d.ts.map +0 -1
  265. package/dist/react/useGiveawayEntry.js +0 -170
  266. package/dist/react/useGiveawayEntry.js.map +0 -1
  267. package/dist/react/useGiveawayPrize.d.ts +0 -12
  268. package/dist/react/useGiveawayPrize.d.ts.map +0 -1
  269. package/dist/react/useGiveawayPrize.js +0 -53
  270. package/dist/react/useGiveawayPrize.js.map +0 -1
  271. package/dist/react/useGiveawayPrizes.d.ts +0 -4
  272. package/dist/react/useGiveawayPrizes.d.ts.map +0 -1
  273. package/dist/react/useGiveawayPrizes.js +0 -58
  274. package/dist/react/useGiveawayPrizes.js.map +0 -1
  275. package/dist/react/useHiddenShows.d.ts +0 -10
  276. package/dist/react/useHiddenShows.d.ts.map +0 -1
  277. package/dist/react/useHiddenShows.js +0 -30
  278. package/dist/react/useHiddenShows.js.map +0 -1
  279. package/dist/react/useKeepScreenAwake.d.ts +0 -2
  280. package/dist/react/useKeepScreenAwake.d.ts.map +0 -1
  281. package/dist/react/useKeepScreenAwake.js +0 -34
  282. package/dist/react/useKeepScreenAwake.js.map +0 -1
  283. package/dist/react/useLiveAuction.d.ts +0 -106
  284. package/dist/react/useLiveAuction.d.ts.map +0 -1
  285. package/dist/react/useLiveAuction.js +0 -255
  286. package/dist/react/useLiveAuction.js.map +0 -1
  287. package/dist/react/useLiveChat.d.ts +0 -110
  288. package/dist/react/useLiveChat.d.ts.map +0 -1
  289. package/dist/react/useLiveChat.js +0 -230
  290. package/dist/react/useLiveChat.js.map +0 -1
  291. package/dist/react/useLiveGiveawaysAndPolls.d.ts +0 -95
  292. package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +0 -1
  293. package/dist/react/useLiveGiveawaysAndPolls.js +0 -225
  294. package/dist/react/useLiveGiveawaysAndPolls.js.map +0 -1
  295. package/dist/react/useLivePage.d.ts +0 -136
  296. package/dist/react/useLivePage.d.ts.map +0 -1
  297. package/dist/react/useLivePage.js +0 -319
  298. package/dist/react/useLivePage.js.map +0 -1
  299. package/dist/react/useLiveShop.d.ts +0 -97
  300. package/dist/react/useLiveShop.d.ts.map +0 -1
  301. package/dist/react/useLiveShop.js +0 -197
  302. package/dist/react/useLiveShop.js.map +0 -1
  303. package/dist/react/useLiveShow.d.ts +0 -3
  304. package/dist/react/useLiveShow.d.ts.map +0 -1
  305. package/dist/react/useLiveShow.js +0 -21
  306. package/dist/react/useLiveShow.js.map +0 -1
  307. package/dist/react/useMySilentAuctionBids.d.ts +0 -29
  308. package/dist/react/useMySilentAuctionBids.d.ts.map +0 -1
  309. package/dist/react/useMySilentAuctionBids.js +0 -157
  310. package/dist/react/useMySilentAuctionBids.js.map +0 -1
  311. package/dist/react/useReplayPage.d.ts +0 -155
  312. package/dist/react/useReplayPage.d.ts.map +0 -1
  313. package/dist/react/useReplayPage.js +0 -580
  314. package/dist/react/useReplayPage.js.map +0 -1
  315. package/dist/react/useSilentAuctionLot.d.ts +0 -44
  316. package/dist/react/useSilentAuctionLot.d.ts.map +0 -1
  317. package/dist/react/useSilentAuctionLot.js +0 -168
  318. package/dist/react/useSilentAuctionLot.js.map +0 -1
  319. package/dist/react/useSilentAuctionLots.d.ts +0 -41
  320. package/dist/react/useSilentAuctionLots.d.ts.map +0 -1
  321. package/dist/react/useSilentAuctionLots.js +0 -64
  322. package/dist/react/useSilentAuctionLots.js.map +0 -1
  323. package/dist/react/useSilentAuctionRounds.d.ts +0 -15
  324. package/dist/react/useSilentAuctionRounds.d.ts.map +0 -1
  325. package/dist/react/useSilentAuctionRounds.js +0 -44
  326. package/dist/react/useSilentAuctionRounds.js.map +0 -1
  327. package/dist/replayPages.d.ts +0 -31
  328. package/dist/replayPages.d.ts.map +0 -1
  329. package/dist/replayPages.js +0 -34
  330. package/dist/replayPages.js.map +0 -1
  331. package/dist/shopifyCommerce.d.ts +0 -204
  332. package/dist/shopifyCommerce.d.ts.map +0 -1
  333. package/dist/shopifyCommerce.js +0 -217
  334. package/dist/shopifyCommerce.js.map +0 -1
  335. package/dist/shopifyIdentity.d.ts +0 -61
  336. package/dist/shopifyIdentity.d.ts.map +0 -1
  337. package/dist/shopifyIdentity.js +0 -61
  338. package/dist/shopifyIdentity.js.map +0 -1
  339. package/dist/shopifyIds.d.ts +0 -9
  340. package/dist/shopifyIds.d.ts.map +0 -1
  341. package/dist/shopifyIds.js +0 -18
  342. package/dist/shopifyIds.js.map +0 -1
  343. package/dist/showCredit.d.ts +0 -89
  344. package/dist/showCredit.d.ts.map +0 -1
  345. package/dist/showCredit.js +0 -120
  346. package/dist/showCredit.js.map +0 -1
  347. package/dist/showLinks.d.ts +0 -24
  348. package/dist/showLinks.d.ts.map +0 -1
  349. package/dist/showLinks.js +0 -23
  350. package/dist/showLinks.js.map +0 -1
  351. package/dist/showLots.d.ts +0 -44
  352. package/dist/showLots.d.ts.map +0 -1
  353. package/dist/showLots.js +0 -70
  354. package/dist/showLots.js.map +0 -1
  355. package/dist/showNames.d.ts +0 -77
  356. package/dist/showNames.d.ts.map +0 -1
  357. package/dist/showNames.js +0 -143
  358. package/dist/showNames.js.map +0 -1
  359. package/dist/showPages.d.ts +0 -56
  360. package/dist/showPages.d.ts.map +0 -1
  361. package/dist/showPages.js +0 -48
  362. package/dist/showPages.js.map +0 -1
  363. package/dist/silentAuctionFeed.d.ts +0 -49
  364. package/dist/silentAuctionFeed.d.ts.map +0 -1
  365. package/dist/silentAuctionFeed.js +0 -242
  366. package/dist/silentAuctionFeed.js.map +0 -1
  367. package/dist/silentAuctionRules.d.ts +0 -253
  368. package/dist/silentAuctionRules.d.ts.map +0 -1
  369. package/dist/silentAuctionRules.js +0 -489
  370. package/dist/silentAuctionRules.js.map +0 -1
  371. package/dist/silentAuctions.d.ts +0 -65
  372. package/dist/silentAuctions.d.ts.map +0 -1
  373. package/dist/silentAuctions.js +0 -272
  374. package/dist/silentAuctions.js.map +0 -1
  375. package/dist/storeData.d.ts +0 -16
  376. package/dist/storeData.d.ts.map +0 -1
  377. package/dist/storeData.js +0 -19
  378. package/dist/storeData.js.map +0 -1
  379. package/dist/ui/BubbleFrame.d.ts +0 -38
  380. package/dist/ui/BubbleFrame.d.ts.map +0 -1
  381. package/dist/ui/BubbleFrame.js +0 -181
  382. package/dist/ui/BubbleFrame.js.map +0 -1
  383. package/dist/ui/LiveBubble.d.ts +0 -43
  384. package/dist/ui/LiveBubble.d.ts.map +0 -1
  385. package/dist/ui/LiveBubble.js +0 -116
  386. package/dist/ui/LiveBubble.js.map +0 -1
  387. package/dist/ui/ReplayBubble.d.ts +0 -23
  388. package/dist/ui/ReplayBubble.d.ts.map +0 -1
  389. package/dist/ui/ReplayBubble.js +0 -71
  390. package/dist/ui/ReplayBubble.js.map +0 -1
  391. package/dist/ui.d.ts +0 -27
  392. package/dist/ui.d.ts.map +0 -1
  393. package/dist/ui.js +0 -34
  394. package/dist/ui.js.map +0 -1
  395. package/dist/unreadRoomMessages.d.ts +0 -26
  396. package/dist/unreadRoomMessages.d.ts.map +0 -1
  397. package/dist/unreadRoomMessages.js +0 -62
  398. package/dist/unreadRoomMessages.js.map +0 -1
  399. package/dist/viewerRules.d.ts +0 -38
  400. package/dist/viewerRules.d.ts.map +0 -1
  401. package/dist/viewerRules.js +0 -46
  402. package/dist/viewerRules.js.map +0 -1
  403. package/dist/winsAttribution.d.ts +0 -22
  404. package/dist/winsAttribution.d.ts.map +0 -1
  405. package/dist/winsAttribution.js +0 -49
  406. package/dist/winsAttribution.js.map +0 -1
  407. package/dist/zegoEngine.d.ts +0 -173
  408. package/dist/zegoEngine.d.ts.map +0 -1
  409. package/dist/zegoEngine.js +0 -1069
  410. 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;IACp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G,eAAO,MAAM,cAAc,eAAe,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3G;AAED,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAiBzG;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAQ/G;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CA6HlG"}
@@ -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,SAAS,EAAE,GAAG,EAAE,CAAC;AAEpF,oGAAoG;AACpG,SAAS,YAAY,CAAC,KAAgC;IACpD,MAAM,KAAK,GAAG,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC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,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"}
@@ -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":[],"mappings":";;AA2DA,8DAkCC;AAl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Q,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"}
@@ -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
@@ -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"}
@@ -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
@@ -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"}