@saasquatch/mint-components 1.10.2-8 → 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.
Files changed (69) hide show
  1. package/dist/cjs/{ShadowViewAddon-3e537eb3.js → ShadowViewAddon-b2621f27.js} +46 -30
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +57 -33
  5. package/dist/cjs/sqm-big-stat_38.cjs.entry.js +11 -16
  6. package/dist/cjs/sqm-empty_4.cjs.entry.js +8 -1
  7. package/dist/cjs/{sqm-portal-container-view-5fb2ad49.js → sqm-portal-container-view-990a85a3.js} +1 -1
  8. package/dist/cjs/sqm-stencilbook.cjs.entry.js +45 -9
  9. package/dist/collection/components/sqm-image/sqm-image-view.js +0 -1
  10. package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +29 -7
  11. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +46 -29
  12. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +39 -27
  13. package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +0 -1
  14. package/dist/collection/components/sqm-portal-container/PortalContainer.stories.js +12 -0
  15. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +1 -1
  16. package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +37 -0
  17. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +2 -1
  18. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +55 -32
  19. package/dist/esm/{ShadowViewAddon-2ac771ca.js → ShadowViewAddon-04640297.js} +46 -30
  20. package/dist/esm/loader.js +1 -1
  21. package/dist/esm/mint-components.js +1 -1
  22. package/dist/esm/sqm-banking-info-form_16.entry.js +57 -33
  23. package/dist/esm/sqm-big-stat_38.entry.js +11 -16
  24. package/dist/esm/sqm-empty_4.entry.js +8 -1
  25. package/dist/esm/{sqm-portal-container-view-ab89c6cc.js → sqm-portal-container-view-6c582684.js} +1 -1
  26. package/dist/esm/sqm-stencilbook.entry.js +45 -9
  27. package/dist/esm-es5/ShadowViewAddon-04640297.js +1 -0
  28. package/dist/esm-es5/loader.js +1 -1
  29. package/dist/esm-es5/mint-components.js +1 -1
  30. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  31. package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
  32. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  33. package/dist/esm-es5/sqm-portal-container-view-6c582684.js +1 -0
  34. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  35. package/dist/mint-components/mint-components.esm.js +1 -1
  36. package/dist/mint-components/{p-5a1b4b5d.entry.js → p-1c0be73e.entry.js} +12 -12
  37. package/dist/mint-components/p-293b71ba.system.entry.js +1 -0
  38. package/dist/mint-components/{p-b45ba369.entry.js → p-31e810e9.entry.js} +2 -2
  39. package/dist/mint-components/{p-560f7316.entry.js → p-59d740b3.entry.js} +2 -2
  40. package/dist/mint-components/p-5de21018.system.entry.js +1 -0
  41. package/dist/mint-components/p-65d430d4.system.entry.js +1 -0
  42. package/dist/mint-components/p-9f0629ba.system.entry.js +1 -0
  43. package/dist/mint-components/{p-e704842c.js → p-c7fd9e16.js} +1 -1
  44. package/dist/mint-components/{p-a7949e42.js → p-d3348267.js} +20 -20
  45. package/dist/mint-components/p-d8d2de11.entry.js +1 -0
  46. package/dist/mint-components/p-dbc2167e.system.js +1 -0
  47. package/dist/mint-components/p-ed17e637.system.js +1 -1
  48. package/dist/mint-components/p-ed6ebd60.system.js +1 -0
  49. package/dist/types/components/sqm-leaderboard/Leaderboard.stories.d.ts +1 -0
  50. package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +3 -3
  51. package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +13 -7
  52. package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +1 -1
  53. package/dist/types/components/sqm-portal-container/PortalContainer.stories.d.ts +1 -0
  54. package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +1 -0
  55. package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +7 -0
  56. package/dist/types/components.d.ts +28 -2
  57. package/docs/docs.docx +0 -0
  58. package/docs/raisins.json +1 -1
  59. package/grapesjs/grapesjs.js +1 -1
  60. package/package.json +2 -2
  61. package/dist/esm-es5/ShadowViewAddon-2ac771ca.js +0 -1
  62. package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +0 -1
  63. package/dist/mint-components/p-0e507dfe.system.entry.js +0 -1
  64. package/dist/mint-components/p-1fe65a36.entry.js +0 -1
  65. package/dist/mint-components/p-34fd1229.system.entry.js +0 -1
  66. package/dist/mint-components/p-4348de13.system.js +0 -1
  67. package/dist/mint-components/p-922578e4.system.js +0 -1
  68. package/dist/mint-components/p-c34a507e.system.entry.js +0 -1
  69. package/dist/mint-components/p-e82b056c.system.entry.js +0 -1
