@internetarchive/donation-monthly-portal 1.0.0 → 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/dist/index.d.ts +3 -0
  2. package/dist/index.js +2 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/models/plan.d.ts +41 -0
  5. package/dist/src/models/plan.js +59 -0
  6. package/dist/src/models/plan.js.map +1 -0
  7. package/dist/src/models/receipt.d.ts +20 -0
  8. package/dist/src/models/receipt.js +37 -0
  9. package/dist/src/models/receipt.js.map +1 -0
  10. package/dist/src/monthly-giving-circle.d.ts +20 -2
  11. package/dist/src/monthly-giving-circle.js +112 -4
  12. package/dist/src/monthly-giving-circle.js.map +1 -1
  13. package/dist/src/plans.d.ts +7 -0
  14. package/dist/src/plans.js +171 -0
  15. package/dist/src/plans.js.map +1 -0
  16. package/dist/src/presentational/ia-button.d.ts +9 -0
  17. package/dist/src/presentational/ia-button.js +101 -0
  18. package/dist/src/presentational/ia-button.js.map +1 -0
  19. package/dist/src/presentational/mgc-title.js +25 -11
  20. package/dist/src/presentational/mgc-title.js.map +1 -1
  21. package/dist/src/receipts.d.ts +25 -0
  22. package/dist/src/receipts.js +217 -0
  23. package/dist/src/receipts.js.map +1 -0
  24. package/dist/src/welcome-message.js +2 -1
  25. package/dist/src/welcome-message.js.map +1 -1
  26. package/dist/test/monthly-giving-circle.test.js +120 -3
  27. package/dist/test/monthly-giving-circle.test.js.map +1 -1
  28. package/dist/test/receipt-email-request-flow.test.d.ts +1 -0
  29. package/dist/test/receipt-email-request-flow.test.js +49 -0
  30. package/dist/test/receipt-email-request-flow.test.js.map +1 -0
  31. package/package.json +3 -2
  32. package/src/models/plan.ts +103 -0
  33. package/src/models/receipt.ts +53 -0
  34. package/src/monthly-giving-circle.ts +123 -4
  35. package/src/plans.ts +169 -0
  36. package/src/presentational/ia-button.ts +93 -0
  37. package/src/presentational/mgc-title.ts +25 -11
  38. package/src/receipts.ts +237 -0
  39. package/src/welcome-message.ts +2 -1
