@saasquatch/mint-components 2.0.1 → 2.0.2-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 (75) hide show
  1. package/dist/cjs/{ShadowViewAddon-1b38dcfc.js → ShadowViewAddon-925a8fa6.js} +3 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +339 -110
  5. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +215 -26
  6. package/dist/cjs/sqm-header-logo.cjs.entry.js +14 -1
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +2 -1
  8. package/dist/cjs/{data-16106637.js → usePayoutStatus-67c78085.js} +161 -129
  9. package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +80 -3
  10. package/dist/collection/components/sqm-portal-footer/sqm-portal-footer-view.js +3 -3
  11. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  12. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +46 -40
  13. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +84 -2
  14. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +353 -0
  15. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +36 -3
  16. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +301 -1
  17. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +92 -2
  18. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +300 -0
  19. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +23 -12
  20. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
  21. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +92 -9
  22. package/dist/esm/{ShadowViewAddon-1adaf077.js → ShadowViewAddon-aae27c2e.js} +3 -3
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/mint-components.js +1 -1
  25. package/dist/esm/sqm-banking-info-form_10.entry.js +290 -61
  26. package/dist/esm/sqm-big-stat_47.entry.js +193 -4
  27. package/dist/esm/sqm-header-logo.entry.js +14 -1
  28. package/dist/esm/sqm-stencilbook.entry.js +2 -1
  29. package/dist/esm/{data-acdb790f.js → usePayoutStatus-f064247b.js} +162 -130
  30. package/dist/esm-es5/{ShadowViewAddon-1adaf077.js → ShadowViewAddon-aae27c2e.js} +1 -1
  31. package/dist/esm-es5/loader.js +1 -1
  32. package/dist/esm-es5/mint-components.js +1 -1
  33. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  34. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  35. package/dist/esm-es5/sqm-header-logo.entry.js +1 -1
  36. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  37. package/dist/esm-es5/usePayoutStatus-f064247b.js +6 -0
  38. package/dist/mint-components/mint-components.esm.js +1 -1
  39. package/dist/mint-components/{p-662ed116.system.entry.js → p-0649123a.system.entry.js} +1 -1
  40. package/dist/mint-components/p-2933bbe9.system.entry.js +1 -0
  41. package/dist/mint-components/p-2c86af62.system.entry.js +1 -0
  42. package/dist/mint-components/p-2e87159a.system.entry.js +1 -0
  43. package/dist/mint-components/p-2ed300e9.entry.js +1 -0
  44. package/dist/mint-components/p-3219fdbe.entry.js +99 -0
  45. package/dist/mint-components/{p-9f8d34d1.system.js → p-38f932ae.system.js} +1 -1
  46. package/dist/mint-components/p-40e0251f.system.js +6 -0
  47. package/dist/mint-components/{p-0e1a1b14.js → p-57ce33dd.js} +1 -1
  48. package/dist/mint-components/{p-31bba357.entry.js → p-5f3eafd4.entry.js} +2 -2
  49. package/dist/mint-components/p-967a9040.system.js +1 -1
  50. package/dist/mint-components/p-b1c4500e.entry.js +273 -0
  51. package/dist/mint-components/p-f17b6de6.js +157 -0
  52. package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +14 -1
  53. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +24 -0
  54. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +16 -0
  55. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +57 -0
  56. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +3 -1
  57. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +48 -0
  58. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +12 -0
  59. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +48 -0
  60. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  61. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -0
  62. package/dist/types/components.d.ts +331 -1
  63. package/docs/docs.docx +0 -0
  64. package/docs/raisins.json +1 -1
  65. package/grapesjs/grapesjs.js +1 -1
  66. package/package.json +1 -1
  67. package/dist/esm-es5/data-acdb790f.js +0 -6
  68. package/dist/mint-components/p-010957a1.entry.js +0 -99
  69. package/dist/mint-components/p-469a6450.system.js +0 -6
  70. package/dist/mint-components/p-720341b1.entry.js +0 -273
  71. package/dist/mint-components/p-a7ee19dc.entry.js +0 -1
  72. package/dist/mint-components/p-d2bb770d.system.entry.js +0 -1
  73. package/dist/mint-components/p-e1e7d01c.js +0 -157
  74. package/dist/mint-components/p-eea87fdc.system.entry.js +0 -1
  75. package/dist/mint-components/p-fedb9ab8.system.entry.js +0 -1
