@saasquatch/mint-components 1.13.3-10 → 1.13.3-12
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/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-qr-code-view-15dfc0b6.js +103 -0
- package/dist/cjs/sqm-qr-code.cjs.entry.js +22 -15
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +25 -11
- package/dist/collection/components/sqm-qr-code/QRCode.stories.js +19 -9
- package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +44 -35
- package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +65 -1
- package/dist/collection/components/sqm-qr-code/useQRCode.js +8 -14
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-qr-code-view-f1d0763b.js +101 -0
- package/dist/esm/sqm-qr-code.entry.js +22 -15
- package/dist/esm/sqm-stencilbook.entry.js +25 -11
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-qr-code-view-f1d0763b.js +1 -0
- package/dist/esm-es5/sqm-qr-code.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-37996351.system.js +1 -1
- package/dist/mint-components/p-47d5d99b.system.entry.js +1 -0
- package/dist/mint-components/p-aad32fb6.system.js +1 -0
- package/dist/mint-components/{p-dfcc0f0e.entry.js → p-ab8fba55.entry.js} +2 -2
- package/dist/mint-components/p-d70a5363.entry.js +17 -0
- package/dist/mint-components/{p-e706440c.system.entry.js → p-db6a5c9d.system.entry.js} +1 -1
- package/dist/mint-components/p-f56bedd5.js +1 -0
- package/dist/types/components/sqm-qr-code/QRCode.stories.d.ts +5 -1
- package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +4 -6
- package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +11 -0
- package/dist/types/components.d.ts +22 -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/cjs/sqm-qr-code-view-3f30d2cd.js +0 -94
- package/dist/esm/sqm-qr-code-view-7c441329.js +0 -92
- package/dist/esm-es5/sqm-qr-code-view-7c441329.js +0 -1
- package/dist/mint-components/p-06267664.system.js +0 -1
- package/dist/mint-components/p-45e82465.entry.js +0 -17
- package/dist/mint-components/p-b630683c.system.entry.js +0 -1
- package/dist/mint-components/p-e6e2b28b.js +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasquatch/mint-components",
|
|
3
3
|
"title": "Mint Components",
|
|
4
|
-
"version": "1.13.3-
|
|
4
|
+
"version": "1.13.3-12",
|
|
5
5
|
"description": "A minimal design library with components for referral and loyalty experiences. Built with Shoelace components by Saasquatch.",
|
|
6
6
|
"icon": "https://res.cloudinary.com/saasquatch/image/upload/v1652219900/squatch-assets/For_Mint.svg",
|
|
7
7
|
"raisins": "docs/raisins.json",
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-a29c60ef.js');
|
|
4
|
-
const JSS = require('./JSS-8503a151.js');
|
|
5
|
-
const ErrorView = require('./ErrorView-b2fcf954.js');
|
|
6
|
-
|
|
7
|
-
const style = {
|
|
8
|
-
DialogContainer: {
|
|
9
|
-
maxWidth: "390px !important",
|
|
10
|
-
},
|
|
11
|
-
Container: {
|
|
12
|
-
display: "flex",
|
|
13
|
-
flexDirection: "row",
|
|
14
|
-
gap: "var(--sl-spacing-small)",
|
|
15
|
-
justifyContent: "space-between",
|
|
16
|
-
},
|
|
17
|
-
FacadeContainer: {
|
|
18
|
-
display: "flex",
|
|
19
|
-
gap: "var(--sl-spacing-medium)",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
},
|
|
22
|
-
ButtonContainer: {
|
|
23
|
-
display: "flex",
|
|
24
|
-
gap: "var(--sl-spacing-medium)",
|
|
25
|
-
},
|
|
26
|
-
FooterContainer: {
|
|
27
|
-
textAlign: "left",
|
|
28
|
-
display: "flex",
|
|
29
|
-
flexDirection: "column",
|
|
30
|
-
gap: "var(--sl-spacing-medium)",
|
|
31
|
-
},
|
|
32
|
-
CodeContainer: {
|
|
33
|
-
display: "flex",
|
|
34
|
-
width: "100%",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
justifyContent: "center",
|
|
37
|
-
},
|
|
38
|
-
Code: {
|
|
39
|
-
width: "100%",
|
|
40
|
-
height: "100%",
|
|
41
|
-
maxWidth: "335px",
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const sheet = JSS.createStyleSheet(style);
|
|
45
|
-
const styleString = sheet.toString();
|
|
46
|
-
const vanillaStyle = `
|
|
47
|
-
sl-dialog::part(base) {
|
|
48
|
-
inset: auto;
|
|
49
|
-
position: absolute;
|
|
50
|
-
left: 25%;
|
|
51
|
-
}
|
|
52
|
-
sl-dialog::part(panel) {
|
|
53
|
-
max-width: 390px;
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
|
-
sl-dialog::part(footer) {
|
|
57
|
-
display: flex;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
gap: var(--sl-spacing-small);
|
|
60
|
-
width: 100%;
|
|
61
|
-
}
|
|
62
|
-
sl-dialog::part(body) {
|
|
63
|
-
padding: 0 var(--sl-spacing-large);
|
|
64
|
-
}
|
|
65
|
-
:host{
|
|
66
|
-
display: flex;
|
|
67
|
-
width: 100%;
|
|
68
|
-
}
|
|
69
|
-
@media (max-width: 499px) {
|
|
70
|
-
:host{
|
|
71
|
-
display: block;
|
|
72
|
-
}
|
|
73
|
-
}`;
|
|
74
|
-
function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
|
|
75
|
-
return (index.h("div", { class: sheet.classes.Container, part: "sqm-base" },
|
|
76
|
-
index.h("style", null, vanillaStyle),
|
|
77
|
-
index.h("style", null, styleString),
|
|
78
|
-
index.h("div", { class: sheet.classes.FacadeContainer },
|
|
79
|
-
error && (index.h(ErrorView.ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
80
|
-
index.h("span", { part: "sqm-title" }, titleText),
|
|
81
|
-
index.h("div", { class: sheet.classes.ButtonContainer },
|
|
82
|
-
index.h("sl-button", { type: "primary", exportparts: "base: primarybutton-base", onClick: showDialog }, viewCodeText),
|
|
83
|
-
index.h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createDownloadable }, downloadCodeText),
|
|
84
|
-
index.h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createPrintable }, printCodeText))),
|
|
85
|
-
index.h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
|
|
86
|
-
(viewError || error) && (index.h(ErrorView.ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
87
|
-
qrLink && (index.h("div", { class: sheet.classes.CodeContainer },
|
|
88
|
-
index.h("img", { class: sheet.classes.Code, src: qrLink }))),
|
|
89
|
-
index.h("div", { slot: "footer", class: sheet.classes.FooterContainer },
|
|
90
|
-
index.h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
|
|
91
|
-
index.h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
exports.QrCodeView = QrCodeView;
|
|
@@ -1,92 +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(base) {
|
|
46
|
-
inset: auto;
|
|
47
|
-
position: absolute;
|
|
48
|
-
left: 25%;
|
|
49
|
-
}
|
|
50
|
-
sl-dialog::part(panel) {
|
|
51
|
-
max-width: 390px;
|
|
52
|
-
width: 100%;
|
|
53
|
-
}
|
|
54
|
-
sl-dialog::part(footer) {
|
|
55
|
-
display: flex;
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
gap: var(--sl-spacing-small);
|
|
58
|
-
width: 100%;
|
|
59
|
-
}
|
|
60
|
-
sl-dialog::part(body) {
|
|
61
|
-
padding: 0 var(--sl-spacing-large);
|
|
62
|
-
}
|
|
63
|
-
:host{
|
|
64
|
-
display: flex;
|
|
65
|
-
width: 100%;
|
|
66
|
-
}
|
|
67
|
-
@media (max-width: 499px) {
|
|
68
|
-
:host{
|
|
69
|
-
display: block;
|
|
70
|
-
}
|
|
71
|
-
}`;
|
|
72
|
-
function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
|
|
73
|
-
return (h("div", { class: sheet.classes.Container, part: "sqm-base" },
|
|
74
|
-
h("style", null, vanillaStyle),
|
|
75
|
-
h("style", null, styleString),
|
|
76
|
-
h("div", { class: sheet.classes.FacadeContainer },
|
|
77
|
-
error && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
78
|
-
h("span", { part: "sqm-title" }, titleText),
|
|
79
|
-
h("div", { class: sheet.classes.ButtonContainer },
|
|
80
|
-
h("sl-button", { type: "primary", exportparts: "base: primarybutton-base", onClick: showDialog }, viewCodeText),
|
|
81
|
-
h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createDownloadable }, downloadCodeText),
|
|
82
|
-
h("sl-button", { exportparts: "base: textbutton-base", type: "text", onClick: createPrintable }, printCodeText))),
|
|
83
|
-
h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
|
|
84
|
-
(viewError || error) && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
|
|
85
|
-
qrLink && (h("div", { class: sheet.classes.CodeContainer },
|
|
86
|
-
h("img", { class: sheet.classes.Code, src: qrLink }))),
|
|
87
|
-
h("div", { slot: "footer", class: sheet.classes.FooterContainer },
|
|
88
|
-
h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
|
|
89
|
-
h("sl-button", { exportparts: "base: button-base", disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { QrCodeView as Q };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h}from"./index-91e7729f.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{E as ErrorView}from"./ErrorView-48e2b969.js";var style={DialogContainer:{maxWidth:"390px !important"},Container:{display:"flex",flexDirection:"row",gap:"var(--sl-spacing-small)",justifyContent:"space-between"},FacadeContainer:{display:"flex",gap:"var(--sl-spacing-medium)",flexDirection:"column"},ButtonContainer:{display:"flex",gap:"var(--sl-spacing-medium)"},FooterContainer:{textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sl-spacing-medium)"},CodeContainer:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center"},Code:{width:"100%",height:"100%",maxWidth:"335px"}};var sheet=createStyleSheet(style);var styleString=sheet.toString();var vanillaStyle="\n sl-dialog::part(base) {\n inset: auto;\n position: absolute;\n left: 25%;\n }\n sl-dialog::part(panel) {\n max-width: 390px;\n width: 100%;\n }\n sl-dialog::part(footer) {\n display: flex;\n flex-direction: column;\n gap: var(--sl-spacing-small);\n width: 100%;\n }\n sl-dialog::part(body) {\n padding: 0 var(--sl-spacing-large);\n }\n :host{\n display: flex;\n width: 100%;\n }\n @media (max-width: 499px) {\n :host{\n display: block;\n }\n }";function QrCodeView(e){var t=e.dialogIsOpen,a=e.error,r=e.viewError,s=e.showDialog,n=e.hideDialog,i=e.qrLink,l=e.titleText,o=e.viewCodeText,d=e.downloadCodeText,p=e.printCodeText,c=e.errorHeaderText,x=e.errorDescriptionText,g=e.createDownloadable,b=e.createPrintable;return h("div",{class:sheet.classes.Container,part:"sqm-base"},h("style",null,vanillaStyle),h("style",null,styleString),h("div",{class:sheet.classes.FacadeContainer},a&&h(ErrorView,{loadingErrorAlertDescription:c,loadingErrorAlertHeader:x}),h("span",{part:"sqm-title"},l),h("div",{class:sheet.classes.ButtonContainer},h("sl-button",{type:"primary",exportparts:"base: primarybutton-base",onClick:s},o),h("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:g},d),h("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:b},p))),h("sl-dialog",{class:sheet.classes.DialogContainer,width:"250px",open:t,label:l,"onSl-hide":n},(r||a)&&h(ErrorView,{loadingErrorAlertDescription:c,loadingErrorAlertHeader:x}),i&&h("div",{class:sheet.classes.CodeContainer},h("img",{class:sheet.classes.Code,src:i})),h("div",{slot:"footer",class:sheet.classes.FooterContainer},h("sl-button",{exportparts:"base: button-base",disabled:a,variant:"default",onClick:g},d),h("sl-button",{exportparts:"base: button-base",disabled:a,variant:"default",onClick:b},p))))}export{QrCodeView as Q};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register(["./p-f26aedcd.system.js","./p-1a673057.system.js","./p-3a62a7e2.system.js"],(function(e){"use strict";var t,a,n;return{setters:[function(e){t=e.h},function(e){a=e.c},function(e){n=e.E}],execute:function(){e("Q",l);var s={DialogContainer:{maxWidth:"390px !important"},Container:{display:"flex",flexDirection:"row",gap:"var(--sl-spacing-small)",justifyContent:"space-between"},FacadeContainer:{display:"flex",gap:"var(--sl-spacing-medium)",flexDirection:"column"},ButtonContainer:{display:"flex",gap:"var(--sl-spacing-medium)"},FooterContainer:{textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sl-spacing-medium)"},CodeContainer:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center"},Code:{width:"100%",height:"100%",maxWidth:"335px"}};var i=a(s);var o=i.toString();var r="\n sl-dialog::part(base) {\n inset: auto;\n position: absolute;\n left: 25%;\n }\n sl-dialog::part(panel) {\n max-width: 390px;\n width: 100%;\n }\n sl-dialog::part(footer) {\n display: flex;\n flex-direction: column;\n gap: var(--sl-spacing-small);\n width: 100%;\n }\n sl-dialog::part(body) {\n padding: 0 var(--sl-spacing-large);\n }\n :host{\n display: flex;\n width: 100%;\n }\n @media (max-width: 499px) {\n :host{\n display: block;\n }\n }";function l(e){var a=e.dialogIsOpen,s=e.error,l=e.viewError,d=e.showDialog,p=e.hideDialog,c=e.qrLink,x=e.titleText,u=e.viewCodeText,g=e.downloadCodeText,b=e.printCodeText,m=e.errorHeaderText,f=e.errorDescriptionText,C=e.createDownloadable,y=e.createPrintable;return t("div",{class:i.classes.Container,part:"sqm-base"},t("style",null,r),t("style",null,o),t("div",{class:i.classes.FacadeContainer},s&&t(n,{loadingErrorAlertDescription:m,loadingErrorAlertHeader:f}),t("span",{part:"sqm-title"},x),t("div",{class:i.classes.ButtonContainer},t("sl-button",{type:"primary",exportparts:"base: primarybutton-base",onClick:d},u),t("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:C},g),t("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:y},b))),t("sl-dialog",{class:i.classes.DialogContainer,width:"250px",open:a,label:x,"onSl-hide":p},(l||s)&&t(n,{loadingErrorAlertDescription:m,loadingErrorAlertHeader:f}),c&&t("div",{class:i.classes.CodeContainer},t("img",{class:i.classes.Code,src:c})),t("div",{slot:"footer",class:i.classes.FooterContainer},t("sl-button",{exportparts:"base: button-base",disabled:s,variant:"default",onClick:C},g),t("sl-button",{exportparts:"base: button-base",disabled:s,variant:"default",onClick:y},b))))}}}}));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{r as e,h as o}from"./p-f708da7b.js";import{k as a,f as t,n as r}from"./p-cd651f81.js";import{d as n,H as i,J as d,F as s,w as c,$ as l,B as m,i as g}from"./p-94a876b9.js";import{c as p}from"./p-c1086930.js";import{g as h}from"./p-9ec99ced.js";import"./p-cef45012.js";import{a as u}from"./p-3f7b81b8.js";import"./p-9acb5038.js";import{Q as w}from"./p-e6e2b28b.js";const v=n.gql`
|
|
2
|
-
query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {
|
|
3
|
-
user: viewer {
|
|
4
|
-
... on User {
|
|
5
|
-
shareLink(
|
|
6
|
-
programId: $programId
|
|
7
|
-
engagementMedium: $engagementMedium
|
|
8
|
-
shareMedium: DIRECT
|
|
9
|
-
)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`,f=n.gql`
|
|
14
|
-
mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
|
|
15
|
-
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
16
|
-
}
|
|
17
|
-
`,R=class{constructor(o){e(this,o),this.titleText="Share your QR code",this.viewCodeText="View QR code",this.downloadCodeText="Download",this.printCodeText="Print",this.errorHeaderText="There was an error loading your QR code",this.errorDescriptionText="Please refresh this page and try again",r(this)}disconnectedCallback(){}render(){const e=h(this),r=g()?function(e){const[o,t]=a(!1);return p({dialogIsOpen:o,showDialog:()=>t(!0),hideDialog:()=>t(!1),titleText:e.titleText,viewCodeText:e.viewCodeText,downloadCodeText:e.downloadCodeText,printCodeText:e.printCodeText,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=",fireViewQrEvent:()=>{console.log("View QR Code clicked")},createDownloadable:async()=>{console.log("Download QR Code clicked")},createPrintable:async()=>{console.log("Print QR Code clicked")}},e.demoData||{},{arrayMerge:(e,o)=>o})}(e):function(e){var o;const r=i(),n=d(),g=m(),p=s(u),[h,w]=a(!1),[R,C]=a(null),[b,y]=a(!1),[E,q]=a(!1),{data:M,errors:I}=c(v,{programId:r,engagementMedium:g},!(null==n?void 0:n.jwt)||void 0!==(null==p?void 0:p.shareLink)),[k]=l(f),D=null===(o=null==M?void 0:M.user)||void 0===o?void 0:o.shareLink,j=`${D}?qrCode`;t((()=>{D&&(async()=>{try{const e=await fetch(`${D}?qrCode&qrCodeImageFormat=svg`),o=await e.blob(),a=URL.createObjectURL(o);C(a)}catch(e){q(!0)}})()}),[D]);const $=async()=>{k({eventMeta:{programId:r,id:null==n?void 0:n.id,accountId:null==n?void 0:n.accountId,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:g,shareMedium:"DIRECT"}}})};return{...e,qrLink:R,dialogIsOpen:h,error:b,viewError:E||!!(null==I?void 0:I.message),showDialog:()=>{y(!1),w(!0)},hideDialog:()=>{y(!1),w(!1)},createDownloadable:async()=>{try{const e=await fetch(`${j}&qrCodeSize=800&qrCodeImageFormat=png`),o=await e.blob(),a=URL.createObjectURL(o);o&&$();const t=document.createElement("a");t.href=a,t.download="qrCode.png",document.body.appendChild(t),t.click(),document.body.removeChild(t)}catch(e){console.error("Failed to fetch QR code:",e),y(!0)}},createPrintable:async()=>{try{const e=await fetch(`${j}&qrCodeSize=1000&qrCodeImageFormat=png&qrCodeErrorCorrectionLevel=H`),o=await e.blob(),a=URL.createObjectURL(o);o&&$();const t=window.open("about:blank","_new"),r=t.document.createElement("img");r.src=a,r.onload=()=>{t.print(),t.close()},t.document.body.appendChild(r)}catch(e){console.error("Failed to fetch QR code: ",e),y(!0)}}}}(e);return o(w,Object.assign({},r))}};export{R as sqm_qr_code}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,n){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:n})}else{e.raw=n}return e};var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++){n=arguments[t];for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))e[o]=n[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r["throw"](e))}catch(e){a(e)}}function c(e){e.done?t(e.value):o(e.value).then(i,s)}c((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(n){return c([e,n])}}function c(i){if(r)throw new TypeError("Generator is already executing.");while(t)try{if(r=1,o&&(a=i[0]&2?o["return"]:i[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,i[1])).done)return a;if(o=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;o=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){t.label=i[1];break}if(i[0]===6&&t.label<a[1]){t.label=a[1];a=i;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(i);break}if(a[2])t.ops.pop();t.trys.pop();continue}i=n.call(e,t)}catch(e){i=[6,e];o=0}finally{r=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};System.register(["./p-f26aedcd.system.js","./p-48135f99.system.js","./p-6cd4f2b1.system.js","./p-4bd679a7.system.js","./p-6333265f.system.js","./p-1a673057.system.js","./p-dbc0e4f8.system.js","./p-3a62a7e2.system.js","./p-06267664.system.js"],(function(e){"use strict";var n,t,r,o,a,i,s,c,u,d,l,f,v,h,g,m,p;return{setters:[function(e){n=e.r;t=e.h},function(e){r=e.k;o=e.f;a=e.n},function(e){i=e.d;s=e.H;c=e.J;u=e.F;d=e.w;l=e.$;f=e.B;v=e.i},function(e){h=e.c},function(e){g=e.g},function(){},function(e){m=e.a},function(){},function(e){p=e.Q}],execute:function(){var _=i.gql(__makeTemplateObject(["\n query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {\n user: viewer {\n ... on User {\n shareLink(\n programId: $programId\n engagementMedium: $engagementMedium\n shareMedium: DIRECT\n )\n }\n }\n }\n"],["\n query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {\n user: viewer {\n ... on User {\n shareLink(\n programId: $programId\n engagementMedium: $engagementMedium\n shareMedium: DIRECT\n )\n }\n }\n }\n"]));var w=i.gql(__makeTemplateObject(["\n mutation loadEvent($eventMeta: UserAnalyticsEvent!) {\n createUserAnalyticsEvent(eventMeta: $eventMeta)\n }\n"],["\n mutation loadEvent($eventMeta: UserAnalyticsEvent!) {\n createUserAnalyticsEvent(eventMeta: $eventMeta)\n }\n"]));function b(e){var n=this;var t;var a=s();var i=c();var v=f();var h=u(m);var g=r(false),p=g[0],b=g[1];var y=r(null),C=y[0],k=y[1];var E=r(false),T=E[0],M=E[1];var R=r(false),j=R[0],x=R[1];var I=d(_,{programId:a,engagementMedium:v},!(i===null||i===void 0?void 0:i.jwt)||(h===null||h===void 0?void 0:h.shareLink)!==undefined),q=I.data,O=I.errors;var L=l(w)[0];var D=(t=q===null||q===void 0?void 0:q.user)===null||t===void 0?void 0:t.shareLink;var U=D+"?qrCode";o((function(){if(!D)return;var e=function(){return __awaiter(n,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,fetch(D+"?qrCode&qrCodeImageFormat=svg")];case 1:e=o.sent();return[4,e.blob()];case 2:n=o.sent();t=URL.createObjectURL(n);k(t);return[3,4];case 3:r=o.sent();x(true);return[3,4];case 4:return[2]}}))}))};e()}),[D]);var $=function(){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(e){L({eventMeta:{programId:a,id:i===null||i===void 0?void 0:i.id,accountId:i===null||i===void 0?void 0:i.accountId,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:v,shareMedium:"DIRECT"}}});return[2]}))}))};var P=function(){return __awaiter(n,void 0,void 0,(function(){var e,n,t,r,o;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,fetch(U+"&qrCodeSize=800&qrCodeImageFormat=png")];case 1:e=a.sent();return[4,e.blob()];case 2:n=a.sent();t=URL.createObjectURL(n);if(n)$();r=document.createElement("a");r.href=t;r.download="qrCode.png";document.body.appendChild(r);r.click();document.body.removeChild(r);return[3,4];case 3:o=a.sent();console.error("Failed to fetch QR code:",o);M(true);return[3,4];case 4:return[2]}}))}))};var Q=function(){return __awaiter(n,void 0,void 0,(function(){var e,n,t,r,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,fetch(U+"&qrCodeSize=1000&qrCodeImageFormat=png&qrCodeErrorCorrectionLevel=H")];case 1:e=i.sent();return[4,e.blob()];case 2:n=i.sent();t=URL.createObjectURL(n);if(n)$();r=window.open("about:blank","_new");o=r.document.createElement("img");o.src=t;o.onload=function(){r.print();r.close()};r.document.body.appendChild(o);return[3,4];case 3:a=i.sent();console.error("Failed to fetch QR code: ",a);M(true);return[3,4];case 4:return[2]}}))}))};return __assign(__assign({},e),{qrLink:C,dialogIsOpen:p,error:T,viewError:j||!!(O===null||O===void 0?void 0:O.message),showDialog:function(){M(false);b(true)},hideDialog:function(){M(false);b(false)},createDownloadable:P,createPrintable:Q})}var y=e("sqm_qr_code",function(){function e(e){n(this,e);this.titleText="Share your QR code";this.viewCodeText="View QR code";this.downloadCodeText="Download";this.printCodeText="Print";this.errorHeaderText="There was an error loading your QR code";this.errorDescriptionText="Please refresh this page and try again";a(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=g(this);var n=v()?C(e):b(e);return t(p,Object.assign({},n))};return e}());function C(e){var n=this;var t=r(false),o=t[0],a=t[1];return h({dialogIsOpen:o,showDialog:function(){return a(true)},hideDialog:function(){return a(false)},titleText:e.titleText,viewCodeText:e.viewCodeText,downloadCodeText:e.downloadCodeText,printCodeText:e.printCodeText,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=",fireViewQrEvent:function(){console.log("View QR Code clicked")},createDownloadable:function(){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(e){console.log("Download QR Code clicked");return[2]}))}))},createPrintable:function(){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(e){console.log("Print QR Code clicked");return[2]}))}))}},e.demoData||{},{arrayMerge:function(e,n){return n}})}}}}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t}from"./p-f708da7b.js";import{c as e}from"./p-cef45012.js";import{E as a}from"./p-9acb5038.js";const n=e({DialogContainer:{maxWidth:"390px !important"},Container:{display:"flex",flexDirection:"row",gap:"var(--sl-spacing-small)",justifyContent:"space-between"},FacadeContainer:{display:"flex",gap:"var(--sl-spacing-medium)",flexDirection:"column"},ButtonContainer:{display:"flex",gap:"var(--sl-spacing-medium)"},FooterContainer:{textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sl-spacing-medium)"},CodeContainer:{display:"flex",width:"100%",alignItems:"center",justifyContent:"center"},Code:{width:"100%",height:"100%",maxWidth:"335px"}}),i=n.toString();function l({dialogIsOpen:e,error:l,viewError:o,showDialog:r,hideDialog:s,qrLink:p,titleText:d,viewCodeText:c,downloadCodeText:x,printCodeText:b,errorHeaderText:g,errorDescriptionText:m,createDownloadable:u,createPrintable:f}){return t("div",{class:n.classes.Container,part:"sqm-base"},t("style",null,"\n sl-dialog::part(base) {\n inset: auto;\n position: absolute;\n left: 25%;\n }\n sl-dialog::part(panel) {\n max-width: 390px;\n width: 100%;\n }\n sl-dialog::part(footer) {\n display: flex;\n flex-direction: column;\n gap: var(--sl-spacing-small);\n width: 100%;\n }\n sl-dialog::part(body) {\n padding: 0 var(--sl-spacing-large);\n }\n :host{\n display: flex;\n width: 100%;\n }\n @media (max-width: 499px) {\n :host{\n display: block;\n }\n }"),t("style",null,i),t("div",{class:n.classes.FacadeContainer},l&&t(a,{loadingErrorAlertDescription:g,loadingErrorAlertHeader:m}),t("span",{part:"sqm-title"},d),t("div",{class:n.classes.ButtonContainer},t("sl-button",{type:"primary",exportparts:"base: primarybutton-base",onClick:r},c),t("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:u},x),t("sl-button",{exportparts:"base: textbutton-base",type:"text",onClick:f},b))),t("sl-dialog",{class:n.classes.DialogContainer,width:"250px",open:e,label:d,"onSl-hide":s},(o||l)&&t(a,{loadingErrorAlertDescription:g,loadingErrorAlertHeader:m}),p&&t("div",{class:n.classes.CodeContainer},t("img",{class:n.classes.Code,src:p})),t("div",{slot:"footer",class:n.classes.FooterContainer},t("sl-button",{exportparts:"base: button-base",disabled:l,variant:"default",onClick:u},x),t("sl-button",{exportparts:"base: button-base",disabled:l,variant:"default",onClick:f},b))))}export{l as Q}
|