@saasquatch/mint-components 1.10.3 → 1.11.0-1

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 (178) hide show
  1. package/dist/cjs/{ShadowViewAddon-c3e91cee.js → ShadowViewAddon-21aa34f8.js} +32 -57
  2. package/dist/cjs/{email-registration-view-248652bb.js → email-registration-view-5170d9f1.js} +1 -1
  3. package/dist/cjs/{global-02e50f09.js → global-4a59a374.js} +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/mint-components.cjs.js +2 -2
  6. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +115 -142
  7. package/dist/cjs/sqm-big-stat_38.cjs.entry.js +24 -65
  8. package/dist/cjs/sqm-empty_4.cjs.entry.js +2 -9
  9. package/dist/cjs/sqm-instant-access-registration.cjs.entry.js +1 -1
  10. package/dist/cjs/{sqm-invoice-table-view-28b14d28.js → sqm-invoice-table-view-c26fb670.js} +6 -8
  11. package/dist/cjs/sqm-leaderboard-rank.cjs.entry.js +1 -1
  12. package/dist/cjs/sqm-logout-current-user.cjs.entry.js +10 -9
  13. package/dist/cjs/{sqm-portal-container-view-990a85a3.js → sqm-portal-container-view-5fb2ad49.js} +1 -1
  14. package/dist/cjs/{sqm-portal-email-verification-view-292b5bf4.js → sqm-portal-email-verification-view-07161940.js} +1 -1
  15. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
  16. package/dist/cjs/{sqm-portal-profile-view-fde54e35.js → sqm-portal-profile-view-07b99f80.js} +1 -1
  17. package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
  18. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
  19. package/dist/cjs/sqm-referred-registration.cjs.entry.js +1 -1
  20. package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +1 -1
  21. package/dist/cjs/sqm-stencilbook.cjs.entry.js +57 -180
  22. package/dist/collection/components/sqm-card-feed/sqm-card-feed.js +1 -1
  23. package/dist/collection/components/sqm-empty/EmptyState.stories.js +1 -1
  24. package/dist/collection/components/sqm-image/sqm-image-view.js +1 -1
  25. package/dist/collection/components/sqm-image/sqm-image.js +0 -20
  26. package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +24 -130
  27. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +29 -55
  28. package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +29 -93
  29. package/dist/collection/components/sqm-leaderboard/useLeaderboard.js +4 -40
  30. package/dist/collection/components/sqm-logout-current-user/useLogoutCurrentUser.js +10 -9
  31. package/dist/collection/components/sqm-portal-container/PortalContainer.stories.js +7 -19
  32. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +1 -1
  33. package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +0 -37
  34. package/dist/collection/components/sqm-referral-card/ReferralCard.stories.js +1 -1
  35. package/dist/collection/components/sqm-share-button/ShareButton.stories.js +1 -1
  36. package/dist/collection/components/sqm-share-button/sqm-share-button-view.js +1 -1
  37. package/dist/collection/components/sqm-share-button/sqm-share-button.js +2 -2
  38. package/dist/collection/components/sqm-task-card/UseTaskCard.stories.js +1 -1
  39. package/dist/collection/components/sqm-task-card/sqm-task-card.js +1 -1
  40. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  41. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +1 -2
  42. package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +18 -11
  43. package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.js +3 -19
  44. package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +3 -2
  45. package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +43 -36
  46. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +2 -2
  47. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +2 -3
  48. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +12 -12
  49. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +32 -55
  50. package/dist/collection/components/tax-and-cash/utils.js +4 -7
  51. package/dist/collection/components/views/email-registration-view.js +1 -1
  52. package/dist/collection/global/global.js +1 -1
  53. package/dist/collection/stories/NewPortal.stories.js +1 -1
  54. package/dist/esm/{ShadowViewAddon-e012b2aa.js → ShadowViewAddon-90897c22.js} +32 -57
  55. package/dist/esm/{email-registration-view-a89a88bf.js → email-registration-view-07d80492.js} +1 -1
  56. package/dist/esm/{global-04c7d3b5.js → global-e7bb0343.js} +1 -1
  57. package/dist/esm/loader.js +2 -2
  58. package/dist/esm/mint-components.js +2 -2
  59. package/dist/esm/sqm-banking-info-form_16.entry.js +115 -142
  60. package/dist/esm/sqm-big-stat_38.entry.js +24 -65
  61. package/dist/esm/sqm-empty_4.entry.js +2 -9
  62. package/dist/esm/sqm-instant-access-registration.entry.js +1 -1
  63. package/dist/esm/{sqm-invoice-table-view-34ac7513.js → sqm-invoice-table-view-2175569f.js} +6 -8
  64. package/dist/esm/sqm-leaderboard-rank.entry.js +1 -1
  65. package/dist/esm/sqm-logout-current-user.entry.js +10 -9
  66. package/dist/esm/{sqm-portal-container-view-6c582684.js → sqm-portal-container-view-ab89c6cc.js} +1 -1
  67. package/dist/esm/{sqm-portal-email-verification-view-4307c992.js → sqm-portal-email-verification-view-0b32261f.js} +1 -1
  68. package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
  69. package/dist/esm/{sqm-portal-profile-view-ffe955c8.js → sqm-portal-profile-view-03026a5e.js} +1 -1
  70. package/dist/esm/sqm-portal-profile.entry.js +2 -2
  71. package/dist/esm/sqm-referral-table_11.entry.js +1 -1
  72. package/dist/esm/sqm-referred-registration.entry.js +1 -1
  73. package/dist/esm/sqm-rewards-table_9.entry.js +1 -1
  74. package/dist/esm/sqm-stencilbook.entry.js +57 -180
  75. package/dist/esm-es5/ShadowViewAddon-90897c22.js +1 -0
  76. package/dist/esm-es5/email-registration-view-07d80492.js +1 -0
  77. package/dist/esm-es5/{global-04c7d3b5.js → global-e7bb0343.js} +1 -1
  78. package/dist/esm-es5/loader.js +1 -1
  79. package/dist/esm-es5/mint-components.js +1 -1
  80. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  81. package/dist/esm-es5/sqm-big-stat_38.entry.js +1 -1
  82. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  83. package/dist/esm-es5/sqm-instant-access-registration.entry.js +1 -1
  84. package/dist/esm-es5/sqm-invoice-table-view-2175569f.js +1 -0
  85. package/dist/esm-es5/sqm-leaderboard-rank.entry.js +1 -1
  86. package/dist/esm-es5/sqm-logout-current-user.entry.js +1 -1
  87. package/dist/esm-es5/sqm-portal-container-view-ab89c6cc.js +1 -0
  88. package/dist/esm-es5/{sqm-portal-email-verification-view-4307c992.js → sqm-portal-email-verification-view-0b32261f.js} +1 -1
  89. package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
  90. package/dist/esm-es5/{sqm-portal-profile-view-ffe955c8.js → sqm-portal-profile-view-03026a5e.js} +1 -1
  91. package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
  92. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  93. package/dist/esm-es5/sqm-referred-registration.entry.js +1 -1
  94. package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
  95. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  96. package/dist/mint-components/mint-components.esm.js +1 -1
  97. package/dist/mint-components/mint-components.js +1 -1
  98. package/dist/mint-components/p-007383e1.entry.js +9 -0
  99. package/dist/mint-components/{p-10685090.js → p-05948592.js} +23 -23
  100. package/dist/mint-components/p-05a9bc83.entry.js +9 -0
  101. package/dist/mint-components/{p-4d233cd4.js → p-0e556260.js} +1 -1
  102. package/dist/mint-components/p-10036f16.js +1 -0
  103. package/dist/mint-components/p-227dec48.js +1 -0
  104. package/dist/mint-components/p-3dbf752a.system.entry.js +1 -0
  105. package/dist/mint-components/p-445ffcfd.system.entry.js +1 -0
  106. package/dist/mint-components/p-482bf487.system.js +1 -0
  107. package/dist/mint-components/{p-b6fc1227.system.entry.js → p-4864ed8a.system.entry.js} +1 -1
  108. package/dist/mint-components/p-5301a2da.system.entry.js +1 -0
  109. package/dist/mint-components/{p-01cfff8a.system.entry.js → p-55a782cf.system.entry.js} +1 -1
  110. package/dist/mint-components/{p-59fe4ad1.system.js → p-573fab0f.system.js} +1 -1
  111. package/dist/mint-components/{p-56f14840.entry.js → p-57e4ef5f.entry.js} +1 -1
  112. package/dist/mint-components/p-5956a47e.entry.js +1 -0
  113. package/dist/mint-components/{p-7049e9b0.entry.js → p-5d485450.entry.js} +1 -1
  114. package/dist/mint-components/p-64491c96.system.entry.js +1 -0
  115. package/dist/mint-components/{p-ce621bcc.js → p-66172a05.js} +1 -1
  116. package/dist/mint-components/p-6bf41e0d.system.js +1 -0
  117. package/dist/mint-components/p-76b69493.entry.js +174 -0
  118. package/dist/mint-components/{p-b4c52c5a.entry.js → p-7a572b34.entry.js} +1 -1
  119. package/dist/mint-components/{p-be4b748a.system.entry.js → p-8fe21979.system.entry.js} +1 -1
  120. package/dist/mint-components/p-922578e4.system.js +1 -0
  121. package/dist/mint-components/{p-3ec16698.entry.js → p-956ed10a.entry.js} +1 -1
  122. package/dist/mint-components/p-97198e2c.system.js +1 -0
  123. package/dist/mint-components/{p-4ea58025.system.entry.js → p-973f6501.system.entry.js} +1 -1
  124. package/dist/mint-components/{p-8704937c.js → p-9774fbc5.js} +1 -1
  125. package/dist/mint-components/{p-35d84041.system.entry.js → p-a61e6394.system.entry.js} +1 -1
  126. package/dist/mint-components/{p-1dd69917.system.entry.js → p-b8dbb809.system.entry.js} +1 -1
  127. package/dist/mint-components/p-be38de26.system.js +1 -0
  128. package/dist/mint-components/{p-ed095674.system.js → p-c7a3fd1b.system.js} +1 -1
  129. package/dist/mint-components/p-cf158064.entry.js +33 -0
  130. package/dist/mint-components/p-d51eb656.entry.js +187 -0
  131. package/dist/mint-components/{p-4df8f1d2.system.js → p-d7df3dfd.system.js} +1 -1
  132. package/dist/mint-components/{p-32d1d162.entry.js → p-dab544d9.entry.js} +1 -1
  133. package/dist/mint-components/{p-c7fd9e16.js → p-e704842c.js} +1 -1
  134. package/dist/mint-components/{p-8679ed9f.system.entry.js → p-e84a74fe.system.entry.js} +1 -1
  135. package/dist/mint-components/{p-7f088154.entry.js → p-ebcec043.entry.js} +1 -1
  136. package/dist/mint-components/p-f8f6c99d.system.entry.js +1 -0
  137. package/dist/types/components/sqm-card-feed/sqm-card-feed.d.ts +1 -1
  138. package/dist/types/components/sqm-image/sqm-image-view.d.ts +0 -1
  139. package/dist/types/components/sqm-image/sqm-image.d.ts +0 -5
  140. package/dist/types/components/sqm-leaderboard/Leaderboard.stories.d.ts +1 -5
  141. package/dist/types/components/sqm-leaderboard/sqm-leaderboard-view.d.ts +4 -6
  142. package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +6 -23
  143. package/dist/types/components/sqm-leaderboard/useLeaderboard.d.ts +2 -4
  144. package/dist/types/components/sqm-portal-container/PortalContainer.stories.d.ts +0 -1
  145. package/dist/types/components/sqm-portal-container/sqm-portal-container-view.d.ts +0 -1
  146. package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +0 -7
  147. package/dist/types/components/sqm-share-button/sqm-share-button.d.ts +2 -2
  148. package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +1 -1
  149. package/dist/types/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.d.ts +5 -3
  150. package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +2 -1
  151. package/dist/types/components/tax-and-cash/utils.d.ts +2 -2
  152. package/dist/types/components.d.ts +14 -66
  153. package/docs/docs.docx +0 -0
  154. package/docs/raisins.json +1 -1
  155. package/grapesjs/grapesjs.js +1 -1
  156. package/package.json +2 -2
  157. package/dist/esm-es5/ShadowViewAddon-e012b2aa.js +0 -1
  158. package/dist/esm-es5/email-registration-view-a89a88bf.js +0 -1
  159. package/dist/esm-es5/sqm-invoice-table-view-34ac7513.js +0 -1
  160. package/dist/esm-es5/sqm-portal-container-view-6c582684.js +0 -1
  161. package/dist/mint-components/p-1c857edb.entry.js +0 -33
  162. package/dist/mint-components/p-2ffefa3b.entry.js +0 -223
  163. package/dist/mint-components/p-31e810e9.entry.js +0 -168
  164. package/dist/mint-components/p-509e29e6.js +0 -1
  165. package/dist/mint-components/p-5de21018.system.entry.js +0 -1
  166. package/dist/mint-components/p-7497a4f6.system.entry.js +0 -1
  167. package/dist/mint-components/p-81689347.entry.js +0 -9
  168. package/dist/mint-components/p-84361da0.system.entry.js +0 -1
  169. package/dist/mint-components/p-95771f79.system.js +0 -1
  170. package/dist/mint-components/p-9f0629ba.system.entry.js +0 -1
  171. package/dist/mint-components/p-a1dba9a1.system.entry.js +0 -1
  172. package/dist/mint-components/p-a51533cb.system.js +0 -1
  173. package/dist/mint-components/p-b23d5520.js +0 -1
  174. package/dist/mint-components/p-bc51264d.system.js +0 -1
  175. package/dist/mint-components/p-d8d2de11.entry.js +0 -1
  176. package/dist/mint-components/p-e3735866.entry.js +0 -11
  177. package/dist/mint-components/p-ed17e637.system.js +0 -1
  178. package/dist/mint-components/p-ed6ebd60.system.js +0 -1
