@internetarchive/donation-monthly-portal 1.0.0 → 2.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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/models/receipt.d.ts +20 -0
- package/dist/src/models/receipt.js +37 -0
- package/dist/src/models/receipt.js.map +1 -0
- package/dist/src/monthly-giving-circle.d.ts +16 -2
- package/dist/src/monthly-giving-circle.js +75 -2
- package/dist/src/monthly-giving-circle.js.map +1 -1
- package/dist/src/presentational/iaux-button.d.ts +9 -0
- package/dist/src/presentational/iaux-button.js +101 -0
- package/dist/src/presentational/iaux-button.js.map +1 -0
- package/dist/src/presentational/mgc-title.js +17 -10
- package/dist/src/presentational/mgc-title.js.map +1 -1
- package/dist/src/receipts.d.ts +25 -0
- package/dist/src/receipts.js +217 -0
- package/dist/src/receipts.js.map +1 -0
- package/dist/src/welcome-message.js +1 -0
- package/dist/src/welcome-message.js.map +1 -1
- package/dist/test/monthly-giving-circle.test.js +85 -2
- package/dist/test/monthly-giving-circle.test.js.map +1 -1
- package/dist/test/receipt-email-request-flow.test.d.ts +1 -0
- package/dist/test/receipt-email-request-flow.test.js +49 -0
- package/dist/test/receipt-email-request-flow.test.js.map +1 -0
- package/package.json +3 -2
- package/src/models/receipt.ts +53 -0
- package/src/monthly-giving-circle.ts +84 -2
- package/src/presentational/iaux-button.ts +93 -0
- package/src/presentational/mgc-title.ts +17 -10
- package/src/receipts.ts +237 -0
- package/src/welcome-message.ts +1 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
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","sourcesContent":["export { MonthlyGivingCircle } from './src/monthly-giving-circle';\nexport type { anUpdate } from './src/monthly-giving-circle';\nexport { Receipt } from './src/models/receipt';\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,22 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import './welcome-message';
|
|
3
3
|
import './presentational/mgc-title';
|
|
4
|
+
import './receipts';
|
|
5
|
+
import type { IauxMgcReceipts } from './receipts';
|
|
6
|
+
import './presentational/iaux-button';
|
|
7
|
+
export declare type anUpdate = {
|
|
8
|
+
message: string;
|
|
9
|
+
status: 'success' | 'fail';
|
|
10
|
+
donationId: string;
|
|
11
|
+
};
|
|
4
12
|
export declare class MonthlyGivingCircle extends LitElement {
|
|
5
13
|
patronName: string;
|
|
14
|
+
receipts: never[];
|
|
15
|
+
updates: anUpdate[];
|
|
16
|
+
viewToDisplay: 'welcome' | 'receipts';
|
|
6
17
|
protected createRenderRoot(): this;
|
|
7
|
-
|
|
18
|
+
get receiptListElement(): IauxMgcReceipts;
|
|
19
|
+
updateReceived(update: anUpdate): void;
|
|
20
|
+
get showReceiptsCTA(): TemplateResult;
|
|
21
|
+
protected render(): TemplateResult<1>;
|
|
8
22
|
}
|
|
@@ -1,20 +1,84 @@
|
|
|
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
6
|
import './presentational/mgc-title';
|
|
7
|
+
import './receipts';
|
|
8
|
+
import './presentational/iaux-button';
|
|
7
9
|
let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
|
|
8
10
|
constructor() {
|
|
9
11
|
super(...arguments);
|
|
10
12
|
this.patronName = '';
|
|
13
|
+
this.receipts = [];
|
|
14
|
+
this.updates = [];
|
|
15
|
+
this.viewToDisplay = 'welcome';
|
|
11
16
|
}
|
|
12
17
|
createRenderRoot() {
|
|
13
18
|
return this;
|
|
14
19
|
}
|
|
20
|
+
get receiptListElement() {
|
|
21
|
+
return this.querySelector('iaux-mgc-receipts');
|
|
22
|
+
}
|
|
23
|
+
updateReceived(update) {
|
|
24
|
+
this.receiptListElement.emailSent({
|
|
25
|
+
id: update.donationId,
|
|
26
|
+
emailStatus: update.status,
|
|
27
|
+
});
|
|
28
|
+
this.updates.unshift(update);
|
|
29
|
+
}
|
|
30
|
+
get showReceiptsCTA() {
|
|
31
|
+
return html `
|
|
32
|
+
<iaux-button
|
|
33
|
+
class="link"
|
|
34
|
+
style="--button-padding: 0;"
|
|
35
|
+
.clickHandler=${() => {
|
|
36
|
+
this.viewToDisplay = 'receipts';
|
|
37
|
+
this.dispatchEvent(new CustomEvent('ShowReceipts'));
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
View recent donation history
|
|
41
|
+
</iaux-button>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
15
44
|
render() {
|
|
45
|
+
if (this.viewToDisplay === 'receipts') {
|
|
46
|
+
return html `
|
|
47
|
+
<iaux-mgc-title titleStyle="default">
|
|
48
|
+
<span slot="title">Recent donations</span>
|
|
49
|
+
<span slot="action">
|
|
50
|
+
<iaux-button
|
|
51
|
+
class="link slim"
|
|
52
|
+
id="close-receipts"
|
|
53
|
+
.clickHandler=${async () => {
|
|
54
|
+
this.viewToDisplay = 'welcome';
|
|
55
|
+
this.dispatchEvent(new CustomEvent('ShowWelcome'));
|
|
56
|
+
this.updates = [];
|
|
57
|
+
await this.updateComplete;
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
Back to account settings
|
|
61
|
+
</iaux-button>
|
|
62
|
+
</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>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
16
75
|
return html `
|
|
17
|
-
<iaux-mgc-title titleStyle="heart"
|
|
76
|
+
<iaux-mgc-title titleStyle="heart">
|
|
77
|
+
<span slot="title">Monthly Giving Circle</span>
|
|
78
|
+
<span slot="action"
|
|
79
|
+
>${this.receipts.length ? this.showReceiptsCTA : nothing}</span
|
|
80
|
+
>
|
|
81
|
+
</iaux-mgc-title>
|
|
18
82
|
<iaux-mgc-welcome .patronName=${this.patronName}></iaux-mgc-welcome>
|
|
19
83
|
`;
|
|
20
84
|
}
|
|
@@ -22,6 +86,15 @@ let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
|
|
|
22
86
|
__decorate([
|
|
23
87
|
property({ type: String })
|
|
24
88
|
], MonthlyGivingCircle.prototype, "patronName", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: Array })
|
|
91
|
+
], MonthlyGivingCircle.prototype, "receipts", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Array })
|
|
94
|
+
], MonthlyGivingCircle.prototype, "updates", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: String, reflect: true })
|
|
97
|
+
], MonthlyGivingCircle.prototype, "viewToDisplay", void 0);
|
|
25
98
|
MonthlyGivingCircle = __decorate([
|
|
26
99
|
customElement('iaux-monthly-giving-circle')
|
|
27
100
|
], MonthlyGivingCircle);
|
|
@@ -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;
|
|
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;AAC3B,OAAO,4BAA4B,CAAC;AACpC,OAAO,YAAY,CAAC;AAEpB,OAAO,8BAA8B,CAAC;AAStC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QAC8B,eAAU,GAAW,EAAE,CAAC;QAEzB,aAAQ,GAAG,EAAE,CAAC;QAEd,YAAO,GAAe,EAAE,CAAC;QAET,kBAAa,GAEvC,SAAS,CAAC;IA6E7B,CAAC;IA3EW,gBAAgB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAoB,CAAC;IACpE,CAAC;IAED,cAAc,CAAC,MAAgB;QAC7B,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC;YAChC,EAAE,EAAE,MAAM,CAAC,UAAU;YACrB,WAAW,EAAE,MAAM,CAAC,MAAM;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAA;;;;wBAIS,GAAG,EAAE;YACnB,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;QACtD,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;IAES,MAAM;QACd,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,EAAE;YACrC,OAAO,IAAI,CAAA;;;;;;;8BAOa,KAAK,IAAI,EAAE;gBACzB,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;gBAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;gBAClB,MAAM,IAAI,CAAC,cAAc,CAAC;YAC5B,CAAC;;;;;;;sBAOO,IAAI,CAAC,QAAQ;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"]}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
+
import '@internetarchive/icon-donate/icon-donate.js';
|
|
5
|
+
let IauxButton = class IauxButton extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.isDisabled = false;
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
return html `
|
|
12
|
+
<button
|
|
13
|
+
?disabled=${this.isDisabled}
|
|
14
|
+
@click=${() => {
|
|
15
|
+
if (this.clickHandler) {
|
|
16
|
+
this === null || this === void 0 ? void 0 : this.clickHandler(this);
|
|
17
|
+
}
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</button>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
IauxButton.styles = css `
|
|
26
|
+
:host {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
height: var(--button-height, 30px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
button {
|
|
32
|
+
border: none;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
line-height: normal;
|
|
35
|
+
border-radius: 0.4rem;
|
|
36
|
+
text-align: center;
|
|
37
|
+
vertical-align: middle;
|
|
38
|
+
display: inline-block;
|
|
39
|
+
padding: 0.6rem 1.2rem;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
-webkit-user-select: none;
|
|
44
|
+
-moz-user-select: none;
|
|
45
|
+
-ms-user-select: none;
|
|
46
|
+
-o-user-select: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host(.transparent) button {
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host(.slim) button {
|
|
55
|
+
padding: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host(.primary) button {
|
|
59
|
+
background-color: #194880;
|
|
60
|
+
border-color: #c5d1df;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host(.secondary) button {
|
|
64
|
+
background: #333;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host(.cancel) button {
|
|
68
|
+
background-color: #e51c26;
|
|
69
|
+
border-color: #f8c6c8;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host(.link) button {
|
|
73
|
+
color: #4b64ff;
|
|
74
|
+
border: none;
|
|
75
|
+
background: transparent;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: var(--link-button-flex-align-items, flex-end);
|
|
78
|
+
padding: var(--link-button-padding, inherit);
|
|
79
|
+
height: inherit;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([isdisabled]) button {
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
opacity: 0.5;
|
|
85
|
+
color: #222 !important;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ type: Boolean, reflect: true })
|
|
90
|
+
], IauxButton.prototype, "isDisabled", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
property({ type: Object })
|
|
93
|
+
], IauxButton.prototype, "clickHandler", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
query('button')
|
|
96
|
+
], IauxButton.prototype, "button", void 0);
|
|
97
|
+
IauxButton = __decorate([
|
|
98
|
+
customElement('iaux-button')
|
|
99
|
+
], IauxButton);
|
|
100
|
+
export { IauxButton };
|
|
101
|
+
//# sourceMappingURL=iaux-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iaux-button.js","sourceRoot":"","sources":["../../../src/presentational/iaux-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,aAAa,CAAC;GAChB,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('iaux-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"]}
|
|
@@ -9,10 +9,7 @@ let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
|
|
|
9
9
|
}
|
|
10
10
|
get heart() {
|
|
11
11
|
return this.titleStyle === 'heart'
|
|
12
|
-
? html `
|
|
13
|
-
<div class="icon-donate"><ia-icon-donate></ia-icon-donate></div>
|
|
14
|
-
<span>Monthly Giving Circle</span>
|
|
15
|
-
`
|
|
12
|
+
? html ` <div class="icon-donate"><ia-icon-donate></ia-icon-donate></div> `
|
|
16
13
|
: nothing;
|
|
17
14
|
}
|
|
18
15
|
render() {
|
|
@@ -30,6 +27,21 @@ let MonthlyGivingCircle = class MonthlyGivingCircle extends LitElement {
|
|
|
30
27
|
}
|
|
31
28
|
};
|
|
32
29
|
MonthlyGivingCircle.styles = css `
|
|
30
|
+
:host {
|
|
31
|
+
padding-bottom: 5px;
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([titlestyle='default']) h2 {
|
|
36
|
+
justify-content: flex-start;
|
|
37
|
+
gap: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host([titlestyle='heart']) h2 .title-section {
|
|
41
|
+
width: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
h2 {
|
|
34
46
|
font-size: 1.5em;
|
|
35
47
|
display: flex;
|
|
@@ -38,13 +50,8 @@ MonthlyGivingCircle.styles = css `
|
|
|
38
50
|
align-content: center;
|
|
39
51
|
margin: 0;
|
|
40
52
|
justify-content: space-between;
|
|
41
|
-
gap: 10px;
|
|
42
53
|
align-items: flex-end;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
h2 .title-section {
|
|
46
|
-
width: 100%;
|
|
47
|
-
display: flex;
|
|
54
|
+
line-height: normal;
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
h2 .icon-donate {
|
|
@@ -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;
|
|
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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import type { Receipt } from './models/receipt';
|
|
3
|
+
import './presentational/iaux-button';
|
|
4
|
+
declare type ReceiptEmailStatus = {
|
|
5
|
+
id: string;
|
|
6
|
+
emailStatus: 'success' | 'fail' | 'pending' | '';
|
|
7
|
+
};
|
|
8
|
+
declare type receiptDispatcherMap = {
|
|
9
|
+
[id: string]: ReceiptEmailStatus;
|
|
10
|
+
};
|
|
11
|
+
export declare class IauxMgcReceipts extends LitElement {
|
|
12
|
+
receipts: never[];
|
|
13
|
+
receiptDispatcher: receiptDispatcherMap | null;
|
|
14
|
+
shouldUpdate(changed: PropertyValues): boolean;
|
|
15
|
+
updated(changed: PropertyValues): void;
|
|
16
|
+
updateReceiptSentMap(): void;
|
|
17
|
+
emailReceipt(receipt: Receipt): void;
|
|
18
|
+
/** callback that confirms status of an receipt email request */
|
|
19
|
+
emailSent(receiptEmailed: ReceiptEmailStatus): Promise<void>;
|
|
20
|
+
emailStatusMessageToDisplay(receiptSentStatus: ReceiptEmailStatus): string;
|
|
21
|
+
ctaButtonText(donation: Receipt, emailStatus?: ReceiptEmailStatus): "Sending..." | "Email receipt";
|
|
22
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
23
|
+
static styles: import("lit").CSSResult;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import './presentational/iaux-button';
|
|
6
|
+
let IauxMgcReceipts = class IauxMgcReceipts extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.receipts = [];
|
|
10
|
+
this.receiptDispatcher = null;
|
|
11
|
+
}
|
|
12
|
+
shouldUpdate(changed) {
|
|
13
|
+
if (changed.has('receiptDispatcher')) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
updated(changed) {
|
|
19
|
+
if (changed.has('receipts')) {
|
|
20
|
+
this.updateReceiptSentMap();
|
|
21
|
+
}
|
|
22
|
+
if (changed.has('receiptDispatcher')) {
|
|
23
|
+
console.log('receiptDispatcher UPDATED ---- ', this.receiptDispatcher);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
updateReceiptSentMap() {
|
|
27
|
+
if (!this.receipts.length) {
|
|
28
|
+
this.receiptDispatcher = null;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const receiptDispatcher = {};
|
|
32
|
+
this.receipts.forEach((receipt) => {
|
|
33
|
+
receiptDispatcher[receipt.id] = {
|
|
34
|
+
id: receipt.id,
|
|
35
|
+
emailStatus: '',
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
this.receiptDispatcher = receiptDispatcher;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
emailReceipt(receipt) {
|
|
42
|
+
this.dispatchEvent(new CustomEvent('EmailReceiptRequest', {
|
|
43
|
+
detail: {
|
|
44
|
+
donation: receipt,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
/** callback that confirms status of an receipt email request */
|
|
49
|
+
async emailSent(receiptEmailed) {
|
|
50
|
+
var _a;
|
|
51
|
+
const currStatusMap = this.receiptDispatcher;
|
|
52
|
+
this.receiptDispatcher = null;
|
|
53
|
+
await this.updateComplete;
|
|
54
|
+
const statusMap = {
|
|
55
|
+
...currStatusMap,
|
|
56
|
+
};
|
|
57
|
+
const { id } = receiptEmailed;
|
|
58
|
+
statusMap[id] = receiptEmailed;
|
|
59
|
+
this.receiptDispatcher = { ...statusMap };
|
|
60
|
+
console.log('RECEIPTS -- emailSent', this.receiptDispatcher, receiptEmailed);
|
|
61
|
+
// re-enable email request button
|
|
62
|
+
const escapedId = CSS.escape(id);
|
|
63
|
+
const button = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`#donation-${escapedId} iaux-button`);
|
|
64
|
+
button.isDisabled = false;
|
|
65
|
+
}
|
|
66
|
+
/* renderings */
|
|
67
|
+
emailStatusMessageToDisplay(receiptSentStatus) {
|
|
68
|
+
switch (receiptSentStatus.emailStatus) {
|
|
69
|
+
case 'success':
|
|
70
|
+
return '✓ Sent';
|
|
71
|
+
case 'fail':
|
|
72
|
+
return '✖ Failed';
|
|
73
|
+
default:
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
ctaButtonText(donation, emailStatus) {
|
|
78
|
+
if ((emailStatus === null || emailStatus === void 0 ? void 0 : emailStatus.emailStatus) === 'pending') {
|
|
79
|
+
return 'Sending...';
|
|
80
|
+
}
|
|
81
|
+
return 'Email receipt';
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
return html `
|
|
85
|
+
<section id="recent-donations-list">
|
|
86
|
+
<table>
|
|
87
|
+
<tr>
|
|
88
|
+
<th class="date">Date</th>
|
|
89
|
+
<th class="amount">Amount</th>
|
|
90
|
+
<th class="action">Action</th>
|
|
91
|
+
</tr>
|
|
92
|
+
${this.receipts.length
|
|
93
|
+
? this.receipts.map((donation) => {
|
|
94
|
+
var _a;
|
|
95
|
+
const emailStatus = (_a = this.receiptDispatcher) === null || _a === void 0 ? void 0 : _a[donation.id];
|
|
96
|
+
const emailUnavailable = (emailStatus === null || emailStatus === void 0 ? void 0 : emailStatus.emailStatus) === 'pending';
|
|
97
|
+
const emailStatusToDisplay = !emailStatus || !emailStatus.emailStatus
|
|
98
|
+
? nothing
|
|
99
|
+
: html `<span
|
|
100
|
+
class=${`sent-status ${emailStatus.emailStatus}`}
|
|
101
|
+
>${this.emailStatusMessageToDisplay(emailStatus)}</span
|
|
102
|
+
>`;
|
|
103
|
+
return html `
|
|
104
|
+
<tr
|
|
105
|
+
id=${`donation-${donation.id}`}
|
|
106
|
+
class=${`${donation.isTest ? 'test' : ''}`}
|
|
107
|
+
>
|
|
108
|
+
<td>
|
|
109
|
+
<div class="donation-date">${donation.date}</div>
|
|
110
|
+
</td>
|
|
111
|
+
<td>
|
|
112
|
+
<div class="donation-amount">
|
|
113
|
+
${donation.amountFormatted}
|
|
114
|
+
</div>
|
|
115
|
+
</td>
|
|
116
|
+
<td>
|
|
117
|
+
<div class="request-receipt">
|
|
118
|
+
<iaux-button
|
|
119
|
+
class="link slim"
|
|
120
|
+
style="--link-button-flex-align-items: center;"
|
|
121
|
+
.clickHandler=${async (iauxButton) => {
|
|
122
|
+
const initialClick = !emailUnavailable;
|
|
123
|
+
if (initialClick) {
|
|
124
|
+
// eslint-disable-next-line no-param-reassign
|
|
125
|
+
iauxButton.isDisabled = true;
|
|
126
|
+
await iauxButton.updateComplete;
|
|
127
|
+
}
|
|
128
|
+
if (emailUnavailable)
|
|
129
|
+
return;
|
|
130
|
+
this.emailReceipt(donation);
|
|
131
|
+
if (this.receiptDispatcher) {
|
|
132
|
+
const statusMap = {
|
|
133
|
+
...this.receiptDispatcher,
|
|
134
|
+
};
|
|
135
|
+
statusMap[donation.id].emailStatus = 'pending';
|
|
136
|
+
this.receiptDispatcher = statusMap;
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
${this.ctaButtonText(donation, emailStatus)}
|
|
141
|
+
</iaux-button>
|
|
142
|
+
${emailStatusToDisplay}
|
|
143
|
+
</div>
|
|
144
|
+
</td>
|
|
145
|
+
</tr>
|
|
146
|
+
`;
|
|
147
|
+
})
|
|
148
|
+
: html `<p>No recent donations found</p>`}
|
|
149
|
+
</table>
|
|
150
|
+
</section>
|
|
151
|
+
`;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
IauxMgcReceipts.styles = css `
|
|
155
|
+
table {
|
|
156
|
+
text-align: left;
|
|
157
|
+
table-layout: fixed;
|
|
158
|
+
min-width: 600px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
button {
|
|
162
|
+
padding: 1rem 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
td {
|
|
166
|
+
padding: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
th.date {
|
|
170
|
+
width: 55px;
|
|
171
|
+
}
|
|
172
|
+
th.amount {
|
|
173
|
+
width: 55px;
|
|
174
|
+
}
|
|
175
|
+
th.action {
|
|
176
|
+
width: 200px;
|
|
177
|
+
}
|
|
178
|
+
iaux-button-style {
|
|
179
|
+
display: inline-block;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.request-receipt {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-wrap: nowrap;
|
|
185
|
+
align-content: center;
|
|
186
|
+
justify-content: flex-start;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 10px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.sent-status.success,
|
|
192
|
+
.sent-status.fail {
|
|
193
|
+
padding: 5px;
|
|
194
|
+
background: rgb(238, 253, 238);
|
|
195
|
+
width: 55px;
|
|
196
|
+
min-height: 20px;
|
|
197
|
+
}
|
|
198
|
+
.sent-status.success {
|
|
199
|
+
color: rgb(33, 149, 24);
|
|
200
|
+
border-left: 5px solid rgb(33, 149, 24);
|
|
201
|
+
}
|
|
202
|
+
.sent-status.fail {
|
|
203
|
+
color: #bb0505;
|
|
204
|
+
border-left: 5px solid #bb0505;
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: Array })
|
|
209
|
+
], IauxMgcReceipts.prototype, "receipts", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: Object })
|
|
212
|
+
], IauxMgcReceipts.prototype, "receiptDispatcher", void 0);
|
|
213
|
+
IauxMgcReceipts = __decorate([
|
|
214
|
+
customElement('iaux-mgc-receipts')
|
|
215
|
+
], IauxMgcReceipts);
|
|
216
|
+
export { IauxMgcReceipts };
|
|
217
|
+
//# sourceMappingURL=receipts.js.map
|