@@ -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-3e537eb3.js');
32
- const sqmPortalContainerView = require('./sqm-portal-container-view-5fb2ad49.js');
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
  /**
@@ -1970,18 +1970,13 @@ const defaultStyles$1 = {
1970
1970
  statsheading: "Referrals",
1971
1971
  rankheading: "Rank",
1972
1972
  anonymousUser: "Anonymous User",
1973
+ viewingUserText: "You",
1973
1974
  rankSuffix: "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
1974
1975
  };
1975
1976
  const link = index.h("a", null, "Support");
1976
1977
  const defaultElements$1 = {
1977
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" })),
1978
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" })),
1979
- loadingstate: (index.h("slot", { name: "loading" },
1980
- index.h("table", null, [...Array(10)].map(() => {
1981
- return (index.h("tr", null,
1982
- index.h("td", null,
1983
- index.h("sl-skeleton", null))));
1984
- })))),
1985
1980
  };
1986
1981
  const Empty$1 = () => {
1987
1982
  const props = {
@@ -2297,7 +2292,7 @@ const ViewerOutside = () => {
2297
2292
  lastInitial: "C",
2298
2293
  textValue: "8",
2299
2294
  rowNumber: 11,
2300
- rank: 23,
2295
+ rank: 24,
2301
2296
  },
2302
2297
  },
2303
2298
  elements: {
@@ -2328,6 +2323,33 @@ const ViewerAnonymous = () => {
2328
2323
  };
2329
2324
  return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, props));
2330
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
+ };
2331
2353
  const HideViewer = () => {
2332
2354
  const props = {
2333
2355
  states: {
@@ -2425,6 +2447,7 @@ const Leaderboard = /*#__PURE__*/Object.freeze({
2425
2447
  TenWithRank: TenWithRank,
2426
2448
  ViewerOutside: ViewerOutside,
2427
2449
  ViewerAnonymous: ViewerAnonymous,
2450
+ HideNamesWithViewerOutside: HideNamesWithViewerOutside,
2428
2451
  HideViewer: HideViewer,
2429
2452
  HideNames: HideNames,
2430
2453
  LeaderboardWithNoNamesAndGraphic: LeaderboardWithNoNamesAndGraphic
@@ -11646,6 +11669,18 @@ const SpaceEvenly = () => {
11646
11669
  index.h("p", null, "Points Balance")))),
11647
11670
  index.h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