package/dist/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export { MonthlyGivingCircle } from './src/monthly-giving-circle';
2
+ export type { AnUpdate } from './src/monthly-giving-circle';
3
+ export { Receipt } from './src/models/receipt';
4
+ export { MonthlyPlan } from './src/models/plan';
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export { MonthlyGivingCircle } from './src/monthly-giving-circle';
2
+ export { Receipt } from './src/models/receipt';
3
+ export { MonthlyPlan } from './src/models/plan';
2
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { MonthlyGivingCircle } from './src/monthly-giving-circle';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { MonthlyGivingCircle } from './src/monthly-giving-circle';\nexport type { AnUpdate } from './src/monthly-giving-circle';\nexport { Receipt } from './src/models/receipt';\nexport { MonthlyPlan } from './src/models/plan';\n"]}
@@ -0,0 +1,41 @@
1
+ declare type BtData = {
2
+ billingDayOfMonth: number;
3
+ nextBillingDate: {
4
+ date: string;
5
+ timezone_type: number;
6
+ timezone: string;
7
+ };
8
+ status: string;
9
+ paymentMethodType: string;
10
+ last4: string | null;
11
+ cardType: string | null;
12
+ expirationMonth: string | null;
13
+ expirationYear: string | null;
14
+ paypalEmail?: string;
15
+ venmoUsername?: string;
16
+ };
17
+ declare type Plan = {
18
+ token: string;
19
+ amount: number;
20
+ currency: string;
21
+ start_date: string;
22
+ is_test: boolean;
23
+ btdata: BtData;
24
+ oldAmount?: number;
25
+ oldDate?: string;
26
+ oldPaymentMethod?: string;
27
+ isCancelled?: boolean;
28
+ };
29
+ export declare class MonthlyPlan {
30
+ plan: Plan;
31
+ currency: string;
32
+ payment: BtData;
33
+ constructor(plan: Plan);
34
+ get id(): string;
35
+ get currencySymbol(): string;
36
+ get amount(): number;
37
+ get startDate(): string;
38
+ get nextBillingDate(): string;
39
+ get isTest(): boolean;
40
+ }
41
+ export {};
@@ -0,0 +1,59 @@
1
+ export class MonthlyPlan {
2
+ constructor(plan) {
3
+ var _a;
4
+ this.plan = plan;
5
+ this.payment = plan.btdata;
6
+ this.currency = (_a = plan.currency) !== null && _a !== void 0 ? _a : 'USD'; // not in data
7
+ }
8
+ get id() {
9
+ // use token as unique id
10
+ return this.plan.token;
11
+ }
12
+ get currencySymbol() {
13
+ return this.currency === 'USD' ? '$' : '';
14
+ }
15
+ get amount() {
16
+ return this.plan.amount;
17
+ }
18
+ get startDate() {
19
+ const date = new Date(this.plan.start_date);
20
+ return date.toLocaleDateString();
21
+ }
22
+ get nextBillingDate() {
23
+ const nextBillingDate = new Date(this.payment.nextBillingDate.date).toLocaleDateString(undefined, {
24
+ year: 'numeric',
25
+ month: 'short',
26
+ day: 'numeric',
27
+ });
28
+ return nextBillingDate !== null && nextBillingDate !== void 0 ? nextBillingDate : 'not found';
29
+ }
30
+ get isTest() {
31
+ return this.plan.is_test;
32
+ }
33
+ }
34
+ /*
35
+
36
+ {
37
+ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtYWlsc3luYyIsImlhdCI6MTczODYxNTY3NS41ODA4MTcsIm5iZiI6MTczODYxNTYxNS41ODA4MTcsImV4cCI6MTczODYxNjI3NS41ODA4MTcsImtleSI6eyJwaWQiOiJkd2NrN20iLCJjaWQiOjgwMzUzOCwiYW1vdW50Ijo1LCJwYXltZW50TWV0aG9kVG9rZW4iOiJxMXllYndoaiIsImN1c3RvbWVySWQiOiI4NTQ2MTk4MzUifSwidXNlciI6IkBpc2EtYXQtdGhlLWFyY2hpdmUifQ.TYlkU1ZZLHmj2ahrkTV7JGLmpCPN4BcOeDFPiXVj0pM",
38
+ "amount": 5,
39
+ "currency": "USD",
40
+ "start_date": "2022-12-09 00:00:00",
41
+ "contribution_status_id": 5,
42
+ "is_test": true,
43
+ "btdata": {
44
+ "billingDayOfMonth": 9,
45
+ "nextBillingDate": {
46
+ "date": "2025-02-09 00:00:00.000000",
47
+ "timezone_type": 3,
48
+ "timezone": "UTC"
49
+ },
50
+ "status": "Active",
51
+ "paymentMethodType": "creditCard",
52
+ "last4": "1111",
53
+ "cardType": "Visa",
54
+ "expirationMonth": "12",
55
+ "expirationYear": "2023"
56
+ }
57
+ }
58
+ */
59
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/models/plan.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,WAAW;IAOtB,YAAY,IAAU;;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,KAAK,CAAC,CAAC,cAAc;IACxD,CAAC;IAED,IAAI,EAAE;QACJ,yBAAyB;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,IAAI,SAAS;QACX,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,eAAe;QACjB,MAAM,eAAe,GAAG,IAAI,IAAI,CAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAClC,CAAC,kBAAkB,CAAC,SAAS,EAAE;YAC9B,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO;YACd,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QAEH,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;IAwBI","sourcesContent":["type BtData = {\n billingDayOfMonth: number;\n nextBillingDate: {\n date: string;\n timezone_type: number;\n timezone: string;\n };\n status: string; // active, inactive\n paymentMethodType: string; // cc, paypal, venmo, etc\n last4: string | null;\n cardType: string | null;\n expirationMonth: string | null;\n expirationYear: string | null;\n paypalEmail?: string;\n venmoUsername?: string;\n};\n\ntype Plan = {\n token: string;\n amount: number;\n currency: string;\n start_date: string; // UTC\n is_test: boolean;\n btdata: BtData;\n oldAmount?: number;\n oldDate?: string;\n oldPaymentMethod?: string;\n isCancelled?: boolean;\n};\n\nexport class MonthlyPlan {\n plan: Plan;\n\n currency: string;\n\n payment: BtData;\n\n constructor(plan: Plan) {\n this.plan = plan;\n this.payment = plan.btdata;\n this.currency = plan.currency ?? 'USD'; // not in data\n }\n\n get id(): string {\n // use token as unique id\n return this.plan.token;\n }\n\n get currencySymbol(): string {\n return this.currency === 'USD' ? '$' : '';\n }\n\n get amount(): number {\n return this.plan.amount;\n }\n\n get startDate(): string {\n const date = new Date(this.plan.start_date);\n return date.toLocaleDateString();\n }\n\n get nextBillingDate(): string {\n const nextBillingDate = new Date(\n this.payment.nextBillingDate.date\n ).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n return nextBillingDate ?? 'not found';\n }\n\n get isTest(): boolean {\n return this.plan.is_test;\n }\n}\n\n/*\n\n{\n \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtYWlsc3luYyIsImlhdCI6MTczODYxNTY3NS41ODA4MTcsIm5iZiI6MTczODYxNTYxNS41ODA4MTcsImV4cCI6MTczODYxNjI3NS41ODA4MTcsImtleSI6eyJwaWQiOiJkd2NrN20iLCJjaWQiOjgwMzUzOCwiYW1vdW50Ijo1LCJwYXltZW50TWV0aG9kVG9rZW4iOiJxMXllYndoaiIsImN1c3RvbWVySWQiOiI4NTQ2MTk4MzUifSwidXNlciI6IkBpc2EtYXQtdGhlLWFyY2hpdmUifQ.TYlkU1ZZLHmj2ahrkTV7JGLmpCPN4BcOeDFPiXVj0pM\",\n \"amount\": 5,\n \"currency\": \"USD\",\n \"start_date\": \"2022-12-09 00:00:00\",\n \"contribution_status_id\": 5,\n \"is_test\": true,\n \"btdata\": {\n \"billingDayOfMonth\": 9,\n \"nextBillingDate\": {\n \"date\": \"2025-02-09 00:00:00.000000\",\n \"timezone_type\": 3,\n \"timezone\": \"UTC\"\n },\n \"status\": \"Active\",\n \"paymentMethodType\": \"creditCard\",\n \"last4\": \"1111\",\n \"cardType\": \"Visa\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2023\"\n }\n}\n */\n"]}
@@ -0,0 +1,20 @@
1
+ declare type AReceipt = {
2
+ currency: string;
3
+ net_amount: number;
4
+ total_amount: number;
5
+ receive_date?: Date;
6
+ date: string;
7
+ isTest: boolean;
8
+ token: string;
9
+ };
10
+ export declare class Receipt {
11
+ receipt: AReceipt;
12
+ constructor(receipt: AReceipt);
13
+ get amountFormatted(): string;
14
+ get amount(): string;
15
+ get isTest(): boolean;
16
+ get id(): string;
17
+ get date(): string;
18
+ get currencySymbol(): string;
19
+ }
20
+ export {};
@@ -0,0 +1,37 @@
1
+ export class Receipt {
2
+ constructor(receipt) {
3
+ this.receipt = receipt;
4
+ }
5
+ get amountFormatted() {
6
+ var _a, _b;
7
+ const value = (_a = this.receipt.total_amount) !== null && _a !== void 0 ? _a : this.receipt.net_amount;
8
+ const currencyType = (_b = this.receipt.currency) !== null && _b !== void 0 ? _b : 'CURR not found';
9
+ if (value) {
10
+ return `${currencyType} ${this.currencySymbol}${value}`;
11
+ }
12
+ return "no amount found, can't find total_amount or net_amount";
13
+ }
14
+ get amount() {
15
+ var _a, _b;
16
+ return ((_b = (_a = `${this.receipt.total_amount}`) !== null && _a !== void 0 ? _a : `${this.receipt.net_amount}`) !== null && _b !== void 0 ? _b : "no amount found, can't find total_amount or net_amount");
17
+ }
18
+ get isTest() {
19
+ var _a;
20
+ return (_a = this.receipt.isTest) !== null && _a !== void 0 ? _a : false;
21
+ }
22
+ get id() {
23
+ var _a;
24
+ return (_a = this.receipt.token) !== null && _a !== void 0 ? _a : 'no token found';
25
+ }
26
+ get date() {
27
+ var _a;
28
+ return (_a = this.receipt.date) !== null && _a !== void 0 ? _a : 'no date found';
29
+ }
30
+ get currencySymbol() {
31
+ if (this.receipt.currency === 'USD') {
32
+ return '$';
33
+ }
34
+ return '';
35
+ }
36
+ }
37
+ //# sourceMappingURL=receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../../src/models/receipt.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,OAAO;IAGlB,YAAY,OAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,eAAe;;QACjB,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,YAAY,mCAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACnE,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,mCAAI,gBAAgB,CAAC;QAC/D,IAAI,KAAK,EAAE;YACT,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC,cAAc,GAAG,KAAK,EAAE,CAAC;SACzD;QACD,OAAO,wDAAwD,CAAC;IAClE,CAAC;IAED,IAAI,MAAM;;QACR,OAAO,CACL,MAAA,MAAA,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,mCAC9B,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,mCAC5B,wDAAwD,CACzD,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;;QACR,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;IACtC,CAAC;IAED,IAAI,EAAE;;QACJ,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,KAAK,mCAAI,gBAAgB,CAAC;IAChD,CAAC;IAED,IAAI,IAAI;;QACN,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,mCAAI,eAAe,CAAC;IAC9C,CAAC;IAED,IAAI,cAAc;QAChB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE;YACnC,OAAO,GAAG,CAAC;SACZ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["type AReceipt = {\n currency: string;\n net_amount: number;\n total_amount: number;\n receive_date?: Date;\n date: string;\n isTest: boolean;\n token: string;\n};\nexport class Receipt {\n receipt: AReceipt;\n\n constructor(receipt: AReceipt) {\n this.receipt = receipt;\n }\n\n get amountFormatted(): string {\n const value = this.receipt.total_amount ?? this.receipt.net_amount;\n const currencyType = this.receipt.currency ?? 'CURR not found';\n if (value) {\n return `${currencyType} ${this.currencySymbol}${value}`;\n }\n return \"no amount found, can't find total_amount or net_amount\";\n }\n\n get amount(): string {\n return (\n `${this.receipt.total_amount}` ??\n `${this.receipt.net_amount}` ??\n \"no amount found, can't find total_amount or net_amount\"\n );\n }\n\n get isTest(): boolean {\n return this.receipt.isTest ?? false;\n }\n\n get id(): string {\n return this.receipt.token ?? 'no token found';\n }\n\n get date(): string {\n return this.receipt.date ?? 'no date found';\n }\n\n get currencySymbol(): string {\n if (this.receipt.currency === 'USD') {\n return '$';\n }\n\n return '';\n }\n}\n"]}
@@ -1,8 +1,26 @@
1
- import { LitElement } from 'lit';
1
+ import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  import './welcome-message';
3
+ import './plans';
3
4
  import './presentational/mgc-title';
5
+ import './receipts';
6
+ import type { IauxMgcReceipts } from './receipts';
7
+ import './presentational/ia-button';
8
+ export declare type AnUpdate = {
9
+ message: string;
10
+ status: 'success' | 'fail';
11
+ donationId: string;
12
+ };
4
13
  export declare class MonthlyGivingCircle extends LitElement {
5
14
  patronName: string;
15
+ receipts: never[];
16
+ updates: AnUpdate[];
17
+ plans: never[];
18
+ viewToDisplay: 'welcome' | 'receipts' | 'plans';
6
19
  protected createRenderRoot(): this;
7
- protected render(): import("lit").TemplateResult<1>;
20
+ updated(changed: PropertyValues): void;
21
+ get receiptListElement(): IauxMgcReceipts;
22
+ updateReceived(update: AnUpdate): void;
23
+ get showReceiptsCTA(): TemplateResult;
24
+ get headerSection(): TemplateResult;
25
+ protected render(): TemplateResult<1>;
8
26
  }
@@ -1,29 +1,137 @@
1
1
  /* eslint-disable no-debugger */
2
2
  import { __decorate } from "tslib";
3
- import { LitElement, html } from 'lit';
3
+ import { LitElement, html, nothing } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
5
  import './welcome-message';
6
+ import './plans';
6
7
  import './presentational/mgc-title';
8
+ import './receipts';
9
+ import './presentational/ia-button';
7
10
  let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
8
11
  constructor() {
9
12
  super(...arguments);
10
13
  this.patronName = '';
14
+ this.receipts = [];
15
+ this.updates = [];
16
+ this.plans = [];
17
+ this.viewToDisplay = 'welcome';
11
18
  }
12
19
  createRenderRoot() {
13
20
  return this;
14
21
  }
22
+ updated(changed) {
23
+ if (changed.has('plans')) {
24
+ this.viewToDisplay = this.plans.length ? 'plans' : 'welcome';
25
+ }
26
+ }
27
+ get receiptListElement() {
28
+ return this.querySelector('ia-mgc-receipts');
29
+ }
30
+ updateReceived(update) {
31
+ this.receiptListElement.emailSent({
32
+ id: update.donationId,
33
+ emailStatus: update.status,
34
+ });
35
+ this.updates.unshift(update);
36
+ }
37
+ get showReceiptsCTA() {
38
+ return html `
39
+ <ia-button
40
+ class="link slim"
41
+ .clickHandler=${() => {
42
+ this.viewToDisplay = 'receipts';
43
+ this.dispatchEvent(new CustomEvent('ShowReceipts'));
44
+ }}
45
+ >
46
+ View recent donation history
47
+ </ia-button>
48
+ `;
49
+ }
50
+ get headerSection() {
51
+ if (this.viewToDisplay === 'receipts') {
52
+ return html `
53
+ <ia-mgc-title titleStyle="default">
54
+ <span slot="title">Recent donations</span>
55
+ <span slot="action">
56
+ <ia-button
57
+ class="link slim"
58
+ id="close-receipts"
59
+ .clickHandler=${async () => {
60
+ this.viewToDisplay = 'welcome';
61
+ this.dispatchEvent(new CustomEvent('ShowWelcome'));
62
+ this.updates = [];
63
+ await this.updateComplete;
64
+ }}
65
+ >
66
+ Back to account settings
67
+ </ia-button>
68
+ </span>
69
+ </ia-mgc-title>
70
+ `;
71
+ }
72
+ if (this.plans.length) {
73
+ return html `
74
+ <ia-mgc-title titleStyle="heart">
75
+ <span slot="title">Monthly Giving Circle</span>
76
+ <span slot="action"
77
+ >${this.receipts.length ? this.showReceiptsCTA : nothing}</span
78
+ >
79
+ </ia-mgc-title>
80
+ `;
81
+ }
82
+ return html `
83
+ <ia-mgc-title titleStyle="heart">
84
+ <span slot="title">Monthly Giving Circle</span>
85
+ <span slot="action"
86
+ >${this.receipts.length ? this.showReceiptsCTA : nothing}</span
87
+ >
88
+ </ia-mgc-title>
89
+ `;
90
+ }
15
91
  render() {
16
92
  return html `
17
- <iaux-mgc-title titleStyle="heart"></iaux-mgc-title>
18
- <iaux-mgc-welcome .patronName=${this.patronName}></iaux-mgc-welcome>
93
+ ${this.headerSection}
94
+ ${this.viewToDisplay === 'receipts'
95
+ ? html `
96
+ <ia-mgc-receipts
97
+ .receipts=${this.receipts}
98
+ @EmailReceiptRequest=${(event) => {
99
+ console.log('EmailReceiptRequest', event.detail);
100
+ this.dispatchEvent(new CustomEvent('EmailReceiptRequest', {
101
+ detail: { ...event.detail },
102
+ }));
103
+ }}
104
+ ></ia-mgc-receipts>
105
+ `
106
+ : nothing}
107
+ ${this.viewToDisplay === 'plans'
108
+ ? html ` <ia-mgc-plans .plans=${this.plans}></ia-mgc-plans> `
109
+ : nothing}
110
+ ${this.viewToDisplay === 'welcome'
111
+ ? html `
112
+ <ia-mgc-welcome .patronName=${this.patronName}></ia-mgc-welcome>
113
+ `
114
+ : nothing}
19
115
  `;
20
116
  }
21
117
  };
