@saasquatch/mint-components 1.12.0-15 → 1.12.0-20

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 (96) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/{sqm-banking-info-form_16.cjs.entry.js → sqm-banking-info-form_17.cjs.entry.js} +443 -91
  4. package/dist/cjs/sqm-big-stat_39.cjs.entry.js +2 -2
  5. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  6. package/dist/cjs/{sqm-invoice-table-view-b0602970.js → sqm-invoice-table-view-4fcf021f.js} +1 -0
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +43 -8
  8. package/dist/cjs/sqm-widget-verification-controller.cjs.entry.js +113 -0
  9. package/dist/cjs/sqm-widget-verification.cjs.entry.js +86 -108
  10. package/dist/collection/collection-manifest.json +1 -1
  11. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.js +2 -2
  12. package/dist/collection/components/sqm-text/sqm-text.js +1 -1
  13. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.js +22 -6
  14. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js +120 -0
  15. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +95 -125
  16. package/dist/collection/components/tax-and-cash/BankingForm.stories.js +17 -0
  17. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  18. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +71 -5
  19. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +2 -1
  20. package/dist/esm/{keys-db1897ae.js → keys-406491dc.js} +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/mint-components.js +1 -1
  23. package/dist/esm/{sqm-banking-info-form_16.entry.js → sqm-banking-info-form_17.entry.js} +445 -94
  24. package/dist/esm/sqm-big-stat_39.entry.js +2 -2
  25. package/dist/esm/sqm-email-verification.entry.js +1 -1
  26. package/dist/esm/sqm-empty_4.entry.js +1 -1
  27. package/dist/esm/{sqm-invoice-table-view-b1ac1bfc.js → sqm-invoice-table-view-b3127605.js} +1 -0
  28. package/dist/esm/sqm-stencilbook.entry.js +43 -8
  29. package/dist/esm/sqm-widget-verification-controller.entry.js +109 -0
  30. package/dist/esm/sqm-widget-verification.entry.js +90 -112
  31. package/dist/esm-es5/{keys-db1897ae.js → keys-406491dc.js} +1 -1
  32. package/dist/esm-es5/loader.js +1 -1
  33. package/dist/esm-es5/mint-components.js +1 -1
  34. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -0
  35. package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
  36. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  37. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  38. package/dist/esm-es5/sqm-invoice-table-view-b3127605.js +1 -0
  39. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  40. package/dist/esm-es5/sqm-widget-verification-controller.entry.js +1 -0
  41. package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
  42. package/dist/mint-components/mint-components.esm.js +1 -1
  43. package/dist/mint-components/{p-e11b605d.entry.js → p-021ccc29.entry.js} +1 -1
  44. package/dist/mint-components/{p-158568e5.system.entry.js → p-0a94fe9f.system.entry.js} +1 -1
  45. package/dist/mint-components/p-156e37c2.system.entry.js +1 -0
  46. package/dist/mint-components/{p-c58250e6.system.entry.js → p-2c342de3.system.entry.js} +1 -1
  47. package/dist/mint-components/p-3007fb7d.system.entry.js +1 -0
  48. package/dist/mint-components/p-38c7775a.js +1 -0
  49. package/dist/mint-components/{p-a8e79cad.entry.js → p-478a3755.entry.js} +2 -2
  50. package/dist/mint-components/p-57dd28bd.system.js +1 -0
  51. package/dist/mint-components/{p-9ec008cb.system.entry.js → p-70af9ba2.system.entry.js} +1 -1
  52. package/dist/mint-components/p-97c92e75.entry.js +16 -0
  53. package/dist/mint-components/p-9bd417fd.entry.js +1 -0
  54. package/dist/mint-components/{p-a5c96f2a.entry.js → p-a954c299.entry.js} +21 -11
  55. package/dist/mint-components/p-c1fa5e04.system.js +1 -0
  56. package/dist/mint-components/p-ca809fdd.system.js +1 -1
  57. package/dist/mint-components/p-cb55d3c4.system.entry.js +1 -0
  58. package/dist/mint-components/{p-4671e644.entry.js → p-cd200c95.entry.js} +1 -1
  59. package/dist/mint-components/p-d4877a65.system.entry.js +1 -0
  60. package/dist/mint-components/p-f1184442.js +1 -0
  61. package/dist/mint-components/{p-fc17c2d2.entry.js → p-f196d71a.entry.js} +11 -11
  62. package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +1 -0
  63. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-controller.d.ts +12 -0
  64. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +3 -4
  65. package/dist/types/components/tax-and-cash/BankingForm.stories.d.ts +1 -0
  66. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +3 -0
  67. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +9 -0
  68. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/extractProps.d.ts +5 -1
  69. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +1 -1
  70. package/dist/types/components.d.ts +27 -37
  71. package/docs/docs.docx +0 -0
  72. package/docs/raisins.json +1 -1
  73. package/grapesjs/grapesjs.js +1 -1
  74. package/package.json +1 -1
  75. package/dist/cjs/sqm-code-verification.cjs.entry.js +0 -342
  76. package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +0 -109
  77. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +0 -345
  78. package/dist/esm/sqm-code-verification.entry.js +0 -338
  79. package/dist/esm/sqm-widget-verification-internal.entry.js +0 -105
  80. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +0 -1
  81. package/dist/esm-es5/sqm-code-verification.entry.js +0 -1
  82. package/dist/esm-es5/sqm-invoice-table-view-b1ac1bfc.js +0 -1
  83. package/dist/esm-es5/sqm-widget-verification-internal.entry.js +0 -1
  84. package/dist/mint-components/p-02892b2a.entry.js +0 -11
  85. package/dist/mint-components/p-03e1ac96.system.entry.js +0 -1
  86. package/dist/mint-components/p-2584baa5.entry.js +0 -16
  87. package/dist/mint-components/p-39840341.js +0 -1
  88. package/dist/mint-components/p-7789349d.system.js +0 -1
  89. package/dist/mint-components/p-8fa2809f.system.entry.js +0 -1
  90. package/dist/mint-components/p-9596e97c.system.entry.js +0 -1
  91. package/dist/mint-components/p-9e788a1a.js +0 -1
  92. package/dist/mint-components/p-b2a99637.system.js +0 -1
  93. package/dist/mint-components/p-b99108a6.system.entry.js +0 -1
  94. package/dist/mint-components/p-bfd92031.system.entry.js +0 -1
  95. package/dist/mint-components/p-c510fb88.entry.js +0 -1
  96. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +0 -20
