@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
@@ -1,16 +1,15 @@
1
- import { useEngagementMedium, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
- import { useState } from "@saasquatch/universal-hooks";
1
+ import { useEngagementMedium, useLazyQuery, useMutation, useParentValue, useProgramId, useQuery, useRefreshDispatcher, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
+ import { useRef, useState } from "@saasquatch/universal-hooks";
3
3
  import { gql } from "graphql-request";
4
4
  import { REFERRAL_CODES_NAMESPACE, SET_CODE_COPIED, } from "../sqm-referral-codes/useReferralCodes";
5
+ const MAX_EDITS = 5;
6
+ const CHARACTER_LIMIT = 15;
7
+ const MIN_CHARACTERS = 3;
5
8
  const MessageLinkQuery = gql `
6
- query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
9
+ query ($programId: ID) {
7
10
  user: viewer {
8
11
  ... on User {
9
- shareLink(
10
- programId: $programId
11
- engagementMedium: $engagementMedium
12
- shareMedium: DIRECT
13
- )
12
+ shareLink(programId: $programId)
14
13
  }
15
14
  }
16
15
  }
@@ -20,19 +19,115 @@ const WIDGET_ENGAGEMENT_EVENT = gql `
20
19
  createUserAnalyticsEvent(eventMeta: $eventMeta)
21
20
  }
22
21
  `;
22
+ const ADD_SHARE_LINK_CODE = gql `
23
+ mutation ($addShareLinkCodeInput: AddShareLinkCodeInput!) {
24
+ addShareLinkCode(addShareLinkCodeInput: $addShareLinkCodeInput) {
25
+ linkCode {
26
+ linkCode
27
+ shortUrl
28
+ referralCode {
29
+ code
30
+ }
31
+ }
32
+ }
33
+ }
34
+ `;
35
+ const VALIDATE_LINK_CODE = gql `
36
+ query validateLinkCode($linkCode: String!) {
37
+ validateLinkCode(linkCode: $linkCode) {
38
+ valid
39
+ invalidReason
40
+ }
41
+ }
42
+ `;
43
+ const GET_LINK_DOMAIN = gql `
44
+ query getLinkDomain {
45
+ tenantSettings {
46
+ primaryLinkDomain {
47
+ host
48
+ }
49
+ }
50
+ }
51
+ `;
52
+ const SHARE_LINK_EDIT_COUNT = gql `
53
+ query shareLinkEditCount {
54
+ viewer {
55
+ ... on User {
56
+ shareLinkCodes {
57
+ totalCount
58
+ data {
59
+ isVanity
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ `;
66
+ function parseShareUrl(url) {
67
+ try {
68
+ const parsed = new URL(url);
69
+ return {
70
+ url: parsed.origin + parsed.pathname,
71
+ domain: parsed.origin + "/",
72
+ path: parsed.pathname.slice(1),
73
+ };
74
+ }
75
+ catch {
76
+ return { url, domain: url, path: "" };
77
+ }
78
+ }
23
79
  export function useShareLink(props) {
24
- var _a, _b;
80
+ var _a, _b, _c, _d, _e, _f, _g;
25
81
  const { programId = useProgramId() } = props;
26
82
  const user = useUserIdentity();
27
83
  const engagementMedium = useEngagementMedium();
28
84
  const contextData = useParentValue(REFERRAL_CODES_NAMESPACE);
29
- const { data } = useQuery(MessageLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
85
+ const { data, refetch } = useQuery(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
30
86
  const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
31
- const [setCopied, copiedRes] = useMutation(SET_CODE_COPIED);
32
- const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
87
+ const [setCopied] = useMutation(SET_CODE_COPIED);
88
+ const [addShareLinkCode, { loading: isSaving }] = useMutation(ADD_SHARE_LINK_CODE);
89
+ const [validateLinkCode] = useLazyQuery(VALIDATE_LINK_CODE);
90
+ const { refresh } = useRefreshDispatcher();
91
+ const { data: linkDomainData } = useQuery(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.allowCustomization);
92
+ const { data: editCountData, refetch: refetchEditCount } = useQuery(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.allowCustomization);
93
+ const { url: copyString, domain: domainPrefix, path: pathSuffix, } = parseShareUrl((_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
33
94
  // Shown during loading
34
- "...";
95
+ "...");
35
96
  const [open, setOpen] = useState(false);
97
+ const [isEditing, setIsEditing] = useState(false);
98
+ const [editValue, setEditValue] = useState("");
99
+ const [validationError, setValidationError] = useState(null);
100
+ const [isValidating, setIsValidating] = useState(false);
101
+ const debounceTimerRef = useRef(undefined);
102
+ const latestValidationValueRef = useRef("");
103
+ const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
104
+ const customizeDisabled = !hasPrimaryLinkDomain;
105
+ const vanityCount = (_g = (_f = (_e = (_d = editCountData === null || editCountData === void 0 ? void 0 : editCountData.viewer) === null || _d === void 0 ? void 0 : _d.shareLinkCodes) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.filter((code) => code.isVanity).length) !== null && _g !== void 0 ? _g : 0;
106
+ const editCount = vanityCount;
107
+ const editsRemaining = Math.max(0, MAX_EDITS - editCount);
108
+ const limitReached = editsRemaining <= 0;
109
+ function mapErrorCodeToInfo(errorCode) {
110
+ if (!errorCode)
111
+ return null;
112
+ const errorMap = {
113
+ EXISTING_CODE_CONFLICT: {
114
+ code: "EXISTING_CODE_CONFLICT",
115
+ title: props.linkTakenErrorTitle,
116
+ description: props.linkTakenErrorDescription,
117
+ },
118
+ INVALID_CHARACTER: {
119
+ code: "INVALID_CHARACTER",
120
+ title: props.invalidCharactersErrorTitle,
121
+ description: props.invalidCharactersErrorDescription,
122
+ },
123
+ BLOCKED_WORD: {
124
+ code: "BLOCKED_WORD",
125
+ title: props.restrictedWordsErrorTitle,
126
+ description: props.restrictedWordsErrorDescription,
127
+ },
128
+ };
129
+ return errorMap[errorCode];
130
+ }
36
131
  async function onClick() {
37
132
  if (contextData) {
38
133
  await setCopied({ referralCode: contextData.referralCode });
@@ -56,5 +151,123 @@ export function useShareLink(props) {
56
151
  },
57
152
  });
58
153
  }
59
- return { ...props, onClick, open, copyString: copyString };
154
+ function onCustomizeClick() {
155
+ if (limitReached || customizeDisabled)
156
+ return;
157
+ setIsEditing(true);
158
+ setEditValue(editCount === 0 ? "" : pathSuffix);
159
+ setValidationError(null);
160
+ }
161
+ function onEditValueChange(value) {
162
+ const trimmed = value.slice(0, CHARACTER_LIMIT);
163
+ setEditValue(trimmed);
164
+ setValidationError(null);
165
+ latestValidationValueRef.current = trimmed;
166
+ if (debounceTimerRef.current)
167
+ clearTimeout(debounceTimerRef.current);
168
+ if (!trimmed || trimmed.length < MIN_CHARACTERS) {
169
+ setIsValidating(false);
170
+ return;
171
+ }
172
+ setIsValidating(true);
173
+ debounceTimerRef.current = setTimeout(async () => {
174
+ var _a, _b;
175
+ const requestedValue = trimmed;
176
+ try {
177
+ const result = await validateLinkCode({ linkCode: requestedValue });
178
+ // Discard stale responses if the user has continued typing
179
+ if (latestValidationValueRef.current !== requestedValue)
180
+ return;
181
+ if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
182
+ const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
183
+ setValidationError(mapErrorCodeToInfo(reason));
184
+ }
185
+ }
186
+ catch {
187
+ // Validation query failed — don't block the user
188
+ if (latestValidationValueRef.current !== requestedValue)
189
+ return;
190
+ }
191
+ if (latestValidationValueRef.current === requestedValue) {
192
+ setIsValidating(false);
193
+ }
194
+ }, 500);
195
+ }
196
+ async function onSave() {
197
+ var _a, _b;
198
+ if (!editValue ||
199
+ editValue.length < MIN_CHARACTERS ||
200
+ validationError ||
201
+ isValidating)
202
+ return;
203
+ try {
204
+ await addShareLinkCode({
205
+ addShareLinkCodeInput: {
206
+ userId: user === null || user === void 0 ? void 0 : user.id,
207
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
208
+ programId,
209
+ linkCode: editValue,
210
+ makeShareLinkCodePrimaryForReferralCode: true,
211
+ },
212
+ });
213
+ setIsEditing(false);
214
+ await Promise.all([refetch(), refetchEditCount()]);
215
+ refresh();
216
+ }
217
+ catch (e) {
218
+ const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
219
+ setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
220
+ code: null,
221
+ title: props.saveErrorTitle,
222
+ description: (e === null || e === void 0 ? void 0 : e.message) || props.saveErrorDescription,
223
+ });
224
+ }
225
+ }
226
+ function onCancel() {
227
+ setIsEditing(false);
228
+ setEditValue("");
229
+ setValidationError(null);
230
+ setIsValidating(false);
231
+ latestValidationValueRef.current = "";
232
+ if (debounceTimerRef.current)
233
+ clearTimeout(debounceTimerRef.current);
234
+ }
235
+ return {
236
+ copyTextViewProps: {
237
+ ...props,
238
+ onClick,
239
+ open,
240
+ copyString,
241
+ },
242
+ minCharactersText: props.minCharactersText,
243
+ allowCustomization: props.allowCustomization,
244
+ customizeLinkLabel: props.customizeLinkButtonLabel,
245
+ saveLabelText: props.saveLabelText,
246
+ savingLabelText: props.savingLabelText,
247
+ cancelLabelText: props.cancelLabelText,
248
+ editLabelText: props.editLabelText,
249
+ charactersRemainingText: props.charactersRemainingText,
250
+ validatingLabelText: props.validatingLabelText,
251
+ isEditing,
252
+ editValue,
253
+ domainPrefix,
254
+ editsRemaining,
255
+ maxEdits: MAX_EDITS,
256
+ limitReached,
257
+ validationError,
258
+ isValidating,
259
+ isSaving,
260
+ characterLimit: CHARACTER_LIMIT,
261
+ minCharacters: MIN_CHARACTERS,
262
+ charactersRemaining: CHARACTER_LIMIT - editValue.length,
263
+ editLimitText: props.editLimitText,
264
+ editLimitReachedText: props.editLimitReachedText,
265
+ supportLinkText: props.supportLinkText,
266
+ customizeDisabled,
267
+ customizeDisabledTooltip: props.customizeDisabledTooltip,
268
+ onCustomizeClick,
269
+ onEditValueChange,
270
+ onSave,
271
+ onCancel,
272
+ };
60
273
  }
@@ -50,7 +50,7 @@ export function TextSpanView(props, children) {
50
50
  display: inline;
51
51
  }
52
52
  `;
53
- return (h("span", { class: sheet.classes[type], part: "sqm-text-span-base" },
53
+ return (h("span", { class: sheet.classes[type], part: "sqm-text-span" },
54
54
  h("style", { type: "text/css" },
55
55
  vanillaStyle,
56
56
  styleString),
@@ -14,6 +14,7 @@ export const GET_USER = gql `
14
14
  user: viewer {
15
15
  ... on User {
16
16
  id
17
+ accountId
17
18
  firstName
18
19
  lastName
19
20
  email
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { intl } from "../../../global/global";
3
3
  export function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
4
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70;
4
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
5
5
  const { errors, ...formState } = props.states.formState;
6
6
  return {
7
7
  0: {
@@ -234,5 +234,23 @@ export function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
234
234
  h("sl-menu-item", { value: "INDIVIDUAL" }, props.text.individualSelectItemLabel),
235
235
  h("sl-menu-item", { value: "FOREIGN" }, props.text.foreignSelectItemLabel))),
236
236
  },
237
+ 15: {
238
+ input: (h("sl-input", Object.assign({ required: true, label: props.text.branchNameLabel, name: "/branchName", id: "branchName", key: "branchName", type: "text" }, (((_71 = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _71 === void 0 ? void 0 : _71.branchName) && {
239
+ class: "error-input",
240
+ helpText: getValidationErrorMessage({
241
+ type: (_73 = (_72 = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _72 === void 0 ? void 0 : _72.branchName) === null || _73 === void 0 ? void 0 : _73.type,
242
+ label: props.text.branchNameLabel,
243
+ }),
244
+ })))),
245
+ },
246
+ 16: {
247
+ input: (h("sl-input", Object.assign({ required: true, label: props.text.classificationCodeLabel, name: "/classificationCode", id: "classificationCode", key: "classificationCode", type: "text" }, (((_74 = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _74 === void 0 ? void 0 : _74.classificationCode) && {
248
+ class: "error-input",
249
+ helpText: getValidationErrorMessage({
250
+ type: (_76 = (_75 = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _75 === void 0 ? void 0 : _75.classificationCode) === null || _76 === void 0 ? void 0 : _76.type,
251
+ label: props.text.classificationCodeLabel,
252
+ }),
253
+ })))),
254
+ },
237
255
  };
238
256
  }
@@ -168,11 +168,19 @@ export class BankingInfoForm {
168
168
  * @uiName Branch code field label
169
169
  */
170
170
  this.branchCodeLabel = "Branch code";
171
+ /**
172
+ * @uiName Branch name field label
173
+ */
174
+ this.branchNameLabel = "Branch name";
171
175
  /**
172
176
  * Label text for the classification input field
173
177
  * @uiName Classification field label
174
178
  */
175
179
  this.classificationLabel = "Classification";
180
+ /**
181
+ * @uiName Classification code field label
182
+ */
183
+ this.classificationCodeLabel = "KBE code";
176
184
  /**
177
185
  * @uiName Taxpayer ID field label
178
186
  */
@@ -1368,6 +1376,27 @@ export class BankingInfoForm {
1368
1376
  "reflect": false,
1369
1377
  "defaultValue": "\"Branch code\""
1370
1378
  },
1379
+ "branchNameLabel": {
1380
+ "type": "string",
1381
+ "mutable": false,
1382
+ "complexType": {
1383
+ "original": "string",
1384
+ "resolved": "string",
1385
+ "references": {}
1386
+ },
1387
+ "required": false,
1388
+ "optional": false,
1389
+ "docs": {
1390
+ "tags": [{
1391
+ "text": "Branch name field label",
1392
+ "name": "uiName"
1393
+ }],
1394
+ "text": ""
1395
+ },
1396
+ "attribute": "branch-name-label",
1397
+ "reflect": false,
1398
+ "defaultValue": "\"Branch name\""
1399
+ },
1371
1400
  "classificationLabel": {
1372
1401
  "type": "string",
1373
1402
  "mutable": false,
@@ -1389,6 +1418,27 @@ export class BankingInfoForm {
1389
1418
  "reflect": false,
1390
1419
  "defaultValue": "\"Classification\""
1391
1420
  },
1421
+ "classificationCodeLabel": {
1422
+ "type": "string",
1423
+ "mutable": false,
1424
+ "complexType": {
1425
+ "original": "string",
1426
+ "resolved": "string",
1427
+ "references": {}
1428
+ },
1429
+ "required": false,
1430
+ "optional": false,
1431
+ "docs": {
1432
+ "tags": [{
1433
+ "text": "Classification code field label",
1434
+ "name": "uiName"
1435
+ }],
1436
+ "text": ""
1437
+ },
1438
+ "attribute": "classification-code-label",
1439
+ "reflect": false,
1440
+ "defaultValue": "\"KBE code\""
1441
+ },
1392
1442
  "taxPayerIdLabel": {
1393
1443
  "type": "string",
1394
1444
  "mutable": false,
@@ -65,7 +65,7 @@ export class IndirectTaxForm {
65
65
  /**
66
66
  * @uiName Indirect tax number field label
67
67
  */
68
- this.indirectTaxNumber = "{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number}}";
68
+ this.indirectTaxNumber = "{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number} other {Tax number}}";
69
69
  /**
70
70
  * Displayed to participants registered for QST.
71
71
  * @uiName QST number field label
@@ -104,7 +104,7 @@ export class IndirectTaxForm {
104
104
  /**
105
105
  * @uiName Missing indirect tax number error message
106
106
  */
107
- this.indirectTaxNumberError = "{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number}} is required";
107
+ this.indirectTaxNumberError = "{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number} other {Tax number}} is required";
108
108
  /**
109
109
  * Placeholder text displayed in the country search dropdown
110
110
  * @uiName Country field placeholder text
@@ -457,7 +457,7 @@ export class IndirectTaxForm {
457
457
  },
458
458
  "attribute": "indirect-tax-number",
459
459
  "reflect": false,
460
- "defaultValue": "\"{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number}}\""
460
+ "defaultValue": "\"{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number} other {Tax number}}\""
461
461
  },
462
462
  "qstNumber": {
463
463
  "type": "string",
@@ -631,7 +631,7 @@ export class IndirectTaxForm {
631
631
  },
632
632
  "attribute": "indirect-tax-number-error",
633
633
  "reflect": false,
634
- "defaultValue": "\"{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number}} is required\""
634
+ "defaultValue": "\"{taxType, select, GST {GST number} HST {HST number} VAT {VAT number} CT {CT number} SST {SST number} GENERAL {Indirect tax number} other {Tax number}} is required\""
635
635
  },
636
636
  "searchForCountryText": {
637
637
  "type": "string",
@@ -15,7 +15,7 @@ export class PayoutDetailsCard {
15
15
  * Badge text indicating payout status
16
16
  * @uiName Payout badge status text
17
17
  */
18
- this.statusBadgeText = "{badgeText, select, payoutToday {Payout Today} nextPayout {Next Payout} }";
18
+ this.statusBadgeText = "{badgeText, select, payoutToday {Payout Today} nextPayout {Next Payout} other {Failed}}";
19
19
  /**
20
20
  * Display participants' payout preference on the payout information card, indicating the balance at which they want to get paid.
21
21
  * @uiName Payout schedule by threshold text
@@ -73,7 +73,7 @@ export class PayoutDetailsCard {
73
73
  },
74
74
  "attribute": "status-badge-text",
75
75
  "reflect": false,
76
- "defaultValue": "\"{badgeText, select, payoutToday {Payout Today} nextPayout {Next Payout} }\""
76
+ "defaultValue": "\"{badgeText, select, payoutToday {Payout Today} nextPayout {Next Payout} other {Failed}}\""
77
77
  },
78
78
  "thresholdPayoutText": {
79
79
  "type": "string",