@@ -247,6 +247,54 @@ export class TaxAndCashDashboard {
247
247
  * @uiName Account review alert description
248
248
  */
249
249
  this.accountReviewDescription = "This process takes 48 hours, payouts are on hold until it's completed. You will receive an email from our referral provider, Impact.com, if any issues arise. It contains details on how to resolve this issue. If you need further assistance, please reach out to our {supportLink}.";
250
+ /**
251
+ * @uiName Payment hold on change alert header
252
+ */
253
+ this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
254
+ /**
255
+ * @uiName Payment hold on change alert description
256
+ */
257
+ this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
258
+ /**
259
+ * @uiName Beneficiary name invalid alert header
260
+ */
261
+ this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
262
+ /**
263
+ * @uiName Beneficiary name invalid description
264
+ */
265
+ this.beneficiaryNameInvalidDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
266
+ /**
267
+ * @uiName Beneficiary name mismatch alert header
268
+ */
269
+ this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
270
+ /**
271
+ * @uiName Beneficiary name mismatch alert description
272
+ */
273
+ this.beneficiaryNameMismatchDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
274
+ /**
275
+ * @uiName Bank name mismatch alert header
276
+ */
277
+ this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
278
+ /**
279
+ * @uiName Bank name mismatch alert description
280
+ */
281
+ this.bankTaxNameMismatchDescription = "The bank name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
282
+ /**
283
+ * @uiName Withdrawal settings invalid alert header
284
+ */
285
+ this.withdrawalSettingsInvalidHeader = "Your payment information includes invalid characters";
286
+ /**
287
+ * @uiName Withdrawal settings invalid alert description
288
+ */
289
+ this.withdrawalSettingsInvalidDescription = "There are invalid characters in your payment information. Please review your information and make sure it is correct with no invalid characters. Your payouts are on hold until this is resolved.";
290
+ /**
291
+ * @uiName Payment returned alert header
292
+ */
293
+ this.paymentReturnedHeader = "Payout unsuccessful";
294
+ /**
295
+ * @uiName Payment returned alert description
296
+ */
297
+ this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
250
298
  /**
251
299
  * @uiName Terms and Conditions text
252
300
  */
@@ -1366,6 +1414,258 @@ export class TaxAndCashDashboard {
1366
1414
  "reflect": false,
1367
1415
  "defaultValue": "\"This process takes 48 hours, payouts are on hold until it's completed. You will receive an email from our referral provider, Impact.com, if any issues arise. It contains details on how to resolve this issue. If you need further assistance, please reach out to our {supportLink}.\""
1368
1416
  },
1417
+ "paymentHoldOnChangeHeader": {
1418
+ "type": "string",
1419
+ "mutable": false,
1420
+ "complexType": {
1421
+ "original": "string",
1422
+ "resolved": "string",
1423
+ "references": {}
1424
+ },
1425
+ "required": false,
1426
+ "optional": false,
1427
+ "docs": {
1428
+ "tags": [{
1429
+ "text": "Payment hold on change alert header",
1430
+ "name": "uiName"
1431
+ }],
1432
+ "text": ""
1433
+ },
1434
+ "attribute": "payment-hold-on-change-header",
1435
+ "reflect": false,
1436
+ "defaultValue": "\"We are reviewing your new payout settings\""
1437
+ },
1438
+ "paymentHoldOnChangeDescription": {
1439
+ "type": "string",
1440
+ "mutable": false,
1441
+ "complexType": {
1442
+ "original": "string",
1443
+ "resolved": "string",
1444
+ "references": {}
1445
+ },
1446
+ "required": false,
1447
+ "optional": false,
1448
+ "docs": {
1449
+ "tags": [{
1450
+ "text": "Payment hold on change alert description",
1451
+ "name": "uiName"
1452
+ }],
1453
+ "text": ""
1454
+ },
1455
+ "attribute": "payment-hold-on-change-description",
1456
+ "reflect": false,
1457
+ "defaultValue": "\"Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.\""
1458
+ },
1459
+ "beneficiaryNameInvalidHeader": {
1460
+ "type": "string",
1461
+ "mutable": false,
1462
+ "complexType": {
1463
+ "original": "string",
1464
+ "resolved": "string",
1465
+ "references": {}
1466
+ },
1467
+ "required": false,
1468
+ "optional": false,
1469
+ "docs": {
1470
+ "tags": [{
1471
+ "text": "Beneficiary name invalid alert header",
1472
+ "name": "uiName"
1473
+ }],
1474
+ "text": ""
1475
+ },
1476
+ "attribute": "beneficiary-name-invalid-header",
1477
+ "reflect": false,
1478
+ "defaultValue": "\"Your payment information does not match your tax form\""
1479
+ },
1480
+ "beneficiaryNameInvalidDescription": {
1481
+ "type": "string",
1482
+ "mutable": false,
1483
+ "complexType": {
1484
+ "original": "string",
1485
+ "resolved": "string",
1486
+ "references": {}
1487
+ },
1488
+ "required": false,
1489
+ "optional": false,
1490
+ "docs": {
1491
+ "tags": [{
1492
+ "text": "Beneficiary name invalid description",
1493
+ "name": "uiName"
1494
+ }],
1495
+ "text": ""
1496
+ },
1497
+ "attribute": "beneficiary-name-invalid-description",
1498
+ "reflect": false,
1499
+ "defaultValue": "\"The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.\""
1500
+ },
1501
+ "beneficiaryNameMismatchHeader": {
1502
+ "type": "string",
1503
+ "mutable": false,
1504
+ "complexType": {
1505
+ "original": "string",
1506
+ "resolved": "string",
1507
+ "references": {}
1508
+ },
1509
+ "required": false,
1510
+ "optional": false,
1511
+ "docs": {
1512
+ "tags": [{
1513
+ "text": "Beneficiary name mismatch alert header",
1514
+ "name": "uiName"
1515
+ }],
1516
+ "text": ""
1517
+ },
1518
+ "attribute": "beneficiary-name-mismatch-header",
1519
+ "reflect": false,
1520
+ "defaultValue": "\"Your payment information does not match your tax form\""
1521
+ },
1522
+ "beneficiaryNameMismatchDescription": {
1523
+ "type": "string",
1524
+ "mutable": false,
1525
+ "complexType": {
1526
+ "original": "string",
1527
+ "resolved": "string",
1528
+ "references": {}
1529
+ },
1530
+ "required": false,
1531
+ "optional": false,
1532
+ "docs": {
1533
+ "tags": [{
1534
+ "text": "Beneficiary name mismatch alert description",
1535
+ "name": "uiName"
1536
+ }],
1537
+ "text": ""
1538
+ },
1539
+ "attribute": "beneficiary-name-mismatch-description",
1540
+ "reflect": false,
1541
+ "defaultValue": "\"The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.\""
1542
+ },
1543
+ "bankTaxNameMismatchHeader": {
1544
+ "type": "string",
1545
+ "mutable": false,
1546
+ "complexType": {
1547
+ "original": "string",
1548
+ "resolved": "string",
1549
+ "references": {}
1550
+ },
1551
+ "required": false,
1552
+ "optional": false,
1553
+ "docs": {
1554
+ "tags": [{
1555
+ "text": "Bank name mismatch alert header",
1556
+ "name": "uiName"
1557
+ }],
1558
+ "text": ""
1559
+ },
1560
+ "attribute": "bank-tax-name-mismatch-header",
1561
+ "reflect": false,
1562
+ "defaultValue": "\"Your payment information does not match your tax form\""
1563
+ },
1564
+ "bankTaxNameMismatchDescription": {
1565
+ "type": "string",
1566
+ "mutable": false,
1567
+ "complexType": {
1568
+ "original": "string",
1569
+ "resolved": "string",
1570
+ "references": {}
1571
+ },
1572
+ "required": false,
1573
+ "optional": false,
1574
+ "docs": {
1575
+ "tags": [{
1576
+ "text": "Bank name mismatch alert description",
1577
+ "name": "uiName"
1578
+ }],
1579
+ "text": ""
1580
+ },
1581
+ "attribute": "bank-tax-name-mismatch-description",
1582
+ "reflect": false,
1583
+ "defaultValue": "\"The bank name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.\""
1584
+ },
1585
+ "withdrawalSettingsInvalidHeader": {
1586
+ "type": "string",
1587
+ "mutable": false,
1588
+ "complexType": {
1589
+ "original": "string",
1590
+ "resolved": "string",
1591
+ "references": {}
1592
+ },
1593
+ "required": false,
1594
+ "optional": false,
1595
+ "docs": {
1596
+ "tags": [{
1597
+ "text": "Withdrawal settings invalid alert header",
1598
+ "name": "uiName"
1599
+ }],
1600
+ "text": ""
1601
+ },
1602
+ "attribute": "withdrawal-settings-invalid-header",
1603
+ "reflect": false,
1604
+ "defaultValue": "\"Your payment information includes invalid characters\""
1605
+ },
1606
+ "withdrawalSettingsInvalidDescription": {
1607
+ "type": "string",
1608
+ "mutable": false,
1609
+ "complexType": {
1610
+ "original": "string",
1611
+ "resolved": "string",
1612
+ "references": {}
1613
+ },
1614
+ "required": false,
1615
+ "optional": false,
1616
+ "docs": {
1617
+ "tags": [{
1618
+ "text": "Withdrawal settings invalid alert description",
1619
+ "name": "uiName"
1620
+ }],
1621
+ "text": ""
1622
+ },
1623
+ "attribute": "withdrawal-settings-invalid-description",
1624
+ "reflect": false,
1625
+ "defaultValue": "\"There are invalid characters in your payment information. Please review your information and make sure it is correct with no invalid characters. Your payouts are on hold until this is resolved.\""
1626
+ },
1627
+ "paymentReturnedHeader": {
1628
+ "type": "string",
1629
+ "mutable": false,
1630
+ "complexType": {
1631
+ "original": "string",
1632
+ "resolved": "string",
1633
+ "references": {}
1634
+ },
1635
+ "required": false,
1636
+ "optional": false,
1637
+ "docs": {
1638
+ "tags": [{
1639
+ "text": "Payment returned alert header",
1640
+ "name": "uiName"
1641
+ }],
1642
+ "text": ""
1643
+ },
1644
+ "attribute": "payment-returned-header",
1645
+ "reflect": false,
1646
+ "defaultValue": "\"Payout unsuccessful\""
1647
+ },
1648
+ "paymentReturnedDescription": {
1649
+ "type": "string",
1650
+ "mutable": false,
1651
+ "complexType": {
1652
+ "original": "string",
1653
+ "resolved": "string",
1654
+ "references": {}
1655
+ },
1656
+ "required": false,
1657
+ "optional": false,
1658
+ "docs": {
1659
+ "tags": [{
1660
+ "text": "Payment returned alert description",
1661
+ "name": "uiName"
1662
+ }],
1663
+ "text": ""
1664
+ },
1665
+ "attribute": "payment-returned-description",
1666
+ "reflect": false,
1667
+ "defaultValue": "\"Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.\""
1668
+ },
1369
1669
  "termsAndConditions": {
1370
1670
  "type": "string",
1371
1671
  "mutable": false,
@@ -287,6 +287,12 @@ export const UserInfoFormView = (props) => {
287
287
  default:
288
288
  regionLabel = text.state;
289
289
  }
290
+ function isDisabledInput(field) {
291
+ var _a;
292
+ if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
293
+ return true;
294
+ return false;
295
+ }
290
296
  return (h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
291
297
  h("style", { type: "text/css" },
292
298
  styleString,
@@ -327,18 +333,22 @@ export const UserInfoFormView = (props) => {
327
333
  })))),
