@orechio/platform-angular 0.6.0 → 0.7.2
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/README.md +134 -64
- package/fesm2022/orechio-platform-angular-account-account-client-mPl0tzMg.mjs.map +1 -1
- package/fesm2022/{orechio-platform-angular-account-forgot-password.page-5_8R5B4m.mjs → orechio-platform-angular-account-forgot-password.page-L-Z-s49p.mjs} +85 -85
- package/fesm2022/orechio-platform-angular-account-forgot-password.page-L-Z-s49p.mjs.map +1 -0
- package/fesm2022/{orechio-platform-angular-account-initial-branch.page-Cmy07JGF.mjs → orechio-platform-angular-account-initial-branch.page-C8a1eU3L.mjs} +61 -61
- package/fesm2022/orechio-platform-angular-account-initial-branch.page-C8a1eU3L.mjs.map +1 -0
- package/fesm2022/{orechio-platform-angular-account-resend-verification.page-qckKAlPk.mjs → orechio-platform-angular-account-resend-verification.page-C3lk1vNj.mjs} +69 -69
- package/fesm2022/orechio-platform-angular-account-resend-verification.page-C3lk1vNj.mjs.map +1 -0
- package/fesm2022/{orechio-platform-angular-account-token-password.page-AHqb8mFk.mjs → orechio-platform-angular-account-token-password.page-1vn5XGVu.mjs} +73 -73
- package/fesm2022/orechio-platform-angular-account-token-password.page-1vn5XGVu.mjs.map +1 -0
- package/fesm2022/{orechio-platform-angular-account-verify-email.page-CHs0EwDf.mjs → orechio-platform-angular-account-verify-email.page-xulVDiOn.mjs} +35 -35
- package/fesm2022/orechio-platform-angular-account-verify-email.page-xulVDiOn.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account.mjs +6 -6
- package/fesm2022/orechio-platform-angular-account.mjs.map +1 -1
- package/fesm2022/orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs +303 -0
- package/fesm2022/orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs +186 -0
- package/fesm2022/orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs +136 -0
- package/fesm2022/orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs +105 -0
- package/fesm2022/orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs +83 -0
- package/fesm2022/orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-profile.page-DHjsB3jJ.mjs +309 -0
- package/fesm2022/orechio-platform-angular-billing-profile.page-DHjsB3jJ.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-subscription.page-Cotupt22.mjs +160 -0
- package/fesm2022/orechio-platform-angular-billing-subscription.page-Cotupt22.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing.mjs +69 -0
- package/fesm2022/orechio-platform-angular-billing.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular.mjs +8 -4
- package/fesm2022/orechio-platform-angular.mjs.map +1 -1
- package/package.json +5 -1
- package/types/orechio-platform-angular-billing.d.ts +32 -0
- package/types/orechio-platform-angular.d.ts +8 -4
- package/fesm2022/orechio-platform-angular-account-forgot-password.page-5_8R5B4m.mjs.map +0 -1
- package/fesm2022/orechio-platform-angular-account-initial-branch.page-Cmy07JGF.mjs.map +0 -1
- package/fesm2022/orechio-platform-angular-account-resend-verification.page-qckKAlPk.mjs.map +0 -1
- package/fesm2022/orechio-platform-angular-account-token-password.page-AHqb8mFk.mjs.map +0 -1
- package/fesm2022/orechio-platform-angular-account-verify-email.page-CHs0EwDf.mjs.map +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { ActivatedRoute, RouterLink } from '@angular/router';
|
|
4
|
+
import { B as BillingClient, S as STATUS_DA_FATURA, g as moeda, d as data, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs';
|
|
5
|
+
import { P as PixPanelComponent } from './orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Detalhe de fatura. O detalhe da Platform não traz dado de pagamento (`InvoiceDetailDto`):
|
|
9
|
+
* o QR vem do refresh, que a Platform aceita para fatura PIX `Pending` ou `Overdue`
|
|
10
|
+
* (`RefreshPaymentDataCommand`, passo 2) — o que inclui a fatura de renovação.
|
|
11
|
+
*/
|
|
12
|
+
class InvoicePage {
|
|
13
|
+
client = inject(BillingClient);
|
|
14
|
+
route = inject(ActivatedRoute);
|
|
15
|
+
status = STATUS_DA_FATURA;
|
|
16
|
+
moeda = moeda;
|
|
17
|
+
data = data;
|
|
18
|
+
fatura = signal(null, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "fatura" }] : /* istanbul ignore next */ []));
|
|
20
|
+
pix = signal(null, /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "pix" }] : /* istanbul ignore next */ []));
|
|
22
|
+
invoiceUrl = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "invoiceUrl" }] : /* istanbul ignore next */ []));
|
|
24
|
+
gerando = signal(false, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "gerando" }] : /* istanbul ignore next */ []));
|
|
26
|
+
erro = signal(null, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "erro" }] : /* istanbul ignore next */ []));
|
|
28
|
+
podeGerarQr = computed(() => {
|
|
29
|
+
const f = this.fatura();
|
|
30
|
+
return !!f && f.paymentMethod === 'Pix' && (f.status === 'Pending' || f.status === 'Overdue');
|
|
31
|
+
}, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "podeGerarQr" }] : /* istanbul ignore next */ []));
|
|
33
|
+
ngOnInit() {
|
|
34
|
+
const id = this.route.snapshot.paramMap.get('id') ?? '';
|
|
35
|
+
this.client.getInvoice(id).subscribe({
|
|
36
|
+
next: (fatura) => this.fatura.set(fatura),
|
|
37
|
+
error: (problema) => this.erro.set(problema),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
gerarQr() {
|
|
41
|
+
const f = this.fatura();
|
|
42
|
+
if (!f || this.gerando())
|
|
43
|
+
return;
|
|
44
|
+
this.gerando.set(true);
|
|
45
|
+
this.erro.set(null);
|
|
46
|
+
this.client.refreshInvoicePix(f.id).subscribe({
|
|
47
|
+
next: (pix) => {
|
|
48
|
+
this.gerando.set(false);
|
|
49
|
+
// O refresh traz o PIX e o `invoiceUrl` juntos: o link acompanha o QR que está na tela.
|
|
50
|
+
this.invoiceUrl.set(pix.invoiceUrl ?? null);
|
|
51
|
+
this.pix.set(pix);
|
|
52
|
+
},
|
|
53
|
+
error: (problema) => {
|
|
54
|
+
this.gerando.set(false);
|
|
55
|
+
this.erro.set(problema);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicePage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
60
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: InvoicePage, isStandalone: true, selector: "orechio-billing-invoice", ngImport: i0, template: `
|
|
61
|
+
<section class="orechio-billing">
|
|
62
|
+
@if (fatura(); as f) {
|
|
63
|
+
<h1>Fatura {{ f.number }}</h1>
|
|
64
|
+
<p>{{ status[f.status] }} — {{ moeda(f.amount) }} — vence em {{ data(f.dueDate) }}</p>
|
|
65
|
+
<p class="orechio-billing__muted">
|
|
66
|
+
{{ f.planNameAtTime }}, de {{ data(f.periodStartsAt) }} a {{ data(f.periodEndsAt) }}
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
<ul>
|
|
70
|
+
@for (item of f.items; track item.order) {
|
|
71
|
+
<li>{{ item.description }} — {{ item.quantity }} × {{ moeda(item.unitAmount) }} = {{ moeda(item.totalAmount) }}</li>
|
|
72
|
+
}
|
|
73
|
+
</ul>
|
|
74
|
+
|
|
75
|
+
@if (podeGerarQr()) {
|
|
76
|
+
<button type="button" data-gerar-qr (click)="gerarQr()" [disabled]="gerando()">
|
|
77
|
+
{{ gerando() ? 'Gerando…' : 'Gerar novo QR' }}
|
|
78
|
+
</button>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@if (pix(); as dados) {
|
|
82
|
+
<orechio-billing-pix [pix]="dados" [invoiceUrl]="invoiceUrl()" />
|
|
83
|
+
}
|
|
84
|
+
} @else if (!erro()) {
|
|
85
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@if (erro(); as problema) {
|
|
89
|
+
<orechio-billing-error [problema]="problema" />
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
<a routerLink="..">Voltar para as faturas</a>
|
|
93
|
+
</section>
|
|
94
|
+
`, isInline: true, styles: [".orechio-billing{display:flex;flex-direction:column;gap:var(--orechio-space-3, .75rem);max-width:40rem;margin:0 auto;padding:var(--orechio-space-6, 1.5rem);color:var(--orechio-color-text, inherit);font-family:var(--orechio-font-body, inherit)}.orechio-billing form{display:flex;flex-direction:column;gap:var(--orechio-space-2, .5rem)}.orechio-billing__muted{color:var(--orechio-color-text-muted, #666)}.orechio-billing__error{color:var(--orechio-color-danger, #b00020)}.orechio-billing__acao{align-self:flex-start;display:inline-block;padding:var(--orechio-space-2, .5rem) var(--orechio-space-4, 1rem);border-radius:var(--orechio-radius, .375rem);background:var(--orechio-color-primary, #1a56db);color:var(--orechio-color-on-primary, #fff);font-weight:600;text-decoration:none}.orechio-billing__acao:hover,.orechio-billing__acao:focus-visible{background:var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0))}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: BillingErrorComponent, selector: "orechio-billing-error", inputs: ["problema"] }, { kind: "component", type: PixPanelComponent, selector: "orechio-billing-pix", inputs: ["pix", "invoiceUrl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicePage, decorators: [{
|
|
97
|
+
type: Component,
|
|
98
|
+
args: [{ selector: 'orechio-billing-invoice', standalone: true, imports: [RouterLink, BillingErrorComponent, PixPanelComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
99
|
+
<section class="orechio-billing">
|
|
100
|
+
@if (fatura(); as f) {
|
|
101
|
+
<h1>Fatura {{ f.number }}</h1>
|
|
102
|
+
<p>{{ status[f.status] }} — {{ moeda(f.amount) }} — vence em {{ data(f.dueDate) }}</p>
|
|
103
|
+
<p class="orechio-billing__muted">
|
|
104
|
+
{{ f.planNameAtTime }}, de {{ data(f.periodStartsAt) }} a {{ data(f.periodEndsAt) }}
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
<ul>
|
|
108
|
+
@for (item of f.items; track item.order) {
|
|
109
|
+
<li>{{ item.description }} — {{ item.quantity }} × {{ moeda(item.unitAmount) }} = {{ moeda(item.totalAmount) }}</li>
|
|
110
|
+
}
|
|
111
|
+
</ul>
|
|
112
|
+
|
|
113
|
+
@if (podeGerarQr()) {
|
|
114
|
+
<button type="button" data-gerar-qr (click)="gerarQr()" [disabled]="gerando()">
|
|
115
|
+
{{ gerando() ? 'Gerando…' : 'Gerar novo QR' }}
|
|
116
|
+
</button>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@if (pix(); as dados) {
|
|
120
|
+
<orechio-billing-pix [pix]="dados" [invoiceUrl]="invoiceUrl()" />
|
|
121
|
+
}
|
|
122
|
+
} @else if (!erro()) {
|
|
123
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@if (erro(); as problema) {
|
|
127
|
+
<orechio-billing-error [problema]="problema" />
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
<a routerLink="..">Voltar para as faturas</a>
|
|
131
|
+
</section>
|
|
132
|
+
`, styles: [".orechio-billing{display:flex;flex-direction:column;gap:var(--orechio-space-3, .75rem);max-width:40rem;margin:0 auto;padding:var(--orechio-space-6, 1.5rem);color:var(--orechio-color-text, inherit);font-family:var(--orechio-font-body, inherit)}.orechio-billing form{display:flex;flex-direction:column;gap:var(--orechio-space-2, .5rem)}.orechio-billing__muted{color:var(--orechio-color-text-muted, #666)}.orechio-billing__error{color:var(--orechio-color-danger, #b00020)}.orechio-billing__acao{align-self:flex-start;display:inline-block;padding:var(--orechio-space-2, .5rem) var(--orechio-space-4, 1rem);border-radius:var(--orechio-radius, .375rem);background:var(--orechio-color-primary, #1a56db);color:var(--orechio-color-on-primary, #fff);font-weight:600;text-decoration:none}.orechio-billing__acao:hover,.orechio-billing__acao:focus-visible{background:var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0))}\n"] }]
|
|
133
|
+
}] });
|
|
134
|
+
|
|
135
|
+
export { InvoicePage };
|
|
136
|
+
//# sourceMappingURL=orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs","sources":["../../../projects/platform-angular/billing/src/pages/invoice.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, computed, inject, signal } from '@angular/core';\r\nimport { ActivatedRoute, RouterLink } from '@angular/router';\r\nimport { ProblemDetails } from '@orechio/platform-angular';\r\nimport { BillingClient } from '../billing-client';\r\nimport { BillingErrorComponent } from '../billing-error.component';\r\nimport { ESTILO_BASE, STATUS_DA_FATURA, data, moeda } from '../billing-format';\r\nimport { InvoiceDetail, PixData } from '../billing-models';\r\nimport { PixPanelComponent } from '../pix-panel.component';\r\n\r\n/**\r\n * Detalhe de fatura. O detalhe da Platform não traz dado de pagamento (`InvoiceDetailDto`):\r\n * o QR vem do refresh, que a Platform aceita para fatura PIX `Pending` ou `Overdue`\r\n * (`RefreshPaymentDataCommand`, passo 2) — o que inclui a fatura de renovação.\r\n */\r\n@Component({\r\n selector: 'orechio-billing-invoice',\r\n standalone: true,\r\n imports: [RouterLink, BillingErrorComponent, PixPanelComponent],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n template: `\r\n <section class=\"orechio-billing\">\r\n @if (fatura(); as f) {\r\n <h1>Fatura {{ f.number }}</h1>\r\n <p>{{ status[f.status] }} — {{ moeda(f.amount) }} — vence em {{ data(f.dueDate) }}</p>\r\n <p class=\"orechio-billing__muted\">\r\n {{ f.planNameAtTime }}, de {{ data(f.periodStartsAt) }} a {{ data(f.periodEndsAt) }}\r\n </p>\r\n\r\n <ul>\r\n @for (item of f.items; track item.order) {\r\n <li>{{ item.description }} — {{ item.quantity }} × {{ moeda(item.unitAmount) }} = {{ moeda(item.totalAmount) }}</li>\r\n }\r\n </ul>\r\n\r\n @if (podeGerarQr()) {\r\n <button type=\"button\" data-gerar-qr (click)=\"gerarQr()\" [disabled]=\"gerando()\">\r\n {{ gerando() ? 'Gerando…' : 'Gerar novo QR' }}\r\n </button>\r\n }\r\n\r\n @if (pix(); as dados) {\r\n <orechio-billing-pix [pix]=\"dados\" [invoiceUrl]=\"invoiceUrl()\" />\r\n }\r\n } @else if (!erro()) {\r\n <p class=\"orechio-billing__muted\">Carregando…</p>\r\n }\r\n\r\n @if (erro(); as problema) {\r\n <orechio-billing-error [problema]=\"problema\" />\r\n }\r\n\r\n <a routerLink=\"..\">Voltar para as faturas</a>\r\n </section>\r\n `,\r\n styles: ESTILO_BASE,\r\n})\r\nexport class InvoicePage implements OnInit {\r\n private readonly client = inject(BillingClient);\r\n private readonly route = inject(ActivatedRoute);\r\n\r\n protected readonly status = STATUS_DA_FATURA;\r\n protected readonly moeda = moeda;\r\n protected readonly data = data;\r\n protected readonly fatura = signal<InvoiceDetail | null>(null);\r\n protected readonly pix = signal<PixData | null>(null);\r\n protected readonly invoiceUrl = signal<string | null>(null);\r\n protected readonly gerando = signal(false);\r\n protected readonly erro = signal<ProblemDetails | null>(null);\r\n protected readonly podeGerarQr = computed(() => {\r\n const f = this.fatura();\r\n return !!f && f.paymentMethod === 'Pix' && (f.status === 'Pending' || f.status === 'Overdue');\r\n });\r\n\r\n ngOnInit(): void {\r\n const id = this.route.snapshot.paramMap.get('id') ?? '';\r\n this.client.getInvoice(id).subscribe({\r\n next: (fatura) => this.fatura.set(fatura),\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n\r\n protected gerarQr(): void {\r\n const f = this.fatura();\r\n if (!f || this.gerando()) return;\r\n\r\n this.gerando.set(true);\r\n this.erro.set(null);\r\n this.client.refreshInvoicePix(f.id).subscribe({\r\n next: (pix) => {\r\n this.gerando.set(false);\r\n // O refresh traz o PIX e o `invoiceUrl` juntos: o link acompanha o QR que está na tela.\r\n this.invoiceUrl.set(pix.invoiceUrl ?? null);\r\n this.pix.set(pix);\r\n },\r\n error: (problema: ProblemDetails) => {\r\n this.gerando.set(false);\r\n this.erro.set(problema);\r\n },\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AASA;;;;AAIG;MA2CU,WAAW,CAAA;AACL,IAAA,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;AAC9B,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;IAE5B,MAAM,GAAG,gBAAgB;IACzB,KAAK,GAAG,KAAK;IACb,IAAI,GAAG,IAAI;IACX,MAAM,GAAG,MAAM,CA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A,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,iBAAiB,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,KAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAuCnD,WAAW,EAAA,UAAA,EAAA,CAAA;kBA1CvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,EAAA,UAAA,EACvB,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAA,eAAA,EAC9C,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,o6BAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { RouterLink } from '@angular/router';
|
|
4
|
+
import { B as BillingClient, S as STATUS_DA_FATURA, g as moeda, d as data, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs';
|
|
5
|
+
|
|
6
|
+
const TAMANHO_DA_PAGINA = 20;
|
|
7
|
+
class InvoicesPage {
|
|
8
|
+
client = inject(BillingClient);
|
|
9
|
+
status = STATUS_DA_FATURA;
|
|
10
|
+
moeda = moeda;
|
|
11
|
+
data = data;
|
|
12
|
+
pagina = signal(null, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "pagina" }] : /* istanbul ignore next */ []));
|
|
14
|
+
erro = signal(null, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "erro" }] : /* istanbul ignore next */ []));
|
|
16
|
+
temProxima = computed(() => {
|
|
17
|
+
const p = this.pagina();
|
|
18
|
+
return !!p && p.page * p.pageSize < p.total;
|
|
19
|
+
}, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "temProxima" }] : /* istanbul ignore next */ []));
|
|
21
|
+
ngOnInit() {
|
|
22
|
+
this.carregar(1);
|
|
23
|
+
}
|
|
24
|
+
carregar(pagina) {
|
|
25
|
+
this.client.listInvoices(pagina, TAMANHO_DA_PAGINA).subscribe({
|
|
26
|
+
next: (resultado) => this.pagina.set(resultado),
|
|
27
|
+
error: (problema) => this.erro.set(problema),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicesPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: InvoicesPage, isStandalone: true, selector: "orechio-billing-invoices", ngImport: i0, template: `
|
|
32
|
+
<section class="orechio-billing">
|
|
33
|
+
<h1>Faturas</h1>
|
|
34
|
+
|
|
35
|
+
@if (erro(); as problema) {
|
|
36
|
+
<orechio-billing-error [problema]="problema" />
|
|
37
|
+
} @else if (pagina(); as p) {
|
|
38
|
+
@if (p.invoices.length === 0) {
|
|
39
|
+
<p class="orechio-billing__muted">Nenhuma fatura ainda.</p>
|
|
40
|
+
} @else {
|
|
41
|
+
<ul>
|
|
42
|
+
@for (fatura of p.invoices; track fatura.id) {
|
|
43
|
+
<li>
|
|
44
|
+
<a [routerLink]="fatura.id">Fatura {{ fatura.number }}</a>
|
|
45
|
+
— {{ status[fatura.status] }} — {{ moeda(fatura.amount) }} — vence em {{ data(fatura.dueDate) }}
|
|
46
|
+
</li>
|
|
47
|
+
}
|
|
48
|
+
</ul>
|
|
49
|
+
|
|
50
|
+
<nav>
|
|
51
|
+
@if (p.page > 1) {
|
|
52
|
+
<button type="button" (click)="carregar(p.page - 1)">Anteriores</button>
|
|
53
|
+
}
|
|
54
|
+
@if (temProxima()) {
|
|
55
|
+
<button type="button" (click)="carregar(p.page + 1)">Próximas</button>
|
|
56
|
+
}
|
|
57
|
+
</nav>
|
|
58
|
+
}
|
|
59
|
+
<a routerLink="..">Voltar para a assinatura</a>
|
|
60
|
+
} @else {
|
|
61
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
62
|
+
}
|
|
63
|
+
</section>
|
|
64
|
+
`, isInline: true, styles: [".orechio-billing{display:flex;flex-direction:column;gap:var(--orechio-space-3, .75rem);max-width:40rem;margin:0 auto;padding:var(--orechio-space-6, 1.5rem);color:var(--orechio-color-text, inherit);font-family:var(--orechio-font-body, inherit)}.orechio-billing form{display:flex;flex-direction:column;gap:var(--orechio-space-2, .5rem)}.orechio-billing__muted{color:var(--orechio-color-text-muted, #666)}.orechio-billing__error{color:var(--orechio-color-danger, #b00020)}.orechio-billing__acao{align-self:flex-start;display:inline-block;padding:var(--orechio-space-2, .5rem) var(--orechio-space-4, 1rem);border-radius:var(--orechio-radius, .375rem);background:var(--orechio-color-primary, #1a56db);color:var(--orechio-color-on-primary, #fff);font-weight:600;text-decoration:none}.orechio-billing__acao:hover,.orechio-billing__acao:focus-visible{background:var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0))}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: BillingErrorComponent, selector: "orechio-billing-error", inputs: ["problema"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
65
|
+
}
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicesPage, decorators: [{
|
|
67
|
+
type: Component,
|
|
68
|
+
args: [{ selector: 'orechio-billing-invoices', standalone: true, imports: [RouterLink, BillingErrorComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
69
|
+
<section class="orechio-billing">
|
|
70
|
+
<h1>Faturas</h1>
|
|
71
|
+
|
|
72
|
+
@if (erro(); as problema) {
|
|
73
|
+
<orechio-billing-error [problema]="problema" />
|
|
74
|
+
} @else if (pagina(); as p) {
|
|
75
|
+
@if (p.invoices.length === 0) {
|
|
76
|
+
<p class="orechio-billing__muted">Nenhuma fatura ainda.</p>
|
|
77
|
+
} @else {
|
|
78
|
+
<ul>
|
|
79
|
+
@for (fatura of p.invoices; track fatura.id) {
|
|
80
|
+
<li>
|
|
81
|
+
<a [routerLink]="fatura.id">Fatura {{ fatura.number }}</a>
|
|
82
|
+
— {{ status[fatura.status] }} — {{ moeda(fatura.amount) }} — vence em {{ data(fatura.dueDate) }}
|
|
83
|
+
</li>
|
|
84
|
+
}
|
|
85
|
+
</ul>
|
|
86
|
+
|
|
87
|
+
<nav>
|
|
88
|
+
@if (p.page > 1) {
|
|
89
|
+
<button type="button" (click)="carregar(p.page - 1)">Anteriores</button>
|
|
90
|
+
}
|
|
91
|
+
@if (temProxima()) {
|
|
92
|
+
<button type="button" (click)="carregar(p.page + 1)">Próximas</button>
|
|
93
|
+
}
|
|
94
|
+
</nav>
|
|
95
|
+
}
|
|
96
|
+
<a routerLink="..">Voltar para a assinatura</a>
|
|
97
|
+
} @else {
|
|
98
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
99
|
+
}
|
|
100
|
+
</section>
|
|
101
|
+
`, styles: [".orechio-billing{display:flex;flex-direction:column;gap:var(--orechio-space-3, .75rem);max-width:40rem;margin:0 auto;padding:var(--orechio-space-6, 1.5rem);color:var(--orechio-color-text, inherit);font-family:var(--orechio-font-body, inherit)}.orechio-billing form{display:flex;flex-direction:column;gap:var(--orechio-space-2, .5rem)}.orechio-billing__muted{color:var(--orechio-color-text-muted, #666)}.orechio-billing__error{color:var(--orechio-color-danger, #b00020)}.orechio-billing__acao{align-self:flex-start;display:inline-block;padding:var(--orechio-space-2, .5rem) var(--orechio-space-4, 1rem);border-radius:var(--orechio-radius, .375rem);background:var(--orechio-color-primary, #1a56db);color:var(--orechio-color-on-primary, #fff);font-weight:600;text-decoration:none}.orechio-billing__acao:hover,.orechio-billing__acao:focus-visible{background:var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0))}\n"] }]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
export { InvoicesPage };
|
|
105
|
+
//# sourceMappingURL=orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs","sources":["../../../projects/platform-angular/billing/src/pages/invoices.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, computed, inject, signal } from '@angular/core';\r\nimport { RouterLink } from '@angular/router';\r\nimport { ProblemDetails } from '@orechio/platform-angular';\r\nimport { BillingClient } from '../billing-client';\r\nimport { BillingErrorComponent } from '../billing-error.component';\r\nimport { ESTILO_BASE, STATUS_DA_FATURA, data, moeda } from '../billing-format';\r\nimport { InvoicesPage as PaginaDeFaturas } from '../billing-models';\r\n\r\nconst TAMANHO_DA_PAGINA = 20;\r\n\r\n@Component({\r\n selector: 'orechio-billing-invoices',\r\n standalone: true,\r\n imports: [RouterLink, BillingErrorComponent],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n template: `\r\n <section class=\"orechio-billing\">\r\n <h1>Faturas</h1>\r\n\r\n @if (erro(); as problema) {\r\n <orechio-billing-error [problema]=\"problema\" />\r\n } @else if (pagina(); as p) {\r\n @if (p.invoices.length === 0) {\r\n <p class=\"orechio-billing__muted\">Nenhuma fatura ainda.</p>\r\n } @else {\r\n <ul>\r\n @for (fatura of p.invoices; track fatura.id) {\r\n <li>\r\n <a [routerLink]=\"fatura.id\">Fatura {{ fatura.number }}</a>\r\n — {{ status[fatura.status] }} — {{ moeda(fatura.amount) }} — vence em {{ data(fatura.dueDate) }}\r\n </li>\r\n }\r\n </ul>\r\n\r\n <nav>\r\n @if (p.page > 1) {\r\n <button type=\"button\" (click)=\"carregar(p.page - 1)\">Anteriores</button>\r\n }\r\n @if (temProxima()) {\r\n <button type=\"button\" (click)=\"carregar(p.page + 1)\">Próximas</button>\r\n }\r\n </nav>\r\n }\r\n <a routerLink=\"..\">Voltar para a assinatura</a>\r\n } @else {\r\n <p class=\"orechio-billing__muted\">Carregando…</p>\r\n }\r\n </section>\r\n `,\r\n styles: ESTILO_BASE,\r\n})\r\nexport class InvoicesPage implements OnInit {\r\n private readonly client = inject(BillingClient);\r\n\r\n protected readonly status = STATUS_DA_FATURA;\r\n protected readonly moeda = moeda;\r\n protected readonly data = data;\r\n protected readonly pagina = signal<PaginaDeFaturas | null>(null);\r\n protected readonly erro = signal<ProblemDetails | null>(null);\r\n protected readonly temProxima = computed(() => {\r\n const p = this.pagina();\r\n return !!p && p.page * p.pageSize < p.total;\r\n });\r\n\r\n ngOnInit(): void {\r\n this.carregar(1);\r\n }\r\n\r\n protected carregar(pagina: number): void {\r\n this.client.listInvoices(pagina, TAMANHO_DA_PAGINA).subscribe({\r\n next: (resultado) => this.pagina.set(resultado),\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAQA,MAAM,iBAAiB,GAAG,EAAE;MA2Cf,YAAY,CAAA;AACN,IAAA,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;IAE5B,MAAM,GAAG,gBAAgB;IACzB,KAAK,GAAG,KAAK;IACb,IAAI,GAAG,IAAI;IACX,MAAM,GAAG,MAAM,CAAyB,IAAI;+EAAC;IAC7C,IAAI,GAAG,MAAM,CAAwB,IAAI;6EAAC;AAC1C,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AAC5C,QAAA,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM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AAA,CAAA;kBAzCxB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,UAAA,EACxB,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAA,eAAA,EAC3B,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,o6BAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { v as validadeDoPix } from './orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* O QR e o copia-e-cola, como a Platform os devolveu. O `encodedImage` é PNG em base64
|
|
7
|
+
* (ASAAS); o `payload` é o código que o app do banco aceita colado.
|
|
8
|
+
*/
|
|
9
|
+
class PixPanelComponent {
|
|
10
|
+
pix = input.required(/* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "pix" }] : /* istanbul ignore next */ []));
|
|
12
|
+
/** Página de pagamento do ASAAS, aberta em nova aba; sem ela, o link não aparece. */
|
|
13
|
+
invoiceUrl = input(null, /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "invoiceUrl" }] : /* istanbul ignore next */ []));
|
|
15
|
+
validadeDoPix = validadeDoPix;
|
|
16
|
+
copiado = signal(false, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "copiado" }] : /* istanbul ignore next */ []));
|
|
18
|
+
semAreaDeTransferencia = signal(false, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "semAreaDeTransferencia" }] : /* istanbul ignore next */ []));
|
|
20
|
+
copiar() {
|
|
21
|
+
const areaDeTransferencia = globalThis.navigator?.clipboard;
|
|
22
|
+
if (!areaDeTransferencia) {
|
|
23
|
+
this.semAreaDeTransferencia.set(true);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
areaDeTransferencia.writeText(this.pix().payload).then(() => this.copiado.set(true), () => this.semAreaDeTransferencia.set(true));
|
|
27
|
+
}
|
|
28
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: PixPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
29
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: PixPanelComponent, isStandalone: true, selector: "orechio-billing-pix", inputs: { pix: { classPropertyName: "pix", publicName: "pix", isSignal: true, isRequired: true, transformFunction: null }, invoiceUrl: { classPropertyName: "invoiceUrl", publicName: "invoiceUrl", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
30
|
+
<div class="orechio-billing-pix">
|
|
31
|
+
<img data-qr [src]="'data:image/png;base64,' + pix().encodedImage" alt="QR Code PIX" width="240" height="240" />
|
|
32
|
+
|
|
33
|
+
<p>Ou copie o código PIX e cole no app do seu banco:</p>
|
|
34
|
+
<code class="orechio-billing-pix__codigo">{{ pix().payload }}</code>
|
|
35
|
+
<button type="button" data-copiar (click)="copiar()">
|
|
36
|
+
{{ copiado() ? 'Código copiado' : 'Copiar código' }}
|
|
37
|
+
</button>
|
|
38
|
+
@if (semAreaDeTransferencia()) {
|
|
39
|
+
<p class="orechio-billing-pix__aviso">Selecione o código acima e copie manualmente.</p>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@if (pix().expirationDate; as validade) {
|
|
43
|
+
<p class="orechio-billing-pix__aviso">Válido até {{ validadeDoPix(validade) }}.</p>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@if (invoiceUrl(); as url) {
|
|
47
|
+
<a data-invoice-url [href]="url" target="_blank" rel="noopener noreferrer">
|
|
48
|
+
Pagar pelo site do ASAAS
|
|
49
|
+
</a>
|
|
50
|
+
}
|
|
51
|
+
</div>
|
|
52
|
+
`, isInline: true, styles: [".orechio-billing-pix{display:flex;flex-direction:column;align-items:flex-start;gap:var(--orechio-space-2, .5rem)}.orechio-billing-pix__codigo{word-break:break-all}.orechio-billing-pix__aviso{color:var(--orechio-color-text-muted, #666)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: PixPanelComponent, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{ selector: 'orechio-billing-pix', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
57
|
+
<div class="orechio-billing-pix">
|
|
58
|
+
<img data-qr [src]="'data:image/png;base64,' + pix().encodedImage" alt="QR Code PIX" width="240" height="240" />
|
|
59
|
+
|
|
60
|
+
<p>Ou copie o código PIX e cole no app do seu banco:</p>
|
|
61
|
+
<code class="orechio-billing-pix__codigo">{{ pix().payload }}</code>
|
|
62
|
+
<button type="button" data-copiar (click)="copiar()">
|
|
63
|
+
{{ copiado() ? 'Código copiado' : 'Copiar código' }}
|
|
64
|
+
</button>
|
|
65
|
+
@if (semAreaDeTransferencia()) {
|
|
66
|
+
<p class="orechio-billing-pix__aviso">Selecione o código acima e copie manualmente.</p>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@if (pix().expirationDate; as validade) {
|
|
70
|
+
<p class="orechio-billing-pix__aviso">Válido até {{ validadeDoPix(validade) }}.</p>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@if (invoiceUrl(); as url) {
|
|
74
|
+
<a data-invoice-url [href]="url" target="_blank" rel="noopener noreferrer">
|
|
75
|
+
Pagar pelo site do ASAAS
|
|
76
|
+
</a>
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
`, styles: [".orechio-billing-pix{display:flex;flex-direction:column;align-items:flex-start;gap:var(--orechio-space-2, .5rem)}.orechio-billing-pix__codigo{word-break:break-all}.orechio-billing-pix__aviso{color:var(--orechio-color-text-muted, #666)}\n"] }]
|
|
80
|
+
}], propDecorators: { pix: [{ type: i0.Input, args: [{ isSignal: true, alias: "pix", required: true }] }], invoiceUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "invoiceUrl", required: false }] }] } });
|
|
81
|
+
|
|
82
|
+
export { PixPanelComponent as P };
|
|
83
|
+
//# sourceMappingURL=orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs","sources":["../../../projects/platform-angular/billing/src/pix-panel.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, signal } from '@angular/core';\r\nimport { validadeDoPix } from './billing-format';\r\nimport { PixData } from './billing-models';\r\n\r\n/**\r\n * O QR e o copia-e-cola, como a Platform os devolveu. O `encodedImage` é PNG em base64\r\n * (ASAAS); o `payload` é o código que o app do banco aceita colado.\r\n */\r\n@Component({\r\n selector: 'orechio-billing-pix',\r\n standalone: true,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n template: `\r\n <div class=\"orechio-billing-pix\">\r\n <img data-qr [src]=\"'data:image/png;base64,' + pix().encodedImage\" alt=\"QR Code PIX\" width=\"240\" height=\"240\" />\r\n\r\n <p>Ou copie o código PIX e cole no app do seu banco:</p>\r\n <code class=\"orechio-billing-pix__codigo\">{{ pix().payload }}</code>\r\n <button type=\"button\" data-copiar (click)=\"copiar()\">\r\n {{ copiado() ? 'Código copiado' : 'Copiar código' }}\r\n </button>\r\n @if (semAreaDeTransferencia()) {\r\n <p class=\"orechio-billing-pix__aviso\">Selecione o código acima e copie manualmente.</p>\r\n }\r\n\r\n @if (pix().expirationDate; as validade) {\r\n <p class=\"orechio-billing-pix__aviso\">Válido até {{ validadeDoPix(validade) }}.</p>\r\n }\r\n\r\n @if (invoiceUrl(); as url) {\r\n <a data-invoice-url [href]=\"url\" target=\"_blank\" rel=\"noopener noreferrer\">\r\n Pagar pelo site do ASAAS\r\n </a>\r\n }\r\n </div>\r\n `,\r\n styles: `\r\n .orechio-billing-pix { display: flex; flex-direction: column; align-items: flex-start; gap: var(--orechio-space-2, 0.5rem); }\r\n .orechio-billing-pix__codigo { word-break: break-all; }\r\n .orechio-billing-pix__aviso { color: var(--orechio-color-text-muted, #666); }\r\n `,\r\n})\r\nexport class PixPanelComponent {\r\n readonly pix = input.required<PixData>();\r\n /** Página de pagamento do ASAAS, aberta em nova aba; sem ela, o link não aparece. */\r\n readonly invoiceUrl = input<string | null | undefined>(null);\r\n\r\n protected readonly validadeDoPix = validadeDoPix;\r\n protected readonly copiado = signal(false);\r\n protected readonly semAreaDeTransferencia = signal(false);\r\n\r\n protected copiar(): void {\r\n const areaDeTransferencia = globalThis.navigator?.clipboard;\r\n if (!areaDeTransferencia) {\r\n this.semAreaDeTransferencia.set(true);\r\n return;\r\n }\r\n\r\n areaDeTransferencia.writeText(this.pix().payload).then(\r\n () => this.copiado.set(true),\r\n () => this.semAreaDeTransferencia.set(true),\r\n );\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAIA;;;AAGG;MAmCU,iBAAiB,CAAA;IACnB,GAAG,GAAG,KAAK,CAAC,QAAQ;4EAAW;;IAE/B,UAAU,GAAG,KAAK,CAA4B,IAAI;mFAAC;IAEzC,aAAa,GAAG,aAAa;IAC7B,OAAO,GAAG,MAAM,CAAC,KAAK;gFAAC;IACvB,sBAAsB,GAAG,MAAM,CAAC,KAAK;+FAAC;IAE/C,MAAM,GAAA;AACd,QAAA,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS;QAC3D,IAAI,CAAC,mBAAmB,EAAE;AACxB,YAAA,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;YACrC;QACF;AAEA,QAAA,mBAAmB,C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