@saasquatch/mint-components 1.11.1-12 → 1.11.1-14

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 (71) hide show
  1. package/dist/cjs/{ShadowViewAddon-f6656672.js → ShadowViewAddon-15ed0bcf.js} +5 -5
  2. package/dist/cjs/{copy-text-view-79484ca2.js → copy-text-view-0a1040b2.js} +14 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mint-components.cjs.js +1 -1
  5. package/dist/cjs/sqm-big-stat_38.cjs.entry.js +2 -2
  6. package/dist/cjs/sqm-empty_4.cjs.entry.js +5 -0
  7. package/dist/cjs/sqm-pagination_3.cjs.entry.js +36 -7
  8. package/dist/cjs/sqm-stencilbook.cjs.entry.js +23 -3
  9. package/dist/collection/components/sqm-coupon-code/sqm-coupon-code.js +1 -1
  10. package/dist/collection/components/sqm-empty/sqm-empty.js +10 -2
  11. package/dist/collection/components/sqm-logout-current-user/sqm-logout-current-user.js +1 -1
  12. package/dist/collection/components/sqm-referral-code/sqm-referral-code.js +3 -1
  13. package/dist/collection/components/sqm-referral-code/useReferralCode.js +10 -4
  14. package/dist/collection/components/sqm-referral-codes/ReferralCodes.stories.js +18 -0
  15. package/dist/collection/components/sqm-referral-codes/sqm-referral-codes-view.js +13 -3
  16. package/dist/collection/components/sqm-referral-codes/sqm-referral-codes.js +17 -1
  17. package/dist/collection/components/sqm-referral-codes/useReferralCodes.js +10 -2
  18. package/dist/collection/components/sqm-share-button/useShareButton.js +3 -3
  19. package/dist/collection/components/sqm-share-code/sqm-share-code.js +1 -1
  20. package/dist/collection/components/sqm-share-link/sqm-share-link.js +1 -1
  21. package/dist/collection/components/sqm-share-link/useShareLink.js +3 -3
  22. package/dist/collection/components/views/copy-text-view.js +4 -2
  23. package/dist/esm/{ShadowViewAddon-58f39af3.js → ShadowViewAddon-66ec2e09.js} +5 -5
  24. package/dist/esm/{copy-text-view-fef437c3.js → copy-text-view-5e472643.js} +14 -4
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/mint-components.js +1 -1
  27. package/dist/esm/sqm-big-stat_38.entry.js +2 -2
  28. package/dist/esm/sqm-empty_4.entry.js +5 -0
  29. package/dist/esm/sqm-pagination_3.entry.js +36 -7
  30. package/dist/esm/sqm-stencilbook.entry.js +23 -3
  31. package/dist/esm-es5/ShadowViewAddon-66ec2e09.js +1 -0
  32. package/dist/esm-es5/copy-text-view-5e472643.js +1 -0
  33. package/dist/esm-es5/loader.js +1 -1
  34. package/dist/esm-es5/mint-components.js +1 -1
  35. package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
  36. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  37. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  38. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  39. package/dist/mint-components/mint-components.esm.js +1 -1
  40. package/dist/mint-components/p-19192ff3.js +52 -0
  41. package/dist/mint-components/{p-908799a4.system.entry.js → p-576ce7fa.system.entry.js} +1 -1
  42. package/dist/mint-components/p-5fc8d87c.system.js +1 -1
  43. package/dist/mint-components/{p-26061987.entry.js → p-65a376c7.entry.js} +2 -2
  44. package/dist/mint-components/p-96d4224a.entry.js +13 -0
  45. package/dist/mint-components/{p-9ef1c919.js → p-99e0b3ad.js} +3 -3
  46. package/dist/mint-components/p-9c0629f7.system.js +1 -0
  47. package/dist/mint-components/p-a49c7625.system.entry.js +1 -0
  48. package/dist/mint-components/p-b260686f.system.entry.js +1 -0
  49. package/dist/mint-components/{p-0025d642.system.entry.js → p-d410a104.system.entry.js} +1 -1
  50. package/dist/mint-components/p-d52a3fe1.system.js +1 -0
  51. package/dist/mint-components/p-ef2b89c9.entry.js +1 -0
  52. package/dist/mint-components/{p-aa4697c9.entry.js → p-f1497827.entry.js} +1 -1
  53. package/dist/types/components/sqm-empty/sqm-empty.d.ts +1 -1
  54. package/dist/types/components/sqm-referral-codes/ReferralCodes.stories.d.ts +2 -0
  55. package/dist/types/components/sqm-referral-codes/sqm-referral-codes-view.d.ts +6 -2
  56. package/dist/types/components/sqm-referral-codes/useReferralCodes.d.ts +3 -1
  57. package/dist/types/components/views/copy-text-view.d.ts +1 -0
  58. package/dist/types/components.d.ts +1 -1
  59. package/docs/docs.docx +0 -0
  60. package/docs/raisins.json +1 -1
  61. package/grapesjs/grapesjs.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/esm-es5/ShadowViewAddon-58f39af3.js +0 -1
  64. package/dist/esm-es5/copy-text-view-fef437c3.js +0 -1
  65. package/dist/mint-components/p-110dddfe.entry.js +0 -1
  66. package/dist/mint-components/p-19e6af4c.system.entry.js +0 -1
  67. package/dist/mint-components/p-476182e7.system.entry.js +0 -1
  68. package/dist/mint-components/p-5e9c6394.js +0 -48
  69. package/dist/mint-components/p-608af4e1.system.js +0 -1
  70. package/dist/mint-components/p-74b989e4.entry.js +0 -13
  71. package/dist/mint-components/p-df76f28c.system.js +0 -1
