@saasquatch/mint-components 1.10.2 → 1.11.0-0
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-b2621f27.js → ShadowViewAddon-21aa34f8.js} +29 -52
- package/dist/cjs/{email-registration-view-248652bb.js → email-registration-view-5170d9f1.js} +1 -1
- package/dist/cjs/{global-02e50f09.js → global-4a59a374.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mint-components.cjs.js +2 -2
- package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +108 -124
- package/dist/cjs/sqm-big-stat_38.cjs.entry.js +15 -70
- package/dist/cjs/sqm-empty_4.cjs.entry.js +2 -9
- package/dist/cjs/sqm-instant-access-registration.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-invoice-table-view-28b14d28.js → sqm-invoice-table-view-1ea0d1fe.js} +2 -1
- package/dist/cjs/sqm-leaderboard-rank.cjs.entry.js +1 -1
- package/dist/cjs/sqm-logout-current-user.cjs.entry.js +10 -9
- package/dist/cjs/{sqm-portal-container-view-990a85a3.js → sqm-portal-container-view-5fb2ad49.js} +1 -1
- package/dist/cjs/{sqm-portal-email-verification-view-292b5bf4.js → sqm-portal-email-verification-view-07161940.js} +1 -1
- package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
- package/dist/cjs/{sqm-portal-profile-view-fde54e35.js → sqm-portal-profile-view-07b99f80.js} +1 -1
- package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
- package/dist/cjs/sqm-referred-registration.cjs.entry.js +1 -1
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +1 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +41 -165
- package/dist/collection/components/sqm-card-feed/sqm-card-feed.js +1 -1
- package/dist/collection/components/sqm-empty/EmptyState.stories.js +1 -1
- package/dist/collection/components/sqm-image/sqm-image-view.js +1 -1
- package/dist/collection/components/sqm-image/sqm-image.js +0 -20
- package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +9 -116
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +26 -51
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +16 -118
- package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +3 -40
- package/dist/collection/components/sqm-logout-current-user/useLogoutCurrentUser.js +10 -9
- package/dist/collection/components/sqm-portal-container/PortalContainer.stories.js +7 -19
- 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 +0 -37
- package/dist/collection/components/sqm-referral-card/ReferralCard.stories.js +1 -1
- package/dist/collection/components/sqm-share-button/ShareButton.stories.js +1 -1
- package/dist/collection/components/sqm-share-button/sqm-share-button-view.js +1 -1
- package/dist/collection/components/sqm-share-button/sqm-share-button.js +2 -2
- package/dist/collection/components/sqm-task-card/UseTaskCard.stories.js +1 -1
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +1 -1
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +1 -2
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +18 -11
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.js +3 -19
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +5 -3
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +49 -33
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +32 -55
- package/dist/collection/components/views/email-registration-view.js +1 -1
- package/dist/collection/global/global.js +1 -1
- package/dist/collection/stories/NewPortal.stories.js +1 -1
- package/dist/esm/{ShadowViewAddon-04640297.js → ShadowViewAddon-90897c22.js} +29 -52
- package/dist/esm/{email-registration-view-a89a88bf.js → email-registration-view-07d80492.js} +1 -1
- package/dist/esm/{global-04c7d3b5.js → global-e7bb0343.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mint-components.js +2 -2
- package/dist/esm/sqm-banking-info-form_16.entry.js +108 -124
- package/dist/esm/sqm-big-stat_38.entry.js +15 -70
- package/dist/esm/sqm-empty_4.entry.js +2 -9
- package/dist/esm/sqm-instant-access-registration.entry.js +1 -1
- package/dist/esm/{sqm-invoice-table-view-34ac7513.js → sqm-invoice-table-view-6945ea24.js} +2 -1
- package/dist/esm/sqm-leaderboard-rank.entry.js +1 -1
- package/dist/esm/sqm-logout-current-user.entry.js +10 -9
- package/dist/esm/{sqm-portal-container-view-6c582684.js → sqm-portal-container-view-ab89c6cc.js} +1 -1
- package/dist/esm/{sqm-portal-email-verification-view-4307c992.js → sqm-portal-email-verification-view-0b32261f.js} +1 -1
- package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
- package/dist/esm/{sqm-portal-profile-view-ffe955c8.js → sqm-portal-profile-view-03026a5e.js} +1 -1
- package/dist/esm/sqm-portal-profile.entry.js +2 -2
- package/dist/esm/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm/sqm-referred-registration.entry.js +1 -1
- package/dist/esm/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm/sqm-stencilbook.entry.js +41 -165
- package/dist/esm-es5/ShadowViewAddon-90897c22.js +1 -0
- package/dist/esm-es5/email-registration-view-07d80492.js +1 -0
- package/dist/esm-es5/{global-04c7d3b5.js → global-e7bb0343.js} +1 -1
- 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-instant-access-registration.entry.js +1 -1
- package/dist/esm-es5/{sqm-invoice-table-view-34ac7513.js → sqm-invoice-table-view-6945ea24.js} +1 -1
- package/dist/esm-es5/sqm-leaderboard-rank.entry.js +1 -1
- package/dist/esm-es5/sqm-logout-current-user.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +1 -0
- package/dist/esm-es5/{sqm-portal-email-verification-view-4307c992.js → sqm-portal-email-verification-view-0b32261f.js} +1 -1
- package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-profile-view-ffe955c8.js → sqm-portal-profile-view-03026a5e.js} +1 -1
- package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-referred-registration.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/mint-components.js +1 -1
- package/dist/mint-components/p-007383e1.entry.js +9 -0
- package/dist/mint-components/p-03deaf76.entry.js +9 -0
- package/dist/mint-components/{p-d3348267.js → p-05948592.js} +20 -20
- package/dist/mint-components/{p-4d233cd4.js → p-0e556260.js} +1 -1
- package/dist/mint-components/p-10036f16.js +1 -0
- package/dist/mint-components/p-445ffcfd.system.entry.js +1 -0
- package/dist/mint-components/{p-b6fc1227.system.entry.js → p-4864ed8a.system.entry.js} +1 -1
- package/dist/mint-components/{p-01cfff8a.system.entry.js → p-55a782cf.system.entry.js} +1 -1
- package/dist/mint-components/{p-59fe4ad1.system.js → p-573fab0f.system.js} +1 -1
- package/dist/mint-components/{p-56f14840.entry.js → p-57e4ef5f.entry.js} +1 -1
- package/dist/mint-components/p-5956a47e.entry.js +1 -0
- package/dist/mint-components/{p-7049e9b0.entry.js → p-5d485450.entry.js} +1 -1
- package/dist/mint-components/p-64491c96.system.entry.js +1 -0
- package/dist/mint-components/{p-ce621bcc.js → p-66172a05.js} +1 -1
- package/dist/mint-components/p-6bf41e0d.system.js +1 -0
- package/dist/mint-components/{p-b4c52c5a.entry.js → p-7a572b34.entry.js} +1 -1
- package/dist/mint-components/p-869c4ee1.system.entry.js +1 -0
- package/dist/mint-components/{p-be4b748a.system.entry.js → p-8fe21979.system.entry.js} +1 -1
- package/dist/mint-components/p-922578e4.system.js +1 -0
- package/dist/mint-components/p-956cd716.system.js +1 -0
- package/dist/mint-components/{p-3ec16698.entry.js → p-956ed10a.entry.js} +1 -1
- package/dist/mint-components/p-97198e2c.system.js +1 -0
- package/dist/mint-components/{p-4ea58025.system.entry.js → p-973f6501.system.entry.js} +1 -1
- package/dist/mint-components/{p-8704937c.js → p-9774fbc5.js} +1 -1
- package/dist/mint-components/{p-35d84041.system.entry.js → p-a61e6394.system.entry.js} +1 -1
- package/dist/mint-components/{p-1dd69917.system.entry.js → p-b8dbb809.system.entry.js} +1 -1
- package/dist/mint-components/p-be38de26.system.js +1 -0
- package/dist/mint-components/{p-b23d5520.js → p-bfdd2042.js} +1 -1
- package/dist/mint-components/{p-31e810e9.entry.js → p-c6c63bc0.entry.js} +7 -6
- package/dist/mint-components/{p-ed095674.system.js → p-c7a3fd1b.system.js} +1 -1
- package/dist/mint-components/p-cf158064.entry.js +33 -0
- package/dist/mint-components/p-d51eb656.entry.js +187 -0
- package/dist/mint-components/{p-4df8f1d2.system.js → p-d7df3dfd.system.js} +1 -1
- package/dist/mint-components/{p-32d1d162.entry.js → p-dab544d9.entry.js} +1 -1
- package/dist/mint-components/p-e566b746.system.entry.js +1 -0
- package/dist/mint-components/{p-c7fd9e16.js → p-e704842c.js} +1 -1
- package/dist/mint-components/{p-8679ed9f.system.entry.js → p-e84a74fe.system.entry.js} +1 -1
- package/dist/mint-components/{p-7f088154.entry.js → p-ebcec043.entry.js} +1 -1
- package/dist/mint-components/p-f8f6c99d.system.entry.js +1 -0
- package/dist/types/components/sqm-card-feed/sqm-card-feed.d.ts +1 -1
- package/dist/types/components/sqm-image/sqm-image-view.d.ts +0 -1
- package/dist/types/components/sqm-image/sqm-image.d.ts +0 -5
- package/dist/types/components/sqm-leaderboard/Leaderboard.stories.d.ts +0 -4
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +3 -6
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +4 -28
- package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +1 -4
- package/dist/types/components/sqm-portal-container/PortalContainer.stories.d.ts +0 -1
- package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +0 -1
- package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +0 -7
- package/dist/types/components/sqm-share-button/sqm-share-button.d.ts +2 -2
- package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.d.ts +6 -3
- package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +3 -1
- package/dist/types/components.d.ts +4 -68
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +2 -2
- package/dist/esm-es5/ShadowViewAddon-04640297.js +0 -1
- package/dist/esm-es5/email-registration-view-a89a88bf.js +0 -1
- package/dist/esm-es5/sqm-portal-container-view-6c582684.js +0 -1
- package/dist/mint-components/p-1c0be73e.entry.js +0 -223
- package/dist/mint-components/p-1c857edb.entry.js +0 -33
- package/dist/mint-components/p-293b71ba.system.entry.js +0 -1
- package/dist/mint-components/p-509e29e6.js +0 -1
- package/dist/mint-components/p-59d740b3.entry.js +0 -9
- package/dist/mint-components/p-5de21018.system.entry.js +0 -1
- package/dist/mint-components/p-65d430d4.system.entry.js +0 -1
- package/dist/mint-components/p-9f0629ba.system.entry.js +0 -1
- package/dist/mint-components/p-a1dba9a1.system.entry.js +0 -1
- package/dist/mint-components/p-a51533cb.system.js +0 -1
- package/dist/mint-components/p-bc51264d.system.js +0 -1
- package/dist/mint-components/p-d8d2de11.entry.js +0 -1
- package/dist/mint-components/p-dbc2167e.system.js +0 -1
- package/dist/mint-components/p-e3735866.entry.js +0 -11
- package/dist/mint-components/p-ed17e637.system.js +0 -1
- package/dist/mint-components/p-ed6ebd60.system.js +0 -1
|
@@ -6,7 +6,7 @@ import { CardFeedView } from "./sqm-card-feed-view";
|
|
|
6
6
|
* @uiName Card Feed
|
|
7
7
|
* @slots [{"name":"","title":"Cards"}]
|
|
8
8
|
* @exampleGroup Rewards
|
|
9
|
-
* @example Task Card Feed - <sqm-card-feed gap="24" width="347"> <sqm-task-card reward-amount="20" goal="1" card-title="Complete a Survey" description="Fill out our NPS survey and get 20 points for giving us honest feedback." button-text="Take survey" reward-unit="Points" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" finite="0" starts-on-message="Starts {startDate}" > </sqm-task-card> <sqm-task-card reward-amount="250" goal="500" show-progress-bar card-title="Spend $500" description="Earn 250 points when you spend $500 or more." button-text="See plans" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" progress-bar-unit="$" finite="0" reward-unit="Points" starts-on-message="Starts {startDate}" > </sqm-task-card> <sqm-task-card goal="1" reward-amount="50" card-title="Follow Us on
|
|
9
|
+
* @example Task Card Feed - <sqm-card-feed gap="24" width="347"> <sqm-task-card reward-amount="20" goal="1" card-title="Complete a Survey" description="Fill out our NPS survey and get 20 points for giving us honest feedback." button-text="Take survey" reward-unit="Points" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" finite="0" starts-on-message="Starts {startDate}" > </sqm-task-card> <sqm-task-card reward-amount="250" goal="500" show-progress-bar card-title="Spend $500" description="Earn 250 points when you spend $500 or more." button-text="See plans" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" progress-bar-unit="$" finite="0" reward-unit="Points" starts-on-message="Starts {startDate}" > </sqm-task-card> <sqm-task-card goal="1" reward-amount="50" card-title="Follow Us on Twitter" description="Earn 50 points when you follow us on Twitter!" button-text="Follow" button-link="https://twitter.com/" open-new-tab="true" event-key="socialFollow" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" finite="0" reward-unit="Points" starts-on-message="Starts {startDate}" > </sqm-task-card> <sqm-task-card reward-amount="1" reward-unit="Free Month" goal="1" card-title="Upgrade Your Plan" description="Receive one free month for being a committed customer when you upgrade your plan." button-text="Upgrade" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" open-new-tab="false" finite="0" starts-on-message="Starts {startDate}" > </sqm-task-card> </sqm-card-feed>
|
|
10
10
|
*/
|
|
11
11
|
export class CardFeed {
|
|
12
12
|
constructor() {
|
|
@@ -126,26 +126,6 @@ export class Image {
|
|
|
126
126
|
},
|
|
127
127
|
"attribute": "min-height",
|
|
128
128
|
"reflect": false
|
|
129
|
-
},
|
|
130
|
-
"width": {
|
|
131
|
-
"type": "string",
|
|
132
|
-
"mutable": false,
|
|
133
|
-
"complexType": {
|
|
134
|
-
"original": "string",
|
|
135
|
-
"resolved": "string",
|
|
136
|
-
"references": {}
|
|
137
|
-
},
|
|
138
|
-
"required": false,
|
|
139
|
-
"optional": true,
|
|
140
|
-
"docs": {
|
|
141
|
-
"tags": [{
|
|
142
|
-
"text": "Width",
|
|
143
|
-
"name": "uiName"
|
|
144
|
-
}],
|
|
145
|
-
"text": "(Optional) Constrains the width of the image. Can be a pixel value or a percentage i.e. \"500px\", \"33%\", etc."
|
|
146
|
-
},
|
|
147
|
-
"attribute": "width",
|
|
148
|
-
"reflect": false
|
|
149
129
|
}
|
|
150
130
|
}; }
|
|
151
131
|
}
|
|
@@ -81,8 +81,8 @@ const users = [
|
|
|
81
81
|
];
|
|
82
82
|
const pointsUsers = [
|
|
83
83
|
{
|
|
84
|
-
firstName: "
|
|
85
|
-
lastInitial: "
|
|
84
|
+
firstName: "",
|
|
85
|
+
lastInitial: "",
|
|
86
86
|
textValue: "82 Points",
|
|
87
87
|
rank: 1,
|
|
88
88
|
rowNumber: 1,
|
|
@@ -156,14 +156,18 @@ const defaultStyles = {
|
|
|
156
156
|
statsheading: "Referrals",
|
|
157
157
|
rankheading: "Rank",
|
|
158
158
|
anonymousUser: "Anonymous User",
|
|
159
|
-
viewingUserText: "You",
|
|
160
|
-
rankSuffix: "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
|
|
161
159
|
};
|
|
162
160
|
const link = h("a", null, "Support");
|
|
163
161
|
const tag = "Contact" + link + "about upgrading your plan";
|
|
164
162
|
const defaultElements = {
|
|
165
163
|
empty: (h("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" })),
|
|
166
164
|
essentials: (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" })),
|
|
165
|
+
loadingstate: (h("slot", { name: "loading" },
|
|
166
|
+
h("table", null, [...Array(10)].map(() => {
|
|
167
|
+
return (h("tr", null,
|
|
168
|
+
h("td", null,
|
|
169
|
+
h("sl-skeleton", null))));
|
|
170
|
+
})))),
|
|
167
171
|
};
|
|
168
172
|
export const Empty = () => {
|
|
169
173
|
const props = {
|
|
@@ -369,38 +373,6 @@ export const ReferralLeaderboard = () => {
|
|
|
369
373
|
};
|
|
370
374
|
return h(LeaderboardView, Object.assign({}, props));
|
|
371
375
|
};
|
|
372
|
-
export const ReferralLeaderboardWithMaxWidth = () => {
|
|
373
|
-
const props = {
|
|
374
|
-
states: {
|
|
375
|
-
loading: false,
|
|
376
|
-
hasLeaders: true,
|
|
377
|
-
styles: {
|
|
378
|
-
...defaultStyles,
|
|
379
|
-
rankheading: "Rank",
|
|
380
|
-
usersheading: "User",
|
|
381
|
-
statsheading: "Referrals",
|
|
382
|
-
showRank: false,
|
|
383
|
-
maxWidth: "300px",
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
data: {
|
|
387
|
-
rankType: "rowNumber",
|
|
388
|
-
leaderboard: users,
|
|
389
|
-
rowNumber: 10,
|
|
390
|
-
viewerRank: {
|
|
391
|
-
firstName: "Viktor",
|
|
392
|
-
lastInitial: "V",
|
|
393
|
-
textValue: "82",
|
|
394
|
-
rank: 1,
|
|
395
|
-
rowNumber: 1,
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
elements: {
|
|
399
|
-
...defaultElements,
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
return h(LeaderboardView, Object.assign({}, props));
|
|
403
|
-
};
|
|
404
376
|
export const PointsLeaderboard = () => {
|
|
405
377
|
const props = {
|
|
406
378
|
states: {
|
|
@@ -479,7 +451,7 @@ export const ViewerOutside = () => {
|
|
|
479
451
|
lastInitial: "C",
|
|
480
452
|
textValue: "8",
|
|
481
453
|
rowNumber: 11,
|
|
482
|
-
rank:
|
|
454
|
+
rank: 23,
|
|
483
455
|
},
|
|
484
456
|
},
|
|
485
457
|
elements: {
|
|
@@ -510,33 +482,6 @@ export const ViewerAnonymous = () => {
|
|
|
510
482
|
};
|
|
511
483
|
return h(LeaderboardView, Object.assign({}, props));
|
|
512
484
|
};
|
|
513
|
-
export const HideNamesWithViewerOutside = () => {
|
|
514
|
-
const props = {
|
|
515
|
-
states: {
|
|
516
|
-
loading: false,
|
|
517
|
-
hasLeaders: true,
|
|
518
|
-
styles: {
|
|
519
|
-
...defaultStyles,
|
|
520
|
-
showRank: true,
|
|
521
|
-
hideNames: true,
|
|
522
|
-
},
|
|
523
|
-
},
|
|
524
|
-
data: {
|
|
525
|
-
rankType: "rowNumber",
|
|
526
|
-
leaderboard: users,
|
|
527
|
-
rowNumber: 10,
|
|
528
|
-
viewerRank: {
|
|
529
|
-
textValue: "8",
|
|
530
|
-
rowNumber: 11,
|
|
531
|
-
rank: 42,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
elements: {
|
|
535
|
-
...defaultElements,
|
|
536
|
-
},
|
|
537
|
-
};
|
|
538
|
-
return h(LeaderboardView, Object.assign({}, props));
|
|
539
|
-
};
|
|
540
485
|
export const HideViewer = () => {
|
|
541
486
|
const props = {
|
|
542
487
|
states: {
|
|
@@ -567,55 +512,3 @@ export const HideViewer = () => {
|
|
|
567
512
|
};
|
|
568
513
|
return h(LeaderboardView, Object.assign({}, props));
|
|
569
514
|
};
|
|
570
|
-
export const HideNames = () => {
|
|
571
|
-
const props = {
|
|
572
|
-
states: {
|
|
573
|
-
loading: false,
|
|
574
|
-
hasLeaders: true,
|
|
575
|
-
rowNumber: 10,
|
|
576
|
-
styles: {
|
|
577
|
-
...defaultStyles,
|
|
578
|
-
showRank: true,
|
|
579
|
-
hideNames: true,
|
|
580
|
-
},
|
|
581
|
-
},
|
|
582
|
-
data: {
|
|
583
|
-
rankType: "rowNumber",
|
|
584
|
-
leaderboard: users,
|
|
585
|
-
rowNumber: 10,
|
|
586
|
-
viewerRank: {
|
|
587
|
-
firstName: "Viktor",
|
|
588
|
-
lastInitial: "V",
|
|
589
|
-
textValue: "82",
|
|
590
|
-
rowNumber: 1,
|
|
591
|
-
rank: 1,
|
|
592
|
-
},
|
|
593
|
-
},
|
|
594
|
-
elements: {
|
|
595
|
-
...defaultElements,
|
|
596
|
-
},
|
|
597
|
-
};
|
|
598
|
-
return h(LeaderboardView, Object.assign({}, props));
|
|
599
|
-
};
|
|
600
|
-
export const LeaderboardWithNoNamesAndGraphic = () => {
|
|
601
|
-
return (h("div", { style: {
|
|
602
|
-
display: "flex",
|
|
603
|
-
alignItems: "flex-start",
|
|
604
|
-
justifyContent: "center",
|
|
605
|
-
width: "100%",
|
|
606
|
-
gap: "50px",
|
|
607
|
-
} },
|
|
608
|
-
h("div", { style: {
|
|
609
|
-
display: "flex",
|
|
610
|
-
flexDirection: "column",
|
|
611
|
-
alignItems: "center",
|
|
612
|
-
justifyContent: "center",
|
|
613
|
-
gap: "10px",
|
|
614
|
-
maxWidth: "30%",
|
|
615
|
-
} },
|
|
616
|
-
h("sqm-image", { width: "70%", alignment: "center", imageUrl: "https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png" }),
|
|
617
|
-
h("h2", { style: { margin: "auto" } }, " Top Performers"),
|
|
618
|
-
h("p", { style: { margin: "0" } }, "The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!")),
|
|
619
|
-
h("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" },
|
|
620
|
-
h("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" }))));
|
|
621
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
-
import { intl } from "../../global/global";
|
|
4
3
|
const style = {
|
|
5
4
|
Leaderboard: {
|
|
6
5
|
"& table": {
|
|
@@ -22,10 +21,9 @@ const style = {
|
|
|
22
21
|
fontWeight: "var(--sl-font-weight-normal)",
|
|
23
22
|
},
|
|
24
23
|
"& .ellipses": {
|
|
25
|
-
textAlign: "
|
|
24
|
+
textAlign: "center",
|
|
26
25
|
padding: "0",
|
|
27
26
|
color: "var(--sl-color-neutral-500)",
|
|
28
|
-
paddingLeft: "25%",
|
|
29
27
|
},
|
|
30
28
|
"& .highlight": {
|
|
31
29
|
background: "var(--sl-color-primary-50)",
|
|
@@ -41,12 +39,6 @@ const style = {
|
|
|
41
39
|
width: "auto",
|
|
42
40
|
whiteSpace: "nowrap",
|
|
43
41
|
},
|
|
44
|
-
"& .Rank": {
|
|
45
|
-
whiteSpace: "nowrap",
|
|
46
|
-
},
|
|
47
|
-
"& .fullWidth": {
|
|
48
|
-
width: "100%",
|
|
49
|
-
},
|
|
50
42
|
},
|
|
51
43
|
};
|
|
52
44
|
const sheet = createStyleSheet(style);
|
|
@@ -57,73 +49,56 @@ const vanillaStyle = `
|
|
|
57
49
|
}
|
|
58
50
|
`;
|
|
59
51
|
export function LeaderboardView(props) {
|
|
60
|
-
var _a, _b, _c;
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
61
53
|
const { states, data, elements } = props;
|
|
62
54
|
const { styles } = states;
|
|
63
55
|
if (states.loading)
|
|
64
|
-
return (h("div", { class: sheet.classes.Leaderboard
|
|
56
|
+
return (h("div", { class: sheet.classes.Leaderboard },
|
|
65
57
|
h("style", { type: "text/css" },
|
|
66
58
|
styleString,
|
|
67
59
|
vanillaStyle),
|
|
68
|
-
|
|
69
|
-
return (h("tr", null,
|
|
70
|
-
h("td", null,
|
|
71
|
-
h("sl-skeleton", null))));
|
|
72
|
-
}))));
|
|
60
|
+
elements.loadingstate));
|
|
73
61
|
if (states.isEssentials)
|
|
74
62
|
return elements.essentials;
|
|
75
63
|
if (!states.hasLeaders)
|
|
76
64
|
return elements.empty;
|
|
77
65
|
let userSeenFlag = false;
|
|
78
|
-
|
|
79
|
-
if (!user.firstName && !user.lastInitial)
|
|
80
|
-
return styles.anonymousUser;
|
|
81
|
-
const { firstName, lastInitial } = user;
|
|
82
|
-
if (firstName && lastInitial)
|
|
83
|
-
return `${firstName} ${lastInitial}`;
|
|
84
|
-
if (firstName || lastInitial)
|
|
85
|
-
return firstName || lastInitial;
|
|
86
|
-
return styles.anonymousUser;
|
|
87
|
-
};
|
|
88
|
-
const getRankCellText = (userRank, isViewingUsersRow) => {
|
|
89
|
-
if (!userRank) {
|
|
90
|
-
return styles.hideNames ? `${styles.viewingUserText}` : "-";
|
|
91
|
-
}
|
|
92
|
-
const viewingUserText = ` - ${styles.viewingUserText}`;
|
|
93
|
-
return styles.rankSuffix
|
|
94
|
-
? intl.formatMessage({
|
|
95
|
-
id: "rank",
|
|
96
|
-
defaultMessage: styles.rankSuffix,
|
|
97
|
-
}, {
|
|
98
|
-
rank: userRank,
|
|
99
|
-
}) + `${isViewingUsersRow && styles.hideNames ? viewingUserText : ""}`
|
|
100
|
-
: `${userRank} ${isViewingUsersRow && styles.hideNames ? viewingUserText : ""}`;
|
|
101
|
-
};
|
|
102
|
-
const showViewingUserText = "";
|
|
103
|
-
return (h("div", { class: sheet.classes.Leaderboard, part: "sqm-base", style: { width: styles.width || "100%" } },
|
|
66
|
+
return (h("div", { class: sheet.classes.Leaderboard, part: "sqm-base" },
|
|
104
67
|
h("style", { type: "text/css" },
|
|
105
68
|
styleString,
|
|
106
69
|
vanillaStyle),
|
|
70
|
+
h("div", null, "Leaderboards"),
|
|
107
71
|
h("table", { part: "sqm-table" },
|
|
108
72
|
h("tr", null,
|
|
109
|
-
styles.showRank &&
|
|
110
|
-
|
|
73
|
+
styles.showRank && h("th", { class: "Rank" }, styles.rankheading),
|
|
74
|
+
h("th", { class: "User" }, styles.usersheading),
|
|
111
75
|
h("th", { class: "Score" }, styles.statsheading)), (_a = data.leaderboard) === null || _a === void 0 ? void 0 :
|
|
112
76
|
_a.map((user) => {
|
|
113
77
|
var _a, _b;
|
|
114
78
|
if (user.rowNumber === ((_a = data.viewerRank) === null || _a === void 0 ? void 0 : _a.rowNumber))
|
|
115
79
|
userSeenFlag = true;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
80
|
+
return (h("tr", { class: !styles.hideViewer &&
|
|
81
|
+
user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber)
|
|
82
|
+
? "highlight"
|
|
83
|
+
: "" },
|
|
84
|
+
styles.showRank && h("td", { class: "Rank" }, user.rank),
|
|
85
|
+
h("td", { class: "User" }, user.firstName && user.lastInitial
|
|
86
|
+
? user.firstName + " " + user.lastInitial
|
|
87
|
+
: user.firstName || user.lastInitial
|
|
88
|
+
? user.firstName || user.lastInitial
|
|
89
|
+
: styles.anonymousUser),
|
|
120
90
|
h("td", { class: "Score" }, user.textValue)));
|
|
121
91
|
}),
|
|
122
92
|
!userSeenFlag && !styles.hideViewer && (h("tr", null,
|
|
123
93
|
h("td", { colSpan: 100, class: "ellipses" },
|
|
124
94
|
h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
|
|
125
95
|
!userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
|
|
126
|
-
styles.showRank && (h("td", { class: "Rank" },
|
|
127
|
-
|
|
128
|
-
|
|
96
|
+
styles.showRank && (h("td", { class: "Rank" }, ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank) || "-")),
|
|
97
|
+
h("td", { class: "User" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.firstName) && ((_d = data.viewerRank) === null || _d === void 0 ? void 0 : _d.lastInitial)
|
|
98
|
+
? ((_e = data.viewerRank) === null || _e === void 0 ? void 0 : _e.firstName) +
|
|
99
|
+
" " + ((_f = data.viewerRank) === null || _f === void 0 ? void 0 : _f.lastInitial)
|
|
100
|
+
: ((_g = data.viewerRank) === null || _g === void 0 ? void 0 : _g.firstName) || ((_h = data.viewerRank) === null || _h === void 0 ? void 0 : _h.lastInitial)
|
|
101
|
+
? ((_j = data.viewerRank) === null || _j === void 0 ? void 0 : _j.firstName) || ((_k = data.viewerRank) === null || _k === void 0 ? void 0 : _k.lastInitial)
|
|
102
|
+
: styles.anonymousUser),
|
|
103
|
+
h("td", { class: "Score" }, ((_l = data.viewerRank) === null || _l === void 0 ? void 0 : _l.textValue) || "0"))))));
|
|
129
104
|
}
|
|
@@ -10,20 +10,13 @@ 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"
|
|
14
|
-
* @example Referral Converted Leaderboard - <sqm-leaderboard usersheading="Referrer"
|
|
15
|
-
* @example Points Earned Leaderboard - <sqm-leaderboard usersheading="Name"
|
|
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>
|
|
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>
|
|
17
16
|
* @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
17
|
*/
|
|
19
18
|
export class Leaderboard {
|
|
20
19
|
constructor() {
|
|
21
|
-
/**
|
|
22
|
-
* Restrict the width of the leaderboard (Can be a pixel value or a percentage i.e. "500px", "33%", etc.)
|
|
23
|
-
*
|
|
24
|
-
* @uiName Width
|
|
25
|
-
*/
|
|
26
|
-
this.width = "100%";
|
|
27
20
|
/**
|
|
28
21
|
* Hide the viewer's leaderboard row if not in the top results.
|
|
29
22
|
*
|
|
@@ -31,21 +24,10 @@ export class Leaderboard {
|
|
|
31
24
|
* @default
|
|
32
25
|
*/
|
|
33
26
|
this.hideViewer = false;
|
|
34
|
-
/**
|
|
35
|
-
* @uiName Viewing user text
|
|
36
|
-
*/
|
|
37
|
-
this.viewingUserText = "You";
|
|
38
|
-
/**
|
|
39
|
-
* Hide the Names of users to protect personal identifiable information
|
|
40
|
-
*
|
|
41
|
-
* @uiName Hide users names
|
|
42
|
-
* @default
|
|
43
|
-
*/
|
|
44
|
-
this.hideNames = false;
|
|
45
27
|
/**
|
|
46
28
|
* Hides the leaderboard if user is on Essentials plan
|
|
47
29
|
*
|
|
48
|
-
* @uiName Hide
|
|
30
|
+
* @uiName Hide viewing user
|
|
49
31
|
* @default
|
|
50
32
|
*/
|
|
51
33
|
this.isEssentials = false;
|
|
@@ -69,6 +51,7 @@ export class Leaderboard {
|
|
|
69
51
|
const props = {
|
|
70
52
|
empty: h(EmptySlot, null),
|
|
71
53
|
essentials: h(EssentialsSlot, null),
|
|
54
|
+
loadingstate: h(LoadingSlot, null),
|
|
72
55
|
usersheading: this.usersheading,
|
|
73
56
|
statsheading: this.statsheading,
|
|
74
57
|
rankheading: this.rankheading,
|
|
@@ -79,12 +62,8 @@ export class Leaderboard {
|
|
|
79
62
|
anonymousUser: this.anonymousUser,
|
|
80
63
|
interval: this.interval,
|
|
81
64
|
hideViewer: this.hideViewer,
|
|
82
|
-
viewingUserText: this.viewingUserText,
|
|
83
|
-
hideNames: this.hideNames,
|
|
84
65
|
showRank: this.showRank,
|
|
85
66
|
isEssentials: this.isEssentials,
|
|
86
|
-
rankSuffix: this.rankSuffix,
|
|
87
|
-
width: this.width,
|
|
88
67
|
};
|
|
89
68
|
const demoProps = { ...props, demoData: this.demoData };
|
|
90
69
|
const viewprops = isDemo()
|
|
@@ -198,47 +177,6 @@ export class Leaderboard {
|
|
|
198
177
|
"attribute": "show-rank",
|
|
199
178
|
"reflect": false
|
|
200
179
|
},
|
|
201
|
-
"width": {
|
|
202
|
-
"type": "string",
|
|
203
|
-
"mutable": false,
|
|
204
|
-
"complexType": {
|
|
205
|
-
"original": "string",
|
|
206
|
-
"resolved": "string",
|
|
207
|
-
"references": {}
|
|
208
|
-
},
|
|
209
|
-
"required": false,
|
|
210
|
-
"optional": false,
|
|
211
|
-
"docs": {
|
|
212
|
-
"tags": [{
|
|
213
|
-
"text": "Width",
|
|
214
|
-
"name": "uiName"
|
|
215
|
-
}],
|
|
216
|
-
"text": "Restrict the width of the leaderboard (Can be a pixel value or a percentage i.e. \"500px\", \"33%\", etc.)"
|
|
217
|
-
},
|
|
218
|
-
"attribute": "width",
|
|
219
|
-
"reflect": false,
|
|
220
|
-
"defaultValue": "\"100%\""
|
|
221
|
-
},
|
|
222
|
-
"rankSuffix": {
|
|
223
|
-
"type": "string",
|
|
224
|
-
"mutable": false,
|
|
225
|
-
"complexType": {
|
|
226
|
-
"original": "string",
|
|
227
|
-
"resolved": "string",
|
|
228
|
-
"references": {}
|
|
229
|
-
},
|
|
230
|
-
"required": false,
|
|
231
|
-
"optional": false,
|
|
232
|
-
"docs": {
|
|
233
|
-
"tags": [{
|
|
234
|
-
"text": "Rank Suffix",
|
|
235
|
-
"name": "uiName"
|
|
236
|
-
}],
|
|
237
|
-
"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
|
-
},
|
|
239
|
-
"attribute": "rank-suffix",
|
|
240
|
-
"reflect": false
|
|
241
|
-
},
|
|
242
180
|
"hideViewer": {
|
|
243
181
|
"type": "boolean",
|
|
244
182
|
"mutable": false,
|
|
@@ -263,51 +201,6 @@ export class Leaderboard {
|
|
|
263
201
|
"reflect": false,
|
|
264
202
|
"defaultValue": "false"
|
|
265
203
|
},
|
|
266
|
-
"viewingUserText": {
|
|
267
|
-
"type": "string",
|
|
268
|
-
"mutable": false,
|
|
269
|
-
"complexType": {
|
|
270
|
-
"original": "string",
|
|
271
|
-
"resolved": "string",
|
|
272
|
-
"references": {}
|
|
273
|
-
},
|
|
274
|
-
"required": false,
|
|
275
|
-
"optional": false,
|
|
276
|
-
"docs": {
|
|
277
|
-
"tags": [{
|
|
278
|
-
"text": "Viewing user text",
|
|
279
|
-
"name": "uiName"
|
|
280
|
-
}],
|
|
281
|
-
"text": ""
|
|
282
|
-
},
|
|
283
|
-
"attribute": "viewing-user-text",
|
|
284
|
-
"reflect": false,
|
|
285
|
-
"defaultValue": "\"You\""
|
|
286
|
-
},
|
|
287
|
-
"hideNames": {
|
|
288
|
-
"type": "boolean",
|
|
289
|
-
"mutable": false,
|
|
290
|
-
"complexType": {
|
|
291
|
-
"original": "boolean",
|
|
292
|
-
"resolved": "boolean",
|
|
293
|
-
"references": {}
|
|
294
|
-
},
|
|
295
|
-
"required": false,
|
|
296
|
-
"optional": false,
|
|
297
|
-
"docs": {
|
|
298
|
-
"tags": [{
|
|
299
|
-
"text": "Hide users names",
|
|
300
|
-
"name": "uiName"
|
|
301
|
-
}, {
|
|
302
|
-
"text": undefined,
|
|
303
|
-
"name": "default"
|
|
304
|
-
}],
|
|
305
|
-
"text": "Hide the Names of users to protect personal identifiable information"
|
|
306
|
-
},
|
|
307
|
-
"attribute": "hide-names",
|
|
308
|
-
"reflect": false,
|
|
309
|
-
"defaultValue": "false"
|
|
310
|
-
},
|
|
311
204
|
"isEssentials": {
|
|
312
205
|
"type": "boolean",
|
|
313
206
|
"mutable": false,
|
|
@@ -320,7 +213,7 @@ export class Leaderboard {
|
|
|
320
213
|
"optional": true,
|
|
321
214
|
"docs": {
|
|
322
215
|
"tags": [{
|
|
323
|
-
"text": "Hide
|
|
216
|
+
"text": "Hide viewing user",
|
|
324
217
|
"name": "uiName"
|
|
325
218
|
}, {
|
|
326
219
|
"text": undefined,
|
|
@@ -466,7 +359,7 @@ export class Leaderboard {
|
|
|
466
359
|
"mutable": false,
|
|
467
360
|
"complexType": {
|
|
468
361
|
"original": "DemoData<LeaderboardViewProps>",
|
|
469
|
-
"resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean;
|
|
362
|
+
"resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean; anonymousUser?: 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; loadingstate: VNode; }; }",
|
|
470
363
|
"references": {
|
|
471
364
|
"DemoData": {
|
|
472
365
|
"location": "import",
|
|
@@ -504,6 +397,14 @@ function EssentialsSlot() {
|
|
|
504
397
|
return (h("slot", { name: "essentials" },
|
|
505
398
|
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" })));
|
|
506
399
|
}
|
|
400
|
+
function LoadingSlot() {
|
|
401
|
+
return (h("slot", { name: "loading" },
|
|
402
|
+
h("table", null, [...Array(10)].map(() => {
|
|
403
|
+
return (h("tr", null,
|
|
404
|
+
h("td", null,
|
|
405
|
+
h("sl-skeleton", null))));
|
|
406
|
+
}))));
|
|
407
|
+
}
|
|
507
408
|
function useLeaderboardDemo(props) {
|
|
508
409
|
var _a, _b;
|
|
509
410
|
const data = ((_b = (_a = props.demoData) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.leaderboard) || [
|
|
@@ -559,10 +460,6 @@ function useLeaderboardDemo(props) {
|
|
|
559
460
|
: "Anonymous User",
|
|
560
461
|
showRank: props.showRank,
|
|
561
462
|
hideViewer: props.hideViewer,
|
|
562
|
-
viewingUserText: props.viewingUserText,
|
|
563
|
-
hideNames: props.hideNames,
|
|
564
|
-
rankSuffix: props.rankSuffix,
|
|
565
|
-
width: props.width,
|
|
566
463
|
},
|
|
567
464
|
},
|
|
568
465
|
data: {
|
|
@@ -572,6 +469,7 @@ function useLeaderboardDemo(props) {
|
|
|
572
469
|
elements: {
|
|
573
470
|
empty: h(EmptySlot, null),
|
|
574
471
|
essentials: h(EssentialsSlot, null),
|
|
472
|
+
loadingstate: h(LoadingSlot, null),
|
|
575
473
|
},
|
|
576
474
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
577
475
|
}
|
|
@@ -23,26 +23,6 @@ const GET_LEADERBOARD = gql `
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
|
-
const GET_LEADERBOARD_WITHOUT_NAMES = gql `
|
|
27
|
-
query (
|
|
28
|
-
$type: String!
|
|
29
|
-
$filter: UserLeaderboardFilterInput
|
|
30
|
-
$locale: RSLocale
|
|
31
|
-
$limit: Int!
|
|
32
|
-
) {
|
|
33
|
-
userLeaderboard(type: $type, filter: $filter) {
|
|
34
|
-
dateModified
|
|
35
|
-
rows(limit: $limit) {
|
|
36
|
-
textValue(locale: $locale)
|
|
37
|
-
rank {
|
|
38
|
-
rank
|
|
39
|
-
denseRank
|
|
40
|
-
rowNumber
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
26
|
const GET_RANK = gql `
|
|
47
27
|
query (
|
|
48
28
|
$type: String!
|
|
@@ -63,24 +43,6 @@ const GET_RANK = gql `
|
|
|
63
43
|
}
|
|
64
44
|
}
|
|
65
45
|
`;
|
|
66
|
-
const GET_RANK_WITHOUT_NAMES = gql `
|
|
67
|
-
query (
|
|
68
|
-
$type: String!
|
|
69
|
-
$filter: UserLeaderboardFilterInput
|
|
70
|
-
$locale: RSLocale
|
|
71
|
-
) {
|
|
72
|
-
viewer {
|
|
73
|
-
... on User {
|
|
74
|
-
leaderboardRank(type: $type, filter: $filter) {
|
|
75
|
-
textValue(locale: $locale)
|
|
76
|
-
rank
|
|
77
|
-
denseRank
|
|
78
|
-
rowNumber
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
46
|
export function useLeaderboard(props) {
|
|
85
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
86
48
|
const programIdContext = useProgramId();
|
|
@@ -106,8 +68,8 @@ export function useLeaderboard(props) {
|
|
|
106
68
|
if (props.maxRows > 0) {
|
|
107
69
|
variables["limit"] = props.maxRows;
|
|
108
70
|
}
|
|
109
|
-
const { data: leaderboardData, loading: loadingLeaderboard, errors: leaderboardErrors, } = useQuery(
|
|
110
|
-
const { data: rankData } = useQuery(
|
|
71
|
+
const { data: leaderboardData, loading: loadingLeaderboard, errors: leaderboardErrors, } = useQuery(GET_LEADERBOARD, variables, !(user === null || user === void 0 ? void 0 : user.jwt), { batch: false });
|
|
72
|
+
const { data: rankData } = useQuery(GET_RANK, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
111
73
|
const leaderboardRows = (_b = leaderboardData === null || leaderboardData === void 0 ? void 0 : leaderboardData.userLeaderboard) === null || _b === void 0 ? void 0 : _b.rows;
|
|
112
74
|
const flattenedLeaderboard = getFlattenedLeaderboard(leaderboardRows);
|
|
113
75
|
const sortedLeaderboard = flattenedLeaderboard === null || flattenedLeaderboard === void 0 ? void 0 : flattenedLeaderboard.sort(function (a, b) {
|
|
@@ -152,6 +114,7 @@ export function useLeaderboard(props) {
|
|
|
152
114
|
elements: {
|
|
153
115
|
empty: props.empty,
|
|
154
116
|
essentials: props.essentials,
|
|
117
|
+
loadingstate: props.loadingstate,
|
|
155
118
|
},
|
|
156
119
|
};
|
|
157
120
|
}
|