UNPKG

@ng-web-apis/payment-request

Version:

This is a library for declarative use of Payment Request API with Angular

75 lines (65 loc) 3.48 kB
import * as i0 from '@angular/core'; import { InjectionToken } from '@angular/core'; interface WaPaymentOptions { requestBillingAddress?: boolean; requestPayerEmail?: boolean; requestPayerName?: boolean; requestPayerPhone?: boolean; requestShipping?: boolean; shippingType?: 'delivery' | 'pickup' | 'shipping'; } interface WaPaymentShippingOption { amount: PaymentCurrencyAmount; id: string; label: string; selected?: boolean; } declare const WA_PAYMENT_OPTIONS: InjectionToken<WaPaymentOptions>; declare class WaPaymentItem implements PaymentItem { amount: PaymentCurrencyAmount; label: string; pending?: boolean; static ɵfac: i0.ɵɵFactoryDeclaration<WaPaymentItem, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<WaPaymentItem, "[waPaymentItem][paymentAmount][paymentLabel]", never, { "amount": { "alias": "paymentAmount"; "required": false; }; "label": { "alias": "paymentLabel"; "required": false; }; "pending": { "alias": "paymentPending"; "required": false; }; }, {}, never, never, true, never>; } declare class WaPayment implements PaymentDetailsInit { total: PaymentItem; id?: string; modifiers?: PaymentDetailsModifier[]; shippingOptions?: WaPaymentShippingOption[]; displayItems?: PaymentItem[]; protected readonly paymentItems: i0.Signal<readonly WaPaymentItem[]>; protected readonly sync: i0.EffectRef; static ɵfac: i0.ɵɵFactoryDeclaration<WaPayment, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<WaPayment, "[waPayment][paymentTotal]", never, { "total": { "alias": "paymentTotal"; "required": false; }; "id": { "alias": "paymentId"; "required": false; }; "modifiers": { "alias": "paymentModifiers"; "required": false; }; "shippingOptions": { "alias": "paymentShippingOptions"; "required": false; }; }, {}, ["paymentItems"], never, true, never>; } declare class WaPaymentSubmit { private readonly paymentHost; private readonly paymentRequest; private readonly nativeElement; private readonly methods; private readonly options; private readonly requests$; readonly waPaymentSubmit: i0.OutputRef<any>; readonly waPaymentError: i0.OutputRef<Error | DOMException>; static ɵfac: i0.ɵɵFactoryDeclaration<WaPaymentSubmit, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<WaPaymentSubmit, "[waPaymentSubmit]", never, {}, { "waPaymentSubmit": "waPaymentSubmit"; "waPaymentError": "waPaymentError"; }, never, never, true, never>; } declare const WaPaymentRequest: readonly [typeof WaPayment, typeof WaPaymentItem, typeof WaPaymentSubmit]; declare class WaPaymentRequestService { private readonly supported; private readonly paymentMethods; private readonly paymentOptions; request(details: PaymentDetailsInit, methods?: PaymentMethodData[], options?: WaPaymentOptions): Promise<PaymentResponse>; static ɵfac: i0.ɵɵFactoryDeclaration<WaPaymentRequestService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<WaPaymentRequestService>; } declare const WA_PAYMENT_METHODS: InjectionToken<PaymentMethodData[]>; declare global { interface Window { PaymentRequest: PaymentRequest; } } declare const WA_PAYMENT_REQUEST_SUPPORT: InjectionToken<boolean>; export { WA_PAYMENT_METHODS, WA_PAYMENT_OPTIONS, WA_PAYMENT_REQUEST_SUPPORT, WaPayment, WaPaymentItem, WaPaymentRequest, WaPaymentRequestService, WaPaymentSubmit }; export type { WaPaymentOptions, WaPaymentShippingOption };