@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.
Files changed (74) hide show
  1. package/dist/cjs/{ShadowViewAddon-721bb748.js → ShadowViewAddon-b2621f27.js} +50 -27
  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 +69 -14
  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 +138 -14
  9. package/dist/collection/components/sqm-empty/EmptyState.stories.js +1 -1
  10. package/dist/collection/components/sqm-image/sqm-image-view.js +1 -1
  11. package/dist/collection/components/sqm-image/sqm-image.js +20 -0
  12. package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +116 -9
  13. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +51 -26
  14. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +118 -16
  15. package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +40 -3
  16. package/dist/collection/components/sqm-portal-container/PortalContainer.stories.js +12 -0
  17. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +1 -1
  18. package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +37 -0
  19. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +2 -1
  20. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +55 -32
  21. package/dist/esm/{ShadowViewAddon-31eb5b16.js → ShadowViewAddon-04640297.js} +50 -27
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/mint-components.js +1 -1
  24. package/dist/esm/sqm-banking-info-form_16.entry.js +57 -33
  25. package/dist/esm/sqm-big-stat_38.entry.js +69 -14
  26. package/dist/esm/sqm-empty_4.entry.js +8 -1
  27. package/dist/esm/{sqm-portal-container-view-ab89c6cc.js → sqm-portal-container-view-6c582684.js} +1 -1
  28. package/dist/esm/sqm-stencilbook.entry.js +138 -14
  29. package/dist/esm-es5/ShadowViewAddon-04640297.js +1 -0
  30. package/dist/esm-es5/loader.js +1 -1
  31. package/dist/esm-es5/mint-components.js +1 -1
  32. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  33. package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
  34. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  35. package/dist/esm-es5/sqm-portal-container-view-6c582684.js +1 -0
  36. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  37. package/dist/mint-components/mint-components.esm.js +1 -1
  38. package/dist/mint-components/p-1c0be73e.entry.js +223 -0
  39. package/dist/mint-components/p-293b71ba.system.entry.js +1 -0
  40. package/dist/mint-components/{p-b45ba369.entry.js → p-31e810e9.entry.js} +2 -2
  41. package/dist/mint-components/{p-bf723ae9.entry.js → p-59d740b3.entry.js} +2 -2
  42. package/dist/mint-components/p-5de21018.system.entry.js +1 -0
  43. package/dist/mint-components/p-65d430d4.system.entry.js +1 -0
  44. package/dist/mint-components/p-9f0629ba.system.entry.js +1 -0
  45. package/dist/mint-components/{p-e704842c.js → p-c7fd9e16.js} +1 -1
  46. package/dist/mint-components/{p-d6474614.js → p-d3348267.js} +20 -20
  47. package/dist/mint-components/p-d8d2de11.entry.js +1 -0
  48. package/dist/mint-components/p-dbc2167e.system.js +1 -0
  49. package/dist/mint-components/p-ed17e637.system.js +1 -1
  50. package/dist/mint-components/p-ed6ebd60.system.js +1 -0
  51. package/dist/types/components/sqm-image/sqm-image-view.d.ts +1 -0
  52. package/dist/types/components/sqm-image/sqm-image.d.ts +5 -0
  53. package/dist/types/components/sqm-leaderboard/Leaderboard.stories.d.ts +4 -0
  54. package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +6 -3
  55. package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +28 -4
  56. package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +4 -1
  57. package/dist/types/components/sqm-portal-container/PortalContainer.stories.d.ts +1 -0
  58. package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +1 -0
  59. package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +7 -0
  60. package/dist/types/components.d.ts +66 -2
  61. package/docs/docs.docx +0 -0
  62. package/docs/raisins.json +1 -1
  63. package/grapesjs/grapesjs.js +1 -1
  64. package/package.json +2 -2
  65. package/dist/esm-es5/ShadowViewAddon-31eb5b16.js +0 -1
  66. package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +0 -1
  67. package/dist/mint-components/p-0d39c815.system.entry.js +0 -1
  68. package/dist/mint-components/p-1fe65a36.entry.js +0 -1
  69. package/dist/mint-components/p-27bd5535.entry.js +0 -187
  70. package/dist/mint-components/p-34fd1229.system.entry.js +0 -1
  71. package/dist/mint-components/p-922578e4.system.js +0 -1
  72. package/dist/mint-components/p-b567780d.system.js +0 -1
  73. package/dist/mint-components/p-c34a507e.system.entry.js +0 -1
  74. package/dist/mint-components/p-f1a1e7f3.system.entry.js +0 -1
