@saasquatch/mint-components 1.10.2-12 → 1.10.2-14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ShadowViewAddon-f46aba53.js → ShadowViewAddon-36267ebd.js} +27 -20
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +57 -33
- package/dist/cjs/sqm-big-stat_38.cjs.entry.js +2 -14
- package/dist/cjs/sqm-empty_4.cjs.entry.js +8 -1
- package/dist/cjs/{sqm-portal-container-view-5fb2ad49.js → sqm-portal-container-view-990a85a3.js} +1 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +15 -8
- package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +0 -6
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +26 -19
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +7 -22
- package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +0 -1
- package/dist/collection/components/sqm-portal-container/PortalContainer.stories.js +12 -0
- package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +1 -1
- package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +37 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +2 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +55 -32
- package/dist/esm/{ShadowViewAddon-5895edd5.js → ShadowViewAddon-b311a206.js} +27 -20
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_16.entry.js +57 -33
- package/dist/esm/sqm-big-stat_38.entry.js +2 -14
- package/dist/esm/sqm-empty_4.entry.js +8 -1
- package/dist/esm/{sqm-portal-container-view-ab89c6cc.js → sqm-portal-container-view-6c582684.js} +1 -1
- package/dist/esm/sqm-stencilbook.entry.js +15 -8
- package/dist/esm-es5/ShadowViewAddon-b311a206.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
- package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-container-view-6c582684.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-226245c7.system.entry.js +1 -0
- package/dist/mint-components/{p-b45ba369.entry.js → p-31e810e9.entry.js} +2 -2
- package/dist/mint-components/p-5de21018.system.entry.js +1 -0
- package/dist/mint-components/{p-1cc0f6ce.js → p-7b001086.js} +20 -20
- package/dist/mint-components/p-9f0629ba.system.entry.js +1 -0
- package/dist/mint-components/{p-7b1b45e9.entry.js → p-a9e7872a.entry.js} +9 -9
- package/dist/mint-components/{p-e704842c.js → p-c7fd9e16.js} +1 -1
- package/dist/mint-components/p-c8bbb9ca.system.entry.js +1 -0
- package/dist/mint-components/p-d70348d8.system.js +1 -0
- package/dist/mint-components/p-d8d2de11.entry.js +1 -0
- package/dist/mint-components/p-ed17e637.system.js +1 -1
- package/dist/mint-components/p-ed6ebd60.system.js +1 -0
- package/dist/mint-components/{p-c8af8c3b.entry.js → p-f1e256b6.entry.js} +2 -2
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +0 -1
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +6 -4
- package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +0 -1
- package/dist/types/components/sqm-portal-container/PortalContainer.stories.d.ts +1 -0
- package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +1 -0
- package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +7 -0
- package/dist/types/components.d.ts +16 -0
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-5895edd5.js +0 -1
- package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +0 -1
- package/dist/mint-components/p-1fe65a36.entry.js +0 -1
- package/dist/mint-components/p-34fd1229.system.entry.js +0 -1
- package/dist/mint-components/p-60b76175.system.js +0 -1
- package/dist/mint-components/p-922578e4.system.js +0 -1
- package/dist/mint-components/p-c12e0887.system.entry.js +0 -1
- package/dist/mint-components/p-c34a507e.system.entry.js +0 -1
- package/dist/mint-components/p-fc352a1b.system.entry.js +0 -1
- package/docs/picklesdoc--2024-01-15--11-20-00.xlsx +0 -0
- package/docs/picklesdoc--2024-01-15--11-24-04.xlsx +0 -0
|
@@ -53,20 +53,34 @@ const vanillaStyle = `
|
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
export function LeaderboardView(props) {
|
|
56
|
-
var _a, _b, _c
|
|
56
|
+
var _a, _b, _c;
|
|
57
57
|
const { states, data, elements } = props;
|
|
58
58
|
const { styles } = states;
|
|
59
59
|
if (states.loading)
|
|
60
|
-
return (h("div", { class: sheet.classes.Leaderboard },
|
|
60
|
+
return (h("div", { class: sheet.classes.Leaderboard, style: { width: styles.width || "100%" } },
|
|
61
61
|
h("style", { type: "text/css" },
|
|
62
62
|
styleString,
|
|
63
63
|
vanillaStyle),
|
|
64
|
-
|
|
64
|
+
h("table", null, [...Array(10)].map(() => {
|
|
65
|
+
return (h("tr", null,
|
|
66
|
+
h("td", null,
|
|
67
|
+
h("sl-skeleton", null))));
|
|
68
|
+
}))));
|
|
65
69
|
if (states.isEssentials)
|
|
66
70
|
return elements.essentials;
|
|
67
71
|
if (!states.hasLeaders)
|
|
68
72
|
return elements.empty;
|
|
69
73
|
let userSeenFlag = false;
|
|
74
|
+
const getUsersName = (user) => {
|
|
75
|
+
if (!user.firstName && !user.lastInitial)
|
|
76
|
+
return styles.anonymousUser;
|
|
77
|
+
const { firstName, lastInitial } = user;
|
|
78
|
+
if (firstName && lastInitial)
|
|
79
|
+
return `${firstName} ${lastInitial}`;
|
|
80
|
+
if (firstName || lastInitial)
|
|
81
|
+
return firstName || lastInitial;
|
|
82
|
+
return styles.anonymousUser;
|
|
83
|
+
};
|
|
70
84
|
return (h("div", { class: sheet.classes.Leaderboard, part: "sqm-base", style: { width: styles.width || "100%" } },
|
|
71
85
|
h("style", { type: "text/css" },
|
|
72
86
|
styleString,
|
|
@@ -84,15 +98,13 @@ export function LeaderboardView(props) {
|
|
|
84
98
|
user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber)
|
|
85
99
|
? "highlight"
|
|
86
100
|
: "" },
|
|
87
|
-
styles.showRank && (h("td", { class: "Rank" },
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
? user.firstName || user.lastInitial
|
|
95
|
-
: styles.anonymousUser)),
|
|
101
|
+
styles.showRank && (h("td", { class: "Rank" }, styles.rankSuffix
|
|
102
|
+
? intl.formatMessage({
|
|
103
|
+
id: "rank",
|
|
104
|
+
defaultMessage: styles.rankSuffix,
|
|
105
|
+
}, { rank: user.rank })
|
|
106
|
+
: user.rank)),
|
|
107
|
+
!styles.hideNames && h("td", { class: "User" }, getUsersName(user)),
|
|
96
108
|
h("td", { class: "Score" }, user.textValue)));
|
|
97
109
|
}),
|
|
98
110
|
!userSeenFlag && !styles.hideViewer && (h("tr", null,
|
|
@@ -100,11 +112,6 @@ export function LeaderboardView(props) {
|
|
|
100
112
|
h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
|
|
101
113
|
!userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
|
|
102
114
|
styles.showRank && (h("td", { class: "Rank" }, ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank) || "-")),
|
|
103
|
-
!styles.hideNames && (h("td", { class: "User" }, (
|
|
104
|
-
|
|
105
|
-
" " + ((_f = data.viewerRank) === null || _f === void 0 ? void 0 : _f.lastInitial)
|
|
106
|
-
: ((_g = data.viewerRank) === null || _g === void 0 ? void 0 : _g.firstName) || ((_h = data.viewerRank) === null || _h === void 0 ? void 0 : _h.lastInitial)
|
|
107
|
-
? ((_j = data.viewerRank) === null || _j === void 0 ? void 0 : _j.firstName) || ((_k = data.viewerRank) === null || _k === void 0 ? void 0 : _k.lastInitial)
|
|
108
|
-
: styles.anonymousUser)),
|
|
109
|
-
h("td", { class: "Score" }, ((_l = data.viewerRank) === null || _l === void 0 ? void 0 : _l.textValue) || "0"))))));
|
|
115
|
+
!styles.hideNames && (h("td", { class: "User" }, getUsersName(data.viewerRank || {}))),
|
|
116
|
+
h("td", { class: "Score" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.textValue) || "0"))))));
|
|
110
117
|
}
|
|
@@ -10,10 +10,10 @@ import { useLeaderboard } from "./useLeaderboard";
|
|
|
10
10
|
* @slots [{"name":"empty", "title":"Empty State"}]
|
|
11
11
|
* @requiredFeatures ["LEADERBOARDS"]
|
|
12
12
|
* @exampleGroup Leaderboard
|
|
13
|
-
* @example Referral Started Leaderboard - <sqm-leaderboard usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
14
|
-
* @example Referral Converted Leaderboard - <sqm-leaderboard usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topConvertedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
15
|
-
* @example Points Earned Leaderboard - <sqm-leaderboard usersheading="Name" statsheading="Points" rank-type="rank" leaderboard-type="topPointEarners" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
16
|
-
* @example Anonymous Leaderboard - <div style="display: flex; align-items: flex-start; justify-content: center; width: 100%; gap: 50px;"><div style="display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; max-width: 30%;"><sqm-image width="70%" alignment="center" image-url="https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png"></sqm-image><h2 style="margin: auto;">Top Performers</h2><p style="margin: 0;">The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!</p></div><sqm-leaderboard width="300px" usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true" hide-names="true" hide-viewer="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard"></sqm-empty></sqm-leaderboard></div>
|
|
13
|
+
* @example Referral Started Leaderboard - <sqm-leaderboard usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
14
|
+
* @example Referral Converted Leaderboard - <sqm-leaderboard usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topConvertedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
15
|
+
* @example Points Earned Leaderboard - <sqm-leaderboard usersheading="Name" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Points" rank-type="rank" leaderboard-type="topPointEarners" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
|
|
16
|
+
* @example Anonymous Leaderboard - <div style="display: flex; align-items: flex-start; justify-content: center; width: 100%; gap: 50px;"><div style="display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; max-width: 30%;"><sqm-image width="70%" alignment="center" image-url="https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png"></sqm-image><h2 style="margin: auto;">Top Performers</h2><p style="margin: 0; text-align: center;">The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!</p></div><sqm-leaderboard width="300px" usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true" hide-names="true" hide-viewer="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard"></sqm-empty></sqm-leaderboard></div>
|
|
17
17
|
* @featureTooltip <div>Motivate your participants by gamifying your program. Contact <a href="mailto:saasquatch-support%40impact.com?subject=Next steps for Leaderboards feature&body=Hi Support Team, %0D%0A%0D%0A I am interested in learning more about how Leaderboards can support the growth of our referral program. Please connect me with a program strategy manager to discuss this feature further, and determine the next steps.%0D%0A%0D%0A%0D%0AThank you,%0D%0A[Add your name here]">Support</a> to upgrade your plan and add a leaderboard.</div>
|
|
18
18
|
*/
|
|
19
19
|
export class Leaderboard {
|
|
@@ -24,10 +24,6 @@ export class Leaderboard {
|
|
|
24
24
|
* @uiName Width
|
|
25
25
|
*/
|
|
26
26
|
this.width = "100%";
|
|
27
|
-
/**
|
|
28
|
-
* @uiName Rank Suffix
|
|
29
|
-
*/
|
|
30
|
-
this.rankSuffix = "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}";
|
|
31
27
|
/**
|
|
32
28
|
* Hide the viewer's leaderboard row if not in the top results.
|
|
33
29
|
*
|
|
@@ -69,7 +65,6 @@ export class Leaderboard {
|
|
|
69
65
|
const props = {
|
|
70
66
|
empty: h(EmptySlot, null),
|
|
71
67
|
essentials: h(EssentialsSlot, null),
|
|
72
|
-
loadingstate: h(LoadingSlot, null),
|
|
73
68
|
usersheading: this.usersheading,
|
|
74
69
|
statsheading: this.statsheading,
|
|
75
70
|
rankheading: this.rankheading,
|
|
@@ -234,11 +229,10 @@ export class Leaderboard {
|
|
|
234
229
|
"text": "Rank Suffix",
|
|
235
230
|
"name": "uiName"
|
|
236
231
|
}],
|
|
237
|
-
"text": ""
|
|
232
|
+
"text": "A JSONata string that formats the rank with the appropriate ordinal suffix (e.g., \"st\" for 1st, \"nd\" for 2nd, \"rd\" for 3rd, and \"th\" for all others)."
|
|
238
233
|
},
|
|
239
234
|
"attribute": "rank-suffix",
|
|
240
|
-
"reflect": false
|
|
241
|
-
"defaultValue": "\"{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}\""
|
|
235
|
+
"reflect": false
|
|
242
236
|
},
|
|
243
237
|
"hideViewer": {
|
|
244
238
|
"type": "boolean",
|
|
@@ -446,7 +440,7 @@ export class Leaderboard {
|
|
|
446
440
|
"mutable": false,
|
|
447
441
|
"complexType": {
|
|
448
442
|
"original": "DemoData<LeaderboardViewProps>",
|
|
449
|
-
"resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean; hideNames?: boolean; anonymousUser?: string; rankSuffix?: string; width?: string; }; }; data?: { rankType: string; leaderboard: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }[]; viewerRank?: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }; }; elements?: { empty: VNode; essentials: VNode;
|
|
443
|
+
"resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean; hideNames?: boolean; anonymousUser?: string; rankSuffix?: string; width?: string; }; }; data?: { rankType: string; leaderboard: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }[]; viewerRank?: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }; }; elements?: { empty: VNode; essentials: VNode; }; }",
|
|
450
444
|
"references": {
|
|
451
445
|
"DemoData": {
|
|
452
446
|
"location": "import",
|
|
@@ -484,14 +478,6 @@ function EssentialsSlot() {
|
|
|
484
478
|
return (h("slot", { name: "essentials" },
|
|
485
479
|
h("sqm-empty", { "empty-state-image": "https://res.cloudinary.com/saasquatch/image/upload/v1715360191/squatch-assets/Leaderboard_Not_Available.svg", "empty-state-header": "Leaderboards aren\u2019t available on your plan", "empty-state-text": "Contact {supportText} to upgrade your plan and start leveraging gamification in your program.", "support-text": "Support", "missing-feature": "Leaderboards" })));
|
|
486
480
|
}
|
|
487
|
-
function LoadingSlot() {
|
|
488
|
-
return (h("slot", { name: "loading" },
|
|
489
|
-
h("table", null, [...Array(10)].map(() => {
|
|
490
|
-
return (h("tr", null,
|
|
491
|
-
h("td", null,
|
|
492
|
-
h("sl-skeleton", null))));
|
|
493
|
-
}))));
|
|
494
|
-
}
|
|
495
481
|
function useLeaderboardDemo(props) {
|
|
496
482
|
var _a, _b;
|
|
497
483
|
const data = ((_b = (_a = props.demoData) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.leaderboard) || [
|
|
@@ -559,7 +545,6 @@ function useLeaderboardDemo(props) {
|
|
|
559
545
|
elements: {
|
|
560
546
|
empty: h(EmptySlot, null),
|
|
561
547
|
essentials: h(EssentialsSlot, null),
|
|
562
|
-
loadingstate: h(LoadingSlot, null),
|
|
563
548
|
},
|
|
564
549
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
565
550
|
}
|
|
@@ -81,6 +81,18 @@ export const SpaceEvenly = () => {
|
|
|
81
81
|
h("p", null, "Points Balance")))),
|
|
82
82
|
h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
|
|
83
83
|
};
|
|
84
|
+
export const ResponsiveBox = () => {
|
|
85
|
+
return (h("div", { style: { width: "100%", maxWidth: "1000px", border: "1px dashed grey" } },
|
|
86
|
+
h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "space-between", "flex-wrap": "nowrap" },
|
|
87
|
+
h("sqm-stat-container", { space: "xxx-large", display: "flex" },
|
|
88
|
+
h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardsRedeemed/CREDIT/global" },
|
|
89
|
+
h("sqm-text", null,
|
|
90
|
+
h("p", null, "Rewards Redeemed"))),
|
|
91
|
+
h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardBalance/CREDIT/POINT/value/global" },
|
|
92
|
+
h("sqm-text", null,
|
|
93
|
+
h("p", null, "Points Balance")))),
|
|
94
|
+
h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
|
|
95
|
+
};
|
|
84
96
|
export const Start = () => {
|
|
85
97
|
return (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
|
|
86
98
|
h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "start" },
|
|
@@ -5,7 +5,7 @@ export function PortalContainerView(props, children) {
|
|
|
5
5
|
Container: {
|
|
6
6
|
boxSizing: "border-box",
|
|
7
7
|
display: props.display || "grid",
|
|
8
|
-
flexWrap: "wrap",
|
|
8
|
+
flexWrap: props.flexWrap || "wrap",
|
|
9
9
|
"grid-template-columns": props.direction === "row"
|
|
10
10
|
? `repeat(auto-fill, minmax(${props.minWidth}, auto))`
|
|
11
11
|
: "100%",
|
|
@@ -37,6 +37,13 @@ export class PortalContainer {
|
|
|
37
37
|
* @uiName Maximum width
|
|
38
38
|
*/
|
|
39
39
|
this.maxWidth = "100%";
|
|
40
|
+
/**
|
|
41
|
+
* @uiName Flex wrap behavior
|
|
42
|
+
* @uiType string
|
|
43
|
+
* @uiEnum ["wrap", "nowrap"]
|
|
44
|
+
* @uiEnumNames ["Wrap", "No Wrap"]
|
|
45
|
+
*/
|
|
46
|
+
this.flexWrap = "wrap";
|
|
40
47
|
/**
|
|
41
48
|
* @uiName Background color
|
|
42
49
|
* @uiWidget color
|
|
@@ -253,6 +260,36 @@ export class PortalContainer {
|
|
|
253
260
|
"reflect": false,
|
|
254
261
|
"defaultValue": "\"100%\""
|
|
255
262
|
},
|
|
263
|
+
"flexWrap": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "string",
|
|
268
|
+
"resolved": "string",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": true,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [{
|
|
275
|
+
"text": "Flex wrap behavior",
|
|
276
|
+
"name": "uiName"
|
|
277
|
+
}, {
|
|
278
|
+
"text": "string",
|
|
279
|
+
"name": "uiType"
|
|
280
|
+
}, {
|
|
281
|
+
"text": "[\"wrap\", \"nowrap\"]",
|
|
282
|
+
"name": "uiEnum"
|
|
283
|
+
}, {
|
|
284
|
+
"text": "[\"Wrap\", \"No Wrap\"]",
|
|
285
|
+
"name": "uiEnumNames"
|
|
286
|
+
}],
|
|
287
|
+
"text": ""
|
|
288
|
+
},
|
|
289
|
+
"attribute": "flex-wrap",
|
|
290
|
+
"reflect": false,
|
|
291
|
+
"defaultValue": "\"wrap\""
|
|
292
|
+
},
|
|
256
293
|
"center": {
|
|
257
294
|
"type": "boolean",
|
|
258
295
|
"mutable": false,
|
package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js
CHANGED
|
@@ -83,6 +83,27 @@ const style = {
|
|
|
83
83
|
color: "var(--sl-color-neutral-500)",
|
|
84
84
|
fontSize: "var(--sl-font-size-medium)",
|
|
85
85
|
},
|
|
86
|
+
PhoneInputsSection: {
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "flex-start",
|
|
89
|
+
flexDirection: "column",
|
|
90
|
+
gap: "4px",
|
|
91
|
+
"& p": {
|
|
92
|
+
fontSize: "var(--sl-font-size-small)",
|
|
93
|
+
color: "var(--sl-input-label-color)",
|
|
94
|
+
fontWeight: "var(--sl-font-weight-semibold)",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
PhoneInputsContainer: {
|
|
98
|
+
display: "flex",
|
|
99
|
+
alignItems: "flex-start",
|
|
100
|
+
gap: "4px",
|
|
101
|
+
width: "100%",
|
|
102
|
+
"& #phoneNumber": {
|
|
103
|
+
width: "100%",
|
|
104
|
+
minWidth: "0px",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
86
107
|
};
|
|
87
108
|
const sheet = createStyleSheet(style);
|
|
88
109
|
const styleString = sheet.toString();
|
|
@@ -108,7 +129,7 @@ const vanillaStyle = `
|
|
|
108
129
|
}
|
|
109
130
|
|
|
110
131
|
sl-select#phoneNumberCountryCode::part(menu) {
|
|
111
|
-
width:
|
|
132
|
+
min-width: 250px;
|
|
112
133
|
}
|
|
113
134
|
`;
|
|
114
135
|
export const UserInfoFormView = (props) => {
|
|
@@ -191,37 +212,39 @@ export const UserInfoFormView = (props) => {
|
|
|
191
212
|
} }), (_e = data === null || data === void 0 ? void 0 : data.countries) === null || _e === void 0 ? void 0 :
|
|
192
213
|
_e.map((c) => (h("sl-menu-item", { value: c.countryCode }, c.displayName))), (_f = data === null || data === void 0 ? void 0 : data.allCountries) === null || _f === void 0 ? void 0 :
|
|
193
214
|
_f.map((c) => (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName)))),
|
|
194
|
-
h("div", {
|
|
195
|
-
h("
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
215
|
+
h("div", { class: classes.PhoneInputsSection },
|
|
216
|
+
h("p", null, text.phoneNumber),
|
|
217
|
+
h("div", { class: classes.PhoneInputsContainer },
|
|
218
|
+
h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
|
|
219
|
+
class: classes.ErrorInput,
|
|
220
|
+
}
|
|
221
|
+
: {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
|
|
222
|
+
h("sl-input", { class: classes.SearchInput, placeholder: text.searchForCountryText, onKeyDown: (e) => {
|
|
223
|
+
// Stop shoelace intercepting key presses
|
|
224
|
+
e.stopPropagation();
|
|
225
|
+
}, "onSl-input": (e) => {
|
|
226
|
+
callbacks.setPhoneCountrySearch(e.target.value);
|
|
227
|
+
} }), (_h = data === null || data === void 0 ? void 0 : data.phoneCountries) === null || _h === void 0 ? void 0 :
|
|
228
|
+
_h.map((c) => {
|
|
229
|
+
var _a, _b;
|
|
230
|
+
return (h("sl-menu-item", { value: c.countryCode },
|
|
231
|
+
h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
|
|
232
|
+
_b.dial_code));
|
|
233
|
+
}), (_j = data === null || data === void 0 ? void 0 : data.allCountries) === null || _j === void 0 ? void 0 :
|
|
234
|
+
_j.map((c) => {
|
|
235
|
+
var _a, _b;
|
|
236
|
+
return (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } },
|
|
237
|
+
h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
|
|
238
|
+
_b.dial_code));
|
|
239
|
+
})),
|
|
240
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber, validationError: ({ value }) =>
|
|
241
|
+
// Naive phone number validation
|
|
242
|
+
validateBillingField(/[a-zA-Z]+/, value) &&
|
|
243
|
+
formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError), disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
|
|
244
|
+
class: classes.ErrorInput,
|
|
245
|
+
helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
|
|
246
|
+
}
|
|
247
|
+
: {}), { required: true })))),
|
|
225
248
|
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
|
|
226
249
|
// Checks for non-ASCII characters
|
|
227
250
|
!validateBillingField(/^[\x20-\xFF]+$/, value) &&
|
|
@@ -11,7 +11,7 @@ import { l as luxonLocale } from './utils-334c1e34.js';
|
|
|
11
11
|
import { T as TextSpanView } from './sqm-text-span-view-8d140661.js';
|
|
12
12
|
import { p as pathToRegexp } from './index-ffa26b43.js';
|
|
13
13
|
import { a as isValidColor, b as isMobile } from './utilities-3f5bba22.js';
|
|
14
|
-
import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-
|
|
14
|
+
import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-6c582684.js';
|
|
15
15
|
|
|
16
16
|
const medium = {
|
|
17
17
|
facebook: { color: "#1877f2", text: "#fff", icon: "facebook" },
|
|
@@ -140,20 +140,34 @@ const vanillaStyle = `
|
|
|
140
140
|
}
|
|
141
141
|
`;
|
|
142
142
|
function LeaderboardView(props) {
|
|
143
|
-
var _a, _b, _c
|
|
143
|
+
var _a, _b, _c;
|
|
144
144
|
const { states, data, elements } = props;
|
|
145
145
|
const { styles } = states;
|
|
146
146
|
if (states.loading)
|
|
147
|
-
return (h("div", { class: sheet$1.classes.Leaderboard },
|
|
147
|
+
return (h("div", { class: sheet$1.classes.Leaderboard, style: { width: styles.width || "100%" } },
|
|
148
148
|
h("style", { type: "text/css" },
|
|
149
149
|
styleString$1,
|
|
150
150
|
vanillaStyle),
|
|
151
|
-
|
|
151
|
+
h("table", null, [...Array(10)].map(() => {
|
|
152
|
+
return (h("tr", null,
|
|
153
|
+
h("td", null,
|
|
154
|
+
h("sl-skeleton", null))));
|
|
155
|
+
}))));
|
|
152
156
|
if (states.isEssentials)
|
|
153
157
|
return elements.essentials;
|
|
154
158
|
if (!states.hasLeaders)
|
|
155
159
|
return elements.empty;
|
|
156
160
|
let userSeenFlag = false;
|
|
161
|
+
const getUsersName = (user) => {
|
|
162
|
+
if (!user.firstName && !user.lastInitial)
|
|
163
|
+
return styles.anonymousUser;
|
|
164
|
+
const { firstName, lastInitial } = user;
|
|
165
|
+
if (firstName && lastInitial)
|
|
166
|
+
return `${firstName} ${lastInitial}`;
|
|
167
|
+
if (firstName || lastInitial)
|
|
168
|
+
return firstName || lastInitial;
|
|
169
|
+
return styles.anonymousUser;
|
|
170
|
+
};
|
|
157
171
|
return (h("div", { class: sheet$1.classes.Leaderboard, part: "sqm-base", style: { width: styles.width || "100%" } },
|
|
158
172
|
h("style", { type: "text/css" },
|
|
159
173
|
styleString$1,
|
|
@@ -171,15 +185,13 @@ function LeaderboardView(props) {
|
|
|
171
185
|
user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber)
|
|
172
186
|
? "highlight"
|
|
173
187
|
: "" },
|
|
174
|
-
styles.showRank && (h("td", { class: "Rank" },
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
? user.firstName || user.lastInitial
|
|
182
|
-
: styles.anonymousUser)),
|
|
188
|
+
styles.showRank && (h("td", { class: "Rank" }, styles.rankSuffix
|
|
189
|
+
? intl.formatMessage({
|
|
190
|
+
id: "rank",
|
|
191
|
+
defaultMessage: styles.rankSuffix,
|
|
192
|
+
}, { rank: user.rank })
|
|
193
|
+
: user.rank)),
|
|
194
|
+
!styles.hideNames && h("td", { class: "User" }, getUsersName(user)),
|
|
183
195
|
h("td", { class: "Score" }, user.textValue)));
|
|
184
196
|
}),
|
|
185
197
|
!userSeenFlag && !styles.hideViewer && (h("tr", null,
|
|
@@ -187,13 +199,8 @@ function LeaderboardView(props) {
|
|
|
187
199
|
h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
|
|
188
200
|
!userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
|
|
189
201
|
styles.showRank && (h("td", { class: "Rank" }, ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank) || "-")),
|
|
190
|
-
!styles.hideNames && (h("td", { class: "User" }, (
|
|
191
|
-
|
|
192
|
-
" " + ((_f = data.viewerRank) === null || _f === void 0 ? void 0 : _f.lastInitial)
|
|
193
|
-
: ((_g = data.viewerRank) === null || _g === void 0 ? void 0 : _g.firstName) || ((_h = data.viewerRank) === null || _h === void 0 ? void 0 : _h.lastInitial)
|
|
194
|
-
? ((_j = data.viewerRank) === null || _j === void 0 ? void 0 : _j.firstName) || ((_k = data.viewerRank) === null || _k === void 0 ? void 0 : _k.lastInitial)
|
|
195
|
-
: styles.anonymousUser)),
|
|
196
|
-
h("td", { class: "Score" }, ((_l = data.viewerRank) === null || _l === void 0 ? void 0 : _l.textValue) || "0"))))));
|
|
202
|
+
!styles.hideNames && (h("td", { class: "User" }, getUsersName(data.viewerRank || {}))),
|
|
203
|
+
h("td", { class: "Score" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.textValue) || "0"))))));
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
const style$2 = {
|