@@ -23,26 +23,6 @@ const GET_LEADERBOARD = gql `
23
23
  }
24
24
  }
25
25
  `;
26
- const GET_LEADERBOARD_WITHOUT_NAMES = gql `
27
- query (
28
- $type: String!
29
- $filter: UserLeaderboardFilterInput
30
- $locale: RSLocale
31
- $limit: Int!
32
- ) {
33
- userLeaderboard(type: $type, filter: $filter) {
34
- dateModified
35
- rows(limit: $limit) {
36
- textValue(locale: $locale)
37
- rank {
38
- rank
39
- denseRank
40
- rowNumber
41
- }
42
- }
43
- }
44
- }
45
- `;
46
26
  const GET_RANK = gql `
47
27
  query (
48
28
  $type: String!
@@ -63,24 +43,6 @@ const GET_RANK = gql `
63
43
  }
64
44
  }
65
45
  `;
66
- const GET_RANK_WITHOUT_NAMES = gql `
67
- query (
68
- $type: String!
69
- $filter: UserLeaderboardFilterInput
70
- $locale: RSLocale
71
- ) {
72
- viewer {
73
- ... on User {
74
- leaderboardRank(type: $type, filter: $filter) {
75
- textValue(locale: $locale)
76
- rank
77
- denseRank
78
- rowNumber
79
- }
80
- }
81
- }
82
- }
83
- `;
84
46
  export function useLeaderboard(props) {
85
47
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
86
48
  const programIdContext = useProgramId();
@@ -106,8 +68,8 @@ export function useLeaderboard(props) {
106
68
  if (props.maxRows > 0) {
107
69
  variables["limit"] = props.maxRows;
108
70
  }
109
- const { data: leaderboardData, loading: loadingLeaderboard, errors: leaderboardErrors, } = useQuery(props.hideNames ? GET_LEADERBOARD_WITHOUT_NAMES : GET_LEADERBOARD, variables, !(user === null || user === void 0 ? void 0 : user.jwt), { batch: false });
110
- const { data: rankData } = useQuery(props.hideNames ? GET_RANK_WITHOUT_NAMES : GET_RANK, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
71
+ const { data: leaderboardData, loading: loadingLeaderboard, errors: leaderboardErrors, } = useQuery(GET_LEADERBOARD, variables, !(user === null || user === void 0 ? void 0 : user.jwt), { batch: false });
72
+ const { data: rankData } = useQuery(GET_RANK, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
111
73
  const leaderboardRows = (_b = leaderboardData === null || leaderboardData === void 0 ? void 0 : leaderboardData.userLeaderboard) === null || _b === void 0 ? void 0 : _b.rows;
112
74
  const flattenedLeaderboard = getFlattenedLeaderboard(leaderboardRows);
113
75
  const sortedLeaderboard = flattenedLeaderboard === null || flattenedLeaderboard === void 0 ? void 0 : flattenedLeaderboard.sort(function (a, b) {
@@ -151,6 +113,8 @@ export function useLeaderboard(props) {
151
113
  },
152
114
  elements: {
153
115
  empty: props.empty,
116
+ essentials: props.essentials,
117
+ loadingstate: props.loadingstate,
154
118
  },
155
119
  };
156
120
  }
@@ -1,24 +1,25 @@
1
1
  import { setUserIdentity, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { gql } from "graphql-request";
3
3
  const GET_USER_DETAILS = gql `
