@saasquatch/mint-components 1.15.4 → 1.15.5-2

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 (116) hide show
  1. package/dist/cjs/{ShadowViewAddon-e9dc77e3.js → ShadowViewAddon-28865623.js} +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +377 -234
  5. package/dist/cjs/{sqm-base-registration-form-view-66f99821.js → sqm-base-registration-form-view-8029d30e.js} +4 -9
  6. package/dist/cjs/sqm-big-stat_43.cjs.entry.js +143 -10
  7. package/dist/cjs/{sqm-invoice-table-view-5c74607f.js → sqm-invoice-table-view-3f60fba9.js} +1 -0
  8. package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +19 -28
  9. package/dist/cjs/sqm-stencilbook.cjs.entry.js +5 -8
  10. package/dist/cjs/{usePayoutStatus-733ef29a.js → usePayoutStatus-fc4e609e.js} +167 -2
  11. package/dist/collection/components/sqm-base-registration/BaseRegistrationForm.stories.js +2 -2
  12. package/dist/collection/components/sqm-base-registration/sqm-base-registration-form-view.js +4 -9
  13. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +1 -1
  14. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +1 -1
  15. package/dist/collection/components/sqm-input-field/sqm-input-field.js +1 -1
  16. package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +1 -1
  17. package/dist/collection/components/sqm-name-fields/NameFields.stories.js +0 -2
  18. package/dist/collection/components/sqm-name-fields/sqm-name-fields-view.js +3 -3
  19. package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +1 -31
  20. package/dist/collection/components/sqm-name-fields/useNameFields.js +0 -1
  21. package/dist/collection/components/sqm-password-field/sqm-password-field.js +2 -2
  22. package/dist/collection/components/sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories.js +0 -1
  23. package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +5 -7
  24. package/dist/collection/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.js +15 -22
  25. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  26. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +47 -40
  27. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +87 -1
  28. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +327 -0
  29. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +27 -3
  30. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +300 -0
  31. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +85 -1
  32. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +300 -0
  33. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +23 -12
  34. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
  35. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +90 -9
  36. package/dist/esm/{ShadowViewAddon-e0d5f1c9.js → ShadowViewAddon-f2176779.js} +2 -2
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/mint-components.js +1 -1
  39. package/dist/esm/sqm-banking-info-form_17.entry.js +331 -188
  40. package/dist/esm/{sqm-base-registration-form-view-d81e316a.js → sqm-base-registration-form-view-dafba287.js} +4 -9
  41. package/dist/esm/sqm-big-stat_43.entry.js +143 -10
  42. package/dist/esm/{sqm-invoice-table-view-3491dd80.js → sqm-invoice-table-view-01453fa3.js} +1 -0
  43. package/dist/esm/sqm-portal-google-registration-form.entry.js +19 -28
  44. package/dist/esm/sqm-stencilbook.entry.js +5 -8
  45. package/dist/esm/{usePayoutStatus-b89e8c49.js → usePayoutStatus-b4bdbfa7.js} +154 -4
  46. package/dist/esm-es5/{ShadowViewAddon-e0d5f1c9.js → ShadowViewAddon-f2176779.js} +1 -1
  47. package/dist/esm-es5/loader.js +1 -1
  48. package/dist/esm-es5/mint-components.js +1 -1
  49. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
  50. package/dist/esm-es5/sqm-base-registration-form-view-dafba287.js +1 -0
  51. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
  52. package/dist/esm-es5/sqm-invoice-table-view-01453fa3.js +1 -0
  53. package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
  54. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  55. package/dist/esm-es5/usePayoutStatus-b4bdbfa7.js +6 -0
  56. package/dist/mint-components/mint-components.esm.js +1 -1
  57. package/dist/mint-components/{p-3ac8613d.system.entry.js → p-02832118.system.entry.js} +1 -1
  58. package/dist/mint-components/{p-d15b642f.system.js → p-0d939b73.system.js} +1 -1
  59. package/dist/mint-components/p-2651ef99.system.js +1 -0
  60. package/dist/mint-components/p-35701119.js +1 -0
  61. package/dist/mint-components/p-37996351.system.js +1 -1
  62. package/dist/mint-components/{p-1edebab1.entry.js → p-4a731079.entry.js} +2 -2
  63. package/dist/mint-components/p-59fe6066.js +1 -0
  64. package/dist/mint-components/p-86a5db85.system.js +1 -0
  65. package/dist/mint-components/p-93db61eb.system.js +6 -0
  66. package/dist/mint-components/p-9c4f4cd6.entry.js +1 -0
  67. package/dist/mint-components/p-a3647f70.system.entry.js +1 -0
  68. package/dist/mint-components/p-a4f494ee.system.entry.js +1 -0
  69. package/dist/mint-components/p-ba14b5f7.system.entry.js +1 -0
  70. package/dist/mint-components/{p-3b6dccec.js → p-c1b074b6.js} +1 -1
  71. package/dist/mint-components/p-d0b404d5.entry.js +109 -0
  72. package/dist/mint-components/p-e3deed72.entry.js +273 -0
  73. package/dist/mint-components/p-fde41ad1.js +157 -0
  74. package/dist/types/components/sqm-base-registration/sqm-base-registration-form-view.d.ts +1 -2
  75. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
  76. package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +1 -1
  77. package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +1 -1
  78. package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +1 -1
  79. package/dist/types/components/sqm-name-fields/sqm-name-fields-view.d.ts +0 -1
  80. package/dist/types/components/sqm-name-fields/sqm-name-fields.d.ts +0 -5
  81. package/dist/types/components/sqm-name-fields/useNameFields.d.ts +0 -1
  82. package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +1 -1
  83. package/dist/types/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.d.ts +1 -2
  84. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +31 -0
  85. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +14 -0
  86. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +53 -0
  87. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +2 -1
  88. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +48 -0
  89. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +12 -0
  90. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +48 -0
  91. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  92. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -0
  93. package/dist/types/components.d.ts +296 -10
  94. package/docs/docs.docx +0 -0
  95. package/docs/raisins.json +1 -1
  96. package/grapesjs/grapesjs.js +1 -1
  97. package/package.json +1 -1
  98. package/dist/esm-es5/sqm-base-registration-form-view-d81e316a.js +0 -1
  99. package/dist/esm-es5/sqm-invoice-table-view-3491dd80.js +0 -1
  100. package/dist/esm-es5/usePayoutStatus-b89e8c49.js +0 -6
  101. package/dist/mint-components/p-021b0540.js +0 -46
  102. package/dist/mint-components/p-3d73cd84.entry.js +0 -220
  103. package/dist/mint-components/p-49932f12.system.js +0 -1
  104. package/dist/mint-components/p-7176a952.entry.js +0 -1
  105. package/dist/mint-components/p-8d0393d9.system.entry.js +0 -1
  106. package/dist/mint-components/p-9308221f.js +0 -1
  107. package/dist/mint-components/p-959c42b2.system.entry.js +0 -1
  108. package/dist/mint-components/p-a6494752.system.js +0 -6
  109. package/dist/mint-components/p-bc021969.system.js +0 -1
  110. package/dist/mint-components/p-c78e6066.entry.js +0 -273
  111. package/dist/mint-components/p-e64e8354.system.entry.js +0 -1
  112. package/dist/mint-components/p-e8e48982.js +0 -1
  113. package/dist/types/global/android.d.ts +0 -7
  114. package/dist/types/global/demo.d.ts +0 -2
  115. package/dist/types/stories/features.d.ts +0 -4
  116. package/dist/types/stories/templates.d.ts +0 -4
