@saasquatch/mint-components 2.2.0-7 → 2.2.0-8

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 (214) hide show
  1. package/dist/cjs/{ShadowViewAddon-1c054d52.js → ShadowViewAddon-3b477e58.js} +429 -27
  2. package/dist/cjs/{data-c03e282a.js → data-89ac73dd.js} +1 -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_10.cjs.entry.js +48 -307
  6. package/dist/cjs/sqm-big-stat_46.cjs.entry.js +334 -36
  7. package/dist/cjs/sqm-code-verification.cjs.entry.js +1 -1
  8. package/dist/cjs/sqm-email-verification_2.cjs.entry.js +19 -12
  9. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  10. package/dist/cjs/{sqm-partner-info-modal-view-97770d03.js → sqm-partner-info-modal-view-f6faecf5.js} +1 -1
  11. package/dist/cjs/{sqm-portal-container-view-70a47420.js → sqm-portal-container-view-757f921b.js} +5 -6
  12. package/dist/cjs/{sqm-portal-email-verification-view-d51c2a06.js → sqm-portal-email-verification-view-abb773a7.js} +1 -1
  13. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
  14. package/dist/cjs/sqm-portal-forgot-password_6.cjs.entry.js +5 -5
  15. package/dist/cjs/{sqm-portal-profile-view-e6927959.js → sqm-portal-profile-view-3515e1e5.js} +1 -1
  16. package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
  17. package/dist/cjs/{sqm-portal-registration-form-view-fd48f1d3.js → sqm-portal-registration-form-view-a45f7a52.js} +1 -1
  18. package/dist/cjs/{sqm-portal-reset-password-view-d90d77f9.js → sqm-portal-reset-password-view-a767b044.js} +1 -1
  19. package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +2 -2
  20. package/dist/cjs/{sqm-portal-verify-email-view-6258dcae.js → sqm-portal-verify-email-view-717d0633.js} +1 -1
  21. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
  22. package/dist/cjs/sqm-rewards-table-customer-note-cell.cjs.entry.js +1 -1
  23. package/dist/cjs/sqm-stencilbook.cjs.entry.js +176 -32
  24. package/dist/cjs/{sqm-text-span-view-8a32dd8c.js → sqm-text-span-view-b9e10f5d.js} +1 -1
  25. package/dist/cjs/sqm-text-span.cjs.entry.js +1 -1
  26. package/dist/cjs/{sqm-user-info-form-view-4d56b339.js → sqm-user-info-form-view-0e1ddbe4.js} +3 -388
  27. package/dist/cjs/{usePayoutStatus-0a98ee05.js → useIndirectTaxForm-c3c1ec56.js} +291 -0
  28. package/dist/cjs/utils-a3b3d05b.js +478 -0
  29. package/dist/collection/components/sqm-big-stat/useBigStat.js +5 -6
  30. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +1 -1
  31. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +2 -3
  32. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +1 -1
  33. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +2 -2
  34. package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +15 -8
  35. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +6 -7
  36. package/dist/collection/components/sqm-portal-google-login/sqm-portal-google-login.js +1 -1
  37. package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +1 -1
  38. package/dist/collection/components/sqm-referral-iframe/ReferralIframe.stories.js +1 -0
  39. package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe-view.js +1 -1
  40. package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe.js +27 -1
  41. package/dist/collection/components/sqm-share-code/sqm-share-code.js +0 -1
  42. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +136 -11
  43. package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +14 -5
  44. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +192 -0
  45. package/dist/collection/components/sqm-share-link/sqm-share-link.js +935 -48
  46. package/dist/collection/components/sqm-share-link/useShareLink.js +227 -14
  47. package/dist/collection/components/sqm-text-span/sqm-text-span-view.js +1 -1
  48. package/dist/collection/components/tax-and-cash/data.js +1 -0
  49. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/formDefinitions.js +19 -1
  50. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +50 -0
  51. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +4 -4
  52. package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js +2 -2
  53. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +65 -7
  54. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +49 -3
  55. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +2 -2
  56. package/dist/esm/{ShadowViewAddon-4d554869.js → ShadowViewAddon-e115fa1c.js} +431 -30
  57. package/dist/esm/{data-017e5ef2.js → data-8698cbc6.js} +1 -0
  58. package/dist/esm/loader.js +1 -1
  59. package/dist/esm/mint-components.js +1 -1
  60. package/dist/esm/sqm-banking-info-form_10.entry.js +36 -295
  61. package/dist/esm/sqm-big-stat_46.entry.js +333 -35
  62. package/dist/esm/sqm-code-verification.entry.js +1 -1
  63. package/dist/esm/sqm-email-verification_2.entry.js +19 -12
  64. package/dist/esm/sqm-empty_4.entry.js +1 -1
  65. package/dist/esm/{sqm-partner-info-modal-view-5709904e.js → sqm-partner-info-modal-view-d6f3a215.js} +1 -1
  66. package/dist/esm/{sqm-portal-container-view-a8c708cd.js → sqm-portal-container-view-200c9df8.js} +6 -7
  67. package/dist/esm/{sqm-portal-email-verification-view-58bad294.js → sqm-portal-email-verification-view-fde1eb35.js} +1 -1
  68. package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
  69. package/dist/esm/sqm-portal-forgot-password_6.entry.js +5 -5
  70. package/dist/esm/{sqm-portal-profile-view-115bad4a.js → sqm-portal-profile-view-2018590a.js} +1 -1
  71. package/dist/esm/sqm-portal-profile.entry.js +2 -2
  72. package/dist/esm/{sqm-portal-registration-form-view-9bf30b56.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
  73. package/dist/esm/{sqm-portal-reset-password-view-f8d1689c.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
  74. package/dist/esm/sqm-portal-reset-password.entry.js +2 -2
  75. package/dist/esm/{sqm-portal-verify-email-view-c053ead1.js → sqm-portal-verify-email-view-590f964b.js} +1 -1
  76. package/dist/esm/sqm-referral-table_11.entry.js +1 -1
  77. package/dist/esm/sqm-rewards-table-customer-note-cell.entry.js +1 -1
  78. package/dist/esm/sqm-stencilbook.entry.js +174 -30
  79. package/dist/esm/{sqm-text-span-view-4db9e33f.js → sqm-text-span-view-72f43dff.js} +1 -1
  80. package/dist/esm/sqm-text-span.entry.js +1 -1
  81. package/dist/esm/{sqm-user-info-form-view-d13f9d3e.js → sqm-user-info-form-view-e1ba6009.js} +3 -385
  82. package/dist/esm/{usePayoutStatus-227ae365.js → useIndirectTaxForm-b2888ea5.js} +291 -3
  83. package/dist/esm/utils-4f5cd04c.js +467 -0
  84. package/dist/esm-es5/ShadowViewAddon-e115fa1c.js +1 -0
  85. package/dist/esm-es5/data-8698cbc6.js +1 -0
  86. package/dist/esm-es5/loader.js +1 -1
  87. package/dist/esm-es5/mint-components.js +1 -1
  88. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  89. package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -1
  90. package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
  91. package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
  92. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  93. package/dist/esm-es5/{sqm-partner-info-modal-view-5709904e.js → sqm-partner-info-modal-view-d6f3a215.js} +1 -1
  94. package/dist/esm-es5/sqm-portal-container-view-200c9df8.js +1 -0
  95. package/dist/esm-es5/{sqm-portal-email-verification-view-58bad294.js → sqm-portal-email-verification-view-fde1eb35.js} +1 -1
  96. package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
  97. package/dist/esm-es5/sqm-portal-forgot-password_6.entry.js +1 -1
  98. package/dist/esm-es5/{sqm-portal-profile-view-115bad4a.js → sqm-portal-profile-view-2018590a.js} +1 -1
  99. package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
  100. package/dist/esm-es5/{sqm-portal-registration-form-view-9bf30b56.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
  101. package/dist/esm-es5/{sqm-portal-reset-password-view-f8d1689c.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
  102. package/dist/esm-es5/sqm-portal-reset-password.entry.js +1 -1
  103. package/dist/esm-es5/{sqm-portal-verify-email-view-c053ead1.js → sqm-portal-verify-email-view-590f964b.js} +1 -1
  104. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  105. package/dist/esm-es5/sqm-rewards-table-customer-note-cell.entry.js +1 -1
  106. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  107. package/dist/esm-es5/{sqm-text-span-view-4db9e33f.js → sqm-text-span-view-72f43dff.js} +1 -1
  108. package/dist/esm-es5/sqm-text-span.entry.js +1 -1
  109. package/dist/esm-es5/sqm-user-info-form-view-e1ba6009.js +1 -0
  110. package/dist/esm-es5/useIndirectTaxForm-b2888ea5.js +6 -0
  111. package/dist/esm-es5/utils-4f5cd04c.js +1 -0
  112. package/dist/mint-components/mint-components.esm.js +1 -1
  113. package/dist/mint-components/{p-4034f157.js → p-0afa6148.js} +1 -1
  114. package/dist/mint-components/p-0b1e90fe.system.js +1 -0
  115. package/dist/mint-components/{p-731c4d33.entry.js → p-13d1b10d.entry.js} +1 -1
  116. package/dist/mint-components/{p-b1b20d42.entry.js → p-1d398dbc.entry.js} +1 -1
  117. package/dist/mint-components/p-1e6a2945.js +1 -0
  118. package/dist/mint-components/p-1efb42e2.js +499 -0
  119. package/dist/mint-components/p-1f387c7b.system.js +1 -1
  120. package/dist/mint-components/{p-d6ccb6fc.entry.js → p-2ed13619.entry.js} +1 -1
  121. package/dist/mint-components/{p-b1765c78.system.js → p-31815fb6.system.js} +1 -1
  122. package/dist/mint-components/p-335a5736.entry.js +1 -0
  123. package/dist/mint-components/{p-dbc8afaa.system.entry.js → p-33ca28ba.system.entry.js} +1 -1
  124. package/dist/mint-components/{p-d1c1c2c9.entry.js → p-3596e241.entry.js} +2 -2
  125. package/dist/mint-components/{p-1faa6ddf.system.entry.js → p-37e24621.system.entry.js} +1 -1
  126. package/dist/mint-components/{p-dafe30c3.entry.js → p-4d73a616.entry.js} +1 -1
  127. package/dist/mint-components/{p-9ba8b28b.system.entry.js → p-51ae6716.system.entry.js} +1 -1
  128. package/dist/mint-components/p-58c24352.system.js +6 -0
  129. package/dist/mint-components/{p-00046ec1.js → p-5c52100b.js} +1 -0
  130. package/dist/mint-components/{p-f368f04a.system.js → p-686dd5eb.system.js} +1 -1
  131. package/dist/mint-components/{p-379cb9f1.system.js → p-7562cd98.system.js} +1 -1
  132. package/dist/mint-components/{p-bd972473.system.js → p-7628e56f.system.js} +1 -1
  133. package/dist/mint-components/{p-d71a8b38.entry.js → p-7cbdf341.entry.js} +2 -2
  134. package/dist/mint-components/p-7d2d9ef9.system.js +1 -0
  135. package/dist/mint-components/{p-8d073bdf.entry.js → p-84495fb8.entry.js} +1 -1
  136. package/dist/mint-components/{p-cfba6b4e.system.entry.js → p-86d20b47.system.entry.js} +1 -1
  137. package/dist/mint-components/{p-71561bb2.system.entry.js → p-8899ff38.system.entry.js} +1 -1
  138. package/dist/mint-components/p-9674856e.entry.js +9 -0
  139. package/dist/mint-components/p-9c1f5317.system.js +1 -0
  140. package/dist/mint-components/p-9f48640d.js +1 -0
  141. package/dist/mint-components/{p-df88dcaa.system.js → p-a4825ec2.system.js} +1 -1
  142. package/dist/mint-components/p-a88b8165.system.entry.js +1 -0
  143. package/dist/mint-components/p-abe9f5b1.js +99 -0
  144. package/dist/mint-components/{p-31edeff4.system.js → p-ae2f610e.system.js} +1 -1
  145. package/dist/mint-components/p-b222bace.system.entry.js +1 -0
  146. package/dist/mint-components/{p-45e2a83a.js → p-b3ad957c.js} +1 -1
  147. package/dist/mint-components/{p-2ab31786.js → p-b871d158.js} +1 -1
  148. package/dist/mint-components/p-b96ed8eb.js +1 -0
  149. package/dist/mint-components/p-bbd41807.entry.js +291 -0
  150. package/dist/mint-components/{p-9b15ee47.system.js → p-be6a0dee.system.js} +1 -1
  151. package/dist/mint-components/{p-a7f72a66.js → p-bee4af5d.js} +1 -1
  152. package/dist/mint-components/{p-0102ad17.system.entry.js → p-c0f8f977.system.entry.js} +1 -1
  153. package/dist/mint-components/{p-50d959bd.js → p-c813ec64.js} +1 -1
  154. package/dist/mint-components/p-cdabd9de.system.js +1 -0
  155. package/dist/mint-components/{p-7699d40a.system.entry.js → p-cfc35705.system.entry.js} +1 -1
  156. package/dist/mint-components/p-d2ede7cd.system.entry.js +1 -0
  157. package/dist/mint-components/{p-e1292288.system.entry.js → p-d3b1ab20.system.entry.js} +1 -1
  158. package/dist/mint-components/p-db6bf7cf.system.entry.js +1 -0
  159. package/dist/mint-components/p-e30abc44.js +1 -0
  160. package/dist/mint-components/{p-3218bb1d.entry.js → p-e506bf7f.entry.js} +1 -1
  161. package/dist/mint-components/{p-ae4994e1.js → p-e8e7af06.js} +1 -1
  162. package/dist/mint-components/p-ebc519bc.system.js +1 -0
  163. package/dist/mint-components/{p-eee0bcf4.entry.js → p-ef32fa8f.entry.js} +1 -1
  164. package/dist/mint-components/{p-ca5b9f4d.system.entry.js → p-fa85ea51.system.entry.js} +1 -1
  165. package/dist/mint-components/p-ffcebe78.entry.js +83 -0
  166. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
  167. package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe-view.d.ts +1 -0
  168. package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe.d.ts +5 -0
  169. package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +9 -0
  170. package/dist/types/components/sqm-share-link/UseShareLink.stories.d.ts +6 -0
  171. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +41 -0
  172. package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +195 -2
  173. package/dist/types/components/sqm-share-link/useShareLink.d.ts +33 -4
  174. package/dist/types/components/tax-and-cash/data.d.ts +2 -0
  175. package/dist/types/components/tax-and-cash/sqm-banking-info-form/formDefinitions.d.ts +6 -0
  176. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +8 -0
  177. package/dist/types/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.d.ts +2 -0
  178. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +10 -0
  179. package/dist/types/components.d.ts +397 -4
  180. package/docs/docs.docx +0 -0
  181. package/docs/raisins.json +1 -1
  182. package/grapesjs/grapesjs.js +1 -1
  183. package/package.json +1 -1
  184. package/readme.md +60 -1
  185. package/shoelace/assets/icons/twitter-x.svg +4 -0
  186. package/dist/cjs/utils-15ce04e3.js +0 -93
  187. package/dist/esm/utils-17daa419.js +0 -85
  188. package/dist/esm-es5/ShadowViewAddon-4d554869.js +0 -1
  189. package/dist/esm-es5/data-017e5ef2.js +0 -1
  190. package/dist/esm-es5/sqm-portal-container-view-a8c708cd.js +0 -1
  191. package/dist/esm-es5/sqm-user-info-form-view-d13f9d3e.js +0 -1
  192. package/dist/esm-es5/usePayoutStatus-227ae365.js +0 -6
  193. package/dist/esm-es5/utils-17daa419.js +0 -1
  194. package/dist/mint-components/p-00dd7f08.js +0 -1
  195. package/dist/mint-components/p-3254fbb4.entry.js +0 -291
  196. package/dist/mint-components/p-4a8ffa03.system.js +0 -1
  197. package/dist/mint-components/p-4e34bcb1.system.js +0 -1
  198. package/dist/mint-components/p-53d90eb5.js +0 -463
  199. package/dist/mint-components/p-5e300ec1.system.js +0 -6
  200. package/dist/mint-components/p-614723aa.js +0 -1
  201. package/dist/mint-components/p-6af71f23.entry.js +0 -9
  202. package/dist/mint-components/p-6c23abd8.entry.js +0 -1
  203. package/dist/mint-components/p-753d06ef.entry.js +0 -133
  204. package/dist/mint-components/p-7aace2b3.system.js +0 -1
  205. package/dist/mint-components/p-b0ab1065.system.entry.js +0 -1
  206. package/dist/mint-components/p-b52a7da9.system.entry.js +0 -1
  207. package/dist/mint-components/p-b699f76e.system.js +0 -1
  208. package/dist/mint-components/p-b6a1e2ac.js +0 -1
  209. package/dist/mint-components/p-b7370480.js +0 -1
  210. package/dist/mint-components/p-ce7d824b.js +0 -49
  211. package/dist/mint-components/p-e93cdcbd.system.js +0 -1
  212. package/dist/mint-components/p-eb285d38.system.entry.js +0 -1
  213. package/dist/mint-components/p-f782ff10.system.entry.js +0 -1
  214. package/docs/stats.json +0 -122783
@@ -2,6 +2,9 @@
2
2
 
3
3
  const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
4
4
  const index_module = require('./index.module-f8c8495f.js');
5
+ const jsonpointer = require('./jsonpointer-11327262.js');
6
+ const utils = require('./utils-a3b3d05b.js');
7
+ const data = require('./data-89ac73dd.js');
5
8
  const eventKeys = require('./eventKeys-7af4df4d.js');
6
9
 
7
10
  var toArray = function toArray(a) {
@@ -1108,7 +1111,295 @@ function usePayoutStatus(props) {
1108
1111
  };
1109
1112
  }
1110
1113
 
1114
+ const CONNECT_PARTNER = index_module.dist.gql `
1115
+ mutation createImpactConnection($vars: ImpactConnectionInput!) {
1116
+ createImpactConnection(impactConnectionInput: $vars) {
1117
+ success
1118
+ validationErrors {
1119
+ field
1120
+ message
1121
+ }
1122
+ user {
1123
+ id
1124
+ accountId
1125
+ impactConnection {
1126
+ connected
1127
+ publisher {
1128
+ brandedSignup
1129
+ requiredTaxDocumentType
1130
+ currentTaxDocument {
1131
+ type
1132
+ status
1133
+ }
1134
+ }
1135
+ }
1136
+ }
1137
+ }
1138
+ }
1139
+ `;
1140
+ const COMPLETE_PARTNER = index_module.dist.gql `
1141
+ mutation completeImpactConnection($vars: ImpactConnectionInput!) {
1142
+ completeImpactConnection(impactConnectionInput: $vars) {
1143
+ success
1144
+ validationErrors {
1145
+ field
1146
+ message
1147
+ }
1148
+ user {
1149
+ id
1150
+ accountId
1151
+ impactConnection {
1152
+ connected
1153
+ publisher {
1154
+ brandedSignup
1155
+ requiredTaxDocumentType
1156
+ currentTaxDocument {
1157
+ type
1158
+ status
1159
+ }
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1165
+ `;
1166
+ function getOption(countries, countryCode) {
1167
+ if (!countries)
1168
+ return;
1169
+ if (countries.find((c) => c.countryCode === countryCode)) {
1170
+ return "otherRegion";
1171
+ }
1172
+ else {
1173
+ return "notRegistered";
1174
+ }
1175
+ }
1176
+ function useIndirectTaxForm(props) {
1177
+ var _a, _b, _c, _d, _e;
1178
+ const user = index_module.J();
1179
+ const locale = index_module.L();
1180
+ const formRef = domContextHooks_module.useRef(null);
1181
+ const context = index_module.Fn(data.TAX_FORM_CONTEXT_NAMESPACE);
1182
+ const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
1183
+ const [connectImpactPartner, { loading: connectLoading }] = index_module.$e(CONNECT_PARTNER);
1184
+ const [completeImpactPartner, { loading: completeLoading }] = index_module.$e(COMPLETE_PARTNER);
1185
+ const userForm = index_module.Fn(data.USER_FORM_CONTEXT_NAMESPACE);
1186
+ const { data: userData, refetch, errors: userError, } = index_module.$n(data.USER_QUERY_NAMESPACE);
1187
+ const { data: _countriesRes, loading: countriesLoading } = index_module.$n(data.COUNTRIES_QUERY_NAMESPACE);
1188
+ const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
1189
+ const _countries = domContextHooks_module.useMemo(() => { var _a, _b; return (_b = (_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((country) => utils.getCountryObj({ countryCode: country.countryCode, locale: intlLocale })); }, [(_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
1190
+ const [loading, setLoading] = domContextHooks_module.useState(false);
1191
+ const [formState, setFormState] = domContextHooks_module.useState({});
1192
+ const [errors, setErrors] = domContextHooks_module.useState({});
1193
+ const [countrySearch, setCountrySearch] = domContextHooks_module.useState("");
1194
+ const [filteredCountries, setFilteredCountries] = domContextHooks_module.useState(_countries || []);
1195
+ const [option, setOption] = domContextHooks_module.useState("notRegistered");
1196
+ const publisher = (_c = (_b = userData === null || userData === void 0 ? void 0 : userData.user) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher;
1197
+ domContextHooks_module.useEffect(() => {
1198
+ // reset redirect hash
1199
+ window.location.hash = "";
1200
+ }, []);
1201
+ domContextHooks_module.useEffect(() => {
1202
+ var _a;
1203
+ if (!((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxCountryCode))
1204
+ return;
1205
+ const _option = getOption(_countries, publisher.taxInformation.indirectTaxCountryCode);
1206
+ setOption(_option);
1207
+ }, [publisher, _countries]);
1208
+ domContextHooks_module.useEffect(() => {
1209
+ if (countrySearch.trim() === "") {
1210
+ setFilteredCountries(_countries || []);
1211
+ }
1212
+ else {
1213
+ setFilteredCountries((_countries === null || _countries === void 0 ? void 0 : _countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase()))) || []);
1214
+ }
1215
+ }, [countrySearch, _countries]);
1216
+ domContextHooks_module.useEffect(() => {
1217
+ var _a, _b;
1218
+ const user = userData === null || userData === void 0 ? void 0 : userData.user;
1219
+ if (!user)
1220
+ return;
1221
+ if ((_b = (_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.taxInformation) {
1222
+ setFormState({
1223
+ province: user.impactConnection.publisher.taxInformation.indirectTaxRegion,
1224
+ subRegion: user.impactConnection.publisher.taxInformation.indirectTaxRegion,
1225
+ hasQst: !!user.impactConnection.publisher.taxInformation.additionalTaxId,
1226
+ qstNumber: user.impactConnection.publisher.taxInformation.additionalTaxId,
1227
+ hasSubRegionTaxNumber: !!user.impactConnection.publisher.taxInformation.withholdingTaxId,
1228
+ subRegionTaxNumber: user.impactConnection.publisher.taxInformation.withholdingTaxId,
1229
+ selectedRegion: user.impactConnection.publisher.taxInformation.indirectTaxCountryCode,
1230
+ indirectTaxNumber: user.impactConnection.publisher.taxInformation.indirectTaxId,
1231
+ });
1232
+ }
1233
+ else {
1234
+ setFormState({
1235
+ selectedRegion: (user === null || user === void 0 ? void 0 : user.countryCode) || (userForm === null || userForm === void 0 ? void 0 : userForm.countryCode),
1236
+ });
1237
+ }
1238
+ }, [userData, userForm]);
1239
+ const onFormChange = (field, e) => {
1240
+ var _a, _b;
1241
+ const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
1242
+ if (!value)
1243
+ console.error("Could not detect select change");
1244
+ setFormState((p) => ({ ...p, [field]: value }));
1245
+ };
1246
+ async function connectPartner(formData) {
1247
+ var _a, _b, _c, _d, _e, _f, _g;
1248
+ const vars = {
1249
+ user: {
1250
+ id: user.id,
1251
+ accountId: user.accountId,
1252
+ },
1253
+ firstName: userForm.firstName,
1254
+ lastName: userForm.lastName,
1255
+ countryCode: userForm.countryCode,
1256
+ currency: userForm.currency,
1257
+ address: userForm.address,
1258
+ city: userForm.city,
1259
+ state: userForm.state,
1260
+ postalCode: userForm.postalCode,
1261
+ phoneNumber: userForm.phoneNumber,
1262
+ phoneNumberCountryCode: userForm.phoneNumberCountryCode,
1263
+ indirectTaxCountryCode: formData.selectedRegion,
1264
+ indirectTaxRegion: formData.province || formData.subRegion,
1265
+ indirectTaxId: formData.indirectTaxNumber,
1266
+ additionalTaxId: formData.qstNumber,
1267
+ withholdingTaxId: formData.subRegionTaxNumber,
1268
+ };
1269
+ // If the partner has already been started call completeImpactConnection
1270
+ // to fill in the remaining details. Otherwise create from scratch.
1271
+ let result = null;
1272
+ let connectionResult;
1273
+ if (((_b = (_a = userData === null || userData === void 0 ? void 0 : userData.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.connectionStatus) === "STARTED") {
1274
+ result = await completeImpactPartner({
1275
+ vars,
1276
+ });
1277
+ connectionResult = (_c = result) === null || _c === void 0 ? void 0 : _c.completeImpactConnection;
1278
+ }
1279
+ else {
1280
+ result = await connectImpactPartner({
1281
+ vars,
1282
+ });
1283
+ connectionResult = (_d = result) === null || _d === void 0 ? void 0 : _d.createImpactConnection;
1284
+ }
1285
+ if (!result || ((_e = result) === null || _e === void 0 ? void 0 : _e.message))
1286
+ throw new Error();
1287
+ if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
1288
+ // Output backend errors to console for now
1289
+ console.error("Failed to create Impact connection: ", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
1290
+ throw new Error();
1291
+ }
1292
+ await refetch();
1293
+ const resultPublisher = (_g = (_f = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher;
1294
+ const hasValidCurrentDocument = utils.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
1295
+ // Fire form change event
1296
+ window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
1297
+ return {
1298
+ resultPublisher,
1299
+ hasValidCurrentDocument,
1300
+ };
1301
+ }
1302
+ const onSubmit = async (event) => {
1303
+ if (!option) {
1304
+ setErrors({ taxDetails: true });
1305
+ return;
1306
+ }
1307
+ let formData = { taxOption: option };
1308
+ let validationErrors = {};
1309
+ const controls = event.target.getFormControls();
1310
+ controls.forEach((control) => {
1311
+ if (!control.name || !control.id)
1312
+ return;
1313
+ if (option === "notRegistered")
1314
+ return; // Don't include fields for notRegistered option
1315
+ const key = control.name;
1316
+ const value = control.value;
1317
+ jsonpointer.jsonpointer.set(formData, key, value);
1318
+ if (control.required && !value) {
1319
+ jsonpointer.jsonpointer.set(validationErrors, key, true);
1320
+ }
1321
+ });
1322
+ setErrors(validationErrors);
1323
+ if (Object.keys(validationErrors).length) {
1324
+ return;
1325
+ }
1326
+ setLoading(true);
1327
+ try {
1328
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
1329
+ if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
1330
+ !hasValidCurrentDocument) {
1331
+ // Go to docusign form
1332
+ setStep("/3");
1333
+ }
1334
+ else {
1335
+ if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
1336
+ // Go to banking information form
1337
+ setStep("/4");
1338
+ }
1339
+ else {
1340
+ // Go right to the dashboard
1341
+ setStep("/dashboard");
1342
+ }
1343
+ }
1344
+ }
1345
+ catch (e) {
1346
+ setErrors({ general: true });
1347
+ }
1348
+ finally {
1349
+ setLoading(false);
1350
+ }
1351
+ };
1352
+ const onBack = () => {
1353
+ setStep(context.overrideBackStep || "/1");
1354
+ };
1355
+ return {
1356
+ states: {
1357
+ step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
1358
+ hideSteps: context.hideSteps,
1359
+ disabled: loading || countriesLoading || connectLoading || completeLoading,
1360
+ loading: loading || connectLoading || countriesLoading || completeLoading,
1361
+ isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
1362
+ loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
1363
+ formState: {
1364
+ checked: option,
1365
+ errors,
1366
+ },
1367
+ },
1368
+ callbacks: {
1369
+ onBack,
1370
+ onSubmit,
1371
+ onFormChange,
1372
+ onChange: setOption,
1373
+ setCountrySearch,
1374
+ onQstToggle: () => setFormState((p) => ({ ...p, hasQst: !p.hasQst })),
1375
+ onSpainToggle: () => setFormState((p) => ({
1376
+ ...p,
1377
+ hasSubRegionTaxNumber: !p.hasSubRegionTaxNumber,
1378
+ })),
1379
+ },
1380
+ data: {
1381
+ esRegions: utils.INDIRECT_TAX_SPAIN_REGIONS,
1382
+ countries: filteredCountries,
1383
+ allCountries: _countries,
1384
+ provinces: utils.INDIRECT_TAX_PROVINCES,
1385
+ },
1386
+ text: props.getTextProps(),
1387
+ refs: {
1388
+ formRef,
1389
+ },
1390
+ slotProps: {
1391
+ formState: {
1392
+ ...formState,
1393
+ errors,
1394
+ },
1395
+ },
1396
+ };
1397
+ }
1398
+
1399
+ exports.COMPLETE_PARTNER = COMPLETE_PARTNER;
1400
+ exports.CONNECT_PARTNER = CONNECT_PARTNER;
1111
1401
  exports.VERIFF_COMPLETE_EVENT_KEY = VERIFF_COMPLETE_EVENT_KEY;
1112
1402
  exports.getStatus = getStatus;
1403
+ exports.useIndirectTaxForm = useIndirectTaxForm;
1113
1404
  exports.usePayoutStatus = usePayoutStatus;
1114
1405
  exports.useVeriffApp = useVeriffApp;