@saasquatch/mint-components 1.13.5 → 1.15.0-0

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 (92) hide show
  1. package/dist/cjs/ErrorView-b2fcf954.js +35 -0
  2. package/dist/cjs/{ShadowViewAddon-14a02da4.js → ShadowViewAddon-787391f7.js} +6 -5
  3. package/dist/cjs/copy-text-view-c85acaaa.js +96 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mint-components.cjs.js +1 -1
  6. package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +3 -2
  7. package/dist/cjs/sqm-big-stat_41.cjs.entry.js +3 -2
  8. package/dist/cjs/{sqm-invoice-table-view-baded4af.js → sqm-invoice-table-view-16ac73d0.js} +2 -31
  9. package/dist/cjs/sqm-pagination_3.cjs.entry.js +6 -5
  10. package/dist/cjs/sqm-qr-code-view-15dfc0b6.js +103 -0
  11. package/dist/cjs/sqm-qr-code.cjs.entry.js +207 -0
  12. package/dist/cjs/sqm-stencilbook.cjs.entry.js +68 -5
  13. package/dist/cjs/{copy-text-view-a5524c20.js → useReferralCodes-82e8797b.js} +0 -93
  14. package/dist/collection/collection-manifest.json +1 -0
  15. package/dist/collection/components/sqm-card-feed/sqm-card-feed.js +2 -0
  16. package/dist/collection/components/sqm-qr-code/QRCode.stories.js +47 -0
  17. package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +98 -0
  18. package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +293 -0
  19. package/dist/collection/components/sqm-qr-code/useQRCode.js +124 -0
  20. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  21. package/dist/esm/ErrorView-48e2b969.js +33 -0
  22. package/dist/esm/{ShadowViewAddon-23a6afab.js → ShadowViewAddon-cf230f50.js} +2 -1
  23. package/dist/esm/copy-text-view-782137ba.js +94 -0
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/esm/mint-components.js +1 -1
  26. package/dist/esm/sqm-banking-info-form_17.entry.js +2 -1
  27. package/dist/esm/sqm-big-stat_41.entry.js +3 -2
  28. package/dist/esm/{sqm-invoice-table-view-af69cd33.js → sqm-invoice-table-view-2c726568.js} +2 -30
  29. package/dist/esm/sqm-pagination_3.entry.js +2 -1
  30. package/dist/esm/sqm-qr-code-view-f1d0763b.js +101 -0
  31. package/dist/esm/sqm-qr-code.entry.js +203 -0
  32. package/dist/esm/sqm-stencilbook.entry.js +68 -5
  33. package/dist/esm/{copy-text-view-459a2e35.js → useReferralCodes-8f75921a.js} +1 -93
  34. package/dist/esm-es5/ErrorView-48e2b969.js +1 -0
  35. package/dist/esm-es5/ShadowViewAddon-cf230f50.js +1 -0
  36. package/dist/esm-es5/copy-text-view-782137ba.js +1 -0
  37. package/dist/esm-es5/loader.js +1 -1
  38. package/dist/esm-es5/mint-components.js +1 -1
  39. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
  40. package/dist/esm-es5/sqm-big-stat_41.entry.js +1 -1
  41. package/dist/esm-es5/sqm-invoice-table-view-2c726568.js +1 -0
  42. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  43. package/dist/esm-es5/sqm-qr-code-view-f1d0763b.js +1 -0
  44. package/dist/esm-es5/sqm-qr-code.entry.js +1 -0
  45. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  46. package/dist/esm-es5/useReferralCodes-8f75921a.js +1 -0
  47. package/dist/mint-components/mint-components.esm.js +1 -1
  48. package/dist/mint-components/p-0c78815e.system.entry.js +1 -0
  49. package/dist/mint-components/{p-01010af0.entry.js → p-116baa69.entry.js} +1 -1
  50. package/dist/mint-components/p-1f089c3f.system.entry.js +1 -0
  51. package/dist/mint-components/p-31015791.js +1 -0
  52. package/dist/mint-components/p-37996351.system.js +1 -1
  53. package/dist/mint-components/p-3a62a7e2.system.js +1 -0
  54. package/dist/mint-components/p-3b90e01b.system.js +1 -0
  55. package/dist/mint-components/p-3f067fd5.js +1 -0
  56. package/dist/mint-components/p-3f7b81b8.js +52 -0
  57. package/dist/mint-components/p-4e773bb1.system.entry.js +1 -0
  58. package/dist/mint-components/p-53730ffe.entry.js +17 -0
  59. package/dist/mint-components/p-562428ef.system.js +1 -0
  60. package/dist/mint-components/{p-23ed5e6f.entry.js → p-57eef0af.entry.js} +4 -4
  61. package/dist/mint-components/p-5cb7f9fc.system.entry.js +1 -0
  62. package/dist/mint-components/{p-d3d74266.js → p-6cc141b9.js} +2 -2
  63. package/dist/mint-components/{p-b51e79b3.entry.js → p-7846937e.entry.js} +2 -2
  64. package/dist/mint-components/p-9acb5038.js +1 -0
  65. package/dist/mint-components/p-a7746488.system.js +1 -0
  66. package/dist/mint-components/p-aad32fb6.system.js +1 -0
  67. package/dist/mint-components/p-daee25f9.system.entry.js +1 -0
  68. package/dist/mint-components/p-dbc0e4f8.system.js +1 -0
  69. package/dist/mint-components/{p-ba9b5b20.entry.js → p-ef6381d4.entry.js} +2 -2
  70. package/dist/mint-components/p-f56bedd5.js +1 -0
  71. package/dist/types/components/sqm-card-feed/sqm-card-feed.d.ts +2 -0
  72. package/dist/types/components/sqm-qr-code/QRCode.stories.d.ts +12 -0
  73. package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +15 -0
  74. package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +52 -0
  75. package/dist/types/components/sqm-qr-code/useQRCode.d.ts +3 -0
  76. package/dist/types/components.d.ts +94 -0
  77. package/docs/docs.docx +0 -0
  78. package/docs/raisins.json +1 -1
  79. package/grapesjs/grapesjs.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/esm-es5/ShadowViewAddon-23a6afab.js +0 -1
  82. package/dist/esm-es5/copy-text-view-459a2e35.js +0 -1
  83. package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +0 -1
  84. package/dist/mint-components/p-33ed6f1c.system.entry.js +0 -1
  85. package/dist/mint-components/p-717cc8ac.system.js +0 -1
  86. package/dist/mint-components/p-71bc04d2.system.entry.js +0 -1
  87. package/dist/mint-components/p-7e7cbccf.system.js +0 -1
  88. package/dist/mint-components/p-7f2d4212.js +0 -52
  89. package/dist/mint-components/p-8da00a59.system.entry.js +0 -1
  90. package/dist/mint-components/p-8f8245da.system.entry.js +0 -1
  91. package/dist/mint-components/p-9320582e.system.js +0 -1
  92. package/dist/mint-components/p-962f3200.js +0 -1
