@saasquatch/mint-components 1.10.2-9 → 1.10.2
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-721bb748.js → ShadowViewAddon-b2621f27.js} +50 -27
- 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 +69 -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 +138 -14
- 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 +20 -0
- package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +116 -9
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +51 -26
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +118 -16
- package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +40 -3
- 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-31eb5b16.js → ShadowViewAddon-04640297.js} +50 -27
- 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 +69 -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 +138 -14
- package/dist/esm-es5/ShadowViewAddon-04640297.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-1c0be73e.entry.js +223 -0
- package/dist/mint-components/p-293b71ba.system.entry.js +1 -0
- package/dist/mint-components/{p-b45ba369.entry.js → p-31e810e9.entry.js} +2 -2
- package/dist/mint-components/{p-bf723ae9.entry.js → p-59d740b3.entry.js} +2 -2
- package/dist/mint-components/p-5de21018.system.entry.js +1 -0
- package/dist/mint-components/p-65d430d4.system.entry.js +1 -0
- package/dist/mint-components/p-9f0629ba.system.entry.js +1 -0
- package/dist/mint-components/{p-e704842c.js → p-c7fd9e16.js} +1 -1
- package/dist/mint-components/{p-d6474614.js → p-d3348267.js} +20 -20
- package/dist/mint-components/p-d8d2de11.entry.js +1 -0
- package/dist/mint-components/p-dbc2167e.system.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/types/components/sqm-image/sqm-image-view.d.ts +1 -0
- package/dist/types/components/sqm-image/sqm-image.d.ts +5 -0
- package/dist/types/components/sqm-leaderboard/Leaderboard.stories.d.ts +4 -0
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +6 -3
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +28 -4
- package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +4 -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 +66 -2
- 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-31eb5b16.js +0 -1
- package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +0 -1
- package/dist/mint-components/p-0d39c815.system.entry.js +0 -1
- package/dist/mint-components/p-1fe65a36.entry.js +0 -1
- package/dist/mint-components/p-27bd5535.entry.js +0 -187
- package/dist/mint-components/p-34fd1229.system.entry.js +0 -1
- package/dist/mint-components/p-922578e4.system.js +0 -1
- package/dist/mint-components/p-b567780d.system.js +0 -1
- package/dist/mint-components/p-c34a507e.system.entry.js +0 -1
- package/dist/mint-components/p-f1a1e7f3.system.entry.js +0 -1
|
@@ -8,7 +8,7 @@ const global = require('./global-02e50f09.js');
|
|
|
8
8
|
require('./index.module-df530553.js');
|
|
9
9
|
require('./JSS-8503a151.js');
|
|
10
10
|
const utils = require('./utils-6847bc06.js');
|
|
11
|
-
const sqmPortalContainerView = require('./sqm-portal-container-view-
|
|
11
|
+
const sqmPortalContainerView = require('./sqm-portal-container-view-990a85a3.js');
|
|
12
12
|
|
|
13
13
|
function EmptyStateView(props) {
|
|
14
14
|
const { emptyStateHeader, emptyStateImage, emptyStateText, supportText, missingFeature = "", } = props;
|
|
@@ -71,6 +71,13 @@ const PortalContainer = class {
|
|
|
71
71
|
* @uiName Maximum width
|
|
72
72
|
*/
|
|
73
73
|
this.maxWidth = "100%";
|
|
74
|
+
/**
|
|
75
|
+
* @uiName Flex wrap behavior
|
|
76
|
+
* @uiType string
|
|
77
|
+
* @uiEnum ["wrap", "nowrap"]
|
|
78
|
+
* @uiEnumNames ["Wrap", "No Wrap"]
|
|
79
|
+
*/
|
|
80
|
+
this.flexWrap = "wrap";
|
|
74
81
|
/**
|
|
75
82
|
* @uiName Background color
|
|
76
83
|
* @uiWidget color
|
package/dist/cjs/{sqm-portal-container-view-5fb2ad49.js → sqm-portal-container-view-990a85a3.js}
RENAMED
|
@@ -29,7 +29,7 @@ function PortalContainerView(props, children) {
|
|
|
29
29
|
Container: {
|
|
30
30
|
boxSizing: "border-box",
|
|
31
31
|
display: props.display || "grid",
|
|
32
|
-
flexWrap: "wrap",
|
|
32
|
+
flexWrap: props.flexWrap || "wrap",
|
|
33
33
|
"grid-template-columns": props.direction === "row"
|
|
34
34
|
? `repeat(auto-fill, minmax(${props.minWidth}, auto))`
|
|
35
35
|
: "100%",
|
|
@@ -28,8 +28,8 @@ const sqmPortalProfileView = require('./sqm-portal-profile-view-fde54e35.js');
|
|
|
28
28
|
require('./utilities-cec9dd36.js');
|
|
29
29
|
const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-96f329ed.js');
|
|
30
30
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7ffcc0d4.js');
|
|
31
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
32
|
-
const sqmPortalContainerView = require('./sqm-portal-container-view-
|
|
31
|
+
const ShadowViewAddon = require('./ShadowViewAddon-b2621f27.js');
|
|
32
|
+
const sqmPortalContainerView = require('./sqm-portal-container-view-990a85a3.js');
|
|
33
33
|
const sqmInvoiceTableView = require('./sqm-invoice-table-view-28b14d28.js');
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -1604,8 +1604,8 @@ const SlottedIntoComponent = () => {
|
|
|
1604
1604
|
data: {
|
|
1605
1605
|
rankType: "rowNumber",
|
|
1606
1606
|
leaderboard: [],
|
|
1607
|
-
showUser: true,
|
|
1608
1607
|
rowNumber: 10,
|
|
1608
|
+
showUser: true,
|
|
1609
1609
|
userRank: {
|
|
1610
1610
|
firstName: "Kutay",
|
|
1611
1611
|
lastInitial: "C",
|
|
@@ -1813,7 +1813,7 @@ const BigStat = /*#__PURE__*/Object.freeze({
|
|
|
1813
1813
|
MultipleStats: MultipleStats
|
|
1814
1814
|
});
|
|
1815
1815
|
|
|
1816
|
-
const scenario$4 = "@owner:noah @author:noah\nFeature: Leaderboard\n\tThe leaderboard supports three main cases\n\t- Top Started Referrers\n\t- Top Converted Referrers\n\t- Top Point Earners\n\tTo display these different types of leaderboards it uses the backends pre-canned options.\n\tThe backend supports filtering on programId and interval, programId is sourced from program context.\n\n Background: A user exists\n Given a user\n And they are viewing the leaderboard\n\n @motivating\n Scenario Outline: Two types of referrals leaderboards can be displayed\n Given a leaderboard has prop \"leaderboard-type\" with <value>\n And there are started referrals on the tenant\n And there are started converted on the tenant\n When the user views the leaderboard\n Then they see the referral <referralType> leaderboard\n\n Examples:\n | value | referralType |\n | topStartedReferrers | started |\n | topConvertedReferrers | converted |\n\n @motivating\n Scenario: The top point earners leaderboard can be displayed\n Given a leaderboard has prop \"leaderboard-type\" with value \"topPointEarners\"\n And there are users with points\n When the user views the leaderboard\n Then they see the top point earners leaderboard\n And text values are displayed for point counts\n\n @minutia\n Scenario Outline: Reward pretty value is used on the top point earners leaderboard\n Given top point earners leaderboard\n And the \"POINT\" reward unit has a pretty value for the following locales\n | locale |\n | en |\n | fr |\n | tr |\n When the user views the leaderboard\n And they have <locale>\n Then they see the translated pretty value in the stat value column\n\n @motivating\n Scenario Outline: Program Context is used by default to filter leaderboard results\n Given a <leaderboardType> leaderboard loaded with program context for \"my-program\"\n When the user views the leaderboard\n Then they only see <results> from \"my-program\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Program Id context can be overwritten with a prop\n Given a <leaderboardType> leaderboard has prop \"program-Id\" with value \"my-test-program\"\n When the user views the leaderboard\n Then they only see <results> from \"my-test-program\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Global leaderboards can be displayed by clearing program context\n\t\t#This is important for clients with use cases like StaffTracks global points leaderboard\n\t\t#This can also be done with a program section in a similar manner\n Given a <leaderboardType> leaderboard has prop \"program-Id\" with value \"\"\n When the user views the leaderboard\n Then they see global <results>\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario: Leaderboard results are shown in descending order\n Given there are leaderboard results\n When the user views the leaderboard\n Then they see up to the 10 top leaderboard results\n And leaderboard is in descending order\n\n @motivating\n Scenario Outline: Leaderboard results can be filtered with a time interval\n Given a <leaderboardType> leaderboard\n And it has prop \"interval\" with value \"2021-11-02T07:00:00.000Z/2021-11-07T07:00:00.000Z\"\n When the user views the leaderboard\n Then they only see <results> from within \"2021-11-02T07:00:00.000Z/2021-11-07T07:00:00.000Z\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Leaderboard rank type can be configured\n Given a leaderboard has prop \"rank-type\" with <value>\n When the user views the leaderboard\n Then their leaderboard rank is their <rank>\n\n Examples:\n | value | rank |\n | rowNumber | row number |\n | denseRank | dense rank |\n | rank | rank |\n\n @minutia\n Scenario Outline: The max number of leaderboard rows displayed can be configured but defaults to 10\n Given a leaderboard has prop \"max-rows\" with <value>\n And the leaderboard has <resultCount>\n When the user views the leaderboard\n Then they see <number> rows\n\n Examples:\n | value | resultCount | number |\n | | 10 | 10 |\n | 5 | 10 | 5 |\n | 3 | 1 | 1 |\n | 25 | 15 | 15 |\n\n @minutiae @ui\n Scenario: Leaderboards with no results show an empty state\n Given a leaderboard has no results\n When the user views the leaderboard\n Then an empty state is dislayed\n And they see an image of a leaderboard\n And below they see \"View your rank in the leaderboard\"\n And below they see \"Be the first to refer a friend and reach the top of the leaderboard\"\n And the text is center aligned\n\n @minutiae @ui\n Scenario: A custom empty state can be provided\n Given a leaderboard has no results\n When the user views the leaderboard\n Then the contents of the \"empty\" slot are displayed\n\n @minutiae @ui\n Scenario: User is on Essentials plan\n Given the user has an Essentials plan\n When they view the leaderboard\n Then a message telling them to upgrade their plan appears:\n \"\"\"\n Contact Support to upgrade your plan and start leveraging\n gamification in your program.\n \"\"\"\n And an empty table image is displayed\n\n @minutiae @ui\n Scenario: Leaderboard headings can be customized\n Given a leaderboard\n And it has the following props\n | prop | value |\n | rankheading | Place |\n | usersheading | Customer |\n | statsheading | Referral Count |\n | show-rank | true |\n When the user views the leaderboard\n Then they see the following columns with headings\n | column | heading |\n | rank | Place |\n | user | Customer |\n | stat | Referral Count |\n\n @motivating @ui\n Scenario Outline: Leaderboard rank can be hidden or shown\n Given a leaderboard\n And it has prop \"show-rank\" with <propValue>\n When the user views the leaderboard\n Then they <maySee> the rank column\n\n Examples:\n | propValue | maySee |\n | true | see |\n | false | don't see |\n | | don't see |\n\n @motivating @ui\n Scenario: Users in the top 10 of the leaderboard results see their leaderboard row highlighted\n Given a user in the top 10 of the leaderboard results\n When they view the leaderboard\n Then they see the row with their name highlighted with brand colour\n\n @motivating @ui\n Scenario Outline: Users not in the top 10 leaderboard results can see their progress at the bottom of the leaderboard\n Given a user <mayHave> completed actions counted by the leaderboard\n And they are not in the top 10 leaderboard results\n And the leaderboard has prop \"show-user\" with <value>\n When they view the leaderboard\n Then they <maySee> \"...\" under the top 10 leaderboard results\n And under \"...\" they <maySee> a row highlighted with brand colour\n And they <maySee> their name\n And they <maySee> their leaderboard value\n And they <maySeeRank>\n\n Examples:\n | mayHave | value | maySee | maySeeRank |\n | has | true | see | see their rank |\n | hasn't | true | see | don't see their rank |\n | N/A | false | don't see | don't see their rank |\n | hasn't | | see | don't see their rank |\n\n @minutiae\n Scenario: Users without names are displayed as an \"Anonymous User\"\n Given a user\n And they do not have a first name\n And they do not have a last initial\n When they view the leaderboard\n Then they see the user displayed as \"Anonymous User\"\n\n @minutiae\n Scenario Outline: If a user only has a first or last name, then only that is displayed\n Given a user\n And they only have a <name>\n When they view the leaderboard\n Then they only see their <name>\n\n Examples:\n | name |\n | firstName |\n | lastName |\n";
|
|
1816
|
+
const scenario$4 = "@owner:noah @author:noah\nFeature: Leaderboard\n\tThe leaderboard supports three main cases\n\t- Top Started Referrers\n\t- Top Converted Referrers\n\t- Top Point Earners\n\tTo display these different types of leaderboards it uses the backends pre-canned options.\n\tThe backend supports filtering on programId and interval, programId is sourced from program context.\n\n Background: A user exists\n Given a user\n And they are viewing the leaderboard\n\n @motivating\n Scenario Outline: Two types of referrals leaderboards can be displayed\n Given a leaderboard has prop \"leaderboard-type\" with <value>\n And there are started referrals on the tenant\n And there are started converted on the tenant\n When the user views the leaderboard\n Then they see the referral <referralType> leaderboard\n\n Examples:\n | value | referralType |\n | topStartedReferrers | started |\n | topConvertedReferrers | converted |\n\n @motivating\n Scenario: The top point earners leaderboard can be displayed\n Given a leaderboard has prop \"leaderboard-type\" with value \"topPointEarners\"\n And there are users with points\n When the user views the leaderboard\n Then they see the top point earners leaderboard\n And text values are displayed for point counts\n\n @minutia\n Scenario Outline: Reward pretty value is used on the top point earners leaderboard\n Given top point earners leaderboard\n And the \"POINT\" reward unit has a pretty value for the following locales\n | locale |\n | en |\n | fr |\n | tr |\n When the user views the leaderboard\n And they have <locale>\n Then they see the translated pretty value in the stat value column\n\n @motivating\n Scenario Outline: Program Context is used by default to filter leaderboard results\n Given a <leaderboardType> leaderboard loaded with program context for \"my-program\"\n When the user views the leaderboard\n Then they only see <results> from \"my-program\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Program Id context can be overwritten with a prop\n Given a <leaderboardType> leaderboard has prop \"program-Id\" with value \"my-test-program\"\n When the user views the leaderboard\n Then they only see <results> from \"my-test-program\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Global leaderboards can be displayed by clearing program context\n\t\t#This is important for clients with use cases like StaffTracks global points leaderboard\n\t\t#This can also be done with a program section in a similar manner\n Given a <leaderboardType> leaderboard has prop \"program-Id\" with value \"\"\n When the user views the leaderboard\n Then they see global <results>\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario: Leaderboard results are shown in descending order\n Given there are leaderboard results\n When the user views the leaderboard\n Then they see up to the 10 top leaderboard results\n And leaderboard is in descending order\n\n @motivating\n Scenario Outline: Leaderboard results can be filtered with a time interval\n Given a <leaderboardType> leaderboard\n And it has prop \"interval\" with value \"2021-11-02T07:00:00.000Z/2021-11-07T07:00:00.000Z\"\n When the user views the leaderboard\n Then they only see <results> from within \"2021-11-02T07:00:00.000Z/2021-11-07T07:00:00.000Z\"\n\n Examples:\n | leaderboardType | results |\n | topStartedReferrers | started referrals |\n | topConvertedReferrers | converted referrals |\n | topPointEarners | points earned |\n\n @motivating\n Scenario Outline: Leaderboard rank type can be configured\n Given a leaderboard has prop \"rank-type\" with <value>\n When the user views the leaderboard\n Then their leaderboard rank is their <rank>\n\n Examples:\n | value | rank |\n | rowNumber | row number |\n | denseRank | dense rank |\n | rank | rank |\n\n @minutia\n Scenario Outline: The max number of leaderboard rows displayed can be configured but defaults to 10\n Given a leaderboard has prop \"max-rows\" with <value>\n And the leaderboard has <resultCount>\n When the user views the leaderboard\n Then they see <number> rows\n\n Examples:\n | value | resultCount | number |\n | | 10 | 10 |\n | 5 | 10 | 5 |\n | 3 | 1 | 1 |\n | 25 | 15 | 15 |\n\n @minutiae @ui\n Scenario: Leaderboards with no results show an empty state\n Given a leaderboard has no results\n When the user views the leaderboard\n Then an empty state is dislayed\n And they see an image of a leaderboard\n And below they see \"View your rank in the leaderboard\"\n And below they see \"Be the first to refer a friend and reach the top of the leaderboard\"\n And the text is center aligned\n\n @minutiae @ui\n Scenario: A custom empty state can be provided\n Given a leaderboard has no results\n When the user views the leaderboard\n Then the contents of the \"empty\" slot are displayed\n\n @minutiae @ui\n Scenario: User is on Essentials plan\n Given the user has an Essentials plan\n When they view the leaderboard\n Then a message telling them to upgrade their plan appears:\n \"\"\"\n Contact Support to upgrade your plan and start leveraging\n gamification in your program.\n \"\"\"\n And an empty table image is displayed\n\n @minutiae @ui\n Scenario: Leaderboard headings can be customized\n Given a leaderboard\n And it has the following props\n | prop | value |\n | rankheading | Place |\n | usersheading | Customer |\n | statsheading | Referral Count |\n | show-rank | true |\n When the user views the leaderboard\n Then they see the following columns with headings\n | column | heading |\n | rank | Place |\n | user | Customer |\n | stat | Referral Count |\n\n @motivating @ui\n Scenario Outline: Leaderboard rank can be hidden or shown\n Given a leaderboard\n And it has prop \"show-rank\" with <propValue>\n When the user views the leaderboard\n Then they <maySee> the rank column\n\n Examples:\n | propValue | maySee |\n | true | see |\n | false | don't see |\n | | don't see |\n\n Scenario Outline: Users names can be hidden or shown\n Given a leaderboard\n And it has prop \"hide-names\" with <propValue>\n When the user views the leaderboard\n Then they <maySee> the referrer column\n\n Examples:\n | propValue | maySee |\n | true | don't see |\n | false | see |\n | | see |\n\n @motivating @ui\n Scenario: Users in the top 10 of the leaderboard results see their leaderboard row highlighted\n Given a user in the top 10 of the leaderboard results\n When they view the leaderboard\n Then they see the row with their name highlighted with brand colour\n\n @motivating @ui\n Scenario Outline: Users not in the top 10 leaderboard results can see their progress at the bottom of the leaderboard\n Given a user <mayHave> completed actions counted by the leaderboard\n And they are not in the top 10 leaderboard results\n And the leaderboard has prop \"show-user\" with <value>\n When they view the leaderboard\n Then they <maySee> \"...\" under the top 10 leaderboard results\n And under \"...\" they <maySee> a row highlighted with brand colour\n And they <maySee> their name\n And they <maySee> their leaderboard value\n And they <maySeeRank>\n\n Examples:\n | mayHave | value | maySee | maySeeRank |\n | has | true | see | see their rank |\n | hasn't | true | see | don't see their rank |\n | N/A | false | don't see | don't see their rank |\n | hasn't | | see | don't see their rank |\n\n @minutiae\n Scenario: Users without names are displayed as an \"Anonymous User\"\n Given a user\n And they do not have a first name\n And they do not have a last initial\n When they view the leaderboard\n Then they see the user displayed as \"Anonymous User\"\n\n @minutiae\n Scenario Outline: If a user only has a first or last name, then only that is displayed\n Given a user\n And they only have a <name>\n When they view the leaderboard\n Then they only see their <name>\n\n Examples:\n | name |\n | firstName |\n | lastName |\n";
|
|
1817
1817
|
|
|
1818
1818
|
const Leaderboard_stories = {
|
|
1819
1819
|
title: "Components/Leaderboard",
|
|
@@ -1895,8 +1895,8 @@ const users = [
|
|
|
1895
1895
|
];
|
|
1896
1896
|
const pointsUsers = [
|
|
1897
1897
|
{
|
|
1898
|
-
firstName: "",
|
|
1899
|
-
lastInitial: "",
|
|
1898
|
+
firstName: "Tom",
|
|
1899
|
+
lastInitial: "Smith",
|
|
1900
1900
|
textValue: "82 Points",
|
|
1901
1901
|
rank: 1,
|
|
1902
1902
|
rowNumber: 1,
|
|
@@ -1970,17 +1970,13 @@ const defaultStyles$1 = {
|
|
|
1970
1970
|
statsheading: "Referrals",
|
|
1971
1971
|
rankheading: "Rank",
|
|
1972
1972
|
anonymousUser: "Anonymous User",
|
|
1973
|
+
viewingUserText: "You",
|
|
1974
|
+
rankSuffix: "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
|
|
1973
1975
|
};
|
|
1974
1976
|
const link = index.h("a", null, "Support");
|
|
1975
1977
|
const defaultElements$1 = {
|
|
1976
1978
|
empty: (index.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" })),
|
|
1977
1979
|
essentials: (index.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" })),
|
|
1978
|
-
loadingstate: (index.h("slot", { name: "loading" },
|
|
1979
|
-
index.h("table", null, [...Array(10)].map(() => {
|
|
1980
|
-
return (index.h("tr", null,
|
|
1981
|
-
index.h("td", null,
|
|
1982
|
-
index.h("sl-skeleton", null))));
|
|
1983
|
-
})))),
|
|
1984
1980
|
};
|
|
1985
1981
|
const Empty$1 = () => {
|
|
1986
1982
|
const props = {
|
|
@@ -2186,6 +2182,38 @@ const ReferralLeaderboard = () => {
|
|
|
2186
2182
|
};
|
|
2187
2183
|
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2188
2184
|
};
|
|
2185
|
+
const ReferralLeaderboardWithMaxWidth = () => {
|
|
2186
|
+
const props = {
|
|
2187
|
+
states: {
|
|
2188
|
+
loading: false,
|
|
2189
|
+
hasLeaders: true,
|
|
2190
|
+
styles: {
|
|
2191
|
+
...defaultStyles$1,
|
|
2192
|
+
rankheading: "Rank",
|
|
2193
|
+
usersheading: "User",
|
|
2194
|
+
statsheading: "Referrals",
|
|
2195
|
+
showRank: false,
|
|
2196
|
+
maxWidth: "300px",
|
|
2197
|
+
},
|
|
2198
|
+
},
|
|
2199
|
+
data: {
|
|
2200
|
+
rankType: "rowNumber",
|
|
2201
|
+
leaderboard: users,
|
|
2202
|
+
rowNumber: 10,
|
|
2203
|
+
viewerRank: {
|
|
2204
|
+
firstName: "Viktor",
|
|
2205
|
+
lastInitial: "V",
|
|
2206
|
+
textValue: "82",
|
|
2207
|
+
rank: 1,
|
|
2208
|
+
rowNumber: 1,
|
|
2209
|
+
},
|
|
2210
|
+
},
|
|
2211
|
+
elements: {
|
|
2212
|
+
...defaultElements$1,
|
|
2213
|
+
},
|
|
2214
|
+
};
|
|
2215
|
+
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2216
|
+
};
|
|
2189
2217
|
const PointsLeaderboard = () => {
|
|
2190
2218
|
const props = {
|
|
2191
2219
|
states: {
|
|
@@ -2264,7 +2292,7 @@ const ViewerOutside = () => {
|
|
|
2264
2292
|
lastInitial: "C",
|
|
2265
2293
|
textValue: "8",
|
|
2266
2294
|
rowNumber: 11,
|
|
2267
|
-
rank:
|
|
2295
|
+
rank: 24,
|
|
2268
2296
|
},
|
|
2269
2297
|
},
|
|
2270
2298
|
elements: {
|
|
@@ -2295,6 +2323,33 @@ const ViewerAnonymous = () => {
|
|
|
2295
2323
|
};
|
|
2296
2324
|
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2297
2325
|
};
|
|
2326
|
+
const HideNamesWithViewerOutside = () => {
|
|
2327
|
+
const props = {
|
|
2328
|
+
states: {
|
|
2329
|
+
loading: false,
|
|
2330
|
+
hasLeaders: true,
|
|
2331
|
+
styles: {
|
|
2332
|
+
...defaultStyles$1,
|
|
2333
|
+
showRank: true,
|
|
2334
|
+
hideNames: true,
|
|
2335
|
+
},
|
|
2336
|
+
},
|
|
2337
|
+
data: {
|
|
2338
|
+
rankType: "rowNumber",
|
|
2339
|
+
leaderboard: users,
|
|
2340
|
+
rowNumber: 10,
|
|
2341
|
+
viewerRank: {
|
|
2342
|
+
textValue: "8",
|
|
2343
|
+
rowNumber: 11,
|
|
2344
|
+
rank: 42,
|
|
2345
|
+
},
|
|
2346
|
+
},
|
|
2347
|
+
elements: {
|
|
2348
|
+
...defaultElements$1,
|
|
2349
|
+
},
|
|
2350
|
+
};
|
|
2351
|
+
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2352
|
+
};
|
|
2298
2353
|
const HideViewer = () => {
|
|
2299
2354
|
const props = {
|
|
2300
2355
|
states: {
|
|
@@ -2325,6 +2380,58 @@ const HideViewer = () => {
|
|
|
2325
2380
|
};
|
|
2326
2381
|
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2327
2382
|
};
|
|
2383
|
+
const HideNames = () => {
|
|
2384
|
+
const props = {
|
|
2385
|
+
states: {
|
|
2386
|
+
loading: false,
|
|
2387
|
+
hasLeaders: true,
|
|
2388
|
+
rowNumber: 10,
|
|
2389
|
+
styles: {
|
|
2390
|
+
...defaultStyles$1,
|
|
2391
|
+
showRank: true,
|
|
2392
|
+
hideNames: true,
|
|
2393
|
+
},
|
|
2394
|
+
},
|
|
2395
|
+
data: {
|
|
2396
|
+
rankType: "rowNumber",
|
|
2397
|
+
leaderboard: users,
|
|
2398
|
+
rowNumber: 10,
|
|
2399
|
+
viewerRank: {
|
|
2400
|
+
firstName: "Viktor",
|
|
2401
|
+
lastInitial: "V",
|
|
2402
|
+
textValue: "82",
|
|
2403
|
+
rowNumber: 1,
|
|
2404
|
+
rank: 1,
|
|
2405
|
+
},
|
|
2406
|
+
},
|
|
2407
|
+
elements: {
|
|
2408
|
+
...defaultElements$1,
|
|
2409
|
+
},
|
|
2410
|
+
};
|
|
2411
|
+
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
|
|
2412
|
+
};
|
|
2413
|
+
const LeaderboardWithNoNamesAndGraphic = () => {
|
|
2414
|
+
return (index.h("div", { style: {
|
|
2415
|
+
display: "flex",
|
|
2416
|
+
alignItems: "flex-start",
|
|
2417
|
+
justifyContent: "center",
|
|
2418
|
+
width: "100%",
|
|
2419
|
+
gap: "50px",
|
|
2420
|
+
} },
|
|
2421
|
+
index.h("div", { style: {
|
|
2422
|
+
display: "flex",
|
|
2423
|
+
flexDirection: "column",
|
|
2424
|
+
alignItems: "center",
|
|
2425
|
+
justifyContent: "center",
|
|
2426
|
+
gap: "10px",
|
|
2427
|
+
maxWidth: "30%",
|
|
2428
|
+
} },
|
|
2429
|
+
index.h("sqm-image", { width: "70%", alignment: "center", imageUrl: "https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png" }),
|
|
2430
|
+
index.h("h2", { style: { margin: "auto" } }, " Top Performers"),
|
|
2431
|
+
index.h("p", { style: { margin: "0" } }, "The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!")),
|
|
2432
|
+
index.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" },
|
|
2433
|
+
index.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" }))));
|
|
2434
|
+
};
|
|
2328
2435
|
|
|
2329
2436
|
const Leaderboard = /*#__PURE__*/Object.freeze({
|
|
2330
2437
|
__proto__: null,
|
|
@@ -2335,11 +2442,15 @@ const Leaderboard = /*#__PURE__*/Object.freeze({
|
|
|
2335
2442
|
One: One,
|
|
2336
2443
|
Five: Five,
|
|
2337
2444
|
ReferralLeaderboard: ReferralLeaderboard,
|
|
2445
|
+
ReferralLeaderboardWithMaxWidth: ReferralLeaderboardWithMaxWidth,
|
|
2338
2446
|
PointsLeaderboard: PointsLeaderboard,
|
|
2339
2447
|
TenWithRank: TenWithRank,
|
|
2340
2448
|
ViewerOutside: ViewerOutside,
|
|
2341
2449
|
ViewerAnonymous: ViewerAnonymous,
|
|
2342
|
-
|
|
2450
|
+
HideNamesWithViewerOutside: HideNamesWithViewerOutside,
|
|
2451
|
+
HideViewer: HideViewer,
|
|
2452
|
+
HideNames: HideNames,
|
|
2453
|
+
LeaderboardWithNoNamesAndGraphic: LeaderboardWithNoNamesAndGraphic
|
|
2343
2454
|
});
|
|
2344
2455
|
|
|
2345
2456
|
const HookStoryAddon = ({ story }, children) => {
|
|
@@ -11558,6 +11669,18 @@ const SpaceEvenly = () => {
|
|
|
11558
11669
|
index.h("p", null, "Points Balance")))),
|
|
11559
11670
|
index.h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
|
|
11560
11671
|
};
|
|
11672
|
+
const ResponsiveBox = () => {
|
|
11673
|
+
return (index.h("div", { style: { width: "100%", maxWidth: "1000px", border: "1px dashed grey" } },
|
|
11674
|
+
index.h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "space-between", "flex-wrap": "nowrap" },
|
|
11675
|
+
index.h("sqm-stat-container", { space: "xxx-large", display: "flex" },
|
|
11676
|
+
index.h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardsRedeemed/CREDIT/global" },
|
|
11677
|
+
index.h("sqm-text", null,
|
|
11678
|
+
index.h("p", null, "Rewards Redeemed"))),
|
|
11679
|
+
index.h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardBalance/CREDIT/POINT/value/global" },
|
|
11680
|
+
index.h("sqm-text", null,
|
|
11681
|
+
index.h("p", null, "Points Balance")))),
|
|
11682
|
+
index.h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
|
|
11683
|
+
};
|
|
11561
11684
|
const Start$1 = () => {
|
|
11562
11685
|
return (index.h("div", { style: { width: "1000px", border: "1px dashed grey" } },
|
|
11563
11686
|
index.h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "start" },
|
|
@@ -11621,6 +11744,7 @@ const PortalContainer = /*#__PURE__*/Object.freeze({
|
|
|
11621
11744
|
SpaceBetween: SpaceBetween,
|
|
11622
11745
|
SpaceAround: SpaceAround,
|
|
11623
11746
|
SpaceEvenly: SpaceEvenly,
|
|
11747
|
+
ResponsiveBox: ResponsiveBox,
|
|
11624
11748
|
Start: Start$1,
|
|
11625
11749
|
Center: Center,
|
|
11626
11750
|
End: End,
|
|
@@ -126,6 +126,26 @@ 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
|
|
129
149
|
}
|
|
130
150
|
}; }
|
|
131
151
|
}
|
|
@@ -81,8 +81,8 @@ const users = [
|
|
|
81
81
|
];
|
|
82
82
|
const pointsUsers = [
|
|
83
83
|
{
|
|
84
|
-
firstName: "",
|
|
85
|
-
lastInitial: "",
|
|
84
|
+
firstName: "Tom",
|
|
85
|
+
lastInitial: "Smith",
|
|
86
86
|
textValue: "82 Points",
|
|
87
87
|
rank: 1,
|
|
88
88
|
rowNumber: 1,
|
|
@@ -156,18 +156,14 @@ 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}}",
|
|
159
161
|
};
|
|
160
162
|
const link = h("a", null, "Support");
|
|
161
163
|
const tag = "Contact" + link + "about upgrading your plan";
|
|
162
164
|
const defaultElements = {
|
|
163
165
|
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" })),
|
|
164
166
|
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
|
-
})))),
|
|
171
167
|
};
|
|
172
168
|
export const Empty = () => {
|
|
173
169
|
const props = {
|
|
@@ -373,6 +369,38 @@ export const ReferralLeaderboard = () => {
|
|
|
373
369
|
};
|
|
374
370
|
return h(LeaderboardView, Object.assign({}, props));
|
|
375
371
|
};
|
|
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
|
+
};
|
|
376
404
|
export const PointsLeaderboard = () => {
|
|
377
405
|
const props = {
|
|
378
406
|
states: {
|
|
@@ -451,7 +479,7 @@ export const ViewerOutside = () => {
|
|
|
451
479
|
lastInitial: "C",
|
|
452
480
|
textValue: "8",
|
|
453
481
|
rowNumber: 11,
|
|
454
|
-
rank:
|
|
482
|
+
rank: 24,
|
|
455
483
|
},
|
|
456
484
|
},
|
|
457
485
|
elements: {
|
|
@@ -482,6 +510,33 @@ export const ViewerAnonymous = () => {
|
|
|
482
510
|
};
|
|
483
511
|
return h(LeaderboardView, Object.assign({}, props));
|
|
484
512
|
};
|
|
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
|
+
};
|
|
485
540
|
export const HideViewer = () => {
|
|
486
541
|
const props = {
|
|
487
542
|
states: {
|
|
@@ -512,3 +567,55 @@ export const HideViewer = () => {
|
|
|
512
567
|
};
|
|
513
568
|
return h(LeaderboardView, Object.assign({}, props));
|
|
514
569
|
};
|
|
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,5 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
+
import { intl } from "../../global/global";
|
|
3
4
|
const style = {
|
|
4
5
|
Leaderboard: {
|
|
5
6
|
"& table": {
|
|
@@ -21,9 +22,10 @@ const style = {
|
|
|
21
22
|
fontWeight: "var(--sl-font-weight-normal)",
|
|
22
23
|
},
|
|
23
24
|
"& .ellipses": {
|
|
24
|
-
textAlign: "
|
|
25
|
+
textAlign: "left",
|
|
25
26
|
padding: "0",
|
|
26
27
|
color: "var(--sl-color-neutral-500)",
|
|
28
|
+
paddingLeft: "25%",
|
|
27
29
|
},
|
|
28
30
|
"& .highlight": {
|
|
29
31
|
background: "var(--sl-color-primary-50)",
|
|
@@ -39,6 +41,12 @@ const style = {
|
|
|
39
41
|
width: "auto",
|
|
40
42
|
whiteSpace: "nowrap",
|
|
41
43
|
},
|
|
44
|
+
"& .Rank": {
|
|
45
|
+
whiteSpace: "nowrap",
|
|
46
|
+
},
|
|
47
|
+
"& .fullWidth": {
|
|
48
|
+
width: "100%",
|
|
49
|
+
},
|
|
42
50
|
},
|
|
43
51
|
};
|
|
44
52
|
const sheet = createStyleSheet(style);
|
|
@@ -49,56 +57,73 @@ const vanillaStyle = `
|
|
|
49
57
|
}
|
|
50
58
|
`;
|
|
51
59
|
export function LeaderboardView(props) {
|
|
52
|
-
var _a, _b, _c
|
|
60
|
+
var _a, _b, _c;
|
|
53
61
|
const { states, data, elements } = props;
|
|
54
62
|
const { styles } = states;
|
|
55
63
|
if (states.loading)
|
|
56
|
-
return (h("div", { class: sheet.classes.Leaderboard },
|
|
64
|
+
return (h("div", { class: sheet.classes.Leaderboard, style: { width: styles.width || "100%" } },
|
|
57
65
|
h("style", { type: "text/css" },
|
|
58
66
|
styleString,
|
|
59
67
|
vanillaStyle),
|
|
60
|
-
|
|
68
|
+
h("table", null, [...Array(10)].map(() => {
|
|
69
|
+
return (h("tr", null,
|
|
70
|
+
h("td", null,
|
|
71
|
+
h("sl-skeleton", null))));
|
|
72
|
+
}))));
|
|
61
73
|
if (states.isEssentials)
|
|
62
74
|
return elements.essentials;
|
|
63
75
|
if (!states.hasLeaders)
|
|
64
76
|
return elements.empty;
|
|
65
77
|
let userSeenFlag = false;
|
|
66
|
-
|
|
78
|
+
const getUsersName = (user) => {
|
|
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%" } },
|
|
67
104
|
h("style", { type: "text/css" },
|
|
68
105
|
styleString,
|
|
69
106
|
vanillaStyle),
|
|
70
|
-
h("div", null, "Leaderboards"),
|
|
71
107
|
h("table", { part: "sqm-table" },
|
|
72
108
|
h("tr", null,
|
|
73
|
-
styles.showRank && h("th", { class:
|
|
74
|
-
h("th", { class: "User" }, styles.usersheading),
|
|
109
|
+
styles.showRank && (h("th", { class: `Rank ${styles.hideNames ? "fullWidth" : ""}` }, styles.rankheading)),
|
|
110
|
+
!styles.hideNames && h("th", { class: "User" }, styles.usersheading),
|
|
75
111
|
h("th", { class: "Score" }, styles.statsheading)), (_a = data.leaderboard) === null || _a === void 0 ? void 0 :
|
|
76
112
|
_a.map((user) => {
|
|
77
113
|
var _a, _b;
|
|
78
114
|
if (user.rowNumber === ((_a = data.viewerRank) === null || _a === void 0 ? void 0 : _a.rowNumber))
|
|
79
115
|
userSeenFlag = true;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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),
|
|
116
|
+
const isViewingUsersRow = !styles.hideViewer && user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber);
|
|
117
|
+
return (h("tr", { class: isViewingUsersRow ? "highlight" : "" },
|
|
118
|
+
styles.showRank && (h("td", { class: "Rank" }, getRankCellText(user.rank, isViewingUsersRow))),
|
|
119
|
+
!styles.hideNames && h("td", { class: "User" }, getUsersName(user)),
|
|
90
120
|
h("td", { class: "Score" }, user.textValue)));
|
|
91
121
|
}),
|
|
92
122
|
!userSeenFlag && !styles.hideViewer && (h("tr", null,
|
|
93
123
|
h("td", { colSpan: 100, class: "ellipses" },
|
|
94
124
|
h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
|
|
95
125
|
!userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
|
|
96
|
-
styles.showRank && (h("td", { class: "Rank" }, ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank
|
|
97
|
-
h("td", { class: "User" }, (
|
|
98
|
-
|
|
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"))))));
|
|
126
|
+
styles.showRank && (h("td", { class: "Rank" }, getRankCellText((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank, true))),
|
|
127
|
+
!styles.hideNames && (h("td", { class: "User" }, getUsersName(data.viewerRank || {}))),
|
|
128
|
+
h("td", { class: "Score" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.textValue) || "0"))))));
|
|
104
129
|
}
|