@justifi/webcomponents 2.0.2 → 3.0.0

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 (39) hide show
  1. package/CHANGELOG.md +13 -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 +3 -2
  4. package/dist/cjs/justifi-payment-form.cjs.entry.js +17 -5
  5. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +1 -1
  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 +68 -0
  10. package/dist/collection/components/billing-form/billing-form-schema.js +1 -1
  11. package/dist/collection/components/billing-form/billing-form.js +2 -1
  12. package/dist/collection/components/payment-form/payment-form.css +384 -0
  13. package/dist/collection/components/payment-form/payment-form.js +106 -11
  14. package/dist/collection/components/payment-form/payment-form.stories.js +23 -43
  15. package/dist/components/billing-form.js +3 -2
  16. package/dist/components/justifi-bank-account-form.js +0 -2
  17. package/dist/components/justifi-payment-form.js +24 -7
  18. package/dist/components/payment-method-form.js +1 -1
  19. package/dist/esm/justifi-bank-account-form.entry.js +0 -1
  20. package/dist/esm/justifi-billing-form_2.entry.js +3 -2
  21. package/dist/esm/justifi-payment-form.entry.js +18 -6
  22. package/dist/esm/justifi-payment-method-form.entry.js +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/webcomponents.js +1 -1
  25. package/dist/types/components/bank-account-form/bank-account-form.d.ts +0 -4
  26. package/dist/types/components/bank-account-form/bank-account-form.stories.d.ts +16 -0
  27. package/dist/types/components/billing-form/billing-form-schema.d.ts +3 -0
  28. package/dist/types/components/payment-form/payment-form.d.ts +11 -5
  29. package/dist/types/components/payment-form/payment-form.stories.d.ts +2 -25
  30. package/dist/types/components.d.ts +14 -9
  31. package/dist/webcomponents/{p-f7aa93bc.entry.js → p-17d2674c.entry.js} +1 -1
  32. package/dist/webcomponents/p-282af003.entry.js +1 -0
  33. package/dist/webcomponents/p-87a342be.entry.js +1 -0
  34. package/dist/webcomponents/p-f3211155.entry.js +1 -0
  35. package/dist/webcomponents/webcomponents.esm.js +1 -1
  36. package/package.json +2 -2
  37. package/dist/webcomponents/p-33fa7295.entry.js +0 -1
  38. package/dist/webcomponents/p-388b2c5f.entry.js +0 -1
  39. package/dist/webcomponents/p-632dab44.entry.js +0 -1
