@orechio/platform-angular 0.7.1 → 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.
Files changed (23) hide show
  1. package/fesm2022/{orechio-platform-angular-billing-billing-format-0nlddK-x.mjs → orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs} +111 -2
  2. package/fesm2022/orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs.map +1 -0
  3. package/fesm2022/{orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs → orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs} +5 -5
  4. package/fesm2022/{orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs.map → orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs.map} +1 -1
  5. package/fesm2022/{orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs → orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs} +5 -5
  6. package/fesm2022/{orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs.map → orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs.map} +1 -1
  7. package/fesm2022/{orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs → orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs} +4 -4
  8. package/fesm2022/{orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs.map → orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs.map} +1 -1
  9. package/fesm2022/{orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs → orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs} +5 -3
  10. package/fesm2022/orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs.map +1 -0
  11. package/fesm2022/{orechio-platform-angular-billing-profile.page-Baa6uoM6.mjs → orechio-platform-angular-billing-profile.page-DHjsB3jJ.mjs} +50 -23
  12. package/fesm2022/orechio-platform-angular-billing-profile.page-DHjsB3jJ.mjs.map +1 -0
  13. package/fesm2022/{orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs → orechio-platform-angular-billing-subscription.page-Cotupt22.mjs} +6 -6
  14. package/fesm2022/orechio-platform-angular-billing-subscription.page-Cotupt22.mjs.map +1 -0
  15. package/fesm2022/orechio-platform-angular-billing.mjs +5 -5
  16. package/fesm2022/orechio-platform-angular.mjs +8 -4
  17. package/fesm2022/orechio-platform-angular.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/types/orechio-platform-angular.d.ts +8 -4
  20. package/fesm2022/orechio-platform-angular-billing-billing-format-0nlddK-x.mjs.map +0 -1
  21. package/fesm2022/orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs.map +0 -1
  22. package/fesm2022/orechio-platform-angular-billing-profile.page-Baa6uoM6.mjs.map +0 -1
  23. package/fesm2022/orechio-platform-angular-billing-subscription.page-9NF8bWhu.mjs.map +0 -1
