@saasquatch/mint-components 1.11.1-1 → 1.11.1-3

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 (45) hide show
  1. package/dist/cjs/{ShadowViewAddon-2c6026c3.js → ShadowViewAddon-1c01c324.js} +16 -7
  2. package/dist/cjs/{copy-text-view-a22ad7e7.js → copy-text-view-3cfef405.js} +27 -2
  3. package/dist/cjs/sqm-big-stat_38.cjs.entry.js +2 -2
  4. package/dist/cjs/sqm-pagination_3.cjs.entry.js +5 -1
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +3 -3
  6. package/dist/collection/components/sqm-referral-code/useReferralCode.js +5 -1
  7. package/dist/collection/components/sqm-referral-codes/useReferralCodes.js +26 -2
  8. package/dist/collection/components/sqm-share-button/useShareButton.js +13 -8
  9. package/dist/collection/components/sqm-share-link/useShareLink.js +5 -1
  10. package/dist/esm/{ShadowViewAddon-5bb2b69a.js → ShadowViewAddon-afc80fe0.js} +16 -7
  11. package/dist/esm/{copy-text-view-bf55abeb.js → copy-text-view-3cd1338e.js} +27 -3
  12. package/dist/esm/sqm-big-stat_38.entry.js +2 -2
  13. package/dist/esm/sqm-pagination_3.entry.js +5 -1
  14. package/dist/esm/sqm-stencilbook.entry.js +3 -3
  15. package/dist/esm-es5/ShadowViewAddon-afc80fe0.js +1 -0
  16. package/dist/esm-es5/copy-text-view-3cd1338e.js +1 -0
  17. package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
  18. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  19. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  20. package/dist/mint-components/mint-components.esm.js +1 -1
  21. package/dist/mint-components/p-14bf2068.system.js +1 -0
  22. package/dist/mint-components/{p-b71c0e2d.system.entry.js → p-20560db6.system.entry.js} +1 -1
  23. package/dist/mint-components/{p-73c6b26d.entry.js → p-4256e919.entry.js} +1 -1
  24. package/dist/mint-components/p-4ec6708d.entry.js +13 -0
  25. package/dist/mint-components/p-5fc8d87c.system.js +1 -1
  26. package/dist/mint-components/{p-b0ce005d.entry.js → p-6061beaf.entry.js} +2 -2
  27. package/dist/mint-components/{p-fec0ac31.js → p-76764513.js} +24 -24
  28. package/dist/mint-components/p-7c1668ca.js +25 -0
  29. package/dist/mint-components/p-99a08cbb.system.entry.js +1 -0
  30. package/dist/mint-components/p-ecfb1582.system.js +1 -0
  31. package/dist/mint-components/{p-4856b234.system.entry.js → p-fbf07dcd.system.entry.js} +1 -1
  32. package/dist/types/components/sqm-referral-codes/useReferralCodes.d.ts +1 -0
  33. package/dist/types/global/android.d.ts +7 -0
  34. package/dist/types/global/demo.d.ts +2 -0
  35. package/dist/types/stories/features.d.ts +4 -0
  36. package/dist/types/stories/templates.d.ts +4 -0
  37. package/docs/docs.docx +0 -0
  38. package/package.json +1 -1
  39. package/dist/esm-es5/ShadowViewAddon-5bb2b69a.js +0 -1
  40. package/dist/esm-es5/copy-text-view-bf55abeb.js +0 -1
  41. package/dist/mint-components/p-0161f5da.entry.js +0 -13
  42. package/dist/mint-components/p-646d302a.system.js +0 -1
  43. package/dist/mint-components/p-6628bc0e.system.js +0 -1
  44. package/dist/mint-components/p-c37137cd.js +0 -2
  45. package/dist/mint-components/p-eb4e9efb.system.entry.js +0 -1
@@ -6,7 +6,7 @@ const global = require('./global-02e50f09.js');
6
6
  const index_module = require('./index.module-df530553.js');
7
7
  const utils = require('./utils-6847bc06.js');
8
8
  const JSS = require('./JSS-8503a151.js');
9
- const copyTextView = require('./copy-text-view-a22ad7e7.js');
9
+ const copyTextView = require('./copy-text-view-3cfef405.js');
10
10
  const cjs = require('./cjs-1066ec21.js');
11
11
  const mixins = require('./mixins-fe9d4112.js');
12
12
  const useChildElements = require('./useChildElements-e0d44916.js');