@@ -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, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_COPIED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query ($programId: ID) {
7
7
  user: viewer {
@@ -24,14 +24,14 @@ 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
+ const [setCopied, copiedRes] = useMutation(SET_CODE_COPIED);
28
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 :
29
29
  // Shown during loading
30
30
  "...";
31
31
  const [open, setOpen] = useState(false);
32
32
  function onClick() {
33
33
  if (contextData) {
34
- setUsed(true);
34
+ setCopied(contextData.referralCode);
35
35
  }
36
36
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
37
37
  // Only if called from a user-initiated event
@@ -51,5 +51,11 @@ export function useReferralCode(props) {
51
51
  },
52
52
  });
53
53
  }
54
- return { ...props, onClick, open, copyString: copyString };
54
+ return {
55
+ ...props,
56
+ onClick,
57
+ open,
58
+ copyString: copyString,
59
+ isCopied: contextData === null || contextData === void 0 ? void 0 : contextData.isCopied,
60
+ };
55
61
  }
@@ -6,6 +6,12 @@ export default {
6
6
  scenario,
7
7
  },
8
8
  };
9
+ const demoData = {
10
+ states: {
11
+ noCodes: false,
12
+ loading: false,
13
+ },
14
+ };
9
15
  const pagination = (slot) => {
10
16
  return h("sqm-pagination", { slot: slot });
11
17
  };
@@ -33,3 +39,15 @@ export const WithPreviouslyCopiedCode = () => {
33
39
  shareCodeWithPreviouslyCopied("shareCodes"),
34
40
  shareButtons("shareButtons")));
35
41
  };