@@ -166,6 +166,101 @@ function moeda(valor) {
166
166
  function data(iso) {
167
167
  return iso ? new Date(iso).toLocaleDateString('pt-BR') : '';
168
168
  }
169
+ const FUSO_DE_BRASILIA = 'America/Sao_Paulo';
170
+ const SUFIXO_DE_BRASILIA = '(horário de Brasília)';
171
+ /** "AAAA-MM-DD HH:mm[:ss]" — o `expirationDate` do ASAAS: sem fuso, já em horário de Brasília. */
172
+ const SEM_FUSO = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/;
173
+ /** O mesmo, com fuso explícito: `Z` ou `±hh:mm` / `±hhmm`. */
174
+ const COM_FUSO = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
175
+ /**
176
+ * A validade do PIX para a tela: "02/10/2026 às 23:59 (horário de Brasília)".
177
+ *
178
+ * O valor do ASAAS NÃO passa por `new Date()`: sem fuso, o construtor o leria no fuso do
179
+ * navegador e a hora exibida se deslocaria. Ele é formatado por PARTES DO TEXTO. Só o valor
180
+ * com fuso explícito é convertido (para America/Sao_Paulo). Formato não reconhecido volta como
181
+ * veio — nunca "Invalid Date".
182
+ */
183
+ function validadeDoPix(valor) {
184
+ const texto = valor.trim();
185
+ const semFuso = SEM_FUSO.exec(texto);
186
+ if (semFuso) {
187
+ const [, ano, mes, dia, hora, minuto] = semFuso;
188
+ return dataValida(+ano, +mes, +dia, +hora, +minuto)
189
+ ? `${dia}/${mes}/${ano} às ${hora}:${minuto} ${SUFIXO_DE_BRASILIA}`
190
+ : valor;
191
+ }
192
+ if (COM_FUSO.test(texto)) {
193
+ const instante = new Date(texto.replace(' ', 'T'));
194
+ if (Number.isNaN(instante.getTime()))
195
+ return valor;
196
+ const partes = Object.fromEntries(new Intl.DateTimeFormat('pt-BR', {
197
+ timeZone: FUSO_DE_BRASILIA,
198
+ day: '2-digit',
199
+ month: '2-digit',
200
+ year: 'numeric',
201
+ hour: '2-digit',
202
+ minute: '2-digit',
203
+ hourCycle: 'h23',
204
+ })
205
+ .formatToParts(instante)
206
+ .map((parte) => [parte.type, parte.value]));
207
+ return `${partes['day']}/${partes['month']}/${partes['year']} às ${partes['hour']}:${partes['minute']} ${SUFIXO_DE_BRASILIA}`;
208
+ }
209
+ return valor;
210
+ }
211
+ function dataValida(ano, mes, dia, hora, minuto) {
212
+ if (mes < 1 || mes > 12 || hora > 23 || minuto > 59 || dia < 1)
213
+ return false;
214
+ return dia <= new Date(Date.UTC(ano, mes, 0)).getUTCDate();
215
+ }
216
+ // ── máscaras (perfil de cobrança) ────────────────────────────────────────────
217
+ function soDigitos(valor) {
218
+ return valor.replace(/\D/g, '');
219
+ }
220
+ /** Junta os grupos de dígitos com os separadores, parando no primeiro grupo vazio. */
221
+ function agrupar(digitos, grupos, separadores) {
222
+ let saida = '';
223
+ let posicao = 0;
224
+ for (let i = 0; i < grupos.length; i++) {
225
+ const grupo = digitos.slice(posicao, posicao + grupos[i]);
226
+ if (!grupo)
227
+ break;
228
+ saida += (i === 0 ? '' : separadores[i - 1]) + grupo;
229
+ posicao += grupos[i];
230
+ }
231
+ return saida;
232
+ }
233
+ /** CPF `000.000.000-00`, progressivo enquanto se digita. */
234
+ function mascararCpf(valor) {
235
+ return agrupar(soDigitos(valor).slice(0, 11), [3, 3, 3, 2], ['.', '.', '-']);
236
+ }
237
+ /** CNPJ `00.000.000/0000-00`, progressivo enquanto se digita. */
238
+ function mascararCnpj(valor) {
239
+ return agrupar(soDigitos(valor).slice(0, 14), [2, 3, 3, 4, 2], ['.', '.', '/', '-']);
240
+ }
241
+ /** O documento conforme o tipo escolhido. */
242
+ function mascararDocumento(tipo, valor) {
243
+ return tipo === 'Cpf' ? mascararCpf(valor) : mascararCnpj(valor);
244
+ }
245
+ /** CEP `00000-000`. */
246
+ function mascararCep(valor) {
247
+ return agrupar(soDigitos(valor).slice(0, 8), [5, 3], ['-']);
248
+ }
249
+ /** Telefone `(00) 0000-0000` (10 dígitos) ou celular `(00) 00000-0000` (11). */
250
+ function mascararTelefone(valor) {
251
+ const digitos = soDigitos(valor).slice(0, 11);
252
+ if (!digitos)
253
+ return '';
254
+ const ddd = digitos.slice(0, 2);
255
+ if (digitos.length <= 2)
256
+ return `(${ddd}`;
257
+ const numero = digitos.slice(2);
258
+ const tamanhoDoPrimeiroBloco = digitos.length > 10 ? 5 : 4;
259
+ const corpo = numero.length > tamanhoDoPrimeiroBloco
260
+ ? `${numero.slice(0, tamanhoDoPrimeiroBloco)}-${numero.slice(tamanhoDoPrimeiroBloco)}`
261
+ : numero;
262
+ return `(${ddd}) ${corpo}`;
263
+ }
169
264
  const STATUS_DA_FATURA = {
170
265
  Created: 'Em emissão',
171
266
  Pending: 'Em aberto',
@@ -188,7 +283,21 @@ const ESTILO_BASE = `
188
283
  .orechio-billing form { display: flex; flex-direction: column; gap: var(--orechio-space-2, 0.5rem); }
189
284
  .orechio-billing__muted { color: var(--orechio-color-text-muted, #666); }
190
285
  .orechio-billing__error { color: var(--orechio-color-danger, #b00020); }
286
+ .orechio-billing__acao {
287
+ align-self: flex-start;
288
+ display: inline-block;
289
+ padding: var(--orechio-space-2, 0.5rem) var(--orechio-space-4, 1rem);
290
+ border-radius: var(--orechio-radius, 0.375rem);
291
+ background: var(--orechio-color-primary, #1a56db);
292
+ color: var(--orechio-color-on-primary, #fff);
293
+ font-weight: 600;
294
+ text-decoration: none;
295
+ }
296
+ .orechio-billing__acao:hover,
297
+ .orechio-billing__acao:focus-visible {
298
+ background: var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0));
299
+ }
191
300
  `;
192
301
 
193
- export { BillingClient as B, STATUS_DA_FATURA as S, BillingErrorComponent as a, data as d, moeda as m };
194
- //# sourceMappingURL=orechio-platform-angular-billing-billing-format-0nlddK-x.mjs.map
302
+ export { BillingClient as B, STATUS_DA_FATURA as S, BillingErrorComponent as a, mascararTelefone as b, mascararDocumento as c, data as d, mascararCpf as e, mascararCnpj as f, moeda as g, mascararCep as m, soDigitos as s, validadeDoPix as v };
303
+ //# sourceMappingURL=orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs","sources":["../../../projects/platform-angular/billing/src/billing-client.ts","../../../projects/platform-angular/billing/src/billing-errors.ts","../../../projects/platform-angular/billing/src/billing-error.component.ts","../../../projects/platform-angular/billing/src/billing-format.ts"],"sourcesContent":["import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { Observable, catchError, throwError } from 'rxjs';\r\nimport { ProblemDetails, normalizeProblemDetails } from '@orechio/platform-angular';\r\nimport { ORECHIO_BILLING_CONFIG } from './billing-config';\r\nimport {\r\n BillingAddressRequest,\r\n BillingContactRequest,\r\n BillingCycle,\r\n BillingProfile,\r\n CheckoutResult,\r\n CreateBillingProfileRequest,\r\n InvoiceDetail,\r\n InvoicesPage,\r\n Plan,\r\n PricingPreview,\r\n RefreshedPayment,\r\n Subscription,\r\n} from './billing-models';\r\n\r\n/**\r\n * O cliente do BFF de cobrança (`Orechio.Platform.Bff.Account` 0.2.0,\r\n * `MapOrechioBillingEndpoints`). Same-origin, só com o BFF do host — mesmo desenho do\r\n * `AccountClient`, e o erro sai pelo mesmo `normalizeProblemDetails`.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class BillingClient {\r\n private readonly http = inject(HttpClient);\r\n private readonly config = inject(ORECHIO_BILLING_CONFIG);\r\n\r\n getSubscription(): Observable<Subscription> {\r\n return this.falha(this.http.get<Subscription>(this.url('/subscription')));\r\n }\r\n\r\n getProfile(): Observable<BillingProfile> {\r\n return this.falha(this.http.get<BillingProfile>(this.url('/profile')));\r\n }\r\n\r\n createProfile(request: CreateBillingProfileRequest): Observable<{ id: string }> {\r\n return this.falha(this.http.post<{ id: string }>(this.url('/profile'), request));\r\n }\r\n\r\n updateProfileContact(request: BillingContactRequest): Observable<void> {\r\n return this.falha(this.http.patch<void>(this.url('/profile/contact'), request));\r\n }\r\n\r\n updateProfileAddress(request: BillingAddressRequest): Observable<void> {\r\n return this.falha(this.http.patch<void>(this.url('/profile/address'), request));\r\n }\r\n\r\n listPlans(): Observable<Plan[]> {\r\n return this.falha(this.http.get<Plan[]>(this.url('/plans')));\r\n }\r\n\r\n previewPricing(planId: string, branchCount: number, cycle: BillingCycle): Observable<PricingPreview> {\r\n const params = new HttpParams({ fromObject: { planId, branchCount, cycle } });\r\n return this.falha(this.http.get<PricingPreview>(this.url('/pricing/preview'), { params }));\r\n }\r\n\r\n /**\r\n * Checkout PIX. O corpo é o `CheckoutRequest` da Platform (`cycle`, `method`), sem\r\n * `applicationId`: com o token de produto, a Platform usa o app do token.\r\n */\r\n checkout(cycle: BillingCycle): Observable<CheckoutResult> {\r\n return this.falha(this.http.post<CheckoutResult>(this.url('/checkout'), { cycle, method: 'pix' }));\r\n }\r\n\r\n listInvoices(page = 1, pageSize = 20): Observable<InvoicesPage> {\r\n const params = new HttpParams({ fromObject: { page, pageSize } });\r\n return this.falha(this.http.get<InvoicesPage>(this.url('/invoices'), { params }));\r\n }\r\n\r\n getInvoice(id: string): Observable<InvoiceDetail> {\r\n return this.falha(this.http.get<InvoiceDetail>(this.url(`/invoices/${encodeURIComponent(id)}`)));\r\n }\r\n\r\n refreshInvoicePix(id: string): Observable<RefreshedPayment> {\r\n return this.falha(this.http.post<RefreshedPayment>(this.url(`/invoices/${encodeURIComponent(id)}/refresh`), null));\r\n }\r\n\r\n private url(path: string): string {\r\n return `${this.config.basePath}${path}`;\r\n }\r\n\r\n private falha<T>(chamada: Observable<T>): Observable<T> {\r\n return chamada.pipe(\r\n catchError((error: HttpErrorResponse) =>\r\n throwError((): ProblemDetails => normalizeProblemDetails(error)),\r\n ),\r\n );\r\n }\r\n}\r\n","import { ProblemDetails } from '@orechio/platform-angular';\r\n\r\nexport interface MensagemDeErro {\r\n texto: string;\r\n /** Só para code desconhecido: é o que o suporte cruza com o log dos dois lados. */\r\n correlationId?: string;\r\n}\r\n\r\nconst ENDERECO_INCOMPLETO = 'Preencha o endereço completo.';\r\nconst DOCUMENTO_INVALIDO = 'CPF ou CNPJ inválido.';\r\nconst DOCUMENTO_TRAVADO =\r\n 'O documento e o nome já foram usados em uma cobrança e não podem mais ser alterados.';\r\nconst PLANO_INDISPONIVEL = 'O plano da assinatura não está disponível. Fale com o suporte.';\r\nconst SO_O_TITULAR = 'Só o titular da conta pode ver e pagar a cobrança.';\r\n\r\n/**\r\n * Os codes que as rotas de cobrança da Platform e do BFF emitem de fato\r\n * (`Commerce*Endpoints`, handlers de `Billing/`, value objects de perfil,\r\n * `PermissionAuthorization`, `Bff.Account`).\r\n */\r\nconst MENSAGENS: Record<string, string> = {\r\n 'session.missing': 'Sua sessão expirou. Entre novamente para continuar.',\r\n 'platform.unavailable':\r\n 'O serviço de cobrança está indisponível no momento. Tente novamente em instantes.',\r\n 'http.0': 'Sem conexão com o servidor. Verifique sua internet e tente novamente.',\r\n rate_limit_exceeded: 'Muitas tentativas. Aguarde alguns minutos e tente novamente.',\r\n\r\n 'access.platform_only': SO_O_TITULAR,\r\n 'permission.denied': SO_O_TITULAR,\r\n\r\n 'subscription.not_found': 'Nenhuma assinatura encontrada para esta conta.',\r\n\r\n 'billing_profile.not_found': 'Cadastre os dados de cobrança antes de pagar.',\r\n 'billing_profile.already_exists': 'Os dados de cobrança já estão cadastrados.',\r\n 'billing_profile.legal_name_required': 'Informe o nome completo ou a razão social.',\r\n 'billing_profile.billing_email_required': 'Informe o e-mail de cobrança.',\r\n 'billing_profile.billing_email_invalid': 'Informe um e-mail de cobrança válido.',\r\n 'billing_profile.mobile_phone_too_long': 'O celular informado é longo demais.',\r\n 'billing_profile.document_type_locked': DOCUMENTO_TRAVADO,\r\n 'billing_profile.document_number_locked': DOCUMENTO_TRAVADO,\r\n 'billing_profile.legal_name_locked': DOCUMENTO_TRAVADO,\r\n 'tax_document.value_required': 'Informe o CPF ou o CNPJ.',\r\n 'tax_document.length_invalid': DOCUMENTO_INVALIDO,\r\n 'tax_document.checksum_invalid': DOCUMENTO_INVALIDO,\r\n 'address.postal_code_invalid': 'CEP inválido.',\r\n 'address.state_invalid': 'UF inválida. Use a sigla do estado, como SP.',\r\n 'address.street_required': ENDERECO_INCOMPLETO,\r\n 'address.number_required': ENDERECO_INCOMPLETO,\r\n 'address.neighborhood_required': ENDERECO_INCOMPLETO,\r\n 'address.city_required': ENDERECO_INCOMPLETO,\r\n\r\n 'checkout.subscription_not_eligible':\r\n 'Não há pagamento de assinatura a fazer agora. Veja as faturas em aberto.',\r\n 'checkout.open_invoice_exists':\r\n 'Já existe uma fatura em aberto. Pague a fatura em aberto em vez de gerar uma nova cobrança.',\r\n 'checkout.pending_other_method':\r\n 'Já existe uma cobrança em aberto por outro meio de pagamento. Veja as faturas.',\r\n 'checkout.credit_card_not_supported': 'Pagamento por cartão ainda não está disponível.',\r\n 'checkout.invoice_in_inconsistent_state':\r\n 'A cobrança anterior ficou incompleta. Tente novamente em alguns minutos.',\r\n 'billing.cycle_invalid': 'Escolha um ciclo de cobrança válido.',\r\n 'pricing_preview.cycle_invalid': 'Escolha um ciclo de cobrança válido.',\r\n 'plan.not_found': PLANO_INDISPONIVEL,\r\n 'plan.not_available': PLANO_INDISPONIVEL,\r\n 'subscription.plan_inactive': PLANO_INDISPONIVEL,\r\n\r\n 'invoice.not_found': 'Fatura não encontrada.',\r\n 'invoice.payment_unavailable':\r\n 'Esta cobrança não está mais disponível para pagamento. Fale com o suporte.',\r\n 'invoice.refresh_not_allowed': 'Esta fatura não está mais em aberto.',\r\n 'invoice.refresh_pix_only': 'Só é possível gerar QR para faturas PIX.',\r\n 'invoice.no_external_payment':\r\n 'Esta fatura ainda não tem cobrança gerada. Tente novamente em alguns minutos.',\r\n};\r\n\r\nconst GENERICA =\r\n 'Não foi possível concluir a operação. Tente novamente; se continuar, informe o código de atendimento ao suporte.';\r\n\r\n/**\r\n * O texto de tela para um erro do BFF, escolhido por `code`. O corpo do erro (`message`) nunca\r\n * vira texto: ele é escrito para log, não para o cliente.\r\n */\r\nexport function mensagemDeErro(problema: ProblemDetails): MensagemDeErro {\r\n const conhecida = MENSAGENS[problema.code];\r\n if (conhecida) return { texto: conhecida };\r\n\r\n return problema.correlationId\r\n ? { texto: GENERICA, correlationId: problema.correlationId }\r\n : { texto: GENERICA };\r\n}\r\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\r\nimport { ProblemDetails } from '@orechio/platform-angular';\r\nimport { mensagemDeErro } from './billing-errors';\r\n\r\n@Component({\r\n selector: 'orechio-billing-error',\r\n standalone: true,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n template: `\r\n <div class=\"orechio-billing__error\" role=\"alert\">\r\n <p>{{ mensagem().texto }}</p>\r\n @if (mensagem().correlationId; as id) {\r\n <p>Código de atendimento: <code>{{ id }}</code></p>\r\n }\r\n </div>\r\n `,\r\n styles: `.orechio-billing__error { color: var(--orechio-color-danger, #b00020); }`,\r\n})\r\nexport class BillingErrorComponent {\r\n readonly problema = input.required<ProblemDetails>();\r\n protected readonly mensagem = computed(() => mensagemDeErro(this.problema()));\r\n}\r\n","import { InvoiceStatus } from './billing-models';\r\n\r\nconst MOEDA = new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' });\r\n\r\nexport function moeda(valor: number): string {\r\n return MOEDA.format(valor);\r\n}\r\n\r\nexport function data(iso: string | null | undefined): string {\r\n return iso ? new Date(iso).toLocaleDateString('pt-BR') : '';\r\n}\r\n\r\nconst FUSO_DE_BRASILIA = 'America/Sao_Paulo';\r\nconst SUFIXO_DE_BRASILIA = '(horário de Brasília)';\r\n\r\n/** \"AAAA-MM-DD HH:mm[:ss]\" — o `expirationDate` do ASAAS: sem fuso, já em horário de Brasília. */\r\nconst SEM_FUSO = /^(\\d{4})-(\\d{2})-(\\d{2})[ T](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?$/;\r\n/** O mesmo, com fuso explícito: `Z` ou `±hh:mm` / `±hhmm`. */\r\nconst COM_FUSO = /^\\d{4}-\\d{2}-\\d{2}[ T]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:?\\d{2})$/i;\r\n\r\n/**\r\n * A validade do PIX para a tela: \"02/10/2026 às 23:59 (horário de Brasília)\".\r\n *\r\n * O valor do ASAAS NÃO passa por `new Date()`: sem fuso, o construtor o leria no fuso do\r\n * navegador e a hora exibida se deslocaria. Ele é formatado por PARTES DO TEXTO. Só o valor\r\n * com fuso explícito é convertido (para America/Sao_Paulo). Formato não reconhecido volta como\r\n * veio — nunca \"Invalid Date\".\r\n */\r\nexport function validadeDoPix(valor: string): string {\r\n const texto = valor.trim();\r\n\r\n const semFuso = SEM_FUSO.exec(texto);\r\n if (semFuso) {\r\n const [, ano, mes, dia, hora, minuto] = semFuso;\r\n return dataValida(+ano, +mes, +dia, +hora, +minuto)\r\n ? `${dia}/${mes}/${ano} às ${hora}:${minuto} ${SUFIXO_DE_BRASILIA}`\r\n : valor;\r\n }\r\n\r\n if (COM_FUSO.test(texto)) {\r\n const instante = new Date(texto.replace(' ', 'T'));\r\n if (Number.isNaN(instante.getTime())) return valor;\r\n\r\n const partes = Object.fromEntries(\r\n new Intl.DateTimeFormat('pt-BR', {\r\n timeZone: FUSO_DE_BRASILIA,\r\n day: '2-digit',\r\n month: '2-digit',\r\n year: 'numeric',\r\n hour: '2-digit',\r\n minute: '2-digit',\r\n hourCycle: 'h23',\r\n })\r\n .formatToParts(instante)\r\n .map((parte) => [parte.type, parte.value]),\r\n );\r\n return `${partes['day']}/${partes['month']}/${partes['year']} às ${partes['hour']}:${partes['minute']} ${SUFIXO_DE_BRASILIA}`;\r\n }\r\n\r\n return valor;\r\n}\r\n\r\nfunction dataValida(ano: number, mes: number, dia: number, hora: number, minuto: number): boolean {\r\n if (mes < 1 || mes > 12 || hora > 23 || minuto > 59 || dia < 1) return false;\r\n return dia <= new Date(Date.UTC(ano, mes, 0)).getUTCDate();\r\n}\r\n\r\n// ── máscaras (perfil de cobrança) ────────────────────────────────────────────\r\n\r\nexport function soDigitos(valor: string): string {\r\n return valor.replace(/\\D/g, '');\r\n}\r\n\r\n/** Junta os grupos de dígitos com os separadores, parando no primeiro grupo vazio. */\r\nfunction agrupar(digitos: string, grupos: readonly number[], separadores: readonly string[]): string {\r\n let saida = '';\r\n let posicao = 0;\r\n for (let i = 0; i < grupos.length; i++) {\r\n const grupo = digitos.slice(posicao, posicao + grupos[i]);\r\n if (!grupo) break;\r\n saida += (i === 0 ? '' : separadores[i - 1]) + grupo;\r\n posicao += grupos[i];\r\n }\r\n return saida;\r\n}\r\n\r\n/** CPF `000.000.000-00`, progressivo enquanto se digita. */\r\nexport function mascararCpf(valor: string): string {\r\n return agrupar(soDigitos(valor).slice(0, 11), [3, 3, 3, 2], ['.', '.', '-']);\r\n}\r\n\r\n/** CNPJ `00.000.000/0000-00`, progressivo enquanto se digita. */\r\nexport function mascararCnpj(valor: string): string {\r\n return agrupar(soDigitos(valor).slice(0, 14), [2, 3, 3, 4, 2], ['.', '.', '/', '-']);\r\n}\r\n\r\n/** O documento conforme o tipo escolhido. */\r\nexport function mascararDocumento(tipo: 'Cpf' | 'Cnpj', valor: string): string {\r\n return tipo === 'Cpf' ? mascararCpf(valor) : mascararCnpj(valor);\r\n}\r\n\r\n/** CEP `00000-000`. */\r\nexport function mascararCep(valor: string): string {\r\n return agrupar(soDigitos(valor).slice(0, 8), [5, 3], ['-']);\r\n}\r\n\r\n/** Telefone `(00) 0000-0000` (10 dígitos) ou celular `(00) 00000-0000` (11). */\r\nexport function mascararTelefone(valor: string): string {\r\n const digitos = soDigitos(valor).slice(0, 11);\r\n if (!digitos) return '';\r\n\r\n const ddd = digitos.slice(0, 2);\r\n if (digitos.length <= 2) return `(${ddd}`;\r\n\r\n const numero = digitos.slice(2);\r\n const tamanhoDoPrimeiroBloco = digitos.length > 10 ? 5 : 4;\r\n const corpo =\r\n numero.length > tamanhoDoPrimeiroBloco\r\n ? `${numero.slice(0, tamanhoDoPrimeiroBloco)}-${numero.slice(tamanhoDoPrimeiroBloco)}`\r\n : numero;\r\n return `(${ddd}) ${corpo}`;\r\n}\r\n\r\nexport const STATUS_DA_FATURA: Record<InvoiceStatus, string> = {\r\n Created: 'Em emissão',\r\n Pending: 'Em aberto',\r\n Paid: 'Paga',\r\n Overdue: 'Vencida',\r\n Refunded: 'Estornada',\r\n Cancelled: 'Cancelada',\r\n};\r\n\r\nexport const ESTILO_BASE = `\r\n .orechio-billing {\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--orechio-space-3, 0.75rem);\r\n max-width: 40rem;\r\n margin: 0 auto;\r\n padding: var(--orechio-space-6, 1.5rem);\r\n color: var(--orechio-color-text, inherit);\r\n font-family: var(--orechio-font-body, inherit);\r\n }\r\n .orechio-billing form { display: flex; flex-direction: column; gap: var(--orechio-space-2, 0.5rem); }\r\n .orechio-billing__muted { color: var(--orechio-color-text-muted, #666); }\r\n .orechio-billing__error { color: var(--orechio-color-danger, #b00020); }\r\n .orechio-billing__acao {\r\n align-self: flex-start;\r\n display: inline-block;\r\n padding: var(--orechio-space-2, 0.5rem) var(--orechio-space-4, 1rem);\r\n border-radius: var(--orechio-radius, 0.375rem);\r\n background: var(--orechio-color-primary, #1a56db);\r\n color: var(--orechio-color-on-primary, #fff);\r\n font-weight: 600;\r\n text-decoration: none;\r\n }\r\n .orechio-billing__acao:hover,\r\n .orechio-billing__acao:focus-visible {\r\n background: var(--orechio-color-primary-hover, var(--orechio-color-primary, #1446b0));\r\n }\r\n`;\r\n"],"names":[],"mappings":";;;;;;;AAoBA;;;;AAIG;MAEU,aAAa,CAAA;AACP,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,IAAA,MAAM,GAAG,MAAM,CAAC,sBAAsB,CAAC;IAExD,eAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAe,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IAC3E;IAEA,UAAU,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE;AAEA,IAAA,aAAa,CAAC,OAAoC,EAAA;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAiB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAClF;AAEA,IAAA,oBAAoB,CAAC,OAA8B,EAAA;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC;IACjF;AAEA,IAAA,oBAAoB,CAAC,OAA8B,EAAA;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,K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C,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;AAC1D,IAAA,MAAM,KAAK,GACT,MAAM,CAAC,MAAM,GAAG;AACd,UAAE,CAAA,EAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;UAClF,MAAM;AACZ,IAAA,OAAO,CAAA,CAAA,EAAI,GAAG,CAAA,EAAA,EAAK,KAAK,EAAE;AAC5B;AAEO,MAAM,gBAAgB,GAAkC;AAC7D,IAAA,OAAO,EAAE,YAAY;AACrB,IAAA,OAAO,EAAE,WAAW;AACpB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,SAAS,EAAE,WAAW;;AAGjB,MAAM,WAAW,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B1B;;;;"}
@@ -2,8 +2,8 @@ import * as i0 from '@angular/core';
2
2
  import { inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { Router, ActivatedRoute, RouterLink } from '@angular/router';
4
4
  import { forkJoin } from 'rxjs';
5
- import { B as BillingClient, m as moeda, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-0nlddK-x.mjs';
6
- import { P as PixPanelComponent } from './orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs';
5
+ import { B as BillingClient, g as moeda, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs';
6
+ import { P as PixPanelComponent } from './orechio-platform-angular-billing-pix-panel.component-fdORTehK.mjs';
7
7
 
8
8
  const STATUS_COM_CHECKOUT = ['Trial', 'PendingPayment', 'Grace', 'Suspended'];
9
9
  const CICLOS = [
@@ -134,7 +134,7 @@ class CheckoutPage {
134
134
  <orechio-billing-error [problema]="problema" />
135
135
  }
136
136
  </section>
137
- `, 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"] }, { kind: "component", type: PixPanelComponent, selector: "orechio-billing-pix", inputs: ["pix", "invoiceUrl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
137
+ `, 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 });
138
138
  }
139
139
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: CheckoutPage, decorators: [{
140
140
  type: Component,
@@ -179,8 +179,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
179
179
  <orechio-billing-error [problema]="problema" />
180
180
  }
181
181
  </section>
182
- `, 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"] }]
182
+ `, 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"] }]
183
183
  }] });