328
334
  h("div", null,
329
335
  h("div", { class: classes.InputContainer },
330
- h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled || states.isUser || states.isPartner }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
336
+ h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
337
+ states.isUser ||
338
+ isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
331
339
  class: classes.ErrorInput,
332
340
  helpText: formatErrorMessage(text.firstName, formState.errors.firstName),
333
341
  }
334
342
  : {}), { id: "firstName", name: "/firstName", required: true })),
335
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled || states.isUser || states.isPartner }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
343
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
344
+ states.isUser ||
345
+ isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
336
346
  class: classes.ErrorInput,
337
347
  helpText: formatErrorMessage(text.lastName, formState.errors.lastName),
338
348
  }
339
349
  : {}), { id: "lastName", name: "/lastName", required: true })),
340
350
  h("sl-input", { exportparts: "label: input-label, base: input-base", value: formState.email, label: text.email, disabled: true, id: "email", name: "/email", required: true }),
341
- h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || states.isPartner }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
351
+ h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || isDisabledInput("countryCode") }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
342
352
  class: classes.ErrorInput,
343
353
  helpText: formatErrorMessage(text.country, formState.errors.countryCode),
344
354
  }
@@ -354,7 +364,8 @@ export const UserInfoFormView = (props) => {
354
364
  h("div", { class: classes.PhoneInputsSection },
355
365
  h("p", null, text.phoneNumber),
356
366
  h("div", { class: classes.PhoneInputsContainer },
357
- h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
367
+ h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
368
+ isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
358
369
  class: classes.ErrorInput,
359
370
  }
360
371
  : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
@@ -380,7 +391,7 @@ export const UserInfoFormView = (props) => {
380
391
  // Naive phone number validation
381
392
  validateBillingField(/[a-zA-Z]+/, value) &&
382
393
  formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
383
- }, disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
394
+ }, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
384
395
  class: classes.ErrorInput,
385
396
  helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
386
397
  }