@@ -37,7 +37,6 @@ sqm-portal-register {
37
37
  const sheet = createStyleSheet(style);
38
38
  const styleString = sheet.toString();
39
39
  export function BaseRegistrationFormView(props) {
40
- var _a, _b;
41
40
  const { states, content, callbacks } = props;
42
41
  return (h("div", { class: sheet.classes.Wrapper },
43
42
  h("style", { type: "text/css" },
@@ -45,8 +44,10 @@ export function BaseRegistrationFormView(props) {
45
44
  styleString),
46
45
  h(TextSpanView, { type: "h3" }, content.pageLabel),
47
46
  h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
47
+ states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
48
+ h("div", { part: "erroralert-text" }, props.states.error))),
48
49
  content.formData,
49
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
50
+ h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
50
51
  if (!value) {
51
52
  return content.requiredFieldErrorMessage;
52
53
  }
@@ -54,13 +55,7 @@ export function BaseRegistrationFormView(props) {
54
55
  if (!value.includes("@")) {
55
56
  return content.invalidEmailErrorMessage;
56
57
  }
57
- } }, (((_a = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _a === void 0 ? void 0 : _a.email) ? {
58
- class: sheet.classes.ErrorStyle,
59
- helpText: ((_b = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ||
60
- content.requiredFieldErrorMessage,
61
- }
62
- : []))),
63
- content.terms,
58
+ } }),
64
59
  h("div", { class: sheet.classes.ButtonsContainer },
65
60
  h("sl-button", { submit: true, exportparts: "base: primarybutton-base", type: "primary", style: { margin: "0" } }, content.submitLabel || "Register"),
66
61
  h("sl-menu-divider", { style: { margin: "0" } }),
@@ -8,7 +8,7 @@ import { CheckboxFieldView, } from "./sqm-checkbox-field-view";
8
8
  import { useCheckboxField } from "./useCheckboxField";
9
9
  /**
10
10
  * @uiName Form Checkbox Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Checkbox Field - <sqm-checkbox-field checkbox-name="terms" checkbox-label="By signing up you agree to the {labelLink}" checkbox-label-link="https://example.com" checkbox-label-link-text="Terms and Conditions" error-message="Must be checked" ></sqm-checkbox-field>
14
14
  */
@@ -8,7 +8,7 @@ import { DropdownFieldView, } from "./sqm-dropdown-field-view";
8
8
  import { useDropdownField } from "./useDropdownField";
9
9
  /**
10
10
  * @uiName Form Dropdown Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
12
12
  * @slots [{"name":"", "title":"Drop Down Option"}]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Dropdown Field - <sqm-dropdown-field dropdown-label="Select an option" error-message="Select an option"><sl-menu-item value="option-1">Option 1</sl-menu-item><sl-menu-item value="option-2">Option 2</sl-menu-item><sl-menu-item value="option-3">Option 3</sl-menu-item></sqm-dropdown-field>
@@ -8,7 +8,7 @@ import { InputFieldView } from "./sqm-input-field-view";
8
8
  import { useInputField } from "./useInputField";
9
9
  /**
10
10
  * @uiName Form Input Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Input Field - <sqm-input-field input-label="Field Label" field-type="text" error-message="Cannot be empty"></sqm-input-field>
14
14
  */
@@ -7,7 +7,7 @@ import { CheckboxFieldView, } from "../sqm-checkbox-field/sqm-checkbox-field-vie
7
7
  import { useCheckboxField } from "../sqm-checkbox-field/useCheckboxField";
8
8
  /**
9
9
  * @uiName Marketing Emails Checkbox Field
10
- * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
10
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
11
  * @requiredFeatures ["MARKETING_EMAILS"]
12
12
  */
13
13
  export class MarketingEmailsCheckbox {
@@ -9,7 +9,6 @@ export default {
9
9
  };
10
10
  const props = {
11
11
  states: {
12
- optional: false,
13
12
  registrationFormState: {
14
13
  validationErrors: undefined,
15
14
  },
@@ -21,7 +20,6 @@ const props = {
21
20
  };
22
21
  const errorProps = {
23
22
  states: {
24
- optional: false,
25
23
  registrationFormState: {
26
24
  validationErrors: {
27
25
  firstName: "Cannot be empty",
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
- import { ErrorStyles } from "../../global/mixins";
3
2
  import { createStyleSheet } from "../../styling/JSS";
3
+ import { ErrorStyles } from "../../global/mixins";
4
4
  const style = {
5
5
  ErrorStyle: ErrorStyles,
6
6
  FieldsContainer: {
@@ -31,7 +31,7 @@ export function NameFieldsView(props) {
31
31
  h("style", { type: "text/css" },
32
32
  vanillaStyle,
33
33
  styleString),
34
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: !states.optional, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
34
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: true, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
35
35
  value: (_g = (_f = states.registrationFormState) === null || _f === void 0 ? void 0 : _f.initialData) === null || _g === void 0 ? void 0 : _g.firstName,
36
36
  }
37
37
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) ? {
@@ -39,7 +39,7 @@ export function NameFieldsView(props) {
39
39
  helpText: (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) || "Cannot be empty",
40
40
  }
41
41
  : []))),
42
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: !states.optional, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
42
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: true, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
43
43
  value: (_o = (_m = states.registrationFormState) === null || _m === void 0 ? void 0 : _m.initialData) === null || _o === void 0 ? void 0 : _o.lastName,
44
44
  }
45
45
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.lastName) ? {
@@ -21,11 +21,6 @@ export class NameFields {
21
21
  * @uiName Last name label
22
22
  */
23
23
  this.lastNameLabel = "Last Name";
24
- /**
25
- * @uiName Optional
26
- * @uiWidget
27
- */
28
- this.optional = false;
29
24
  withHooks(this);
30
25
  }
31
26
  disconnectedCallback() { }
@@ -77,36 +72,12 @@ export class NameFields {
77
72
  "reflect": false,
78
73
  "defaultValue": "\"Last Name\""
79
74
  },
80
- "optional": {
81
- "type": "boolean",
82
- "mutable": false,
83
- "complexType": {
84
- "original": "boolean",
85
- "resolved": "boolean",
86
- "references": {}
87
- },
88
- "required": false,
89
- "optional": false,
90
- "docs": {
91
- "tags": [{
92
- "text": "Optional",
93
- "name": "uiName"
94
- }, {
95
- "text": undefined,
96
- "name": "uiWidget"
97
- }],
98
- "text": ""
99
- },
100
- "attribute": "optional",
101
- "reflect": false,
102
- "defaultValue": "false"
103
- },
104
75
  "demoData": {
105
76
  "type": "unknown",
106
77
  "mutable": false,
107
78
  "complexType": {
108
79
  "original": "DemoData<NameFieldsViewProps>",
109
- "resolved": "{ states?: { optional: boolean; registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
80
+ "resolved": "{ states?: { registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
110
81
  "references": {
111
82
  "DemoData": {
112
83
  "location": "import",
@@ -139,7 +110,6 @@ export class NameFields {
139
110
  function useNameFieldsDemo(props) {
140
111
  return deepmerge({
141
112
  states: {
142
- optional: props.optional,
143
113
  validationErrors: [],
144
114
  content: {
145
115
  firstNameLabel: props.firstNameLabel,
@@ -4,7 +4,6 @@ export function useNameFields(props) {
4
4
  const registrationFormState = useDomContext(REGISTRATION_FORM_STATE_CONTEXT);
5
5
  return {
6
6
  states: {
7
- optional: props.optional,
8
7
  registrationFormState,
9
8
  content: {
10
9
  lastNameLabel: props.lastNameLabel,
@@ -3,13 +3,13 @@ import { withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { useState } from "@saasquatch/universal-hooks";
4
4
  import { Component, h, Prop, State } from "@stencil/core";
5
5
  import deepmerge from "deepmerge";
6
- import { getProps } from "../../utils/utils";
7
6
  import { validateNewPassword } from "./passwordValidation";
8
7
  import { PortalResetPasswordView, } from "./sqm-password-field-view";
9
8
  import { usePasswordField } from "./usePasswordField";
9
+ import { getProps } from "../../utils/utils";
10
10
  /**
11
11
  * @uiName Form Password Field
12
- * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Password Field - <sqm-password-field field-label="Password"></sqm-password-field>
15
15
  */
@@ -31,7 +31,6 @@ const defaultProps = {
31
31
  formData: (h("div", null,
32
32
  " ",
33
33
  h(NameFieldsView, { states: {
34
- optional: false,
35
34
  registrationFormState: {
36
35
  validationErrors: undefined,
37
36
  disabled: true,
@@ -2,11 +2,11 @@ import { isDemo, navigation } from "@saasquatch/component-boilerplate";
2
2
  import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { Component, h, Prop, State } from "@stencil/core";
4
4
  import deepmerge from "deepmerge";
5
- import { createStyleSheet } from "../../styling/JSS";
6
5
  import { BaseRegistrationFormView } from "../sqm-base-registration/sqm-base-registration-form-view";
7
6
  import { PortalRegistrationFormView, } from "../sqm-portal-registration-form/sqm-portal-registration-form-view";
8
7
  import { usePortalRegistrationForm } from "../sqm-portal-registration-form/usePortalRegistrationForm";
9
8
  import { usePortalGoogleRegistrationForm } from "./usePortalGoogleRegistrationForm";
9
+ import { createStyleSheet } from "../../styling/JSS";
10
10
  /**
11
11
  * @uiName Google Registration
12
12
  * @canvasRenderer always-replace
@@ -161,7 +161,7 @@ export class PortalGoogleRegistrationForm {
161
161
  };
162
162
  const sheet = createStyleSheet(styles);
163
163
  const styleString = sheet.toString();
164
- const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, validationErrors, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
164
+ const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, emailValidationError, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
165
165
  const content = {
166
166
  formData: h("slot", { name: "formData" }),
167
167
  googleButton: (h("sqm-google-sign-in", { text: this.googleButtonText, onInitComplete: handleGoogleInit })),
@@ -192,16 +192,14 @@ export class PortalGoogleRegistrationForm {
192
192
  };
193
193
  if (showRegistrationForm.mode === "base") {
194
194
  return (h(BaseRegistrationFormView, { states: {
195
- validationErrors,
195
+ error: emailValidationError,
196
196
  }, callbacks: { handleEmailSubmit }, content: content }));
197
197
  }
198
198
  return (h(PortalRegistrationFormView, { states: {
199
199
  ...states,
200
200
  emailDisabled: true,
201
201
  hidePasswords: showRegistrationForm.mode === "google",
202
- }, callbacks: callbacks,
203
- // Show terms only on first screen
204
- content: { ...content, terms: null }, refs: refs }));
202
+ }, callbacks: callbacks, content: content, refs: refs }));
205
203
  }
206
204
  static get is() { return "sqm-portal-google-registration-form"; }
207
205
  static get encapsulation() { return "shadow"; }
@@ -876,7 +874,7 @@ function useGoogleDemo(props) {
876
874
  mode: "base",
877
875
  });
878
876
  return deepmerge({
879
- validationErrors: {},
877
+ emailValidationError: false,
880
878
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
881
879
  showRegistrationForm,
882
880
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -1,8 +1,9 @@
1
1
  import { useState } from "@saasquatch/universal-hooks";
2
2
  import jsonpointer from "jsonpointer";
3
- import { jwtDecode } from "jwt-decode";
4
3
  import { useRegistrationForm } from "../sqm-portal-registration-form/useRegistrationFormState";
4
+ import { jwtDecode } from "jwt-decode";
5
5
  export function usePortalGoogleRegistrationForm(props) {
6
+ const [emailValidationError, setEmailValidationError] = useState(null);
6
7
  const [registrationFormState, setRegistrationFormState] = useRegistrationForm();
7
8
  const [showRegistrationForm, setShowRegistrationForm] = useState({
8
9
  mode: "base",
@@ -10,40 +11,33 @@ export function usePortalGoogleRegistrationForm(props) {
10
11
  const handleEmailSubmit = async (event) => {
11
12
  const formControls = event.target.getFormControls();
12
13
  let formData = {};
13
- let validationErrors = {};
14
+ let errorMessage = null;
14
15
  formControls.forEach((control) => {
15
16
  if (!control.name)
16
17
  return;
17
- const key = control.name;
18
- const value = control.value;
19
- jsonpointer.set(formData, key, value);
20
- if (control.required && !value) {
21
- jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
22
- }
18
+ jsonpointer.set(formData, control.name, control.value);
19
+ // only validate email field
20
+ if (control.name !== "/email")
21
+ return;
22
+ if (control.required && !control.value)
23
+ errorMessage = props.requiredFieldErrorMessage;
23
24
  if (typeof control.validationError === "function") {
24
25
  const validate = control.validationError;
25
26
  const validationError = validate({
26
27
  control,
27
- key,
28
- value,
28
+ key: "email",
29
+ value: control.value,
29
30
  });
30
31
  if (validationError)
31
- jsonpointer.set(validationErrors, key, validationError);
32
+ errorMessage = validationError;
32
33
  }
33
34
  });
34
- if (Object.keys(validationErrors).length) {
35
- // early return for validation errors
36
- setRegistrationFormState({
37
- ...registrationFormState,
38
- loading: false,
39
- error: "",
40
- validationErrors,
41
- });
35
+ if (errorMessage) {
36
+ setEmailValidationError(errorMessage);
42
37
  return;
43
38
  }
44
39
  setRegistrationFormState({
45
40
  ...registrationFormState,
46
- validationErrors: {},
47
41
  initialData: {
48
42
  ...registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.initialData,
49
43
  ...formData,
@@ -73,9 +67,8 @@ export function usePortalGoogleRegistrationForm(props) {
73
67
  }
74
68
  };
75
69
  return {
76
- registrationFormState,
77
70
  showRegistrationForm,
78
- validationErrors: registrationFormState.validationErrors,
71
+ emailValidationError,
79
72
  handleGoogleInit,
80
73
  handleEmailSubmit,
81
74
  };
@@ -32,6 +32,7 @@ const stepOneProps = {
32
32
  },
33
33
  },
34
34
  data: {
35
+ partnerData: {},
35
36
  regionLabelEnum: "STATE",
36
37
  regions: [],
37
38
  phoneCountries: [
@@ -6,7 +6,7 @@ import { COUNTRIES_QUERY_NAMESPACE, TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAME
6
6
  import { INDIRECT_TAX_PROVINCES, INDIRECT_TAX_SPAIN_REGIONS, } from "../subregions";
7
7
  import { getCountryObj, validTaxDocument } from "../utils";
8
8
  import { TAX_FORM_UPDATED_EVENT_KEY } from "../eventKeys";
9
- const CONNECT_PARTNER = gql `
9
+ export const CONNECT_PARTNER = gql `
10
10
  mutation createImpactConnection($vars: ImpactConnectionInput!) {
11
11
  createImpactConnection(impactConnectionInput: $vars) {
12
12
  success
@@ -111,8 +111,51 @@ export function useIndirectTaxForm(props) {
111
111
  console.error("Could not detect select change");
112
112
  setFormState((p) => ({ ...p, [field]: value }));
113
113
  };
114
- const onSubmit = async (event) => {
114
+ async function connectPartner(formData) {
115
115
  var _a, _b, _c, _d, _e;
116
+ const vars = {
117
+ user: {
118
+ id: user.id,
119
+ accountId: user.accountId,
120
+ },
121
+ firstName: userForm.firstName,
122
+ lastName: userForm.lastName,
123
+ countryCode: userForm.countryCode,
124
+ currency: userForm.currency,
125
+ address: userForm.address,
126
+ city: userForm.city,
127
+ state: userForm.state,
128
+ postalCode: userForm.postalCode,
129
+ phoneNumber: userForm.phoneNumber,
130
+ phoneNumberCountryCode: userForm.phoneNumberCountryCode,
131
+ indirectTaxCountryCode: formData.selectedRegion,
132
+ indirectTaxRegion: formData.province || formData.subRegion,
133
+ indirectTaxId: formData.indirectTaxNumber,
134
+ additionalTaxId: formData.qstNumber,
135
+ withholdingTaxId: formData.subRegionTaxNumber,
136
+ };
137
+ const result = await connectImpactPartner({
138
+ vars,
139
+ });
140
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
141
+ throw new Error();
142
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
143
+ // Output backend errors to console for now
144
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
145
+ throw new Error();
146
+ }
147
+ await refetch();
148
+ const resultPublisher = (_e = (_d = (_c = result
149
+ .createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
150
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
151
+ // Fire form change event
152
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
153
+ return {
154
+ resultPublisher,
155
+ hasValidCurrentDocument,
156
+ };
157
+ }
158
+ const onSubmit = async (event) => {
116
159
  if (!option) {
117
160
  setErrors({ taxDetails: true });
118
161
  return;
@@ -138,44 +181,7 @@ export function useIndirectTaxForm(props) {
138
181
  }
139
182
  setLoading(true);
140
183
  try {
141
- const vars = {
142
- user: {
143
- id: user.id,
144
- accountId: user.accountId,
145
- },
146
- firstName: userForm.firstName,
147
- lastName: userForm.lastName,
148
- countryCode: userForm.countryCode,
149
- currency: userForm.currency,
150
- address: userForm.address,
151
- city: userForm.city,
152
- state: userForm.state,
153
- postalCode: userForm.postalCode,
154
- phoneNumber: userForm.phoneNumber,
155
- phoneNumberCountryCode: userForm.phoneNumberCountryCode,
156
- indirectTaxCountryCode: formData.selectedRegion,
157
- indirectTaxRegion: formData.province || formData.subRegion,
158
- indirectTaxId: formData.indirectTaxNumber,
159
- additionalTaxId: formData.qstNumber,
160
- withholdingTaxId: formData.subRegionTaxNumber,
161
- };
162
- const result = await connectImpactPartner({
163
- vars,
164
- });
165
- if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
166
- throw new Error();
167
- if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
168
- // Output backend errors to console for now
169
- console.error("Failed to create Impact connection: ", result.createImpactConnection
170
- .validationErrors);
171
- throw new Error();
172
- }
173
- await refetch();
174
- const resultPublisher = (_e = (_d = (_c = result
175
- .createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
176
- const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
177
- // Fire form change event
178
- window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
184
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
179
185
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
180
186
  !hasValidCurrentDocument) {
181
187
  // Go to docusign form
@@ -226,6 +232,7 @@ export function useIndirectTaxForm(props) {
226
232
  ...p,
227
233
  hasSubRegionTaxNumber: !p.hasSubRegionTaxNumber,
228
234
  })),
235
+ connectPartner,
229
236
  },
230
237
  data: {
231
238
  esRegions: INDIRECT_TAX_SPAIN_REGIONS,
@@ -160,7 +160,7 @@ export function PayoutStatusAlertView(props) {
160
160
  class: sheet.classes.WarningAlertContainer,
161
161
  };
162
162
  }
163
- case "ACCOUNT_REVIEW":
163
+ case "NEW_PAYEE_REVIEW":
164
164
  return {
165
165
  header: text.accountReviewHeader,
166
166
  description: intl.formatMessage({
@@ -174,6 +174,90 @@ export function PayoutStatusAlertView(props) {
174
174
  icon: "exclamation-triangle",
175
175
  class: sheet.classes.WarningAlertContainer,
176
176
  };
177
+ case "PAYMENT_HOLD_ON_CHANGE":
178
+ return {
179
+ header: text.paymentHoldOnChangeHeader,
180
+ description: intl.formatMessage({
181
+ id: "accountReviewDescription",
182
+ defaultMessage: text.paymentHoldOnChangeDescription,
183
+ }, {
184
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
185
+ }),
186
+ buttonText: null,
187
+ alertType: "warning",
188
+ icon: "exclamation-triangle",
189
+ class: sheet.classes.WarningAlertContainer,
190
+ };
191
+ case "BENEFICIARY_NAME_INVALID":
192
+ return {
193
+ header: text.beneficiaryNameInvalidHeader,
194
+ description: intl.formatMessage({
195
+ id: "accountReviewDescription",
196
+ defaultMessage: text.beneficiaryNameInvalidDescription,
197
+ }, {
198
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
199
+ }),
200
+ buttonText: text.editPaymentInformationButton,
201
+ alertType: "warning",
202
+ icon: "exclamation-triangle",
203
+ class: sheet.classes.WarningAlertContainer,
204
+ };
205
+ case "BENEFICIARY_NAME_MISMATCH":
206
+ return {
207
+ header: text.beneficiaryNameMismatchHeader,
208
+ description: intl.formatMessage({
209
+ id: "accountReviewDescription",
210
+ defaultMessage: text.beneficiaryNameMismatchDescription,
211
+ }, {
212
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
213
+ }),
214
+ buttonText: text.editPaymentInformationButton,
215
+ alertType: "warning",
216
+ icon: "exclamation-triangle",
217
+ class: sheet.classes.WarningAlertContainer,
218
+ };
219
+ case "BANK_TAX_NAME_MISMATCH":
220
+ return {
221
+ header: text.bankTaxNameMismatchHeader,
222
+ description: intl.formatMessage({
223
+ id: "accountReviewDescription",
224
+ defaultMessage: text.bankTaxNameMismatchDescription,
225
+ }, {
226
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
227
+ }),
228
+ buttonText: text.editPaymentInformationButton,
229
+ alertType: "warning",
230
+ icon: "exclamation-triangle",
231
+ class: sheet.classes.WarningAlertContainer,
232
+ };
233
+ case "WITHDRAWAL_SETTINGS_INVALID":
234
+ return {
235
+ header: text.withdrawalSettingsInvalidHeader,
236
+ description: intl.formatMessage({
237
+ id: "accountReviewDescription",
238
+ defaultMessage: text.withdrawalSettingsInvalidDescription,
239
+ }, {
240
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
241
+ }),
242
+ buttonText: text.editPaymentInformationButton,
243
+ alertType: "warning",
244
+ icon: "exclamation-triangle",
245
+ class: sheet.classes.WarningAlertContainer,
246
+ };
247
+ case "PAYMENT_RETURNED":
248
+ return {
249
+ header: text.paymentReturnedHeader,
250
+ description: intl.formatMessage({
251
+ id: "accountReviewDescription",
252
+ defaultMessage: text.paymentReturnedDescription,
253
+ }, {
254
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
255
+ }),
256
+ buttonText: text.editPaymentInformationButton,
257
+ alertType: "warning",
258
+ icon: "exclamation-triangle",
259
+ class: sheet.classes.WarningAlertContainer,
260
+ };
177
261
  case "HOLD":
178
262
  return {
179
263
  header: text.holdHeader,
@@ -207,6 +291,8 @@ export function PayoutStatusAlertView(props) {
207
291
  case "VERIFICATION:REQUIRED":
208
292
  return (h("sl-button", { type: "default", loading: states.veriffLoading, onClick: callbacks.onClick }, text.verificationRequiredButtonText));
209
293
  default:
294
+ if (alertDetails.buttonText)
295
+ return (h("sl-button", { type: "default", onClick: callbacks.onPaymentInfoClick }, alertDetails.buttonText));
210
296
  return;
211
297
  }
212
298
  }