@justifi/webcomponents 2.0.2 → 3.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +0 -1
  3. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +5 -4
  4. package/dist/cjs/justifi-payment-form.cjs.entry.js +17 -5
  5. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +3 -4
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/webcomponents.cjs.js +1 -1
  8. package/dist/collection/components/bank-account-form/bank-account-form.js +0 -18
  9. package/dist/collection/components/bank-account-form/bank-account-form.stories.js +116 -0
  10. package/dist/collection/components/billing-form/billing-form-schema.js +1 -1
  11. package/dist/collection/components/billing-form/billing-form.css +46 -0
  12. package/dist/collection/components/billing-form/billing-form.js +4 -3
  13. package/dist/collection/components/billing-form/billing-form.stories.js +50 -3
  14. package/dist/collection/components/card-form/card-form.stories.js +17 -0
  15. package/dist/collection/components/payment-form/payment-form.css +384 -0
  16. package/dist/collection/components/payment-form/payment-form.js +106 -11
  17. package/dist/collection/components/payment-form/payment-form.stories.js +30 -43
  18. package/dist/collection/components/payment-method-form/payment-method-form.js +2 -3
  19. package/dist/components/billing-form.js +5 -4
  20. package/dist/components/justifi-bank-account-form.js +0 -2
  21. package/dist/components/justifi-payment-form.js +24 -7
  22. package/dist/components/payment-method-form.js +3 -4
  23. package/dist/esm/justifi-bank-account-form.entry.js +0 -1
  24. package/dist/esm/justifi-billing-form_2.entry.js +5 -4
  25. package/dist/esm/justifi-payment-form.entry.js +18 -6
  26. package/dist/esm/justifi-payment-method-form.entry.js +3 -4
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/webcomponents.js +1 -1
  29. package/dist/types/components/bank-account-form/bank-account-form.d.ts +0 -4
  30. package/dist/types/components/bank-account-form/bank-account-form.stories.d.ts +24 -0
  31. package/dist/types/components/billing-form/billing-form-schema.d.ts +3 -0
  32. package/dist/types/components/billing-form/billing-form.d.ts +3 -0
  33. package/dist/types/components/billing-form/billing-form.stories.d.ts +1 -0
  34. package/dist/types/components/card-form/card-form.stories.d.ts +2 -0
  35. package/dist/types/components/payment-form/payment-form.d.ts +11 -5
  36. package/dist/types/components/payment-form/payment-form.stories.d.ts +2 -25
  37. package/dist/types/components.d.ts +20 -9
  38. package/dist/webcomponents/p-282af003.entry.js +1 -0
  39. package/dist/webcomponents/{p-f7aa93bc.entry.js → p-a3798c44.entry.js} +1 -1
  40. package/dist/webcomponents/p-b526ae5a.entry.js +1 -0
  41. package/dist/webcomponents/p-f3211155.entry.js +1 -0
  42. package/dist/webcomponents/webcomponents.esm.js +1 -1
  43. package/package.json +2 -2
  44. package/dist/webcomponents/p-33fa7295.entry.js +0 -1
  45. package/dist/webcomponents/p-388b2c5f.entry.js +0 -1
  46. package/dist/webcomponents/p-632dab44.entry.js +0 -1
@@ -3,12 +3,59 @@ export default {
3
3
  component: 'justifi-billing-form',
4
4
  parameters: {},
5
5
  };