42
+ export const Empty = () => {
43
+ return (h("sqm-referral-codes", { demoData: { states: { ...demoData.states, noCodes: true } } },
44
+ pagination("pagination"),
45
+ shareCodes("shareCodes"),
46
+ shareButtons("shareButtons")));
47
+ };
48
+ export const Loading = () => {
49
+ return (h("sqm-referral-codes", { demoData: { states: { ...demoData.states, loading: true } } },
50
+ pagination("pagination"),
51
+ shareCodes("shareCodes"),
52
+ shareButtons("shareButtons")));
53
+ };
@@ -46,7 +46,18 @@ const vanillaStyle = `
46
46
  const sheet = createStyleSheet(style);
47
47
  const styleString = sheet.toString();
48
48
  export function ReferralCodesView(props) {
49
- const { slots, titleText } = props;
49
+ const { slots, titleText, states } = props;
50
+ const getSlotContent = (states) => {
51
+ if (states.noCodes) {
52
+ return slots.empty;
53
+ }
54
+ if (states.loading) {
55
+ return slots.loading;
56
+ }
57
+ return (h("div", { class: sheet.classes.Wrapper },
58
+ h("div", { class: sheet.classes.ShareCodeContainer }, slots.shareCodes),
59
+ h("div", { class: sheet.classes.ShareButtonContainer }, slots.shareButtons)));
60
+ };
50
61
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
51
62
  h("style", { type: "text/css" },
52
63
  vanillaStyle,
@@ -54,6 +65,5 @@ export function ReferralCodesView(props) {
54
65
  h("div", { class: sheet.classes.HeaderContainer },
55
66
  h("h2", { class: sheet.classes.TitleText }, titleText),
56
67
  slots.pagination),
57
- h("div", { class: sheet.classes.ShareCodeContainer }, slots.shareCodes),
58
- h("div", { class: sheet.classes.ShareButtonContainer }, slots.shareButtons)));
68
+ getSlotContent(states)));
59
69
  }
@@ -29,6 +29,8 @@ export class ReferralCodes {
29
29
  shareButtons: h("slot", { name: "shareButtons" }),
30
30
  shareCodes: h("slot", { name: "shareCodes" }),
31
31
  pagination: h("slot", { name: "pagination" }),
32
+ empty: h(EmptySlot, null),
33
+ loading: h(LoadingSlot, null),
32
34
  };
33
35
  const viewProps = {
34
36
  slots,
@@ -67,7 +69,7 @@ export class ReferralCodes {
67
69
  "mutable": false,
68
70
  "complexType": {
69
71
  "original": "DemoData<ReferralCodesViewProps>",
70
- "resolved": "{ slots?: { shareButtons: VNode; shareCodes: VNode; pagination: VNode; }; loading?: boolean; titleText?: string; noCodes?: boolean; }",
72
+ "resolved": "{ states?: { noCodes: boolean; loading: boolean; }; slots?: { shareButtons: VNode; shareCodes: VNode; pagination: VNode; empty: VNode; loading: VNode; }; titleText?: string; }",
71
73
  "references": {
72
74
  "DemoData": {
73
75
  "location": "import",
@@ -94,6 +96,20 @@ export class ReferralCodes {
94
96
  }
95
97
  }; }
96
98
  }
99
+ function EmptySlot() {
100
+ return (h("slot", { name: "empty" },
101
+ h("sqm-empty", { emptyStateHeader: "Your new codes and links aren\u2019t ready yet", emptyStateText: "Please contact our program support team to let them know you\u2019re out of codes." })));
102
+ }
103
+ function LoadingSlot() {
104
+ return (h("slot", { name: "loading" },
105
+ h(LoadingRow, null),
106
+ h(LoadingRow, null),
107
+ h(LoadingRow, null),
108
+ h(LoadingRow, null)));
109
+ }
110
+ function LoadingRow() {
111
+ return h("sl-skeleton", { style: { width: "100%" } });
112
+ }
97
113
  function useDemoReferralCodes(props) {
98
114
  return deepmerge({
99
115
  titleText: props.titleText,
@@ -49,8 +49,12 @@ const GET_REFERRAL_CODES = gql `
49
49
  `;
50
50
  export const REFERRAL_CODES_NAMESPACE = "sq:referral-codes";
51
51
  export const REFERRAL_CODES_PAGINATION_CONTEXT = "sq:referral-codes-pagination";
52
- export const SET_CODE_USED = gql `
53
- mutation test {}
52
+ export const SET_CODE_COPIED = gql `
53
+ mutation markReferralCodeCopied($referralCode: String!) {
54
+ markReferralCodeCopied(referralCode: $referralCode) {
55
+ referralCode
56
+ }
57
+ }
54
58
  `;
