@saasquatch/mint-components 1.13.3-9 → 1.13.4
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/{ShadowViewAddon-3ddee92b.js → ShadowViewAddon-14a02da4.js} +138 -104
- package/dist/cjs/{useReferralCodes-82e8797b.js → copy-text-view-a5524c20.js} +93 -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 +2 -3
- package/dist/cjs/{sqm-big-stat_39.cjs.entry.js → sqm-big-stat_41.cjs.entry.js} +221 -4
- package/dist/cjs/{sqm-invoice-table-view-16ac73d0.js → sqm-invoice-table-view-baded4af.js} +31 -2
- package/dist/cjs/sqm-pagination_3.cjs.entry.js +5 -6
- package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +1 -1
- package/dist/cjs/sqm-portal-forgot-password.cjs.entry.js +1 -1
- package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-portal-registration-form-view-ebf355a6.js → sqm-portal-registration-form-view-637a4bf4.js} +1 -0
- package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +2 -1
- package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +1 -1
- package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +1 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +470 -431
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/sqm-checkbox-field/CheckboxField.stories.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +6 -15
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +5 -5
- package/dist/collection/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.js +11 -0
- package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +129 -0
- package/dist/collection/components/sqm-portal-change-marketing/ChangeMarketing.stories.js +54 -0
- package/dist/collection/components/sqm-portal-change-marketing/sqm-portal-change-marketing-view.js +47 -0
- package/dist/collection/components/sqm-portal-change-marketing/sqm-portal-change-marketing.js +217 -0
- package/dist/collection/components/sqm-portal-change-marketing/usePortalChangeMarketing.js +115 -0
- package/dist/collection/components/sqm-portal-email-verification/sqm-portal-email-verification.js +3 -3
- package/dist/collection/components/sqm-portal-forgot-password/sqm-portal-forgot-password.js +3 -3
- package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +2 -2
- package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +3 -3
- package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +4 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +1 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +3 -2
- package/dist/collection/components/sqm-portal-reset-password/sqm-portal-reset-password.js +3 -3
- package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email.js +3 -3
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +6 -2
- package/dist/collection/components/sqm-titled-section/sqm-titled-section.js +3 -0
- package/dist/esm/{ShadowViewAddon-499b1f86.js → ShadowViewAddon-23a6afab.js} +134 -101
- package/dist/esm/{useReferralCodes-8f75921a.js → copy-text-view-459a2e35.js} +93 -1
- 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 +1 -2
- package/dist/esm/{sqm-big-stat_39.entry.js → sqm-big-stat_41.entry.js} +220 -5
- package/dist/esm/{sqm-invoice-table-view-2c726568.js → sqm-invoice-table-view-af69cd33.js} +30 -2
- package/dist/esm/sqm-pagination_3.entry.js +1 -2
- package/dist/esm/sqm-portal-email-verification.entry.js +1 -1
- package/dist/esm/sqm-portal-forgot-password.entry.js +1 -1
- package/dist/esm/sqm-portal-google-registration-form.entry.js +1 -1
- package/dist/esm/{sqm-portal-registration-form-view-32c4b488.js → sqm-portal-registration-form-view-3c1f6000.js} +1 -0
- package/dist/esm/sqm-portal-registration-form.entry.js +2 -1
- package/dist/esm/sqm-portal-reset-password.entry.js +1 -1
- package/dist/esm/sqm-portal-verify-email.entry.js +1 -1
- package/dist/esm/sqm-stencilbook.entry.js +470 -431
- package/dist/esm-es5/ShadowViewAddon-23a6afab.js +1 -0
- package/dist/esm-es5/copy-text-view-459a2e35.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_41.entry.js +1 -0
- package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +1 -0
- package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-registration-form-view-32c4b488.js → sqm-portal-registration-form-view-3c1f6000.js} +1 -1
- package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-01010af0.entry.js +258 -0
- package/dist/mint-components/{p-079405ff.entry.js → p-0d2d0b6d.entry.js} +1 -1
- package/dist/mint-components/p-33ed6f1c.system.entry.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-38b5f028.system.entry.js +1 -0
- package/dist/mint-components/p-717cc8ac.system.js +1 -0
- package/dist/mint-components/p-71bc04d2.system.entry.js +1 -0
- package/dist/mint-components/p-7e7cbccf.system.js +1 -0
- package/dist/mint-components/p-7f2d4212.js +52 -0
- package/dist/mint-components/{p-e6045498.entry.js → p-7f80a9d7.entry.js} +1 -1
- package/dist/mint-components/{p-793d2130.js → p-91ab3da1.js} +1 -1
- package/dist/mint-components/p-9320582e.system.js +1 -0
- package/dist/mint-components/{p-51d3cde7.system.entry.js → p-9386ad84.system.entry.js} +1 -1
- package/dist/mint-components/p-962f3200.js +1 -0
- package/dist/mint-components/{p-54adee71.system.entry.js → p-9bfd9bed.system.entry.js} +1 -1
- package/dist/mint-components/{p-7846937e.entry.js → p-b51e79b3.entry.js} +2 -2
- package/dist/mint-components/p-b93fd99c.system.entry.js +1 -0
- package/dist/mint-components/p-d3d74266.js +394 -0
- package/dist/mint-components/{p-bb0f585c.system.js → p-e5d0375e.system.js} +1 -1
- package/dist/mint-components/{p-012af236.entry.js → p-f29eda2f.entry.js} +4 -4
- package/dist/mint-components/p-f2cc6a6f.entry.js +9 -0
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +1 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +4 -4
- package/dist/types/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.d.ts +8 -0
- package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +27 -0
- package/dist/types/components/{sqm-qr-code/QRCode.stories.d.ts → sqm-portal-change-marketing/ChangeMarketing.stories.d.ts} +2 -2
- package/dist/types/components/sqm-portal-change-marketing/sqm-portal-change-marketing-view.d.ts +28 -0
- package/dist/types/components/sqm-portal-change-marketing/sqm-portal-change-marketing.d.ts +39 -0
- package/dist/types/components/sqm-portal-change-marketing/usePortalChangeMarketing.d.ts +3 -0
- package/dist/types/components/sqm-portal-email-verification/sqm-portal-email-verification.d.ts +1 -1
- package/dist/types/components/sqm-portal-forgot-password/sqm-portal-forgot-password.d.ts +1 -1
- package/dist/types/components/sqm-portal-login/sqm-portal-login.d.ts +1 -1
- package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +1 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +1 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +1 -1
- package/dist/types/components/sqm-portal-reset-password/sqm-portal-reset-password.d.ts +1 -1
- package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email.d.ts +1 -1
- package/dist/types/components/sqm-titled-section/sqm-titled-section.d.ts +1 -0
- package/dist/types/components.d.ts +132 -85
- 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/cjs/ErrorView-b2fcf954.js +0 -35
- package/dist/cjs/copy-text-view-c85acaaa.js +0 -96
- package/dist/cjs/sqm-qr-code-view-82b14685.js +0 -89
- package/dist/cjs/sqm-qr-code.cjs.entry.js +0 -199
- package/dist/collection/components/sqm-qr-code/QRCode.stories.js +0 -37
- package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +0 -84
- package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +0 -229
- package/dist/collection/components/sqm-qr-code/useQRCode.js +0 -129
- package/dist/esm/ErrorView-48e2b969.js +0 -33
- package/dist/esm/copy-text-view-782137ba.js +0 -94
- package/dist/esm/sqm-qr-code-view-2dff1823.js +0 -87
- package/dist/esm/sqm-qr-code.entry.js +0 -195
- package/dist/esm-es5/ErrorView-48e2b969.js +0 -1
- package/dist/esm-es5/ShadowViewAddon-499b1f86.js +0 -1
- package/dist/esm-es5/copy-text-view-782137ba.js +0 -1
- package/dist/esm-es5/sqm-big-stat_39.entry.js +0 -1
- package/dist/esm-es5/sqm-invoice-table-view-2c726568.js +0 -1
- package/dist/esm-es5/sqm-qr-code-view-2dff1823.js +0 -1
- package/dist/esm-es5/sqm-qr-code.entry.js +0 -1
- package/dist/esm-es5/useReferralCodes-8f75921a.js +0 -1
- package/dist/mint-components/p-31015791.js +0 -1
- package/dist/mint-components/p-31c73e3a.system.entry.js +0 -1
- package/dist/mint-components/p-3a62a7e2.system.js +0 -1
- package/dist/mint-components/p-3b90e01b.system.js +0 -1
- package/dist/mint-components/p-3edc9c8a.entry.js +0 -9
- package/dist/mint-components/p-3f067fd5.js +0 -1
- package/dist/mint-components/p-3f7b81b8.js +0 -52
- package/dist/mint-components/p-4f6bb357.system.js +0 -1
- package/dist/mint-components/p-5afd7e38.system.entry.js +0 -1
- package/dist/mint-components/p-5cb7f9fc.system.entry.js +0 -1
- package/dist/mint-components/p-7c434c65.js +0 -1
- package/dist/mint-components/p-97038074.system.entry.js +0 -1
- package/dist/mint-components/p-9acb5038.js +0 -1
- package/dist/mint-components/p-a7746488.system.js +0 -1
- package/dist/mint-components/p-d78298a5.entry.js +0 -17
- package/dist/mint-components/p-da4ff3b4.system.js +0 -1
- package/dist/mint-components/p-dbc0e4f8.system.js +0 -1
- package/dist/mint-components/p-e2d5cd22.js +0 -394
- package/dist/mint-components/p-f15c1a53.entry.js +0 -241
- package/dist/mint-components/p-f4ba6e2b.system.entry.js +0 -1
- package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +0 -17
- package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +0 -41
- package/dist/types/components/sqm-qr-code/useQRCode.d.ts +0 -3
- package/dist/types/global/android.d.ts +0 -7
- package/dist/types/global/demo.d.ts +0 -2
- package/dist/types/stories/features.d.ts +0 -4
- package/dist/types/stories/templates.d.ts +0 -4
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { isDemo } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { useState, withHooks } from "@saasquatch/stencil-hooks";
|
|
3
|
-
import { Component, h, Prop } from "@stencil/core";
|
|
4
|
-
import deepmerge from "deepmerge";
|
|
5
|
-
import { getProps } from "../../utils/utils";
|
|
6
|
-
import { QrCodeView } from "./sqm-qr-code-view";
|
|
7
|
-
import { useQRCode } from "./useQRCode";
|
|
8
|
-
/**
|
|
9
|
-
* @uiName QR Code
|
|
10
|
-
* @exampleGroup Sharing
|
|
11
|
-
* @example QR Code - <sqm-qr-code></sqm-qr-code>
|
|
12
|
-
*/
|
|
13
|
-
export class QrCode {
|
|
14
|
-
constructor() {
|
|
15
|
-
/**
|
|
16
|
-
* @uiName Title
|
|
17
|
-
*/
|
|
18
|
-
this.titleText = "Share your QR code";
|
|
19
|
-
/**
|
|
20
|
-
* @uiName View QR code text
|
|
21
|
-
*/
|
|
22
|
-
this.viewCodeText = "View QR code";
|
|
23
|
-
/**
|
|
24
|
-
* @uiName Download QR code text
|
|
25
|
-
*/
|
|
26
|
-
this.downloadCodeText = "Download";
|
|
27
|
-
/**
|
|
28
|
-
* @uiName Print QR code text
|
|
29
|
-
*/
|
|
30
|
-
this.printCodeText = "Print";
|
|
31
|
-
/**
|
|
32
|
-
* @uiName Header for error banner
|
|
33
|
-
*/
|
|
34
|
-
this.errorHeaderText = "There was an error loading your QR code";
|
|
35
|
-
/**
|
|
36
|
-
* @uiName Description for error banner
|
|
37
|
-
*/
|
|
38
|
-
this.errorDescriptionText = "Please refresh this page and try again";
|
|
39
|
-
withHooks(this);
|
|
40
|
-
}
|
|
41
|
-
disconnectedCallback() { }
|
|
42
|
-
render() {
|
|
43
|
-
const thisProps = getProps(this);
|
|
44
|
-
const props = isDemo() ? useDemoQRCode(thisProps) : useQRCode(thisProps);
|
|
45
|
-
return h(QrCodeView, Object.assign({}, props));
|
|
46
|
-
}
|
|
47
|
-
static get is() { return "sqm-qr-code"; }
|
|
48
|
-
static get encapsulation() { return "shadow"; }
|
|
49
|
-
static get properties() { return {
|
|
50
|
-
"titleText": {
|
|
51
|
-
"type": "string",
|
|
52
|
-
"mutable": false,
|
|
53
|
-
"complexType": {
|
|
54
|
-
"original": "string",
|
|
55
|
-
"resolved": "string",
|
|
56
|
-
"references": {}
|
|
57
|
-
},
|
|
58
|
-
"required": false,
|
|
59
|
-
"optional": true,
|
|
60
|
-
"docs": {
|
|
61
|
-
"tags": [{
|
|
62
|
-
"text": "Title",
|
|
63
|
-
"name": "uiName"
|
|
64
|
-
}],
|
|
65
|
-
"text": ""
|
|
66
|
-
},
|
|
67
|
-
"attribute": "title-text",
|
|
68
|
-
"reflect": false,
|
|
69
|
-
"defaultValue": "\"Share your QR code\""
|
|
70
|
-
},
|
|
71
|
-
"viewCodeText": {
|
|
72
|
-
"type": "string",
|
|
73
|
-
"mutable": false,
|
|
74
|
-
"complexType": {
|
|
75
|
-
"original": "string",
|
|
76
|
-
"resolved": "string",
|
|
77
|
-
"references": {}
|
|
78
|
-
},
|
|
79
|
-
"required": false,
|
|
80
|
-
"optional": true,
|
|
81
|
-
"docs": {
|
|
82
|
-
"tags": [{
|
|
83
|
-
"text": "View QR code text",
|
|
84
|
-
"name": "uiName"
|
|
85
|
-
}],
|
|
86
|
-
"text": ""
|
|
87
|
-
},
|
|
88
|
-
"attribute": "view-code-text",
|
|
89
|
-
"reflect": false,
|
|
90
|
-
"defaultValue": "\"View QR code\""
|
|
91
|
-
},
|
|
92
|
-
"downloadCodeText": {
|
|
93
|
-
"type": "string",
|
|
94
|
-
"mutable": false,
|
|
95
|
-
"complexType": {
|
|
96
|
-
"original": "string",
|
|
97
|
-
"resolved": "string",
|
|
98
|
-
"references": {}
|
|
99
|
-
},
|
|
100
|
-
"required": false,
|
|
101
|
-
"optional": true,
|
|
102
|
-
"docs": {
|
|
103
|
-
"tags": [{
|
|
104
|
-
"text": "Download QR code text",
|
|
105
|
-
"name": "uiName"
|
|
106
|
-
}],
|
|
107
|
-
"text": ""
|
|
108
|
-
},
|
|
109
|
-
"attribute": "download-code-text",
|
|
110
|
-
"reflect": false,
|
|
111
|
-
"defaultValue": "\"Download\""
|
|
112
|
-
},
|
|
113
|
-
"printCodeText": {
|
|
114
|
-
"type": "string",
|
|
115
|
-
"mutable": false,
|
|
116
|
-
"complexType": {
|
|
117
|
-
"original": "string",
|
|
118
|
-
"resolved": "string",
|
|
119
|
-
"references": {}
|
|
120
|
-
},
|
|
121
|
-
"required": false,
|
|
122
|
-
"optional": true,
|
|
123
|
-
"docs": {
|
|
124
|
-
"tags": [{
|
|
125
|
-
"text": "Print QR code text",
|
|
126
|
-
"name": "uiName"
|
|
127
|
-
}],
|
|
128
|
-
"text": ""
|
|
129
|
-
},
|
|
130
|
-
"attribute": "print-code-text",
|
|
131
|
-
"reflect": false,
|
|
132
|
-
"defaultValue": "\"Print\""
|
|
133
|
-
},
|
|
134
|
-
"errorHeaderText": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"mutable": false,
|
|
137
|
-
"complexType": {
|
|
138
|
-
"original": "string",
|
|
139
|
-
"resolved": "string",
|
|
140
|
-
"references": {}
|
|
141
|
-
},
|
|
142
|
-
"required": false,
|
|
143
|
-
"optional": true,
|
|
144
|
-
"docs": {
|
|
145
|
-
"tags": [{
|
|
146
|
-
"text": "Header for error banner",
|
|
147
|
-
"name": "uiName"
|
|
148
|
-
}],
|
|
149
|
-
"text": ""
|
|
150
|
-
},
|
|
151
|
-
"attribute": "error-header-text",
|
|
152
|
-
"reflect": false,
|
|
153
|
-
"defaultValue": "\"There was an error loading your QR code\""
|
|
154
|
-
},
|
|
155
|
-
"errorDescriptionText": {
|
|
156
|
-
"type": "string",
|
|
157
|
-
"mutable": false,
|
|
158
|
-
"complexType": {
|
|
159
|
-
"original": "string",
|
|
160
|
-
"resolved": "string",
|
|
161
|
-
"references": {}
|
|
162
|
-
},
|
|
163
|
-
"required": false,
|
|
164
|
-
"optional": true,
|
|
165
|
-
"docs": {
|
|
166
|
-
"tags": [{
|
|
167
|
-
"text": "Description for error banner",
|
|
168
|
-
"name": "uiName"
|
|
169
|
-
}],
|
|
170
|
-
"text": ""
|
|
171
|
-
},
|
|
172
|
-
"attribute": "error-description-text",
|
|
173
|
-
"reflect": false,
|
|
174
|
-
"defaultValue": "\"Please refresh this page and try again\""
|
|
175
|
-
},
|
|
176
|
-
"demoData": {
|
|
177
|
-
"type": "unknown",
|
|
178
|
-
"mutable": false,
|
|
179
|
-
"complexType": {
|
|
180
|
-
"original": "DemoData<QRCodeViewProps>",
|
|
181
|
-
"resolved": "{ titleText?: string; error?: boolean; dialogIsOpen?: boolean; viewError?: boolean; showDialog?: () => void; hideDialog?: () => void; qrLink?: string; createDownloadable?: () => void; viewCodeText?: string; downloadCodeText?: string; printCodeText?: string; errorHeaderText?: string; errorDescriptionText?: string; createPrintable?: () => void; }",
|
|
182
|
-
"references": {
|
|
183
|
-
"DemoData": {
|
|
184
|
-
"location": "import",
|
|
185
|
-
"path": "../../global/demo"
|
|
186
|
-
},
|
|
187
|
-
"QRCodeViewProps": {
|
|
188
|
-
"location": "import",
|
|
189
|
-
"path": "./sqm-qr-code-view"
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
"required": false,
|
|
194
|
-
"optional": true,
|
|
195
|
-
"docs": {
|
|
196
|
-
"tags": [{
|
|
197
|
-
"text": undefined,
|
|
198
|
-
"name": "undocumented"
|
|
199
|
-
}, {
|
|
200
|
-
"text": "object",
|
|
201
|
-
"name": "uiType"
|
|
202
|
-
}],
|
|
203
|
-
"text": ""
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}; }
|
|
207
|
-
}
|
|
208
|
-
function useDemoQRCode(props) {
|
|
209
|
-
const [dialogIsOpen, setDialog] = useState(false);
|
|
210
|
-
return deepmerge({
|
|
211
|
-
dialogIsOpen,
|
|
212
|
-
showDialog: () => setDialog(true),
|
|
213
|
-
hideDialog: () => setDialog(false),
|
|
214
|
-
titleText: props.titleText,
|
|
215
|
-
viewCodeText: props.viewCodeText,
|
|
216
|
-
downloadCodeText: props.downloadCodeText,
|
|
217
|
-
printCodeText: props.printCodeText,
|
|
218
|
-
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=",
|
|
219
|
-
fireViewQrEvent: () => {
|
|
220
|
-
console.log("View QR Code clicked");
|
|
221
|
-
},
|
|
222
|
-
createDownloadable: async () => {
|
|
223
|
-
console.log("Download QR Code clicked");
|
|
224
|
-
},
|
|
225
|
-
createPrintable: async () => {
|
|
226
|
-
console.log("Print QR Code clicked");
|
|
227
|
-
},
|
|
228
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
229
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { useEngagementMedium, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { useState } from "@saasquatch/stencil-hooks";
|
|
3
|
-
import { useEffect } from "@saasquatch/universal-hooks";
|
|
4
|
-
import { gql } from "graphql-request";
|
|
5
|
-
import { REFERRAL_CODES_NAMESPACE, } from "../sqm-referral-codes/useReferralCodes";
|
|
6
|
-
const ShareLinkQuery = gql `
|
|
7
|
-
query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {
|
|
8
|
-
user: viewer {
|
|
9
|
-
... on User {
|
|
10
|
-
shareLink(
|
|
11
|
-
programId: $programId
|
|
12
|
-
engagementMedium: $engagementMedium
|
|
13
|
-
shareMedium: DIRECT
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
const WIDGET_ENGAGEMENT_EVENT = gql `
|
|
20
|
-
mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
|
|
21
|
-
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
export function useQRCode(props) {
|
|
25
|
-
var _a;
|
|
26
|
-
const programId = useProgramId();
|
|
27
|
-
const user = useUserIdentity();
|
|
28
|
-
const engagementMedium = useEngagementMedium();
|
|
29
|
-
const contextData = useParentValue(REFERRAL_CODES_NAMESPACE);
|
|
30
|
-
const [dialogIsOpen, setDialog] = useState(false);
|
|
31
|
-
const [qrLink, setQrUrl] = useState(null);
|
|
32
|
-
const [error, setError] = useState(false);
|
|
33
|
-
const [viewError, setViewError] = useState(false);
|
|
34
|
-
const { data, errors } = useQuery(ShareLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
|
|
35
|
-
const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
|
|
36
|
-
const shareLink = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink;
|
|
37
|
-
const qrPrefix = `${shareLink}?qrCode`;
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (!shareLink)
|
|
40
|
-
return;
|
|
41
|
-
const getQrCode = async () => {
|
|
42
|
-
try {
|
|
43
|
-
const res = await fetch(`${shareLink}?qrCode&qrCodeImageFormat=svg`);
|
|
44
|
-
const blob = await res.blob();
|
|
45
|
-
const url = URL.createObjectURL(blob);
|
|
46
|
-
setQrUrl(url);
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
setViewError(true);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
getQrCode();
|
|
53
|
-
}, [shareLink]);
|
|
54
|
-
const fireEvent = async () => {
|
|
55
|
-
sendLoadEvent({
|
|
56
|
-
eventMeta: {
|
|
57
|
-
programId,
|
|
58
|
-
id: user === null || user === void 0 ? void 0 : user.id,
|
|
59
|
-
accountId: user === null || user === void 0 ? void 0 : user.accountId,
|
|
60
|
-
type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
|
|
61
|
-
meta: {
|
|
62
|
-
engagementMedium,
|
|
63
|
-
shareMedium: "DIRECT",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const createDownloadable = async () => {
|
|
69
|
-
try {
|
|
70
|
-
const res = await fetch(`${qrPrefix}&qrCodeSize=800&qrCodeImageFormat=png`);
|
|
71
|
-
const blob = await res.blob();
|
|
72
|
-
const url = URL.createObjectURL(blob);
|
|
73
|
-
// Successful
|
|
74
|
-
if (blob)
|
|
75
|
-
fireEvent();
|
|
76
|
-
// Trigger download
|
|
77
|
-
const link = document.createElement("a");
|
|
78
|
-
link.href = url;
|
|
79
|
-
link.download = "qrCode.png";
|
|
80
|
-
document.body.appendChild(link);
|
|
81
|
-
link.click();
|
|
82
|
-
document.body.removeChild(link);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.error("Failed to fetch QR code:", e);
|
|
86
|
-
setError(true);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const createPrintable = async () => {
|
|
90
|
-
try {
|
|
91
|
-
const res = await fetch(`${qrPrefix}&qrCodeSize=1000&qrCodeImageFormat=png&qrCodeErrorCorrectionLevel=H`);
|
|
92
|
-
const blob = await res.blob();
|
|
93
|
-
const url = URL.createObjectURL(blob);
|
|
94
|
-
// Successful
|
|
95
|
-
if (blob)
|
|
96
|
-
fireEvent();
|
|
97
|
-
// Trigger print
|
|
98
|
-
const page = window.open("about:blank", "_new");
|
|
99
|
-
const img = page.document.createElement("img");
|
|
100
|
-
img.src = url;
|
|
101
|
-
img.onload = () => {
|
|
102
|
-
page.print();
|
|
103
|
-
page.close();
|
|
104
|
-
};
|
|
105
|
-
page.document.body.appendChild(img);
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
console.error("Failed to fetch QR code: ", e);
|
|
109
|
-
setError(true);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
return {
|
|
113
|
-
...props,
|
|
114
|
-
qrLink,
|
|
115
|
-
dialogIsOpen,
|
|
116
|
-
error: error,
|
|
117
|
-
viewError: viewError || !!(errors === null || errors === void 0 ? void 0 : errors.message),
|
|
118
|
-
showDialog: () => {
|
|
119
|
-
setError(false);
|
|
120
|
-
setDialog(true);
|
|
121
|
-
},
|
|
122
|
-
hideDialog: () => {
|
|
123
|
-
setError(false);
|
|
124
|
-
setDialog(false);
|
|
125
|
-
},
|
|
126
|
-
createDownloadable,
|
|
127
|
-
createPrintable,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { h } from './index-91e7729f.js';
|
|
2
|
-
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
3
|
-
|
|
4
|
-
const styles = {
|
|
5
|
-
Alert: {
|
|
6
|
-
"&::part(base)": {
|
|
7
|
-
backgroundColor: "var(--sl-color-danger-100)",
|
|
8
|
-
border: "1px solid var(--sl-color-danger-200)",
|
|
9
|
-
padding: "0 16px",
|
|
10
|
-
},
|
|
11
|
-
"& sl-icon": {
|
|
12
|
-
margin: 0,
|
|
13
|
-
},
|
|
14
|
-
"& sl-icon::part(base)": {
|
|
15
|
-
color: "var(--sl-color-danger-500)",
|
|
16
|
-
margin: 0,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const ErrorView = (props) => {
|
|
21
|
-
const sheet = createStyleSheet(styles);
|
|
22
|
-
const styleString = sheet.toString();
|
|
23
|
-
const { classes } = sheet;
|
|
24
|
-
return (h("div", null,
|
|
25
|
-
h("style", null, styleString),
|
|
26
|
-
h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", open: true, class: classes.Alert },
|
|
27
|
-
h("sl-icon", { slot: "icon", name: "exclamation-octagon", class: "Error" }),
|
|
28
|
-
h("strong", null, props.loadingErrorAlertHeader),
|
|
29
|
-
h("br", null),
|
|
30
|
-
props.loadingErrorAlertDescription)));
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { ErrorView as E };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { h } from './index-91e7729f.js';
|
|
2
|
-
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
3
|
-
import { H as HostBlock } from './mixins-83f90fa1.js';
|
|
4
|
-
|
|
5
|
-
const style = {
|
|
6
|
-
HostBlock: HostBlock,
|
|
7
|
-
inputStyle: {
|
|
8
|
-
"&::part(input)": { textOverflow: "ellipsis", width: "100%" },
|
|
9
|
-
"&::part(base)": { cursor: "pointer", overflow: "visible" },
|
|
10
|
-
width: "100%",
|
|
11
|
-
},
|
|
12
|
-
inputErrorStyle: {
|
|
13
|
-
"&::part(base)": {
|
|
14
|
-
border: "2px solid red",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
ContainerDiv: {
|
|
18
|
-
display: "flex",
|
|
19
|
-
alignItems: "flex-start",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
justifyContent: "center",
|
|
22
|
-
gap: "var(--sl-spacing-x-small)",
|
|
23
|
-
width: "100%",
|
|
24
|
-
},
|
|
25
|
-
containerStyle: {
|
|
26
|
-
display: "flex",
|
|
27
|
-
alignItems: "center",
|
|
28
|
-
gap: "var(--sl-spacing-x-small)",
|
|
29
|
-
width: "100%",
|
|
30
|
-
},
|
|
31
|
-
errorTextStyle: {
|
|
32
|
-
margin: "0",
|
|
33
|
-
color: "var(--sl-color-danger-500)",
|
|
34
|
-
},
|
|
35
|
-
notificationTextStyle: {
|
|
36
|
-
margin: "0",
|
|
37
|
-
color: "var(--sl-color-neutral-500)",
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const vanillaStyle = `
|
|
41
|
-
:host{
|
|
42
|
-
display: block;
|
|
43
|
-
width: 100%;
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
const textAlignStyle = {
|
|
47
|
-
right: `
|
|
48
|
-
sl-input::part(input){
|
|
49
|
-
text-align: right;
|
|
50
|
-
}`,
|
|
51
|
-
center: `
|
|
52
|
-
sl-input::part(input){
|
|
53
|
-
text-align: center;
|
|
54
|
-
}`,
|
|
55
|
-
left: ``,
|
|
56
|
-
};
|
|
57
|
-
const disabledStyles = `
|
|
58
|
-
sl-input::part(input){
|
|
59
|
-
cursor: default;
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
const sheet = createStyleSheet(style);
|
|
63
|
-
const styleString = sheet.toString();
|
|
64
|
-
function CopyTextView(props) {
|
|
65
|
-
const { buttonStyle = "icon" } = props;
|
|
66
|
-
const error = !props.loading && props.error;
|
|
67
|
-
const inputText = error ? props.inputPlaceholderText : props.copyString;
|
|
68
|
-
const disabled = error || props.loading || props.disabled;
|
|
69
|
-
const tooltipPlacement = props.buttonStyle === "button-below"
|
|
70
|
-
? "bottom"
|
|
71
|
-
: props.buttonStyle === "button-outside"
|
|
72
|
-
? "top"
|
|
73
|
-
: "top-end";
|
|
74
|
-
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"))));
|
|
75
|
-
return (h("div", { class: sheet.classes.ContainerDiv },
|
|
76
|
-
h("style", { type: "text/css" },
|
|
77
|
-
styleString,
|
|
78
|
-
vanillaStyle,
|
|
79
|
-
textAlignStyle[props.textAlign],
|
|
80
|
-
disabled && disabledStyles),
|
|
81
|
-
h("div", { class: sheet.classes.containerStyle, style: {
|
|
82
|
-
flexDirection: `${buttonStyle === "button-below" ? "column" : "row"}`,
|
|
83
|
-
} },
|
|
84
|
-
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 },
|
|
85
|
-
buttonStyle === "icon" && copyButton,
|
|
86
|
-
error && (h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
|
|
87
|
-
(buttonStyle === "button-outside" || buttonStyle === "button-below") &&
|
|
88
|
-
copyButton),
|
|
89
|
-
props.isCopied &&
|
|
90
|
-
props.showNotificationText &&
|
|
91
|
-
props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { CopyTextView as C };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { h } from './index-91e7729f.js';
|
|
2
|
-
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
3
|
-
import { E as ErrorView } from './ErrorView-48e2b969.js';
|
|
4
|
-
|
|
5
|
-
const style = {
|
|
6
|
-
DialogContainer: {
|
|
7
|
-
maxWidth: "390px !important",
|
|
8
|
-
},
|
|
9
|
-
Container: {
|
|
10
|
-
display: "flex",
|
|
11
|
-
flexDirection: "row",
|
|
12
|
-
gap: "var(--sl-spacing-small)",
|
|
13
|
-
justifyContent: "space-between",
|
|
14
|
-
},
|
|
15
|
-
FacadeContainer: {
|
|
16
|
-
display: "flex",
|
|
17
|
-
gap: "var(--sl-spacing-medium)",
|
|
18
|
-
flexDirection: "column",
|
|
19
|
-
},
|
|
20
|
-
ButtonContainer: {
|
|
21
|
-
display: "flex",
|
|
22
|
-
gap: "var(--sl-spacing-medium)",
|
|
23
|
-
},
|
|
24
|
-
FooterContainer: {
|
|
25
|
-
textAlign: "left",
|
|
26
|
-
display: "flex",
|
|
27
|
-
flexDirection: "column",
|
|
28
|
-
gap: "var(--sl-spacing-medium)",
|
|
29
|
-
},
|
|
30
|
-
CodeContainer: {
|
|
31
|
-
display: "flex",
|
|
32
|
-
width: "100%",
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
justifyContent: "center",
|
|
35
|
-
},
|
|
36
|
-
Code: {
|
|
37
|
-
width: "100%",
|
|
38
|
-
height: "100%",
|
|
39
|
-
maxWidth: "335px",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const sheet = createStyleSheet(style);
|
|
43
|
-
const styleString = sheet.toString();
|
|
44
|
-
const vanillaStyle = `
|
|
45
|
-
sl-dialog::part(panel) {
|
|
46
|
-
max-width: 390px;
|
|
47
|
-
width: 100%;
|
|
48
|
-
}
|
|
49
|
-
sl-dialog::part(footer) {
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
gap: var(--sl-spacing-small);
|
|
53
|
-
width: 100%;
|
|
54
|
-
}
|
|
55
|
-
sl-dialog::part(body) {
|
|
56
|
-
padding: 0 var(--sl-spacing-large);
|
|
57
|
-
}
|
|
58
|
-
:host{
|
|
59
|
-
display: flex;
|
|
60
|
-
width: 100%;
|
|
61
|
-
}
|
|
62
|
-
@media (max-width: 499px) {
|
|
63
|
-
:host{
|
|
64
|
-
display: block;
|
|
65
|
-
}
|
|
66
|
-
}`;
|
|
67
|
-
function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
|
|
68
|
-
return (h("div", { class: sheet.classes.Container, part: "sqm-base" },
|
|
69
|
-
h("style", null, vanillaStyle),
|
|
70
|
-
h("style", null, styleString),
|
|
71
|
-
h("div", { class: sheet.classes.FacadeContainer },
|
|
72
|
-
error && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
73
|
-
h("span", { part: "sqm-title" }, titleText),
|
|
74
|
-
h("div", { class: sheet.classes.ButtonContainer },
|
|
75
|
-
h("sl-button", { type: "primary", onClick: showDialog }, viewCodeText),
|
|
76
|
-
h("sl-button", { type: "text", onClick: createDownloadable }, downloadCodeText),
|
|
77
|
-
h("sl-button", { type: "text", onClick: createPrintable }, printCodeText))),
|
|
78
|
-
h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
|
|
79
|
-
(viewError || error) && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
80
|
-
qrLink && (h("div", { class: sheet.classes.CodeContainer },
|
|
81
|
-
h("img", { class: sheet.classes.Code, src: qrLink }))),
|
|
82
|
-
h("div", { slot: "footer", class: sheet.classes.FooterContainer },
|
|
83
|
-
h("sl-button", { disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
|
|
84
|
-
h("sl-button", { disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { QrCodeView as Q };
|