6
- const Template = ({ styleOverrides }) => {
7
- const parsedStyleOverrides = styleOverrides ? JSON.stringify(styleOverrides) : null;
6
+ const Template = (args) => {
8
7
  return (`
9
8
  <div>
10
- <justifi-billing-form data-testid="billing-form-iframe" style-overrides='${parsedStyleOverrides || ''}' />
9
+ <style>
10
+ :root {
11
+ ${args['css-variables'] || ''}
12
+ }
13
+ </style>
14
+ <justifi-billing-form
15
+ data-testid="billing-form-iframe"
16
+ legend="${args['legend'] || ''}"
17
+
18
+ />
11
19
  </div>
12
20
  `);
13
21
  };
14
22
  export const Basic = Template.bind({});
23
+ Basic.args = {
24
+ legend: 'Billing Form',
25
+ };
26
+ export const Styled = Template.bind({});
27
+ Styled.args = {
28
+ legend: 'Styled Billing Form',
29
+ 'css-variables': `
30
+ --jfi-layout-padding: 0;
31
+ --jfi-layout-form-control-spacing-x: .5rem;
32
+ --jfi-layout-form-control-spacing-y: 1rem;
33
+ --jfi-form-label-font-weight: 700;
34
+ --jfi-form-label-font-family: sans-serif;
35
+ --jfi-form-label-margin: 0 0 .5rem 0;
36
+ --jfi-form-control-background-color: #F4F4F6;
37
+ --jfi-form-control-background-color-hover: #EEEEF5;
38
+ --jfi-form-control-border-color: rgba(0, 0, 0, 0.42);
39
+ --jfi-form-control-border-color-hover: rgba(0, 0, 0, 0.62);
40
+ --jfi-form-control-border-color-focus: #fccc32;
41
+ --jfi-form-control-border-color-error: #C12727;
42
+ --jfi-form-control-border-top-width: 0;
43
+ --jfi-form-control-border-left-width: 0;
44
+ --jfi-form-control-border-bottom-width: 1px;
45
+ --jfi-form-control-border-right-width: 0;
46
+ --jfi-form-control-border-radius: 4px 4px 0 0;
47
+ --jfi-form-control-border-style: solid;
48
+ --jfi-form-control-box-shadow-focus: none;
49
+ --jfi-form-control-box-shadow-error-focus: none;
50
+ --jfi-form-control-border-style: solid;
51
+ --jfi-form-control-color: #212529;
52
+ --jfi-form-control-font-size: 1rem;
53
+ --jfi-form-control-font-weight: 400;
54
+ --jfi-form-control-line-height: 2;
55
+ --jfi-form-control-margin: 0;
56
+ --jfi-form-control-padding: .5rem .875rem;
57
+ --jfi-error-message-color: #C12727;
58
+ --jfi-error-message-margin: .25rem 0 0 0;
59
+ --jfi-error-message-font-size: .875rem;
60
+ `
61
+ };
@@ -80,6 +80,23 @@ Basic.args = {
80
80
  'validation-mode': 'onSubmit',
81
81
  'single-line': false,
82
82
  };
83
+ export const SingleLine = Template.bind({});
84
+ SingleLine.args = {
85
+ 'single-line': true,
86
+ };
87
+ export const Embedded = Template.bind({});
88
+ Embedded.decorators = [
89
+ (story) => `
90
+ <style>
91
+ #wrapper {
92
+ background-color: #aaaaaa;
93
+ }
94
+ </style>
95
+ <div id="wrapper" style="width: 50%;">
96
+ ${story()}
97
+ </div>
98
+ `,
99
+ ];
83
100
  export const Styled = Template.bind({});
84
101
  Styled.args = {
85
102
  cssVariables: (`
@@ -1543,6 +1543,390 @@ progress {
1543
1543
  --bs-gutter-y: 3rem;
1544
1544
  }
1545
1545
  }
1546
+ .btn {
1547
+ --bs-btn-padding-x: 0.75rem;
1548
+ --bs-btn-padding-y: 0.375rem;
1549
+ --bs-btn-font-family: ;
1550
+ --bs-btn-font-size: 1rem;
1551
+ --bs-btn-font-weight: 400;
1552
+ --bs-btn-line-height: 1.5;
1553
+ --bs-btn-color: #212529;
1554
+ --bs-btn-bg: transparent;
1555
+ --bs-btn-border-width: 1px;
1556
+ --bs-btn-border-color: transparent;
1557
+ --bs-btn-border-radius: 0.375rem;
1558
+ --bs-btn-hover-border-color: transparent;
1559
+ --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
1560
+ --bs-btn-disabled-opacity: 0.65;
1561
+ --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5);
1562
+ display: inline-block;
1563
+ padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
1564
+ font-family: var(--bs-btn-font-family);
1565
+ font-size: var(--bs-btn-font-size);
1566
+ font-weight: var(--bs-btn-font-weight);
1567
+ line-height: var(--bs-btn-line-height);
1568
+ color: var(--bs-btn-color);
1569
+ text-align: center;
1570
+ text-decoration: none;
1571
+ vertical-align: middle;
1572
+ cursor: pointer;
1573
+ user-select: none;
1574
+ border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
1575
+ border-radius: var(--bs-btn-border-radius);
1576
+ background-color: var(--bs-btn-bg);
1577
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
1578
+ }
1579
+ @media (prefers-reduced-motion: reduce) {
1580
+ .btn {
1581
+ transition: none;
1582
+ }
1583
+ }
1584
+ .btn:hover {
1585
+ color: var(--bs-btn-hover-color);
1586
+ background-color: var(--bs-btn-hover-bg);
1587
+ border-color: var(--bs-btn-hover-border-color);
1588
+ }
1589
+ .btn-check + .btn:hover {
1590
+ color: var(--bs-btn-color);
1591
+ background-color: var(--bs-btn-bg);
1592
+ border-color: var(--bs-btn-border-color);
1593
+ }
1594
+ .btn:focus-visible {
1595
+ color: var(--bs-btn-hover-color);
1596
+ background-color: var(--bs-btn-hover-bg);
1597
+ border-color: var(--bs-btn-hover-border-color);
1598
+ outline: 0;
1599
+ box-shadow: var(--bs-btn-focus-box-shadow);
1600
+ }
1601
+ .btn-check:focus-visible + .btn {
1602
+ border-color: var(--bs-btn-hover-border-color);
1603
+ outline: 0;
1604
+ box-shadow: var(--bs-btn-focus-box-shadow);
1605
+ }
1606
+ .btn-check:checked + .btn, :not(.btn-check) + .btn:active, .btn:first-child:active, .btn.active, .btn.show {
1607
+ color: var(--bs-btn-active-color);
1608
+ background-color: var(--bs-btn-active-bg);
1609
+ border-color: var(--bs-btn-active-border-color);
1610
+ }
1611
+ .btn-check:checked + .btn:focus-visible, :not(.btn-check) + .btn:active:focus-visible, .btn:first-child:active:focus-visible, .btn.active:focus-visible, .btn.show:focus-visible {
1612
+ box-shadow: var(--bs-btn-focus-box-shadow);
1613
+ }
1614
+ .btn:disabled, .btn.disabled, fieldset:disabled .btn {
1615
+ color: var(--bs-btn-disabled-color);
1616
+ pointer-events: none;
1617
+ background-color: var(--bs-btn-disabled-bg);
1618
+ border-color: var(--bs-btn-disabled-border-color);
1619
+ opacity: var(--bs-btn-disabled-opacity);
1620
+ }
1621
+
1622
+ .btn-primary {
1623
+ --bs-btn-color: #fff;
1624
+ --bs-btn-bg: #0d6efd;
1625
+ --bs-btn-border-color: #0d6efd;
1626
+ --bs-btn-hover-color: #fff;
1627
+ --bs-btn-hover-bg: #0b5ed7;
1628
+ --bs-btn-hover-border-color: #0a58ca;
1629
+ --bs-btn-focus-shadow-rgb: 49, 132, 253;
1630
+ --bs-btn-active-color: #fff;
1631
+ --bs-btn-active-bg: #0a58ca;
1632
+ --bs-btn-active-border-color: #0a53be;
1633
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1634
+ --bs-btn-disabled-color: #fff;
1635
+ --bs-btn-disabled-bg: #0d6efd;
1636
+ --bs-btn-disabled-border-color: #0d6efd;
1637
+ }
1638
+
1639
+ .btn-secondary {
1640
+ --bs-btn-color: #fff;
1641
+ --bs-btn-bg: #6c757d;
1642
+ --bs-btn-border-color: #6c757d;
1643
+ --bs-btn-hover-color: #fff;
1644
+ --bs-btn-hover-bg: #5c636a;
1645
+ --bs-btn-hover-border-color: #565e64;
1646
+ --bs-btn-focus-shadow-rgb: 130, 138, 145;
1647
+ --bs-btn-active-color: #fff;
1648
+ --bs-btn-active-bg: #565e64;
1649
+ --bs-btn-active-border-color: #51585e;
1650
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1651
+ --bs-btn-disabled-color: #fff;
1652
+ --bs-btn-disabled-bg: #6c757d;
1653
+ --bs-btn-disabled-border-color: #6c757d;
1654
+ }
1655
+
1656
+ .btn-success {
1657
+ --bs-btn-color: #fff;
1658
+ --bs-btn-bg: #198754;
1659
+ --bs-btn-border-color: #198754;
1660
+ --bs-btn-hover-color: #fff;
1661
+ --bs-btn-hover-bg: #157347;
1662
+ --bs-btn-hover-border-color: #146c43;
1663
+ --bs-btn-focus-shadow-rgb: 60, 153, 110;
1664
+ --bs-btn-active-color: #fff;
1665
+ --bs-btn-active-bg: #146c43;
1666
+ --bs-btn-active-border-color: #13653f;
1667
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1668
+ --bs-btn-disabled-color: #fff;
1669
+ --bs-btn-disabled-bg: #198754;
1670
+ --bs-btn-disabled-border-color: #198754;
1671
+ }
1672
+
1673
+ .btn-info {
1674
+ --bs-btn-color: #000;
1675
+ --bs-btn-bg: #0dcaf0;
1676
+ --bs-btn-border-color: #0dcaf0;
1677
+ --bs-btn-hover-color: #000;
1678
+ --bs-btn-hover-bg: #31d2f2;
1679
+ --bs-btn-hover-border-color: #25cff2;
1680
+ --bs-btn-focus-shadow-rgb: 11, 172, 204;
1681
+ --bs-btn-active-color: #000;
1682
+ --bs-btn-active-bg: #3dd5f3;
1683
+ --bs-btn-active-border-color: #25cff2;
1684
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1685
+ --bs-btn-disabled-color: #000;
1686
+ --bs-btn-disabled-bg: #0dcaf0;
1687
+ --bs-btn-disabled-border-color: #0dcaf0;
1688
+ }
1689
+
1690
+ .btn-warning {
1691
+ --bs-btn-color: #000;
1692
+ --bs-btn-bg: #ffc107;
1693
+ --bs-btn-border-color: #ffc107;
1694
+ --bs-btn-hover-color: #000;
1695
+ --bs-btn-hover-bg: #ffca2c;
1696
+ --bs-btn-hover-border-color: #ffc720;
1697
+ --bs-btn-focus-shadow-rgb: 217, 164, 6;
1698
+ --bs-btn-active-color: #000;
1699
+ --bs-btn-active-bg: #ffcd39;
1700
+ --bs-btn-active-border-color: #ffc720;
1701
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1702
+ --bs-btn-disabled-color: #000;
1703
+ --bs-btn-disabled-bg: #ffc107;
1704
+ --bs-btn-disabled-border-color: #ffc107;
1705
+ }
1706
+
1707
+ .btn-danger {
1708
+ --bs-btn-color: #fff;
1709
+ --bs-btn-bg: #dc3545;
1710
+ --bs-btn-border-color: #dc3545;
1711
+ --bs-btn-hover-color: #fff;
1712
+ --bs-btn-hover-bg: #bb2d3b;
1713
+ --bs-btn-hover-border-color: #b02a37;
1714
+ --bs-btn-focus-shadow-rgb: 225, 83, 97;
1715
+ --bs-btn-active-color: #fff;
1716
+ --bs-btn-active-bg: #b02a37;
1717
+ --bs-btn-active-border-color: #a52834;
1718
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1719
+ --bs-btn-disabled-color: #fff;
1720
+ --bs-btn-disabled-bg: #dc3545;
1721
+ --bs-btn-disabled-border-color: #dc3545;
1722
+ }
1723
+
1724
+ .btn-light {
1725
+ --bs-btn-color: #000;
1726
+ --bs-btn-bg: #f8f9fa;
1727
+ --bs-btn-border-color: #f8f9fa;
1728
+ --bs-btn-hover-color: #000;
1729
+ --bs-btn-hover-bg: #d3d4d5;
1730
+ --bs-btn-hover-border-color: #c6c7c8;
1731
+ --bs-btn-focus-shadow-rgb: 211, 212, 213;
1732
+ --bs-btn-active-color: #000;
1733
+ --bs-btn-active-bg: #c6c7c8;
1734
+ --bs-btn-active-border-color: #babbbc;
1735
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1736
+ --bs-btn-disabled-color: #000;
1737
+ --bs-btn-disabled-bg: #f8f9fa;
1738
+ --bs-btn-disabled-border-color: #f8f9fa;
1739
+ }
1740
+
1741
+ .btn-dark {
1742
+ --bs-btn-color: #fff;
1743
+ --bs-btn-bg: #212529;
1744
+ --bs-btn-border-color: #212529;
1745
+ --bs-btn-hover-color: #fff;
1746
+ --bs-btn-hover-bg: #424649;
1747
+ --bs-btn-hover-border-color: #373b3e;
1748
+ --bs-btn-focus-shadow-rgb: 66, 70, 73;
1749
+ --bs-btn-active-color: #fff;
1750
+ --bs-btn-active-bg: #4d5154;
1751
+ --bs-btn-active-border-color: #373b3e;
1752
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1753
+ --bs-btn-disabled-color: #fff;
1754
+ --bs-btn-disabled-bg: #212529;
1755
+ --bs-btn-disabled-border-color: #212529;
1756
+ }
1757
+
1758
+ .btn-outline-primary {
1759
+ --bs-btn-color: #0d6efd;
1760
+ --bs-btn-border-color: #0d6efd;
1761
+ --bs-btn-hover-color: #fff;
1762
+ --bs-btn-hover-bg: #0d6efd;
1763
+ --bs-btn-hover-border-color: #0d6efd;
1764
+ --bs-btn-focus-shadow-rgb: 13, 110, 253;
1765
+ --bs-btn-active-color: #fff;
1766
+ --bs-btn-active-bg: #0d6efd;
1767
+ --bs-btn-active-border-color: #0d6efd;
1768
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1769
+ --bs-btn-disabled-color: #0d6efd;
1770
+ --bs-btn-disabled-bg: transparent;
1771
+ --bs-btn-disabled-border-color: #0d6efd;
1772
+ --bs-gradient: none;
1773
+ }
1774
+
1775
+ .btn-outline-secondary {
1776
+ --bs-btn-color: #6c757d;
1777
+ --bs-btn-border-color: #6c757d;
1778
+ --bs-btn-hover-color: #fff;
1779
+ --bs-btn-hover-bg: #6c757d;
1780
+ --bs-btn-hover-border-color: #6c757d;
1781
+ --bs-btn-focus-shadow-rgb: 108, 117, 125;
1782
+ --bs-btn-active-color: #fff;
1783
+ --bs-btn-active-bg: #6c757d;
1784
+ --bs-btn-active-border-color: #6c757d;
1785
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1786
+ --bs-btn-disabled-color: #6c757d;
1787
+ --bs-btn-disabled-bg: transparent;
1788
+ --bs-btn-disabled-border-color: #6c757d;
1789
+ --bs-gradient: none;
1790
+ }
1791
+
1792
+ .btn-outline-success {
1793
+ --bs-btn-color: #198754;
1794
+ --bs-btn-border-color: #198754;
1795
+ --bs-btn-hover-color: #fff;
1796
+ --bs-btn-hover-bg: #198754;
1797
+ --bs-btn-hover-border-color: #198754;
1798
+ --bs-btn-focus-shadow-rgb: 25, 135, 84;
1799
+ --bs-btn-active-color: #fff;
1800
+ --bs-btn-active-bg: #198754;
1801
+ --bs-btn-active-border-color: #198754;
1802
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1803
+ --bs-btn-disabled-color: #198754;
1804
+ --bs-btn-disabled-bg: transparent;
1805
+ --bs-btn-disabled-border-color: #198754;
1806
+ --bs-gradient: none;
1807
+ }
1808
+
1809
+ .btn-outline-info {
1810
+ --bs-btn-color: #0dcaf0;
1811
+ --bs-btn-border-color: #0dcaf0;
1812
+ --bs-btn-hover-color: #000;
1813
+ --bs-btn-hover-bg: #0dcaf0;
1814
+ --bs-btn-hover-border-color: #0dcaf0;
1815
+ --bs-btn-focus-shadow-rgb: 13, 202, 240;
1816
+ --bs-btn-active-color: #000;
1817
+ --bs-btn-active-bg: #0dcaf0;
1818
+ --bs-btn-active-border-color: #0dcaf0;
1819
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1820
+ --bs-btn-disabled-color: #0dcaf0;
1821
+ --bs-btn-disabled-bg: transparent;
1822
+ --bs-btn-disabled-border-color: #0dcaf0;
1823
+ --bs-gradient: none;
1824
+ }
1825
+
1826
+ .btn-outline-warning {
1827
+ --bs-btn-color: #ffc107;
1828
+ --bs-btn-border-color: #ffc107;
1829
+ --bs-btn-hover-color: #000;
1830
+ --bs-btn-hover-bg: #ffc107;
1831
+ --bs-btn-hover-border-color: #ffc107;
1832
+ --bs-btn-focus-shadow-rgb: 255, 193, 7;
1833
+ --bs-btn-active-color: #000;
1834
+ --bs-btn-active-bg: #ffc107;
1835
+ --bs-btn-active-border-color: #ffc107;
1836
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1837
+ --bs-btn-disabled-color: #ffc107;
1838
+ --bs-btn-disabled-bg: transparent;
1839
+ --bs-btn-disabled-border-color: #ffc107;
1840
+ --bs-gradient: none;
1841
+ }
1842
+
1843
+ .btn-outline-danger {
1844
+ --bs-btn-color: #dc3545;
1845
+ --bs-btn-border-color: #dc3545;
1846
+ --bs-btn-hover-color: #fff;
1847
+ --bs-btn-hover-bg: #dc3545;
1848
+ --bs-btn-hover-border-color: #dc3545;
1849
+ --bs-btn-focus-shadow-rgb: 220, 53, 69;
1850
+ --bs-btn-active-color: #fff;
1851
+ --bs-btn-active-bg: #dc3545;
1852
+ --bs-btn-active-border-color: #dc3545;
1853
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1854
+ --bs-btn-disabled-color: #dc3545;
1855
+ --bs-btn-disabled-bg: transparent;
1856
+ --bs-btn-disabled-border-color: #dc3545;
1857
+ --bs-gradient: none;
1858
+ }
1859
+
1860
+ .btn-outline-light {
1861
+ --bs-btn-color: #f8f9fa;
1862
+ --bs-btn-border-color: #f8f9fa;
1863
+ --bs-btn-hover-color: #000;
1864
+ --bs-btn-hover-bg: #f8f9fa;
1865
+ --bs-btn-hover-border-color: #f8f9fa;
1866
+ --bs-btn-focus-shadow-rgb: 248, 249, 250;
1867
+ --bs-btn-active-color: #000;
1868
+ --bs-btn-active-bg: #f8f9fa;
1869
+ --bs-btn-active-border-color: #f8f9fa;
1870
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1871
+ --bs-btn-disabled-color: #f8f9fa;
1872
+ --bs-btn-disabled-bg: transparent;
1873
+ --bs-btn-disabled-border-color: #f8f9fa;
1874
+ --bs-gradient: none;
1875
+ }
1876
+
1877
+ .btn-outline-dark {
1878
+ --bs-btn-color: #212529;
1879
+ --bs-btn-border-color: #212529;
1880
+ --bs-btn-hover-color: #fff;
1881
+ --bs-btn-hover-bg: #212529;
1882
+ --bs-btn-hover-border-color: #212529;
1883
+ --bs-btn-focus-shadow-rgb: 33, 37, 41;
1884
+ --bs-btn-active-color: #fff;
1885
+ --bs-btn-active-bg: #212529;
1886
+ --bs-btn-active-border-color: #212529;
1887
+ --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
1888
+ --bs-btn-disabled-color: #212529;
1889
+ --bs-btn-disabled-bg: transparent;
1890
+ --bs-btn-disabled-border-color: #212529;
1891
+ --bs-gradient: none;
1892
+ }
1893
+
1894
+ .btn-link {
1895
+ --bs-btn-font-weight: 400;
1896
+ --bs-btn-color: var(--bs-link-color);
1897
+ --bs-btn-bg: transparent;
1898
+ --bs-btn-border-color: transparent;
1899
+ --bs-btn-hover-color: var(--bs-link-hover-color);
1900
+ --bs-btn-hover-border-color: transparent;
1901
+ --bs-btn-active-color: var(--bs-link-hover-color);
1902
+ --bs-btn-active-border-color: transparent;
1903
+ --bs-btn-disabled-color: #6c757d;
1904
+ --bs-btn-disabled-border-color: transparent;
1905
+ --bs-btn-box-shadow: none;
1906
+ --bs-btn-focus-shadow-rgb: 49, 132, 253;
1907
+ text-decoration: underline;
1908
+ }
1909
+ .btn-link:focus-visible {
1910
+ color: var(--bs-btn-color);
1911
+ }
1912
+ .btn-link:hover {
1913
+ color: var(--bs-btn-hover-color);
1914
+ }
1915
+
1916
+ .btn-lg {
1917
+ --bs-btn-padding-y: 0.5rem;
1918
+ --bs-btn-padding-x: 1rem;
1919
+ --bs-btn-font-size: 1.25rem;
1920
+ --bs-btn-border-radius: 0.5rem;
1921
+ }
1922
+
1923
+ .btn-sm {
1924
+ --bs-btn-padding-y: 0.25rem;
1925
+ --bs-btn-padding-x: 0.5rem;
1926
+ --bs-btn-font-size: 0.875rem;
1927
+ --bs-btn-border-radius: 0.25rem;
1928
+ }
1929
+
1546
1930
  :host {
1547
1931
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
1548
1932
  font-size: 1rem;
@@ -4,7 +4,12 @@ export class PaymentForm {
4
4
  constructor() {
5
5
  this.bankAccount = undefined;
6
6
  this.card = undefined;
7
+ this.email = undefined;
7
8
  this.iframeOrigin = undefined;
9
+ this.clientId = undefined;
10
+ this.accountId = undefined;
11
+ this.submitButtonText = undefined;
12
+ this.submitButtonEnabled = true;
8
13
  this.selectedPaymentMethodType = undefined;
9
14
  this.allowedPaymentMethodTypes = [];
10
15
  }
@@ -27,16 +32,22 @@ export class PaymentForm {
27
32
  async fillBillingForm(fields) {
28
33
  this.billingFormRef.fill(fields);
29
34
  }
30
- async submit(args) {
35
+ async enableSubmitButton() {
36
+ this.submitButtonEnabled = true;
37
+ }
38
+ async submit(event) {
39
+ event.preventDefault();
31
40
  if (!this.paymentMethodFormRef || !this.billingFormRef)
32
41
  return;
33
42
  const billingFormValidation = await this.billingFormRef.validate();
34
43
  const paymentMethodFormValidation = await this.paymentMethodFormRef.validate();
35
44
  if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
36
45
  return;
46
+ this.submitButtonEnabled = false;
37
47
  const billingFormFieldValues = await this.billingFormRef.getValues();
38
- const paymentMethodData = Object.assign(Object.assign({}, args.paymentMethodData), billingFormFieldValues);
39
- return this.paymentMethodFormRef.tokenize(args.clientId, paymentMethodData, args.accountId);
48
+ const paymentMethodData = Object.assign({ email: this.email }, billingFormFieldValues);
49
+ const tokenizeResponse = await this.paymentMethodFormRef.tokenize(this.clientId, paymentMethodData, this.accountId);
50
+ this.submitted.emit(tokenizeResponse);
40
51
  }
41
52
  render() {
42
53
  return (h(Host, null, h("form", { class: "row gy-3" }, (this.allowedPaymentMethodTypes.length > 1) && (h("div", { class: "col-12" }, h("justifi-payment-method-selector", { paymentMethodTypes: this.allowedPaymentMethodTypes, selectedPaymentMethodType: this.selectedPaymentMethodType }))), h("div", { class: "col-12" }, h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, "iframe-origin": this.iframeOrigin, ref: el => {
@@ -47,7 +58,7 @@ export class PaymentForm {
47
58
  if (el) {
48
59
  this.billingFormRef = el;
49
60
  }
50
- } })))));
61
+ } })), h("div", { class: "col-12" }, h("button", { onClick: (event) => this.submit(event), disabled: !this.submitButtonEnabled, type: "submit", class: "btn btn-primary" }, this.submitButtonText || 'Submit')))));
51
62
  }
52
63
  static get is() { return "justifi-payment-form"; }
53
64
  static get encapsulation() { return "shadow"; }
@@ -97,6 +108,23 @@ export class PaymentForm {
97
108
  "attribute": "card",
98
109
  "reflect": false
99
110
  },
111
+ "email": {
112
+ "type": "string",
113
+ "mutable": false,
114
+ "complexType": {
115
+ "original": "string",
116
+ "resolved": "string",
117
+ "references": {}
118
+ },
119
+ "required": false,
120
+ "optional": true,
121
+ "docs": {
122
+ "tags": [],
123
+ "text": ""
124
+ },
125
+ "attribute": "email",
126
+ "reflect": false
127
+ },
100
128
  "iframeOrigin": {
101
129
  "type": "string",
102
130
  "mutable": false,
@@ -113,15 +141,85 @@ export class PaymentForm {
113
141
  },
114
142
  "attribute": "iframe-origin",
115
143
  "reflect": false
144
+ },
145
+ "clientId": {
146
+ "type": "string",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "string",
150
+ "resolved": "string",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": false,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": ""
158
+ },
159
+ "attribute": "client-id",
160
+ "reflect": false
161
+ },
162
+ "accountId": {
163
+ "type": "string",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "string",
167
+ "resolved": "string",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": true,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": ""
175
+ },
176
+ "attribute": "account-id",
177
+ "reflect": false
178
+ },
179
+ "submitButtonText": {
180
+ "type": "string",
181
+ "mutable": false,
182
+ "complexType": {
183
+ "original": "string",
184
+ "resolved": "string",
185
+ "references": {}
186
+ },
187
+ "required": false,
188
+ "optional": true,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": ""
192
+ },
193
+ "attribute": "submit-button-text",
194
+ "reflect": false
116
195
  }
117
196
  };
118
197
  }
119
198
  static get states() {
120
199
  return {
200
+ "submitButtonEnabled": {},
121
201
  "selectedPaymentMethodType": {},
122
202
  "allowedPaymentMethodTypes": {}
123
203
  };
124
204
  }
205
+ static get events() {
206
+ return [{
207
+ "method": "submitted",
208
+ "name": "submitted",
209
+ "bubbles": true,
210
+ "cancelable": true,
211
+ "composed": true,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": ""
215
+ },
216
+ "complexType": {
217
+ "original": "{ data: any }",
218
+ "resolved": "{ data: any; }",
219
+ "references": {}
220
+ }
221
+ }];
222
+ }
125
223
  static get methods() {
126
224
  return {
127
225
  "fillBillingForm": {
@@ -147,19 +245,16 @@ export class PaymentForm {
147
245
  "tags": []
148
246
  }
149
247
  },
150
- "submit": {
248
+ "enableSubmitButton": {
151
249
  "complexType": {
152
- "signature": "(args: { clientId: string; paymentMethodData: any; accountId?: string; }) => Promise<any>",
153
- "parameters": [{
154
- "tags": [],
155
- "text": ""
156
- }],
250
+ "signature": "() => Promise<void>",
251
+ "parameters": [],
157
252
  "references": {
158
253
  "Promise": {
159
254
  "location": "global"
160
255
  }
161
256
  },
162
- "return": "Promise<any>"
257
+ "return": "Promise<void>"
163
258
  },
164
259
  "docs": {
165
260
  "text": "",