@internetarchive/donation-monthly-portal 2.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 (35) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +1 -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/monthly-giving-circle.d.ts +10 -6
  8. package/dist/src/monthly-giving-circle.js +59 -24
  9. package/dist/src/monthly-giving-circle.js.map +1 -1
  10. package/dist/src/plans.d.ts +7 -0
  11. package/dist/src/plans.js +171 -0
  12. package/dist/src/plans.js.map +1 -0
  13. package/dist/src/presentational/{iaux-button.js → ia-button.js} +2 -2
  14. package/dist/src/presentational/ia-button.js.map +1 -0
  15. package/dist/src/presentational/mgc-title.js +8 -1
  16. package/dist/src/presentational/mgc-title.js.map +1 -1
  17. package/dist/src/receipts.d.ts +1 -1
  18. package/dist/src/receipts.js +6 -6
  19. package/dist/src/receipts.js.map +1 -1
  20. package/dist/src/welcome-message.js +1 -1
  21. package/dist/src/welcome-message.js.map +1 -1
  22. package/dist/test/monthly-giving-circle.test.js +51 -17
  23. package/dist/test/monthly-giving-circle.test.js.map +1 -1
  24. package/dist/test/receipt-email-request-flow.test.js +7 -7
  25. package/dist/test/receipt-email-request-flow.test.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/models/plan.ts +103 -0
  28. package/src/monthly-giving-circle.ts +68 -31
  29. package/src/plans.ts +169 -0
  30. package/src/presentational/{iaux-button.ts → ia-button.ts} +1 -1
  31. package/src/presentational/mgc-title.ts +8 -1
  32. package/src/receipts.ts +7 -7
  33. package/src/welcome-message.ts +1 -1
  34. package/dist/src/presentational/iaux-button.js.map +0 -1
  35. /package/dist/src/presentational/{iaux-button.d.ts → ia-button.d.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { MonthlyGivingCircle } from './src/monthly-giving-circle';
2
- export type { anUpdate } from './src/monthly-giving-circle';
2
+ export type { AnUpdate } from './src/monthly-giving-circle';
3
3
  export { Receipt } from './src/models/receipt';
4
+ export { MonthlyPlan } from './src/models/plan';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { MonthlyGivingCircle } from './src/monthly-giving-circle';
2
2
  export { Receipt } from './src/models/receipt';
3
+ export { MonthlyPlan } from './src/models/plan';
3
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;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { MonthlyGivingCircle } from './src/monthly-giving-circle';\nexport type { anUpdate } from './src/monthly-giving-circle';\nexport { Receipt } from './src/models/receipt';\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"]}
@@ -1,10 +1,11 @@
1
- import { LitElement, TemplateResult } from 'lit';
1
+ import { LitElement, TemplateResult, PropertyValues } from 'lit';
2
2
  import './welcome-message';
3
+ import './plans';
3
4
  import './presentational/mgc-title';
4
5
  import './receipts';
5
6
  import type { IauxMgcReceipts } from './receipts';
6
- import './presentational/iaux-button';
7
- export declare type anUpdate = {
7
+ import './presentational/ia-button';
8
+ export declare type AnUpdate = {
8
9
  message: string;
9
10
  status: 'success' | 'fail';
10
11
  donationId: string;
@@ -12,11 +13,14 @@ export declare type anUpdate = {
12
13
  export declare class MonthlyGivingCircle extends LitElement {
13
14
  patronName: string;
14
15
  receipts: never[];
15
- updates: anUpdate[];
16
- viewToDisplay: 'welcome' | 'receipts';
16
+ updates: AnUpdate[];
17
+ plans: never[];
18
+ viewToDisplay: 'welcome' | 'receipts' | 'plans';
17
19
  protected createRenderRoot(): this;
20
+ updated(changed: PropertyValues): void;
18
21
  get receiptListElement(): IauxMgcReceipts;
19
- updateReceived(update: anUpdate): void;
22
+ updateReceived(update: AnUpdate): void;
20
23
  get showReceiptsCTA(): TemplateResult;
24
+ get headerSection(): TemplateResult;
21
25
  protected render(): TemplateResult<1>;
22
26
  }
@@ -3,22 +3,29 @@ import { __decorate } from "tslib";
3
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';
7
8
  import './receipts';
8
- import './presentational/iaux-button';
9
+ import './presentational/ia-button';
9
10
  let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
10
11
  constructor() {
11
12
  super(...arguments);
12
13
  this.patronName = '';
13
14
  this.receipts = [];
14
15
  this.updates = [];
16
+ this.plans = [];
15
17
  this.viewToDisplay = 'welcome';
16
18
  }
17
19
  createRenderRoot() {
18
20
  return this;
19
21
  }
22
+ updated(changed) {
23
+ if (changed.has('plans')) {
24
+ this.viewToDisplay = this.plans.length ? 'plans' : 'welcome';
25
+ }
26
+ }
20
27
  get receiptListElement() {
21
- return this.querySelector('iaux-mgc-receipts');
28
+ return this.querySelector('ia-mgc-receipts');
22
29
  }
23
30
  updateReceived(update) {
24
31
  this.receiptListElement.emailSent({
@@ -29,25 +36,24 @@ let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
29
36
  }
30
37
  get showReceiptsCTA() {
31
38
  return html `
32
- <iaux-button
33
- class="link"
34
- style="--button-padding: 0;"
39
+ <ia-button
40
+ class="link slim"
35
41
  .clickHandler=${() => {
36
42
  this.viewToDisplay = 'receipts';
37
43
  this.dispatchEvent(new CustomEvent('ShowReceipts'));
38
44
  }}
39
45
  >
40
46
  View recent donation history
41
- </iaux-button>
47
+ </ia-button>
42
48
  `;
43
49
  }
44
- render() {
50
+ get headerSection() {
45
51
  if (this.viewToDisplay === 'receipts') {
46
52
  return html `
47
- <iaux-mgc-title titleStyle="default">
53
+ <ia-mgc-title titleStyle="default">
48
54
  <span slot="title">Recent donations</span>
49
55
  <span slot="action">
50
- <iaux-button
56
+ <ia-button
51
57
  class="link slim"
52
58
  id="close-receipts"
53
59
  .clickHandler=${async () => {
@@ -58,28 +64,54 @@ let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
58
64
  }}
59
65
  >
60
66
  Back to account settings
61
- </iaux-button>
67
+ </ia-button>
62
68
  </span>
63
- </iaux-mgc-title>
64
- <iaux-mgc-receipts
65
- .receipts=${this.receipts}
66
- @EmailReceiptRequest=${(event) => {
67
- console.log('EmailReceiptRequest', event.detail);
68
- this.dispatchEvent(new CustomEvent('EmailReceiptRequest', {
69
- detail: { ...event.detail },
70
- }));
71
- }}
72
- ></iaux-mgc-receipts>
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>
73
80
  `;
74
81
  }
75
82
  return html `
76
- <iaux-mgc-title titleStyle="heart">
83
+ <ia-mgc-title titleStyle="heart">
77
84
  <span slot="title">Monthly Giving Circle</span>
78
85
  <span slot="action"
79
86
  >${this.receipts.length ? this.showReceiptsCTA : nothing}</span
80
87
  >
81
- </iaux-mgc-title>
82
- <iaux-mgc-welcome .patronName=${this.patronName}></iaux-mgc-welcome>
88
+ </ia-mgc-title>
89
+ `;
90
+ }
91
+ render() {
92
+ return html `
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}
83
115
  `;
84
116
  }
85
117
  };
@@ -92,11 +124,14 @@ __decorate([
92
124
  __decorate([
93
125
  property({ type: Array })
94
126
  ], MonthlyGivingCircle.prototype, "updates", void 0);
127
+ __decorate([
128
+ property({ type: Array })
129
+ ], MonthlyGivingCircle.prototype, "plans", void 0);
95
130
  __decorate([
96
131
  property({ type: String, reflect: true })
97
132
  ], MonthlyGivingCircle.prototype, "viewToDisplay", void 0);
98
133
  MonthlyGivingCircle = __decorate([
99
- customElement('iaux-monthly-giving-circle')
134
+ customElement('ia-monthly-giving-circle')
100
135
  ], MonthlyGivingCircle);
101
136
  export { MonthlyGivingCircle };
102
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,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,mBAAmB,CAAC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Q;iCACF,CAAC,KAAkB,EAAE,EAAE;gBAC5C,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACjD,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,qBAAqB,EAAE;oBACrC,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE;iBAC5B,CAAC,CACH,CAAC;YACJ,CAAC;;OAEJ,CAAC;SACH;QAED,OAAO,IAAI,CAAA;;;;aAIF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO;;;sCAG5B,IAAI,CAAC,UAAU;KAChD,CAAC;IACJ,CAAC;CACF,CAAA;AArF6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAyB;AAEzB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAAe;AAEd;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAA0B;AAET;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0DAEf;AAThB,mBAAmB;IAD/B,aAAa,CAAC,4BAA4B,CAAC;GAC/B,mBAAmB,CAsF/B;SAtFY,mBAAmB","sourcesContent":["/* eslint-disable no-debugger */\n\nimport { LitElement, html, TemplateResult, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport './welcome-message';\nimport './presentational/mgc-title';\nimport './receipts';\nimport type { IauxMgcReceipts } from './receipts';\nimport './presentational/iaux-button';\n\nexport type anUpdate = {\n message: string;\n status: 'success' | 'fail';\n donationId: string;\n};\n\n@customElement('iaux-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: String, reflect: true }) viewToDisplay:\n | 'welcome'\n | 'receipts' = 'welcome';\n\n protected createRenderRoot() {\n return this;\n }\n\n get receiptListElement(): IauxMgcReceipts {\n return this.querySelector('iaux-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 <iaux-button\n class=\"link\"\n style=\"--button-padding: 0;\"\n .clickHandler=${() => {\n this.viewToDisplay = 'receipts';\n this.dispatchEvent(new CustomEvent('ShowReceipts'));\n }}\n >\n View recent donation history\n </iaux-button>\n `;\n }\n\n protected render() {\n if (this.viewToDisplay === 'receipts') {\n return html`\n <iaux-mgc-title titleStyle=\"default\">\n <span slot=\"title\">Recent donations</span>\n <span slot=\"action\">\n <iaux-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 </iaux-button>\n </span>\n </iaux-mgc-title>\n <iaux-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 ></iaux-mgc-receipts>\n `;\n }\n\n return html`\n <iaux-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 </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;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I,CAAC,aAAa,KAAK,OAAO;YAC9B,CAAC,CAAC,IAAI,CAAA,yBAAyB,IAAI,CAAC,KAAK,mBAAmB;YAC5D,CAAC,CAAC,OAAO;QACT,IAAI,CAAC,aAAa,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,CAAA;0CAC4B,IAAI,CAAC,UAAU;WAC9C;YACH,CAAC,CAAC,OAAO;KACZ,CAAC;IACJ,CAAC;CACF,CAAA;AAzH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAyB;AAEzB;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
@@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BAAiB,MAAK,QAAQ;gBAC5C,CAAC,CAAC,IAAI,CAAA;;oCAEQ,UAAU,MAAA,IAAI,CAAC,OAAO,0CAAE,WAAW,EAAE;+BAC1C,MAAA,IAAI,CAAC,OAAO,0CAAE,WAAW;;6BAE3B;gBACP,CAAC,CAAC,OAAO;sBACT,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,iBAAiB,MAAK,OAAO;gBAC3C,CAAC,CAAC,IAAI,CAAA;;oCAEQ,UAAU,MAAA,IAAI,CAAC,OAAO,0CAAE,aAAa,EAAE;+BAC5C,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"]}
@@ -95,7 +95,7 @@ __decorate([
95
95
  query('button')
96
96
  ], IauxButton.prototype, "button", void 0);
97
97
  IauxButton = __decorate([
98
- customElement('iaux-button')
98
+ customElement('ia-button')
99
99
  ], IauxButton);
100
100
  export { IauxButton };
101
- //# sourceMappingURL=iaux-button.js.map
101
+ //# sourceMappingURL=ia-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-button.js","sourceRoot":"","sources":["../../../src/presentational/ia-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,6CAA6C,CAAC;AAGrD,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,UAAU;IAA1C;;QAC8C,eAAU,GAAG,KAAK,CAAC;IAqFjE,CAAC;IA9EC,MAAM;QACJ,OAAO,IAAI,CAAA;;oBAEK,IAAI,CAAC,UAAU;iBAClB,GAAG,EAAE;YACZ,IAAI,IAAI,CAAC,YAAY,EAAE;gBACrB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,IAAI,CAAC,CAAC;aAC1B;QACH,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;CAiEF,CAAA;AA/DQ,iBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DlB,CAAC;AApF0C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAoB;AAGnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA2C;AAErD;IAAhB,KAAK,CAAC,QAAQ,CAAC;0CAA4B;AANjC,UAAU;IADtB,aAAa,CAAC,WAAW,CAAC;GACd,UAAU,CAsFtB;SAtFY,UAAU","sourcesContent":["import { LitElement, html, css } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\n\nimport '@internetarchive/icon-donate/icon-donate.js';\n\n@customElement('ia-button')\nexport class IauxButton extends LitElement {\n @property({ type: Boolean, reflect: true }) isDisabled = false;\n\n // eslint-disable-next-line no-use-before-define\n @property({ type: Object }) clickHandler?: (self: IauxButton) => void;\n\n @query('button') button!: HTMLButtonElement;\n\n render() {\n return html`\n <button\n ?disabled=${this.isDisabled}\n @click=${() => {\n if (this.clickHandler) {\n this?.clickHandler(this);\n }\n }}\n >\n <slot></slot>\n </button>\n `;\n }\n\n static styles = css`\n :host {\n display: inline-block;\n height: var(--button-height, 30px);\n }\n\n button {\n border: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n display: inline-block;\n padding: 0.6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n :host(.transparent) button {\n background-color: transparent;\n }\n\n :host(.slim) button {\n padding: 0;\n }\n\n :host(.primary) button {\n background-color: #194880;\n border-color: #c5d1df;\n }\n\n :host(.secondary) button {\n background: #333;\n }\n\n :host(.cancel) button {\n background-color: #e51c26;\n border-color: #f8c6c8;\n }\n\n :host(.link) button {\n color: #4b64ff;\n border: none;\n background: transparent;\n display: flex;\n align-items: var(--link-button-flex-align-items, flex-end);\n padding: var(--link-button-padding, inherit);\n height: inherit;\n }\n\n :host([isdisabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n color: #222 !important;\n }\n `;\n}\n"]}
@@ -75,12 +75,19 @@ MonthlyGivingCircle.styles = css `
75
75
  justify-content: flex-end;
76
76
  align-items: flex-end;
77
77
  }
78
+
79
+ @media screen and (max-width: 500px) {
80
+ h2,
81
+ slot[name='action'] {
82
+ display: block;
83
+ }
84
+ }
78
85
  `;
79
86
  __decorate([
80
87
  property({ type: String })
81
88
  ], MonthlyGivingCircle.prototype, "titleStyle", void 0);
82
89
  MonthlyGivingCircle = __decorate([
83
- customElement('iaux-mgc-title')
90
+ customElement('ia-mgc-title')
84
91
  ], MonthlyGivingCircle);
85
92
  export { MonthlyGivingCircle };
86
93
  //# sourceMappingURL=mgc-title.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mgc-title.js","sourceRoot":"","sources":["../../../src/presentational/mgc-title.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,6CAA6C,CAAC;AAGrD,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QAC8B,eAAU,GAAwB,OAAO,CAAC;IAwExE,CAAC;IAtEC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,KAAK,OAAO;YAChC,CAAC,CAAC,IAAI,CAAA,oEAAoE;YAC1E,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;cAID,IAAI,CAAC,KAAK;;;;;;KAMnB,CAAC;IACJ,CAAC;CAoDF,CAAA;AAlDQ,0BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDlB,CAAC;AAvE0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA2C;AAD3D,mBAAmB;IAD/B,aAAa,CAAC,gBAAgB,CAAC;GACnB,mBAAmB,CAyE/B;SAzEY,mBAAmB","sourcesContent":["import { LitElement, html, css, TemplateResult, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport '@internetarchive/icon-donate/icon-donate.js';\n\n@customElement('iaux-mgc-title')\nexport class MonthlyGivingCircle extends LitElement {\n @property({ type: String }) titleStyle: 'heart' | 'default' = 'heart';\n\n get heart(): TemplateResult | typeof nothing {\n return this.titleStyle === 'heart'\n ? html` <div class=\"icon-donate\"><ia-icon-donate></ia-icon-donate></div> `\n : nothing;\n }\n\n render() {\n return html`\n <div>\n <h2>\n <div class=\"title-section\">\n ${this.heart}\n <slot name=\"title\"></slot>\n </div>\n <slot name=\"action\"></slot>\n </h2>\n </div>\n `;\n }\n\n static styles = css`\n :host {\n padding-bottom: 5px;\n display: block;\n }\n\n :host([titlestyle='default']) h2 {\n justify-content: flex-start;\n gap: 20px;\n }\n\n :host([titlestyle='heart']) h2 .title-section {\n width: 100%;\n display: flex;\n }\n\n h2 {\n font-size: 1.5em;\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-content: center;\n margin: 0;\n justify-content: space-between;\n align-items: flex-end;\n line-height: normal;\n }\n\n h2 .icon-donate {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-content: flex-end;\n align-items: center;\n justify-content: flex-start;\n }\n\n h2 .icon-donate {\n --iconFillColor: red;\n --iconWidth: 1.2em;\n --iconHeight: 1.2em;\n }\n\n slot[name='action'] {\n padding: 0 !important;\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n }\n `;\n}\n"]}
1
+ {"version":3,"file":"mgc-title.js","sourceRoot":"","sources":["../../../src/presentational/mgc-title.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,6CAA6C,CAAC;AAGrD,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QAC8B,eAAU,GAAwB,OAAO,CAAC;IA+ExE,CAAC;IA7EC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,KAAK,OAAO;YAChC,CAAC,CAAC,IAAI,CAAA,oEAAoE;YAC1E,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;cAID,IAAI,CAAC,KAAK;;;;;;KAMnB,CAAC;IACJ,CAAC;CA2DF,CAAA;AAzDQ,0BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDlB,CAAC;AA9E0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA2C;AAD3D,mBAAmB;IAD/B,aAAa,CAAC,cAAc,CAAC;GACjB,mBAAmB,CAgF/B;SAhFY,mBAAmB","sourcesContent":["import { LitElement, html, css, TemplateResult, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport '@internetarchive/icon-donate/icon-donate.js';\n\n@customElement('ia-mgc-title')\nexport class MonthlyGivingCircle extends LitElement {\n @property({ type: String }) titleStyle: 'heart' | 'default' = 'heart';\n\n get heart(): TemplateResult | typeof nothing {\n return this.titleStyle === 'heart'\n ? html` <div class=\"icon-donate\"><ia-icon-donate></ia-icon-donate></div> `\n : nothing;\n }\n\n render() {\n return html`\n <div>\n <h2>\n <div class=\"title-section\">\n ${this.heart}\n <slot name=\"title\"></slot>\n </div>\n <slot name=\"action\"></slot>\n </h2>\n </div>\n `;\n }\n\n static styles = css`\n :host {\n padding-bottom: 5px;\n display: block;\n }\n\n :host([titlestyle='default']) h2 {\n justify-content: flex-start;\n gap: 20px;\n }\n\n :host([titlestyle='heart']) h2 .title-section {\n width: 100%;\n display: flex;\n }\n\n h2 {\n font-size: 1.5em;\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-content: center;\n margin: 0;\n justify-content: space-between;\n align-items: flex-end;\n line-height: normal;\n }\n\n h2 .icon-donate {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-content: flex-end;\n align-items: center;\n justify-content: flex-start;\n }\n\n h2 .icon-donate {\n --iconFillColor: red;\n --iconWidth: 1.2em;\n --iconHeight: 1.2em;\n }\n\n slot[name='action'] {\n padding: 0 !important;\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n }\n\n @media screen and (max-width: 500px) {\n h2,\n slot[name='action'] {\n display: block;\n }\n }\n `;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
2
  import type { Receipt } from './models/receipt';
3
- import './presentational/iaux-button';
3
+ import './presentational/ia-button';
4
4
  declare type ReceiptEmailStatus = {
5
5
  id: string;
6
6
  emailStatus: 'success' | 'fail' | 'pending' | '';