22
118
  __decorate([
23
119
  property({ type: String })
24
120
  ], MonthlyGivingCircle.prototype, "patronName", void 0);
121
+ __decorate([
122
+ property({ type: Array })
123
+ ], MonthlyGivingCircle.prototype, "receipts", void 0);
124
+ __decorate([
125
+ property({ type: Array })
126
+ ], MonthlyGivingCircle.prototype, "updates", void 0);
127
+ __decorate([
128
+ property({ type: Array })
129
+ ], MonthlyGivingCircle.prototype, "plans", void 0);
130
+ __decorate([
131
+ property({ type: String, reflect: true })
132
+ ], MonthlyGivingCircle.prototype, "viewToDisplay", void 0);
25
133
  MonthlyGivingCircle = __decorate([
26
- customElement('iaux-monthly-giving-circle')
134
+ customElement('ia-monthly-giving-circle')
27
135
  ], MonthlyGivingCircle);
28
136
  export { MonthlyGivingCircle };
29
137
  //# sourceMappingURL=monthly-giving-circle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"monthly-giving-circle.js","sourceRoot":"","sources":["../../src/monthly-giving-circle.ts"],"names":[],"mappings":"AAAA,gCAAgC;;AAEhC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,mBAAmB,CAAC;AAC3B,OAAO,4BAA4B,CAAC;AAGpC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QAC8B,eAAU,GAAW,EAAE,CAAC;IAYtD,CAAC;IAVW,gBAAgB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,MAAM;QACd,OAAO,IAAI,CAAA;;sCAEuB,IAAI,CAAC,UAAU;KAChD,CAAC;IACJ,CAAC;CACF,CAAA;AAZ6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAyB;AADzC,mBAAmB;IAD/B,aAAa,CAAC,4BAA4B,CAAC;GAC/B,mBAAmB,CAa/B;SAbY,mBAAmB","sourcesContent":["/* eslint-disable no-debugger */\n\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport './welcome-message';\nimport './presentational/mgc-title';\n\n@customElement('iaux-monthly-giving-circle')\nexport class MonthlyGivingCircle extends LitElement {\n @property({ type: String }) patronName: string = '';\n\n protected createRenderRoot() {\n return this;\n }\n\n protected render() {\n return html`\n <iaux-mgc-title titleStyle=\"heart\"></iaux-mgc-title>\n <iaux-mgc-welcome .patronName=${this.patronName}></iaux-mgc-welcome>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"monthly-giving-circle.js","sourceRoot":"","sources":["../../src/monthly-giving-circle.ts"],"names":[],"mappings":"AAAA,gCAAgC;;AAEhC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,mBAAmB,CAAC;AAC3B,OAAO,SAAS,CAAC;AACjB,OAAO,4BAA4B,CAAC;AACpC,OAAO,YAAY,CAAC;AAEpB,OAAO,4BAA4B,CAAC;AASpC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QAC8B,eAAU,GAAW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;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAAe;AAEd;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAA0B;AAEzB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAAY;AAEK;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0DAGlB;AAZb,mBAAmB;IAD/B,aAAa,CAAC,0BAA0B,CAAC;GAC7B,mBAAmB,CA0H/B;SA1HY,mBAAmB","sourcesContent":["/* eslint-disable no-debugger */\n\nimport { LitElement, html, TemplateResult, nothing, PropertyValues } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport './welcome-message';\nimport './plans';\nimport './presentational/mgc-title';\nimport './receipts';\nimport type { IauxMgcReceipts } from './receipts';\nimport './presentational/ia-button';\n\nexport type AnUpdate = {\n message: string;\n status: 'success' | 'fail';\n donationId: string;\n};\n\n@customElement('ia-monthly-giving-circle')\nexport class MonthlyGivingCircle extends LitElement {\n @property({ type: String }) patronName: string = '';\n\n @property({ type: Array }) receipts = [];\n\n @property({ type: Array }) updates: AnUpdate[] = [];\n\n @property({ type: Array }) plans = [];\n\n @property({ type: String, reflect: true }) viewToDisplay:\n | 'welcome'\n | 'receipts'\n | 'plans' = 'welcome';\n\n protected createRenderRoot() {\n return this;\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('plans')) {\n this.viewToDisplay = this.plans.length ? 'plans' : 'welcome';\n }\n }\n\n get receiptListElement(): IauxMgcReceipts {\n return this.querySelector('ia-mgc-receipts') as IauxMgcReceipts;\n }\n\n updateReceived(update: AnUpdate) {\n this.receiptListElement.emailSent({\n id: update.donationId,\n emailStatus: update.status,\n });\n this.updates.unshift(update);\n }\n\n get showReceiptsCTA(): TemplateResult {\n return html`\n <ia-button\n class=\"link slim\"\n .clickHandler=${() => {\n this.viewToDisplay = 'receipts';\n this.dispatchEvent(new CustomEvent('ShowReceipts'));\n }}\n >\n View recent donation history\n </ia-button>\n `;\n }\n\n get headerSection(): TemplateResult {\n if (this.viewToDisplay === 'receipts') {\n return html`\n <ia-mgc-title titleStyle=\"default\">\n <span slot=\"title\">Recent donations</span>\n <span slot=\"action\">\n <ia-button\n class=\"link slim\"\n id=\"close-receipts\"\n .clickHandler=${async () => {\n this.viewToDisplay = 'welcome';\n this.dispatchEvent(new CustomEvent('ShowWelcome'));\n this.updates = [];\n await this.updateComplete;\n }}\n >\n Back to account settings\n </ia-button>\n </span>\n </ia-mgc-title>\n `;\n }\n\n if (this.plans.length) {\n return html`\n <ia-mgc-title titleStyle=\"heart\">\n <span slot=\"title\">Monthly Giving Circle</span>\n <span slot=\"action\"\n >${this.receipts.length ? this.showReceiptsCTA : nothing}</span\n >\n </ia-mgc-title>\n `;\n }\n\n return html`\n <ia-mgc-title titleStyle=\"heart\">\n <span slot=\"title\">Monthly Giving Circle</span>\n <span slot=\"action\"\n >${this.receipts.length ? this.showReceiptsCTA : nothing}</span\n >\n </ia-mgc-title>\n `;\n }\n\n protected render() {\n return html`\n ${this.headerSection}\n ${this.viewToDisplay === 'receipts'\n ? html`\n <ia-mgc-receipts\n .receipts=${this.receipts}\n @EmailReceiptRequest=${(event: CustomEvent) => {\n console.log('EmailReceiptRequest', event.detail);\n this.dispatchEvent(\n new CustomEvent('EmailReceiptRequest', {\n detail: { ...event.detail },\n })\n );\n }}\n ></ia-mgc-receipts>\n `\n : nothing}\n ${this.viewToDisplay === 'plans'\n ? html` <ia-mgc-plans .plans=${this.plans}></ia-mgc-plans> `\n : nothing}\n ${this.viewToDisplay === 'welcome'\n ? html`\n <ia-mgc-welcome .patronName=${this.patronName}></ia-mgc-welcome>\n `\n : nothing}\n `;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { LitElement } from 'lit';