@@ -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": "",
@@ -1,35 +1,13 @@
1
+ const isDev = process.env.NODE_ENV === 'development';
1
2
  export default {
2
3
  title: 'Components/PaymentForm',
3
4
  component: 'justifi-payment-form',
4
5
  argTypes: {
5
- 'bank-account': {
6
- control: 'boolean',
7
- table: {
8
- category: 'Props'
9
- }
10
- },
11
- card: {
12
- control: 'boolean',
13
- table: {
14
- category: 'Props'
15
- }
16
- },
17
- accountId: {
6
+ 'iframe-origin': {
18
7
  control: 'text',
19
8
  table: {
20
- category: 'Tokenize Arguments'
21
- }
22
- },
23
- clientId: {
24
- control: 'text',
25
- table: {
26
- category: 'Tokenize Arguments'
27
- }
28
- },
29
- paymentMethodData: {
30
- control: 'object',
31
- table: {
32
- category: 'Tokenize Arguments'
9
+ disable: isDev ? false : true,
10
+ category: 'props',
33
11
  }
34
12
  },
35
13
  },
@@ -46,10 +24,15 @@ const Template = (args) => {
46
24
  // The <div> here should be replaced by a `display` property in the cardForm potentially
47
25
  return (`
48
26
  <div>
49
- <justifi-payment-form card=${args.card} bank-account=${args['bank-account']} />
50
- </div>
51
- <div>
52
- <button id="submit-button">Submit</button>
27
+ <justifi-payment-form
28
+ card=${args.card}
29
+ bank-account='${args['bank-account']}'
30
+ email='${args.email}'
31
+ client-id='${args['client-id']}'
32
+ account-id='${args['account-id']}'
33
+ submit-button-text='${args['submit-button-text']}'
34
+ iframe-origin='${args['iframe-origin']}'
35
+ />
53
36
  </div>
54
37
  <style>
55
38
  :root {
@@ -60,15 +43,11 @@ const Template = (args) => {
60
43
  (async () => {
61
44
  await customElements.whenDefined('justifi-payment-form');
62
45
  const paymentForm = document.querySelector('justifi-payment-form');
63
- const submitButton = document.querySelector('#submit-button');
64
-
65
- submitButton?.addEventListener('click', async () => {
66
- const tokenizeResponse = await paymentForm.submit({
67
- clientId: '${args.clientId}',
68
- paymentMethodData: ${JSON.stringify(args.paymentMethodData)},
69
- accountId: '${args.accountId}'
70
- });
71
- console.log('tokenizeResponse:', tokenizeResponse);
46
+ paymentForm.addEventListener('submitted', async (event) => {
47
+ // here is where you would submit a payment with the token
48
+ console.log(event.detail);
49
+ // after the payment succeeds or fails, the form submit button can be enabled again
50
+ await paymentForm.enableSubmitButton();
72
51
  });
73
52
  })()
74
53
  </script>
@@ -78,10 +57,11 @@ export const Basic = Template.bind({});
78
57
  Basic.args = {
79
58
  'bank-account': true,
80
59
  card: true,
81
- clientId: '',
82
- paymentMethodData: {},
83
- accountId: '',
84
- iframeOrigin: ''
60
+ email: '',
61
+ 'client-id': '',
62
+ 'account-id': '',
63
+ 'submit-button-text': '',
64
+ 'iframe-origin': ''
85
65
  };
86
66
  export const Styled = Template.bind({});
87
67
  Styled.args = {
@@ -1848,7 +1848,7 @@ create$3.prototype = ObjectSchema.prototype;
1848
1848
 
1849
1849
  const RegExZip = /^\d{5}/;
1850
1850
  const BillingFormSchema = create$3({
1851
- // name: string().required('Enter name'),
1851
+ name: create$6().required('Enter name'),
1852
1852
  address_line1: create$6().required('Enter street address'),
1853
1853
  address_line2: create$6(),
1854
1854
  address_city: create$6().required('Enter city'),
@@ -2112,6 +2112,7 @@ const BillingForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2112
2112
  this.legendBlock = (h("legend", null, this.legend));
2113
2113
  this.legend = undefined;
2114
2114
  this.billingFields = {
2115
+ name: '',
2115
2116
  address_line1: '',
2116
2117
  address_line2: '',
2117
2118
  address_city: '',
@@ -2150,7 +2151,7 @@ const BillingForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2150
2151
  return this.billingFields;
2151
2152
  }
2152
2153
  render() {
2153
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, this.legend && this.legendBlock, h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 })), h("div", { class: "col-12" }, h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 })), h("div", { class: "col-12" }, h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city })), h("div", { class: "col-12" }, h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state })), h("div", { class: "col-12" }, h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))))));
2154
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, this.legend && this.legendBlock, h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("text-input", { name: "name", label: "Full Name", defaultValue: this.billingFields.name, error: this.billingFieldsErrors.name })), h("div", { class: "col-12" }, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 })), h("div", { class: "col-12" }, h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 })), h("div", { class: "col-12" }, h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city })), h("div", { class: "col-12" }, h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state })), h("div", { class: "col-12" }, h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))))));
2154
2155
  }
2155
2156
  static get style() { return billingFormCss; }
2156
2157
  }, [1, "justifi-billing-form", {