55
59
  export function useReferralCodes(props) {
56
60
  const user = useUserIdentity();
@@ -74,6 +78,8 @@ export function useReferralCodes(props) {
74
78
  loading: true,
75
79
  referralCode: "",
76
80
  shareLink: "",
81
+ isCopied: false,
82
+ isUsed: false,
77
83
  email: {
78
84
  messageLink: "",
79
85
  },
@@ -90,6 +96,8 @@ export function useReferralCodes(props) {
90
96
  const data = referralData.data[0];
91
97
  setReferralCodesContext({
92
98
  referralCode: data.code,
99
+ isCopied: !!data.dateCopied,
100
+ isUsed: !!data.dateUsed,
93
101
  shareLink: (_d = (_c = (_b = data.shareLinkCodes) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.direct,
94
102
  email: {
95
103
  messageLink: (_g = (_f = (_e = data.shareLinkCodes) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.email,
@@ -1,7 +1,7 @@
1
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, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_COPIED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query (
7
7
  $programId: ID
@@ -67,7 +67,7 @@ export function useShareButton(props) {
67
67
  const overrideData = data === null || data === void 0 ? void 0 : data[medium];
68
68
  // only queries if a programId is available
69
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);
70
+ const [setCopied, copiedRes] = useMutation(SET_CODE_COPIED);
71
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);
72
72
  const environment = getEnvironmentSDK();
73
73
  const hide = (medium.toLocaleUpperCase() === "SMS" &&
@@ -76,7 +76,7 @@ export function useShareButton(props) {
76
76
  function onClick() {
77
77
  var _a, _b, _c, _d;
78
78
  if (overrideData) {
79
- setUsed(true);
79
+ setCopied(overrideData === null || overrideData === void 0 ? void 0 : overrideData.referralCode);
80
80
  }
81
81
  if (medium.toLocaleUpperCase() === "FACEBOOK" &&
82
82
  environment.type === "SquatchAndroid") {
@@ -210,7 +210,7 @@ export class ShareCode {
210
210
  "mutable": false,
211
211
  "complexType": {
212
212
  "original": "DemoData<CopyTextViewProps>",
213
- "resolved": "{ loading?: boolean; copyString?: string; tooltiptext?: string; open?: boolean; copyButtonLabel?: string; disabled?: boolean; textAlign?: \"left\" | \"right\" | \"center\"; buttonStyle?: \"icon\" | \"button-outside\" | \"button-below\"; error?: boolean; errorText?: string; notificationText?: string; showNotificationText?: boolean; inputPlaceholderText?: string; dateAvailable?: string; onClick?: () => void; }",
213
+ "resolved": "{ loading?: boolean; copyString?: string; tooltiptext?: string; open?: boolean; copyButtonLabel?: string; disabled?: boolean; textAlign?: \"left\" | \"right\" | \"center\"; buttonStyle?: \"icon\" | \"button-outside\" | \"button-below\"; error?: boolean; errorText?: string; notificationText?: string; showNotificationText?: boolean; inputPlaceholderText?: string; dateAvailable?: string; isCopied?: boolean; onClick?: () => void; }",
214
214
  "references": {
215
215
  "DemoData": {
216
216
  "location": "import",
@@ -210,7 +210,7 @@ export class ShareLink {
210
210
  "mutable": false,
211
211
  "complexType": {
212
212
  "original": "DemoData<CopyTextViewProps>",
213
- "resolved": "{ loading?: boolean; copyString?: string; tooltiptext?: string; open?: boolean; copyButtonLabel?: string; disabled?: boolean; textAlign?: \"left\" | \"right\" | \"center\"; buttonStyle?: \"icon\" | \"button-outside\" | \"button-below\"; error?: boolean; errorText?: string; notificationText?: string; showNotificationText?: boolean; inputPlaceholderText?: string; dateAvailable?: string; onClick?: () => void; }",
213
+ "resolved": "{ loading?: boolean; copyString?: string; tooltiptext?: string; open?: boolean; copyButtonLabel?: string; disabled?: boolean; textAlign?: \"left\" | \"right\" | \"center\"; buttonStyle?: \"icon\" | \"button-outside\" | \"button-below\"; error?: boolean; errorText?: string; notificationText?: string; showNotificationText?: boolean; inputPlaceholderText?: string; dateAvailable?: string; isCopied?: boolean; onClick?: () => void; }",
214
214
  "references": {
215
215
  "DemoData": {
216
216
  "location": "import",
@@ -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, SET_CODE_USED, } from "../sqm-referral-codes/useReferralCodes";
4
+ import { REFERRAL_CODES_NAMESPACE, SET_CODE_COPIED, } from "../sqm-referral-codes/useReferralCodes";
5
5
  const MessageLinkQuery = gql `
6
6
  query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
7
7
  user: viewer {
@@ -28,14 +28,14 @@ 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
+ const [setCopied, copiedRes] = useMutation(SET_CODE_COPIED);
32
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 :
33
33
  // Shown during loading
34
34
  "...";
35
35
  const [open, setOpen] = useState(false);
36
36
  function onClick() {
37
37
  if (contextData) {
38
- setUsed(true);
38
+ setCopied(contextData.referralCode);
39
39
  }
40
40
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
41
41
  // Only if called from a user-initiated event
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
- import { createStyleSheet } from "../../styling/JSS";
3
2
  import { HostBlock } from "../../global/mixins";
3
+ import { createStyleSheet } from "../../styling/JSS";
4
4
  const style = {
5
5
  HostBlock: HostBlock,
6
6
  inputStyle: {
@@ -86,5 +86,7 @@ export function CopyTextView(props) {
86
86
  error && (h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
87
87
  (buttonStyle === "button-outside" || buttonStyle === "button-below") &&
88
88
  copyButton),
89
- props.showNotificationText && props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
89
+ props.isCopied &&
90
+ props.showNotificationText &&
91
+ props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
90
92
  }
@@ -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, S as SET_CODE_USED, C as CopyTextView } from './copy-text-view-fef437c3.js';
7
+ import { a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_COPIED, C as CopyTextView } from './copy-text-view-5e472643.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,14 +379,14 @@ 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
+ const [setCopied, copiedRes] = $e(SET_CODE_COPIED);
383
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 :
384
384
  // Shown during loading
385
385
  "...";
386
386
  const [open, setOpen] = useState(false);
387
387
  function onClick() {
388
388
  if (contextData) {
389
- setUsed(true);
389
+ setCopied(contextData.referralCode);
390
390
  }
391
391
  // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
392
392
  // Only if called from a user-initiated event
@@ -474,7 +474,7 @@ function useShareButton(props) {
474
474
  const overrideData = data === null || data === void 0 ? void 0 : data[medium];
475
475
  // only queries if a programId is available
476
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);
477
+ const [setCopied, copiedRes] = $e(SET_CODE_COPIED);
478
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);
479
479
  const environment = getEnvironmentSDK();
480
480
  const hide = (medium.toLocaleUpperCase() === "SMS" &&
@@ -483,7 +483,7 @@ function useShareButton(props) {
483
483
  function onClick() {
484
484
  var _a, _b, _c, _d;
485
485
  if (overrideData) {
486
- setUsed(true);
486
+ setCopied(overrideData === null || overrideData === void 0 ? void 0 : overrideData.referralCode);
487
487
  }
488
488
  if (medium.toLocaleUpperCase() === "FACEBOOK" &&
489
489
  environment.type === "SquatchAndroid") {
@@ -52,8 +52,12 @@ const GET_REFERRAL_CODES = dist.gql `
52
52
  `;
53
53
  const REFERRAL_CODES_NAMESPACE = "sq:referral-codes";
54
54
  const REFERRAL_CODES_PAGINATION_CONTEXT = "sq:referral-codes-pagination";
55
- const SET_CODE_USED = dist.gql `
56
- mutation test {}
55
+ const SET_CODE_COPIED = dist.gql `
56
+ mutation markReferralCodeCopied($referralCode: String!) {
57
+ markReferralCodeCopied(referralCode: $referralCode) {
58
+ referralCode
59
+ }
60
+ }
57
61
  `;
58
62
  function useReferralCodes(props) {
59
63
  const user = Q();
@@ -77,6 +81,8 @@ function useReferralCodes(props) {
77
81
  loading: true,
78
82
  referralCode: "",
79
83
  shareLink: "",
84
+ isCopied: false,
85
+ isUsed: false,
80
86
  email: {
81
87
  messageLink: "",
82
88
  },
@@ -93,6 +99,8 @@ function useReferralCodes(props) {
93
99
  const data = referralData.data[0];
94
100
  setReferralCodesContext({
95
101
  referralCode: data.code,
102
+ isCopied: !!data.dateCopied,
103
+ isUsed: !!data.dateUsed,
96
104
  shareLink: (_d = (_c = (_b = data.shareLinkCodes) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.direct,
97
105
  email: {
98
106
  messageLink: (_g = (_f = (_e = data.shareLinkCodes) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.email,
@@ -207,7 +215,9 @@ function CopyTextView(props) {
207
215
  error && (h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
208
216
  (buttonStyle === "button-outside" || buttonStyle === "button-below") &&
209
217
  copyButton),
210
- props.showNotificationText && props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
218
+ props.isCopied &&
219
+ props.showNotificationText &&
220
+ props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
211
221
  }
212
222
 
213
- export { CopyTextView as C, REFERRAL_CODES_PAGINATION_CONTEXT as R, SET_CODE_USED as S, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };
223
+ export { CopyTextView as C, REFERRAL_CODES_PAGINATION_CONTEXT as R, SET_CODE_COPIED as S, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };