@saasquatch/mint-components 1.6.5-10 → 1.6.5-12

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 (66) hide show
  1. package/dist/cjs/{ShadowViewAddon-e4ae9353.js → ShadowViewAddon-52d34e08.js} +18 -4
  2. package/dist/cjs/sqm-big-stat_35.cjs.entry.js +62 -6
  3. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +2 -2
  4. package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +3 -9
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +6 -1
  6. package/dist/cjs/{useReferralTable-7abdeee1.js → useReferralTable-812f7288.js} +1 -9
  7. package/dist/collection/components/sqm-big-stat/sqm-big-stat.js +1 -1
  8. package/dist/collection/components/sqm-referral-table/sqm-referral-table.js +3 -6
  9. package/dist/collection/components/sqm-referral-table/useReferralTable.js +1 -9
  10. package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeListData.js +1 -0
  11. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +1 -1
  12. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +1 -0
  13. package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +15 -1
  14. package/dist/collection/components/sqm-rewards-table/sqm-rewards-table.js +3 -7
  15. package/dist/collection/components/sqm-rewards-table/useRewardsTable.js +1 -6
  16. package/dist/collection/components/sqm-share-code/sqm-share-code.js +16 -2
  17. package/dist/collection/components/sqm-share-code/useShareCode.js +15 -2
  18. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +3 -0
  19. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +1 -1
  20. package/dist/collection/components/sqm-share-link/sqm-share-link.js +16 -2
  21. package/dist/collection/components/sqm-share-link/useShareLink.js +15 -2
  22. package/dist/collection/stories/NewPortal.stories.js +2 -0
  23. package/dist/esm/{ShadowViewAddon-072029f9.js → ShadowViewAddon-b1d70829.js} +18 -4
  24. package/dist/esm/sqm-big-stat_35.entry.js +62 -6
  25. package/dist/esm/sqm-referral-table_11.entry.js +2 -2
  26. package/dist/esm/sqm-rewards-table_9.entry.js +3 -9
  27. package/dist/esm/sqm-stencilbook.entry.js +6 -1
  28. package/dist/esm/{useReferralTable-189c1f7a.js → useReferralTable-d8f625cc.js} +1 -9
  29. package/dist/esm-es5/ShadowViewAddon-b1d70829.js +1 -0
  30. package/dist/esm-es5/sqm-big-stat_35.entry.js +1 -1
  31. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  32. package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
  33. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  34. package/dist/esm-es5/useReferralTable-d8f625cc.js +1 -0
  35. package/dist/mint-components/mint-components.esm.js +1 -1
  36. package/dist/mint-components/p-07548bda.entry.js +99 -0
  37. package/dist/mint-components/p-10304467.entry.js +1 -0
  38. package/dist/mint-components/p-37c270fc.entry.js +9 -0
  39. package/dist/mint-components/{p-ea7a6e3e.system.entry.js → p-3c360049.system.entry.js} +1 -1
  40. package/dist/mint-components/{p-c983a42b.js → p-44938126.js} +3 -3
  41. package/dist/mint-components/p-9649b314.system.entry.js +1 -0
  42. package/dist/mint-components/{p-e1cf4a20.entry.js → p-9977bfb8.entry.js} +8 -8
  43. package/dist/mint-components/p-a61aa4bb.system.entry.js +1 -0
  44. package/dist/mint-components/p-a7e17c0f.system.js +1 -0
  45. package/dist/mint-components/p-b43a075f.system.js +1 -1
  46. package/dist/mint-components/{p-0f7ac7b8.js → p-b5c07438.js} +1 -9
  47. package/dist/mint-components/p-cef7926c.system.entry.js +1 -0
  48. package/dist/mint-components/p-eb66dec9.system.js +1 -0
  49. package/dist/types/components/sqm-referral-table/sqm-referral-table.d.ts +1 -5
  50. package/dist/types/components/sqm-reward-exchange-list/RewardExchangeListData.d.ts +19 -0
  51. package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +1 -0
  52. package/dist/types/components/sqm-rewards-table/sqm-rewards-table.d.ts +1 -5
  53. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +1 -0
  54. package/dist/types/components.d.ts +4 -12
  55. package/docs/docs.docx +0 -0
  56. package/package.json +1 -1
  57. package/dist/esm-es5/ShadowViewAddon-072029f9.js +0 -1
  58. package/dist/esm-es5/useReferralTable-189c1f7a.js +0 -1
  59. package/dist/mint-components/p-32e4c92a.system.js +0 -1
  60. package/dist/mint-components/p-3746854e.entry.js +0 -104
  61. package/dist/mint-components/p-43d17cb7.entry.js +0 -1
  62. package/dist/mint-components/p-4b722e77.system.entry.js +0 -1
  63. package/dist/mint-components/p-8a80f5f7.system.entry.js +0 -1
  64. package/dist/mint-components/p-96dc5a6b.entry.js +0 -9
  65. package/dist/mint-components/p-9bbdbe79.system.entry.js +0 -1
  66. package/dist/mint-components/p-a6c80189.system.js +0 -1
@@ -200,7 +200,7 @@ function ShareLinkView(props) {
200
200
  return (index.h("div", null,
201
201
  index.h("style", { type: "text/css" }, styleString$2),
202
202
  index.h("sl-tooltip", { trigger: "manual", content: props.tooltiptext, placement: "top-end", disabled: props.disabled, open: props.open, skidding: -20 },
203
- index.h("sl-input", { class: sheet$2.classes.inputStyle, exportparts: "label: input-label", value: props.shareString, readonly: true },
203
+ index.h("sl-input", { class: sheet$2.classes.inputStyle, exportparts: "label: input-label", value: props.shareString, ref: props.setInput, readonly: true },
204
204
  index.h("sl-icon-button", { onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, slot: "suffix", name: "files", disabled: props.disabled })))));
205
205
  }
206
206
 
@@ -365,10 +365,23 @@ function useShareLink(props) {
365
365
  // Shown during loading
366
366
  "...";
367
367
  const [open, setOpen] = stencilHooks_module.useState(false);
368
+ const [input, setInput] = stencilHooks_module.useState(undefined);
368
369
  function onClick() {
369
370
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
370
371
  // Only if called from a user-initiated event
371
- navigator.clipboard.writeText(shareString);
372
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
373
+ navigator.clipboard.writeText(shareString);
374
+ }
375
+ else {
376
+ input === null || input === void 0 ? void 0 : input.select();
377
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
378
+ try {
379
+ document.execCommand("copy");
380
+ }
381
+ catch (err) {
382
+ console.log("Error while copying to clipboard: " + err);
383
+ }
384
+ }
372
385
  setOpen(true);
373
386
  setTimeout(() => setOpen(false), props.tooltiplifespan);
374
387
  sendLoadEvent({
@@ -384,7 +397,7 @@ function useShareLink(props) {
384
397
  },
385
398
  });
386
399
  }
387
- return { ...props, onClick, open, shareString };
400
+ return { ...props, onClick, open, shareString, setInput };
388
401
  }
389
402
 
