@saasquatch/mint-components 1.13.2 → 1.13.3-10
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.
- package/dist/cjs/ErrorView-b2fcf954.js +35 -0
- package/dist/cjs/{ShadowViewAddon-cf0ee0a0.js → ShadowViewAddon-3ddee92b.js} +6 -5
- package/dist/cjs/copy-text-view-c85acaaa.js +96 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +3 -2
- package/dist/cjs/sqm-big-stat_39.cjs.entry.js +3 -2
- package/dist/cjs/{sqm-invoice-table-view-baded4af.js → sqm-invoice-table-view-16ac73d0.js} +2 -31
- package/dist/cjs/sqm-pagination_3.cjs.entry.js +6 -5
- package/dist/cjs/sqm-qr-code-view-3f30d2cd.js +94 -0
- package/dist/cjs/sqm-qr-code.cjs.entry.js +199 -0
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +55 -6
- package/dist/cjs/{copy-text-view-a5524c20.js → useReferralCodes-82e8797b.js} +0 -93
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sqm-qr-code/QRCode.stories.js +37 -0
- package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +89 -0
- package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +229 -0
- package/dist/collection/components/sqm-qr-code/useQRCode.js +129 -0
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/esm/ErrorView-48e2b969.js +33 -0
- package/dist/esm/{ShadowViewAddon-fd07e6e1.js → ShadowViewAddon-499b1f86.js} +2 -1
- package/dist/esm/copy-text-view-782137ba.js +94 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_17.entry.js +2 -1
- package/dist/esm/sqm-big-stat_39.entry.js +3 -2
- package/dist/esm/{sqm-invoice-table-view-af69cd33.js → sqm-invoice-table-view-2c726568.js} +2 -30
- package/dist/esm/sqm-pagination_3.entry.js +2 -1
- package/dist/esm/sqm-qr-code-view-7c441329.js +92 -0
- package/dist/esm/sqm-qr-code.entry.js +195 -0
- package/dist/esm/sqm-stencilbook.entry.js +55 -6
- package/dist/esm/{copy-text-view-459a2e35.js → useReferralCodes-8f75921a.js} +1 -93
- package/dist/esm-es5/ErrorView-48e2b969.js +1 -0
- package/dist/esm-es5/ShadowViewAddon-499b1f86.js +1 -0
- package/dist/esm-es5/copy-text-view-782137ba.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-2c726568.js +1 -0
- package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
- package/dist/esm-es5/sqm-qr-code-view-7c441329.js +1 -0
- package/dist/esm-es5/sqm-qr-code.entry.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/useReferralCodes-8f75921a.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-f29eda2f.entry.js → p-012af236.entry.js} +4 -4
- package/dist/mint-components/p-06267664.system.js +1 -0
- package/dist/mint-components/p-31015791.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-3a62a7e2.system.js +1 -0
- package/dist/mint-components/p-3b90e01b.system.js +1 -0
- package/dist/mint-components/p-3f067fd5.js +1 -0
- package/dist/mint-components/p-3f7b81b8.js +52 -0
- package/dist/mint-components/p-45e82465.entry.js +17 -0
- package/dist/mint-components/p-5afd7e38.system.entry.js +1 -0
- package/dist/mint-components/p-5cb7f9fc.system.entry.js +1 -0
- package/dist/mint-components/{p-b51e79b3.entry.js → p-7846937e.entry.js} +2 -2
- package/dist/mint-components/p-97038074.system.entry.js +1 -0
- package/dist/mint-components/p-9acb5038.js +1 -0
- package/dist/mint-components/p-a7746488.system.js +1 -0
- package/dist/mint-components/p-b630683c.system.entry.js +1 -0
- package/dist/mint-components/p-da4ff3b4.system.js +1 -0
- package/dist/mint-components/p-dbc0e4f8.system.js +1 -0
- package/dist/mint-components/p-dfcc0f0e.entry.js +9 -0
- package/dist/mint-components/{p-d12fc50f.js → p-e2d5cd22.js} +20 -20
- package/dist/mint-components/p-e6e2b28b.js +1 -0
- package/dist/mint-components/p-e706440c.system.entry.js +1 -0
- package/dist/mint-components/{p-87d385d8.entry.js → p-f15c1a53.entry.js} +1 -1
- package/dist/types/components/sqm-qr-code/QRCode.stories.d.ts +8 -0
- package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +17 -0
- package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +41 -0
- package/dist/types/components/sqm-qr-code/useQRCode.d.ts +3 -0
- package/dist/types/components.d.ts +72 -0
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-fd07e6e1.js +0 -1
- package/dist/esm-es5/copy-text-view-459a2e35.js +0 -1
- package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +0 -1
- package/dist/mint-components/p-57e2c2fa.system.js +0 -1
- package/dist/mint-components/p-717cc8ac.system.js +0 -1
- package/dist/mint-components/p-71bc04d2.system.entry.js +0 -1
- package/dist/mint-components/p-7f2d4212.js +0 -52
- package/dist/mint-components/p-9320582e.system.js +0 -1
- package/dist/mint-components/p-962f3200.js +0 -1
- package/dist/mint-components/p-abedbbf3.system.entry.js +0 -1
- package/dist/mint-components/p-b93fd99c.system.entry.js +0 -1
- package/dist/mint-components/p-bc83460e.system.entry.js +0 -1
- package/dist/mint-components/p-da932ca2.entry.js +0 -9
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-a29c60ef.js');
|
|
6
|
+
const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
|
|
7
|
+
const index_module = require('./index.module-ee84433d.js');
|
|
8
|
+
const cjs = require('./cjs-1066ec21.js');
|
|
9
|
+
const utils = require('./utils-6847bc06.js');
|
|
10
|
+
require('./JSS-8503a151.js');
|
|
11
|
+
const useReferralCodes = require('./useReferralCodes-82e8797b.js');
|
|
12
|
+
require('./ErrorView-b2fcf954.js');
|
|
13
|
+
const sqmQrCodeView = require('./sqm-qr-code-view-3f30d2cd.js');
|
|
14
|
+
|
|
15
|
+
const ShareLinkQuery = index_module.dist.gql `
|
|
16
|
+
query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {
|
|
17
|
+
user: viewer {
|
|
18
|
+
... on User {
|
|
19
|
+
shareLink(
|
|
20
|
+
programId: $programId
|
|
21
|
+
engagementMedium: $engagementMedium
|
|
22
|
+
shareMedium: DIRECT
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const WIDGET_ENGAGEMENT_EVENT = index_module.dist.gql `
|
|
29
|
+
mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
|
|
30
|
+
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
function useQRCode(props) {
|
|
34
|
+
var _a;
|
|
35
|
+
const programId = index_module.H();
|
|
36
|
+
const user = index_module.J();
|
|
37
|
+
const engagementMedium = index_module.B();
|
|
38
|
+
const contextData = index_module.Fn(useReferralCodes.REFERRAL_CODES_NAMESPACE);
|
|
39
|
+
const [dialogIsOpen, setDialog] = stencilHooks_module.useState(false);
|
|
40
|
+
const [qrLink, setQrUrl] = stencilHooks_module.useState(null);
|
|
41
|
+
const [error, setError] = stencilHooks_module.useState(false);
|
|
42
|
+
const [viewError, setViewError] = stencilHooks_module.useState(false);
|
|
43
|
+
const { data, errors } = index_module.wn(ShareLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
|
|
44
|
+
const [sendLoadEvent] = index_module.$e(WIDGET_ENGAGEMENT_EVENT);
|
|
45
|
+
const shareLink = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink;
|
|
46
|
+
const qrPrefix = `${shareLink}?qrCode`;
|
|
47
|
+
stencilHooks_module.useEffect(() => {
|
|
48
|
+
if (!shareLink)
|
|
49
|
+
return;
|
|
50
|
+
const getQrCode = async () => {
|
|
51
|
+
try {
|
|
52
|
+
const res = await fetch(`${shareLink}?qrCode&qrCodeImageFormat=svg`);
|
|
53
|
+
const blob = await res.blob();
|
|
54
|
+
const url = URL.createObjectURL(blob);
|
|
55
|
+
setQrUrl(url);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
setViewError(true);
|
|
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
|
+
qrLink,
|
|
124
|
+
dialogIsOpen,
|
|
125
|
+
error: error,
|
|
126
|
+
viewError: viewError || !!(errors === null || errors === void 0 ? void 0 : errors.message),
|
|
127
|
+
showDialog: () => {
|
|
128
|
+
setError(false);
|
|
129
|
+
setDialog(true);
|
|
130
|
+
},
|
|
131
|
+
hideDialog: () => {
|
|
132
|
+
setError(false);
|
|
133
|
+
setDialog(false);
|
|
134
|
+
},
|
|
135
|
+
createDownloadable,
|
|
136
|
+
createPrintable,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const QrCode = class {
|
|
141
|
+
constructor(hostRef) {
|
|
142
|
+
index.registerInstance(this, hostRef);
|
|
143
|
+
/**
|
|
144
|
+
* @uiName Title
|
|
145
|
+
*/
|
|
146
|
+
this.titleText = "Share your QR code";
|
|
147
|
+
/**
|
|
148
|
+
* @uiName View QR code text
|
|
149
|
+
*/
|
|
150
|
+
this.viewCodeText = "View QR code";
|
|
151
|
+
/**
|
|
152
|
+
* @uiName Download QR code text
|
|
153
|
+
*/
|
|
154
|
+
this.downloadCodeText = "Download";
|
|
155
|
+
/**
|
|
156
|
+
* @uiName Print QR code text
|
|
157
|
+
*/
|
|
158
|
+
this.printCodeText = "Print";
|
|
159
|
+
/**
|
|
160
|
+
* @uiName Header for error banner
|
|
161
|
+
*/
|
|
162
|
+
this.errorHeaderText = "There was an error loading your QR code";
|
|
163
|
+
/**
|
|
164
|
+
* @uiName Description for error banner
|
|
165
|
+
*/
|
|
166
|
+
this.errorDescriptionText = "Please refresh this page and try again";
|
|
167
|
+
stencilHooks_module.h$1(this);
|
|
168
|
+
}
|
|
169
|
+
disconnectedCallback() { }
|
|
170
|
+
render() {
|
|
171
|
+
const thisProps = utils.getProps(this);
|
|
172
|
+
const props = index_module.isDemo() ? useDemoQRCode(thisProps) : useQRCode(thisProps);
|
|
173
|
+
return index.h(sqmQrCodeView.QrCodeView, Object.assign({}, props));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
function useDemoQRCode(props) {
|
|
177
|
+
const [dialogIsOpen, setDialog] = stencilHooks_module.useState(false);
|
|
178
|
+
return cjs.cjs({
|
|
179
|
+
dialogIsOpen,
|
|
180
|
+
showDialog: () => setDialog(true),
|
|
181
|
+
hideDialog: () => setDialog(false),
|
|
182
|
+
titleText: props.titleText,
|
|
183
|
+
viewCodeText: props.viewCodeText,
|
|
184
|
+
downloadCodeText: props.downloadCodeText,
|
|
185
|
+
printCodeText: props.printCodeText,
|
|
186
|
+
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=",
|
|
187
|
+
fireViewQrEvent: () => {
|
|
188
|
+
console.log("View QR Code clicked");
|
|
189
|
+
},
|
|
190
|
+
createDownloadable: async () => {
|
|
191
|
+
console.log("Download QR Code clicked");
|
|
192
|
+
},
|
|
193
|
+
createPrintable: async () => {
|
|
194
|
+
console.log("Print QR Code clicked");
|
|
195
|
+
},
|
|
196
|
+
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
exports.sqm_qr_code = QrCode;
|
|
@@ -9,8 +9,9 @@ const index_module = require('./index.module-ee84433d.js');
|
|
|
9
9
|
require('./cjs-1066ec21.js');
|
|
10
10
|
require('./utils-6847bc06.js');
|
|
11
11
|
const JSS = require('./JSS-8503a151.js');
|
|
12
|
-
|
|
12
|
+
require('./useReferralCodes-82e8797b.js');
|
|
13
13
|
require('./mixins-f7e0377a.js');
|
|
14
|
+
const copyTextView = require('./copy-text-view-c85acaaa.js');
|
|
14
15
|
const GenericTableView = require('./GenericTableView-a9f4ba75.js');
|
|
15
16
|
require('./useChildElements-1b35d945.js');
|
|
16
17
|
const luxon = require('./luxon-2926d85f.js');
|
|
@@ -32,9 +33,11 @@ const sqmPortalProfileView = require('./sqm-portal-profile-view-33164798.js');
|
|
|
32
33
|
require('./utilities-78f5e169.js');
|
|
33
34
|
const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe602822.js');
|
|
34
35
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
|
|
35
|
-
|
|
36
|
+
require('./ErrorView-b2fcf954.js');
|
|
37
|
+
const sqmQrCodeView = require('./sqm-qr-code-view-3f30d2cd.js');
|
|
38
|
+
const ShadowViewAddon = require('./ShadowViewAddon-3ddee92b.js');
|
|
36
39
|
const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
|
|
37
|
-
const sqmInvoiceTableView = require('./sqm-invoice-table-view-
|
|
40
|
+
const sqmInvoiceTableView = require('./sqm-invoice-table-view-16ac73d0.js');
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
43
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -4104,7 +4107,7 @@ const promoCodeReferralWidget = "<sqm-brand brand-color=\"#4225c4\" brand-font=\
|
|
|
4104
4107
|
|
|
4105
4108
|
const loyaltyWidget = "<sqm-brand brand-color=\"#4225c4\" brand-font=\"Nunito Sans\">\n <sqm-portal-container\n direction=\"column\"\n padding=\"small\"\n gap=\"xxxx-large\"\n display=\"grid\"\n max-width=\"100%\"\n background-color=\"#ffffff\"\n >\n <sqm-portal-container\n direction=\"column\"\n padding=\"none\"\n gap=\"xxx-large\"\n display=\"grid\"\n max-width=\"100%\"\n >\n <sqm-hero-image\n image-url=\"https://res.cloudinary.com/saasquatch/image/upload/v1644000275/squatch-assets/yr6ER3R.png\"\n header=\"MyCompany Rewards\"\n description=\"Complete tasks to earn rewards\"\n layout=\"overlay\"\n padding-image=\"xxxx-large\"\n padding-text=\"xxx-large\"\n image-pos=\"center\"\n overlay-color=\"#5e5669\"\n overlay-opacity=\"0.9\"\n >\n </sqm-hero-image>\n <sqm-portal-container\n direction=\"column\"\n padding=\"none\"\n gap=\"xxx-large\"\n max-width=\"770px\"\n center\n display=\"grid\"\n >\n <sqm-program-explainer header=\"How it works\">\n <sqm-program-explainer-step\n description=\"Complete tasks like uploading your first video or sharing videos with friends\"\n header=\"Earn points for using our product\"\n icon=\"cash-stack\"\n text-color=\"#000000\"\n >\n </sqm-program-explainer-step>\n <sqm-program-explainer-step\n description=\"Redeem rewards like one free month of Enterprise or two plane tickets to anywhere in North America\"\n header=\"Redeem rewards with your points\"\n icon=\"people\"\n text-color=\"#000000\"\n >\n </sqm-program-explainer-step>\n </sqm-program-explainer>\n <sqm-portal-container\n center\n direction=\"row\"\n display=\"flex\"\n justify-content=\"space-between\"\n gap=\"xxx-large\"\n max-width=\"100%\"\n padding=\"none\"\n >\n <sqm-stat-container space=\"xxx-large\" display=\"flex\">\n <sqm-big-stat\n flex-reverse=\"true\"\n alignment=\"left\"\n stat-type=\"/rewardsRedeemed/CREDIT/POINTS\"\n >\n <p>Points Redeemed</p>\n </sqm-big-stat>\n <sqm-big-stat\n flex-reverse=\"true\"\n alignment=\"left\"\n stat-type=\"/rewardBalance/CREDIT/POINT/value/global\"\n >\n <p>Points Balance</p>\n </sqm-big-stat>\n </sqm-stat-container>\n </sqm-portal-container>\n <sqm-portal-container\n direction=\"column\"\n padding=\"none\"\n gap=\"xx-large\"\n display=\"grid\"\n max-width=\"100%\"\n >\n <sqm-titled-section\n label-margin=\"small\"\n padding=\"none\"\n text-align=\"center\"\n >\n <h3 slot=\"label\">Earn points</h3>\n </sqm-titled-section>\n <sqm-card-feed gap=\"24\" width=\"347\">\n <sqm-task-card\n reward-amount=\"20\"\n goal=\"1\"\n card-title=\"Complete a Survey\"\n description=\"Fill out our NPS survey and get 20 points for giving us honest feedback.\"\n button-text=\"Take survey\"\n reward-unit=\"Points\"\n completed-text=\"Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}\"\n ended-message=\"Ended {endDate}\"\n expiry-message=\"Ends {endDate}\"\n finite=\"0\"\n starts-on-message=\"Starts {startDate}\"\n >\n </sqm-task-card>\n <sqm-task-card\n reward-amount=\"250\"\n goal=\"500\"\n show-progress-bar\n card-title=\"Spend $500\"\n description=\"Earn 250 points when you spend $500 or more.\"\n button-text=\"See plans\"\n completed-text=\"Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}\"\n ended-message=\"Ended {endDate}\"\n expiry-message=\"Ends {endDate}\"\n progress-bar-unit=\"$\"\n finite=\"0\"\n reward-unit=\"Points\"\n starts-on-message=\"Starts {startDate}\"\n >\n </sqm-task-card>\n <sqm-task-card\n goal=\"1\"\n reward-amount=\"50\"\n card-title=\"Follow Us on X\"\n description=\"Earn 50 points when you Follow Us on X!\"\n button-text=\"Follow\"\n button-link=\"https://twitter.com/\"\n open-new-tab=\"true\"\n event-key=\"socialFollow\"\n completed-text=\"Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}\"\n ended-message=\"Ended {endDate}\"\n expiry-message=\"Ends {endDate}\"\n finite=\"0\"\n reward-unit=\"Points\"\n starts-on-message=\"Starts {startDate}\"\n >\n </sqm-task-card>\n <sqm-task-card\n reward-amount=\"1\"\n reward-unit=\"Free Month\"\n goal=\"1\"\n card-title=\"Upgrade Your Plan\"\n description=\"Receive one free month for being a committed customer when you upgrade your plan.\"\n button-text=\"Upgrade\"\n completed-text=\"Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}\"\n ended-message=\"Ended {endDate}\"\n expiry-message=\"Ends {endDate}\"\n open-new-tab=\"false\"\n finite=\"0\"\n starts-on-message=\"Starts {startDate}\"\n >\n </sqm-task-card>\n </sqm-card-feed>\n <sqm-portal-container\n gap=\"large\"\n direction=\"column\"\n display=\"grid\"\n max-width=\"100%\"\n padding=\"none\"\n >\n <sqm-titled-section\n padding=\"none\"\n text-align=\"center\"\n label-margin=\"xx-small\"\n >\n <h3 slot=\"label\">Reward History</h3>\n </sqm-titled-section>\n <sqm-rewards-table\n per-page=\"4\"\n hidden-columns=\"0\"\n more-label=\"Next\"\n prev-label=\"Prev\"\n sm-breakpoint=\"599\"\n md-breakpoint=\"799\"\n >\n <sqm-rewards-table-reward-column\n available-text=\"{availableAmount} remaining\"\n column-title=\"Reward\"\n copy-text=\"Copied!\"\n redeemed-text=\"{redeemedAmount} redeemed\"\n >\n </sqm-rewards-table-reward-column>\n <sqm-rewards-table-source-column\n anonymous-user=\"Anonymous User\"\n column-title=\"Source\"\n deleted-user=\"Deleted User\"\n referral-text=\"{rewardSource, select, FRIEND_SIGNUP {Referral to} REFERRED {Referred by} other {}}\"\n reward-exchange-text=\"Reward Exchange\"\n reward-source-text=\"{rewardSource, select, MANUAL {Manual} AUTOMATED {{programName}} other {}}\"\n >\n </sqm-rewards-table-source-column>\n <sqm-rewards-table-status-column\n column-title=\"Status\"\n expiry-text=\"Expires on \"\n status-text=\"{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} EXPIRED {Expired} REDEEMED {Redeemed} other {Not available} }\"\n >\n </sqm-rewards-table-status-column>\n <sqm-rewards-table-date-column\n column-title=\"Date received\"\n date-shown=\"dateGiven\"\n >\n </sqm-rewards-table-date-column>\n <sqm-empty\n slot=\"empty\"\n empty-state-image=\"https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_reward2.png\"\n empty-state-header=\"View your rewards\"\n empty-state-text=\"Refer friends and complete tasks to view the details of your rewards\"\n >\n </sqm-empty>\n </sqm-rewards-table>\n </sqm-portal-container>\n </sqm-portal-container>\n <sqm-portal-footer\n support-email=\"support@example.com\"\n terms-link=\"https:\\/\\/example.com\"\n faq-link=\"https:\\/\\/example.com\"\n terms-text=\"Terms And Conditions\"\n faq-text=\"FAQ\"\n show-powered-by=\"true\"\n padding-bottom=\"none\"\n padding-left=\"none\"\n padding-right=\"none\"\n padding-top=\"none\"\n ></sqm-portal-footer>\n </sqm-portal-container>\n </sqm-portal-container>\n </sqm-portal-container>\n</sqm-brand>\n";
|
|
4106
4109
|
|
|
4107
|
-
const instantAccessReferrerShareWidget = "<sqm-hero\n background=\"https://res.cloudinary.com/saasquatch/image/upload/v1683589933/Portal%20Assets/Screen-Shot-2022-01-06-at-3.23.58-AM.png\"\n columns=\"2\"\n padding-size=\"medium\"\n wrap-direction=\"wrap\"\n secondary-background=\"#FFFFFF\"\n min-height=\"200\"\n ><sqm-referral-card\n vertical-alignment=\"start\"\n slot=\"secondary-column\"\n padding-bottom=\"small\"\n padding-left=\"x-large\"\n padding-right=\"x-large\"\n padding-top=\"small\"\n >\n <sqm-titled-section\n text-align=\"center\"\n label-margin=\"none\"\n padding=\"none\"\n slot=\"header\"\n ><h1 slot=\"label\">Invite your friends to unlock rewards!</h1>\n <p slot=\"content\">\n They’ll get a $50 credit towards a new account and\n you’ll get a $50 in credit for each friend you refer.\n </p></sqm-titled-section\n >\n <sqm-portal-container\n gap=\"small\"\n direction=\"column\"\n display=\"grid\"\n max-width=\"100%\"\n padding=\"none\"\n slot=\"left\"\n >\n <p style=\"margin: 0\">Choose how you want to share:</p>\n <sqm-share-link\n tooltip-text=\"Copied to Clipboard\"\n tooltip-lifespan=\"1000\"\n >\n </sqm-share-link>\n <sqm-share-button\n medium=\"email\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Share via email\n </sqm-share-button>\n <sqm-share-button\n medium=\"linkedin\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Share on LinkedIn\n </sqm-share-button>\n <sqm-share-button\n medium=\"twitter\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Post about us on X\n </sqm-share-button> </sqm-portal-container\n ><sqm-portal-container\n display=\"flex\"\n slot=\"footer\"\n gap=\"small\"\n justify-content=\"center\"\n >\n <sqm-logout-current-user\n user-identification-text=\"{email}\"\n switch-user-link=\"#\"\n switch-user-text=\"not you?\"\n ></sqm-logout-current-user>\n <sqm-portal-footer\n support-email=\"support@example.com\"\n show-powered-by=\"true\"\n padding-bottom=\"x-small\"\n padding-left=\"none\"\n padding-right=\"none\"\n padding-top=\"none\"\n hide-support-text\n terms-text=\"Terms And Conditions\"\n terms-link=\"https://example.com\"\n ></sqm-portal-footer></sqm-portal-container\n ></sqm-referral-card>\n</sqm-hero>\n";
|
|
4110
|
+
const instantAccessReferrerShareWidget = "<sqm-hero\n background=\"https://res.cloudinary.com/saasquatch/image/upload/v1683589933/Portal%20Assets/Screen-Shot-2022-01-06-at-3.23.58-AM.png\"\n columns=\"2\"\n padding-size=\"medium\"\n wrap-direction=\"wrap\"\n secondary-background=\"#FFFFFF\"\n min-height=\"200\"\n ><sqm-referral-card\n vertical-alignment=\"start\"\n slot=\"secondary-column\"\n padding-bottom=\"small\"\n padding-left=\"x-large\"\n padding-right=\"x-large\"\n padding-top=\"small\"\n >\n <sqm-titled-section\n text-align=\"center\"\n label-margin=\"none\"\n padding=\"none\"\n slot=\"header\"\n ><h1 slot=\"label\">Invite your friends to unlock rewards!</h1>\n <p slot=\"content\">\n They’ll get a $50 credit towards a new account and\n you’ll get a $50 in credit for each friend you refer.\n </p></sqm-titled-section\n >\n <sqm-portal-container\n gap=\"small\"\n direction=\"column\"\n display=\"grid\"\n max-width=\"100%\"\n padding=\"none\"\n slot=\"left\"\n >\n <p style=\"margin: 0\">Choose how you want to share:</p>\n <sqm-share-link\n tooltip-text=\"Copied to Clipboard\"\n tooltip-lifespan=\"1000\"\n >\n </sqm-share-link>\n <sqm-share-button\n medium=\"email\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Share via email\n </sqm-share-button>\n <sqm-share-button\n medium=\"linkedin\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Share on LinkedIn\n </sqm-share-button>\n <sqm-share-button\n medium=\"twitter\"\n icon-slot=\"prefix\"\n size=\"medium\"\n type=\"default\"\n >\n Post about us on X\n </sqm-share-button> </sqm-portal-container\n ><sqm-portal-container\n display=\"flex\"\n slot=\"footer\"\n gap=\"small\"\n justify-content=\"center\"\n >\n <sqm-logout-current-user\n user-identification-text=\"{email}\"\n switch-user-link=\"#\"\n switch-user-text=\"not you?\"\n email-error-text=\"Error fetching email\"\n ></sqm-logout-current-user>\n <sqm-portal-footer\n support-email=\"support@example.com\"\n show-powered-by=\"true\"\n padding-bottom=\"x-small\"\n padding-left=\"none\"\n padding-right=\"none\"\n padding-top=\"none\"\n hide-support-text\n terms-text=\"Terms And Conditions\"\n terms-link=\"https://example.com\"\n ></sqm-portal-footer></sqm-portal-container\n ></sqm-referral-card>\n</sqm-hero>\n";
|
|
4108
4111
|
|
|
4109
4112
|
const instantAccessFriendCouponWidget = "<sqm-hero\n background=\"https://res.cloudinary.com/saasquatch/image/upload/v1683589933/Portal%20Assets/Screen-Shot-2022-01-06-at-3.23.58-AM.png\"\n columns=\"2\"\n padding-size=\"medium\"\n wrap-direction=\"wrap\"\n secondary-background=\"#FFFFFF\"\n>\n <sqm-referral-card\n vertical-alignment=\"start\"\n padding-bottom=\"small\"\n padding-left=\"x-large\"\n padding-right=\"x-large\"\n padding-top=\"small\"\n slot=\"secondary-column\"\n >\n <sqm-portal-container\n gap=\"large\"\n direction=\"column\"\n display=\"flex\"\n justify-content=\"center\"\n max-width=\"100%\"\n padding=\"none\"\n slot=\"header\"\n >\n <sqm-titled-section\n text-align=\"center\"\n label-margin=\"xxx-small\"\n padding=\"none\"\n >\n <h1 slot=\"label\">You got $50 off thanks to a friend!</h1>\n <p slot=\"content\">\n <span> Use this reward to get $50 off your next purchase. </span>\n </p>\n </sqm-titled-section>\n\n <sqm-coupon-code copy-button-style=\"button-outside\"></sqm-coupon-code>\n </sqm-portal-container>\n\n <sqm-portal-footer\n slot=\"footer\"\n show-powered-by=\"true\"\n padding-bottom=\"none\"\n padding-left=\"none\"\n padding-right=\"none\"\n padding-top=\"none\"\n hide-support-text\n terms-text=\"Terms And Conditions\"\n terms-link=\"https://example.com\"\n ></sqm-portal-footer>\n </sqm-referral-card>\n</sqm-hero>\n";
|
|
4110
4113
|
|
|
@@ -15671,6 +15674,51 @@ const PortalGoogleRegistrationFormStories = /*#__PURE__*/Object.freeze({
|
|
|
15671
15674
|
TermsAndConditions: TermsAndConditions$4
|
|
15672
15675
|
});
|
|
15673
15676
|
|
|
15677
|
+
const QRCode_stories = {
|
|
15678
|
+
title: "Components/QR Code",
|
|
15679
|
+
};
|
|
15680
|
+
const defaultProps$r = {
|
|
15681
|
+
dialogIsOpen: false,
|
|
15682
|
+
error: false,
|
|
15683
|
+
viewError: false,
|
|
15684
|
+
showDialog: () => void 0,
|
|
15685
|
+
hideDialog: () => void 0,
|
|
15686
|
+
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=",
|
|
15687
|
+
createDownloadable: async () => {
|
|
15688
|
+
console.log("Download QR Code clicked");
|
|
15689
|
+
},
|
|
15690
|
+
createPrintable: async () => {
|
|
15691
|
+
console.log("Print QR Code clicked");
|
|
15692
|
+
},
|
|
15693
|
+
titleText: "Share your QR code",
|
|
15694
|
+
viewCodeText: "View QR code",
|
|
15695
|
+
downloadCodeText: "Download",
|
|
15696
|
+
printCodeText: "Print",
|
|
15697
|
+
errorHeaderText: "There was an error loading your QR code",
|
|
15698
|
+
errorDescriptionText: "Please refresh this page and try again",
|
|
15699
|
+
};
|
|
15700
|
+
const Default$o = () => {
|
|
15701
|
+
return index.h(sqmQrCodeView.QrCodeView, Object.assign({}, defaultProps$r));
|
|
15702
|
+
};
|
|
15703
|
+
const Expanded = () => {
|
|
15704
|
+
return index.h(sqmQrCodeView.QrCodeView, Object.assign({}, defaultProps$r, { dialogIsOpen: true }));
|
|
15705
|
+
};
|
|
15706
|
+
const Error$b = () => {
|
|
15707
|
+
return (index.h(sqmQrCodeView.QrCodeView, Object.assign({}, defaultProps$r, { dialogIsOpen: true, viewError: true })));
|
|
15708
|
+
};
|
|
15709
|
+
const DownloadError = () => {
|
|
15710
|
+
return (index.h(sqmQrCodeView.QrCodeView, Object.assign({}, defaultProps$r, { dialogIsOpen: false, error: true })));
|
|
15711
|
+
};
|
|
15712
|
+
|
|
15713
|
+
const QRCode = /*#__PURE__*/Object.freeze({
|
|
15714
|
+
__proto__: null,
|
|
15715
|
+
'default': QRCode_stories,
|
|
15716
|
+
Default: Default$o,
|
|
15717
|
+
Expanded: Expanded,
|
|
15718
|
+
Error: Error$b,
|
|
15719
|
+
DownloadError: DownloadError
|
|
15720
|
+
});
|
|
15721
|
+
|
|
15674
15722
|
/**
|
|
15675
15723
|
*
|
|
15676
15724
|
* Themes
|
|
@@ -15683,7 +15731,7 @@ const PortalGoogleRegistrationFormStories = /*#__PURE__*/Object.freeze({
|
|
|
15683
15731
|
*
|
|
15684
15732
|
*/
|
|
15685
15733
|
//
|
|
15686
|
-
const Default$
|
|
15734
|
+
const Default$p = `
|
|
15687
15735
|
// No CSS
|
|
15688
15736
|
`;
|
|
15689
15737
|
const Orangey = `
|
|
@@ -15717,7 +15765,7 @@ const Klip = `
|
|
|
15717
15765
|
|
|
15718
15766
|
const Themes = /*#__PURE__*/Object.freeze({
|
|
15719
15767
|
__proto__: null,
|
|
15720
|
-
Default: Default$
|
|
15768
|
+
Default: Default$p,
|
|
15721
15769
|
Orangey: Orangey,
|
|
15722
15770
|
Netflix: Netflix,
|
|
15723
15771
|
SaaSquatchCorporate: SaaSquatchCorporate,
|
|
@@ -18404,6 +18452,7 @@ const stories = [
|
|
|
18404
18452
|
WidgetCodeVerification,
|
|
18405
18453
|
PayoutButtonScroll,
|
|
18406
18454
|
PayoutStatusAlert,
|
|
18455
|
+
QRCode,
|
|
18407
18456
|
];
|
|
18408
18457
|
const StencilStorybook = class {
|
|
18409
18458
|
constructor(hostRef) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-a29c60ef.js');
|
|
4
3
|
const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
|
|
5
4
|
const index_module = require('./index.module-ee84433d.js');
|
|
6
|
-
const JSS = require('./JSS-8503a151.js');
|
|
7
|
-
const mixins = require('./mixins-f7e0377a.js');
|
|
8
5
|
|
|
9
6
|
const GET_REFERRAL_CODES = index_module.dist.gql `
|
|
10
7
|
query getCodes(
|
|
@@ -135,96 +132,6 @@ function useReferralCodes(props) {
|
|
|
135
132
|
};
|
|
136
133
|
}
|
|
137
134
|
|
|
138
|
-
const style = {
|
|
139
|
-
HostBlock: mixins.HostBlock,
|
|
140
|
-
inputStyle: {
|
|
141
|
-
"&::part(input)": { textOverflow: "ellipsis", width: "100%" },
|
|
142
|
-
"&::part(base)": { cursor: "pointer", overflow: "visible" },
|
|
143
|
-
width: "100%",
|
|
144
|
-
},
|
|
145
|
-
inputErrorStyle: {
|
|
146
|
-
"&::part(base)": {
|
|
147
|
-
border: "2px solid red",
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
ContainerDiv: {
|
|
151
|
-
display: "flex",
|
|
152
|
-
alignItems: "flex-start",
|
|
153
|
-
flexDirection: "column",
|
|
154
|
-
justifyContent: "center",
|
|
155
|
-
gap: "var(--sl-spacing-x-small)",
|
|
156
|
-
width: "100%",
|
|
157
|
-
},
|
|
158
|
-
containerStyle: {
|
|
159
|
-
display: "flex",
|
|
160
|
-
alignItems: "center",
|
|
161
|
-
gap: "var(--sl-spacing-x-small)",
|
|
162
|
-
width: "100%",
|
|
163
|
-
},
|
|
164
|
-
errorTextStyle: {
|
|
165
|
-
margin: "0",
|
|
166
|
-
color: "var(--sl-color-danger-500)",
|
|
167
|
-
},
|
|
168
|
-
notificationTextStyle: {
|
|
169
|
-
margin: "0",
|
|
170
|
-
color: "var(--sl-color-neutral-500)",
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
const vanillaStyle = `
|
|
174
|
-
:host{
|
|
175
|
-
display: block;
|
|
176
|
-
width: 100%;
|
|
177
|
-
}
|
|
178
|
-
`;
|
|
179
|
-
const textAlignStyle = {
|
|
180
|
-
right: `
|
|
181
|
-
sl-input::part(input){
|
|
182
|
-
text-align: right;
|
|
183
|
-
}`,
|
|
184
|
-
center: `
|
|
185
|
-
sl-input::part(input){
|
|
186
|
-
text-align: center;
|
|
187
|
-
}`,
|
|
188
|
-
left: ``,
|
|
189
|
-
};
|
|
190
|
-
const disabledStyles = `
|
|
191
|
-
sl-input::part(input){
|
|
192
|
-
cursor: default;
|
|
193
|
-
}
|
|
194
|
-
`;
|
|
195
|
-
const sheet = JSS.createStyleSheet(style);
|
|
196
|
-
const styleString = sheet.toString();
|
|
197
|
-
function CopyTextView(props) {
|
|
198
|
-
const { buttonStyle = "icon" } = props;
|
|
199
|
-
const error = !props.loading && props.error;
|
|
200
|
-
const inputText = error ? props.inputPlaceholderText : props.copyString;
|
|
201
|
-
const disabled = error || props.loading || props.disabled;
|
|
202
|
-
const tooltipPlacement = props.buttonStyle === "button-below"
|
|
203
|
-
? "bottom"
|
|
204
|
-
: props.buttonStyle === "button-outside"
|
|
205
|
-
? "top"
|
|
206
|
-
: "top-end";
|
|
207
|
-
const copyButton = (index.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" ? (index.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 })) : (index.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"))));
|
|
208
|
-
return (index.h("div", { class: sheet.classes.ContainerDiv },
|
|
209
|
-
index.h("style", { type: "text/css" },
|
|
210
|
-
styleString,
|
|
211
|
-
vanillaStyle,
|
|
212
|
-
textAlignStyle[props.textAlign],
|
|
213
|
-
disabled && disabledStyles),
|
|
214
|
-
index.h("div", { class: sheet.classes.containerStyle, style: {
|
|
215
|
-
flexDirection: `${buttonStyle === "button-below" ? "column" : "row"}`,
|
|
216
|
-
} },
|
|
217
|
-
index.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 },
|
|
218
|
-
buttonStyle === "icon" && copyButton,
|
|
219
|
-
error && (index.h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
|
|
220
|
-
(buttonStyle === "button-outside" || buttonStyle === "button-below") &&
|
|
221
|
-
copyButton),
|
|
222
|
-
props.isCopied &&
|
|
223
|
-
props.showNotificationText &&
|
|
224
|
-
props.notificationText && (index.h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
exports.CopyTextView = CopyTextView;
|
|
228
135
|
exports.REFERRAL_CODES_NAMESPACE = REFERRAL_CODES_NAMESPACE;
|
|
229
136
|
exports.REFERRAL_CODES_PAGINATION_CONTEXT = REFERRAL_CODES_PAGINATION_CONTEXT;
|
|
230
137
|
exports.SET_CODE_COPIED = SET_CODE_COPIED;
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"./components/sqm-program-explainer/sqm-program-explainer.js",
|
|
71
71
|
"./components/sqm-program-explainer-step/sqm-program-explainer-step.js",
|
|
72
72
|
"./components/sqm-program-menu/sqm-program-menu.js",
|
|
73
|
+
"./components/sqm-qr-code/sqm-qr-code.js",
|
|
73
74
|
"./components/sqm-referral-card/sqm-referral-card.js",
|
|
74
75
|
"./components/sqm-referral-code/sqm-referral-code.js",
|
|
75
76
|
"./components/sqm-referral-iframe/sqm-referral-iframe.js",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { QrCodeView } from "./sqm-qr-code-view";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/QR Code",
|
|
5
|
+
};
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
dialogIsOpen: false,
|
|
8
|
+
error: false,
|
|
9
|
+
viewError: false,
|
|
10
|
+
showDialog: () => void 0,
|
|
11
|
+
hideDialog: () => void 0,
|
|
12
|
+
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=",
|
|
13
|
+
createDownloadable: async () => {
|
|
14
|
+
console.log("Download QR Code clicked");
|
|
15
|
+
},
|
|
16
|
+
createPrintable: async () => {
|
|
17
|
+
console.log("Print QR Code clicked");
|
|
18
|
+
},
|
|
19
|
+
titleText: "Share your QR code",
|
|
20
|
+
viewCodeText: "View QR code",
|
|
21
|
+
downloadCodeText: "Download",
|
|
22
|
+
printCodeText: "Print",
|
|
23
|
+
errorHeaderText: "There was an error loading your QR code",
|
|
24
|
+
errorDescriptionText: "Please refresh this page and try again",
|
|
25
|
+
};
|
|
26
|
+
export const Default = () => {
|
|
27
|
+
return h(QrCodeView, Object.assign({}, defaultProps));
|
|
28
|
+
};
|
|
29
|
+
export const Expanded = () => {
|
|
30
|
+
return h(QrCodeView, Object.assign({}, defaultProps, { dialogIsOpen: true }));
|
|
31
|
+
};
|
|
32
|
+
export const Error = () => {
|
|
33
|
+
return (h(QrCodeView, Object.assign({}, defaultProps, { dialogIsOpen: true, viewError: true })));
|
|
34
|
+
};
|
|
35
|
+
export const DownloadError = () => {
|
|
36
|
+
return (h(QrCodeView, Object.assign({}, defaultProps, { dialogIsOpen: false, error: true })));
|
|
37
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
+
import { ErrorView } from "../tax-and-cash/sqm-tax-and-cash/ErrorView";
|
|
4
|
+
const style = {
|
|
5
|
+
DialogContainer: {
|
|
6
|
+
maxWidth: "390px !important",
|
|
7
|
+
},
|
|
8
|
+
Container: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
gap: "var(--sl-spacing-small)",
|
|
12
|
+
justifyContent: "space-between",
|
|
13
|
+
},
|
|
14
|
+
FacadeContainer: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
gap: "var(--sl-spacing-medium)",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
},
|
|
19
|
+
ButtonContainer: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
gap: "var(--sl-spacing-medium)",
|
|
22
|
+
},
|
|
23
|
+
FooterContainer: {
|
|
24
|
+
textAlign: "left",
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
gap: "var(--sl-spacing-medium)",
|
|
28
|
+
},
|
|
29
|
+
CodeContainer: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
width: "100%",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
justifyContent: "center",
|
|
34
|
+
},
|
|
35
|
+
Code: {
|
|
36
|
+
width: "100%",
|
|
37
|
+
height: "100%",
|
|
38
|
+
maxWidth: "335px",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const sheet = createStyleSheet(style);
|
|
42
|
+
const styleString = sheet.toString();
|
|
43
|
+
const vanillaStyle = `
|
|
44
|
+
sl-dialog::part(base) {
|
|
45
|
+
inset: auto;
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 25%;
|
|
48
|
+
}
|
|
49
|
+
sl-dialog::part(panel) {
|
|
50
|
+
max-width: 390px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
sl-dialog::part(footer) {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: var(--sl-spacing-small);
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
sl-dialog::part(body) {
|
|
60
|
+
padding: 0 var(--sl-spacing-large);
|
|
61
|
+
}
|
|
62
|
+
:host{
|
|
63
|
+
display: flex;
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
@media (max-width: 499px) {
|
|
67
|
+
:host{
|
|
68
|
+
display: block;
|
|
69
|
+
}
|
|
70
|
+
}`;
|
|
71
|
+
export function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
|
|
72
|
+
return (h("div", { class: sheet.classes.Container, part: "sqm-base" },
|
|
73
|
+
h("style", null, vanillaStyle),
|
|
74
|
+
h("style", null, styleString),
|
|
75
|
+
h("div", { class: sheet.classes.FacadeContainer },
|
|
76
|
+
error && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
77
|
+
h("span", { part: "sqm-title" }, titleText),
|
|
78
|
+
h("div", { class: sheet.classes.ButtonContainer },
|
|
79
|
+
h("sl-button", { type: "primary", exportparts: "base: primarybutton-base", onClick: showDialog }, viewCodeText),
|
|
80
|
+
h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createDownloadable }, downloadCodeText),
|
|
81
|
+
h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createPrintable }, printCodeText))),
|
|
82
|
+
h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
|
|
83
|
+
(viewError || error) && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
84
|
+
qrLink && (h("div", { class: sheet.classes.CodeContainer },
|
|
85
|
+
h("img", { class: sheet.classes.Code, src: qrLink }))),
|
|
86
|
+
h("div", { slot: "footer", class: sheet.classes.FooterContainer },
|
|
87
|
+
h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
|
|
88
|
+
h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
|
|
89
|
+
}
|