4
- query getUserDetails {
5
- viewer {
6
- ... on User {
7
- id
8
- accountId
9
- email
10
- }
4
+ query getUserDetails($id: String!, $accountId: String!) {
5
+ user(id: $id, accountId: $accountId) {
6
+ id
7
+ accountId
8
+ email
11
9
  }
12
10
  }
13
11
  `;
14
12
  export function useLogoutCurrentUser(props) {
15
13
  var _a, _b;
16
14
  const user = useUserIdentity();
17
- const { loading, data } = useQuery(GET_USER_DETAILS, {}, !user);
15
+ const { loading, data } = useQuery(GET_USER_DETAILS, {
16
+ id: user === null || user === void 0 ? void 0 : user.id,
17
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
18
+ }, !user);
18
19
  const onSwitchClick = () => {
19
20
  setUserIdentity(undefined);
20
21
  };
21
- const filledInEmailText = (_a = props.userIdentificationText) === null || _a === void 0 ? void 0 : _a.replace("{email}", (_b = data === null || data === void 0 ? void 0 : data.viewer) === null || _b === void 0 ? void 0 : _b.email);
22
+ const filledInEmailText = (_a = props.userIdentificationText) === null || _a === void 0 ? void 0 : _a.replace("{email}", (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.email);
22
23
  return {
23
24
  loading,
24
25
  onSwitchClick,
@@ -13,37 +13,37 @@ export const TooWideColumn = () => (h("div", { style: { width: "200px", border:
13
13
  export const TooWideRow = () => (h("div", { style: { width: "500px", border: "1px dashed grey" } },
14
14
  h("sqm-portal-container", { gap: "xxx-large", direction: "row", "min-width": "160px" },
15
15
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
16
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
16
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
17
17
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
18
18
  export const TooWideSmallGap = () => (h("div", { style: { width: "500px", border: "1px dashed grey" } },
19
19
  h("sqm-portal-container", { gap: "small", direction: "row", "min-width": "160px" },
20
20
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
21
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
21
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
22
22
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
23
23
  export const TooWidePadding = () => (h("div", { style: { width: "500px", border: "1px dashed grey" } },
24
24
  h("sqm-portal-container", { padding: "xxx-large", gap: "xxx-large", direction: "row", "min-width": "160px" },
25
25
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
26
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
26
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
27
27
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
28
28
  export const TooWideDisplayFlex = () => (h("div", { style: { width: "500px", border: "1px dashed grey" } },
29
29
  h("sqm-portal-container", { gap: "xxx-large", direction: "row", display: "flex", "min-width": "160px" },
30
30
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
31
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
31
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
32
32
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
33
33
  export const HalfWidth = () => (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
34
34
  h("sqm-portal-container", { gap: "xxx-large", direction: "row", minWidth: "160px", maxWidth: "50%" },
35
35
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
36
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
36
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
37
37
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
38
38
  export const HalfWidthCenter = () => (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
39
39
  h("sqm-portal-container", { gap: "xxx-large", direction: "row", minWidth: "160px", maxWidth: "50%", center: true },
40
40
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
41
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
41
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
42
42
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
43
43
  export const FullWidth = () => (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
44
44
  h("sqm-portal-container", { gap: "xxx-large", direction: "row", maxWidth: "100%" },
45
45
  h("sqm-share-button", { icon: "envelope", medium: "email", size: "medium", class: "hydrated" }, "Email a friend"),
46
- h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Post about us on X"),
46
+ h("sqm-share-button", { medium: "twitter", size: "medium", class: "hydrated" }, "Tweet about us"),
47
47
  h("sqm-share-button", { medium: "facebook", size: "medium", class: "hydrated" }, "Share on Facebook"))));
48
48
  export const SpaceBetween = () => {
49
49
  return (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
@@ -81,18 +81,6 @@ export const SpaceEvenly = () => {
81
81
  h("p", null, "Points Balance")))),
82
82
  h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
83
83
  };
84
- export const ResponsiveBox = () => {
85
- return (h("div", { style: { width: "100%", maxWidth: "1000px", border: "1px dashed grey" } },
86
- h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "space-between", "flex-wrap": "nowrap" },
87
- h("sqm-stat-container", { space: "xxx-large", display: "flex" },
88
- h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardsRedeemed/CREDIT/global" },
89
- h("sqm-text", null,
90
- h("p", null, "Rewards Redeemed"))),
91
- h("sqm-big-stat", { "flex-reverse": "true", alignment: "left", "stat-type": "/rewardBalance/CREDIT/POINT/value/global" },
92
- h("sqm-text", null,
93
- h("p", null, "Points Balance")))),
94
- h("sqm-scroll", { "scroll-id": "tab-2", outline: true, "button-type": "primary", "button-text": "Redeem your rewards", mobile: true }))));
95
- };
96
84
  export const Start = () => {
97
85
  return (h("div", { style: { width: "1000px", border: "1px dashed grey" } },
98
86
  h("sqm-portal-container", { center: true, direction: "row", display: "flex", "justify-content": "start" },
@@ -5,7 +5,7 @@ export function PortalContainerView(props, children) {
5
5
  Container: {
6
6
  boxSizing: "border-box",
7
7
  display: props.display || "grid",
8
- flexWrap: props.flexWrap || "wrap",
8
+ flexWrap: "wrap",
9
9
  "grid-template-columns": props.direction === "row"
10
10
  ? `repeat(auto-fill, minmax(${props.minWidth}, auto))`
11
11
  : "100%",
@@ -37,13 +37,6 @@ export class PortalContainer {
37
37
  * @uiName Maximum width
38
38
  */
39
39
  this.maxWidth = "100%";
40
- /**
41
- * @uiName Flex wrap behavior
42
- * @uiType string
43
- * @uiEnum ["wrap", "nowrap"]
44
- * @uiEnumNames ["Wrap", "No Wrap"]
45
- */
46
- this.flexWrap = "wrap";
47
40
  /**
48
41
  * @uiName Background color
49
42
  * @uiWidget color
@@ -260,36 +253,6 @@ export class PortalContainer {
260
253
  "reflect": false,
261
254
  "defaultValue": "\"100%\""
262
255
  },
263
- "flexWrap": {
264
- "type": "string",
265
- "mutable": false,
266
- "complexType": {
267
- "original": "string",
268
- "resolved": "string",
269
- "references": {}
270
- },
271
- "required": false,
272
- "optional": true,
273
- "docs": {
274
- "tags": [{
275
- "text": "Flex wrap behavior",
276
- "name": "uiName"
277
- }, {
278
- "text": "string",
279
- "name": "uiType"
280
- }, {
281
- "text": "[\"wrap\", \"nowrap\"]",
282
- "name": "uiEnum"
283
- }, {
284
- "text": "[\"Wrap\", \"No Wrap\"]",
285
- "name": "uiEnumNames"
286
- }],
287
- "text": ""
288
- },
289
- "attribute": "flex-wrap",
290
- "reflect": false,
291
- "defaultValue": "\"wrap\""
292
- },
293
256
  "center": {
294
257
  "type": "boolean",
295
258
  "mutable": false,
@@ -19,7 +19,7 @@ const sharebutton = (slot) => {
19
19
  h("sqm-portal-container", { gap: "x-small" },
20
20
  h("sqm-share-button", { medium: "email" }, "Share via email"),
21
21
  h("sqm-share-button", { medium: "facebook" }, "Share on Facebook"),
22
- h("sqm-share-button", { medium: "twitter" }, "Post about us on X"))));
22
+ h("sqm-share-button", { medium: "twitter" }, "Tweet about us"))));
23
23
  };
24
24
  const timeline = (slot, count) => {
25
25
  return (h("sqm-timeline", { slot: slot, icon: "circle" },
@@ -83,7 +83,7 @@ export const AllMediums = () => {
83
83
  h("span", null, "Linkedin")),
84
84
  h("br", null),
85
85
  h("sqm-share-button", { medium: "twitter" },
86
- h("span", null, "Post on X")),
86
+ h("span", null, "Twitter")),
87
87
  h("br", null),
88
88
  h("sqm-share-button", { medium: "pinterest" },
89
89
  h("span", null, "Pinterest")),
@@ -3,7 +3,7 @@ import { createStyleSheet } from "../../styling/JSS";
3
3
  import { HostBlock } from "../../global/mixins";
4
4
  const medium = {
5
5
  facebook: { color: "#1877f2", text: "#fff", icon: "facebook" },
6
- twitter: { color: "#000000", text: "#fff", icon: "twitter-x" },
6
+ twitter: { color: "#1da1f2", text: "#fff", icon: "twitter" },
7
7
  email: { color: "#666666", text: "#fff", icon: "envelope" },
8
8
  direct: { color: "var(--sl-color-primary-500)", text: "#fff", icon: "send" },
9
9
  linkedin: { color: "#0077b5", text: "#fff", icon: "linkedin" },
@@ -12,7 +12,7 @@ import deepmerge from "deepmerge";
12
12
  * @uiOrder ["medium", "program-id", "*", "pill", "disabled", "hideicon"]
13
13
  * @exampleGroup Sharing
14
14
  * @example Facebook Share Button - <sqm-share-button medium="facebook">Share on Facebook</sqm-share-button>
15
- * @example X Share Button - <sqm-share-button medium="twitter">Share via X</sqm-share-button>
15
+ * @example Twitter Share Button - <sqm-share-button medium="twitter">Share via Tweet</sqm-share-button>
16
16
  * @example Email Share Button - <sqm-share-button medium="email">Share via Email</sqm-share-button>
17
17
  * @example Web Share Sheet Share Button - <sqm-share-button medium="direct">Share</sqm-share-button>
18
18
  * @example LinkedIn Share Button - <sqm-share-button medium="linkedin">Share on LinkedIn</sqm-share-button>
@@ -102,7 +102,7 @@ export class ShareButton {
102
102
  "text": "[\"facebook\", \"twitter\", \"email\", \"direct\", \"linkedin\", \"sms\", \"fbmessenger\", \"whatsapp\", \"linemessenger\", \"pinterest\" ]",
103
103
  "name": "uiEnum"
104
104
  }, {
105
- "text": "[\"Facebook\", \"X\", \"Email\", \"Web Share Sheet\", \"Linkedin\", \"SMS\", \"Facebook Messenger\", \"Whatsapp\", \"Line Messenger\", \"Pinterest\"]",
105
+ "text": "[\"Facebook\", \"Twitter\", \"Email\", \"Web Share Sheet\", \"Linkedin\", \"SMS\", \"Facebook Messenger\", \"Whatsapp\", \"Line Messenger\", \"Pinterest\"]",
106
106
  "name": "uiEnumNames"
107
107
  }],
108
108
  "text": "The social medium to share on. Share messages and links\nwill be pulled from your program config and tagged for analytics."
@@ -50,7 +50,7 @@ export const TaskCardFeed = createHookStory(() => {
50
50
  return (h("sqm-card-feed", null,
51
51
  h("sqm-task-card", { "reward-amount": "75", "card-title": "Refer a Friend", description: "Invite a friend to Klip and get 75 points when they signup for a free trial or contact our us about an enterprise license.", "button-text": "Start referring", "button-link": "https://klip-staging.vercel.app/app/klip-rewards", goal: 1, repeatable: true, "completed-text": "", demoData: "", "ended-message": "", "event-key": "", "expiry-message": "", "progress-bar-unit": "", "reward-duration": "2022-01-04T08:00:00.000Z/2022-01-20T08:00:00.000Z", "reward-unit": "", "starts-on-message": "", "stat-type": "", "display-duration": "2022-01-04T08:00:00.000Z/2022-01-05T08:00:00.000Z" }),
52
52
  h("sqb-program-section", { "program-id": "klip-loyalty" },
53
- h("sqm-task-card", { "reward-amount": "50", "card-title": "Follow Us on X", description: "Earn 50 points when you Follow Us on X!", "button-text": "Follow", "button-link": "https://twitter.com/", goal: 1, "stat-type": "/programGoals/count/Follow-on-Social-Media", "open-new-tab": "true", "event-key": "socialFollow" })),
53
+ h("sqm-task-card", { "reward-amount": "50", "card-title": "Follow Us on Twitter", description: "Earn 50 points when you follow us on Twitter!", "button-text": "Follow", "button-link": "https://twitter.com/", goal: 1, "stat-type": "/programGoals/count/Follow-on-Social-Media", "open-new-tab": "true", "event-key": "socialFollow" })),
54
54
  h("sqm-task-card", { "reward-amount": "250", goal: 500, "show-progress-bar": "true", "card-title": "Spend $500 on Klip Products", description: "Earn 250 points when you spend $500 or more on Klip products.", "button-text": "See plans", "button-link": "https://klip-staging.vercel.app/app/plans", "stat-type": "/customFields/purchaseTotal", "open-new-tab": "false" }),
55
55
  h("sqb-program-section", { "program-id": "klip-loyalty" },
56
56
  h("sqm-task-card", { "reward-amount": "25", goal: 1, "card-title": "Upload Your First Video", description: "Earn 25 points for exploring the Klip platform when you upload your first video.", "button-text": "Upload", "button-link": "https://klip-staging.vercel.app/app", "stat-type": "/programGoals/count/Record-First-Video", "open-new-tab": "false" })),
@@ -13,7 +13,7 @@ import { useTaskCard } from "./useTaskCard";
13
13
  * @exampleGroup Rewards
14
14
  * @example One Time Task Card - <sqm-task-card reward-amount="1" reward-unit="Free Month" goal="1" card-title="Upgrade Your Plan" description="Receive one free month for being a committed customer when you upgrade your plan." button-text="Upgrade" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" open-new-tab="false" finite="0" starts-on-message="Starts {startDate}"></sqm-task-card>
15
15
  * @example Repeatable Task Card - <sqm-task-card reward-amount="250" goal="500" show-progress-bar card-title="Spend $500" description="Earn 250 points when you spend $500 or more." button-text="See plans" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" progress-bar-unit="$" finite="0" repeatable="" reward-unit="Points" starts-on-message="Starts {startDate}"></sqm-task-card>
16
- * @example Event Sending Task Card - <sqm-task-card goal="1" reward-amount="50" card-title="Follow Us on X" description="Earn 50 points when you Follow Us on X!" button-text="Follow" button-link="https://twitter.com/" open-new-tab="true" event-key="socialFollow" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" finite="0" reward-unit="Points" starts-on-message="Starts {startDate}"></sqm-task-card>
16
+ * @example Event Sending Task Card - <sqm-task-card goal="1" reward-amount="50" card-title="Follow Us on Twitter" description="Earn 50 points when you follow us on Twitter!" button-text="Follow" button-link="https://twitter.com/" open-new-tab="true" event-key="socialFollow" completed-text="Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}" ended-message="Ended {endDate}" expiry-message="Ends {endDate}" finite="0" reward-unit="Points" starts-on-message="Starts {startDate}"></sqm-task-card>
17
17
  */
18
18
  export class TaskCard {
19
19
  constructor() {
@@ -236,6 +236,7 @@ const docusignFormProps = {
236
236
  },
237
237
  },
238
238
  callbacks: {
239
+ completeDocument: async () => { },
239
240
  setParticipantType: (p) => console.log({ p }),
240
241
  setDocusignStatus: (status) => console.log(status),
241
242
  },
@@ -116,8 +116,7 @@ const style = {
116
116
  background: "var(--sl-color-gray-200)",
117
117
  },
118
118
  LargeSkeleton: {
119
- width: "100%",
120
- maxWidth: "320px",
119
+ width: "320px",
121
120
  height: "40px",
122
121
  borderRadius: "50px",
123
122
  background: "var(--sl-color-gray-200)",
@@ -1,11 +1,12 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { createStyleSheet } from "../../../../styling/JSS";
3
- import { useCallback, useEffect } from "@saasquatch/universal-hooks";
3
+ import { useCallback, useEffect, } from "@saasquatch/universal-hooks";
4
4
  import { DOCUSIGN_EXPIRED_STATES, DOCUSIGN_ERROR_STATES, } from "../useDocusignForm";
5
5
  const style = {
6
6
  DocusignStatusContainer: {
7
7
  width: "100%",
8
- height: "600px",
8
+ minHeight: "600px",
9
+ height: "900px",
9
10
  display: "flex",
10
11
  flexDirection: "column",
11
12
  alignItems: "center",
@@ -59,21 +60,26 @@ export const DocusignLoadingView = () => {
59
60
  h("div", { class: classes.DocusignStatusContainer },
60
61
  h("sl-spinner", { style: { fontSize: "50px", margin: "40px" } }))));
61
62
  };
62
- export const DocusignIframe = ({ states, callbacks, text, }) => {
63
+ export const DocusignIframe = ({ states, data, callbacks, text, }) => {
63
64
  if (states.urlLoading)
64
65
  return h(DocusignLoadingView, null);
66
+ // TODO: Confirm impact domain before launch
67
+ const allowedDomains = [
68
+ "referralsaasquatch.com",
69
+ "impacttech.complysandbox.com",
70
+ ];
65
71
  const callback = useCallback((e) => {
66
- var _a;
67
- if (!((_a = e.origin) === null || _a === void 0 ? void 0 : _a.includes("referralsaasquatch.com")))
72
+ const allowed = allowedDomains.some((d) => { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.includes(d); });
73
+ if (!allowed)
68
74
  return;
69
- if (!e.data)
70
- return;
71
- callbacks.onStatusChange(e.data.eventStatus);
75
+ if (e.data === "Complyexchange Thank you page Exit") {
76
+ callbacks.completeDocument();
77
+ }
72
78
  }, []);
73
79
  useEffect(() => {
74
- window.addEventListener("message", callback);
80
+ window.addEventListener("message", callback, false);
75
81
  return () => {
76
- window.removeEventListener("message", callback);
82
+ window.removeEventListener("message", callback, false);
77
83
  };
78
84
  }, []);
79
85
  if (DOCUSIGN_ERROR_STATES.includes(states.status)) {
@@ -81,5 +87,6 @@ export const DocusignIframe = ({ states, callbacks, text, }) => {
81
87
  }
82
88
  if (DOCUSIGN_EXPIRED_STATES.includes(states.status))
83
89
  return h(DocusignExpiredView, { text: text });
84
- return (h("iframe", { frameBorder: "0", src: states.url, width: "100%", height: "600px" }));
90
+ return (h("iframe", { frameBorder: "0", src: data.documentUrl, width: "100%", height: "1000px" }));
85
91
  };
92
+ // NWH4QF
@@ -140,7 +140,7 @@ const vanillaStyle = `
140
140
 
141
141
  `;
142
142
  export const DocusignFormView = (props) => {
143
- var _a, _b;
143
+ var _a;
144
144
  const { states, states: { formState, documentTypeString }, callbacks, text, slots, } = props;
145
145
  const { classes } = sheet;
146
146
  return (h("div", { class: classes.Container },
@@ -166,23 +166,7 @@ export const DocusignFormView = (props) => {
166
166
  h("strong", null, text.error.generalTitle),
167
167
  h("br", null),
168
168
  text.error.generalDescription)),
169
- states.documentType !== "W9" && (h("div", { class: classes.CheckboxWrapper },
170
- h("p", { class: classes.BoldText }, text.participantType),
171
- states.loading ? (h("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h("div", { style: { display: "flex", flexDirection: "column" } },
172
- h("sl-radio", { exportparts: "base: radio-base", value: "individualParticipant", name: "/participantType", checked: formState.participantType === "individualParticipant", disabled: states.disabled || states.participantTypeDisabled, onClick: () => {
173
- if (states.disabled || states.participantTypeDisabled)
174
- return;
175
- callbacks.setParticipantType("individualParticipant");
176
- } },
177
- h("span", { class: classes.RadioText }, text.individualParticipant)),
178
- h("sl-radio", { exportparts: "base: radio-base", value: "businessEntity", name: "/participantType", checked: formState.participantType === "businessEntity", disabled: states.disabled || states.participantTypeDisabled, onClick: () => {
179
- if (states.disabled || states.participantTypeDisabled)
180
- return;
181
- callbacks.setParticipantType("businessEntity");
182
- } },
183
- h("span", { class: classes.RadioText }, text.businessEntity)))),
184
- ((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.participantType) && (h("p", { class: classes.ErrorText }, text.error.participantType)))),
185
- (states.documentType === "W9" || formState.participantType) && (h("div", null,
169
+ h("div", null,
186
170
  h("div", null,
187
171
  h("h5", { class: classes.BoldText }, intl.formatMessage({ id: "tax-form-label", defaultMessage: text.taxFormLabel }, { documentType: documentTypeString })),
188
172
  h("p", null, intl.formatMessage({
@@ -197,5 +181,5 @@ export const DocusignFormView = (props) => {
197
181
  h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "primary", open: true, class: classes.InfoAlert },
198
182
  h("sl-icon", { class: classes.InfoIcon, slot: "icon", name: "info-circle" }),
199
183
  text.docusignSessionWarning),
200
- slots.docusignIframeSlot)))));
184
+ slots.docusignIframeSlot))));
201
185
  };
@@ -131,12 +131,13 @@ export class DocusignForm {
131
131
  const _isDemo = isDemo();
132
132
  const props = _isDemo ? useDocusignFormDemo(this) : useDocusignForm(this);
133
133
  const docusignIframeSlot = (h(DocusignIframe, { states: {
134
- url: props.data.documentUrl,
135
134
  status: props.states.docusignStatus,
136
135
  loading: props.states.loading,
137
136
  urlLoading: props.states.urlLoading,
137
+ }, data: {
138
+ documentUrl: props.data.documentUrl,
138
139
  }, callbacks: {
139
- onStatusChange: props.callbacks.setDocusignStatus,
140
+ completeDocument: props.callbacks.completeDocument,
140
141
  }, text: props.text }));
141
142
  return (h(Host, null,
142
143
  h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
@@ -14,6 +14,13 @@ const GET_TAX_DOCUMENT = gql `
14
14
  }
15
15
  }