@@ -381,11 +381,15 @@ function useShareLink(props) {
381
381
  const contextData = index_module.In(copyTextView.REFERRAL_CODES_NAMESPACE);
382
382
  const { data } = index_module.yn(MessageLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
383
383
  const [sendLoadEvent] = index_module.$e(WIDGET_ENGAGEMENT_EVENT);
384
+ const [setUsed, usedRes] = index_module.$e(copyTextView.SET_CODE_USED);
384
385
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
385
386
  // Shown during loading
386
387
  "...";
387
388
  const [open, setOpen] = stencilHooks_module.useState(false);
388
389
  function onClick() {
390
+ if (contextData) {
391
+ setUsed(true);
392
+ }
389
393
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
390
394
  // Only if called from a user-initiated event
391
395
  navigator.clipboard.writeText(copyString);
@@ -459,7 +463,7 @@ function GenericShare(messageLink, errorText) {
459
463
  return messageLink ? window.open(messageLink) : alert(errorText);
460
464
  }
461
465
  function useShareButton(props) {
462
- var _a, _b, _c;
466
+ var _a, _b;
463
467
  const { sharetitle, sharetext, medium } = props;
464
468
  const programId = props.programId ? props.programId : index_module.H();
465
469
  const user = index_module.Q();
@@ -469,24 +473,29 @@ function useShareButton(props) {
469
473
  shareMedium: medium.toUpperCase(),
470
474
  };
471
475
  const data = index_module.In(copyTextView.REFERRAL_CODES_NAMESPACE);
476
+ const overrideData = data === null || data === void 0 ? void 0 : data[medium];
472
477
  // only queries if a programId is available
473
- const res = index_module.yn(MessageLinkQuery$1, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || (data === null || data === void 0 ? void 0 : data[medium]) !== undefined);
474
- const directLink = ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.shareLink) || ((_c = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.shareLink);
478
+ const res = index_module.yn(MessageLinkQuery$1, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || overrideData !== undefined);
479
+ const [setUsed, usedRes] = index_module.$e(copyTextView.SET_CODE_USED);
480
+ const directLink = (overrideData === null || overrideData === void 0 ? void 0 : overrideData.shareLink) || ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.shareLink);
475
481
  const environment = index_module.getEnvironmentSDK();
476
482
  const hide = (medium.toLocaleUpperCase() === "SMS" &&
477
483
  window.orientation === undefined) ||
478
484
  (medium.toLocaleUpperCase() === "DIRECT" && !window.navigator.share);
479
485
  function onClick() {
480
- var _a, _b, _c, _d, _e, _f;
486
+ var _a, _b, _c, _d;
487
+ if (overrideData) {
488
+ setUsed(true);
489
+ }
481
490
  if (medium.toLocaleUpperCase() === "FACEBOOK" &&
482
491
  environment.type === "SquatchAndroid") {
483
- FacebookShare(directLink, ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.messageLink) || ((_c = (_b = res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.messageLink), props.errorText);
492
+ FacebookShare(directLink, (overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.messageLink), props.errorText);
484
493
  }
485
494
  else if (medium.toLocaleUpperCase() === "DIRECT") {
486
495
  NativeShare({ sharetitle, sharetext }, directLink, props.errorText, props.unsupportedPlatformText);
487
496
  }
488
497
  else {
489
- GenericShare(((_d = data === null || data === void 0 ? void 0 : data[medium]) === null || _d === void 0 ? void 0 : _d.messageLink) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.viewer) === null || _f === void 0 ? void 0 : _f.messageLink), props.errorText);
498
+ GenericShare((overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.viewer) === null || _d === void 0 ? void 0 : _d.messageLink), props.errorText);
490
499
  }
491
500
  }
492
501
  return { ...props, loading: res.loading, onClick, hide };
@@ -6,10 +6,34 @@ const index_module = require('./index.module-df530553.js');
6
6
  const JSS = require('./JSS-8503a151.js');
7
7
  const mixins = require('./mixins-fe9d4112.js');
8
8
 
9
- const GET_REFERRAL_CODES = index_module.dist.gql `query getReferralCodes {
10
- }`;
9
+ const GET_REFERRAL_CODES = index_module.dist.gql `
10
+ query getCodes($limit: Int!, $offset: Int!) {
11
+ viewer {
12
+ ... on User {
13
+ referralCodeList(limit: $limit, offset: $offset) {
14
+ data {
15
+ code
16
+ dateUsed
17
+ dateCopied
18
+ shareLinkCodes(limit: $limit, offset: $offset) {
19
+ data {
20
+ linkCode
21
+ shortUrl
22
+ }
23
+ }
24
+ }
25
+ count
26
+ totalCount
27
+ }
28
+ }
29
+ }
30
+ }
31
+ `;
11
32
  const REFERRAL_CODES_NAMESPACE = "sq:referral-codes";
12
33
  const REFERRAL_CODES_PAGINATION_CONTEXT = "sq:referral-codes-pagination";
34
+ const SET_CODE_USED = index_module.dist.gql `
35
+ mutation test {}
36
+ `;
13
37
  function useReferralCodes(props) {
14
38
  const user = index_module.Q();
15
39
  console.log({ props });
@@ -170,4 +194,5 @@ function CopyTextView(props) {
170
194
  exports.CopyTextView = CopyTextView;
171
195
  exports.REFERRAL_CODES_NAMESPACE = REFERRAL_CODES_NAMESPACE;
172
196
  exports.REFERRAL_CODES_PAGINATION_CONTEXT = REFERRAL_CODES_PAGINATION_CONTEXT;
197
+ exports.SET_CODE_USED = SET_CODE_USED;
173
198
  exports.useReferralCodes = useReferralCodes;
@@ -9,7 +9,7 @@ const index_module = require('./index.module-df530553.js');
9
9
  const jsonpointer = require('./jsonpointer-11327262.js');
10
10
  const utils = require('./utils-6847bc06.js');
11
11
  const JSS = require('./JSS-8503a151.js');
12
- const copyTextView = require('./copy-text-view-a22ad7e7.js');
12
+ const copyTextView = require('./copy-text-view-3cfef405.js');
13
13
  const cjs = require('./cjs-1066ec21.js');
14
14
  require('./mixins-fe9d4112.js');
15
15
  const reRender = require('./re-render-1976e05e.js');
@@ -20,7 +20,7 @@ const index$1 = require('./index-8c6255f5.js');
20
20
  const useRegistrationFormState = require('./useRegistrationFormState-876ed65d.js');
21
21
  const utilities = require('./utilities-cec9dd36.js');
22
22
  const AsYouType = require('./AsYouType-6788393a.js');
23
- const ShadowViewAddon = require('./ShadowViewAddon-2c6026c3.js');
23
+ const ShadowViewAddon = require('./ShadowViewAddon-1c01c324.js');
24
24
  require('./sqm-portal-container-view-990a85a3.js');
25
25
 
26
26
  const BigStat = class {
@@ -7,7 +7,7 @@ const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
7
  const index_module = require('./index.module-df530553.js');
8
8
  const utils = require('./utils-6847bc06.js');
9
9
  const JSS = require('./JSS-8503a151.js');
10
- const copyTextView = require('./copy-text-view-a22ad7e7.js');
10
+ const copyTextView = require('./copy-text-view-3cfef405.js');
11
11
  const cjs = require('./cjs-1066ec21.js');
12
12
  require('./mixins-fe9d4112.js');
13
13
 
@@ -110,11 +110,15 @@ function useReferralCode(props) {
110
110
  const contextData = index_module.In(copyTextView.REFERRAL_CODES_NAMESPACE);
111
111
  const { data } = index_module.yn(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) !== undefined);
112
112
  const [sendLoadEvent] = index_module.$e(WIDGET_ENGAGEMENT_EVENT);
113
+ const [setUsed, usedRes] = index_module.$e(copyTextView.SET_CODE_USED);
113
114
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode))) !== null && _b !== void 0 ? _b :
114
115
  // Shown during loading
115
116
  "...";
116
117
  const [open, setOpen] = stencilHooks_module.useState(false);
117
118
  function onClick() {
119
+ if (contextData) {
120
+ setUsed(true);
121
+ }
118
122
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
119
123
  // Only if called from a user-initiated event
120
124
  navigator.clipboard.writeText(copyString);
@@ -8,7 +8,7 @@ require('./global-02e50f09.js');
8
8
  const index_module = require('./index.module-df530553.js');
9
9
  require('./utils-6847bc06.js');
10
10
  const JSS = require('./JSS-8503a151.js');
11
- const copyTextView = require('./copy-text-view-a22ad7e7.js');
11
+ const copyTextView = require('./copy-text-view-3cfef405.js');
12
12
  require('./cjs-1066ec21.js');
13
13
  require('./mixins-fe9d4112.js');
14
14
  const GenericTableView = require('./GenericTableView-a3f48e15.js');
@@ -29,7 +29,7 @@ const sqmPortalProfileView = require('./sqm-portal-profile-view-fde54e35.js');
29
29
  require('./utilities-cec9dd36.js');
30
30
  const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-34771d2c.js');
31
31
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-c8f91506.js');
32
- const ShadowViewAddon = require('./ShadowViewAddon-2c6026c3.js');
32
+ const ShadowViewAddon = require('./ShadowViewAddon-1c01c324.js');
33
33
  const sqmPortalContainerView = require('./sqm-portal-container-view-990a85a3.js');
34
34
  const sqmInvoiceTableView = require('./sqm-invoice-table-view-e3b03a00.js');
35
35
 
@@ -15104,7 +15104,7 @@ const UseInvoiceTableCells = /*#__PURE__*/Object.freeze({
15104
15104
  InvoiceTableDemoHook: InvoiceTableDemoHook
15105
15105
  });
15106
15106
 
15107
- const scenario$E = "@author: sam\n@owner: sam\n\nFeature: Referral Codes Component\n\n A paginated display of available and used promo codes for the user to share with others\n\n @motivating\n Scenario: Promo code can be shared using various share mediums\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n Then the promo code can be copied directly\n And the promo code can be shared using <shareMedium>\n\n Examples:\n | shareMedium |\n | DIRECT |\n | EMAIL |\n | FBMESSENGER |\n | WHATSAPP |\n\n @minutia\n Scenario: User is notified if the currently viewed promo code has been used already\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the code has not been used already\n Then no notification text is displayed\n When the code is changed to one that has been used\n Then the notification text is displayed\n\n @minutia\n Scenario Outline: Share mediums can be optionally displayed\n Given an authenticated user\n And the program has promo codes configured\n And <propName> is true\n Then the <shareMedium> is hidden\n Examples:\n | propName | shareMedium |\n | hideSharelink | DIRECT |\n | hideEmail | EMAIL |\n | hideFbMessenger | FBMESSENGER |\n | hideWhatsApp | WHATSAPP |\n\n @minutia\n Scenario Outline: Number of codes is displayed in the pagination component\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the user has <numCodes> available\n And the user is on <currentPage>\n Then the pagination text is <paginationText>\n Examples:\n | numCodes | currentPage | paginationText |\n | 5 | 1 | 1 of 5 |\n | 5 | 2 | 2 of 5 |\n | 5 | 3 | 3 of 5 |\n | 5 | 4 | 4 of 5 |\n | 5 | 5 | 5 of 5 |\n | 1 | 1 | 1 of 1 |\n | 0 | 0 | 0 of 0 |\n\n";
15107
+ const scenario$E = "@author: sam\n@owner: sam\n\nFeature: Referral Codes Component\n\n A paginated display of available and used promo codes for the user to share with others\n\n @motivating\n Scenario: Promo code can be shared using various share mediums\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n Then the promo code can be copied directly\n And the promo code can be shared using <shareMedium>\n\n Examples:\n | shareMedium |\n | DIRECT |\n | EMAIL |\n | FBMESSENGER |\n | WHATSAPP |\n\n @minutia\n Scenario: User is notified if the currently viewed promo code has been used already\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the code has not been used already\n Then no notification text is displayed\n When the code is changed to one that has been used\n Then the notification text is displayed\n\n @minutia\n Scenario Outline: Share buttons slots use the link from referral codes instead of the default query\n Given an authenticated user\n And the program has promo codes configured\n And a <shareMedium> button is a child of `<sqm-referral-codes>`\n Then the <shareMedium> button is shown\n And the link is <promoCode>\n Examples:\n | propName | shareMedium | promoCode |\n | hideSharelink | DIRECT | PROMOCODE1 |\n | hideEmail | EMAIL | PROMOCODE1 |\n | hideFbMessenger | FBMESSENGER | PROMOCODE1 |\n | hideWhatsApp | WHATSAPP | PROMOCODE1 |\n\n @minutia\n Scenario Outline: Number of codes is displayed in the pagination component\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the user has <numCodes> available\n And the user is on <currentPage>\n Then the pagination text is <paginationText>\n Examples:\n | numCodes | currentPage | paginationText |\n | 5 | 1 | 1 of 5 |\n | 5 | 2 | 2 of 5 |\n | 5 | 3 | 3 of 5 |\n | 5 | 4 | 4 of 5 |\n | 5 | 5 | 5 of 5 |\n | 1 | 1 | 1 of 1 |\n | 0 | 0 | 0 of 0 |\n\n";
15108
15108
 
15109
15109
  const ReferralCodes_stories = {
15110
15110
  title: "Components/Referral Codes",
@@ -1,7 +1,7 @@
1
1
  import { useEngagementMedium, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useState } from "@saasquatch/universal-hooks";
3
3
  import { gql } from "graphql-request";
4
- import { REFERRAL_CODES_NAMESPACE, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query ($programId: ID) {
7
7
  user: viewer {
@@ -24,11 +24,15 @@ export function useReferralCode(props) {
24
24
  const contextData = useParentValue(REFERRAL_CODES_NAMESPACE);
25
25
  const { data } = useQuery(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) !== undefined);
26
26
  const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
27
+ const [setUsed, usedRes] = useMutation(SET_CODE_USED);
27
28
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode))) !== null && _b !== void 0 ? _b :
28
29
  // Shown during loading
29
30
  "...";
30
31
  const [open, setOpen] = useState(false);
31
32
  function onClick() {
33
+ if (contextData) {
34
+ setUsed(true);
35
+ }
32
36
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
33
37
  // Only if called from a user-initiated event
34
38
  navigator.clipboard.writeText(copyString);
@@ -1,10 +1,34 @@
1
1
  import { usePaginatedQuery, useParentState, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { gql } from "graphql-request";
3
3
  import { useEffect } from "@saasquatch/universal-hooks";
4
- const GET_REFERRAL_CODES = gql `query getReferralCodes {
5
- }`;
4
+ const GET_REFERRAL_CODES = gql `
5
+ query getCodes($limit: Int!, $offset: Int!) {
6
+ viewer {
7
+ ... on User {
8
+ referralCodeList(limit: $limit, offset: $offset) {
9
+ data {
10
+ code
11
+ dateUsed
12
+ dateCopied
13
+ shareLinkCodes(limit: $limit, offset: $offset) {
14
+ data {
15
+ linkCode
16
+ shortUrl
17
+ }
18
+ }
19
+ }
20
+ count
21
+ totalCount
22
+ }
23
+ }
24
+ }
25
+ }
26
+ `;
6
27
  export const REFERRAL_CODES_NAMESPACE = "sq:referral-codes";
7
28
  export const REFERRAL_CODES_PAGINATION_CONTEXT = "sq:referral-codes-pagination";
29
+ export const SET_CODE_USED = gql `
30
+ mutation test {}
31
+ `;
8
32
  export function useReferralCodes(props) {
9
33
  const user = useUserIdentity();
10
34
  console.log({ props });
@@ -1,7 +1,7 @@
1
- import { useEngagementMedium, useUserIdentity, useQuery, useParentValue, } from "@saasquatch/component-boilerplate";
1
+ import { useEngagementMedium, useUserIdentity, useQuery, useParentValue, useMutation, } from "@saasquatch/component-boilerplate";
2
2
  import { gql } from "graphql-request";
3
3
  import { useProgramId, getEnvironmentSDK, } from "@saasquatch/component-boilerplate";
4
- import { REFERRAL_CODES_NAMESPACE, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query (
7
7
  $programId: ID
@@ -54,7 +54,7 @@ function GenericShare(messageLink, errorText) {
54
54
  return messageLink ? window.open(messageLink) : alert(errorText);
55
55
  }
56
56
  export function useShareButton(props) {
57
- var _a, _b, _c;
57
+ var _a, _b;
58
58
  const { sharetitle, sharetext, medium } = props;
59
59
  const programId = props.programId ? props.programId : useProgramId();
60
60
  const user = useUserIdentity();
@@ -64,24 +64,29 @@ export function useShareButton(props) {
64
64
  shareMedium: medium.toUpperCase(),
65
65
  };
66
66
  const data = useParentValue(REFERRAL_CODES_NAMESPACE);
67
+ const overrideData = data === null || data === void 0 ? void 0 : data[medium];
67
68
  // only queries if a programId is available
68
- const res = useQuery(MessageLinkQuery, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || (data === null || data === void 0 ? void 0 : data[medium]) !== undefined);
69
- const directLink = ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.shareLink) || ((_c = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.shareLink);
69
+ const res = useQuery(MessageLinkQuery, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || overrideData !== undefined);
70
+ const [setUsed, usedRes] = useMutation(SET_CODE_USED);
71
+ const directLink = (overrideData === null || overrideData === void 0 ? void 0 : overrideData.shareLink) || ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.shareLink);
70
72
  const environment = getEnvironmentSDK();
71
73
  const hide = (medium.toLocaleUpperCase() === "SMS" &&
72
74
  window.orientation === undefined) ||
73
75
  (medium.toLocaleUpperCase() === "DIRECT" && !window.navigator.share);
74
76
  function onClick() {
75
- var _a, _b, _c, _d, _e, _f;
77
+ var _a, _b, _c, _d;
78
+ if (overrideData) {
79
+ setUsed(true);
80
+ }
76
81
  if (medium.toLocaleUpperCase() === "FACEBOOK" &&
77
82
  environment.type === "SquatchAndroid") {
78
- FacebookShare(directLink, ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.messageLink) || ((_c = (_b = res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.messageLink), props.errorText);
83
+ FacebookShare(directLink, (overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.messageLink), props.errorText);
79
84
  }
80
85
  else if (medium.toLocaleUpperCase() === "DIRECT") {
81
86
  NativeShare({ sharetitle, sharetext }, directLink, props.errorText, props.unsupportedPlatformText);
82
87
  }
83
88
  else {
84
- GenericShare(((_d = data === null || data === void 0 ? void 0 : data[medium]) === null || _d === void 0 ? void 0 : _d.messageLink) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.viewer) === null || _f === void 0 ? void 0 : _f.messageLink), props.errorText);
89
+ GenericShare((overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.viewer) === null || _d === void 0 ? void 0 : _d.messageLink), props.errorText);
85
90
  }
86
91
  }
87
92
  return { ...props, loading: res.loading, onClick, hide };
@@ -1,7 +1,7 @@
1
1
  import { useEngagementMedium, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useState } from "@saasquatch/universal-hooks";
3
3
  import { gql } from "graphql-request";
4
- import { REFERRAL_CODES_NAMESPACE, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
7
7
  user: viewer {
@@ -28,11 +28,15 @@ export function useShareLink(props) {
28
28
  const contextData = useParentValue(REFERRAL_CODES_NAMESPACE);
29
29
  const { data } = useQuery(MessageLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
30
30
  const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
31
+ const [setUsed, usedRes] = useMutation(SET_CODE_USED);
31
32
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
32
33
  // Shown during loading
33
34
  "...";
34
35
  const [open, setOpen] = useState(false);
35
36
  function onClick() {
37
+ if (contextData) {
38
+ setUsed(true);
39
+ }
36
40
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
37
41
  // Only if called from a user-initiated event
38
42
  navigator.clipboard.writeText(copyString);
@@ -4,7 +4,7 @@ import { i as intl } from './global-b89b6edc.js';
4
4
  import { d as dist, H, Q, I as In, y as yn, $ as $e, B, a as getEnvironmentSDK, L } from './index.module-f122af7b.js';
5
5
  import { l as luxonLocale } from './utils-334c1e34.js';
6
6
  import { c as createStyleSheet, j as jss, a as create } from './JSS-67b5cff8.js';
7
- import { a as REFERRAL_CODES_NAMESPACE, C as CopyTextView } from './copy-text-view-bf55abeb.js';
7
+ import { a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_USED, C as CopyTextView } from './copy-text-view-3cd1338e.js';
8
8
  import { c as cjs } from './cjs-bdfb4486.js';
9
9
  import { H as HostBlock, A as AuthWrapper, a as AuthColumn, b as AuthButtonsContainer, E as ErrorStyles } from './mixins-f60a614c.js';
10
10
  import { u as useChildElements } from './useChildElements-37daf533.js';
@@ -379,11 +379,15 @@ function useShareLink(props) {
379
379
  const contextData = In(REFERRAL_CODES_NAMESPACE);
380
380
  const { data } = yn(MessageLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
381
381
  const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
382
+ const [setUsed, usedRes] = $e(SET_CODE_USED);
382
383
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
383
384
  // Shown during loading
384
385
  "...";
385
386
  const [open, setOpen] = useState(false);
386
387
  function onClick() {
388
+ if (contextData) {
389
+ setUsed(true);
390
+ }
387
391
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
388
392
  // Only if called from a user-initiated event
389
393
  navigator.clipboard.writeText(copyString);
@@ -457,7 +461,7 @@ function GenericShare(messageLink, errorText) {
457
461
  return messageLink ? window.open(messageLink) : alert(errorText);
458
462
  }
459
463
  function useShareButton(props) {
460
- var _a, _b, _c;
464
+ var _a, _b;
461
465
  const { sharetitle, sharetext, medium } = props;
462
466
  const programId = props.programId ? props.programId : H();
463
467
  const user = Q();
@@ -467,24 +471,29 @@ function useShareButton(props) {
467
471
  shareMedium: medium.toUpperCase(),
468
472
  };
469
473
  const data = In(REFERRAL_CODES_NAMESPACE);
474
+ const overrideData = data === null || data === void 0 ? void 0 : data[medium];
470
475
  // only queries if a programId is available
471
- const res = yn(MessageLinkQuery$1, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || (data === null || data === void 0 ? void 0 : data[medium]) !== undefined);
472
- const directLink = ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.shareLink) || ((_c = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.shareLink);
476
+ const res = yn(MessageLinkQuery$1, variables, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId || overrideData !== undefined);
477
+ const [setUsed, usedRes] = $e(SET_CODE_USED);
478
+ const directLink = (overrideData === null || overrideData === void 0 ? void 0 : overrideData.shareLink) || ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.shareLink);
473
479
  const environment = getEnvironmentSDK();
474
480
  const hide = (medium.toLocaleUpperCase() === "SMS" &&
475
481
  window.orientation === undefined) ||
476
482
  (medium.toLocaleUpperCase() === "DIRECT" && !window.navigator.share);
477
483
  function onClick() {
478
- var _a, _b, _c, _d, _e, _f;
484
+ var _a, _b, _c, _d;
485
+ if (overrideData) {
486
+ setUsed(true);
487
+ }
479
488
  if (medium.toLocaleUpperCase() === "FACEBOOK" &&
480
489
  environment.type === "SquatchAndroid") {
481
- FacebookShare(directLink, ((_a = data === null || data === void 0 ? void 0 : data[medium]) === null || _a === void 0 ? void 0 : _a.messageLink) || ((_c = (_b = res.data) === null || _b === void 0 ? void 0 : _b.viewer) === null || _c === void 0 ? void 0 : _c.messageLink), props.errorText);
490
+ FacebookShare(directLink, (overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.messageLink), props.errorText);
482
491
  }
483
492
  else if (medium.toLocaleUpperCase() === "DIRECT") {
484
493
  NativeShare({ sharetitle, sharetext }, directLink, props.errorText, props.unsupportedPlatformText);
485
494
  }
486
495
  else {
487
- GenericShare(((_d = data === null || data === void 0 ? void 0 : data[medium]) === null || _d === void 0 ? void 0 : _d.messageLink) || ((_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.viewer) === null || _f === void 0 ? void 0 : _f.messageLink), props.errorText);
496
+ GenericShare((overrideData === null || overrideData === void 0 ? void 0 : overrideData.messageLink) || ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.viewer) === null || _d === void 0 ? void 0 : _d.messageLink), props.errorText);
488
497
  }
489
498
  }
490
499
  return { ...props, loading: res.loading, onClick, hide };
@@ -4,10 +4,34 @@ import { d as dist, Q, k as kn, C as Cn } from './index.module-f122af7b.js';
4
4
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
5
5
  import { H as HostBlock } from './mixins-f60a614c.js';
6
6
 
7
- const GET_REFERRAL_CODES = dist.gql `query getReferralCodes {
8
- }`;
7
+ const GET_REFERRAL_CODES = dist.gql `
8
+ query getCodes($limit: Int!, $offset: Int!) {
9
+ viewer {
10
+ ... on User {
11
+ referralCodeList(limit: $limit, offset: $offset) {
12
+ data {
13
+ code
14
+ dateUsed
15
+ dateCopied
16
+ shareLinkCodes(limit: $limit, offset: $offset) {
17
+ data {
18
+ linkCode
19
+ shortUrl
20
+ }
21
+ }
22
+ }
23
+ count
24
+ totalCount
25
+ }
26
+ }
27
+ }
28
+ }
29
+ `;
9
30
  const REFERRAL_CODES_NAMESPACE = "sq:referral-codes";
10
31
  const REFERRAL_CODES_PAGINATION_CONTEXT = "sq:referral-codes-pagination";
32
+ const SET_CODE_USED = dist.gql `
33
+ mutation test {}
34
+ `;
11
35
  function useReferralCodes(props) {
12
36
  const user = Q();
13
37
  console.log({ props });
@@ -165,4 +189,4 @@ function CopyTextView(props) {
165
189
  props.showNotificationText && props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
166
190
  }
167
191
 
168
- export { CopyTextView as C, REFERRAL_CODES_PAGINATION_CONTEXT as R, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };
192
+ export { CopyTextView as C, REFERRAL_CODES_PAGINATION_CONTEXT as R, SET_CODE_USED as S, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };
@@ -5,7 +5,7 @@ import { i as isDemo, _, d as dist, Q, H, $ as $e, y as yn, B, L, g as gn, e as
5
5
  import { j as jsonpointer } from './jsonpointer-388a7082.js';
6
6
  import { g as getProps, a as getMissingProps, s as sanitizeUrlPath } from './utils-334c1e34.js';
7
7
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
8
- import { C as CopyTextView } from './copy-text-view-bf55abeb.js';
8
+ import { C as CopyTextView } from './copy-text-view-3cd1338e.js';
9
9
  import { c as cjs } from './cjs-bdfb4486.js';
10
10
  import './mixins-f60a614c.js';
11
11
  import { a as useRequestRerender } from './re-render-c64289f3.js';
@@ -16,7 +16,7 @@ import { p as pathToRegexp } from './index-ffa26b43.js';
16
16
  import { R as REGISTRATION_FORM_STATE_CONTEXT, u as useRegistrationFormState } from './useRegistrationFormState-53c71782.js';
17
17
  import { i as isEmpty } from './utilities-18d10876.js';
18
18
  import { A as AsYouType } from './AsYouType-46f67d0d.js';
19
- import { b as useDemoBigStat, U as useBigStat, B as BigStatView, O as autoColorScaleCss, J as CardFeedView, C as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, V as withShadowView, L as LeaderboardView, N as NameFieldsView, d as PortalChangePasswordView, i as PortalFooterView, P as PortalFrameView, e as PortalLoginView, f as PortalRegisterView, R as ReferralIframeView, W as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-5bb2b69a.js';
19
+ import { b as useDemoBigStat, U as useBigStat, B as BigStatView, O as autoColorScaleCss, J as CardFeedView, C as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, V as withShadowView, L as LeaderboardView, N as NameFieldsView, d as PortalChangePasswordView, i as PortalFooterView, P as PortalFrameView, e as PortalLoginView, f as PortalRegisterView, R as ReferralIframeView, W as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-afc80fe0.js';
20
20
  import './sqm-portal-container-view-6c582684.js';
21
21
 
22
22
  const BigStat = class {
@@ -3,7 +3,7 @@ import { n as h$1, k as useState } from './stencil-hooks.module-ac12ca1c.js';
3
3
  import { I as In, i as isDemo, d as dist, H, Q, y as yn, $ as $e, B } from './index.module-f122af7b.js';
4
4
  import { g as getProps } from './utils-334c1e34.js';
5
5
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
6
- import { R as REFERRAL_CODES_PAGINATION_CONTEXT, a as REFERRAL_CODES_NAMESPACE, C as CopyTextView, u as useReferralCodes } from './copy-text-view-bf55abeb.js';
6
+ import { R as REFERRAL_CODES_PAGINATION_CONTEXT, a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_USED, C as CopyTextView, u as useReferralCodes } from './copy-text-view-3cd1338e.js';
7
7
  import { c as cjs } from './cjs-bdfb4486.js';
8
8
  import './mixins-f60a614c.js';
9
9
 
@@ -106,11 +106,15 @@ function useReferralCode(props) {
106
106
  const contextData = In(REFERRAL_CODES_NAMESPACE);
107
107
  const { data } = yn(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) !== undefined);
108
108
  const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
109
+ const [setUsed, usedRes] = $e(SET_CODE_USED);
109
110
  const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode))) !== null && _b !== void 0 ? _b :
110
111
  // Shown during loading
111
112
  "...";
112
113
  const [open, setOpen] = useState(false);
113
114
  function onClick() {
115
+ if (contextData) {
116
+ setUsed(true);
117
+ }
114
118
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
115
119
  // Only if called from a user-initiated event
116
120
  navigator.clipboard.writeText(copyString);
@@ -4,7 +4,7 @@ import './global-b89b6edc.js';
4
4
  import { e as $n, S as Sn, b as setUserIdentity, d as dist, X as Xe, o as setProgramId } from './index.module-f122af7b.js';
5
5
  import './utils-334c1e34.js';
6
6
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
7
- import { C as CopyTextView } from './copy-text-view-bf55abeb.js';
7
+ import { C as CopyTextView } from './copy-text-view-3cd1338e.js';
8
8
  import './cjs-bdfb4486.js';
9
9
  import './mixins-f60a614c.js';
10
10
  import { G as GenericTableView } from './GenericTableView-bf154727.js';
@@ -25,7 +25,7 @@ import { P as PortalProfileView } from './sqm-portal-profile-view-d72dd5ac.js';
25
25
  import './utilities-18d10876.js';
26
26
  import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-f1454d43.js';
27
27
  import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-3739f523.js';
28
- import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalLoginView, f as PortalRegisterView, T as TaskCardView, g as ProgressBarView, h as PoweredByImg$1, i as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, C as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as autoColorScaleCss, Q as ShadowViewAddon } from './ShadowViewAddon-5bb2b69a.js';
28
+ import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalLoginView, f as PortalRegisterView, T as TaskCardView, g as ProgressBarView, h as PoweredByImg$1, i as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, C as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as autoColorScaleCss, Q as ShadowViewAddon } from './ShadowViewAddon-afc80fe0.js';
29
29
  import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-6c582684.js';
30
30
  import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-09cc28d6.js';
31
31
 
@@ -15100,7 +15100,7 @@ const UseInvoiceTableCells = /*#__PURE__*/Object.freeze({
15100
15100
  InvoiceTableDemoHook: InvoiceTableDemoHook
15101
15101
  });
15102
15102
 
15103
- const scenario$E = "@author: sam\n@owner: sam\n\nFeature: Referral Codes Component\n\n A paginated display of available and used promo codes for the user to share with others\n\n @motivating\n Scenario: Promo code can be shared using various share mediums\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n Then the promo code can be copied directly\n And the promo code can be shared using <shareMedium>\n\n Examples:\n | shareMedium |\n | DIRECT |\n | EMAIL |\n | FBMESSENGER |\n | WHATSAPP |\n\n @minutia\n Scenario: User is notified if the currently viewed promo code has been used already\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the code has not been used already\n Then no notification text is displayed\n When the code is changed to one that has been used\n Then the notification text is displayed\n\n @minutia\n Scenario Outline: Share mediums can be optionally displayed\n Given an authenticated user\n And the program has promo codes configured\n And <propName> is true\n Then the <shareMedium> is hidden\n Examples:\n | propName | shareMedium |\n | hideSharelink | DIRECT |\n | hideEmail | EMAIL |\n | hideFbMessenger | FBMESSENGER |\n | hideWhatsApp | WHATSAPP |\n\n @minutia\n Scenario Outline: Number of codes is displayed in the pagination component\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the user has <numCodes> available\n And the user is on <currentPage>\n Then the pagination text is <paginationText>\n Examples:\n | numCodes | currentPage | paginationText |\n | 5 | 1 | 1 of 5 |\n | 5 | 2 | 2 of 5 |\n | 5 | 3 | 3 of 5 |\n | 5 | 4 | 4 of 5 |\n | 5 | 5 | 5 of 5 |\n | 1 | 1 | 1 of 1 |\n | 0 | 0 | 0 of 0 |\n\n";
15103
+ const scenario$E = "@author: sam\n@owner: sam\n\nFeature: Referral Codes Component\n\n A paginated display of available and used promo codes for the user to share with others\n\n @motivating\n Scenario: Promo code can be shared using various share mediums\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n Then the promo code can be copied directly\n And the promo code can be shared using <shareMedium>\n\n Examples:\n | shareMedium |\n | DIRECT |\n | EMAIL |\n | FBMESSENGER |\n | WHATSAPP |\n\n @minutia\n Scenario: User is notified if the currently viewed promo code has been used already\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the code has not been used already\n Then no notification text is displayed\n When the code is changed to one that has been used\n Then the notification text is displayed\n\n @minutia\n Scenario Outline: Share buttons slots use the link from referral codes instead of the default query\n Given an authenticated user\n And the program has promo codes configured\n And a <shareMedium> button is a child of `<sqm-referral-codes>`\n Then the <shareMedium> button is shown\n And the link is <promoCode>\n Examples:\n | propName | shareMedium | promoCode |\n | hideSharelink | DIRECT | PROMOCODE1 |\n | hideEmail | EMAIL | PROMOCODE1 |\n | hideFbMessenger | FBMESSENGER | PROMOCODE1 |\n | hideWhatsApp | WHATSAPP | PROMOCODE1 |\n\n @minutia\n Scenario Outline: Number of codes is displayed in the pagination component\n Given an authenticated user\n And the program has promo codes configured\n When the promo code section is loaded\n And the user has <numCodes> available\n And the user is on <currentPage>\n Then the pagination text is <paginationText>\n Examples:\n | numCodes | currentPage | paginationText |\n | 5 | 1 | 1 of 5 |\n | 5 | 2 | 2 of 5 |\n | 5 | 3 | 3 of 5 |\n | 5 | 4 | 4 of 5 |\n | 5 | 5 | 5 of 5 |\n | 1 | 1 | 1 of 1 |\n | 0 | 0 | 0 of 0 |\n\n";
15104
15104
 
15105
15105
  const ReferralCodes_stories = {
15106
15106
  title: "Components/Referral Codes",