@@ -0,0 +1,203 @@
1
+ import { r as registerInstance, h as h$1 } from './index-91e7729f.js';
2
+ import { k as useState, f as useEffect, n as h } from './stencil-hooks.module-4bc38af4.js';
3
+ import { d as dist, H, J, F as Fn, w as wn, $ as $e, B, i as isDemo } from './index.module-89a79f66.js';
4
+ import { c as cjs } from './cjs-bdfb4486.js';
5
+ import { g as getProps } from './utils-334c1e34.js';
6
+ import './JSS-67b5cff8.js';
7
+ import { a as REFERRAL_CODES_NAMESPACE } from './useReferralCodes-8f75921a.js';
8
+ import './ErrorView-48e2b969.js';
9
+ import { Q as QrCodeView } from './sqm-qr-code-view-f1d0763b.js';
10
+
11
+ const ShareLinkQuery = dist.gql `
12
+ query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {
13
+ user: viewer {
14
+ ... on User {
15
+ shareLink(
16
+ programId: $programId
17
+ engagementMedium: $engagementMedium
18
+ shareMedium: DIRECT
19
+ )
20
+ }
21
+ }
22
+ }
23
+ `;
24
+ const WIDGET_ENGAGEMENT_EVENT = dist.gql `
25
+ mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
26
+ createUserAnalyticsEvent(eventMeta: $eventMeta)
27
+ }
28
+ `;
29
+ function useQRCode(props) {
30
+ var _a;
31
+ const programId = H();
32
+ const user = J();
33
+ const engagementMedium = B();
34
+ const contextData = Fn(REFERRAL_CODES_NAMESPACE);
35
+ const [qrLink, setQrUrl] = useState(null);
36
+ const [error, setError] = useState(false);
37
+ const [loading, setLoading] = useState(false);
38
+ const { data, errors, loading: requestLoading, } = wn(ShareLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
39
+ const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
40
+ const shareLink = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink;
41
+ const qrPrefix = `${shareLink}?qrCode`;
42
+ const completeLoading = requestLoading || loading;
43
+ useEffect(() => {
44
+ if (!shareLink)
45
+ return;
46
+ const getQrCode = async () => {
47
+ setLoading(true);
48
+ try {
49
+ const res = await fetch(`${shareLink}?qrCode&qrCodeImageFormat=svg&qrCodeQuietZoneSize=0`);
50
+ const blob = await res.blob();
51
+ const url = URL.createObjectURL(blob);
52
+ setQrUrl(url);
53
+ }
54
+ catch (e) {
55
+ setError(true);
56
+ }
57
+ finally {
58
+ setLoading(false);
59
+ }
60
+ };
61
+ getQrCode();
62
+ }, [shareLink]);
63
+ const fireEvent = async () => {
64
+ sendLoadEvent({
65
+ eventMeta: {
66
+ programId,
67
+ id: user === null || user === void 0 ? void 0 : user.id,
68
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
69
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
70
+ meta: {
71
+ engagementMedium,
72
+ shareMedium: "DIRECT",
73
+ },
74
+ },
75
+ });
76
+ };
77
+ const createDownloadable = async () => {
78
+ try {
79
+ const res = await fetch(`${qrPrefix}&qrCodeSize=800&qrCodeImageFormat=png`);
80
+ const blob = await res.blob();
81
+ const url = URL.createObjectURL(blob);
82
+ // Successful
83
+ if (blob)
84
+ fireEvent();
85
+ // Trigger download
86
+ const link = document.createElement("a");
87
+ link.href = url;
88
+ link.download = "qrCode.png";
89
+ document.body.appendChild(link);
90
+ link.click();
91
+ document.body.removeChild(link);
92
+ }
93
+ catch (e) {
94
+ console.error("Failed to fetch QR code:", e);
95
+ setError(true);
96
+ }
97
+ };
98
+ const createPrintable = async () => {
99
+ try {
100
+ const res = await fetch(`${qrPrefix}&qrCodeSize=1000&qrCodeImageFormat=png&qrCodeErrorCorrectionLevel=H`);
101
+ const blob = await res.blob();
102
+ const url = URL.createObjectURL(blob);
103
+ // Successful
104
+ if (blob)
105
+ fireEvent();
106
+ // Trigger print
107
+ const page = window.open("about:blank", "_new");
108
+ const img = page.document.createElement("img");
109
+ img.src = url;
110
+ img.onload = () => {
111
+ page.print();
112
+ page.close();
113
+ };
114
+ page.document.body.appendChild(img);
115
+ }
116
+ catch (e) {
117
+ console.error("Failed to fetch QR code: ", e);
118
+ setError(true);
119
+ }
120
+ };
121
+ return {
122
+ ...props,
123
+ loading: completeLoading,
124
+ qrLink,
125
+ error: error,
126
+ createDownloadable,
127
+ createPrintable,
128
+ };
129
+ }
130
+
131
+ const QrCode = class {
132
+ constructor(hostRef) {
133
+ registerInstance(this, hostRef);
134
+ /**
135
+ * @uiName Title
136
+ */
137
+ this.titleText = "Share your QR code";
138
+ /**
139
+ * @uiName View QR code text
140
+ */
141
+ this.viewCodeText = "View QR code";
142
+ /**
143
+ * @uiName Download QR code text
144
+ */
145
+ this.downloadCodeText = "Download";
146
+ /**
147
+ * @uiName Print QR code text
148
+ */
149
+ this.printCodeText = "Print";
150
+ /**
151
+ * @uiName Header for error banner
152
+ */
153
+ this.errorHeaderText = "There was an error loading your QR code";
154
+ /**
155
+ * @uiName Description for error banner
156
+ */
157
+ this.errorDescriptionText = "Please refresh this page and try again";
158
+ /**
159
+ * @uiName Hide title
160
+ */
161
+ this.hideTitle = false;
162
+ /**
163
+ * @uiName QR code alignment
164
+ * @uiType string
165
+ * @uiEnum ["left", "center", "right"]
166
+ * @uiEnumNames ["Left", "Center", "Right"]
167
+ */
168
+ this.alignment = "center";
169
+ h(this);
170
+ }
171
+ disconnectedCallback() { }
172
+ render() {
173
+ const thisProps = getProps(this);
174
+ const props = isDemo() ? useDemoQRCode(thisProps) : useQRCode(thisProps);
175
+ return h$1(QrCodeView, Object.assign({}, props));
176
+ }
177
+ };
178
+ function useDemoQRCode(props) {
179
+ const [dialogIsOpen, setDialog] = useState(false);
180
+ return cjs({
181
+ dialogIsOpen,
182
+ hideTitle: props.hideTitle,
183
+ showDialog: () => setDialog(true),
184
+ hideDialog: () => setDialog(false),
185
+ titleText: props.titleText,
186
+ viewCodeText: props.viewCodeText,
187
+ downloadCodeText: props.downloadCodeText,
188
+ printCodeText: props.printCodeText,
189
+ alignment: props.alignment,
190
+ qrLink: "https://media.istockphoto.com/id/1251071788/vector/qr-code-bar-code-black-icon-digital-technology.jpg?s=612x612&w=0&k=20&c=maw4OqMSEegAdSo8Drm9HO7i1ddddvP2YaL1UuWbRig=",
191
+ fireViewQrEvent: () => {
192
+ console.log("View QR Code clicked");
193
+ },
194
+ createDownloadable: async () => {
195
+ console.log("Download QR Code clicked");
196
+ },
197
+ createPrintable: async () => {
198
+ console.log("Print QR Code clicked");
199
+ },
200
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
201
+ }
202
+
203
+ export { QrCode as sqm_qr_code };
@@ -5,8 +5,9 @@ import { j as jn, k as kn, b as setUserIdentity, d as dist, X as Xe, p as setPro
5
5
  import './cjs-bdfb4486.js';
6
6
  import './utils-334c1e34.js';
7
7
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
8
- import { C as CopyTextView } from './copy-text-view-459a2e35.js';
8
+ import './useReferralCodes-8f75921a.js';
9
9
  import './mixins-83f90fa1.js';
10
+ import { C as CopyTextView } from './copy-text-view-782137ba.js';
10
11
  import { G as GenericTableView } from './GenericTableView-7b9087af.js';
11
12
  import './useChildElements-7945ae56.js';
12
13
  import { l as luxon } from './luxon-8d51c92b.js';
@@ -28,9 +29,11 @@ import { P as PortalProfileView } from './sqm-portal-profile-view-93003974.js';
28
29
  import './utilities-5b0ca040.js';
29
30
  import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-54a8651f.js';
30
31
  import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-b12cb894.js';
31
- 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 PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i 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-23a6afab.js';
32
+ import './ErrorView-48e2b969.js';
33
+ import { Q as QrCodeView } from './sqm-qr-code-view-f1d0763b.js';
34
+ 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 PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i 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-cf230f50.js';
32
35
  import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-1683ae32.js';
33
- import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-af69cd33.js';
36
+ import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-2c726568.js';
34
37
 
35
38
  /**
36
39
  * lodash (Custom Build) <https://lodash.com/>
@@ -15752,6 +15755,65 @@ const PortalGoogleRegistrationFormStories = /*#__PURE__*/Object.freeze({
15752
15755
  TermsAndConditions: TermsAndConditions$4
15753
15756
  });
15754
15757
 
15758
+ const QRCode_stories = {
15759
+ title: "Components/QR Code",
15760
+ };
15761
+ const defaultProps$s = {
15762
+ hideTitle: false,
15763
+ loading: false,
15764
+ alignment: "center",
15765
+ error: false,
15766
+ qrLink: "https://media.istockphoto.com/id/1251071788/vector/qr-code-bar-code-black-icon-digital-technology.jpg?s=612x612&w=0&k=20&c=maw4OqMSEegAdSo8Drm9HO7i1ddddvP2YaL1UuWbRig=",
15767
+ createDownloadable: async () => {
15768
+ console.log("Download QR Code clicked");
15769
+ },
15770
+ createPrintable: async () => {
15771
+ console.log("Print QR Code clicked");
15772
+ },
15773
+ titleText: "Share your QR code",
15774
+ downloadCodeText: "Download",
15775
+ printCodeText: "Print",
15776
+ errorHeaderText: "There was an error loading your QR code",
15777
+ errorDescriptionText: "Please refresh this page and try again",
15778
+ };
15779
+ const Default$q = () => {
15780
+ return h(QrCodeView, Object.assign({}, defaultProps$s));
15781
+ };
15782
+ const HideTitle = () => {
15783
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { hideTitle: true }));
15784
+ };
15785
+ const LeftAlign$1 = () => {
15786
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { alignment: "left" }));
15787
+ };
15788
+ const CenterAlign = () => {
15789
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { alignment: "center" }));
15790
+ };
15791
+ const RightAlign$1 = () => {
15792
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { alignment: "right" }));
15793
+ };
15794
+ const Loading$c = () => {
15795
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { loading: true }));
15796
+ };
15797
+ const Error$c = () => {
15798
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { error: true }));
15799
+ };
15800
+ const DownloadError = () => {
15801
+ return h(QrCodeView, Object.assign({}, defaultProps$s, { error: true }));
15802
+ };
15803
+
15804
+ const QRCode = /*#__PURE__*/Object.freeze({
15805
+ __proto__: null,
15806
+ 'default': QRCode_stories,
15807
+ Default: Default$q,
15808
+ HideTitle: HideTitle,
15809
+ LeftAlign: LeftAlign$1,
15810
+ CenterAlign: CenterAlign,
15811
+ RightAlign: RightAlign$1,
15812
+ Loading: Loading$c,
15813
+ Error: Error$c,
15814
+ DownloadError: DownloadError
15815
+ });
15816
+
15755
15817
  /**
15756
15818
  *
15757
15819
  * Themes
@@ -15764,7 +15826,7 @@ const PortalGoogleRegistrationFormStories = /*#__PURE__*/Object.freeze({
15764
15826
  *
15765
15827
  */
15766
15828
  //
15767
- const Default$q = `
15829
+ const Default$r = `
15768
15830
  // No CSS
15769
15831
  `;
15770
15832
  const Orangey = `
@@ -15798,7 +15860,7 @@ const Klip = `
15798
15860
 
15799
15861
  const Themes = /*#__PURE__*/Object.freeze({
15800
15862
  __proto__: null,
15801
- Default: Default$q,
15863
+ Default: Default$r,
15802
15864
  Orangey: Orangey,
15803
15865
  Netflix: Netflix,
15804
15866
  SaaSquatchCorporate: SaaSquatchCorporate,
@@ -18488,6 +18550,7 @@ const stories = [
18488
18550
  WidgetCodeVerification,
18489
18551
  PayoutButtonScroll,
18490
18552
  PayoutStatusAlert,
18553
+ QRCode,
18491
18554
  ];
18492
18555
  const StencilStorybook = class {
18493
18556
  constructor(hostRef) {
@@ -1,8 +1,5 @@
1
- import { h } from './index-91e7729f.js';
2
1
  import { f as useEffect } from './stencil-hooks.module-4bc38af4.js';
3
2
  import { d as dist, J, H, Q as Qe, R as Rn, I as In, B } from './index.module-89a79f66.js';
4
- import { c as createStyleSheet } from './JSS-67b5cff8.js';
5
- import { H as HostBlock } from './mixins-83f90fa1.js';
6
3
 
7
4
  const GET_REFERRAL_CODES = dist.gql `
8
5
  query getCodes(
@@ -133,93 +130,4 @@ function useReferralCodes(props) {
133
130
  };
134
131
  }
135
132
 
136
- const style = {
137
- HostBlock: HostBlock,
138
- inputStyle: {
139
- "&::part(input)": { textOverflow: "ellipsis", width: "100%" },
140
- "&::part(base)": { cursor: "pointer", overflow: "visible" },
141
- width: "100%",
142
- },
143
- inputErrorStyle: {
144
- "&::part(base)": {
145
- border: "2px solid red",
146
- },
147
- },
148
- ContainerDiv: {
149
- display: "flex",
150
- alignItems: "flex-start",
151
- flexDirection: "column",
152
- justifyContent: "center",
153
- gap: "var(--sl-spacing-x-small)",
154
- width: "100%",
155
- },
156
- containerStyle: {
157
- display: "flex",
158
- alignItems: "center",
159
- gap: "var(--sl-spacing-x-small)",
160
- width: "100%",
161
- },
162
- errorTextStyle: {
163
- margin: "0",
164
- color: "var(--sl-color-danger-500)",
165
- },
166
- notificationTextStyle: {
167
- margin: "0",
168
- color: "var(--sl-color-neutral-500)",
169
- },
170
- };
171
- const vanillaStyle = `
172
- :host{
173
- display: block;
174
- width: 100%;
175
- }
176
- `;
177
- const textAlignStyle = {
178
- right: `
179
- sl-input::part(input){
180
- text-align: right;
181
- }`,
182
- center: `
183
- sl-input::part(input){
184
- text-align: center;
185
- }`,
186
- left: ``,
187
- };
188
- const disabledStyles = `
189
- sl-input::part(input){
190
- cursor: default;
191
- }
192
- `;
193
- const sheet = createStyleSheet(style);
194
- const styleString = sheet.toString();
195
- function CopyTextView(props) {
196
- const { buttonStyle = "icon" } = props;
197
- const error = !props.loading && props.error;
198
- const inputText = error ? props.inputPlaceholderText : props.copyString;
199
- const disabled = error || props.loading || props.disabled;
200
- const tooltipPlacement = props.buttonStyle === "button-below"
201
- ? "bottom"
202
- : props.buttonStyle === "button-outside"
203
- ? "top"
204
- : "top-end";
205
- const copyButton = (h("sl-tooltip", { trigger: "manual", content: props.tooltiptext, placement: tooltipPlacement, disabled: props.disabled, open: props.open, skidding: props.buttonStyle === "icon" ? -5 : 0, slot: "suffix" }, buttonStyle === "icon" ? (h("sl-icon-button", { exportparts: "base: icon-button-base", onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, name: "files", disabled: disabled })) : (h("sl-button", { exportparts: "base: copy-button-base", onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, size: "medium", style: { width: `${buttonStyle === "button-below" && "100%"}` }, disabled: disabled, type: "primary" }, props.copyButtonLabel || "Copy"))));
206
- return (h("div", { class: sheet.classes.ContainerDiv },
207
- h("style", { type: "text/css" },
208
- styleString,
209
- vanillaStyle,
210
- textAlignStyle[props.textAlign],
211
- disabled && disabledStyles),
212
- h("div", { class: sheet.classes.containerStyle, style: {
213
- flexDirection: `${buttonStyle === "button-below" ? "column" : "row"}`,
214
- } },
215
- h("sl-input", { class: `${sheet.classes.inputStyle} ${error ? sheet.classes.inputErrorStyle : ""}`, exportparts: "base: input-base, input: input-label", value: props.loading ? "Loading..." : inputText, readonly: true, disabled: disabled },
216
- buttonStyle === "icon" && copyButton,
217
- error && (h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
218
- (buttonStyle === "button-outside" || buttonStyle === "button-below") &&
219
- copyButton),
220
- props.isCopied &&
221
- props.showNotificationText &&
222
- props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
223
- }
224
-
225
- export { CopyTextView as C, REFERRAL_CODES_PAGINATION_CONTEXT as R, SET_CODE_COPIED as S, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };
133
+ export { REFERRAL_CODES_PAGINATION_CONTEXT as R, SET_CODE_COPIED as S, REFERRAL_CODES_NAMESPACE as a, useReferralCodes as u };
@@ -0,0 +1 @@
1
+ import{h}from"./index-91e7729f.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";var styles={Alert:{"&::part(base)":{backgroundColor:"var(--sl-color-danger-100)",border:"1px solid var(--sl-color-danger-200)",padding:"0 16px"},"& sl-icon":{margin:0},"& sl-icon::part(base)":{color:"var(--sl-color-danger-500)",margin:0}}};var ErrorView=function(r){var e=createStyleSheet(styles);var o=e.toString();var a=e.classes;return h("div",null,h("style",null,o),h("sl-alert",{exportparts:"base: alert-base, icon:alert-icon",type:"danger",open:true,class:a.Alert},h("sl-icon",{slot:"icon",name:"exclamation-octagon",class:"Error"}),h("strong",null,r.loadingErrorAlertHeader),h("br",null),r.loadingErrorAlertDescription))};export{ErrorView as E};