390
403
  const MessageLinkQuery$1 = index_module.dist.gql `
@@ -3250,7 +3263,7 @@ function RewardExchangeView(props) {
3250
3263
  })),
3251
3264
  (data === null || data === void 0 ? void 0 : data.fuelTankCode) && (index.h("div", { class: "promo" },
3252
3265
  states.content.text.promoCode,
3253
- index.h(ShareLinkView, { shareString: data.fuelTankCode, tooltiptext: (_f = states === null || states === void 0 ? void 0 : states.content) === null || _f === void 0 ? void 0 : _f.text.tooltipText, open: states.open, onClick: callbacks.copyFuelTankCode }))),
3266
+ index.h(ShareLinkView, { shareString: data.fuelTankCode, tooltiptext: (_f = states === null || states === void 0 ? void 0 : states.content) === null || _f === void 0 ? void 0 : _f.text.tooltipText, open: states.open, onClick: callbacks.copyFuelTankCode, setInput: callbacks.setInput }))),
3254
3267
  index.h("div", { class: sheet$d.classes.Button },
3255
3268
  index.h("sl-button", { class: "continue center", type: "primary", size: "large", onClick: () => callbacks.resetState(true) }, states.content.text.doneText))));
3256
3269
  }
@@ -3376,6 +3389,7 @@ const baseResponse = (data, stage = "chooseReward", selectedItem = null, selecte
3376
3389
  setStage: null,
3377
3390
  setExchangeState: null,
3378
3391
  copyFuelTankCode: null,
3392
+ setInput: null,
3379
3393
  refs: null,
3380
3394
  },
3381
3395
  refs: null,
@@ -18,7 +18,7 @@ const utils = require('./utils-6847bc06.js');
18
18
  require('./sqm-text-span-view-c34577fa.js');
19
19
  const AsYouType = require('./AsYouType-6788393a.js');
20
20
  const useRegistrationFormState = require('./useRegistrationFormState-8f2caf7f.js');
21
- const ShadowViewAddon = require('./ShadowViewAddon-e4ae9353.js');
21
+ const ShadowViewAddon = require('./ShadowViewAddon-52d34e08.js');
22
22
  require('./sqm-portal-container-view-5beae29c.js');
23
23
 
24
24
  const BigStat = class {
@@ -2776,6 +2776,7 @@ function useRewardExchangeList(props) {
2776
2776
  setExchangeState({ exchangeError: true });
2777
2777
  }
2778
2778
  }, [exchangeResponse, errors]);
2779
+ const [input, setInput] = stencilHooks_module.useState(undefined);
2779
2780
  const canvasRef = stencilHooks_module.useRef();
2780
2781
  stencilHooks_module.useEffect(() => {
2781
2782
  if (!canvasRef.current)
@@ -2863,7 +2864,19 @@ function useRewardExchangeList(props) {
2863
2864
  }
2864
2865
  function copyFuelTankCode() {
2865
2866
  var _a, _b;
2866
- navigator.clipboard.writeText((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.fuelTankCode);
2867
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
2868
+ navigator.clipboard.writeText((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.fuelTankCode);
2869
+ }
2870
+ else {
2871
+ input === null || input === void 0 ? void 0 : input.select();
2872
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
2873
+ try {
2874
+ document.execCommand("copy");
2875
+ }
2876
+ catch (err) {
2877
+ console.log("Error while copying to clipboard: " + err);
2878
+ }
2879
+ }
2867
2880
  setOpen(true);
2868
2881
  setTimeout(() => setOpen(false), 1000);
2869
2882
  }
@@ -2892,6 +2905,7 @@ function useRewardExchangeList(props) {
2892
2905
  setStage,
2893
2906
  resetState,
2894
2907
  copyFuelTankCode,
2908
+ setInput,
2895
2909
  },
2896
2910
  refs: {
2897
2911
  canvasRef,
@@ -3078,6 +3092,7 @@ function useRewardExchangeListDemo(props) {
3078
3092
  setStage: (_) => { },
3079
3093
  resetState: () => { },
3080
3094
  copyFuelTankCode: () => { },
3095
+ setInput: () => { },
3081
3096
  },
3082
3097
  refs: {
3083
3098
  canvasRef: {},
@@ -3354,10 +3369,23 @@ function useShareCode(props) {
3354
3369
  // Shown during loading
3355
3370
  "...";
3356
3371
  const [open, setOpen] = stencilHooks_module.useState(false);
3372
+ const [input, setInput] = stencilHooks_module.useState(undefined);
3357
3373
  function onClick() {
3358
3374
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
3359
3375
  // Only if called from a user-initiated event
3360
- navigator.clipboard.writeText(shareString);
3376
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
3377
+ navigator.clipboard.writeText(shareString);
3378
+ }
3379
+ else {
3380
+ input === null || input === void 0 ? void 0 : input.select();
3381
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
3382
+ try {
3383
+ document.execCommand("copy");
3384
+ }
3385
+ catch (err) {
3386
+ console.log("Error while copying to clipboard: " + err);
3387
+ }
3388
+ }
3361
3389
  setOpen(true);
3362
3390
  setTimeout(() => setOpen(false), props.tooltiplifespan);
3363
3391
  sendLoadEvent({
@@ -3373,7 +3401,7 @@ function useShareCode(props) {
3373
3401
  },
3374
3402
  });
3375
3403
  }
3376
- return { ...props, onClick, open, shareString };
3404
+ return { ...props, onClick, open, shareString, setInput };
3377
3405
  }
3378
3406
 
3379
3407
  const ShareCode = class {
@@ -3405,14 +3433,28 @@ const ShareCode = class {
3405
3433
  function useDemoShareCode(props) {
3406
3434
  const [open, setOpen] = stencilHooks_module.useState(false);
3407
3435
  const shareString = "SHARECODE001";
3436
+ const [input, setInput] = stencilHooks_module.useState(undefined);
3408
3437
  return cjs.cjs({
3409
3438
  shareString,
3410
3439
  tooltiptext: props.tooltiptext,
3411
3440
  open,
3441
+ setInput,
3412
3442
  onClick: () => {
3413
3443
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
3414
3444
  // Only if called from a user-initiated event
3415
- navigator.clipboard.writeText(shareString);
3445
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
3446
+ navigator.clipboard.writeText(shareString);
3447
+ }
3448
+ else {
3449
+ input === null || input === void 0 ? void 0 : input.select();
3450
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
3451
+ try {
3452
+ document.execCommand("copy");
3453
+ }
3454
+ catch (err) {
3455
+ console.log("Error while copying to clipboard: " + err);
3456
+ }
3457
+ }
3416
3458
  setOpen(true);
3417
3459
  setTimeout(() => setOpen(false), props.tooltiplifespan);
3418
3460
  },
@@ -3448,14 +3490,28 @@ const ShareLink = class {
3448
3490
  function useDemoShareLink(props) {
3449
3491
  const [open, setOpen] = stencilHooks_module.useState(false);
3450
3492
  const shareString = "https://www.example.com/sharelink/abc";
3493
+ const [input, setInput] = stencilHooks_module.useState(undefined);
3451
3494
  return cjs.cjs({
3452
3495
  shareString,
3453
3496
  tooltiptext: props.tooltiptext,
3454
3497
  open,
3498
+ setInput,
3455
3499
  onClick: () => {
3456
3500
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
3457
3501
  // Only if called from a user-initiated event
3458
- navigator.clipboard.writeText(shareString);
3502
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
3503
+ navigator.clipboard.writeText(shareString);
3504
+ }
3505
+ else {
3506
+ input === null || input === void 0 ? void 0 : input.select();
3507
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
3508
+ try {
3509
+ document.execCommand("copy");
3510
+ }
3511
+ catch (err) {
3512
+ console.log("Error while copying to clipboard: " + err);
3513
+ }
3514
+ }
3459
3515
  setOpen(true);
3460
3516
  setTimeout(() => setOpen(false), props.tooltiplifespan);
3461
3517
  },
@@ -14,7 +14,7 @@ const GenericTableView = require('./GenericTableView-9271483b.js');
14
14
  const reRender = require('./re-render-172958b1.js');
15
15
  const useChildElements = require('./useChildElements-6993ec39.js');
16
16
  const luxon = require('./luxon-479fc825.js');
17
- const useReferralTable = require('./useReferralTable-7abdeee1.js');
17
+ const useReferralTable = require('./useReferralTable-812f7288.js');
18
18
  const utils = require('./utils-6847bc06.js');
19
19
  const sqmTextSpanView = require('./sqm-text-span-view-c34577fa.js');
20
20
 
@@ -224,7 +224,7 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
224
224
  page: 0,
225
225
  });
226
226
  const tick = reRender.useRerenderListener();
227
- const mockData = stencilHooks_module.useMemo(() => { var _a; return ((_a = props.demoData) === null || _a === void 0 ? void 0 : _a.mockData) || mockReferralData(props.perPage); }, [props.perPage]);
227
+ const mockData = stencilHooks_module.useMemo(() => mockReferralData(props.perPage), [props.perPage]);
228
228
  const components = useChildElements.useChildElements();
229
229
  async function getComponentData(components) {
230
230
  var _a;
@@ -14,7 +14,7 @@ const GenericTableView = require('./GenericTableView-9271483b.js');
14
14
  const reRender = require('./re-render-172958b1.js');
15
15
  const useChildElements = require('./useChildElements-6993ec39.js');
16
16
  const luxon = require('./luxon-479fc825.js');
17
- const useReferralTable = require('./useReferralTable-7abdeee1.js');
17
+ const useReferralTable = require('./useReferralTable-812f7288.js');
18
18
  const utils = require('./utils-6847bc06.js');
19
19
 
20
20
  const mockRewardData = (count = 4) => {
@@ -136,12 +136,7 @@ const GET_REWARDS = index_module.dist.gql `
136
136
  count
