@orechio/platform-angular 0.5.0 → 0.7.1
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 +56 -0
- package/fesm2022/orechio-platform-angular-account-account-client-mPl0tzMg.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account-forgot-password.page-L-Z-s49p.mjs +136 -0
- 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-C8a1eU3L.mjs +121 -0
- package/fesm2022/orechio-platform-angular-account-initial-branch.page-C8a1eU3L.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account-resend-verification.page-C3lk1vNj.mjs +122 -0
- package/fesm2022/orechio-platform-angular-account-resend-verification.page-C3lk1vNj.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account-token-password.page-1vn5XGVu.mjs +181 -0
- package/fesm2022/orechio-platform-angular-account-token-password.page-1vn5XGVu.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account-verify-email.page-xulVDiOn.mjs +121 -0
- package/fesm2022/orechio-platform-angular-account-verify-email.page-xulVDiOn.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-account.mjs +106 -0
- package/fesm2022/orechio-platform-angular-account.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-billing-format-0nlddK-x.mjs +194 -0
- package/fesm2022/orechio-platform-angular-billing-billing-format-0nlddK-x.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs +186 -0
- package/fesm2022/orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs +136 -0
- package/fesm2022/orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs +105 -0
- package/fesm2022/orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs +81 -0
- package/fesm2022/orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-profile.page-Baa6uoM6.mjs +282 -0
- package/fesm2022/orechio-platform-angular-billing-profile.page-Baa6uoM6.mjs.map +1 -0
- package/fesm2022/orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs +160 -0
- package/fesm2022/orechio-platform-angular-billing-subscription.page-9NF8bWhu.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 +62 -62
- package/fesm2022/orechio-platform-angular.mjs.map +1 -1
- package/package.json +9 -1
- package/types/orechio-platform-angular-account.d.ts +97 -0
- package/types/orechio-platform-angular-billing.d.ts +32 -0
|
@@ -0,0 +1,160 @@
|
|
|
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 { d as data, B as BillingClient, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-0nlddK-x.mjs';
|
|
5
|
+
|
|
6
|
+
const DIA = 24 * 60 * 60 * 1000;
|
|
7
|
+
const EM_ABERTO = ['Created', 'Pending', 'Overdue'];
|
|
8
|
+
const emAtraso = (assinatura) => assinatura.status === 'Grace' || assinatura.status === 'Suspended';
|
|
9
|
+
/**
|
|
10
|
+
* A ação de cada estado segue o que a Platform aceita: o checkout serve `Trial`,
|
|
11
|
+
* `PendingPayment` e, desde a BILLING-2b, `Grace` e `Suspended` — mas só sem fatura aberta
|
|
12
|
+
* (`Created|Pending|Overdue`; com ela, `checkout.open_invoice_exists`). Em carência e suspensão
|
|
13
|
+
* a ação depende disso: fatura aberta → o detalhe dela; nenhuma → o checkout. Cancelada e
|
|
14
|
+
* expirada não têm ação de pagamento nesta versão: reativar é v2 (ADR-021 §3.5).
|
|
15
|
+
*/
|
|
16
|
+
function situacao(assinatura, agora, emAberto) {
|
|
17
|
+
const pagar = { texto: 'Pagar agora', link: 'checkout' };
|
|
18
|
+
const faturas = { texto: 'Ver faturas', link: 'invoices' };
|
|
19
|
+
const acaoDeAtraso = emAberto
|
|
20
|
+
? { texto: 'Pagar fatura em aberto', link: `invoices/${emAberto.id}` }
|
|
21
|
+
: { texto: 'Pagar', link: 'checkout' };
|
|
22
|
+
const orientacao = emAberto ? 'Pague a fatura em aberto' : 'Faça o pagamento';
|
|
23
|
+
switch (assinatura.status) {
|
|
24
|
+
case 'Trial': {
|
|
25
|
+
const dias = Math.max(0, Math.ceil((Date.parse(assinatura.trialEndsAt) - agora) / DIA));
|
|
26
|
+
const restante = dias === 0 ? 'O período de teste termina hoje.'
|
|
27
|
+
: dias === 1 ? 'Falta 1 dia para o fim do período de teste.'
|
|
28
|
+
: `Faltam ${dias} dias para o fim do período de teste.`;
|
|
29
|
+
return { titulo: 'Período de teste', detalhe: restante, acao: { texto: 'Assinar agora', link: 'checkout' } };
|
|
30
|
+
}
|
|
31
|
+
case 'PendingPayment':
|
|
32
|
+
return {
|
|
33
|
+
titulo: 'Pagamento pendente',
|
|
34
|
+
detalhe: 'A assinatura começa assim que o primeiro pagamento for confirmado.',
|
|
35
|
+
acao: pagar,
|
|
36
|
+
};
|
|
37
|
+
case 'Active':
|
|
38
|
+
return {
|
|
39
|
+
titulo: 'Assinatura ativa',
|
|
40
|
+
detalhe: assinatura.currentPeriodEndsAt
|
|
41
|
+
? `Próxima renovação em ${data(assinatura.currentPeriodEndsAt)}.`
|
|
42
|
+
: 'Tudo em dia.',
|
|
43
|
+
acao: faturas,
|
|
44
|
+
};
|
|
45
|
+
case 'Grace':
|
|
46
|
+
return {
|
|
47
|
+
titulo: 'Pagamento em atraso',
|
|
48
|
+
detalhe: assinatura.graceEndsAt
|
|
49
|
+
? `O acesso continua até ${data(assinatura.graceEndsAt)}. ${orientacao} para não ter o acesso suspenso.`
|
|
50
|
+
: `${orientacao} para não ter o acesso suspenso.`,
|
|
51
|
+
acao: acaoDeAtraso,
|
|
52
|
+
};
|
|
53
|
+
case 'Suspended':
|
|
54
|
+
return {
|
|
55
|
+
titulo: 'Assinatura suspensa',
|
|
56
|
+
detalhe: `O acesso foi suspenso por falta de pagamento. ${orientacao} para voltar a usar.`,
|
|
57
|
+
acao: acaoDeAtraso,
|
|
58
|
+
};
|
|
59
|
+
case 'Cancelled':
|
|
60
|
+
return {
|
|
61
|
+
titulo: 'Assinatura cancelada',
|
|
62
|
+
detalhe: assinatura.cancelEffectiveAt
|
|
63
|
+
? `O cancelamento vale a partir de ${data(assinatura.cancelEffectiveAt)}. Para reativar, fale com o suporte.`
|
|
64
|
+
: 'Para reativar, fale com o suporte.',
|
|
65
|
+
acao: faturas,
|
|
66
|
+
};
|
|
67
|
+
case 'Expired':
|
|
68
|
+
return {
|
|
69
|
+
titulo: 'Assinatura expirada',
|
|
70
|
+
detalhe: 'Para voltar a assinar, fale com o suporte.',
|
|
71
|
+
acao: faturas,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class SubscriptionPage {
|
|
76
|
+
client = inject(BillingClient);
|
|
77
|
+
assinatura = signal(null, /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "assinatura" }] : /* istanbul ignore next */ []));
|
|
79
|
+
/** Só preenchido em Grace/Suspended: `undefined` = ainda não respondeu; `null` = nenhuma aberta. */
|
|
80
|
+
emAberto = signal(undefined, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "emAberto" }] : /* istanbul ignore next */ []));
|
|
82
|
+
erro = signal(null, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "erro" }] : /* istanbul ignore next */ []));
|
|
84
|
+
atual = computed(() => {
|
|
85
|
+
const assinatura = this.assinatura();
|
|
86
|
+
if (!assinatura)
|
|
87
|
+
return null;
|
|
88
|
+
const aberta = this.emAberto();
|
|
89
|
+
// Sem a resposta das faturas não se sabe o destino da ação: não se adivinha.
|
|
90
|
+
if (emAtraso(assinatura) && aberta === undefined)
|
|
91
|
+
return null;
|
|
92
|
+
return situacao(assinatura, Date.now(), aberta ?? null);
|
|
93
|
+
}, /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "atual" }] : /* istanbul ignore next */ []));
|
|
95
|
+
ngOnInit() {
|
|
96
|
+
this.client.getSubscription().subscribe({
|
|
97
|
+
next: (assinatura) => {
|
|
98
|
+
this.assinatura.set(assinatura);
|
|
99
|
+
if (emAtraso(assinatura))
|
|
100
|
+
this.buscarFaturaEmAberto();
|
|
101
|
+
},
|
|
102
|
+
error: (problema) => this.erro.set(problema),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
buscarFaturaEmAberto() {
|
|
106
|
+
this.client.listInvoices().subscribe({
|
|
107
|
+
next: (pagina) => this.emAberto.set(pagina.invoices.find((f) => EM_ABERTO.includes(f.status)) ?? null),
|
|
108
|
+
error: (problema) => this.erro.set(problema),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: SubscriptionPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
112
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: SubscriptionPage, isStandalone: true, selector: "orechio-billing-subscription", ngImport: i0, template: `
|
|
113
|
+
<section class="orechio-billing">
|
|
114
|
+
<h1>Assinatura</h1>
|
|
115
|
+
|
|
116
|
+
@if (erro(); as problema) {
|
|
117
|
+
<orechio-billing-error [problema]="problema" />
|
|
118
|
+
} @else if (atual(); as s) {
|
|
119
|
+
<h2>{{ s.titulo }}</h2>
|
|
120
|
+
<p>{{ s.detalhe }}</p>
|
|
121
|
+
<a data-acao [routerLink]="s.acao.link">{{ s.acao.texto }}</a>
|
|
122
|
+
|
|
123
|
+
<nav class="orechio-billing__muted">
|
|
124
|
+
<a routerLink="profile">Dados de cobrança</a>
|
|
125
|
+
·
|
|
126
|
+
<a routerLink="invoices">Faturas</a>
|
|
127
|
+
</nav>
|
|
128
|
+
} @else {
|
|
129
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
130
|
+
}
|
|
131
|
+
</section>
|
|
132
|
+
`, 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)}\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 });
|
|
133
|
+
}
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: SubscriptionPage, decorators: [{
|
|
135
|
+
type: Component,
|
|
136
|
+
args: [{ selector: 'orechio-billing-subscription', standalone: true, imports: [RouterLink, BillingErrorComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
137
|
+
<section class="orechio-billing">
|
|
138
|
+
<h1>Assinatura</h1>
|
|
139
|
+
|
|
140
|
+
@if (erro(); as problema) {
|
|
141
|
+
<orechio-billing-error [problema]="problema" />
|
|
142
|
+
} @else if (atual(); as s) {
|
|
143
|
+
<h2>{{ s.titulo }}</h2>
|
|
144
|
+
<p>{{ s.detalhe }}</p>
|
|
145
|
+
<a data-acao [routerLink]="s.acao.link">{{ s.acao.texto }}</a>
|
|
146
|
+
|
|
147
|
+
<nav class="orechio-billing__muted">
|
|
148
|
+
<a routerLink="profile">Dados de cobrança</a>
|
|
149
|
+
·
|
|
150
|
+
<a routerLink="invoices">Faturas</a>
|
|
151
|
+
</nav>
|
|
152
|
+
} @else {
|
|
153
|
+
<p class="orechio-billing__muted">Carregando…</p>
|
|
154
|
+
}
|
|
155
|
+
</section>
|
|
156
|
+
`, 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)}\n"] }]
|
|
157
|
+
}] });
|
|
158
|
+
|
|
159
|
+
export { SubscriptionPage };
|
|
160
|
+
//# sourceMappingURL=orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs","sources":["../../../projects/platform-angular/billing/src/pages/subscription.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, data } from '../billing-format';\r\nimport { InvoiceListItem, InvoiceStatus, Subscription } from '../billing-models';\r\n\r\nconst DIA = 24 * 60 * 60 * 1000;\r\nconst EM_ABERTO: InvoiceStatus[] = ['Created', 'Pending', 'Overdue'];\r\n\r\nconst emAtraso = (assinatura: Subscription) =>\r\n assinatura.status === 'Grace' || assinatura.status === 'Suspended';\r\n\r\ninterface Situacao {\r\n titulo: string;\r\n detalhe: string;\r\n acao: { texto: string; link: string };\r\n}\r\n\r\n/**\r\n * A ação de cada estado segue o que a Platform aceita: o checkout serve `Trial`,\r\n * `PendingPayment` e, desde a BILLING-2b, `Grace` e `Suspended` — mas só sem fatura aberta\r\n * (`Created|Pending|Overdue`; com ela, `checkout.open_invoice_exists`). Em carência e suspensão\r\n * a ação depende disso: fatura aberta → o detalhe dela; nenhuma → o checkout. Cancelada e\r\n * expirada não têm ação de pagamento nesta versão: reativar é v2 (ADR-021 §3.5).\r\n */\r\nfunction situacao(assinatura: Subscription, agora: number, emAberto: InvoiceListItem | null): Situacao {\r\n const pagar = { texto: 'Pagar agora', link: 'checkout' };\r\n const faturas = { texto: 'Ver faturas', link: 'invoices' };\r\n const acaoDeAtraso = emAberto\r\n ? { texto: 'Pagar fatura em aberto', link: `invoices/${emAberto.id}` }\r\n : { texto: 'Pagar', link: 'checkout' };\r\n const orientacao = emAberto ? 'Pague a fatura em aberto' : 'Faça o pagamento';\r\n\r\n switch (assinatura.status) {\r\n case 'Trial': {\r\n const dias = Math.max(0, Math.ceil((Date.parse(assinatura.trialEndsAt) - agora) / DIA));\r\n const restante =\r\n dias === 0 ? 'O período de teste termina hoje.'\r\n : dias === 1 ? 'Falta 1 dia para o fim do período de teste.'\r\n : `Faltam ${dias} dias para o fim do período de teste.`;\r\n return { titulo: 'Período de teste', detalhe: restante, acao: { texto: 'Assinar agora', link: 'checkout' } };\r\n }\r\n case 'PendingPayment':\r\n return {\r\n titulo: 'Pagamento pendente',\r\n detalhe: 'A assinatura começa assim que o primeiro pagamento for confirmado.',\r\n acao: pagar,\r\n };\r\n case 'Active':\r\n return {\r\n titulo: 'Assinatura ativa',\r\n detalhe: assinatura.currentPeriodEndsAt\r\n ? `Próxima renovação em ${data(assinatura.currentPeriodEndsAt)}.`\r\n : 'Tudo em dia.',\r\n acao: faturas,\r\n };\r\n case 'Grace':\r\n return {\r\n titulo: 'Pagamento em atraso',\r\n detalhe: assinatura.graceEndsAt\r\n ? `O acesso continua até ${data(assinatura.graceEndsAt)}. ${orientacao} para não ter o acesso suspenso.`\r\n : `${orientacao} para não ter o acesso suspenso.`,\r\n acao: acaoDeAtraso,\r\n };\r\n case 'Suspended':\r\n return {\r\n titulo: 'Assinatura suspensa',\r\n detalhe: `O acesso foi suspenso por falta de pagamento. ${orientacao} para voltar a usar.`,\r\n acao: acaoDeAtraso,\r\n };\r\n case 'Cancelled':\r\n return {\r\n titulo: 'Assinatura cancelada',\r\n detalhe: assinatura.cancelEffectiveAt\r\n ? `O cancelamento vale a partir de ${data(assinatura.cancelEffectiveAt)}. Para reativar, fale com o suporte.`\r\n : 'Para reativar, fale com o suporte.',\r\n acao: faturas,\r\n };\r\n case 'Expired':\r\n return {\r\n titulo: 'Assinatura expirada',\r\n detalhe: 'Para voltar a assinar, fale com o suporte.',\r\n acao: faturas,\r\n };\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'orechio-billing-subscription',\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>Assinatura</h1>\r\n\r\n @if (erro(); as problema) {\r\n <orechio-billing-error [problema]=\"problema\" />\r\n } @else if (atual(); as s) {\r\n <h2>{{ s.titulo }}</h2>\r\n <p>{{ s.detalhe }}</p>\r\n <a data-acao [routerLink]=\"s.acao.link\">{{ s.acao.texto }}</a>\r\n\r\n <nav class=\"orechio-billing__muted\">\r\n <a routerLink=\"profile\">Dados de cobrança</a>\r\n ·\r\n <a routerLink=\"invoices\">Faturas</a>\r\n </nav>\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 SubscriptionPage implements OnInit {\r\n private readonly client = inject(BillingClient);\r\n\r\n private readonly assinatura = signal<Subscription | null>(null);\r\n /** Só preenchido em Grace/Suspended: `undefined` = ainda não respondeu; `null` = nenhuma aberta. */\r\n private readonly emAberto = signal<InvoiceListItem | null | undefined>(undefined);\r\n protected readonly erro = signal<ProblemDetails | null>(null);\r\n protected readonly atual = computed(() => {\r\n const assinatura = this.assinatura();\r\n if (!assinatura) return null;\r\n\r\n const aberta = this.emAberto();\r\n // Sem a resposta das faturas não se sabe o destino da ação: não se adivinha.\r\n if (emAtraso(assinatura) && aberta === undefined) return null;\r\n\r\n return situacao(assinatura, Date.now(), aberta ?? null);\r\n });\r\n\r\n ngOnInit(): void {\r\n this.client.getSubscription().subscribe({\r\n next: (assinatura) => {\r\n this.assinatura.set(assinatura);\r\n if (emAtraso(assinatura)) this.buscarFaturaEmAberto();\r\n },\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n\r\n private buscarFaturaEmAberto(): void {\r\n this.client.listInvoices().subscribe({\r\n next: (pagina) => this.emAberto.set(pagina.invoices.find((f) => EM_ABERTO.includes(f.status)) ?? null),\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAQA,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAC/B,MAAM,SAAS,GAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;AAEpE,MAAM,QAAQ,GAAG,CAAC,UAAwB,KACxC,UAAU,CAAC,MAAM,KAAK,OAAO,IAAI,UAAU,CAAC,MAAM,KAAK,WAAW;AAQpE;;;;;;AAMG;AACH,SAAS,QAAQ,CAAC,UAAwB,EAAE,KAAa,EAAE,QAAgC,EAAA;IACzF,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE;IACxD,MAAM,OAAO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B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAvBjB,CAAA;;;;;;;;;;;;;;;;;;;;GAoBT,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAtBS,UAAU,kPAAE,qBAAqB,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAyBhC,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBA5B5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,8BAA8B,EAAA,UAAA,EAC5B,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAA,eAAA,EAC3B,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,CAAA;;;;;;;;;;;;;;;;;;;;AAoBT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
const ORECHIO_BILLING_CONFIG = new InjectionToken('ORECHIO_BILLING_CONFIG');
|
|
4
|
+
function provideOrechioBilling(options = {}) {
|
|
5
|
+
const bruto = options.basePath ?? '/api/billing';
|
|
6
|
+
// Mesma regra do `BillingRoutePrefix` do BFF, no mesmo momento: na composição. Uma URL
|
|
7
|
+
// absoluta aqui levaria a cobrança para fora do domínio do produto, onde o cookie de sessão
|
|
8
|
+
// não vai junto.
|
|
9
|
+
if (!bruto.startsWith('/') || bruto.startsWith('//')) {
|
|
10
|
+
throw new Error(`provideOrechioBilling: \`basePath\` precisa ser um caminho same-origin começando com '/': '${bruto}'.`);
|
|
11
|
+
}
|
|
12
|
+
const config = { basePath: bruto.replace(/\/+$/, '') };
|
|
13
|
+
return [{ provide: ORECHIO_BILLING_CONFIG, useValue: config }];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* As rotas de cobrança. O host as monta em `/billing` — é para lá que os e-mails de cobrança
|
|
18
|
+
* da Platform apontam (`{base}/billing`, ADR-021 §3.2):
|
|
19
|
+
*
|
|
20
|
+
* <pre>
|
|
21
|
+
* { path: 'billing', children: ORECHIO_BILLING_ROUTES }
|
|
22
|
+
* </pre>
|
|
23
|
+
*
|
|
24
|
+
* Os caminhos ENTRE as telas são fixos (a situação leva a `checkout` e `invoices`, o
|
|
25
|
+
* pagamento sem perfil leva a `profile`). Todas com `loadComponent`, como as de conta.
|
|
26
|
+
*/
|
|
27
|
+
const ORECHIO_BILLING_ROUTES = [
|
|
28
|
+
{
|
|
29
|
+
path: '',
|
|
30
|
+
pathMatch: 'full',
|
|
31
|
+
title: 'Assinatura',
|
|
32
|
+
loadComponent: () => import('./orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs').then((m) => m.SubscriptionPage),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
path: 'profile',
|
|
36
|
+
title: 'Dados de cobrança',
|
|
37
|
+
loadComponent: () => import('./orechio-platform-angular-billing-profile.page-Baa6uoM6.mjs').then((m) => m.ProfilePage),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: 'checkout',
|
|
41
|
+
title: 'Pagar assinatura',
|
|
42
|
+
loadComponent: () => import('./orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs').then((m) => m.CheckoutPage),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
path: 'invoices',
|
|
46
|
+
title: 'Faturas',
|
|
47
|
+
loadComponent: () => import('./orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs').then((m) => m.InvoicesPage),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
path: 'invoices/:id',
|
|
51
|
+
title: 'Fatura',
|
|
52
|
+
loadComponent: () => import('./orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs').then((m) => m.InvoicePage),
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Public API Surface of @orechio/platform-angular/billing
|
|
58
|
+
*
|
|
59
|
+
* BILLING-3 — as telas de cobrança do titular (ADR-021 §3.5). Mesmo contrato do entry
|
|
60
|
+
* `account`: `BillingClient` e as páginas NÃO são exportados. As telas são alcançadas por
|
|
61
|
+
* `ORECHIO_BILLING_ROUTES`, e os caminhos entre elas só valem montados juntos.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generated bundle index. Do not edit.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export { ORECHIO_BILLING_CONFIG, ORECHIO_BILLING_ROUTES, provideOrechioBilling };
|
|
69
|
+
//# sourceMappingURL=orechio-platform-angular-billing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orechio-platform-angular-billing.mjs","sources":["../../../projects/platform-angular/billing/src/billing-config.ts","../../../projects/platform-angular/billing/src/billing.routes.ts","../../../projects/platform-angular/billing/src/public-api.ts","../../../projects/platform-angular/billing/src/orechio-platform-angular-billing.ts"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\r\n\r\nexport interface OrechioBillingConfig {\r\n /**\r\n * Prefixo do BFF de cobrança (`MapOrechioBillingEndpoints`), same-origin. O BFF lê a sessão\r\n * do host e fala com a Platform; o browser nunca vê token nem fala com a Platform.\r\n */\r\n basePath: string;\r\n}\r\n\r\nexport const ORECHIO_BILLING_CONFIG = new InjectionToken<OrechioBillingConfig>(\r\n 'ORECHIO_BILLING_CONFIG',\r\n);\r\n\r\nexport interface OrechioBillingOptions {\r\n /** Default `/api/billing`, o mesmo `BillingRoutePrefix` default do BFF. */\r\n basePath?: string;\r\n}\r\n\r\nexport function provideOrechioBilling(options: OrechioBillingOptions = {}): Provider[] {\r\n const bruto = options.basePath ?? '/api/billing';\r\n\r\n // Mesma regra do `BillingRoutePrefix` do BFF, no mesmo momento: na composição. Uma URL\r\n // absoluta aqui levaria a cobrança para fora do domínio do produto, onde o cookie de sessão\r\n // não vai junto.\r\n if (!bruto.startsWith('/') || bruto.startsWith('//')) {\r\n throw new Error(\r\n `provideOrechioBilling: \\`basePath\\` precisa ser um caminho same-origin começando com '/': '${bruto}'.`,\r\n );\r\n }\r\n\r\n const config: OrechioBillingConfig = { basePath: bruto.replace(/\\/+$/, '') };\r\n return [{ provide: ORECHIO_BILLING_CONFIG, useValue: config }];\r\n}\r\n","import { Routes } from '@angular/router';\r\n\r\n/**\r\n * As rotas de cobrança. O host as monta em `/billing` — é para lá que os e-mails de cobrança\r\n * da Platform apontam (`{base}/billing`, ADR-021 §3.2):\r\n *\r\n * <pre>\r\n * { path: 'billing', children: ORECHIO_BILLING_ROUTES }\r\n * </pre>\r\n *\r\n * Os caminhos ENTRE as telas são fixos (a situação leva a `checkout` e `invoices`, o\r\n * pagamento sem perfil leva a `profile`). Todas com `loadComponent`, como as de conta.\r\n */\r\nexport const ORECHIO_BILLING_ROUTES: Routes = [\r\n {\r\n path: '',\r\n pathMatch: 'full',\r\n title: 'Assinatura',\r\n loadComponent: () => import('./pages/subscription.page').then((m) => m.SubscriptionPage),\r\n },\r\n {\r\n path: 'profile',\r\n title: 'Dados de cobrança',\r\n loadComponent: () => import('./pages/profile.page').then((m) => m.ProfilePage),\r\n },\r\n {\r\n path: 'checkout',\r\n title: 'Pagar assinatura',\r\n loadComponent: () => import('./pages/checkout.page').then((m) => m.CheckoutPage),\r\n },\r\n {\r\n path: 'invoices',\r\n title: 'Faturas',\r\n loadComponent: () => import('./pages/invoices.page').then((m) => m.InvoicesPage),\r\n },\r\n {\r\n path: 'invoices/:id',\r\n title: 'Fatura',\r\n loadComponent: () => import('./pages/invoice.page').then((m) => m.InvoicePage),\r\n },\r\n];\r\n","/*\r\n * Public API Surface of @orechio/platform-angular/billing\r\n *\r\n * BILLING-3 — as telas de cobrança do titular (ADR-021 §3.5). Mesmo contrato do entry\r\n * `account`: `BillingClient` e as páginas NÃO são exportados. As telas são alcançadas por\r\n * `ORECHIO_BILLING_ROUTES`, e os caminhos entre elas só valem montados juntos.\r\n */\r\n\r\nexport type { OrechioBillingConfig, OrechioBillingOptions } from './billing-config';\r\nexport { ORECHIO_BILLING_CONFIG, provideOrechioBilling } from './billing-config';\r\n\r\nexport { ORECHIO_BILLING_ROUTES } from './billing.routes';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAUa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB;AAQpB,SAAU,qBAAqB,CAAC,OAAA,GAAiC,EAAE,EAAA;AACvE,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,IAAI,cAAc;;;;AAKhD,IAAA,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AACpD,QAAA,MAAM,IAAI,KAAK,CACb,8FAA8F,KAAK,CAAA,EAAA,CAAI,CACxG;IACH;AAEA,IAAA,MAAM,MAAM,GAAyB,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;IAC5E,OAAO,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAChE;;AC/BA;;;;;;;;;;AAUG;AACI,MAAM,sBAAsB,GAAW;AAC5C,IAAA;AACE,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,SAAS,EAAE,MAAM;AACjB,QAAA,KAAK,EAAE,YAAY;AACnB,QAAA,aAAa,EAAE,MAAM,OAAO,mEAA2B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC;AACzF,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,mBAAmB;AAC1B,QAAA,aAAa,EAAE,MAAM,OAAO,8DAAsB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC;AAC/E,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,kBAAkB;AACzB,QAAA,aAAa,EAAE,MAAM,OAAO,+DAAuB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC;AACjF,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,aAAa,EAAE,MAAM,OAAO,+DAAuB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC;AACjF,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,aAAa,EAAE,MAAM,OAAO,8DAAsB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC;AAC/E,KAAA;;;ACvCH;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
@@ -252,37 +252,37 @@ class BranchSelector {
|
|
|
252
252
|
return branch.id.slice(0, 8);
|
|
253
253
|
}
|
|
254
254
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: BranchSelector, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
255
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: BranchSelector, isStandalone: true, selector: "orechio-branch-selector", inputs: { branches: { classPropertyName: "branches", publicName: "branches", isSignal: true, isRequired: true, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null }, confirmLabel: { classPropertyName: "confirmLabel", publicName: "confirmLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, ngImport: i0, template: `
|
|
256
|
-
@if (branches().length === 0) {
|
|
257
|
-
<p class="orechio-branch-selector__empty" role="status">{{ emptyLabel() }}</p>
|
|
258
|
-
} @else {
|
|
259
|
-
<fieldset class="orechio-branch-selector" [disabled]="busy()">
|
|
260
|
-
<legend>{{ legend() }}</legend>
|
|
261
|
-
|
|
262
|
-
@for (branch of branches(); track branch.id; let index = $index) {
|
|
263
|
-
<label class="orechio-branch-selector__option">
|
|
264
|
-
<input
|
|
265
|
-
type="radio"
|
|
266
|
-
name="orechio-branch"
|
|
267
|
-
[value]="branch.id"
|
|
268
|
-
[checked]="chosen === branch.id"
|
|
269
|
-
(change)="choose(branch.id)"
|
|
270
|
-
/>
|
|
271
|
-
<span class="orechio-branch-selector__label">{{ label(branch, index) }}</span>
|
|
272
|
-
<span class="orechio-branch-selector__hint">{{ fragment(branch) }}</span>
|
|
273
|
-
</label>
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
<button
|
|
277
|
-
type="button"
|
|
278
|
-
class="orechio-branch-selector__confirm"
|
|
279
|
-
[disabled]="!chosen || busy()"
|
|
280
|
-
(click)="confirm()"
|
|
281
|
-
>
|
|
282
|
-
{{ confirmLabel() }}
|
|
283
|
-
</button>
|
|
284
|
-
</fieldset>
|
|
285
|
-
}
|
|
255
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: BranchSelector, isStandalone: true, selector: "orechio-branch-selector", inputs: { branches: { classPropertyName: "branches", publicName: "branches", isSignal: true, isRequired: true, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null }, confirmLabel: { classPropertyName: "confirmLabel", publicName: "confirmLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, ngImport: i0, template: `
|
|
256
|
+
@if (branches().length === 0) {
|
|
257
|
+
<p class="orechio-branch-selector__empty" role="status">{{ emptyLabel() }}</p>
|
|
258
|
+
} @else {
|
|
259
|
+
<fieldset class="orechio-branch-selector" [disabled]="busy()">
|
|
260
|
+
<legend>{{ legend() }}</legend>
|
|
261
|
+
|
|
262
|
+
@for (branch of branches(); track branch.id; let index = $index) {
|
|
263
|
+
<label class="orechio-branch-selector__option">
|
|
264
|
+
<input
|
|
265
|
+
type="radio"
|
|
266
|
+
name="orechio-branch"
|
|
267
|
+
[value]="branch.id"
|
|
268
|
+
[checked]="chosen === branch.id"
|
|
269
|
+
(change)="choose(branch.id)"
|
|
270
|
+
/>
|
|
271
|
+
<span class="orechio-branch-selector__label">{{ label(branch, index) }}</span>
|
|
272
|
+
<span class="orechio-branch-selector__hint">{{ fragment(branch) }}</span>
|
|
273
|
+
</label>
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
<button
|
|
277
|
+
type="button"
|
|
278
|
+
class="orechio-branch-selector__confirm"
|
|
279
|
+
[disabled]="!chosen || busy()"
|
|
280
|
+
(click)="confirm()"
|
|
281
|
+
>
|
|
282
|
+
{{ confirmLabel() }}
|
|
283
|
+
</button>
|
|
284
|
+
</fieldset>
|
|
285
|
+
}
|
|
286
286
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
287
287
|
}
|
|
288
288
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: BranchSelector, decorators: [{
|
|
@@ -290,37 +290,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
290
290
|
args: [{
|
|
291
291
|
selector: 'orechio-branch-selector',
|
|
292
292
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
293
|
-
template: `
|
|
294
|
-
@if (branches().length === 0) {
|
|
295
|
-
<p class="orechio-branch-selector__empty" role="status">{{ emptyLabel() }}</p>
|
|
296
|
-
} @else {
|
|
297
|
-
<fieldset class="orechio-branch-selector" [disabled]="busy()">
|
|
298
|
-
<legend>{{ legend() }}</legend>
|
|
299
|
-
|
|
300
|
-
@for (branch of branches(); track branch.id; let index = $index) {
|
|
301
|
-
<label class="orechio-branch-selector__option">
|
|
302
|
-
<input
|
|
303
|
-
type="radio"
|
|
304
|
-
name="orechio-branch"
|
|
305
|
-
[value]="branch.id"
|
|
306
|
-
[checked]="chosen === branch.id"
|
|
307
|
-
(change)="choose(branch.id)"
|
|
308
|
-
/>
|
|
309
|
-
<span class="orechio-branch-selector__label">{{ label(branch, index) }}</span>
|
|
310
|
-
<span class="orechio-branch-selector__hint">{{ fragment(branch) }}</span>
|
|
311
|
-
</label>
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
<button
|
|
315
|
-
type="button"
|
|
316
|
-
class="orechio-branch-selector__confirm"
|
|
317
|
-
[disabled]="!chosen || busy()"
|
|
318
|
-
(click)="confirm()"
|
|
319
|
-
>
|
|
320
|
-
{{ confirmLabel() }}
|
|
321
|
-
</button>
|
|
322
|
-
</fieldset>
|
|
323
|
-
}
|
|
293
|
+
template: `
|
|
294
|
+
@if (branches().length === 0) {
|
|
295
|
+
<p class="orechio-branch-selector__empty" role="status">{{ emptyLabel() }}</p>
|
|
296
|
+
} @else {
|
|
297
|
+
<fieldset class="orechio-branch-selector" [disabled]="busy()">
|
|
298
|
+
<legend>{{ legend() }}</legend>
|
|
299
|
+
|
|
300
|
+
@for (branch of branches(); track branch.id; let index = $index) {
|
|
301
|
+
<label class="orechio-branch-selector__option">
|
|
302
|
+
<input
|
|
303
|
+
type="radio"
|
|
304
|
+
name="orechio-branch"
|
|
305
|
+
[value]="branch.id"
|
|
306
|
+
[checked]="chosen === branch.id"
|
|
307
|
+
(change)="choose(branch.id)"
|
|
308
|
+
/>
|
|
309
|
+
<span class="orechio-branch-selector__label">{{ label(branch, index) }}</span>
|
|
310
|
+
<span class="orechio-branch-selector__hint">{{ fragment(branch) }}</span>
|
|
311
|
+
</label>
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
<button
|
|
315
|
+
type="button"
|
|
316
|
+
class="orechio-branch-selector__confirm"
|
|
317
|
+
[disabled]="!chosen || busy()"
|
|
318
|
+
(click)="confirm()"
|
|
319
|
+
>
|
|
320
|
+
{{ confirmLabel() }}
|
|
321
|
+
</button>
|
|
322
|
+
</fieldset>
|
|
323
|
+
}
|
|
324
324
|
`,
|
|
325
325
|
}]
|
|
326
326
|
}], propDecorators: { branches: [{ type: i0.Input, args: [{ isSignal: true, alias: "branches", required: true }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], legend: [{ type: i0.Input, args: [{ isSignal: true, alias: "legend", required: false }] }], confirmLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirmLabel", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }] } });
|