11648
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
+ };
11649
11684
  const Start$1 = () => {
11650
11685
  return (index.h("div", { style: { width: "1000px", border: "1px dashed grey" } },
11651
11686
  index.h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "start" },
@@ -11709,6 +11744,7 @@ const PortalContainer = /*#__PURE__*/Object.freeze({
11709
11744
  SpaceBetween: SpaceBetween,
11710
11745
  SpaceAround: SpaceAround,
11711
11746
  SpaceEvenly: SpaceEvenly,
11747
+ ResponsiveBox: ResponsiveBox,
11712
11748
  Start: Start$1,
11713
11749
  Center: Center,
11714
11750
  End: End,
@@ -5,7 +5,6 @@ export function ImageView(props) {
5
5
  const style = {
6
6
  Container: {
7
7
  display: "flex",
8
- // width: props.width || "100%",
9
8
  width: "100%",
10
9
  justifyContent: props.alignment || "center",
11
10
  background: props.backgroundColor || "",
@@ -156,6 +156,7 @@ const defaultStyles = {
156
156
  statsheading: "Referrals",
157
157
  rankheading: "Rank",
158
158
  anonymousUser: "Anonymous User",
159
+ viewingUserText: "You",
159
160
  rankSuffix: "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}",
160
161
  };
161
162
  const link = h("a", null, "Support");
@@ -163,12 +164,6 @@ const tag = "Contact" + link + "about upgrading your plan";
163
164
  const defaultElements = {
164
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" })),
165
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" })),
166
- loadingstate: (h("slot", { name: "loading" },
167
- h("table", null, [...Array(10)].map(() => {
168
- return (h("tr", null,
169
- h("td", null,
170
- h("sl-skeleton", null))));
171
- })))),
172
167
  };
173
168
  export const Empty = () => {
174
169
  const props = {
@@ -484,7 +479,7 @@ export const ViewerOutside = () => {
484
479
  lastInitial: "C",
485
480
  textValue: "8",
486
481
  rowNumber: 11,
487
- rank: 23,
482
+ rank: 24,
488
483
  },
489
484
  },
490
485
  elements: {
@@ -515,6 +510,33 @@ export const ViewerAnonymous = () => {
515
510
  };
516
511
  return h(LeaderboardView, Object.assign({}, props));
517
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
+ };
518
540
  export const HideViewer = () => {
519
541
  const props = {
520
542
  states: {
@@ -22,9 +22,10 @@ const style = {
22
22
  fontWeight: "var(--sl-font-weight-normal)",
23
23
  },
24
24
  "& .ellipses": {
25
- textAlign: "center",
25
+ textAlign: "left",
26
26
  padding: "0",
27
27
  color: "var(--sl-color-neutral-500)",
28
+ paddingLeft: "25%",
28
29
  },
29
30
  "& .highlight": {
30
31
  background: "var(--sl-color-primary-50)",
@@ -40,6 +41,9 @@ const style = {
40
41
  width: "auto",
41
42
  whiteSpace: "nowrap",
42
43
  },
44
+ "& .Rank": {
45
+ whiteSpace: "nowrap",
46
+ },
43
47
  "& .fullWidth": {
44
48
  width: "100%",
45
49
  },
@@ -53,22 +57,49 @@ const vanillaStyle = `
53
57
  }
54
58
  `;
55
59
  export function LeaderboardView(props) {
56
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
60
+ var _a, _b, _c;
57
61
  const { states, data, elements } = props;
58
62
  const { styles } = states;
59
63
  if (states.loading)
60
- return (h("div", { class: sheet.classes.Leaderboard },
64
+ return (h("div", { class: sheet.classes.Leaderboard, style: { width: styles.width || "100%" } },
61
65
  h("style", { type: "text/css" },
62
66
  styleString,
63
67
  vanillaStyle),
64
- elements.loadingstate));
68
+ h("table", null, [...Array(10)].map(() => {
69
+ return (h("tr", null,
70
+ h("td", null,
71
+ h("sl-skeleton", null))));
72
+ }))));
65
73
  if (states.isEssentials)
66
74
  return elements.essentials;
67
75
  if (!states.hasLeaders)
68
76
  return elements.empty;
69
77
  let userSeenFlag = false;
70
- console.log("The rank is: ", (_a = data.viewerRank) === null || _a === void 0 ? void 0 : _a.rank);
71
- console.log("The rank suffix is: ", styles.width);
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 = "";
72
103
  return (h("div", { class: sheet.classes.Leaderboard, part: "sqm-base", style: { width: styles.width || "100%" } },
73
104
  h("style", { type: "text/css" },
74
105
  styleString,
@@ -77,36 +108,22 @@ export function LeaderboardView(props) {
77
108
  h("tr", null,
78
109
  styles.showRank && (h("th", { class: `Rank ${styles.hideNames ? "fullWidth" : ""}` }, styles.rankheading)),
79
110
  !styles.hideNames && h("th", { class: "User" }, styles.usersheading),
80
- h("th", { class: "Score" }, styles.statsheading)), (_b = data.leaderboard) === null || _b === void 0 ? void 0 :
81
- _b.map((user) => {
111
+ h("th", { class: "Score" }, styles.statsheading)), (_a = data.leaderboard) === null || _a === void 0 ? void 0 :
112
+ _a.map((user) => {
82
113
  var _a, _b;
83
114
  if (user.rowNumber === ((_a = data.viewerRank) === null || _a === void 0 ? void 0 : _a.rowNumber))
84
115
  userSeenFlag = true;
85
- return (h("tr", { class: !styles.hideViewer &&
86
- user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber)
87
- ? "highlight"
88
- : "" },
89
- styles.showRank && (h("td", { class: "Rank" }, intl.formatMessage({
90
- id: "rank",
91
- defaultMessage: styles.rankSuffix,
92
- }, { rank: user.rank }))),
93
- !styles.hideNames && (h("td", { class: "User" }, user.firstName && user.lastInitial
94
- ? user.firstName + " " + user.lastInitial
95
- : user.firstName || user.lastInitial
96
- ? user.firstName || user.lastInitial
97
- : 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)),
98
120
  h("td", { class: "Score" }, user.textValue)));
99
121
  }),
100
122
  !userSeenFlag && !styles.hideViewer && (h("tr", null,
101
123
  h("td", { colSpan: 100, class: "ellipses" },
102
124
  h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
103
125
  !userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
104
- styles.showRank && (h("td", { class: "Rank" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.rank) || "-")),
105
- !styles.hideNames && (h("td", { class: "User" }, ((_d = data.viewerRank) === null || _d === void 0 ? void 0 : _d.firstName) && ((_e = data.viewerRank) === null || _e === void 0 ? void 0 : _e.lastInitial)
106
- ? ((_f = data.viewerRank) === null || _f === void 0 ? void 0 : _f.firstName) +
107
- " " + ((_g = data.viewerRank) === null || _g === void 0 ? void 0 : _g.lastInitial)
108
- : ((_h = data.viewerRank) === null || _h === void 0 ? void 0 : _h.firstName) || ((_j = data.viewerRank) === null || _j === void 0 ? void 0 : _j.lastInitial)
109
- ? ((_k = data.viewerRank) === null || _k === void 0 ? void 0 : _k.firstName) || ((_l = data.viewerRank) === null || _l === void 0 ? void 0 : _l.lastInitial)
110
- : styles.anonymousUser)),
111
- h("td", { class: "Score" }, ((_m = data.viewerRank) === null || _m === void 0 ? void 0 : _m.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"))))));
112
129
  }
@@ -9,25 +9,21 @@ import { useLeaderboard } from "./useLeaderboard";
9
9
  * @uiName Leaderboard
10
10
  * @slots [{"name":"empty", "title":"Empty State"}]
11
11
  * @requiredFeatures ["LEADERBOARDS"]
12
- * @validParents ["div"]
13
12
  * @exampleGroup Leaderboard
14
- * @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>
15
- * @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>
16
- * @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
- * @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" imageUrl="https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png"></sqm-image><h2 style="margin: auto;">Top Performers</h2><p style="margin: 0;">The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!</p></div><sqm-leaderboard width="300px" usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true" hide-names="true" hide-viewer="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard"></sqm-empty></sqm-leaderboard></div>
18
- * @example Test - <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>
13
+ * @example Referral Started Leaderboard - <sqm-leaderboard usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
14
+ * @example Referral Converted Leaderboard - <sqm-leaderboard usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topConvertedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
15
+ * @example Points Earned Leaderboard - <sqm-leaderboard usersheading="Name" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Points" rank-type="rank" leaderboard-type="topPointEarners" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
16
+ * @example Anonymous Leaderboard - <div style="display: flex; align-items: flex-start; justify-content: center; width: 100%; gap: 50px;"><div style="display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; max-width: 30%;"><sqm-image width="70%" alignment="center" image-url="https://res.cloudinary.com/saasquatch-staging/image/upload/v1729728469/Leaderboard_image_z87lsm.png"></sqm-image><h2 style="margin: auto;">Top Performers</h2><p style="margin: 0; text-align: center;">The leaderboard highlights the top performers in real-time. Stay motivated, stay competitive!</p></div><sqm-leaderboard width="300px" usersheading="Referrer" rank-suffix="{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true" hide-names="true" hide-viewer="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard"></sqm-empty></sqm-leaderboard></div>
19
17
  * @featureTooltip <div>Motivate your participants by gamifying your program. Contact <a href="mailto:saasquatch-support%40impact.com?subject=Next steps for Leaderboards feature&body=Hi Support Team, %0D%0A%0D%0A I am interested in learning more about how Leaderboards can support the growth of our referral program. Please connect me with a program strategy manager to discuss this feature further, and determine the next steps.%0D%0A%0D%0A%0D%0AThank you,%0D%0A[Add your name here]">Support</a> to upgrade your plan and add a leaderboard.</div>
20
18
  */
21
19
  export class Leaderboard {
22
20
  constructor() {
23
21
  /**
24
- * @uiName Place text
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
25
  */
26
26
  this.width = "100%";
27
- /**
28
- * @uiName Rank Suffix
29
- */
30
- this.rankSuffix = "{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}";
31
27
  /**
32
28
  * Hide the viewer's leaderboard row if not in the top results.
33
29
  *
@@ -35,6 +31,10 @@ export class Leaderboard {
35
31
  * @default
36
32
  */
37
33
  this.hideViewer = false;
34
+ /**
35
+ * @uiName Viewing user text
36
+ */
37
+ this.viewingUserText = "You";
38
38
  /**
39
39
  * Hide the Names of users to protect personal identifiable information
40
40
  *
@@ -69,7 +69,6 @@ export class Leaderboard {
69
69
  const props = {
70
70
  empty: h(EmptySlot, null),
71
71
  essentials: h(EssentialsSlot, null),
72
- loadingstate: h(LoadingSlot, null),
73
72
  usersheading: this.usersheading,
74
73
  statsheading: this.statsheading,
75
74
  rankheading: this.rankheading,
@@ -80,6 +79,7 @@ export class Leaderboard {
80
79
  anonymousUser: this.anonymousUser,
81
80
  interval: this.interval,
82
81
  hideViewer: this.hideViewer,
82
+ viewingUserText: this.viewingUserText,
83
83
  hideNames: this.hideNames,
84
84
  showRank: this.showRank,
85
85
  isEssentials: this.isEssentials,
@@ -210,10 +210,10 @@ export class Leaderboard {
210
210
  "optional": false,
211
211
  "docs": {
212
212
  "tags": [{
213
- "text": "Place text",
213
+ "text": "Width",
214
214
  "name": "uiName"
215
215
  }],
216
- "text": ""
216
+ "text": "Restrict the width of the leaderboard (Can be a pixel value or a percentage i.e. \"500px\", \"33%\", etc.)"
217
217
  },
218
218
  "attribute": "width",
219
219
  "reflect": false,
@@ -234,11 +234,10 @@ export class Leaderboard {
234
234
  "text": "Rank Suffix",
235
235
  "name": "uiName"
236
236
  }],
237
- "text": ""
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
238
  },
239
239
  "attribute": "rank-suffix",
240
- "reflect": false,
241
- "defaultValue": "\"{rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}\""
240
+ "reflect": false
242
241
  },
243
242
  "hideViewer": {
244
243
  "type": "boolean",
@@ -264,6 +263,27 @@ export class Leaderboard {
264
263
  "reflect": false,
265
264
  "defaultValue": "false"
266
265
  },
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
+ },
267
287
  "hideNames": {
268
288
  "type": "boolean",
269
289
  "mutable": false,
@@ -446,7 +466,7 @@ export class Leaderboard {
446
466
  "mutable": false,
447
467
  "complexType": {
448
468
  "original": "DemoData<LeaderboardViewProps>",
449
- "resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean; hideNames?: boolean; anonymousUser?: string; rankSuffix?: string; width?: string; }; }; data?: { rankType: string; leaderboard: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }[]; viewerRank?: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }; }; elements?: { empty: VNode; essentials: VNode; loadingstate: VNode; }; }",
469
+ "resolved": "{ states?: { loading: boolean; hasLeaders: boolean; isEssentials?: boolean; styles: { usersheading: string; statsheading: string; rankheading?: string; showRank?: boolean; hideViewer?: boolean; viewingUserText?: string; hideNames?: boolean; anonymousUser?: string; rankSuffix?: string; width?: string; }; }; data?: { rankType: string; leaderboard: { textValue: string; rank: number; firstName: string; lastInitial: string; rowNumber: number; }[]; viewerRank?: { textValue: string; rank: number; firstName?: string; lastInitial?: string; rowNumber: number; }; }; elements?: { empty: VNode; essentials: VNode; }; }",
450
470
  "references": {
451
471
  "DemoData": {
452
472
  "location": "import",
@@ -484,14 +504,6 @@ function EssentialsSlot() {
484
504
  return (h("slot", { name: "essentials" },
485
505
  h("sqm-empty", { "empty-state-image": "https://res.cloudinary.com/saasquatch/image/upload/v1715360191/squatch-assets/Leaderboard_Not_Available.svg", "empty-state-header": "Leaderboards aren\u2019t available on your plan", "empty-state-text": "Contact {supportText} to upgrade your plan and start leveraging gamification in your program.", "support-text": "Support", "missing-feature": "Leaderboards" })));
486
506
  }
487
- function LoadingSlot() {
488
- return (h("slot", { name: "loading" },
489
- h("table", null, [...Array(10)].map(() => {
490
- return (h("tr", null,
491
- h("td", null,
492
- h("sl-skeleton", null))));
493
- }))));
494
- }
495
507
  function useLeaderboardDemo(props) {
496
508
  var _a, _b;
497
509
  const data = ((_b = (_a = props.demoData) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.leaderboard) || [
@@ -547,6 +559,7 @@ function useLeaderboardDemo(props) {
547
559
  : "Anonymous User",
548
560
  showRank: props.showRank,
549
561
  hideViewer: props.hideViewer,
562
+ viewingUserText: props.viewingUserText,
550
563
  hideNames: props.hideNames,
551
564
  rankSuffix: props.rankSuffix,
552
565
  width: props.width,
@@ -559,7 +572,6 @@ function useLeaderboardDemo(props) {
559
572
  elements: {
560
573
  empty: h(EmptySlot, null),
561
574
  essentials: h(EssentialsSlot, null),
562
- loadingstate: h(LoadingSlot, null),
563
575
  },
564
576
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
565
577
  }
@@ -152,7 +152,6 @@ export function useLeaderboard(props) {
152
152
  elements: {
153
153
  empty: props.empty,
154
154
  essentials: props.essentials,
155
- loadingstate: props.loadingstate,
156
155
  },
157
156
  };
158
157
  }
@@ -81,6 +81,18 @@ export const SpaceEvenly = () => {
81
81
  h("p", null, "Points Balance")))),
82
82
  h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
83
83
  };
84
+ export const ResponsiveBox = () => {
85
+ return (h("div", { style: { width: "100%", maxWidth: "1000px", border: "1px dashed grey" } },
86
+ h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "space-between", "flex-wrap": "nowrap" },
87
+ h("sqm-stat-container", { space: "xxx-large", display: "flex" },
88
+ h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardsRedeemed/CREDIT/global" },
89
+ h("sqm-text", null,
90
+ h("p", null, "Rewards Redeemed"))),
91
+ h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardBalance/CREDIT/POINT/value/global" },
92
+ h("sqm-text", null,
93
+ h("p", null, "Points Balance")))),
94
+ h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
95
+ };
84
96
  export const Start = () => {
85
97
  return (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
86
98
  h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "start" },
@@ -5,7 +5,7 @@ export function PortalContainerView(props, children) {
5
5
  Container: {
6
6
  boxSizing: "border-box",
7
7
  display: props.display || "grid",
8
- flexWrap: "wrap",
8
+ flexWrap: props.flexWrap || "wrap",
9
9
  "grid-template-columns": props.direction === "row"
10
10
  ? `repeat(auto-fill, minmax(${props.minWidth}, auto))`
11
11
  : "100%",
@@ -37,6 +37,13 @@ export class PortalContainer {
37
37
  * @uiName Maximum width
38
38
  */
39
39
  this.maxWidth = "100%";
40
+ /**
41
+ * @uiName Flex wrap behavior
42
+ * @uiType string
43
+ * @uiEnum ["wrap", "nowrap"]
44
+ * @uiEnumNames ["Wrap", "No Wrap"]
45
+ */
46
+ this.flexWrap = "wrap";
40
47
  /**
41
48
  * @uiName Background color
42
49
  * @uiWidget color
@@ -253,6 +260,36 @@ export class PortalContainer {
253
260
  "reflect": false,
254
261
  "defaultValue": "\"100%\""
255
262
  },
263
+ "flexWrap": {
264
+ "type": "string",
265
+ "mutable": false,
266
+ "complexType": {
267
+ "original": "string",
268
+ "resolved": "string",
269
+ "references": {}
270
+ },
271
+ "required": false,
272
+ "optional": true,
273
+ "docs": {
274
+ "tags": [{
275
+ "text": "Flex wrap behavior",
276
+ "name": "uiName"
277
+ }, {
278
+ "text": "string",
279
+ "name": "uiType"
280
+ }, {
281
+ "text": "[\"wrap\", \"nowrap\"]",
282
+ "name": "uiEnum"
283
+ }, {
284
+ "text": "[\"Wrap\", \"No Wrap\"]",
285
+ "name": "uiEnumNames"
286
+ }],
287
+ "text": ""
288
+ },
289
+ "attribute": "flex-wrap",
290
+ "reflect": false,
291
+ "defaultValue": "\"wrap\""
292
+ },
256
293
  "center": {
257
294
  "type": "boolean",
258
295
  "mutable": false,
@@ -116,7 +116,8 @@ const style = {
116
116
  background: "var(--sl-color-gray-200)",
117
117
  },
118
118
  LargeSkeleton: {
119
- width: "320px",
119
+ width: "100%",
120
+ maxWidth: "320px",
120
121
  height: "40px",
121
122
  borderRadius: "50px",
122
123
  background: "var(--sl-color-gray-200)",