137
137
  data {
138
138
  meta {
139
- status
140
- integration {
141
- name
142
- }
143
139
  message
144
- customMeta
145
140
  }
146
141
  id
147
142
  type
@@ -263,7 +258,7 @@ function useRewardsTable(props, emptyElement, loadingElement) {
263
258
  const columnsPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderLabel()));
264
259
  // get the column cells (renderCell is asynchronous)
265
260
  const cellsPromise = data === null || data === void 0 ? void 0 : data.map(async (r) => {
266
- const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale, index.h)));
261
+ const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale)));
267
262
  const cells = (await Promise.all(cellPromise));
268
263
  return cells;
269
264
  });
@@ -400,7 +395,7 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
400
395
  page: 0,
401
396
  });
402
397
  const tick = reRender.useRerenderListener();
403
- const { data } = stencilHooks_module.useMemo(() => { var _a; return ((_a = props.demoData) === null || _a === void 0 ? void 0 : _a.mockData) || mockRewardData(props.perPage); }, [props.perPage]);
398
+ const { data } = stencilHooks_module.useMemo(() => mockRewardData(props.perPage), [props.perPage]);
404
399
  const components = useChildElements.useChildElements();
405
400
  async function getComponentData(components) {
406
401
  let componentData = data;
@@ -439,7 +434,6 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
439
434
  return cells;
440
435
  });