2
+ import './presentational/ia-button';
3
+ export declare class IauxMgcPlans extends LitElement {
4
+ plans: never[];
5
+ protected render(): import("lit").TemplateResult<1>;
6
+ static styles: import("lit").CSSResult;
7
+ }
@@ -0,0 +1,171 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css, nothing } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import './presentational/ia-button';
5
+ let IauxMgcPlans = class IauxMgcPlans extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.plans = [];
9
+ }
10
+ render() {
11
+ return html `
12
+ <section class="monthly-giving-circle">
13
+ <ul>
14
+ ${this.plans.map((plan) => {
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
16
+ const methodType = (_b = (_a = plan.payment) === null || _a === void 0 ? void 0 : _a.paymentMethodType) !== null && _b !== void 0 ? _b : 'Method not found';
17
+ const cardType = (_d = (_c = plan.payment) === null || _c === void 0 ? void 0 : _c.cardType) !== null && _d !== void 0 ? _d : 'Card type not found';
18
+ const last4 = ((_e = plan.payment) === null || _e === void 0 ? void 0 : _e.last4)
19
+ ? `...${(_f = plan.payment) === null || _f === void 0 ? void 0 : _f.last4}`
20
+ : 'CC number not found';
21
+ return html `
22
+ <li>
23
+ <div class="info">
24
+ <div class="amount">
25
+ <h3>Amount</h3>
26
+ <p>
27
+ ${plan.currency}
28
+ ${plan.currencySymbol}${plan.amount}/month
29
+ </p>
30
+ ${plan.isTest
31
+ ? html `<p class="is-test">(Test payment)</p>`
32
+ : nothing}
33
+ </div>
34
+ <div class="payment-details">
35
+ <h3>Method</h3>
36
+ <p>${methodType}</p>
37
+ ${((_g = plan.payment) === null || _g === void 0 ? void 0 : _g.cardType) === 'creditCard'
38
+ ? html `<p>${cardType}</p>
39
+ <p>${last4}</p>`
40
+ : nothing}
41
+ ${((_h = plan.payment) === null || _h === void 0 ? void 0 : _h.paymentMethodType) === 'Paypal'
42
+ ? html `<p>
43
+ Paypal email:
44
+ <a href=${`mailto:${(_j = plan.payment) === null || _j === void 0 ? void 0 : _j.paypalEmail}`}
45
+ >${(_k = plan.payment) === null || _k === void 0 ? void 0 : _k.paypalEmail}</a
46
+ >
47
+ </p>`
48
+ : nothing}
49
+ ${((_l = plan.payment) === null || _l === void 0 ? void 0 : _l.paymentMethodType) === 'Venmo'
50
+ ? html `<p>
51
+ Venmo username:
52
+ <a href=${`mailto:${(_m = plan.payment) === null || _m === void 0 ? void 0 : _m.venmoUsername}`}
53
+ >${(_o = plan.payment) === null || _o === void 0 ? void 0 : _o.paypalEmail}</a
54
+ >
55
+ </p>`
56
+ : nothing}
57
+ ${((_p = plan.payment) === null || _p === void 0 ? void 0 : _p.cardType) !== 'creditCard'
58
+ ? html `<p>
59
+ Expires:
60
+ ${(_r = (_q = plan.payment) === null || _q === void 0 ? void 0 : _q.expirationMonth) !== null && _r !== void 0 ? _r : 'month not found'}/${(_t = (_s = plan.payment) === null || _s === void 0 ? void 0 : _s.expirationYear) !== null && _t !== void 0 ? _t : 'year not found'}
61
+ </p>`
62
+ : nothing}
63
+ </div>
64
+ <div class="next-donation">
65
+ <h3>Next Donation</h3>
66
+ <p>${plan.nextBillingDate}</p>
67
+ </div>
68
+ </div>
69
+ <ia-button
70
+ class="ia-button link edit-donation"
71
+ isdisabled
72
+ .clickHandler=${() => console.log(plan)}
73
+ >
74
+ Manage this monthly donation
75
+ </ia-button>
76
+ </li>
77
+ `;
78
+ })}
79
+ </ul>
80
+ </section>
81
+ `;
82
+ }
83
+ };
84
+ IauxMgcPlans.styles = css `
85
+ :host {
86
+ max-height: 500px;
87
+ overflow-y: scroll;
88
+ display: block;
89
+ }
90
+
91
+ .is-test {
92
+ font-size: 0.8rem;
93
+ }
94
+
95
+ li {
96
+ border: 1px solid #23765d;
97
+ background-color: #eeffee;
98
+ display: block;
99
+ width: inherit;
100
+ }
101
+ table {
102
+ width: 100%;
103
+ text-align: left;
104
+ max-width: 600px;
105
+ }
106
+
107
+ ul {
108
+ padding: 0;
109
+ list-style-type: none;
110
+ margin: 0;
111
+ }
112
+
113
+ ul li {
114
+ border: 1px solid #23765d;
115
+ background-color: #eeffee;
116
+ margin: 0.5rem 0;
117
+ padding: 0.5rem 0.5rem 1rem 0.5rem;
118
+ position: relative;
119
+ }
120
+
121
+ ul li button.edit-donation {
122
+ height: 30px;
123
+ display: block;
124
+ position: absolute;
125
+ bottom: 0;
126
+ }
127
+
128
+ ul li .info {
129
+ display: grid;
130
+ min-height: 90px;
131
+ grid-template-columns: 0.5fr 1fr 0.5fr;
132
+ grid-template-rows: 1fr;
133
+ gap: 0px 5px;
134
+ grid-auto-flow: row;
135
+ grid-template-areas: 'amount details next-donation';
136
+ }
137
+
138
+ ul li .info .amount {
139
+ grid-area: amount;
140
+ }
141
+
142
+ ul li .info .payment-details {
143
+ grid-area: details;
144
+ }
145
+
146
+ ul li .info .next-donation {
147
+ grid-area: next-donation;
148
+ }
149
+
150
+ ul li .info > * {
151
+ margin: 0 0 0.5rem 0;
152
+ }
153
+
154
+ ul li .info > * > * {
155
+ margin: 0;
156
+ }
157
+
158
+ @media screen and (max-width: 500px) {
159
+ ul li .info {
160
+ display: block;
161
+ }
162
+ }
163
+ `;
164
+ __decorate([
165
+ property({ type: Array })
166
+ ], IauxMgcPlans.prototype, "plans", void 0);
167
+ IauxMgcPlans = __decorate([
168
+ customElement('ia-mgc-plans')
169
+ ], IauxMgcPlans);
170
+ export { IauxMgcPlans };
171
+ //# sourceMappingURL=plans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/plans.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI5D,OAAO,4BAA4B,CAAC;AAGpC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,UAAU;IAA5C;;QAC6B,UAAK,GAAG,EAAE,CAAC;IA+JxC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,MAAA,IAAI,CAAC,OAAO,0CAAE,WAAW;;6BAE3B;gBACP,CAAC,CAAC,OAAO;sBACT,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,MAAK,YAAY;gBACvC,CAAC,CAAC,IAAI,CAAA;;4BAEA,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,eAAe,mCAC/B,iBAAiB,IAAI,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,cAAc,mCACjD,gBAAgB;6BACb;gBACP,CAAC,CAAC,OAAO;;;;yBAIN,IAAI,CAAC,eAAe;;;;;;kCAMX,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;;;;;aAK5C,CAAC;QACJ,CAAC,CAAC;;;KAGP,CAAC;IACJ,CAAC;CAkFF,CAAA;AAhFQ,mBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+ElB,CAAC;AA9JyB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAY;AAD3B,YAAY;IADxB,aAAa,CAAC,cAAc,CAAC;GACjB,YAAY,CAgKxB;SAhKY,YAAY","sourcesContent":["import { LitElement, html, css, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport type { MonthlyPlan } from './models/plan';\n\nimport './presentational/ia-button';\n\n@customElement('ia-mgc-plans')\nexport class IauxMgcPlans extends LitElement {\n @property({ type: Array }) plans = [];\n\n protected render() {\n return html`\n <section class=\"monthly-giving-circle\">\n <ul>\n ${this.plans.map((plan: MonthlyPlan) => {\n const methodType =\n plan.payment?.paymentMethodType ?? 'Method not found';\n const cardType = plan.payment?.cardType ?? 'Card type not found';\n const last4 = plan.payment?.last4\n ? `...${plan.payment?.last4}`\n : 'CC number not found';\n\n return html`\n <li>\n <div class=\"info\">\n <div class=\"amount\">\n <h3>Amount</h3>\n <p>\n ${plan.currency}\n ${plan.currencySymbol}${plan.amount}/month\n </p>\n ${plan.isTest\n ? html`<p class=\"is-test\">(Test payment)</p>`\n : nothing}\n </div>\n <div class=\"payment-details\">\n <h3>Method</h3>\n <p>${methodType}</p>\n ${plan.payment?.cardType === 'creditCard'\n ? html`<p>${cardType}</p>\n <p>${last4}</p>`\n : nothing}\n ${plan.payment?.paymentMethodType === 'Paypal'\n ? html`<p>\n Paypal email:\n <a href=${`mailto:${plan.payment?.paypalEmail}`}\n >${plan.payment?.paypalEmail}</a\n >\n </p>`\n : nothing}\n ${plan.payment?.paymentMethodType === 'Venmo'\n ? html`<p>\n Venmo username:\n <a href=${`mailto:${plan.payment?.venmoUsername}`}\n >${plan.payment?.paypalEmail}</a\n >\n </p>`\n : nothing}\n ${plan.payment?.cardType !== 'creditCard'\n ? html`<p>\n Expires:\n ${plan.payment?.expirationMonth ??\n 'month not found'}/${plan.payment?.expirationYear ??\n 'year not found'}\n </p>`\n : nothing}\n </div>\n <div class=\"next-donation\">\n <h3>Next Donation</h3>\n <p>${plan.nextBillingDate}</p>\n </div>\n </div>\n <ia-button\n class=\"ia-button link edit-donation\"\n isdisabled\n .clickHandler=${() => console.log(plan)}\n >\n Manage this monthly donation\n </ia-button>\n </li>\n `;\n })}\n </ul>\n </section>\n `;\n }\n\n static styles = css`\n :host {\n max-height: 500px;\n overflow-y: scroll;\n display: block;\n }\n\n .is-test {\n font-size: 0.8rem;\n }\n\n li {\n border: 1px solid #23765d;\n background-color: #eeffee;\n display: block;\n width: inherit;\n }\n table {\n width: 100%;\n text-align: left;\n max-width: 600px;\n }\n\n ul {\n padding: 0;\n list-style-type: none;\n margin: 0;\n }\n\n ul li {\n border: 1px solid #23765d;\n background-color: #eeffee;\n margin: 0.5rem 0;\n padding: 0.5rem 0.5rem 1rem 0.5rem;\n position: relative;\n }\n\n ul li button.edit-donation {\n height: 30px;\n display: block;\n position: absolute;\n bottom: 0;\n }\n\n ul li .info {\n display: grid;\n min-height: 90px;\n grid-template-columns: 0.5fr 1fr 0.5fr;\n grid-template-rows: 1fr;\n gap: 0px 5px;\n grid-auto-flow: row;\n grid-template-areas: 'amount details next-donation';\n }\n\n ul li .info .amount {\n grid-area: amount;\n }\n\n ul li .info .payment-details {\n grid-area: details;\n }\n\n ul li .info .next-donation {\n grid-area: next-donation;\n }\n\n ul li .info > * {\n margin: 0 0 0.5rem 0;\n }\n\n ul li .info > * > * {\n margin: 0;\n }\n\n @media screen and (max-width: 500px) {\n ul li .info {\n display: block;\n }\n }\n `;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { LitElement } from 'lit';
2
+ import '@internetarchive/icon-donate/icon-donate.js';
3
+ export declare class IauxButton extends LitElement {
4
+ isDisabled: boolean;
5
+ clickHandler?: (self: IauxButton) => void;
6
+ button: HTMLButtonElement;
7
+ render(): import("lit").TemplateResult<1>;
8
+ static styles: import("lit").CSSResult;
9
+ }