@@ -1724,7 +1724,7 @@ NavigationMenu.style = sqmNavigationMenuCss;
1724
1724
  const style$2 = {
1725
1725
  Wrapper: {
1726
1726
  maxWidth: "200px",
1727
- border: "1px solid black",
1727
+ marginLeft: "auto",
1728
1728
  },
1729
1729
  PayoutButtonDescription: {
1730
1730
  color: "var(--sl-color-neutral-500)",
@@ -1738,7 +1738,7 @@ function PayoutButtonScrollView(props) {
1738
1738
  const { text, states } = props;
1739
1739
  if (!states.payoutSettingsComplete)
1740
1740
  return index.h("div", null);
1741
- return (index.h("div", { part: "sqm-base", class: sheet$2.classes.Wrapper },
1741
+ return (index.h("div", { class: sheet$2.classes.Wrapper },
1742
1742
  index.h("style", { type: "text/css" }, styleString$2),
1743
1743
  index.h("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.payoutButtonText, "scroll-animation": "smooth" }),
1744
1744
  index.h("p", { class: sheet$2.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
@@ -121,7 +121,7 @@ const vanillaStyle = `
121
121
 
122
122
  sqm-text h4 {
123
123
  font-size: var(--sl-font-size-large);
124
- font-weight: var(--sl-font-weight-semibold);
124
+ font-weight: var(--sl-font-weight-bold);
125
125
  color: var(--sl-color-neutral-800);
126
126
  margin: 0;
127
127
  }
@@ -709,6 +709,7 @@ const stepFourProps = {
709
709
  saveDisabled: false,
710
710
  thresholds: [],
711
711
  loadingError: false,
712
+ email: "test@example.com",
712
713
  formState: {
713
714
  paymentMethodChecked: "toBankAccount",
714
715
  },
@@ -30,7 +30,7 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-96f
30
30
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7ffcc0d4.js');
31
31
  const ShadowViewAddon = require('./ShadowViewAddon-040cffad.js');
32
32
  const sqmPortalContainerView = require('./sqm-portal-container-view-990a85a3.js');
33
- const sqmInvoiceTableView = require('./sqm-invoice-table-view-b0602970.js');
33
+ const sqmInvoiceTableView = require('./sqm-invoice-table-view-4fcf021f.js');
34
34
 
35
35
  /**
36
36
  * lodash (Custom Build) <https://lodash.com/>
@@ -14417,6 +14417,7 @@ const bankingFormProps = {
14417
14417
  thresholds: [],
14418
14418
  currency: "USD",
14419
14419
  loadingError: false,
14420
+ email: "test@example.com",
14420
14421
  },
14421
14422
  callbacks: {
14422
14423
  onVerificationHide: () => { },
@@ -14730,6 +14731,22 @@ const BankingInfoFormWithFixedDayPaymentScheduleLoading = () => {
14730
14731
  },
14731
14732
  } }));
14732
14733
  };
14734
+ const BankingInfoFormVerififyIdentityModal = () => {
14735
+ return (index.h("sqm-banking-info-form", { demoData: {
14736
+ ...bankingFormProps,
14737
+ states: {
14738
+ ...bankingFormProps.states,
14739
+ isPartner: true,
14740
+ showVerification: true,
14741
+ formState: {
14742
+ ...bankingFormProps.states.formState,
14743
+ bankCountry: "US",
14744
+ paymentScheduleChecked: "FIXED_DAY",
14745
+ },
14746
+ currency: "USD",
14747
+ },
14748
+ } }));
14749
+ };
14733
14750
 
14734
14751
  const BankingInfoForm = /*#__PURE__*/Object.freeze({
14735
14752
  __proto__: null,
@@ -14755,7 +14772,8 @@ const BankingInfoForm = /*#__PURE__*/Object.freeze({
14755
14772
  BankingInfoFormWithBalanceThresholdPaymentScheduleLoading: BankingInfoFormWithBalanceThresholdPaymentScheduleLoading,
14756
14773
  BankingInfoFormWithFixedDayPaymentSchedule: BankingInfoFormWithFixedDayPaymentSchedule,
14757
14774
  BankingInfoFormWithFixedDayPaymentScheduleWithError: BankingInfoFormWithFixedDayPaymentScheduleWithError,
14758
- BankingInfoFormWithFixedDayPaymentScheduleLoading: BankingInfoFormWithFixedDayPaymentScheduleLoading
14775
+ BankingInfoFormWithFixedDayPaymentScheduleLoading: BankingInfoFormWithFixedDayPaymentScheduleLoading,
14776
+ BankingInfoFormVerififyIdentityModal: BankingInfoFormVerififyIdentityModal
14759
14777
  });
14760
14778
 
14761
14779
  const InvoiceTableCell_stories = {
@@ -15014,12 +15032,17 @@ const defaultProps$k = {
15014
15032
  sendCodeError: false,
15015
15033
  };
15016
15034
  const Default$i = () => (index.h("sqm-email-verification", { demoData: {} }));
15017
- const EmailIsPrefilled = () => (index.h("sqm-email-verification", { demoData: {
15018
- states: {
15019
- ...defaultProps$k,
15020
- email: "test@example.com",
15021
- },
15022
- } }));
15035
+ const EmailIsPrefilled = () => (index.h("div", null,
15036
+ index.h("sqm-text", null,
15037
+ index.h("h4", null, "Verify your email")),
15038
+ index.h("sqm-text", null,
15039
+ index.h("sub", null, "To get your cash paid out directly to your bank account, please complete your account setup")),
15040
+ index.h("sqm-email-verification", { demoData: {
15041
+ states: {
15042
+ ...defaultProps$k,
15043
+ email: "test@example.com",
15044
+ },
15045
+ } })));
15023
15046
  const Loading$7 = () => (index.h("sqm-email-verification", { demoData: {
15024
15047
  states: {
15025
15048
  ...defaultProps$k,
@@ -15032,6 +15055,17 @@ const SaveLoading = () => (index.h("sqm-email-verification", { demoData: {
15032
15055
  loading: true,
15033
15056
  },
15034
15057
  } }));
15058
+ const WithHeader$1 = () => (index.h("div", null,
15059
+ index.h("sqm-text", null,
15060
+ index.h("h4", null, "Verify your email")),
15061
+ index.h("sqm-text", null,
15062
+ index.h("sub", null, "To get your cash paid out directly to your bank account, please complete your account setup")),
15063
+ index.h("sqm-email-verification", { demoData: {
15064
+ states: {
15065
+ ...defaultProps$k,
15066
+ email: "test@example.com",
15067
+ },
15068
+ } })));
15035
15069
  const InvalidEmail = () => (index.h("sqm-email-verification", { demoData: {
15036
15070
  states: {
15037
15071
  ...defaultProps$k,
@@ -15052,6 +15086,7 @@ const WidgetEmailVerification = /*#__PURE__*/Object.freeze({
15052
15086
  EmailIsPrefilled: EmailIsPrefilled,
15053
15087
  Loading: Loading$7,
15054
15088
  SaveLoading: SaveLoading,
15089
+ WithHeader: WithHeader$1,
15055
15090
  InvalidEmail: InvalidEmail,
15056
15091
  SendCodeError: SendCodeError
15057
15092
  });
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-b0129cd6.js');
6
+ const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
+ const index_module = require('./index.module-b8d9d0ba.js');
8
+ const keys = require('./keys-cff24974.js');
9
+
10
+ const debug = stencilHooks_module.browser("sq:widget-verification");
11
+ function useTemplateChildren({ parent, callback }) {
12
+ const parentObserver = new MutationObserver(listenForTemplateChanges);
13
+ const childTemplateObserver = new MutationObserver(callback);
14
+ parentObserver.observe(parent, {
15
+ childList: true,
16
+ // We only care about immediate children templates
17
+ subtree: false,
18
+ });
19
+ listenForTemplateChanges({ addedNodes: parent.querySelectorAll("template") });
20
+ function listenForTemplateChanges(mutationList) {
21
+ var _a;
22
+ // Be smart, only look at the mutation list
23
+ (_a = mutationList.addedNodes) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
24
+ childTemplateObserver.observe(t.content, {
25
+ childList: true,
26
+ attributes: true,
27
+ // Look deep into the templates for re-rendering
28
+ subtree: true,
29
+ });
30
+ });
31
+ }
32
+ return () => {
33
+ parentObserver.disconnect();
34
+ childTemplateObserver.disconnect();
35
+ };
36
+ }
37
+ const WidgetVerificationController = class {
38
+ constructor(hostRef) {
39
+ index.registerInstance(this, hostRef);
40
+ stencilHooks_module.h$1(this);
41
+ }
42
+ disconnectedCallback() { }
43
+ render() {
44
+ const [context, setContext] = index_module.Fn({
45
+ namespace: keys.VERIFICATION_PARENT_NAMESPACE,
46
+ initialValue: false,
47
+ });
48
+ const [container, setContainer] = stencilHooks_module.useState(undefined);
49
+ const [slot, setSlot] = stencilHooks_module.useState(undefined);
50
+ const updateTemplates = index_module.useCallback(() => {
51
+ const isAuth = context;
52
+ const templates = slot.querySelectorAll(`template`);
53
+ const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
54
+ if (template) {
55
+ // use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
56
+ const newContent = template.innerHTML || template.firstElementChild.outerHTML;
57
+ // if template contents are an exact match
58
+ if (newContent === container.innerHTML) {
59
+ debug("don't rerender");
60
+ }
61
+ else if (template) {
62
+ container.innerHTML = newContent;
63
+ }
64
+ }
65
+ const plopTargets = Array.from(slot.children).filter((el) => el.tagName === "RAISINS-PLOP-TARGET");
66
+ // if editing in raisins
67
+ if (plopTargets.length) {
68
+ const loggedInPlopTargets = plopTargets.filter((el) => el.slot === "verified");
69
+ const loggedOutPlopTargets = plopTargets.filter((el) => el.slot === "not-verified");
70
+ loggedOutPlopTargets.forEach((target, i) => {
71
+ if (isAuth) {
72
+ target.style.display = "none";
73
+ return;
74
+ }
75
+ // Place last plop target at the bottom of the parent
76
+ if (i === loggedOutPlopTargets.length - 1) {
77
+ target.style.bottom = "0px";
78
+ target.style.left = "0px";
79
+ target.style.right = "0px";
80
+ target.style.position = "absolute";
81
+ }
82
+ target.style.height = "25px";
83
+ });
84
+ loggedInPlopTargets.forEach((target, i) => {
85
+ if (!isAuth) {
86
+ target.style.display = "none";
87
+ return;
88
+ }
89
+ // Place last plop target at the bottom of the parent
90
+ if (i === loggedInPlopTargets.length - 1) {
91
+ target.style.bottom = "0px";
92
+ target.style.left = "0px";
93
+ target.style.right = "0px";
94
+ target.style.position = "absolute";
95
+ }
96
+ target.style.height = "25px";
97
+ });
98
+ }
99
+ }, [container, slot, context]);
100
+ stencilHooks_module.useEffect(() => {
101
+ if (!container || !slot) {
102
+ debug("DOM not ready:");
103
+ return;
104
+ }
105
+ // Run on first render
106
+ updateTemplates();
107
+ return useTemplateChildren({ parent: slot, callback: updateTemplates });
108
+ }, [slot, container, context]);
109
+ return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
110
+ }
111
+ };
112
+
113
+ exports.sqm_widget_verification_controller = WidgetVerificationController;
@@ -7,44 +7,70 @@ const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
7
  const index_module = require('./index.module-b8d9d0ba.js');
8
8
  const utils = require('./utils-6847bc06.js');
9
9
  const keys = require('./keys-cff24974.js');
10
+ const extractProps = require('./extractProps-fd93ba62.js');
10
11
 
11
- const debug = stencilHooks_module.browser("sq:widget-verification");
12
- function useTemplateChildren({ parent, callback }) {
13
- const parentObserver = new MutationObserver(listenForTemplateChanges);
14
- const childTemplateObserver = new MutationObserver(callback);
15
- parentObserver.observe(parent, {
16
- childList: true,
17
- // We only care about immediate children templates
18
- subtree: false,
19
- });
20
- listenForTemplateChanges({ addedNodes: parent.querySelectorAll("template") });
21
- function listenForTemplateChanges(mutationList) {
22
- var _a;
23
- // Be smart, only look at the mutation list
24
- (_a = mutationList.addedNodes) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
25
- childTemplateObserver.observe(t.content, {
26
- childList: true,
27
- attributes: true,
28
- // Look deep into the templates for re-rendering
29
- subtree: true,
30
- });
31
- });
12
+ const USER_LOOKUP = index_module.dist.gql `
13
+ query checkUserVerification {
14
+ viewer {
15
+ ... on User {
16
+ id
17
+ accountId
18
+ email
19
+ emailVerified
20
+ managedIdentity {
21
+ email
22
+ emailVerified
23
+ }
24
+ }
25
+ }
32
26
  }
33
- return () => {
34
- parentObserver.disconnect();
35
- childTemplateObserver.disconnect();
27
+ `;
28
+ function useWidgetVerificationInternal() {
29
+ const userIdentity = index_module.K();
30
+ const [showCode, setShowCode] = index_module.Fn({
31
+ namespace: keys.SHOW_CODE_NAMESPACE,
32
+ initialValue: false,
33
+ });
34
+ const [email, setEmail] = index_module.Fn({
35
+ namespace: keys.VERIFICATION_EMAIL_NAMESPACE,
36
+ initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
37
+ });
38
+ const setContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
39
+ const [loading, setLoading] = stencilHooks_module.useState(true);
40
+ const [fetch] = index_module.an(USER_LOOKUP);
41
+ stencilHooks_module.useEffect(() => {
42
+ const checkUser = async () => {
43
+ var _a, _b, _c;
44
+ try {
45
+ const res = await fetch({});
46
+ if (!res || res instanceof Error)
47
+ throw new Error();
48
+ if ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified)
49
+ setContext(true);
50
+ else if ((_c = (_b = res === null || res === void 0 ? void 0 : res.viewer) === null || _b === void 0 ? void 0 : _b.managedIdentity) === null || _c === void 0 ? void 0 : _c.emailVerified)
51
+ setContext(true);
52
+ }
53
+ catch (e) {
54
+ console.error("Could not fetch user information:", e);
55
+ }
56
+ finally {
57
+ setLoading(false);
58
+ }
59
+ };
60
+ checkUser();
61
+ }, []);
62
+ const onVerification = () => {
63
+ setContext(true);
36
64
  };
65
+ return { showCode, onVerification, loading };
37
66
  }
38
67
  const WidgetVerification = class {
39
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
- CODE STEP PROPS
41
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
42
68
  constructor(hostRef) {
43
69
  index.registerInstance(this, hostRef);
44
70
  // ! Any updated must be reflected in sqm-widget-verification-internal AND sqm-email-verification AND sqm-code-verification
45
71
  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
- EMAIL STEP PROPS
47
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
72
+ EMAIL STEP PROPS
73
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
48
74
  /**
49
75
  * @uiName Verify email widget header text
50
76
  * @uiGroup Email Verification Step
@@ -76,8 +102,8 @@ const WidgetVerification = class {
76
102
  */
77
103
  this.emailStep_emailValidationErrorText = "Please enter a valid email";
78
104
  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79
- EMAIL STEP PROPS
80
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
105
+ EMAIL STEP PROPS
106
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
81
107
  /**
82
108
  * @uiName Verify code widget header text
83
109
  * @uiGroup Code Verification Step
@@ -126,85 +152,37 @@ const WidgetVerification = class {
126
152
  stencilHooks_module.h$1(this);
127
153
  }
128
154
  disconnectedCallback() { }
155
+ getStepTextProps(prefix) {
156
+ const props = utils.getProps(this);
157
+ return extractProps.extractProps(props, prefix);
158
+ }
129
159
  render() {
130
- const [context, setContext] = index_module.Fn({
131
- namespace: keys.VERIFICATION_PARENT_NAMESPACE,
132
- initialValue: false,
133
- });
134
- const [container, setContainer] = stencilHooks_module.useState(undefined);
135
- const [slot, setSlot] = stencilHooks_module.useState(undefined);
136
- const updateTemplates = index_module.useCallback(() => {
137
- const isAuth = context;
138
- const templates = slot.querySelectorAll(`template`);
139
- const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
140
- if (template) {
141
- // use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
142
- const newContent = template.innerHTML || template.firstElementChild.outerHTML;
143
- // if template contents are an exact match
144
- if (newContent === container.innerHTML) {
145
- debug("don't rerender");
146
- }
147
- else if (template) {
148
- container.innerHTML = newContent;
149
- }
150
- }
151
- const plopTargets = Array.from(slot.children).filter((el) => el.tagName === "RAISINS-PLOP-TARGET");
152
- // if editing in raisins
153
- if (plopTargets.length) {
154
- const loggedInPlopTargets = plopTargets.filter((el) => el.slot === "verified");
155
- const loggedOutPlopTargets = plopTargets.filter((el) => el.slot === "not-verified");
156
- loggedOutPlopTargets.forEach((target, i) => {
157
- if (isAuth) {
158
- target.style.display = "none";
159
- return;
160
- }
161
- // Place last plop target at the bottom of the parent
162
- if (i === loggedOutPlopTargets.length - 1) {
163
- target.style.bottom = "0px";
164
- target.style.left = "0px";
165
- target.style.right = "0px";
166
- target.style.position = "absolute";
167
- }
168
- target.style.height = "25px";
169
- });
170
- loggedInPlopTargets.forEach((target, i) => {
171
- if (!isAuth) {
172
- target.style.display = "none";
173
- return;
174
- }
175
- // Place last plop target at the bottom of the parent
176
- if (i === loggedInPlopTargets.length - 1) {
177
- target.style.bottom = "0px";
178
- target.style.left = "0px";
179
- target.style.right = "0px";
180
- target.style.position = "absolute";
181
- }
182
- target.style.height = "25px";
183
- });
184
- }
185
- }, [container, slot, context]);
186
- stencilHooks_module.useEffect(() => {
187
- if (!container || !slot) {
188
- debug("DOM not ready:");
189
- return;
190
- }
191
- // Run on first render
192
- updateTemplates();
193
- return useTemplateChildren({ parent: slot, callback: updateTemplates });
194
- }, [slot, container, context]);
195
- // useEffect(() => {
196
- // const host = useHost();
197
- // const callback = (e: CustomEvent) => {
198
- // e.stopPropagation();
199
- // setContext({ token: e.detail.token });
200
- // };
201
- // host.addEventListener(VERIFICATION_EVENT_KEY, callback);
202
- // return () => {
203
- // host.removeEventListener(VERIFICATION_EVENT_KEY, callback);
204
- // };
205
- // }, []);
206
- return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("template", { slot: "not-verified" }, index.h("sqm-widget-verification-internal", Object.assign({}, utils.getProps(this)))), index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
160
+ const { showCode, onVerification, loading } = index_module.isDemo()
161
+ ? useDemoWidgetVerificationInternal()
162
+ : useWidgetVerificationInternal();
163
+ // TODO: Shoelace spinner is throwing errors
164
+ if (loading)
165
+ return index.h("div", null);
166
+ if (showCode) {
167
+ return (index.h("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_"))));
168
+ }
169
+ return (index.h("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))));
207
170
  }
208
171
  };
172
+ function useDemoWidgetVerificationInternal() {
173
+ const [showCode, setShowCode] = index_module.Fn({
174
+ namespace: keys.SHOW_CODE_NAMESPACE,
175
+ initialValue: false,
176
+ });
177
+ const [email, setEmail] = index_module.Fn({
178
+ namespace: keys.VERIFICATION_EMAIL_NAMESPACE,
179
+ initialValue: undefined,
180
+ });
181
+ const setContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
182
+ const onVerification = () => {
183
+ setContext(true);
184
+ };
185
+ return { showCode, onVerification, loading: false };
186
+ }
209
187
 
210
188
  exports.sqm_widget_verification = WidgetVerification;
@@ -108,7 +108,7 @@
108
108
  "./components/sqm-timeline/sqm-timeline.js",
109
109
  "./components/sqm-titled-section/sqm-titled-section.js",
110
110
  "./components/sqm-user-name/sqm-user-name.js",
111
- "./components/sqm-widget-verification/sqm-widget-verification-internal.js",
111
+ "./components/sqm-widget-verification/sqm-widget-verification-controller.js",
112
112
  "./components/sqm-widget-verification/sqm-widget-verification.js",
113
113
  "./components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js",
114
114
  "./components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js",
@@ -3,7 +3,7 @@ import { createStyleSheet } from "../../styling/JSS";
3
3
  const style = {
4
4
  Wrapper: {
5
5
  maxWidth: "200px",
6
- border: "1px solid black",
6
+ marginLeft: "auto",
7
7
  },
8
8
  PayoutButtonDescription: {
9
9
  color: "var(--sl-color-neutral-500)",
@@ -17,7 +17,7 @@ export function PayoutButtonScrollView(props) {
17
17
  const { text, states } = props;
18
18
  if (!states.payoutSettingsComplete)
19
19
  return h("div", null);
20
- return (h("div", { part: "sqm-base", class: sheet.classes.Wrapper },
20
+ return (h("div", { class: sheet.classes.Wrapper },
21
21
  h("style", { type: "text/css" }, styleString),
22
22
  h("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.payoutButtonText, "scroll-animation": "smooth" }),
23
23
  h("p", { class: sheet.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
@@ -28,7 +28,7 @@ const vanillaStyle = `
28
28
 
29
29
  sqm-text h4 {
30
30
  font-size: var(--sl-font-size-large);
31
- font-weight: var(--sl-font-weight-semibold);
31
+ font-weight: var(--sl-font-weight-bold);
32
32
  color: var(--sl-color-neutral-800);
33
33
  margin: 0;
34
34
  }
@@ -10,12 +10,17 @@ const defaultProps = {
10
10
  sendCodeError: false,
11
11
  };
12
12
  export const Default = () => (h("sqm-email-verification", { demoData: {} }));
13
- export const EmailIsPrefilled = () => (h("sqm-email-verification", { demoData: {
14
- states: {
15
- ...defaultProps,
16
- email: "test@example.com",
17
- },
18
- } }));
13
+ export const EmailIsPrefilled = () => (h("div", null,
14
+ h("sqm-text", null,
15
+ h("h4", null, "Verify your email")),
16
+ h("sqm-text", null,
17
+ h("sub", null, "To get your cash paid out directly to your bank account, please complete your account setup")),
18
+ h("sqm-email-verification", { demoData: {
19
+ states: {
20
+ ...defaultProps,
21
+ email: "test@example.com",
22
+ },
23
+ } })));
19
24
  export const Loading = () => (h("sqm-email-verification", { demoData: {
20
25
  states: {
21
26
  ...defaultProps,
@@ -28,6 +33,17 @@ export const SaveLoading = () => (h("sqm-email-verification", { demoData: {
28
33
  loading: true,
29
34
  },
30
35
  } }));
36
+ export const WithHeader = () => (h("div", null,
37
+ h("sqm-text", null,
38
+ h("h4", null, "Verify your email")),
39
+ h("sqm-text", null,
40
+ h("sub", null, "To get your cash paid out directly to your bank account, please complete your account setup")),
41
+ h("sqm-email-verification", { demoData: {
42
+ states: {
43
+ ...defaultProps,
44
+ email: "test@example.com",
45
+ },
46
+ } })));
31
47
  export const InvalidEmail = () => (h("sqm-email-verification", { demoData: {
32
48
  states: {
33
49
  ...defaultProps,