441
436
  const rows = cellsPromise && (await Promise.all(cellsPromise)).filter((i) => i);
442
- // @ts-ignore
443
437
  setContent({ rows });
444
438
  const columns = columnsPromise && (await Promise.all(columnsPromise));
445
439
  // Set the content to render and finish loading components
@@ -26,7 +26,7 @@ const sqmPortalForgotPasswordView = require('./sqm-portal-forgot-password-view-2
26
26
  const sqmPortalProfileView = require('./sqm-portal-profile-view-11b2265b.js');
27
27
  const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-803a56be.js');
28
28
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-6741f5bd.js');
29
- const ShadowViewAddon = require('./ShadowViewAddon-e4ae9353.js');
29
+ const ShadowViewAddon = require('./ShadowViewAddon-52d34e08.js');
30
30
  const sqmPortalContainerView = require('./sqm-portal-container-view-5beae29c.js');
31
31
 
32
32
  /**
@@ -1636,6 +1636,7 @@ const Default = () => {
1636
1636
  shareString: "https://noah.example.com",
1637
1637
  open: false,
1638
1638
  tooltiptext: "Copied!",
1639
+ setInput: () => { },
1639
1640
  };
1640
1641
  return index.h(ShadowViewAddon.ShareLinkView, Object.assign({}, props));
1641
1642
  };
@@ -1644,6 +1645,7 @@ const Tooltip = () => {
1644
1645
  shareString: "https://noah.example.com",
1645
1646
  tooltiptext: "Some text for the tooltip",
1646
1647
  open: true,
1648
+ setInput: () => { },
1647
1649
  };
1648
1650
  return index.h(ShadowViewAddon.ShareLinkView, Object.assign({}, props));
1649
1651
  };
@@ -1653,6 +1655,7 @@ const Disabled = () => {
1653
1655
  disabled: true,
1654
1656
  open: true,
1655
1657
  tooltiptext: "Copied!",
1658
+ setInput: () => { },
1656
1659
  };
1657
1660
  return index.h(ShadowViewAddon.ShareLinkView, Object.assign({}, props));
1658
1661
  };
@@ -3598,6 +3601,7 @@ const Dashboard = () => {
3598
3601
  disabled: false,
3599
3602
  tooltiptext: "Share link copied",
3600
3603
  onClick: () => console.log("Share link copied"),
3604
+ setInput: () => { },
3601
3605
  };
3602
3606
  const sharecodeProps = {
3603
3607
  shareString: "JOHNSMITH1",
@@ -3605,6 +3609,7 @@ const Dashboard = () => {
3605
3609
  disabled: false,
3606
3610
  tooltiptext: "Share code copied",
3607
3611
  onClick: () => console.log("Share code copied"),
3612
+ setInput: () => { },
3608
3613
  };
3609
3614
  const twitterButtonProps = {
3610
3615
  medium: "twitter",
@@ -47,14 +47,6 @@ const GET_REFERRER_DATA = index_module.dist.gql `
47
47
  statuses
48
48
  globalRewardKey
49
49
  programRewardKey
50
- meta {
51
- status
52
- integration {
53
- name
54
- }
55
- message
56
- customMeta
57
- }
58
50
  rewardRedemptionTransactions {
59
51
  data {
60
52
  exchangedRewards {
@@ -255,7 +247,7 @@ function useReferralTable(props, emptyElement, loadingElement) {
255
247
  }
256
248
  // get the column cells (renderCell is asynchronous)
257
249
  const cellsPromise = data === null || data === void 0 ? void 0 : data.map(async (r) => {
258
- const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale, index.h)));
250
+ const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale)));
259
251
  const cells = (await Promise.all(cellPromise));
260
252
  return cells;
261
253
  });
@@ -148,7 +148,7 @@ export class BigStat {
148
148
  "mutable": false,
149
149
  "complexType": {
150
150
  "original": "DemoData<BigStatViewProps>",
151
- "resolved": "{ value?: number; statvalue?: string; loading?: boolean; flexReverse?: boolean; alignment?: \"left\" | \"right\" | \"center\"; labelSlot?: VNode; }",
151
+ "resolved": "{ loading?: boolean; value?: number; statvalue?: string; flexReverse?: boolean; alignment?: \"left\" | \"right\" | \"center\"; labelSlot?: VNode; }",
152
152
  "references": {
153
153
  "DemoData": {
154
154
  "location": "import",
@@ -258,8 +258,8 @@ export class ReferralTable {
258
258
  "type": "unknown",
259
259
  "mutable": false,
260
260
  "complexType": {
261
- "original": "DemoData<GenericTableViewProps> & {\r\n mockData?: { data: Referral[] };\r\n }",
262
- "resolved": "Partial<Pick<GenericTableViewProps, \"states\" | \"data\" | \"elements\">> & { mockData?: { data: Referral[]; }; }",
261
+ "original": "DemoData<GenericTableViewProps>",
262
+ "resolved": "{ states?: { hasPrev: boolean; hasNext: boolean; show: \"loading\" | \"empty\" | \"rows\"; namespace: string; }; data?: { textOverrides: { showLabels: boolean; prevLabel: string; moreLabel: string; }; hiddenColumns: string; mdBreakpoint: number; smBreakpoint: number; }; elements?: { columns: string[]; rows: VNode[][]; loading?: boolean; emptyElement?: VNode; loadingElement?: VNode; page?: number; }; }",
263
263
  "references": {
264
264
  "DemoData": {
265
265
  "location": "import",
@@ -268,9 +268,6 @@ export class ReferralTable {
268
268
  "GenericTableViewProps": {
269
269
  "location": "import",
270
270
  "path": "../../tables/GenericTableView"
271
- },
272
- "Referral": {
273
- "location": "global"
274
271
  }
275
272
  }
276
273
  },
@@ -316,7 +313,7 @@ function useReferralTableDemo(props, emptyElement, loadingElement) {
316
313
  page: 0,
317
314
  });
318
315
  const tick = useRerenderListener();
319
- const mockData = useMemo(() => { var _a; return ((_a = props.demoData) === null || _a === void 0 ? void 0 : _a.mockData) || mockReferralData(props.perPage); }, [props.perPage]);
316
+ const mockData = useMemo(() => mockReferralData(props.perPage), [props.perPage]);
320
317
  const components = useChildElements();
321
318
  async function getComponentData(components) {
322
319
  var _a;
@@ -46,14 +46,6 @@ const GET_REFERRER_DATA = gql `
46
46
  statuses
47
47
  globalRewardKey
48
48
  programRewardKey
49
- meta {
50
- status
51
- integration {
52
- name
53
- }
54
- message
55
- customMeta
56
- }
57
49
  rewardRedemptionTransactions {
58
50
  data {
59
51
  exchangedRewards {
@@ -254,7 +246,7 @@ export function useReferralTable(props, emptyElement, loadingElement) {
254
246
  }
255
247
  // get the column cells (renderCell is asynchronous)
256
248
  const cellsPromise = data === null || data === void 0 ? void 0 : data.map(async (r) => {
257
- const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale, h)));
249
+ const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale)));
258
250
  const cells = (await Promise.all(cellPromise));
259
251
  return cells;
260
252
  });
@@ -51,6 +51,7 @@ const baseResponse = (data, stage = "chooseReward", selectedItem = null, selecte
51
51
  setStage: null,
52
52
  setExchangeState: null,
53
53
  copyFuelTankCode: null,
54
+ setInput: null,
54
55
  refs: null,
55
56
  },
56
57
  refs: null,
@@ -538,7 +538,7 @@ export function RewardExchangeView(props) {
538
538
  })),
539
539
  (data === null || data === void 0 ? void 0 : data.fuelTankCode) && (h("div", { class: "promo" },
540
540
  states.content.text.promoCode,
541
- h(ShareLinkView, { shareString: data.fuelTankCode, tooltiptext: (_f = states === null || states === void 0 ? void 0 : states.content) === null || _f === void 0 ? void 0 : _f.text.tooltipText, open: states.open, onClick: callbacks.copyFuelTankCode }))),
541
+ h(ShareLinkView, { shareString: data.fuelTankCode, tooltiptext: (_f = states === null || states === void 0 ? void 0 : states.content) === null || _f === void 0 ? void 0 : _f.text.tooltipText, open: states.open, onClick: callbacks.copyFuelTankCode, setInput: callbacks.setInput }))),
542
542
  h("div", { class: sheet.classes.Button },
543
543
  h("sl-button", { class: "continue center", type: "primary", size: "large", onClick: () => callbacks.resetState(true) }, states.content.text.doneText))));
544
544
  }
@@ -773,6 +773,7 @@ function useRewardExchangeListDemo(props) {
773
773
  setStage: (_) => { },
774
774
  resetState: () => { },
775
775
  copyFuelTankCode: () => { },
776
+ setInput: () => { },
776
777
  },
777
778
  refs: {
778
779
  canvasRef: {},
@@ -81,6 +81,7 @@ export function useRewardExchangeList(props) {
81
81
  setExchangeState({ exchangeError: true });
82
82
  }
83
83
  }, [exchangeResponse, errors]);
84
+ const [input, setInput] = useState(undefined);
84
85
  const canvasRef = useRef();
85
86
  useEffect(() => {
86
87
  if (!canvasRef.current)
@@ -168,7 +169,19 @@ export function useRewardExchangeList(props) {
168
169
  }
169
170
  function copyFuelTankCode() {
170
171
  var _a, _b;
171
- navigator.clipboard.writeText((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.fuelTankCode);
172
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
173
+ navigator.clipboard.writeText((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.fuelTankCode);
174
+ }
175
+ else {
176
+ input === null || input === void 0 ? void 0 : input.select();
177
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
178
+ try {
179
+ document.execCommand("copy");
180
+ }
181
+ catch (err) {
182
+ console.log("Error while copying to clipboard: " + err);
183
+ }
184
+ }
172
185
  setOpen(true);
173
186
  setTimeout(() => setOpen(false), 1000);
174
187
  }
@@ -197,6 +210,7 @@ export function useRewardExchangeList(props) {
197
210
  setStage,
198
211
  resetState,
199
212
  copyFuelTankCode,
213
+ setInput,
200
214
  },
201
215
  refs: {
202
216
  canvasRef,
@@ -222,8 +222,8 @@ export class RewardsTable {
222
222
  "type": "unknown",
223
223
  "mutable": false,
224
224
  "complexType": {
225
- "original": "DemoData<GenericTableViewProps> & {\r\n mockData?: { data: Referral[] };\r\n }",
226
- "resolved": "Partial<Pick<GenericTableViewProps, \"states\" | \"data\" | \"elements\">> & { mockData?: { data: Referral[]; }; }",
225
+ "original": "DemoData<GenericTableViewProps>",
226
+ "resolved": "{ states?: { hasPrev: boolean; hasNext: boolean; show: \"loading\" | \"empty\" | \"rows\"; namespace: string; }; data?: { textOverrides: { showLabels: boolean; prevLabel: string; moreLabel: string; }; hiddenColumns: string; mdBreakpoint: number; smBreakpoint: number; }; elements?: { columns: string[]; rows: VNode[][]; loading?: boolean; emptyElement?: VNode; loadingElement?: VNode; page?: number; }; }",
227
227
  "references": {
228
228
  "DemoData": {
229
229
  "location": "import",
@@ -232,9 +232,6 @@ export class RewardsTable {
232
232
  "GenericTableViewProps": {
233
233
  "location": "import",
234
234
  "path": "../../tables/GenericTableView"
235
- },
236
- "Referral": {
237
- "location": "global"
238
235
  }
239
236
  }
240
237
  },
@@ -280,7 +277,7 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
280
277
  page: 0,
281
278
  });
282
279
  const tick = useRerenderListener();
283
- const { data } = useMemo(() => { var _a; return ((_a = props.demoData) === null || _a === void 0 ? void 0 : _a.mockData) || mockRewardData(props.perPage); }, [props.perPage]);
280
+ const { data } = useMemo(() => mockRewardData(props.perPage), [props.perPage]);
284
281
  const components = useChildElements();
285
282
  async function getComponentData(components) {
286
283
  let componentData = data;
@@ -319,7 +316,6 @@ function useRewardsTableDemo(props, emptyElement, loadingElement) {
319
316
  return cells;
320
317
  });
321
318
  const rows = cellsPromise && (await Promise.all(cellsPromise)).filter((i) => i);
322
- // @ts-ignore
323
319
  setContent({ rows });
324
320
  const columns = columnsPromise && (await Promise.all(columnsPromise));
325
321
  // Set the content to render and finish loading components
@@ -28,12 +28,7 @@ const GET_REWARDS = gql `
28
28
  count
29
29
  data {
30
30
  meta {
31
- status
32
- integration {
33
- name
34
- }
35
31
  message
36
- customMeta
37
32
  }
38
33
  id
39
34
  type
@@ -155,7 +150,7 @@ export function useRewardsTable(props, emptyElement, loadingElement) {
155
150
  const columnsPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderLabel()));
156
151
  // get the column cells (renderCell is asynchronous)
157
152
  const cellsPromise = data === null || data === void 0 ? void 0 : data.map(async (r) => {
158
- const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale, h)));
153
+ const cellPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c) => tryMethod(c, () => c.renderCell(r, locale)));
159
154
  const cells = (await Promise.all(cellPromise));
160
155
  return cells;
161
156
  });
@@ -107,7 +107,7 @@ export class ShareCode {
107
107
  "mutable": false,
108
108
  "complexType": {
109
109
  "original": "DemoData<ShareLinkViewProps>",
110
- "resolved": "{ disabled?: boolean; onClick?: () => void; shareString?: string; open?: boolean; tooltiptext?: string; }",
110
+ "resolved": "{ disabled?: boolean; onClick?: () => void; shareString?: string; open?: boolean; tooltiptext?: string; setInput?: (el: HTMLInputElement) => void; }",
111
111
  "references": {
112
112
  "DemoData": {
113
113
  "location": "import",
@@ -137,14 +137,28 @@ export class ShareCode {
137
137
  function useDemoShareCode(props) {
138
138
  const [open, setOpen] = useState(false);
139
139
  const shareString = "SHARECODE001";
140
+ const [input, setInput] = useState(undefined);
140
141
  return deepmerge({
141
142
  shareString,
142
143
  tooltiptext: props.tooltiptext,
143
144
  open,
145
+ setInput,
144
146
  onClick: () => {
145
147
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
146
148
  // Only if called from a user-initiated event
147
- navigator.clipboard.writeText(shareString);
149
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
150
+ navigator.clipboard.writeText(shareString);
151
+ }
152
+ else {
153
+ input === null || input === void 0 ? void 0 : input.select();
154
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
155
+ try {
156
+ document.execCommand("copy");
157
+ }
158
+ catch (err) {
159
+ console.log("Error while copying to clipboard: " + err);
160
+ }
161
+ }
148
162
  setOpen(true);
149
163
  setTimeout(() => setOpen(false), props.tooltiplifespan);
150
164
  },
@@ -26,10 +26,23 @@ export function useShareCode(props) {
26
26
  // Shown during loading
27
27
  "...";
28
28
  const [open, setOpen] = useState(false);
29
+ const [input, setInput] = useState(undefined);
29
30
  function onClick() {
30
31
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
31
32
  // Only if called from a user-initiated event
32
- navigator.clipboard.writeText(shareString);
33
+ if (navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) {
34
+ navigator.clipboard.writeText(shareString);
35
+ }
36
+ else {
37
+ input === null || input === void 0 ? void 0 : input.select();
38
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 99999);
39
+ try {
40
+ document.execCommand("copy");
41
+ }
42
+ catch (err) {
43
+ console.log("Error while copying to clipboard: " + err);
44
+ }
45
+ }
33
46
  setOpen(true);
34
47
  setTimeout(() => setOpen(false), props.tooltiplifespan);
35
48
  sendLoadEvent({
@@ -45,5 +58,5 @@ export function useShareCode(props) {
45
58
  },
46
59
  });
47
60
  }
48
- return { ...props, onClick, open, shareString };
61
+ return { ...props, onClick, open, shareString, setInput };
49
62
  }
@@ -12,6 +12,7 @@ export const Default = () => {
12
12
  shareString: "https://noah.example.com",
13
13
  open: false,
14
14
  tooltiptext: "Copied!",
15
+ setInput: () => { },
15
16
  };
16
17
  return h(ShareLinkView, Object.assign({}, props));
17
18
  };
@@ -20,6 +21,7 @@ export const Tooltip = () => {
20
21
  shareString: "https://noah.example.com",
21
22
  tooltiptext: "Some text for the tooltip",
22
23
  open: true,
24
+ setInput: () => { },
23
25
  };
24
26
  return h(ShareLinkView, Object.assign({}, props));
25
27
  };
@@ -29,6 +31,7 @@ export const Disabled = () => {
29
31
  disabled: true,
30
32
  open: true,
31
33
  tooltiptext: "Copied!",
34
+ setInput: () => { },
32
35
  };
33
36
  return h(ShareLinkView, Object.assign({}, props));
34
37
  };
@@ -13,6 +13,6 @@ export function ShareLinkView(props) {
13
13
  return (h("div", null,
14
14
  h("style", { type: "text/css" }, styleString),
15
15
  h("sl-tooltip", { trigger: "manual", content: props.tooltiptext, placement: "top-end", disabled: props.disabled, open: props.open, skidding: -20 },
16
- h("sl-input", { class: sheet.classes.inputStyle, exportparts: "label: input-label", value: props.shareString, readonly: true },
16
+ h("sl-input", { class: sheet.classes.inputStyle, exportparts: "label: input-label", value: props.shareString, ref: props.setInput, readonly: true },
17
17
  h("sl-icon-button", { onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, slot: "suffix", name: "files", disabled: props.disabled })))));
18
18
  }