184
184
 
185
185
  export { CheckoutPage };
186
- //# sourceMappingURL=orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs.map
186
+ //# sourceMappingURL=orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"orechio-platform-angular-billing-checkout.page-CHU_Drpu.mjs","sources":["../../../projects/platform-angular/billing/src/pages/checkout.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, inject, signal } from '@angular/core';\r\nimport { ActivatedRoute, Router, RouterLink } from '@angular/router';\r\nimport { forkJoin } from 'rxjs';\r\nimport { ProblemDetails } from '@orechio/platform-angular';\r\nimport { BillingClient } from '../billing-client';\r\nimport { BillingErrorComponent } from '../billing-error.component';\r\nimport { ESTILO_BASE, moeda } from '../billing-format';\r\nimport { BillingCycle, PixData, PricingPreview, Subscription, SubscriptionStatus } from '../billing-models';\r\nimport { PixPanelComponent } from '../pix-panel.component';\r\n\r\nconst STATUS_COM_CHECKOUT: SubscriptionStatus[] = ['Trial', 'PendingPayment', 'Grace', 'Suspended'];\r\n\r\nconst CICLOS: { valor: BillingCycle; rotulo: string }[] = [\r\n { valor: 'Monthly', rotulo: 'Mensal' },\r\n { valor: 'Yearly', rotulo: 'Anual' },\r\n];\r\n\r\n/**\r\n * Pagar a assinatura (ADR-021 §3.5, item 3): o plano ATUAL — trocar de plano é v2 —, o preço\r\n * de cada ciclo vindo de `pricing/preview`, e o checkout PIX.\r\n */\r\n@Component({\r\n selector: 'orechio-billing-checkout',\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 <h1>Pagar assinatura</h1>\r\n\r\n @if (pix(); as dados) {\r\n <p>Pague o PIX abaixo. A assinatura é atualizada assim que o pagamento for confirmado.</p>\r\n <orechio-billing-pix [pix]=\"dados\" [invoiceUrl]=\"invoiceUrl()\" />\r\n <a routerLink=\"..\">Voltar para a assinatura</a>\r\n } @else if (inelegivel()) {\r\n <p>Não há pagamento de assinatura a fazer agora.</p>\r\n <a routerLink=\"../invoices\">Ver faturas</a>\r\n } @else if (previas().length) {\r\n <h2>{{ previas()[0].planName }}</h2>\r\n\r\n <fieldset>\r\n <legend>Ciclo de cobrança</legend>\r\n @for (previa of previas(); track previa.cycle) {\r\n <label>\r\n <input\r\n type=\"radio\"\r\n name=\"ciclo\"\r\n [value]=\"previa.cycle\"\r\n [checked]=\"ciclo() === previa.cycle\"\r\n (change)=\"ciclo.set(previa.cycle)\"\r\n />\r\n {{ rotulo(previa.cycle) }} — {{ moeda(previa.total) }}\r\n </label>\r\n }\r\n </fieldset>\r\n\r\n <button type=\"button\" data-gerar-pix (click)=\"pagar()\" [disabled]=\"enviando()\">\r\n {{ enviando() ? 'Gerando PIX…' : 'Gerar PIX' }}\r\n </button>\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 </section>\r\n `,\r\n styles: ESTILO_BASE,\r\n})\r\nexport class CheckoutPage implements OnInit {\r\n private readonly client = inject(BillingClient);\r\n private readonly router = inject(Router);\r\n private readonly route = inject(ActivatedRoute);\r\n\r\n protected readonly moeda = moeda;\r\n protected readonly previas = signal<PricingPreview[]>([]);\r\n protected readonly ciclo = signal<BillingCycle>('Monthly');\r\n protected readonly inelegivel = signal(false);\r\n protected readonly enviando = signal(false);\r\n protected readonly pix = signal<PixData | null>(null);\r\n protected readonly invoiceUrl = signal<string | null>(null);\r\n protected readonly erro = signal<ProblemDetails | null>(null);\r\n\r\n protected rotulo(ciclo: BillingCycle): string {\r\n return CICLOS.find((c) => c.valor === ciclo)?.rotulo ?? ciclo;\r\n }\r\n\r\n ngOnInit(): void {\r\n forkJoin({ assinatura: this.client.getSubscription(), perfil: this.client.getProfile() }).subscribe({\r\n next: ({ assinatura, perfil }) => {\r\n // O checkout serve Trial, PendingPayment, Grace e Suspended (`InitiateCheckoutCommand`,\r\n // passo 4; os dois últimos desde a BILLING-2b, e só sem fatura aberta — ver `pagar`).\r\n // Checado antes do perfil: não se pede cadastro para um pagamento que não existe.\r\n if (!STATUS_COM_CHECKOUT.includes(assinatura.status)) {\r\n this.inelegivel.set(true);\r\n return;\r\n }\r\n\r\n // O checkout recusa sem perfil (`billing_profile.not_found`). Mandar para o perfil\r\n // ANTES poupa o cliente de escolher o ciclo para receber um erro.\r\n if (!perfil.exists || !perfil.isComplete) {\r\n void this.router.navigate(['../profile'], {\r\n relativeTo: this.route,\r\n queryParams: { next: 'checkout' },\r\n });\r\n return;\r\n }\r\n\r\n this.ciclo.set(assinatura.cycle);\r\n this.carregarPrecos(assinatura);\r\n },\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n\r\n protected pagar(): void {\r\n if (this.enviando()) return;\r\n this.enviando.set(true);\r\n this.erro.set(null);\r\n\r\n this.client.checkout(this.ciclo()).subscribe({\r\n next: (resultado) => {\r\n this.enviando.set(false);\r\n this.invoiceUrl.set(resultado.invoiceUrl ?? null);\r\n if (resultado.pix) this.pix.set(resultado.pix);\r\n else this.erro.set({ code: 'checkout.pix_missing', status: 200 });\r\n },\r\n error: (problema: ProblemDetails) => {\r\n this.enviando.set(false);\r\n // Em Grace/Suspended com fatura aberta a Platform recusa: a aberta é a que se paga.\r\n if (problema.code === 'checkout.open_invoice_exists') {\r\n void this.router.navigate(['../invoices'], { relativeTo: this.route });\r\n return;\r\n }\r\n this.erro.set(problema);\r\n },\r\n });\r\n }\r\n\r\n private carregarPrecos(assinatura: Subscription): void {\r\n forkJoin(\r\n CICLOS.map(({ valor }) =>\r\n this.client.previewPricing(assinatura.planId, assinatura.branchCountSnapshot, valor),\r\n ),\r\n ).subscribe({\r\n next: (previas) => this.previas.set(previas),\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;AAUA,MAAM,mBAAmB,GAAyB,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EA3CS,UAAU,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,EAAA,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;;2FA8CnD,YAAY,EAAA,UAAA,EAAA,CAAA;kBAjDxB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,UAAA,EACxB,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAA,eAAA,EAC9C,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA;;;;;"}
1
+ {"version":3,"file":"orechio-platform-angular-billing-checkout.page-CNl0PPiE.mjs","sources":["../../../projects/platform-angular/billing/src/pages/checkout.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, inject, signal } from '@angular/core';\r\nimport { ActivatedRoute, Router, RouterLink } from '@angular/router';\r\nimport { forkJoin } from 'rxjs';\r\nimport { ProblemDetails } from '@orechio/platform-angular';\r\nimport { BillingClient } from '../billing-client';\r\nimport { BillingErrorComponent } from '../billing-error.component';\r\nimport { ESTILO_BASE, moeda } from '../billing-format';\r\nimport { BillingCycle, PixData, PricingPreview, Subscription, SubscriptionStatus } from '../billing-models';\r\nimport { PixPanelComponent } from '../pix-panel.component';\r\n\r\nconst STATUS_COM_CHECKOUT: SubscriptionStatus[] = ['Trial', 'PendingPayment', 'Grace', 'Suspended'];\r\n\r\nconst CICLOS: { valor: BillingCycle; rotulo: string }[] = [\r\n { valor: 'Monthly', rotulo: 'Mensal' },\r\n { valor: 'Yearly', rotulo: 'Anual' },\r\n];\r\n\r\n/**\r\n * Pagar a assinatura (ADR-021 §3.5, item 3): o plano ATUAL — trocar de plano é v2 —, o preço\r\n * de cada ciclo vindo de `pricing/preview`, e o checkout PIX.\r\n */\r\n@Component({\r\n selector: 'orechio-billing-checkout',\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 <h1>Pagar assinatura</h1>\r\n\r\n @if (pix(); as dados) {\r\n <p>Pague o PIX abaixo. A assinatura é atualizada assim que o pagamento for confirmado.</p>\r\n <orechio-billing-pix [pix]=\"dados\" [invoiceUrl]=\"invoiceUrl()\" />\r\n <a routerLink=\"..\">Voltar para a assinatura</a>\r\n } @else if (inelegivel()) {\r\n <p>Não há pagamento de assinatura a fazer agora.</p>\r\n <a routerLink=\"../invoices\">Ver faturas</a>\r\n } @else if (previas().length) {\r\n <h2>{{ previas()[0].planName }}</h2>\r\n\r\n <fieldset>\r\n <legend>Ciclo de cobrança</legend>\r\n @for (previa of previas(); track previa.cycle) {\r\n <label>\r\n <input\r\n type=\"radio\"\r\n name=\"ciclo\"\r\n [value]=\"previa.cycle\"\r\n [checked]=\"ciclo() === previa.cycle\"\r\n (change)=\"ciclo.set(previa.cycle)\"\r\n />\r\n {{ rotulo(previa.cycle) }} — {{ moeda(previa.total) }}\r\n </label>\r\n }\r\n </fieldset>\r\n\r\n <button type=\"button\" data-gerar-pix (click)=\"pagar()\" [disabled]=\"enviando()\">\r\n {{ enviando() ? 'Gerando PIX…' : 'Gerar PIX' }}\r\n </button>\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 </section>\r\n `,\r\n styles: ESTILO_BASE,\r\n})\r\nexport class CheckoutPage implements OnInit {\r\n private readonly client = inject(BillingClient);\r\n private readonly router = inject(Router);\r\n private readonly route = inject(ActivatedRoute);\r\n\r\n protected readonly moeda = moeda;\r\n protected readonly previas = signal<PricingPreview[]>([]);\r\n protected readonly ciclo = signal<BillingCycle>('Monthly');\r\n protected readonly inelegivel = signal(false);\r\n protected readonly enviando = signal(false);\r\n protected readonly pix = signal<PixData | null>(null);\r\n protected readonly invoiceUrl = signal<string | null>(null);\r\n protected readonly erro = signal<ProblemDetails | null>(null);\r\n\r\n protected rotulo(ciclo: BillingCycle): string {\r\n return CICLOS.find((c) => c.valor === ciclo)?.rotulo ?? ciclo;\r\n }\r\n\r\n ngOnInit(): void {\r\n forkJoin({ assinatura: this.client.getSubscription(), perfil: this.client.getProfile() }).subscribe({\r\n next: ({ assinatura, perfil }) => {\r\n // O checkout serve Trial, PendingPayment, Grace e Suspended (`InitiateCheckoutCommand`,\r\n // passo 4; os dois últimos desde a BILLING-2b, e só sem fatura aberta — ver `pagar`).\r\n // Checado antes do perfil: não se pede cadastro para um pagamento que não existe.\r\n if (!STATUS_COM_CHECKOUT.includes(assinatura.status)) {\r\n this.inelegivel.set(true);\r\n return;\r\n }\r\n\r\n // O checkout recusa sem perfil (`billing_profile.not_found`). Mandar para o perfil\r\n // ANTES poupa o cliente de escolher o ciclo para receber um erro.\r\n if (!perfil.exists || !perfil.isComplete) {\r\n void this.router.navigate(['../profile'], {\r\n relativeTo: this.route,\r\n queryParams: { next: 'checkout' },\r\n });\r\n return;\r\n }\r\n\r\n this.ciclo.set(assinatura.cycle);\r\n this.carregarPrecos(assinatura);\r\n },\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n\r\n protected pagar(): void {\r\n if (this.enviando()) return;\r\n this.enviando.set(true);\r\n this.erro.set(null);\r\n\r\n this.client.checkout(this.ciclo()).subscribe({\r\n next: (resultado) => {\r\n this.enviando.set(false);\r\n this.invoiceUrl.set(resultado.invoiceUrl ?? null);\r\n if (resultado.pix) this.pix.set(resultado.pix);\r\n else this.erro.set({ code: 'checkout.pix_missing', status: 200 });\r\n },\r\n error: (problema: ProblemDetails) => {\r\n this.enviando.set(false);\r\n // Em Grace/Suspended com fatura aberta a Platform recusa: a aberta é a que se paga.\r\n if (problema.code === 'checkout.open_invoice_exists') {\r\n void this.router.navigate(['../invoices'], { relativeTo: this.route });\r\n return;\r\n }\r\n this.erro.set(problema);\r\n },\r\n });\r\n }\r\n\r\n private carregarPrecos(assinatura: Subscription): void {\r\n forkJoin(\r\n CICLOS.map(({ valor }) =>\r\n this.client.previewPricing(assinatura.planId, assinatura.branchCountSnapshot, valor),\r\n ),\r\n ).subscribe({\r\n next: (previas) => this.previas.set(previas),\r\n error: (problema: ProblemDetails) => this.erro.set(problema),\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;AAUA,MAAM,mBAAmB,GAAyB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,CAAC;AAEnG,MAAM,MAAM,GAA8C;AACxD,IAAA,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE;AACtC,IAAA,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;CACrC;AAED;;;AAGG;MAk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,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,EAAA,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;;2FA8CnD,YAAY,EAAA,UAAA,EAAA,CAAA;kBAjDxB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,UAAA,EACxB,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAA,eAAA,EAC9C,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,o6BAAA,CAAA,EAAA;;;;;"}
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { ActivatedRoute, RouterLink } from '@angular/router';
4
- import { B as BillingClient, S as STATUS_DA_FATURA, m as moeda, d as data, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-0nlddK-x.mjs';
5
- import { P as PixPanelComponent } from './orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs';
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
6
 
7
7
  /**
8
8
  * Detalhe de fatura. O detalhe da Platform não traz dado de pagamento (`InvoiceDetailDto`):
@@ -91,7 +91,7 @@ class InvoicePage {
91
91
 
92
92
  <a routerLink="..">Voltar para as faturas</a>
93
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)}\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 });
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
95
  }
96
96
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicePage, decorators: [{
97
97
  type: Component,
@@ -129,8 +129,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
129
129
 
130
130
  <a routerLink="..">Voltar para as faturas</a>
131
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)}\n"] }]
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
133
  }] });
134
134
 
135
135
  export { InvoicePage };
136
- //# sourceMappingURL=orechio-platform-angular-billing-invoice.page-BVyWur3o.mjs.map
136
+ //# sourceMappingURL=orechio-platform-angular-billing-invoice.page-CLojIJkf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"orechio-platform-angular-billing-invoice.page-BVyWur3o.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,CAAuB,IAAI;+EAAC;IAC3C,GAAG,GAAG,MAAM,CAAiB,IAAI;4EAAC;IAClC,UAAU,GAAG,MAAM,CAAgB,IAAI;mFAAC;IACxC,OAAO,GAAG,MAAM,CAAC,KAAK;gFAAC;IACvB,IAAI,GAAG,MAAM,CAAwB,IAAI;6EAAC;AAC1C,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAK;AAC7C,QAAA,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QACvB,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;IAC/F,CAAC;oFAAC;IAEF,QAAQ,GAAA;AACN,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;QACvD,IAAI,CAAC,MAAM,CAAC,UAAU,CA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;;"}
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;;;;AAI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AA,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,EAAA,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;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { RouterLink } from '@angular/router';
4
- import { B as BillingClient, S as STATUS_DA_FATURA, m as moeda, d as data, a as BillingErrorComponent } from './orechio-platform-angular-billing-billing-format-0nlddK-x.mjs';
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
5
 
6
6
  const TAMANHO_DA_PAGINA = 20;
7
7
  class InvoicesPage {
@@ -61,7 +61,7 @@ class InvoicesPage {
61
61
  <p class="orechio-billing__muted">Carregando…</p>
62
62
  }
63
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)}\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 });
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
65
  }
66
66
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InvoicesPage, decorators: [{
67
67
  type: Component,
@@ -98,8 +98,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
98
98
  <p class="orechio-billing__muted">Carregando…</p>
99
99
  }
100
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)}\n"] }]
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
102
  }] });
103
103
 
104
104
  export { InvoicesPage };
105
- //# sourceMappingURL=orechio-platform-angular-billing-invoices.page-BiEm3hRf.mjs.map
105
+ //# sourceMappingURL=orechio-platform-angular-billing-invoices.page-COsCT5NY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"orechio-platform-angular-billing-invoices.page-BiEm3hRf.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,EAAE;AACvB,QAAA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK;IAC7C,CAAC;mFAAC;IAEF,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClB;AAEU,IAAA,QAAQ,CAAC,MAAc,EAAA;QAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,iBAAiB,C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EAAA;;;;;"}
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,EAAE;AACvB,QAAA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK;IAC7C,CAAC;mFAAC;IAEF,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClB;AAEU,IAAA,QAAQ,CAAC,MAAc,EAAA;QAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,SAAS,CAAC;AAC5D,YAAA,IAAI,EAAE,CAAC,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,GAA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from '@angular/core';
3
+ import { v as validadeDoPix } from './orechio-platform-angular-billing-billing-format-DFY2U19Y.mjs';
3
4
 
4
5
  /**
5
6
  * O QR e o copia-e-cola, como a Platform os devolveu. O `encodedImage` é PNG em base64
@@ -11,6 +12,7 @@ class PixPanelComponent {
11
12
  /** Página de pagamento do ASAAS, aberta em nova aba; sem ela, o link não aparece. */
12
13
  invoiceUrl = input(null, /* @ts-ignore */
13
14
  ...(ngDevMode ? [{ debugName: "invoiceUrl" }] : /* istanbul ignore next */ []));
15
+ validadeDoPix = validadeDoPix;
14
16
  copiado = signal(false, /* @ts-ignore */
15
17
  ...(ngDevMode ? [{ debugName: "copiado" }] : /* istanbul ignore next */ []));
16
18
  semAreaDeTransferencia = signal(false, /* @ts-ignore */
@@ -38,7 +40,7 @@ class PixPanelComponent {
38
40
  }
39
41
 
40
42
  @if (pix().expirationDate; as validade) {
41
- <p class="orechio-billing-pix__aviso">Válido até {{ validade }}.</p>
43
+ <p class="orechio-billing-pix__aviso">Válido até {{ validadeDoPix(validade) }}.</p>
42
44
  }
43
45
 
44
46
  @if (invoiceUrl(); as url) {
@@ -65,7 +67,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
65
67
  }
66
68
 
67
69
  @if (pix().expirationDate; as validade) {
68
- <p class="orechio-billing-pix__aviso">Válido até {{ validade }}.</p>
70
+ <p class="orechio-billing-pix__aviso">Válido até {{ validadeDoPix(validade) }}.</p>
69
71
  }
70
72
 
71
73
  @if (invoiceUrl(); as url) {
@@ -78,4 +80,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
78
80
  }], propDecorators: { pix: [{ type: i0.Input, args: [{ isSignal: true, alias: "pix", required: true }] }], invoiceUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "invoiceUrl", required: false }] }] } });
79
81
 
80
82
  export { PixPanelComponent as P };
81
- //# sourceMappingURL=orechio-platform-angular-billing-pix-panel.component-B608dQmc.mjs.map
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,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CACpD,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAC5B,MAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAC5C;IACH;uGApBW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAA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