16
16
  `;
17
+ const COMPLETE_TAX_DOCUMENT = gql `
18
+ mutation completeImpactPublisherTaxDocument($vars: UserIdInput!) {
19
+ completeImpactPublisherTaxDocument(user: $vars) {
20
+ success
21
+ }
22
+ }
23
+ `;
17
24
  export const DOCUSIGN_ERROR_STATES = [
18
25
  "exception",
19
26
  "decline",
@@ -23,20 +30,21 @@ export const DOCUSIGN_ERROR_STATES = [
23
30
  export const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
24
31
  export const DOCUSIGN_SUCCESS_STATES = ["signing_complete", "viewing_complete"];
25
32
  export function useDocusignForm(props) {
26
- var _a, _b, _c, _d, _e;
33
+ var _a, _b, _c;
27
34
  const user = useUserIdentity();
28
35
  const context = useParentValue(TAX_FORM_CONTEXT_NAMESPACE);
29
36
  const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
30
37
  const { data, loading: userLoading, refetch, } = useParentQueryValue(USER_QUERY_NAMESPACE);
31
38
  const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
32
39
  const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = useMutation(GET_TAX_DOCUMENT);
40
+ const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = useMutation(COMPLETE_TAX_DOCUMENT);
33
41
  const [docusignStatus, setDocusignStatus] = useState(undefined);
34
42
  const [participantType, setParticipantType] = useState(undefined);
35
43
  const [errors, setErrors] = useState({});
36
44
  const [loading, setLoading] = useState(false);
37
45
  // Only look at current document if it's valid (same as required type)
38
- const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType, (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.type)
39
- ? (_d = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _d === void 0 ? void 0 : _d.type : undefined;
46
+ const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) && (publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument)
47
+ ? publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType : undefined;
40
48
  const actualDocumentType = existingDocumentType ||
41
49
  getDocumentType(participantType) || (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType);
42
50
  useEffect(() => {
@@ -50,19 +58,14 @@ export function useDocusignForm(props) {
50
58
  }
51
59
  }, [existingDocumentType]);
52
60
  useEffect(() => {
53
- var _a;
54
61
  // Skip if no publisher info
55
62
  if (!user || !publisher)
56
63
  return;
57
- // Skip on initial load of W8 case
58
- if (((_a = publisher.requiredTaxDocumentType) === null || _a === void 0 ? void 0 : _a.startsWith("W8")) &&
59
- !publisher.currentTaxDocument &&
60
- !participantType)
61
- return;
62
64
  const fetchDocument = async () => {
63
65
  try {
64
66
  const result = await createTaxDocument({
65
67
  vars: {
68
+ provider: "COMPLY_EXCHANGE",
66
69
  user: {
67
70
  id: user.id,
68
71
  accountId: user.accountId,
@@ -81,33 +84,36 @@ export function useDocusignForm(props) {
81
84
  };
82
85
  fetchDocument();
83
86
  }, [user, publisher, participantType]);
84
- useEffect(() => {
85
- const onSubmit = async () => {
86
- try {
87
- setLoading(true);
88
- await refetch();
89
- // Skip banking info form if it already is saved
90
- // or if brandedSignup is false
91
- setStep(context.overrideNextStep ||
92
- !!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
93
- !(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
94
- ? "/dashboard"
95
- : "/4");
96
- }
97
- catch (e) {
98
- setErrors({ general: true });
99
- }
100
- finally {
101
- setLoading(false);
102
- }
103
- };
104
- // Handled in view
105
- if (DOCUSIGN_ERROR_STATES.includes(docusignStatus))
87
+ const completeDocument = async () => {
88
+ if (!user)
106
89
  return;
107
- if (DOCUSIGN_SUCCESS_STATES.includes(docusignStatus)) {
108
- onSubmit();
90
+ try {
91
+ setLoading(true);
92
+ const result = await completeTaxDocument({
93
+ vars: {
94
+ id: user.id,
95
+ accountId: user.accountId,
96
+ },
97
+ });
98
+ console.log({ result });
99
+ if (!result || result.message)
100
+ throw new Error();
101
+ // @ts-expect-error: no data type for result
102
+ if (!result.completeImpactPublisherTaxDocument.success)
103
+ throw new Error();
104
+ setStep(context.overrideNextStep ||
105
+ !!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
106
+ !(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
107
+ ? "/dashboard"
108
+ : "/4");
109
109
  }
110
- }, [docusignStatus, refetch]);
110
+ catch (e) {
111
+ setErrors({ general: true });
112
+ }
113
+ finally {
114
+ setLoading(false);
115
+ }
116
+ };
111
117
  const allLoading = userLoading || documentLoading || loading;
112
118
  return {
113
119
  states: {
@@ -115,7 +121,7 @@ export function useDocusignForm(props) {
115
121
  hideSteps: context.hideSteps,
116
122
  disabled: allLoading,
117
123
  participantTypeDisabled: allLoading || !!existingDocumentType,
118
- loading: userLoading || loading,
124
+ loading: userLoading || loading || completeDocumentLoading,
119
125
  urlLoading: documentLoading,
120
126
  loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
121
127
  formState: {
@@ -129,10 +135,11 @@ export function useDocusignForm(props) {
129
135
  },
130
136
  data: {
131
137
  taxForm: actualDocumentType,
132
- documentUrl: (_e = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _e === void 0 ? void 0 : _e.documentUrl,
138
+ documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
133
139
  },
134
140
  callbacks: {
135
141
  setDocusignStatus,
142
+ completeDocument,
136
143
  setParticipantType,
137
144
  },
138
145
  text: props.getTextProps(),
@@ -107,7 +107,7 @@ export function useIndirectTaxForm(props) {
107
107
  setFormState((p) => ({ ...p, [field]: value }));
108
108
  };
109
109
  const onSubmit = async (event) => {
110
- var _a, _b, _c, _d, _e, _f;
110
+ var _a, _b, _c, _d, _e;
111
111
  if (!option) {
112
112
  setErrors({ taxDetails: true });
113
113
  return;
@@ -168,7 +168,7 @@ export function useIndirectTaxForm(props) {
168
168
  await refetch();
169
169
  const resultPublisher = (_e = (_d = (_c = result
170
170
  .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;
171
- const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType, (_f = resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument) === null || _f === void 0 ? void 0 : _f.type);
171
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
172
172
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
173
173
  !hasValidCurrentDocument) {
174
174
  // Go to docusign form
@@ -1,6 +1,6 @@
1
1
  import { getContextValueName, useHost, useLocale, useParentQuery, useParentState, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useEffect, useMemo } from "@saasquatch/universal-hooks";
3
- import { getCountryObj, validTaxDocument } from "../utils";
3
+ import { getCountryObj } from "../utils";
4
4
  import { COUNTRIES_NAMESPACE, COUNTRIES_QUERY_NAMESPACE, CURRENCIES_NAMESPACE, CURRENCIES_QUERY_NAMESPACE, FINANCE_NETWORK_SETTINGS_NAMESPACE, GET_COUNTRIES, GET_CURRENCIES, GET_FINANCE_NETWORK_SETTINGS, GET_USER, SORTED_COUNTRIES_NAMESPACE, TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAMESPACE, USER_FORM_CONTEXT_NAMESPACE, USER_QUERY_NAMESPACE, } from "./data";
5
5
  function getCurrentStep(user) {
6
6
  var _a;
@@ -9,8 +9,7 @@ function getCurrentStep(user) {
9
9
  }
10
10
  const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, } = user.impactConnection.publisher;
11
11
  // If they do have a required document, look at current document
12
- if (requiredTaxDocumentType &&
13
- !validTaxDocument(requiredTaxDocumentType, currentTaxDocument === null || currentTaxDocument === void 0 ? void 0 : currentTaxDocument.type))
12
+ if (requiredTaxDocumentType && !currentTaxDocument)
14
13
  return "/3";
15
14
  if (!withdrawalSettings && brandedSignup)
16
15
  return "/4";