@@ -388,7 +399,7 @@ export const UserInfoFormView = (props) => {
388
399
  h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
389
400
  // Checks for non-ASCII characters
390
401
  !validateBillingField(/^[\x20-\xFF]+$/, value) &&
391
- formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
402
+ formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("address") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
392
403
  class: classes.ErrorInput,
393
404
  helpText: formatErrorMessage(text.address, formState.errors.address),
394
405
  }
@@ -396,22 +407,22 @@ export const UserInfoFormView = (props) => {
396
407
  h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.city, id: "city", name: "/city", value: formState.city, validationError: ({ value }) =>
397
408
  // Checks for non-ASCII characters
398
409
  !validateBillingField(/^[\x20-\xFF]+$/, value) &&
399
- formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
410
+ formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("city") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
400
411
  class: classes.ErrorInput,
401
412
  helpText: formatErrorMessage(text.city, formState.errors.city),
402
413
  }
403
414
  : {}), { required: true })),
404
- !states.hideState && (h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || states.isPartner }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
415
+ !states.hideState && (h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || isDisabledInput("state") }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
405
416
  class: classes.ErrorInput,
406
417
  helpText: formatErrorMessage(text.state, formState.errors.state),
407
418
  }
408
419
  : {}), { required: true }), (_p = data.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (h("sl-menu-item", { value: r.value }, r.label))))),