@@ -10,13 +10,20 @@ import { useLeaderboard } from "./useLeaderboard";
10
10
  * @slots [{"name":"empty", "title":"Empty State"}]
11
11
  * @requiredFeatures ["LEADERBOARDS"]
12
12
  * @exampleGroup Leaderboard
13
- * @example Referral Started Leaderboard - <sqm-leaderboard usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topStartedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
14
- * @example Referral Converted Leaderboard - <sqm-leaderboard usersheading="Referrer" statsheading="Referrals" rank-type="rank" leaderboard-type="topConvertedReferrers" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
15
- * @example Points Earned Leaderboard - <sqm-leaderboard usersheading="Name" statsheading="Points" rank-type="rank" leaderboard-type="topPointEarners" rankheading="Rank" show-rank="true"><sqm-empty empty-state-image="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png" empty-state-header="View your rank in the leaderboard" empty-state-text="Be the first to refer a friend and reach the top of the leaderboard" ></sqm-empty></sqm-leaderboard>
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>
16
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>
17
18
  */
18
19
  export class Leaderboard {
19
20
  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%";
20
27
  /**
21
28
  * Hide the viewer's leaderboard row if not in the top results.
22
29
  *
@@ -24,10 +31,21 @@ export class Leaderboard {
24
31
  * @default
25
32
  */
26
33
  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;
27
45
  /**
28
46
  * Hides the leaderboard if user is on Essentials plan
29
47
  *
30
- * @uiName Hide viewing user
48
+ * @uiName Hide leaderboard for essentials user
31
49
  * @default
32
50
  */
33
51
  this.isEssentials = false;
@@ -51,7 +69,6 @@ export class Leaderboard {
51
69
  const props = {
52
70
  empty: h(EmptySlot, null),
53
71
  essentials: h(EssentialsSlot, null),
54
- loadingstate: h(LoadingSlot, null),
55
72
  usersheading: this.usersheading,
56
73
  statsheading: this.statsheading,
57
74
  rankheading: this.rankheading,
@@ -62,8 +79,12 @@ export class Leaderboard {
62
79
  anonymousUser: this.anonymousUser,
63
80
  interval: this.interval,
64
81
  hideViewer: this.hideViewer,
82
+ viewingUserText: this.viewingUserText,
83
+ hideNames: this.hideNames,
65
84
  showRank: this.showRank,
66
85
  isEssentials: this.isEssentials,
86
+ rankSuffix: this.rankSuffix,
87
+ width: this.width,
67
88
  };
68
89
  const demoProps = { ...props, demoData: this.demoData };
69
90
  const viewprops = isDemo()
@@ -177,6 +198,47 @@ export class Leaderboard {
177
198
  "attribute": "show-rank",
178
199
  "reflect": false
179
200
  },
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
+ },
180
242
  "hideViewer": {
181
243
  "type": "boolean",
182
244
  "mutable": false,
@@ -201,6 +263,51 @@ export class Leaderboard {
201
263
  "reflect": false,
202
264
  "defaultValue": "false"
203
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
+ },
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
+ },
204
311
  "isEssentials": {
205
312
  "type": "boolean",
206
313
  "mutable": false,
@@ -213,7 +320,7 @@ export class Leaderboard {
213
320
  "optional": true,
214
321
  "docs": {
215
322
  "tags": [{
216
- "text": "Hide viewing user",
323
+ "text": "Hide leaderboard for essentials user",
217
324
  "name": "uiName"
218
325
  }, {
219
326
  "text": undefined,
@@ -359,7 +466,7 @@ export class Leaderboard {
359
466
  "mutable": false,
360
467
  "complexType": {
361
468
  "original": "DemoData<LeaderboardViewProps>",
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; }; }",
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; }; }",
363
470
  "references": {
364
471
  "DemoData": {
365
472
  "location": "import",
@@ -397,14 +504,6 @@ function EssentialsSlot() {
397
504
  return (h("slot", { name: "essentials" },
398
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" })));
399
506
  }
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
- }
408
507
  function useLeaderboardDemo(props) {
409
508
  var _a, _b;
410
509
  const data = ((_b = (_a = props.demoData) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.leaderboard) || [
@@ -460,6 +559,10 @@ function useLeaderboardDemo(props) {
460
559
  : "Anonymous User",
461
560
  showRank: props.showRank,
462
561
  hideViewer: props.hideViewer,
562
+ viewingUserText: props.viewingUserText,
563
+ hideNames: props.hideNames,
564
+ rankSuffix: props.rankSuffix,
565
+ width: props.width,
463
566
  },
464
567
  },
465
568
  data: {
@@ -469,7 +572,6 @@ function useLeaderboardDemo(props) {
469
572
  elements: {
470
573
  empty: h(EmptySlot, null),
471
574
  essentials: h(EssentialsSlot, null),
472
- loadingstate: h(LoadingSlot, null),
473
575
  },
474
576
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
475
577
  }
@@ -23,6 +23,26 @@ 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
+ `;
26
46
  const GET_RANK = gql `
27
47
  query (
28
48
  $type: String!
@@ -43,6 +63,24 @@ const GET_RANK = gql `
43
63
  }
44
64
  }
45
65
  `;
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
+ `;
46
84
  export function useLeaderboard(props) {
47
85
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48
86
  const programIdContext = useProgramId();
@@ -68,8 +106,8 @@ export function useLeaderboard(props) {
68
106
  if (props.maxRows > 0) {
69
107
  variables["limit"] = props.maxRows;
70
108
  }
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));
109
+ const { data: leaderboardData, loading: loadingLeaderboard, errors: leaderboardErrors, } = useQuery(props.hideNames ? GET_LEADERBOARD_WITHOUT_NAMES : GET_LEADERBOARD, variables, !(user === null || user === void 0 ? void 0 : user.jwt), { batch: false });
110
+ const { data: rankData } = useQuery(props.hideNames ? GET_RANK_WITHOUT_NAMES : GET_RANK, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
73
111
  const leaderboardRows = (_b = leaderboardData === null || leaderboardData === void 0 ? void 0 : leaderboardData.userLeaderboard) === null || _b === void 0 ? void 0 : _b.rows;
74
112
  const flattenedLeaderboard = getFlattenedLeaderboard(leaderboardRows);
75
113
  const sortedLeaderboard = flattenedLeaderboard === null || flattenedLeaderboard === void 0 ? void 0 : flattenedLeaderboard.sort(function (a, b) {
@@ -114,7 +152,6 @@ export function useLeaderboard(props) {
114
152
  elements: {
115
153
  empty: props.empty,
116
154
  essentials: props.essentials,
117
- loadingstate: props.loadingstate,
118
155
  },
119
156
  };
120
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)",
@@ -83,6 +83,27 @@ const style = {
83
83
  color: "var(--sl-color-neutral-500)",
84
84
  fontSize: "var(--sl-font-size-medium)",
85
85
  },
86
+ PhoneInputsSection: {
87
+ display: "flex",
88
+ alignItems: "flex-start",
89
+ flexDirection: "column",
90
+ gap: "4px",
91
+ "& p": {
92
+ fontSize: "var(--sl-font-size-small)",
93
+ color: "var(--sl-input-label-color)",
94
+ fontWeight: "var(--sl-font-weight-semibold)",
95
+ },
96
+ },
97
+ PhoneInputsContainer: {
98
+ display: "flex",
99
+ alignItems: "flex-start",
100
+ gap: "4px",
101
+ width: "100%",
102
+ "& #phoneNumber": {
103
+ width: "100%",
104
+ minWidth: "0px",
105
+ },
106
+ },
86
107
  };
87
108
  const sheet = createStyleSheet(style);
88
109
  const styleString = sheet.toString();
@@ -108,7 +129,7 @@ const vanillaStyle = `
108
129
  }
109
130
 
110
131
  sl-select#phoneNumberCountryCode::part(menu) {
111
- width: 450px;
132
+ min-width: 250px;
112
133
  }
113
134
  `;
114
135
  export const UserInfoFormView = (props) => {
@@ -191,37 +212,39 @@ export const UserInfoFormView = (props) => {
191
212
  } }), (_e = data === null || data === void 0 ? void 0 : data.countries) === null || _e === void 0 ? void 0 :
192
213
  _e.map((c) => (h("sl-menu-item", { value: c.countryCode }, c.displayName))), (_f = data === null || data === void 0 ? void 0 : data.allCountries) === null || _f === void 0 ? void 0 :
193
214
  _f.map((c) => (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName)))),
194
- h("div", { style: { display: "flex", gap: "4px" } },
195
- h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", label: text.phoneNumber, style: { minWidth: "140px" }, value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
196
- class: classes.ErrorInput,
197
- }
198
- : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
199
- h("sl-input", { class: classes.SearchInput, placeholder: text.searchForCountryText, onKeyDown: (e) => {
200
- // Stop shoelace intercepting key presses
201
- e.stopPropagation();
202
- }, "onSl-input": (e) => {
203
- callbacks.setPhoneCountrySearch(e.target.value);
204
- } }), (_h = data === null || data === void 0 ? void 0 : data.phoneCountries) === null || _h === void 0 ? void 0 :
205
- _h.map((c) => {
206
- var _a, _b;
207
- return (h("sl-menu-item", { style: { width: "500px" }, value: c.countryCode },
208
- h("div", { slot: "prefix", style: { marginRight: "8px" } }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
209
- _b.dial_code));
210
- }), (_j = data === null || data === void 0 ? void 0 : data.allCountries) === null || _j === void 0 ? void 0 :
211
- _j.map((c) => {
212
- var _a, _b;
213
- return (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } },
214
- h("div", { slot: "prefix", style: { marginRight: "8px" } }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
215
- _b.dial_code));
216
- })),
217
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: " ", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber, style: { marginTop: "2px", width: "362px" }, validationError: ({ value }) =>
218
- // Naive phone number validation
219
- validateBillingField(/[a-zA-Z]+/, value) &&
220
- formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError), disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
221
- class: classes.ErrorInput,
222
- helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
223
- }
224
- : {}), { required: true }))),
215
+ h("div", { class: classes.PhoneInputsSection },
216
+ h("p", null, text.phoneNumber),
217
+ h("div", { class: classes.PhoneInputsContainer },
218
+ h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
219
+ class: classes.ErrorInput,
220
+ }
221
+ : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
222
+ h("sl-input", { class: classes.SearchInput, placeholder: text.searchForCountryText, onKeyDown: (e) => {
223
+ // Stop shoelace intercepting key presses
224
+ e.stopPropagation();
225
+ }, "onSl-input": (e) => {
226
+ callbacks.setPhoneCountrySearch(e.target.value);
227
+ } }), (_h = data === null || data === void 0 ? void 0 : data.phoneCountries) === null || _h === void 0 ? void 0 :
228
+ _h.map((c) => {
229
+ var _a, _b;
230
+ return (h("sl-menu-item", { value: c.countryCode },
231
+ h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
232
+ _b.dial_code));
233
+ }), (_j = data === null || data === void 0 ? void 0 : data.allCountries) === null || _j === void 0 ? void 0 :
234
+ _j.map((c) => {
235
+ var _a, _b;
236
+ return (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } },
237
+ h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
238
+ _b.dial_code));
239
+ })),
240
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber, validationError: ({ value }) =>
241
+ // Naive phone number validation
242
+ validateBillingField(/[a-zA-Z]+/, value) &&
243
+ formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError), disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
244
+ class: classes.ErrorInput,
245
+ helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
246
+ }
247
+ : {}), { required: true })))),
225
248
  h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
226
249
  // Checks for non-ASCII characters
227
250
  !validateBillingField(/^[\x20-\xFF]+$/, value) &&
@@ -11,7 +11,7 @@ import { l as luxonLocale } from './utils-334c1e34.js';
11
11
  import { T as TextSpanView } from './sqm-text-span-view-8d140661.js';
12
12
  import { p as pathToRegexp } from './index-ffa26b43.js';
13
13
  import { a as isValidColor, b as isMobile } from './utilities-3f5bba22.js';
14
- import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-ab89c6cc.js';
14
+ import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-6c582684.js';
15
15
 
16
16
  const medium = {
17
17
  facebook: { color: "#1877f2", text: "#fff", icon: "facebook" },
@@ -109,9 +109,10 @@ const style$1 = {
109
109
  fontWeight: "var(--sl-font-weight-normal)",
110
110
  },
111
111
  "& .ellipses": {
112
- textAlign: "center",
112
+ textAlign: "left",
113
113
  padding: "0",
114
114
  color: "var(--sl-color-neutral-500)",
115
+ paddingLeft: "25%",
115
116
  },
116
117
  "& .highlight": {
117
118
  background: "var(--sl-color-primary-50)",
@@ -127,6 +128,12 @@ const style$1 = {
127
128
  width: "auto",
128
129
  whiteSpace: "nowrap",
129
130
  },
131
+ "& .Rank": {
132
+ whiteSpace: "nowrap",
133
+ },
134
+ "& .fullWidth": {
135
+ width: "100%",
136
+ },
130
137
  },
131
138
  };
132
139
  const sheet$1 = createStyleSheet(style$1);
@@ -137,58 +144,74 @@ const vanillaStyle = `
137
144
  }
138
145
  `;
139
146
  function LeaderboardView(props) {
140
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
147
+ var _a, _b, _c;
141
148
  const { states, data, elements } = props;
142
149
  const { styles } = states;
143
150
  if (states.loading)
144
- return (h("div", { class: sheet$1.classes.Leaderboard },
151
+ return (h("div", { class: sheet$1.classes.Leaderboard, style: { width: styles.width || "100%" } },
145
152
  h("style", { type: "text/css" },
146
153
  styleString$1,
147
154
  vanillaStyle),
148
- elements.loadingstate));
155
+ h("table", null, [...Array(10)].map(() => {
156
+ return (h("tr", null,
157
+ h("td", null,
158
+ h("sl-skeleton", null))));
159
+ }))));
149
160
  if (states.isEssentials)
150
161
  return elements.essentials;
151
162
  if (!states.hasLeaders)
152
163
  return elements.empty;
153
164
  let userSeenFlag = false;
154
- return (h("div", { class: sheet$1.classes.Leaderboard, part: "sqm-base" },
165
+ const getUsersName = (user) => {
166
+ if (!user.firstName && !user.lastInitial)
167
+ return styles.anonymousUser;
168
+ const { firstName, lastInitial } = user;
169
+ if (firstName && lastInitial)
170
+ return `${firstName} ${lastInitial}`;
171
+ if (firstName || lastInitial)
172
+ return firstName || lastInitial;
173
+ return styles.anonymousUser;
174
+ };
175
+ const getRankCellText = (userRank, isViewingUsersRow) => {
176
+ if (!userRank) {
177
+ return styles.hideNames ? `${styles.viewingUserText}` : "-";
178
+ }
179
+ const viewingUserText = ` - ${styles.viewingUserText}`;
180
+ return styles.rankSuffix
181
+ ? intl.formatMessage({
182
+ id: "rank",
183
+ defaultMessage: styles.rankSuffix,
184
+ }, {
185
+ rank: userRank,
186
+ }) + `${isViewingUsersRow && styles.hideNames ? viewingUserText : ""}`
187
+ : `${userRank} ${isViewingUsersRow && styles.hideNames ? viewingUserText : ""}`;
188
+ };
189
+ return (h("div", { class: sheet$1.classes.Leaderboard, part: "sqm-base", style: { width: styles.width || "100%" } },
155
190
  h("style", { type: "text/css" },
156
191
  styleString$1,
157
192
  vanillaStyle),
158
- h("div", null, "Leaderboards"),
159
193
  h("table", { part: "sqm-table" },
160
194
  h("tr", null,
161
- styles.showRank && h("th", { class: "Rank" }, styles.rankheading),
162
- h("th", { class: "User" }, styles.usersheading),
195
+ styles.showRank && (h("th", { class: `Rank ${styles.hideNames ? "fullWidth" : ""}` }, styles.rankheading)),
196
+ !styles.hideNames && h("th", { class: "User" }, styles.usersheading),
163
197
  h("th", { class: "Score" }, styles.statsheading)), (_a = data.leaderboard) === null || _a === void 0 ? void 0 :
164
198
  _a.map((user) => {
165
199
  var _a, _b;
166
200
  if (user.rowNumber === ((_a = data.viewerRank) === null || _a === void 0 ? void 0 : _a.rowNumber))
167
201
  userSeenFlag = true;
168
- return (h("tr", { class: !styles.hideViewer &&
169
- user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber)
170
- ? "highlight"
171
- : "" },
172
- styles.showRank && h("td", { class: "Rank" }, user.rank),
173
- h("td", { class: "User" }, user.firstName && user.lastInitial
174
- ? user.firstName + " " + user.lastInitial
175
- : user.firstName || user.lastInitial
176
- ? user.firstName || user.lastInitial
177
- : styles.anonymousUser),
202
+ const isViewingUsersRow = !styles.hideViewer && user.rowNumber === ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rowNumber);
203
+ return (h("tr", { class: isViewingUsersRow ? "highlight" : "" },
204
+ styles.showRank && (h("td", { class: "Rank" }, getRankCellText(user.rank, isViewingUsersRow))),
205
+ !styles.hideNames && h("td", { class: "User" }, getUsersName(user)),
178
206
  h("td", { class: "Score" }, user.textValue)));
179
207
  }),
180
208
  !userSeenFlag && !styles.hideViewer && (h("tr", null,
181
209
  h("td", { colSpan: 100, class: "ellipses" },
182
210
  h("sl-icon", { name: "three-dots", style: { verticalAlign: "middle" } })))),
183
211
  !userSeenFlag && !styles.hideViewer && (h("tr", { class: "highlight" },
184
- styles.showRank && (h("td", { class: "Rank" }, ((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank) || "-")),
185
- 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)
186
- ? ((_e = data.viewerRank) === null || _e === void 0 ? void 0 : _e.firstName) +
187
- " " + ((_f = data.viewerRank) === null || _f === void 0 ? void 0 : _f.lastInitial)
188
- : ((_g = data.viewerRank) === null || _g === void 0 ? void 0 : _g.firstName) || ((_h = data.viewerRank) === null || _h === void 0 ? void 0 : _h.lastInitial)
189
- ? ((_j = data.viewerRank) === null || _j === void 0 ? void 0 : _j.firstName) || ((_k = data.viewerRank) === null || _k === void 0 ? void 0 : _k.lastInitial)
190
- : styles.anonymousUser),
191
- h("td", { class: "Score" }, ((_l = data.viewerRank) === null || _l === void 0 ? void 0 : _l.textValue) || "0"))))));
212
+ styles.showRank && (h("td", { class: "Rank" }, getRankCellText((_b = data.viewerRank) === null || _b === void 0 ? void 0 : _b.rank, true))),
213
+ !styles.hideNames && (h("td", { class: "User" }, getUsersName(data.viewerRank || {}))),
214
+ h("td", { class: "Score" }, ((_c = data.viewerRank) === null || _c === void 0 ? void 0 : _c.textValue) || "0"))))));
192
215
  }
193
216
 
194
217
  const style$2 = {