|
17 | 17 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; |
18 | 18 | font-size: 14px; |
19 | 19 | line-height: 1.42857143; |
| 20 | + |
| 21 | + /* css vars for web component */ |
| 22 | + --one-column-view-max-width: 500px; |
20 | 23 | } |
21 | 24 |
|
22 | 25 | body .dev-tools { |
|
38 | 41 | <div class="dev-tools"> |
39 | 42 | <div id="options"> |
40 | 43 | <button id="toggle-receipts">Toggle receipts</button> |
41 | | - <button id="toggle-buttons">Toggle button types</button> |
| 44 | + <button id="clear-updates">Clear updates</button> |
| 45 | + <button id="toggle-plans">Toggle plans</button> |
42 | 46 |
|
43 | 47 | <p id="interaction-status-area" style="min-height: 50px;margin: 10px;"></p> |
44 | 48 | </div> |
45 | 49 | </div> |
46 | 50 |
|
47 | 51 | <div id="demo"> |
48 | 52 | <style> |
49 | | - iaux-monthly-giving-circle { |
| 53 | + ia-monthly-giving-circle { |
50 | 54 | display: block; |
51 | 55 | margin: 0 auto; |
52 | 56 | max-width: 800px; |
53 | 57 | } |
54 | 58 | </style> |
55 | | - <iaux-monthly-giving-circle></iaux-monthly-giving-circle> |
| 59 | + <ia-monthly-giving-circle></ia-monthly-giving-circle> |
56 | 60 | </div> |
57 | 61 |
|
58 | 62 | <script type="module" src="../dist/src/monthly-giving-circle.js"></script> |
59 | 63 | <script type="module"> |
60 | | - import { Receipt } from '../dist/src/models/receipt.js'; |
| 64 | + import { MonthlyPlan, Receipt } from '../dist/index.js'; |
61 | 65 |
|
62 | 66 | let updateNotices = []; |
63 | 67 |
|
| 68 | + const plans = { |
| 69 | + "41": { |
| 70 | + "token": "Acbdcdcadsfdasf.1234alphanumeric.3foobarXyZ", |
| 71 | + "amount": 10, |
| 72 | + "start_date": "2024-05-22 00:00:00", |
| 73 | + "is_test": true, |
| 74 | + "btdata": { |
| 75 | + "billingDayOfMonth": 22, |
| 76 | + "nextBillingDate": { |
| 77 | + "date": "2024-08-22 00:00:00.000000", |
| 78 | + "timezone_type": 3, |
| 79 | + "timezone": "UTC" |
| 80 | + }, |
| 81 | + "status": "Active", |
| 82 | + "paymentMethodType": "Paypal", |
| 83 | + "last4": null, |
| 84 | + "cardType": null, |
| 85 | + "expirationMonth": null, |
| 86 | + "expirationYear": null, |
| 87 | + "paypalEmail": "donations-buyer@archive.org" |
| 88 | + } |
| 89 | + }, |
| 90 | + "23764": { |
| 91 | + "token": "Acbdcdcadsfdasf.1234alphanumeric.3foobar", |
| 92 | + "amount": 5, |
| 93 | + "start_date": "2022-12-09 00:00:00", |
| 94 | + "is_test": true, |
| 95 | + "btdata": { |
| 96 | + "billingDayOfMonth": 9, |
| 97 | + "nextBillingDate": { |
| 98 | + "date": "2024-09-09 00:00:00.000000", |
| 99 | + "timezone_type": 3, |
| 100 | + "timezone": "UTC" |
| 101 | + }, |
| 102 | + "status": "Active", |
| 103 | + "paymentMethodType": "creditCard", |
| 104 | + "last4": "1111", |
| 105 | + "cardType": "Visa", |
| 106 | + "expirationMonth": "12", |
| 107 | + "expirationYear": "2023" |
| 108 | + } |
| 109 | + }, |
| 110 | + "35406": { |
| 111 | + "token": "Acbdcdcadsfdasf.1234alphanumeric.3foobar444999sparklingCider", |
| 112 | + "amount": 5, |
| 113 | + "currency": "USD", |
| 114 | + "start_date": "2024-07-01 00:00:00", |
| 115 | + "is_test": true, |
| 116 | + "btdata": { |
| 117 | + "billingDayOfMonth": 22, |
| 118 | + "nextBillingDate": { |
| 119 | + "date": "2024-08-22 00:00:00.000000", |
| 120 | + "timezone_type": 3, |
| 121 | + "timezone": "UTC" |
| 122 | + }, |
| 123 | + "status": "Active", |
| 124 | + "paymentMethodType": "Venmo", |
| 125 | + "last4": null, |
| 126 | + "cardType": null, |
| 127 | + "expirationMonth": null, |
| 128 | + "expirationYear": null, |
| 129 | + "venmoUsername": "venmojoe" |
| 130 | + } |
| 131 | + } |
| 132 | + }; |
| 133 | + |
| 134 | + const plansArray = Object.keys(plans).map((key) => new MonthlyPlan(plans[key])); |
| 135 | + |
64 | 136 | const receiptsData = [ |
65 | 137 | new Receipt({ |
66 | | - |
| 138 | + currency: 'USD', |
67 | 139 | net_amount: 9999.99, |
68 | 140 | total_amount: 9999.99, |
69 | 141 | fee_amount: 0, |
|
118 | 190 |
|
119 | 191 | let showReceipts = true; |
120 | 192 |
|
121 | | - const mgcComponent = document.querySelector('iaux-monthly-giving-circle'); |
| 193 | + const mgcComponent = document.querySelector('ia-monthly-giving-circle'); |
122 | 194 |
|
123 | 195 | // load start data |
124 | 196 | mgcComponent.receipts = receiptsData; |
| 197 | + mgcComponent.plans = plansArray; |
125 | 198 |
|
126 | 199 | // event handlers |
127 | 200 | mgcComponent.addEventListener('EmailReceiptRequest', (e) => { |
|
163 | 236 |
|
164 | 237 | showReceipts = true; |
165 | 238 | }); |
| 239 | + document.getElementById('clear-updates').addEventListener('click', async () => { |
| 240 | + updateNotices = []; |
| 241 | + mgcComponent.updates = updateNotices; |
| 242 | + await mgcComponent.updateComplete; |
| 243 | + }); |
| 244 | + document.getElementById('toggle-plans').addEventListener('click', async () => { |
| 245 | + mgcComponent.plans = mgcComponent.plans.length ? [] : plansArray; |
| 246 | + await mgcComponent.updateComplete; |
| 247 | + }); |
166 | 248 | </script> |
167 | 249 | </body> |
168 | 250 | </html> |
0 commit comments