409
- h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || states.isPartner }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
420
+ h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || isDisabledInput("postalCode") }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
410
421
  class: classes.ErrorInput,
411
422
  helpText: formatErrorMessage(text.postalCode, formState.errors.postalCode),
412
423
  }
413
424
  : {}), { required: true })),
414
- h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || states.isPartner, helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
425
+ h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledInput("currency"), helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
415
426
  class: classes.ErrorInput,
416
427
  helpText: formatErrorMessage(text.currency, formState.errors.currency),
417
428
  }
@@ -433,7 +444,7 @@ export const UserInfoFormView = (props) => {
433
444
  h("div", { class: classes.CheckboxWrapper },
434
445
  h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
435
446
  e.target.value = e.target.checked;
436
- }, disabled: states.isPartner ? false : states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
447
+ }, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
437
448
  ((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (h("p", { class: classes.ErrorText }, formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
438
- h("sl-button", { type: "primary", disabled: states.isPartner ? false : states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
449
+ h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
439
450
  };
@@ -889,7 +889,7 @@ export class TaxForm {
889
889
  "mutable": false,
890
890
  "complexType": {
891
891
  "original": "DemoData<UseUserInfoFormResult>",
892
- "resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
892
+ "resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; partnerData: ImpactPublisher; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
893
893
  "references": {
894
894
  "DemoData": {
895
895
  "location": "import",
@@ -1,11 +1,13 @@
1
- import { useParent, useParentQueryValue, useParentValue, } from "@saasquatch/component-boilerplate";
1
+ import { useMutation, useParent, useParentQueryValue, useParentValue, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useEffect, useMemo, useRef, useState, } from "@saasquatch/universal-hooks";
3
3
  import jsonpointer from "jsonpointer";
4
4
  import { CURRENCIES_NAMESPACE, SORTED_COUNTRIES_NAMESPACE, TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAMESPACE, USER_FORM_CONTEXT_NAMESPACE, USER_QUERY_NAMESPACE, } from "../data";
5
5
  import { ADDRESS_REGIONS } from "../subregions";
6
- import { objectIsFull } from "../utils";
6
+ import { objectIsFull, validTaxDocument } from "../utils";
7
+ import { TAX_FORM_UPDATED_EVENT_KEY } from "../eventKeys";
8
+ import { CONNECT_PARTNER, } from "../sqm-indirect-tax-form/useIndirectTaxForm";
7
9
  export function useUserInfoForm(props) {
8
- var _a, _b, _c, _d;
10
+ var _a, _b, _c, _d, _e, _f;
9
11
  const currencyRef = useRef(undefined);
10
12
  const phoneCountryRef = useRef(undefined);
11
13
  const formRef = useRef(null);
@@ -13,7 +15,9 @@ export function useUserInfoForm(props) {
13
15
  const countries = useParentValue(SORTED_COUNTRIES_NAMESPACE);
14
16
  const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
15
17
  const [userFormContext, setUserFormContext] = useParent(USER_FORM_CONTEXT_NAMESPACE);
16
- const { data, loading, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
18
+ const user = useUserIdentity();
19
+ const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = useMutation(CONNECT_PARTNER);
20
+ const { data, loading, refetch, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
17
21
  const _currencies = useParentValue(CURRENCIES_NAMESPACE);
18
22
  const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
19
23
  const [countrySearch, setCountrySearch] = useState("");
@@ -115,6 +119,45 @@ export function useUserInfoForm(props) {
115
119
  setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
116
120
  }
117
121
  }, [currencySearch, currencies]);
122
+ async function connectPartner(formData) {
123
+ var _a, _b, _c, _d, _e;
124
+ const vars = {
125
+ user: {
126
+ id: user.id,
127
+ accountId: user.accountId,
128
+ },
129
+ firstName: formData.firstName,
130
+ lastName: formData.lastName,
131
+ countryCode: formData.countryCode,
132
+ currency: formData.currency,
133
+ address: formData.address,
134
+ city: formData.city,
135
+ state: formData.state,
136
+ postalCode: formData.postalCode,
137
+ phoneNumber: formData.phoneNumber,
138
+ phoneNumberCountryCode: formData.phoneNumberCountryCode,
139
+ };
140
+ const result = await connectImpactPartner({
141
+ vars,
142
+ });
143
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
144
+ throw new Error();
145
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
146
+ // Output backend errors to console for now
147
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
148
+ throw new Error();
149
+ }
150
+ await refetch();
151
+ const resultPublisher = (_e = (_d = (_c = result
152
+ .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;
153
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
154
+ // Fire form change event
155
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
156
+ return {
157
+ resultPublisher,
158
+ hasValidCurrentDocument,
159
+ };
160
+ }
118
161
  async function onSubmit(event) {
119
162
  let formControls = event.target.getFormControls();
120
163
  let formData = {};
@@ -157,9 +200,48 @@ export function useUserInfoForm(props) {
157
200
  postalCode: userData.postalCode,
158
201
  currency: userData.currency,
159
202
  });
160
- const nextStep = context.overrideNextStep || "/2";
203
+ const skipNextStep = getSkipNextStep(userData);
204
+ console.log({ skipNextStep });
205
+ if (skipNextStep) {
206
+ try {
207
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
208
+ if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
209
+ !hasValidCurrentDocument) {
210
+ // Go to docusign form
211
+ setStep("/3");
212
+ }
213
+ else {
214
+ if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
215
+ // Go to banking information form
216
+ setStep("/4");
217
+ }
218
+ else {
219
+ // Go right to the dashboard
220
+ setStep("/dashboard");
221
+ }
222
+ }
223
+ return;
224
+ }
225
+ catch (e) {
226
+ setErrors({ general: true });
227
+ return;
228
+ }
229
+ }
230
+ const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
161
231
  setStep(nextStep);
162
232
  }
233
+ // TODO: get from backend
234
+ const hasIndirectTax = false;
235
+ const brandCountry = "";
236
+ function getSkipNextStep(userData) {
237
+ if (userData.countryCode === "US")
238
+ return true;
239
+ if (!hasIndirectTax)
240
+ return true;
241
+ if (hasIndirectTax && userData.countryCode !== brandCountry)
242
+ return true;
243
+ return false;
244
+ }
163
245
  const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
164
246
  const regionObj = hasStates
165
247
  ? ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
@@ -187,16 +269,17 @@ export function useUserInfoForm(props) {
187
269
  allCountries: countries,
188
270
  regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
189
271
  regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
272
+ partnerData: (_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,
190
273
  },
191
274
  states: {
192
275
  step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
193
276
  hideState: !hasStates,
194
277
  hideSteps: !!context.hideSteps,
195
- disabled: loading,
278
+ disabled: loading || connectLoading,
196
279
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
197
- loading: loading,
198
- isPartner: !!((_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),
199
- isUser: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.user),
280
+ loading: loading || connectLoading,
281
+ isPartner: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.publisher),
282
+ isUser: !!((_f = (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.impactConnection) === null || _f === void 0 ? void 0 : _f.user),
200
283
  formState: {
201
284
  ...userFormContext,
202
285
  errors: formErrors,
@@ -2849,14 +2849,14 @@ function ChangeMarktingView(props) {
2849
2849
  }
2850
2850
 
2851
2851
  const vanillaStyle$5 = `
2852
- :host{
2852
+ :host {
2853
2853
  margin: 0 auto;
2854
2854
  width: 100%;
2855
2855
  }
2856
- a{
2856
+ a {
2857
2857
  cursor:pointer;
2858
2858
  color: var(--sqm-text-subdued);
2859
- text-decoration: none ;
2859
+ text-decoration: none;
2860
2860
  }
2861
2861
  `;
2862
2862
  function PortalFooterView(props) {