@tiledev/sdk-apptile-live-selling 0.14.0 → 0.15.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/README.md +36 -11
- package/dist/clipsPage.d.ts +29 -0
- package/dist/clipsPage.d.ts.map +1 -0
- package/dist/clipsPage.js +49 -0
- package/dist/clipsPage.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/linkLots.d.ts +64 -0
- package/dist/linkLots.d.ts.map +1 -0
- package/dist/linkLots.js +84 -0
- package/dist/linkLots.js.map +1 -0
- package/dist/livePages.d.ts +91 -4
- package/dist/livePages.d.ts.map +1 -1
- package/dist/livePages.js +101 -4
- package/dist/livePages.js.map +1 -1
- package/dist/pageOptions.d.ts +24 -6
- package/dist/pageOptions.d.ts.map +1 -1
- package/dist/pageOptions.js +20 -3
- package/dist/pageOptions.js.map +1 -1
- package/dist/pageTypes.d.ts +58 -0
- package/dist/pageTypes.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.d.ts +11 -3
- package/dist/react/LiveSellingProvider.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.js +26 -8
- package/dist/react/LiveSellingProvider.js.map +1 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.web.d.ts +3 -1
- package/dist/react/index.web.d.ts.map +1 -1
- package/dist/react/index.web.js +7 -1
- package/dist/react/index.web.js.map +1 -1
- package/dist/react/shopifyProviders.d.ts +4 -3
- package/dist/react/shopifyProviders.d.ts.map +1 -1
- package/dist/react/shopifyProviders.js +6 -4
- package/dist/react/shopifyProviders.js.map +1 -1
- package/dist/react/useAccountName.d.ts +8 -0
- package/dist/react/useAccountName.d.ts.map +1 -0
- package/dist/react/useAccountName.js +49 -0
- package/dist/react/useAccountName.js.map +1 -0
- package/dist/react/useClipsPage.d.ts +47 -0
- package/dist/react/useClipsPage.d.ts.map +1 -0
- package/dist/react/useClipsPage.js +130 -0
- package/dist/react/useClipsPage.js.map +1 -0
- package/dist/react/useLiveAuction.d.ts +5 -3
- package/dist/react/useLiveAuction.d.ts.map +1 -1
- package/dist/react/useLiveAuction.js +10 -5
- package/dist/react/useLiveAuction.js.map +1 -1
- package/dist/react/useLiveChat.d.ts +42 -7
- package/dist/react/useLiveChat.d.ts.map +1 -1
- package/dist/react/useLiveChat.js +90 -12
- package/dist/react/useLiveChat.js.map +1 -1
- package/dist/react/useLiveGiveawaysAndPolls.d.ts +14 -3
- package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +1 -1
- package/dist/react/useLiveGiveawaysAndPolls.js +56 -11
- package/dist/react/useLiveGiveawaysAndPolls.js.map +1 -1
- package/dist/react/useLivePage.d.ts +22 -1
- package/dist/react/useLivePage.d.ts.map +1 -1
- package/dist/react/useLivePage.js +51 -11
- package/dist/react/useLivePage.js.map +1 -1
- package/dist/react/useLiveShop.d.ts +25 -5
- package/dist/react/useLiveShop.d.ts.map +1 -1
- package/dist/react/useLiveShop.js +65 -19
- package/dist/react/useLiveShop.js.map +1 -1
- package/dist/react/useReplayPage.d.ts +20 -4
- package/dist/react/useReplayPage.d.ts.map +1 -1
- package/dist/react/useReplayPage.js +94 -33
- package/dist/react/useReplayPage.js.map +1 -1
- package/dist/showNames.d.ts +11 -0
- package/dist/showNames.d.ts.map +1 -1
- package/dist/showNames.js +23 -1
- package/dist/showNames.js.map +1 -1
- package/package.json +1 -10
|
@@ -9,6 +9,7 @@ exports.useLiveAuction = useLiveAuction;
|
|
|
9
9
|
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const auctionRules_1 = require("../auctionRules");
|
|
12
|
+
const linkLots_1 = require("../linkLots");
|
|
12
13
|
const LiveSellingProvider_1 = require("./LiveSellingProvider");
|
|
13
14
|
const platformSession_1 = require("./platformSession");
|
|
14
15
|
const navigation_1 = require("./navigation");
|
|
@@ -57,7 +58,9 @@ const moneyIn = (currencyCode) => (amount) => (0, sdk_shopify_1.formatMoney)({ a
|
|
|
57
58
|
* the winner's name, not who they are. No name is handed out as an email. The win itself reaches the
|
|
58
59
|
* cart's Items You Won from the server; that page reads it each time it opens.
|
|
59
60
|
* - **The lots** for the Shop button's sheet and the card (`lotStateFor`): open (the round is on it),
|
|
60
|
-
* closed (won: on the show's record, or seen here), else upcoming.
|
|
61
|
+
* closed (won: on the show's record, or seen here), else upcoming. A link the host added (0.15.0,
|
|
62
|
+
* `showLinkOf`) sits among them with its price and no state, and a featured link has no round on the
|
|
63
|
+
* card: it is opened, never bid on (`useLiveShop` opens it).
|
|
61
64
|
* - **The store's name** in the bidding rules is `shopName` (old Amore's took the host's, which can be
|
|
62
65
|
* a person's).
|
|
63
66
|
* - **Nothing shows** until the session holds this show's record (`useLiveShow`; never a hidden show the
|
|
@@ -72,7 +75,7 @@ function useLiveAuction({ openItemsYouWon }) {
|
|
|
72
75
|
const { placeBid, dismissAuctionWin } = session.actions;
|
|
73
76
|
const customer = (0, sdk_shopify_1.useCustomer)();
|
|
74
77
|
const nav = (0, navigation_1.useNavigation)();
|
|
75
|
-
const { routes, shopName } = (0, LiveSellingProvider_1.useLivePageOptions)();
|
|
78
|
+
const { routes, shopName, canOpenLinks } = (0, LiveSellingProvider_1.useLivePageOptions)();
|
|
76
79
|
const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
|
|
77
80
|
const { auction } = session;
|
|
78
81
|
// ─── Which show ────────────────────────────────────────────────────────────────────────────────
|
|
@@ -186,16 +189,18 @@ function useLiveAuction({ openItemsYouWon }) {
|
|
|
186
189
|
return null;
|
|
187
190
|
return session.products.flatMap((item) => {
|
|
188
191
|
var _a;
|
|
192
|
+
// A link the host added: opened, not bid on.
|
|
189
193
|
if (!item.raw)
|
|
190
|
-
return [];
|
|
194
|
+
return item.externalUrl ? [(0, linkLots_1.showLinkOf)(item, { canOpen: canOpenLinks })] : [];
|
|
191
195
|
// The lot's opening bid, joined onto the product from the record by the session.
|
|
192
196
|
const startingBid = (_a = item.baseBidPrice) !== null && _a !== void 0 ? _a : null;
|
|
193
197
|
return [{ product: item.raw, startingBid: startingBid !== null ? money(startingBid) : null, state: stateOf(item.storeProductId) }];
|
|
194
198
|
});
|
|
195
|
-
}, [isAuction, session.products, money, stateOf]);
|
|
199
|
+
}, [isAuction, session.products, money, stateOf, canOpenLinks]);
|
|
196
200
|
const featured = session.activeProduct;
|
|
197
201
|
const auctionRound = (0, react_1.useMemo)(() => {
|
|
198
|
-
|
|
202
|
+
// A featured link is never on the block.
|
|
203
|
+
if (!isAuction || !featured || (!featured.raw && featured.externalUrl))
|
|
199
204
|
return null;
|
|
200
205
|
const state = stateOf(featured.storeProductId);
|
|
201
206
|
const onThisLot = state === 'open';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveAuction.js","sourceRoot":"","sources":["../../src/react/useLiveAuction.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useLiveAuction.js","sourceRoot":"","sources":["../../src/react/useLiveAuction.ts"],"names":[],"mappings":";;AA6FA,wCAgMC;AA7RD;;;;GAIG;AACH,sDAAyF;AACzF,iCAA0E;AAE1E,kDAA8C;AAC9C,0CAAyC;AAGzC,+DAA2D;AAC3D,uDAAmF;AACnF,6CAQsB;AAetB;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAErF,sEAAsE;AACtE,MAAM,OAAO,GAAG,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;AAEpH;;;;;;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ACnB;QACD,cAAc,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;QAClE,UAAU,EAAE;YACV,MAAM,EAAE,SAAS,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,YAAY;YACtD,MAAM,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;SACpC;QACD,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE;QAC1C,2EAA2E;QAC3E,WAAW,EAAE,EAAE,YAAY,EAAE;QAC7B,qEAAqE;QACrE,UAAU,EAAE,EAAE,IAAI,EAAE;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,14 @@ export interface LiveChatShow {
|
|
|
7
7
|
canComment: boolean;
|
|
8
8
|
/** The show takes reactions (`capabilitiesFor(show).canReact`). */
|
|
9
9
|
canReact: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Opens a link from the chat inside the app, the show in the bubble (`useLivePage`'s `openLink`, 0.15.0).
|
|
12
|
+
* The chat hands over only the host's and moderators' links (the comments tile decides by the line's
|
|
13
|
+
* `source`). Unset, or an app with no `routes.openLink`: the chat's links are words.
|
|
14
|
+
*/
|
|
15
|
+
openLink?: (url: string) => void;
|
|
16
|
+
/** An auction show (`capabilitiesFor(show).canBid`, 0.15.0): the comment box's "Sign in to comment" has a switch per kind of show. */
|
|
17
|
+
auction?: boolean;
|
|
10
18
|
}
|
|
11
19
|
/**
|
|
12
20
|
* The Live screen's chat and reactions. `useLivePage` calls it with what it knows about the show and
|
|
@@ -20,21 +28,40 @@ export interface LiveChatShow {
|
|
|
20
28
|
* account loads, the pin (`session.pinnedComment`), the host's reaction setting
|
|
21
29
|
* (`session.reactionStyle`), and the shopper's own comment and reaction shown at once. Nothing here
|
|
22
30
|
* repeats it.
|
|
23
|
-
* - **Anyone can comment** (Freckled Poppy's rule, decided): a shopper the room has no name
|
|
24
|
-
* for one on their first comment, inside the comment box, and the session saves it on
|
|
25
|
-
* (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
|
|
31
|
+
* - **Anyone can comment** (Freckled Poppy's rule, decided): a signed-out shopper the room has no name
|
|
32
|
+
* for is asked for one on their first comment, inside the comment box, and the session saves it on
|
|
33
|
+
* this phone (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
|
|
26
34
|
* account's name (`ShopifyLiveSessionProvider`'s `viewerName`); while their account loads (on app
|
|
27
|
-
* open, or a moment after signing in), Send waits.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
35
|
+
* open, or a moment after signing in), Send waits (`accountNameAsk`).
|
|
36
|
+
* - **A signed-in shopper with no first name on their account is asked once** (0.15.0; amore-v2's
|
|
37
|
+
* ENG-686, decided 2026-10-19 by its Head of Engineering: old Amore's and old K-Marie's way). A Shopify
|
|
38
|
+
* sign-in by emailed code leaves the name blank, and since 0.13.0 the room names nobody by their
|
|
39
|
+
* email. The comment box asks for a first and a last name (`commentBox.accountName`, starting from what
|
|
40
|
+
* the account has), saves them on the account (`onSaveAccountName`, through `useAccountName`) and only
|
|
41
|
+
* then sends the comment, so the account, the room and the next show all have it. A giveaway entry
|
|
42
|
+
* asks the same way, so whichever comes first asks, once. A name typed as a guest before signing in
|
|
43
|
+
* isn't used: the account's name governs. A save that didn't go through sends nothing, and the sheet
|
|
44
|
+
* says so. A comment box without the account's fields asks for one name, kept on this phone
|
|
45
|
+
* (`onSaveName`), as in 0.14.0.
|
|
46
|
+
* - **The show's team's names can't be used** (0.15.0; Host and Moderator unless `LiveSellingProvider`'s
|
|
47
|
+
* `blockedNames` says), signed in or not: the sheet says so as the name is typed (`isNameAllowed`), and
|
|
48
|
+
* an account named as one is asked as one with no name. The session refuses them too.
|
|
49
|
+
* - **"Sign in to comment"** (0.15.0; decided 2026-10-19 by amore-v2's Head of Engineering): the comment
|
|
50
|
+
* box's two switches, one for live shows and one for auction shows (`auction` says which applies), off
|
|
51
|
+
* by default. On, a signed-out shopper's tap on the box starts the app's sign-in (sdk-shopify's
|
|
52
|
+
* `useSignIn`; the app's Sign In page is `routes.openSignIn`) in place of the name sheet; back on this
|
|
53
|
+
* screen signed in, the keyboard comes up in the box (`keyboardRequest`). Back still signed out,
|
|
54
|
+
* nothing more happens, now or after a later sign-in elsewhere.
|
|
30
55
|
* - **Reactions** need no sign-in. Which ones is the button tile's; the Live screen hands the same list
|
|
31
56
|
* to the floating reactions.
|
|
32
57
|
* - **A tap on a name** in the chat puts "@name" in the comment box.
|
|
58
|
+
* - **A tap on a host's or moderator's link** opens it inside the app, the show in the bubble
|
|
59
|
+
* (`comments.onOpenLink`, 0.15.0, amore-v2's ENG-656). None without a way to open links.
|
|
33
60
|
* - **Hide Comments** is the shopper's, for this visit to the screen.
|
|
34
61
|
* - **`keyboardUp`**: the comment box's keyboard is up, so the screen lets a tap on the video put it
|
|
35
62
|
* away (iOS has no key for that).
|
|
36
63
|
*/
|
|
37
|
-
export declare function useLiveChat({ onAir, canComment, canReact }: LiveChatShow): {
|
|
64
|
+
export declare function useLiveChat({ onAir, canComment, canReact, openLink, auction }: LiveChatShow): {
|
|
38
65
|
keyboardUp: boolean;
|
|
39
66
|
/** The comment box has the keyboard: the screen lifts its bottom group for it, and for nothing else. */
|
|
40
67
|
typing: boolean;
|
|
@@ -44,16 +71,24 @@ export declare function useLiveChat({ onAir, canComment, canReact }: LiveChatSho
|
|
|
44
71
|
hidden: boolean;
|
|
45
72
|
onToggleHidden: () => void;
|
|
46
73
|
onPressName: ((name: string) => void) | undefined;
|
|
74
|
+
onOpenLink: ((url: string) => void) | undefined;
|
|
47
75
|
};
|
|
48
76
|
commentBox: {
|
|
49
77
|
visible: boolean;
|
|
50
78
|
askForName: boolean;
|
|
79
|
+
accountName: import("../pageTypes").NameOnAccount | null;
|
|
51
80
|
waitingForName: boolean;
|
|
81
|
+
signedOut: boolean;
|
|
82
|
+
auction: boolean;
|
|
83
|
+
keyboardRequest: number;
|
|
84
|
+
onSignInToComment: () => void;
|
|
52
85
|
sending: boolean;
|
|
53
86
|
mention: LiveCommentMention | null;
|
|
54
87
|
nameMaxLength: number;
|
|
55
88
|
onSend: (text: string) => Promise<void>;
|
|
56
89
|
onSaveName: (name: string) => Promise<boolean>;
|
|
90
|
+
onSaveAccountName: (firstName: string, lastName: string) => Promise<boolean>;
|
|
91
|
+
isNameAllowed: (name: string) => boolean;
|
|
57
92
|
onTypingChange: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
58
93
|
};
|
|
59
94
|
reactionButton: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveChat.d.ts","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLiveChat.d.ts","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQvD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sIAAsI;IACtI,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAe,EAAE,EAAE,YAAY;;IA8GhG,wGAAwG;;;;;;;6BA/BvE,MAAM;2BAjIxB,MAAM,KAAK,IAAI;;;;;;;;;;;;;;uBAoGjB,MAAM;2BAaqB,MAAM;uCAO5B,MAAM,YAAY,MAAM;8BATH,MAAM;;;;;+BA2BP,MAAM;;;;;;;;;;;EAkE/C;AAED,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLiveChat = useLiveChat;
|
|
4
4
|
/**
|
|
5
5
|
* The Live screen's chat and reactions (0.14.0, moved from amore-v2's `src/core/hooks/useLiveChat.ts`:
|
|
6
|
-
* phase 2 of its "Live player plan", Freckled Poppy's behaviour
|
|
6
|
+
* phase 2 of its "Live player plan", Freckled Poppy's behaviour; 0.15.0 adds its links, account names,
|
|
7
|
+
* blocked names and "Sign in to comment", from amore-v2's `eng928/integration`).
|
|
7
8
|
*/
|
|
8
9
|
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const react_native_1 = require("react-native");
|
|
11
12
|
const livePages_1 = require("../livePages");
|
|
13
|
+
const showNames_1 = require("../showNames");
|
|
12
14
|
const viewer_1 = require("../viewer");
|
|
15
|
+
const LiveSellingProvider_1 = require("./LiveSellingProvider");
|
|
13
16
|
const platformSession_1 = require("./platformSession");
|
|
17
|
+
const useAccountName_1 = require("./useAccountName");
|
|
18
|
+
const navigation_1 = require("./navigation");
|
|
14
19
|
/**
|
|
15
20
|
* The Live screen's chat and reactions. `useLivePage` calls it with what it knows about the show and
|
|
16
21
|
* hands the result to the screen (`page.chat`), one set of props per tile.
|
|
@@ -23,33 +28,86 @@ const platformSession_1 = require("./platformSession");
|
|
|
23
28
|
* account loads, the pin (`session.pinnedComment`), the host's reaction setting
|
|
24
29
|
* (`session.reactionStyle`), and the shopper's own comment and reaction shown at once. Nothing here
|
|
25
30
|
* repeats it.
|
|
26
|
-
* - **Anyone can comment** (Freckled Poppy's rule, decided): a shopper the room has no name
|
|
27
|
-
* for one on their first comment, inside the comment box, and the session saves it on
|
|
28
|
-
* (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
|
|
31
|
+
* - **Anyone can comment** (Freckled Poppy's rule, decided): a signed-out shopper the room has no name
|
|
32
|
+
* for is asked for one on their first comment, inside the comment box, and the session saves it on
|
|
33
|
+
* this phone (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
|
|
29
34
|
* account's name (`ShopifyLiveSessionProvider`'s `viewerName`); while their account loads (on app
|
|
30
|
-
* open, or a moment after signing in), Send waits.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
35
|
+
* open, or a moment after signing in), Send waits (`accountNameAsk`).
|
|
36
|
+
* - **A signed-in shopper with no first name on their account is asked once** (0.15.0; amore-v2's
|
|
37
|
+
* ENG-686, decided 2026-10-19 by its Head of Engineering: old Amore's and old K-Marie's way). A Shopify
|
|
38
|
+
* sign-in by emailed code leaves the name blank, and since 0.13.0 the room names nobody by their
|
|
39
|
+
* email. The comment box asks for a first and a last name (`commentBox.accountName`, starting from what
|
|
40
|
+
* the account has), saves them on the account (`onSaveAccountName`, through `useAccountName`) and only
|
|
41
|
+
* then sends the comment, so the account, the room and the next show all have it. A giveaway entry
|
|
42
|
+
* asks the same way, so whichever comes first asks, once. A name typed as a guest before signing in
|
|
43
|
+
* isn't used: the account's name governs. A save that didn't go through sends nothing, and the sheet
|
|
44
|
+
* says so. A comment box without the account's fields asks for one name, kept on this phone
|
|
45
|
+
* (`onSaveName`), as in 0.14.0.
|
|
46
|
+
* - **The show's team's names can't be used** (0.15.0; Host and Moderator unless `LiveSellingProvider`'s
|
|
47
|
+
* `blockedNames` says), signed in or not: the sheet says so as the name is typed (`isNameAllowed`), and
|
|
48
|
+
* an account named as one is asked as one with no name. The session refuses them too.
|
|
49
|
+
* - **"Sign in to comment"** (0.15.0; decided 2026-10-19 by amore-v2's Head of Engineering): the comment
|
|
50
|
+
* box's two switches, one for live shows and one for auction shows (`auction` says which applies), off
|
|
51
|
+
* by default. On, a signed-out shopper's tap on the box starts the app's sign-in (sdk-shopify's
|
|
52
|
+
* `useSignIn`; the app's Sign In page is `routes.openSignIn`) in place of the name sheet; back on this
|
|
53
|
+
* screen signed in, the keyboard comes up in the box (`keyboardRequest`). Back still signed out,
|
|
54
|
+
* nothing more happens, now or after a later sign-in elsewhere.
|
|
33
55
|
* - **Reactions** need no sign-in. Which ones is the button tile's; the Live screen hands the same list
|
|
34
56
|
* to the floating reactions.
|
|
35
57
|
* - **A tap on a name** in the chat puts "@name" in the comment box.
|
|
58
|
+
* - **A tap on a host's or moderator's link** opens it inside the app, the show in the bubble
|
|
59
|
+
* (`comments.onOpenLink`, 0.15.0, amore-v2's ENG-656). None without a way to open links.
|
|
36
60
|
* - **Hide Comments** is the shopper's, for this visit to the screen.
|
|
37
61
|
* - **`keyboardUp`**: the comment box's keyboard is up, so the screen lets a tap on the video put it
|
|
38
62
|
* away (iOS has no key for that).
|
|
39
63
|
*/
|
|
40
|
-
function useLiveChat({ onAir, canComment, canReact }) {
|
|
64
|
+
function useLiveChat({ onAir, canComment, canReact, openLink, auction = false }) {
|
|
41
65
|
var _a, _b, _c, _d, _e;
|
|
42
66
|
// The session changes only on the room's events, never on a clock.
|
|
43
67
|
const session = (0, platformSession_1.useLiveSession)();
|
|
44
68
|
const { sendComment, sendReaction, chooseViewerName } = session.actions;
|
|
45
|
-
const { loggedIn, restoring
|
|
69
|
+
const { loggedIn, restoring } = (0, sdk_shopify_1.useCustomer)();
|
|
70
|
+
const { accountLoading, nameToComplete, saveNameToAccount } = (0, useAccountName_1.useAccountName)();
|
|
71
|
+
const { routes, blockedNames, canOpenLinks } = (0, LiveSellingProvider_1.useLivePageOptions)();
|
|
46
72
|
// ─── Who the shopper is in the room ──────────────────────────────────────────────────────────────
|
|
47
|
-
|
|
73
|
+
// A stored sign-in is still being read on app open: not a signed-out shopper to ask.
|
|
74
|
+
const signedIn = !!loggedIn || !!restoring;
|
|
75
|
+
const { askForName, waitingForName } = (0, livePages_1.accountNameAsk)({
|
|
48
76
|
named: !!((_a = session.viewerName) === null || _a === void 0 ? void 0 : _a.trim()),
|
|
49
77
|
loggedIn: !!loggedIn,
|
|
50
78
|
restoring: !!restoring,
|
|
51
|
-
|
|
79
|
+
accountLoading,
|
|
80
|
+
nameToComplete,
|
|
52
81
|
});
|
|
82
|
+
// ─── "Sign in to comment", and back to the box ───────────────────────────────────────────────────
|
|
83
|
+
const nav = (0, navigation_1.useNavigation)();
|
|
84
|
+
const isFocused = (0, navigation_1.useIsFocused)();
|
|
85
|
+
const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
|
|
86
|
+
/** The shopper tapped the box to sign in: once back here signed in, the keyboard comes up in it. */
|
|
87
|
+
const [backToTheBox, setBackToTheBox] = (0, react_1.useState)(false);
|
|
88
|
+
/** A new number each time the box should take the keyboard. */
|
|
89
|
+
const [keyboardRequest, setKeyboardRequest] = (0, react_1.useState)(0);
|
|
90
|
+
const startSignIn = signIn.start;
|
|
91
|
+
const signInToComment = (0, react_1.useCallback)(() => {
|
|
92
|
+
setBackToTheBox(true);
|
|
93
|
+
void startSignIn();
|
|
94
|
+
}, [startSignIn]);
|
|
95
|
+
// Back here: this screen focused (the Sign In page closed), and no system sign-in sheet up.
|
|
96
|
+
const screenOnShow = isFocused && !signIn.signingIn;
|
|
97
|
+
const wasOnShow = (0, react_1.useRef)(screenOnShow);
|
|
98
|
+
(0, react_1.useEffect)(() => {
|
|
99
|
+
const cameBackOnShow = screenOnShow && !wasOnShow.current;
|
|
100
|
+
wasOnShow.current = screenOnShow;
|
|
101
|
+
if (!backToTheBox)
|
|
102
|
+
return;
|
|
103
|
+
if (loggedIn && screenOnShow) {
|
|
104
|
+
setBackToTheBox(false);
|
|
105
|
+
setKeyboardRequest((request) => request + 1);
|
|
106
|
+
}
|
|
107
|
+
// Back without signing in: the box stays as it was, now and after a later sign-in elsewhere.
|
|
108
|
+
else if (!loggedIn && cameBackOnShow)
|
|
109
|
+
setBackToTheBox(false);
|
|
110
|
+
}, [backToTheBox, loggedIn, screenOnShow]);
|
|
53
111
|
// ─── Commenting ─────────────────────────────────────────────────────────────────────────────────
|
|
54
112
|
const [sending, setSending] = (0, react_1.useState)(false);
|
|
55
113
|
const send = (0, react_1.useCallback)(async (text) => {
|
|
@@ -61,8 +119,19 @@ function useLiveChat({ onAir, canComment, canReact }) {
|
|
|
61
119
|
setSending(false);
|
|
62
120
|
}
|
|
63
121
|
}, [sendComment]);
|
|
64
|
-
/**
|
|
122
|
+
/** False for a name the show's team goes by: the sheet says so before Save. */
|
|
123
|
+
const isNameAllowed = (0, react_1.useCallback)((name) => !(0, showNames_1.isBlockedViewerName)(name, blockedNames), [blockedNames]);
|
|
124
|
+
/** Signed out: true once the session has saved the name on this phone, and the engine has it for the comment that follows. */
|
|
65
125
|
const saveName = (0, react_1.useCallback)(async (name) => !!(await chooseViewerName(name)), [chooseViewerName]);
|
|
126
|
+
/**
|
|
127
|
+
* Signed in: true once the name is on the account. Then given to the session as well, as the room reads
|
|
128
|
+
* the account's name only on the next draw, after the comment waiting for it has gone: this gives the
|
|
129
|
+
* engine the name for that comment, and keeps it on this phone.
|
|
130
|
+
*/
|
|
131
|
+
const saveAccountName = (0, react_1.useCallback)(async (firstName, lastName) => {
|
|
132
|
+
const savedName = await saveNameToAccount(firstName, lastName);
|
|
133
|
+
return !!savedName && !!(await chooseViewerName(savedName));
|
|
134
|
+
}, [saveNameToAccount, chooseViewerName]);
|
|
66
135
|
const [mention, setMention] = (0, react_1.useState)(null);
|
|
67
136
|
const mentionsSoFar = (0, react_1.useRef)(0);
|
|
68
137
|
const replyTo = (0, react_1.useCallback)((name) => {
|
|
@@ -101,16 +170,25 @@ function useLiveChat({ onAir, canComment, canReact }) {
|
|
|
101
170
|
onToggleHidden: toggleComments,
|
|
102
171
|
// Only with a comment box to reply into.
|
|
103
172
|
onPressName: commentBoxShown ? replyTo : undefined,
|
|
173
|
+
// Only with somewhere to open it: without, every link is words.
|
|
174
|
+
onOpenLink: canOpenLinks ? openLink : undefined,
|
|
104
175
|
},
|
|
105
176
|
commentBox: {
|
|
106
177
|
visible: commentBoxShown,
|
|
107
178
|
askForName,
|
|
179
|
+
accountName: nameToComplete,
|
|
108
180
|
waitingForName,
|
|
181
|
+
signedOut: !signedIn,
|
|
182
|
+
auction,
|
|
183
|
+
keyboardRequest,
|
|
184
|
+
onSignInToComment: signInToComment,
|
|
109
185
|
sending,
|
|
110
186
|
mention,
|
|
111
187
|
nameMaxLength: viewer_1.MAX_VIEWER_NAME,
|
|
112
188
|
onSend: send,
|
|
113
189
|
onSaveName: saveName,
|
|
190
|
+
onSaveAccountName: saveAccountName,
|
|
191
|
+
isNameAllowed,
|
|
114
192
|
onTypingChange: setTyping,
|
|
115
193
|
},
|
|
116
194
|
reactionButton: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveChat.js","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useLiveChat.js","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":";;AAiFA,kCA0JC;AA3OD;;;;GAIG;AACH,sDAA8D;AAC9D,iCAAiE;AACjE,+CAAkD;AAElD,4CAA8C;AAE9C,4CAAmD;AACnD,sCAA4C;AAC5C,+DAA2D;AAC3D,uDAAmD;AACnD,qDAAkD;AAClD,6CAAoG;AAoBpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,SAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAgB;;IAClG,mEAAmE;IACnE,MAAM,OAAO,GAAG,IAAA,gCAAc,GAAE,CAAC;IACjC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IACxE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC9C,MAAM,EAAE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AAC,CAAC,SAAS;YAClD,gEAAgE;YAChE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SAChD;QACD,UAAU,EAAE;YACV,OAAO,EAAE,eAAe;YACxB,UAAU;YACV,WAAW,EAAE,cAAc;YAC3B,cAAc;YACd,SAAS,EAAE,CAAC,QAAQ;YACpB,OAAO;YACP,eAAe;YACf,iBAAiB,EAAE,eAAe;YAClC,OAAO;YACP,OAAO;YACP,aAAa,EAAE,wBAAe;YAC9B,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,QAAQ;YACpB,iBAAiB,EAAE,eAAe;YAClC,aAAa;YACb,cAAc,EAAE,SAAS;SAC1B;QACD,cAAc,EAAE;YACd,OAAO,EAAE,KAAK,IAAI,QAAQ;YAC1B,OAAO,EAAE,KAAK;SACf;QACD,SAAS,EAAE;YACT,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE;YAClC,aAAa,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,QAAQ;SACjD;QACD,aAAa,EAAE;YACb,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,IAAI;SAC7C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -26,9 +26,16 @@ import type { LiveGiveawayPrize } from '../pageTypes';
|
|
|
26
26
|
* page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
|
|
27
27
|
* "back here" is this screen focused with no system sheet up.
|
|
28
28
|
* - **The entry carries the room's name for the shopper** (`session.viewerName`: their account's
|
|
29
|
-
* name, never an email). While
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* name, never an email). While their account loads, Enter waits; if the room has none, the sheet
|
|
30
|
+
* asks ("Entering As:", old Amore's) and the entry goes once the session holds the name.
|
|
31
|
+
* - **An account with no first name is asked for one, and it goes on the account** (0.15.0; amore-v2's
|
|
32
|
+
* ENG-686, decided 2026-10-19 by its Head of Engineering, the comment box's way: `useAccountName`).
|
|
33
|
+
* "Entering As:" asks for a first and a last name (`accountName`, starting from what the account
|
|
34
|
+
* has); Enter puts them on the account (sdk-shopify's `updateProfile`) and then enters under that
|
|
35
|
+
* name (`onEnterWithAccountName`). So a shopper is asked once, by a giveaway or a comment. A name
|
|
36
|
+
* that didn't go on the account says so in the sheet (`nameSaveFailed`) and enters nothing. A name
|
|
37
|
+
* the show's team goes by (`LiveSellingProvider`'s `blockedNames`) is refused as it is typed
|
|
38
|
+
* (`isNameAllowed`); the session refuses it too.
|
|
32
39
|
* - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
|
|
33
40
|
* sheet, and Enter can be tried again.
|
|
34
41
|
* - The host's draw closes the sheet (Freckled Poppy's).
|
|
@@ -55,12 +62,16 @@ export declare function useLiveGiveawaysAndPolls(): {
|
|
|
55
62
|
signInToEnter: boolean;
|
|
56
63
|
waitingForName: boolean;
|
|
57
64
|
askForName: boolean;
|
|
65
|
+
accountName: import("../pageTypes").NameOnAccount | null;
|
|
66
|
+
nameSaveFailed: boolean;
|
|
67
|
+
isNameAllowed: (name: string) => boolean;
|
|
58
68
|
nameMaxLength: number;
|
|
59
69
|
entryFailed: boolean;
|
|
60
70
|
sheetVisible: boolean;
|
|
61
71
|
onOpenSheet: () => void;
|
|
62
72
|
onCloseSheet: () => void;
|
|
63
73
|
onEnter: (typedName?: string) => void;
|
|
74
|
+
onEnterWithAccountName: (firstName: string, lastName: string) => undefined;
|
|
64
75
|
onSignInToEnter: () => void;
|
|
65
76
|
};
|
|
66
77
|
giveawayDraw: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveGiveawaysAndPolls.d.ts","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLiveGiveawaysAndPolls.d.ts","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AActD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,wBAAwB;;;;;;;;;;;;8BA6FG,MAAM;;;;;;;4CAuCP,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;2BA1BnD,MAAM;;EA8CpB;AAED,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -4,16 +4,20 @@ exports.useLiveGiveawaysAndPolls = useLiveGiveawaysAndPolls;
|
|
|
4
4
|
/**
|
|
5
5
|
* The Live screen's giveaways and polls (0.14.0, moved from amore-v2's
|
|
6
6
|
* `src/core/hooks/useLiveGiveawaysAndPolls.ts`: phase 5 of its "Live player plan", Freckled Poppy's
|
|
7
|
-
* behaviour, old Amore's look
|
|
8
|
-
*
|
|
7
|
+
* behaviour, old Amore's look; 0.15.0 adds its account names and blocked names, from amore-v2's
|
|
8
|
+
* `eng928/integration`). The routes are the app's (`LiveSellingProvider`'s `routes`); the route's
|
|
9
|
+
* `streamId` param is read here.
|
|
9
10
|
*/
|
|
10
11
|
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
11
12
|
const react_1 = require("react");
|
|
13
|
+
const livePages_1 = require("../livePages");
|
|
12
14
|
const pageOptions_1 = require("../pageOptions");
|
|
13
15
|
const sessionTypes_1 = require("../sessionTypes");
|
|
16
|
+
const showNames_1 = require("../showNames");
|
|
14
17
|
const viewer_1 = require("../viewer");
|
|
15
18
|
const LiveSellingProvider_1 = require("./LiveSellingProvider");
|
|
16
19
|
const platformSession_1 = require("./platformSession");
|
|
20
|
+
const useAccountName_1 = require("./useAccountName");
|
|
17
21
|
const useGiveawayEntry_1 = require("./useGiveawayEntry");
|
|
18
22
|
const useGiveawayPrize_1 = require("./useGiveawayPrize");
|
|
19
23
|
const navigation_1 = require("./navigation");
|
|
@@ -44,9 +48,16 @@ const navigation_1 = require("./navigation");
|
|
|
44
48
|
* page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
|
|
45
49
|
* "back here" is this screen focused with no system sheet up.
|
|
46
50
|
* - **The entry carries the room's name for the shopper** (`session.viewerName`: their account's
|
|
47
|
-
* name, never an email). While
|
|
48
|
-
*
|
|
49
|
-
*
|
|
51
|
+
* name, never an email). While their account loads, Enter waits; if the room has none, the sheet
|
|
52
|
+
* asks ("Entering As:", old Amore's) and the entry goes once the session holds the name.
|
|
53
|
+
* - **An account with no first name is asked for one, and it goes on the account** (0.15.0; amore-v2's
|
|
54
|
+
* ENG-686, decided 2026-10-19 by its Head of Engineering, the comment box's way: `useAccountName`).
|
|
55
|
+
* "Entering As:" asks for a first and a last name (`accountName`, starting from what the account
|
|
56
|
+
* has); Enter puts them on the account (sdk-shopify's `updateProfile`) and then enters under that
|
|
57
|
+
* name (`onEnterWithAccountName`). So a shopper is asked once, by a giveaway or a comment. A name
|
|
58
|
+
* that didn't go on the account says so in the sheet (`nameSaveFailed`) and enters nothing. A name
|
|
59
|
+
* the show's team goes by (`LiveSellingProvider`'s `blockedNames`) is refused as it is typed
|
|
60
|
+
* (`isNameAllowed`); the session refuses it too.
|
|
50
61
|
* - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
|
|
51
62
|
* sheet, and Enter can be tried again.
|
|
52
63
|
* - The host's draw closes the sheet (Freckled Poppy's).
|
|
@@ -71,9 +82,10 @@ function useLiveGiveawaysAndPolls() {
|
|
|
71
82
|
const session = (0, platformSession_1.useLiveSession)();
|
|
72
83
|
const { voteInPoll } = session.actions;
|
|
73
84
|
const { loggedIn, restoring, customer } = (0, sdk_shopify_1.useCustomer)();
|
|
85
|
+
const { accountLoading, nameToComplete, saveNameToAccount } = (0, useAccountName_1.useAccountName)();
|
|
74
86
|
const cartId = (_d = (_c = (0, sdk_shopify_1.useCart)().cart) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null;
|
|
75
87
|
const nav = (0, navigation_1.useNavigation)();
|
|
76
|
-
const { routes } = (0, LiveSellingProvider_1.useLivePageOptions)();
|
|
88
|
+
const { routes, blockedNames } = (0, LiveSellingProvider_1.useLivePageOptions)();
|
|
77
89
|
const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
|
|
78
90
|
// ─── Which show ────────────────────────────────────────────────────────────────────────────────
|
|
79
91
|
// The session's record once it is this show's: right after the pin it can still hold the last show's.
|
|
@@ -121,11 +133,40 @@ function useLiveGiveawaysAndPolls() {
|
|
|
121
133
|
};
|
|
122
134
|
}, [openGiveaway, prizeProduct, prizeVariant, showCurrency]);
|
|
123
135
|
// ─── Who the shopper is to the giveaway ────────────────────────────────────────────────────────
|
|
124
|
-
const named = !!((_l = session.viewerName) === null || _l === void 0 ? void 0 : _l.trim());
|
|
125
136
|
const signInToEnter = !loggedIn && !restoring;
|
|
126
|
-
// A stored sign-in still being read, or a signed-in shopper's
|
|
127
|
-
|
|
128
|
-
const askForName
|
|
137
|
+
// A stored sign-in still being read, or a signed-in shopper's account (and so their name) still on its
|
|
138
|
+
// way: Enter waits. No first name on the account: asked, and saved to it. Else the room's own ask.
|
|
139
|
+
const { askForName, waitingForName } = (0, livePages_1.giveawayNameAsk)({
|
|
140
|
+
named: !!((_l = session.viewerName) === null || _l === void 0 ? void 0 : _l.trim()),
|
|
141
|
+
loggedIn: !!loggedIn,
|
|
142
|
+
hasCustomer: !!customer,
|
|
143
|
+
accountLoading,
|
|
144
|
+
nameToComplete,
|
|
145
|
+
});
|
|
146
|
+
// "Entering As:" for the account: the name goes on the account, then the entry goes under it.
|
|
147
|
+
const [savingAccountName, setSavingAccountName] = (0, react_1.useState)(false);
|
|
148
|
+
const [accountNameNotSaved, setAccountNameNotSaved] = (0, react_1.useState)(false);
|
|
149
|
+
const enterUnder = entry.enter;
|
|
150
|
+
const enterWithAccountName = (0, react_1.useCallback)(async (firstName, lastName) => {
|
|
151
|
+
setSavingAccountName(true);
|
|
152
|
+
setAccountNameNotSaved(false);
|
|
153
|
+
try {
|
|
154
|
+
const savedName = await saveNameToAccount(firstName, lastName);
|
|
155
|
+
if (savedName)
|
|
156
|
+
enterUnder(savedName);
|
|
157
|
+
else
|
|
158
|
+
setAccountNameNotSaved(true);
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
setSavingAccountName(false);
|
|
162
|
+
}
|
|
163
|
+
}, [saveNameToAccount, enterUnder]);
|
|
164
|
+
// A failure belongs to the sheet it happened in.
|
|
165
|
+
(0, react_1.useEffect)(() => {
|
|
166
|
+
if (!entry.sheetOpen)
|
|
167
|
+
setAccountNameNotSaved(false);
|
|
168
|
+
}, [entry.sheetOpen]);
|
|
169
|
+
const isNameAllowed = (0, react_1.useCallback)((name) => !(0, showNames_1.isBlockedViewerName)(name, blockedNames), [blockedNames]);
|
|
129
170
|
// ─── The poll ──────────────────────────────────────────────────────────────────────────────────
|
|
130
171
|
const poll = showing ? ((_m = session.poll) !== null && _m !== void 0 ? _m : null) : null;
|
|
131
172
|
const pollId = (_p = (_o = session.poll) === null || _o === void 0 ? void 0 : _o.pollUuid) !== null && _p !== void 0 ? _p : null;
|
|
@@ -147,16 +188,20 @@ function useLiveGiveawaysAndPolls() {
|
|
|
147
188
|
prize,
|
|
148
189
|
entryCount: giveaway.entryCount,
|
|
149
190
|
entered: giveaway.registered,
|
|
150
|
-
entering: entry.entering,
|
|
191
|
+
entering: entry.entering || savingAccountName,
|
|
151
192
|
signInToEnter,
|
|
152
193
|
waitingForName,
|
|
153
194
|
askForName,
|
|
195
|
+
accountName: nameToComplete,
|
|
196
|
+
nameSaveFailed: accountNameNotSaved,
|
|
197
|
+
isNameAllowed,
|
|
154
198
|
nameMaxLength: viewer_1.MAX_VIEWER_NAME,
|
|
155
199
|
entryFailed: entry.entryFailed,
|
|
156
200
|
sheetVisible: entry.sheetOpen,
|
|
157
201
|
onOpenSheet: entry.openSheet,
|
|
158
202
|
onCloseSheet: entry.closeSheet,
|
|
159
203
|
onEnter: entry.enter,
|
|
204
|
+
onEnterWithAccountName: (firstName, lastName) => void enterWithAccountName(firstName, lastName),
|
|
160
205
|
onSignInToEnter: entry.signInToEnter,
|
|
161
206
|
},
|
|
162
207
|
giveawayDraw: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveGiveawaysAndPolls.js","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useLiveGiveawaysAndPolls.js","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":";;AA+EA,4DAwJC;AAvOD;;;;;;GAMG;AACH,sDAAkG;AAClG,iCAAkE;AAElE,4CAA+C;AAC/C,gDAAmD;AAEnD,kDAAgD;AAChD,4CAAmD;AACnD,sCAA4C;AAC5C,+DAA2D;AAC3D,uDAAgE;AAChE,qDAAkD;AAClD,yDAAsD;AACtD,yDAAsD;AACtD,6CAA8H;AAK9H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,SAAgB,wBAAwB;;IACtC,MAAM,QAAQ,GAAG,MAAA,MAAA,IAAA,qBAAQ,GAAa,CAAC,MAAM,0CAAE,QAAQ,mCAAI,EAAE,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAA,yBAAY,GAAE,CAAC;IACjC,mEAAmE;IACnE,MAAM,OAAO,GAAG,IAAA,gCAAc,GAAW,CAAC;IAC1C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IACvC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,yBAAW,GAAE,CAAC;IACxD,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,GAAG,IAA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