@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.
Files changed (156) hide show
  1. package/dist/cjs/{ShadowViewAddon-3ddee92b.js → ShadowViewAddon-14a02da4.js} +138 -104
  2. package/dist/cjs/{useReferralCodes-82e8797b.js → copy-text-view-a5524c20.js} +93 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mint-components.cjs.js +1 -1
  5. package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +2 -3
  6. package/dist/cjs/{sqm-big-stat_39.cjs.entry.js → sqm-big-stat_41.cjs.entry.js} +221 -4
  7. package/dist/cjs/{sqm-invoice-table-view-16ac73d0.js → sqm-invoice-table-view-baded4af.js} +31 -2
  8. package/dist/cjs/sqm-pagination_3.cjs.entry.js +5 -6
  9. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +1 -1
  10. package/dist/cjs/sqm-portal-forgot-password.cjs.entry.js +1 -1
  11. package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +1 -1
  12. package/dist/cjs/{sqm-portal-registration-form-view-ebf355a6.js → sqm-portal-registration-form-view-637a4bf4.js} +1 -0
  13. package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +2 -1
  14. package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +1 -1
  15. package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +1 -1
  16. package/dist/cjs/sqm-stencilbook.cjs.entry.js +470 -431
  17. package/dist/collection/collection-manifest.json +2 -1
  18. package/dist/collection/components/sqm-checkbox-field/CheckboxField.stories.js +1 -1
  19. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +6 -15
  20. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +5 -5
  21. package/dist/collection/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.js +11 -0
  22. package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +129 -0
  23. package/dist/collection/components/sqm-portal-change-marketing/ChangeMarketing.stories.js +54 -0
  24. package/dist/collection/components/sqm-portal-change-marketing/sqm-portal-change-marketing-view.js +47 -0
  25. package/dist/collection/components/sqm-portal-change-marketing/sqm-portal-change-marketing.js +217 -0
  26. package/dist/collection/components/sqm-portal-change-marketing/usePortalChangeMarketing.js +115 -0
  27. package/dist/collection/components/sqm-portal-email-verification/sqm-portal-email-verification.js +3 -3
  28. package/dist/collection/components/sqm-portal-forgot-password/sqm-portal-forgot-password.js +3 -3
  29. package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +2 -2
  30. package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +3 -3
  31. package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +4 -0
  32. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +1 -0
  33. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +3 -2
  34. package/dist/collection/components/sqm-portal-reset-password/sqm-portal-reset-password.js +3 -3
  35. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email.js +3 -3
  36. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +6 -2
  37. package/dist/collection/components/sqm-titled-section/sqm-titled-section.js +3 -0
  38. package/dist/esm/{ShadowViewAddon-499b1f86.js → ShadowViewAddon-23a6afab.js} +134 -101
  39. package/dist/esm/{useReferralCodes-8f75921a.js → copy-text-view-459a2e35.js} +93 -1
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/mint-components.js +1 -1
  42. package/dist/esm/sqm-banking-info-form_17.entry.js +1 -2
  43. package/dist/esm/{sqm-big-stat_39.entry.js → sqm-big-stat_41.entry.js} +220 -5
  44. package/dist/esm/{sqm-invoice-table-view-2c726568.js → sqm-invoice-table-view-af69cd33.js} +30 -2
  45. package/dist/esm/sqm-pagination_3.entry.js +1 -2
  46. package/dist/esm/sqm-portal-email-verification.entry.js +1 -1
  47. package/dist/esm/sqm-portal-forgot-password.entry.js +1 -1
  48. package/dist/esm/sqm-portal-google-registration-form.entry.js +1 -1
  49. package/dist/esm/{sqm-portal-registration-form-view-32c4b488.js → sqm-portal-registration-form-view-3c1f6000.js} +1 -0
  50. package/dist/esm/sqm-portal-registration-form.entry.js +2 -1
  51. package/dist/esm/sqm-portal-reset-password.entry.js +1 -1
  52. package/dist/esm/sqm-portal-verify-email.entry.js +1 -1
  53. package/dist/esm/sqm-stencilbook.entry.js +470 -431
  54. package/dist/esm-es5/ShadowViewAddon-23a6afab.js +1 -0
  55. package/dist/esm-es5/copy-text-view-459a2e35.js +1 -0
  56. package/dist/esm-es5/loader.js +1 -1
  57. package/dist/esm-es5/mint-components.js +1 -1
  58. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
  59. package/dist/esm-es5/sqm-big-stat_41.entry.js +1 -0
  60. package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +1 -0
  61. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  62. package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
  63. package/dist/esm-es5/{sqm-portal-registration-form-view-32c4b488.js → sqm-portal-registration-form-view-3c1f6000.js} +1 -1
  64. package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -1
  65. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  66. package/dist/mint-components/mint-components.esm.js +1 -1
  67. package/dist/mint-components/p-01010af0.entry.js +258 -0
  68. package/dist/mint-components/{p-079405ff.entry.js → p-0d2d0b6d.entry.js} +1 -1
  69. package/dist/mint-components/p-33ed6f1c.system.entry.js +1 -0
  70. package/dist/mint-components/p-37996351.system.js +1 -1
  71. package/dist/mint-components/p-38b5f028.system.entry.js +1 -0
  72. package/dist/mint-components/p-717cc8ac.system.js +1 -0
  73. package/dist/mint-components/p-71bc04d2.system.entry.js +1 -0
  74. package/dist/mint-components/p-7e7cbccf.system.js +1 -0
  75. package/dist/mint-components/p-7f2d4212.js +52 -0
  76. package/dist/mint-components/{p-e6045498.entry.js → p-7f80a9d7.entry.js} +1 -1
  77. package/dist/mint-components/{p-793d2130.js → p-91ab3da1.js} +1 -1
  78. package/dist/mint-components/p-9320582e.system.js +1 -0
  79. package/dist/mint-components/{p-51d3cde7.system.entry.js → p-9386ad84.system.entry.js} +1 -1
  80. package/dist/mint-components/p-962f3200.js +1 -0
  81. package/dist/mint-components/{p-54adee71.system.entry.js → p-9bfd9bed.system.entry.js} +1 -1
  82. package/dist/mint-components/{p-7846937e.entry.js → p-b51e79b3.entry.js} +2 -2
  83. package/dist/mint-components/p-b93fd99c.system.entry.js +1 -0
  84. package/dist/mint-components/p-d3d74266.js +394 -0
  85. package/dist/mint-components/{p-bb0f585c.system.js → p-e5d0375e.system.js} +1 -1
  86. package/dist/mint-components/{p-012af236.entry.js → p-f29eda2f.entry.js} +4 -4
  87. package/dist/mint-components/p-f2cc6a6f.entry.js +9 -0
  88. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +1 -1
  89. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +4 -4
  90. package/dist/types/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.d.ts +8 -0
  91. package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +27 -0
  92. package/dist/types/components/{sqm-qr-code/QRCode.stories.d.ts → sqm-portal-change-marketing/ChangeMarketing.stories.d.ts} +2 -2
  93. package/dist/types/components/sqm-portal-change-marketing/sqm-portal-change-marketing-view.d.ts +28 -0
  94. package/dist/types/components/sqm-portal-change-marketing/sqm-portal-change-marketing.d.ts +39 -0
  95. package/dist/types/components/sqm-portal-change-marketing/usePortalChangeMarketing.d.ts +3 -0
  96. package/dist/types/components/sqm-portal-email-verification/sqm-portal-email-verification.d.ts +1 -1
  97. package/dist/types/components/sqm-portal-forgot-password/sqm-portal-forgot-password.d.ts +1 -1
  98. package/dist/types/components/sqm-portal-login/sqm-portal-login.d.ts +1 -1
  99. package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +1 -0
  100. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +1 -0
  101. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +1 -1
  102. package/dist/types/components/sqm-portal-reset-password/sqm-portal-reset-password.d.ts +1 -1
  103. package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email.d.ts +1 -1
  104. package/dist/types/components/sqm-titled-section/sqm-titled-section.d.ts +1 -0
  105. package/dist/types/components.d.ts +132 -85
  106. package/docs/docs.docx +0 -0
  107. package/docs/raisins.json +1 -1
  108. package/grapesjs/grapesjs.js +1 -1
  109. package/package.json +1 -1
  110. package/dist/cjs/ErrorView-b2fcf954.js +0 -35
  111. package/dist/cjs/copy-text-view-c85acaaa.js +0 -96
  112. package/dist/cjs/sqm-qr-code-view-82b14685.js +0 -89
  113. package/dist/cjs/sqm-qr-code.cjs.entry.js +0 -199
  114. package/dist/collection/components/sqm-qr-code/QRCode.stories.js +0 -37
  115. package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +0 -84
  116. package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +0 -229
  117. package/dist/collection/components/sqm-qr-code/useQRCode.js +0 -129
  118. package/dist/esm/ErrorView-48e2b969.js +0 -33
  119. package/dist/esm/copy-text-view-782137ba.js +0 -94
  120. package/dist/esm/sqm-qr-code-view-2dff1823.js +0 -87
  121. package/dist/esm/sqm-qr-code.entry.js +0 -195
  122. package/dist/esm-es5/ErrorView-48e2b969.js +0 -1
  123. package/dist/esm-es5/ShadowViewAddon-499b1f86.js +0 -1
  124. package/dist/esm-es5/copy-text-view-782137ba.js +0 -1
  125. package/dist/esm-es5/sqm-big-stat_39.entry.js +0 -1
  126. package/dist/esm-es5/sqm-invoice-table-view-2c726568.js +0 -1
  127. package/dist/esm-es5/sqm-qr-code-view-2dff1823.js +0 -1
  128. package/dist/esm-es5/sqm-qr-code.entry.js +0 -1
  129. package/dist/esm-es5/useReferralCodes-8f75921a.js +0 -1
  130. package/dist/mint-components/p-31015791.js +0 -1
  131. package/dist/mint-components/p-31c73e3a.system.entry.js +0 -1
  132. package/dist/mint-components/p-3a62a7e2.system.js +0 -1
  133. package/dist/mint-components/p-3b90e01b.system.js +0 -1
  134. package/dist/mint-components/p-3edc9c8a.entry.js +0 -9
  135. package/dist/mint-components/p-3f067fd5.js +0 -1
  136. package/dist/mint-components/p-3f7b81b8.js +0 -52
  137. package/dist/mint-components/p-4f6bb357.system.js +0 -1
  138. package/dist/mint-components/p-5afd7e38.system.entry.js +0 -1
  139. package/dist/mint-components/p-5cb7f9fc.system.entry.js +0 -1
  140. package/dist/mint-components/p-7c434c65.js +0 -1
  141. package/dist/mint-components/p-97038074.system.entry.js +0 -1
  142. package/dist/mint-components/p-9acb5038.js +0 -1
  143. package/dist/mint-components/p-a7746488.system.js +0 -1
  144. package/dist/mint-components/p-d78298a5.entry.js +0 -17
  145. package/dist/mint-components/p-da4ff3b4.system.js +0 -1
  146. package/dist/mint-components/p-dbc0e4f8.system.js +0 -1
  147. package/dist/mint-components/p-e2d5cd22.js +0 -394
  148. package/dist/mint-components/p-f15c1a53.entry.js +0 -241
  149. package/dist/mint-components/p-f4ba6e2b.system.entry.js +0 -1
  150. package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +0 -17
  151. package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +0 -41
  152. package/dist/types/components/sqm-qr-code/useQRCode.d.ts +0 -3
  153. package/dist/types/global/android.d.ts +0 -7
  154. package/dist/types/global/demo.d.ts +0 -2
  155. package/dist/types/stories/features.d.ts +0 -4
  156. package/dist/types/stories/templates.d.ts +0 -4
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-9",
4
+ "version": "1.13.4",
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,35 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-a29c60ef.js');
4
- const JSS = require('./JSS-8503a151.js');
5
-
6
- const styles = {
7
- Alert: {
8
- "&::part(base)": {
9
- backgroundColor: "var(--sl-color-danger-100)",
10
- border: "1px solid var(--sl-color-danger-200)",
11
- padding: "0 16px",
12
- },
13
- "& sl-icon": {
14
- margin: 0,
15
- },
16
- "& sl-icon::part(base)": {
17
- color: "var(--sl-color-danger-500)",
18
- margin: 0,
19
- },
20
- },
21
- };
22
- const ErrorView = (props) => {
23
- const sheet = JSS.createStyleSheet(styles);
24
- const styleString = sheet.toString();
25
- const { classes } = sheet;
26
- return (index.h("div", null,
27
- index.h("style", null, styleString),
28
- index.h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", open: true, class: classes.Alert },
29
- index.h("sl-icon", { slot: "icon", name: "exclamation-octagon", class: "Error" }),
30
- index.h("strong", null, props.loadingErrorAlertHeader),
31
- index.h("br", null),
32
- props.loadingErrorAlertDescription)));
33
- };
34
-
35
- exports.ErrorView = ErrorView;
@@ -1,96 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-a29c60ef.js');
4
- const JSS = require('./JSS-8503a151.js');
5
- const mixins = require('./mixins-f7e0377a.js');
6
-
7
- const style = {
8
- HostBlock: mixins.HostBlock,
9
- inputStyle: {
10
- "&::part(input)": { textOverflow: "ellipsis", width: "100%" },
11
- "&::part(base)": { cursor: "pointer", overflow: "visible" },
12
- width: "100%",
13
- },
14
- inputErrorStyle: {
15
- "&::part(base)": {
16
- border: "2px solid red",
17
- },
18
- },
19
- ContainerDiv: {
20
- display: "flex",
21
- alignItems: "flex-start",
22
- flexDirection: "column",
23
- justifyContent: "center",
24
- gap: "var(--sl-spacing-x-small)",
25
- width: "100%",
26
- },
27
- containerStyle: {
28
- display: "flex",
29
- alignItems: "center",
30
- gap: "var(--sl-spacing-x-small)",
31
- width: "100%",
32
- },
33
- errorTextStyle: {
34
- margin: "0",
35
- color: "var(--sl-color-danger-500)",
36
- },
37
- notificationTextStyle: {
38
- margin: "0",
39
- color: "var(--sl-color-neutral-500)",
40
- },
41
- };
42
- const vanillaStyle = `
43
- :host{
44
- display: block;
45
- width: 100%;
46
- }
47
- `;
48
- const textAlignStyle = {
49
- right: `
50
- sl-input::part(input){
51
- text-align: right;
52
- }`,
53
- center: `
54
- sl-input::part(input){
55
- text-align: center;
56
- }`,
57
- left: ``,
58
- };
59
- const disabledStyles = `
60
- sl-input::part(input){
61
- cursor: default;
62
- }
63
- `;
64
- const sheet = JSS.createStyleSheet(style);
65
- const styleString = sheet.toString();
66
- function CopyTextView(props) {
67
- const { buttonStyle = "icon" } = props;
68
- const error = !props.loading && props.error;
69
- const inputText = error ? props.inputPlaceholderText : props.copyString;
70
- const disabled = error || props.loading || props.disabled;
71
- const tooltipPlacement = props.buttonStyle === "button-below"
72
- ? "bottom"
73
- : props.buttonStyle === "button-outside"
74
- ? "top"
75
- : "top-end";
76
- 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"))));
77
- return (index.h("div", { class: sheet.classes.ContainerDiv },
78
- index.h("style", { type: "text/css" },
79
- styleString,
80
- vanillaStyle,
81
- textAlignStyle[props.textAlign],
82
- disabled && disabledStyles),
83
- index.h("div", { class: sheet.classes.containerStyle, style: {
84
- flexDirection: `${buttonStyle === "button-below" ? "column" : "row"}`,
85
- } },
86
- 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 },
87
- buttonStyle === "icon" && copyButton,
88
- error && (index.h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
89
- (buttonStyle === "button-outside" || buttonStyle === "button-below") &&
90
- copyButton),
91
- props.isCopied &&
92
- props.showNotificationText &&
93
- props.notificationText && (index.h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
94
- }
95
-
96
- exports.CopyTextView = CopyTextView;
@@ -1,89 +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(panel) {
48
- max-width: 390px;
49
- width: 100%;
50
- }
51
- sl-dialog::part(footer) {
52
- display: flex;
53
- flex-direction: column;
54
- gap: var(--sl-spacing-small);
55
- width: 100%;
56
- }
57
- sl-dialog::part(body) {
58
- padding: 0 var(--sl-spacing-large);
59
- }
60
- :host{
61
- display: flex;
62
- width: 100%;
63
- }
64
- @media (max-width: 499px) {
65
- :host{
66
- display: block;
67
- }
68
- }`;
69
- function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
70
- return (index.h("div", { class: sheet.classes.Container, part: "sqm-base" },
71
- index.h("style", null, vanillaStyle),
72
- index.h("style", null, styleString),
73
- index.h("div", { class: sheet.classes.FacadeContainer },
74
- error && (index.h(ErrorView.ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
75
- index.h("span", { part: "sqm-title" }, titleText),
76
- index.h("div", { class: sheet.classes.ButtonContainer },
77
- index.h("sl-button", { type: "primary", onClick: showDialog }, viewCodeText),
78
- index.h("sl-button", { type: "text", onClick: createDownloadable }, downloadCodeText),
79
- index.h("sl-button", { type: "text", onClick: createPrintable }, printCodeText))),
80
- index.h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
81
- (viewError || error) && (index.h(ErrorView.ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
82
- qrLink && (index.h("div", { class: sheet.classes.CodeContainer },
83
- index.h("img", { class: sheet.classes.Code, src: qrLink }))),
84
- index.h("div", { slot: "footer", class: sheet.classes.FooterContainer },
85
- index.h("sl-button", { disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
86
- index.h("sl-button", { disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
87
- }
88
-
89
- exports.QrCodeView = QrCodeView;
@@ -1,199 +0,0 @@
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-82b14685.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;
@@ -1,37 +0,0 @@
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
- };
@@ -1,84 +0,0 @@
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(panel) {
45
- max-width: 390px;
46
- width: 100%;
47
- }
48
- sl-dialog::part(footer) {
49
- display: flex;
50
- flex-direction: column;
51
- gap: var(--sl-spacing-small);
52
- width: 100%;
53
- }
54
- sl-dialog::part(body) {
55
- padding: 0 var(--sl-spacing-large);
56
- }
57
- :host{
58
- display: flex;
59
- width: 100%;
60
- }
61
- @media (max-width: 499px) {
62
- :host{
63
- display: block;
64
- }
65
- }`;
66
- export function QrCodeView({ dialogIsOpen, error, viewError, showDialog, hideDialog, qrLink, titleText, viewCodeText, downloadCodeText, printCodeText, errorHeaderText, errorDescriptionText, createDownloadable, createPrintable, }) {
67
- return (h("div", { class: sheet.classes.Container, part: "sqm-base" },
68
- h("style", null, vanillaStyle),
69
- h("style", null, styleString),
70
- h("div", { class: sheet.classes.FacadeContainer },
71
- error && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
72
- h("span", { part: "sqm-title" }, titleText),
73
- h("div", { class: sheet.classes.ButtonContainer },
74
- h("sl-button", { type: "primary", onClick: showDialog }, viewCodeText),
75
- h("sl-button", { type: "text", onClick: createDownloadable }, downloadCodeText),
76
- h("sl-button", { type: "text", onClick: createPrintable }, printCodeText))),
77
- h("sl-dialog", { class: sheet.classes.DialogContainer, width: "250px", open: dialogIsOpen, label: titleText, "onSl-hide": hideDialog },
78
- (viewError || error) && (h(ErrorView, { loadingErrorAlertDescription: errorHeaderText, loadingErrorAlertHeader: errorDescriptionText })),
79
- qrLink && (h("div", { class: sheet.classes.CodeContainer },
80
- h("img", { class: sheet.classes.Code, src: qrLink }))),
81
- h("div", { slot: "footer", class: sheet.classes.FooterContainer },
82
- h("sl-button", { disabled: error, variant: "default", onClick: createDownloadable }, downloadCodeText),
83
- h("sl-button", { disabled: error, variant: "default", onClick: createPrintable }, printCodeText)))));
84
- }