@apolopay-sdk/angular 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ [?9001h[?1004h[?25l> @apolopay-sdk/angular@0.1.0 build D:\Repositories\DV Consultores\Apolo Pay\apolo-pay-sdk\javascript-sdk\packages\angular
2
+ > ngc -p tsconfig.lib.json]0;C:\WINDOWS\system32\cmd.exe[?25h]0;Angular Compiler (ngc)[?9001l[?1004l
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @apolopay-sdk/angular
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 220bf24: initial version
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [220bf24]
12
+ - @apolopay-sdk/ui@1.0.0
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @apolopay-sdk/angular
2
+
3
+ Angular wrapper for the Apolo Pay SDK. Provides a component to integrate the Apolo Pay payment button into Angular applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @apolopay-sdk/angular
9
+ # or
10
+ pnpm add @apolopay-sdk/angular
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### 1. Add the component to your Module or Component
16
+
17
+ ```typescript
18
+ import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
19
+ import { ApoloPayButtonComponent, ApoloPayClient, type ClientResponse, type ClientError } from '@apolopay-sdk/angular';
20
+
21
+ @Component({
22
+ selector: 'app-root',
23
+ standalone: true,
24
+ imports: [ApoloPayButtonComponent],
25
+ schemas: [CUSTOM_ELEMENTS_SCHEMA], // Required for Web Components
26
+ template: `
27
+ <apolopay-button
28
+ [client]="client"
29
+ [processId]="processId"
30
+ productTitle="Order #ANG-1"
31
+ (success)="handleSuccess($event)"
32
+ (error)="handleError($event)"
33
+ ></apolopay-button>
34
+ `
35
+ })
36
+ export class AppComponent {
37
+ client = new ApoloPayClient({ publicKey: 'pk_test_...' });
38
+ processId = 'your-process-id';
39
+
40
+ handleSuccess(response: ClientResponse) {
41
+ console.log('Payment successful!', response);
42
+ }
43
+
44
+ handleError(error: ClientError) {
45
+ console.error('Payment error:', error);
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Props and Events
51
+
52
+ - `[client]`: (ApoloPayClient) **Required**.
53
+ - `[processId]`: (string) **Required**.
54
+ - `[productTitle]`: (string)
55
+ - `[lang]`: ('es' | 'en')
56
+ - `[label]`: (string)
57
+ - `[barrierDismissible]`: (boolean)
58
+ - `(success)`: Event fired on success.
59
+ - `(error)`: Event fired on error.
60
+
61
+ ## License
62
+
63
+ MIT
@@ -0,0 +1,4 @@
1
+ export * from './lib/apolopay-button.module';
2
+ export * from './lib/apolopay-button.component';
3
+ export * from '@apolopay-sdk/ui';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /*
2
+ * API Pública de @apolopay-sdk/angular
3
+ */
4
+ export * from './lib/apolopay-button.module';
5
+ export * from './lib/apolopay-button.component';
6
+ // Re-exporta los tipos
7
+ export * from '@apolopay-sdk/ui';
@@ -0,0 +1,20 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import type { ClientResponse, ClientError, Locale, ApoloPayClient } from '@apolopay-sdk/ui';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ApoloPayButtonComponent {
5
+ client?: ApoloPayClient;
6
+ processId?: string;
7
+ productTitle?: string;
8
+ lang?: Locale;
9
+ label?: string;
10
+ loading?: boolean;
11
+ disabled?: boolean;
12
+ barrierDismissible?: boolean;
13
+ success: EventEmitter<ClientResponse<any>>;
14
+ error: EventEmitter<ClientError>;
15
+ onSuccess(event: Event): void;
16
+ onError(event: Event): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApoloPayButtonComponent, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<ApoloPayButtonComponent, "apolopay-button-component", never, { "client": { "alias": "client"; "required": false; }; "processId": { "alias": "processId"; "required": false; }; "productTitle": { "alias": "productTitle"; "required": false; }; "lang": { "alias": "lang"; "required": false; }; "label": { "alias": "label"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "barrierDismissible": { "alias": "barrierDismissible"; "required": false; }; }, { "success": "success"; "error": "error"; }, never, ["*"], true, never>;
19
+ }
20
+ //# sourceMappingURL=apolopay-button.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolopay-button.component.d.ts","sourceRoot":"","sources":["../../src/lib/apolopay-button.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAA0B,MAAM,eAAe,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;;AAE5F,qBA6Ba,uBAAuB;IAEzB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG5B,OAAO,oCAAsC;IAC7C,KAAK,4BAAmC;IAGlD,SAAS,CAAC,KAAK,EAAE,KAAK;IAKtB,OAAO,CAAC,KAAK,EAAE,KAAK;yCArBT,uBAAuB;2CAAvB,uBAAuB;CAwBnC"}
@@ -0,0 +1,71 @@
1
+ import { Component, Input, Output, EventEmitter, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ const _c0 = ["*"];
4
+ export class ApoloPayButtonComponent {
5
+ constructor() {
6
+ // 6. Define los Outputs (eventos)
7
+ this.success = new EventEmitter();
8
+ this.error = new EventEmitter();
9
+ }
10
+ // 7. Traduce el CustomEvent ($event) a un EventEmitter de Angular
11
+ onSuccess(event) {
12
+ // $event.detail contiene los datos del evento del Web Component
13
+ this.success.emit(event.detail);
14
+ }
15
+ onError(event) {
16
+ this.error.emit(event.detail);
17
+ }
18
+ static { this.ɵfac = function ApoloPayButtonComponent_Factory(t) { return new (t || ApoloPayButtonComponent)(); }; }
19
+ static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ApoloPayButtonComponent, selectors: [["apolopay-button-component"]], inputs: { client: "client", processId: "processId", productTitle: "productTitle", lang: "lang", label: "label", loading: "loading", disabled: "disabled", barrierDismissible: "barrierDismissible" }, outputs: { success: "success", error: "error" }, standalone: true, features: [i0.ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 2, vars: 8, consts: [[3, "success", "error", "client", "label", "lang", "loading", "disabled"]], template: function ApoloPayButtonComponent_Template(rf, ctx) { if (rf & 1) {
20
+ i0.ɵɵprojectionDef();
21
+ i0.ɵɵelementStart(0, "apolopay-button", 0);
22
+ i0.ɵɵlistener("success", function ApoloPayButtonComponent_Template_apolopay_button_success_0_listener($event) { return ctx.onSuccess($event); })("error", function ApoloPayButtonComponent_Template_apolopay_button_error_0_listener($event) { return ctx.onError($event); });
23
+ i0.ɵɵprojection(1);
24
+ i0.ɵɵelementEnd();
25
+ } if (rf & 2) {
26
+ i0.ɵɵproperty("client", ctx.client)("label", ctx.label)("lang", ctx.lang)("loading", ctx.loading)("disabled", ctx.disabled);
27
+ i0.ɵɵattribute("process-id", ctx.processId)("product-title", ctx.productTitle)("barrier-dismissible", ctx.barrierDismissible ? "" : null);
28
+ } }, styles: ["[_nghost-%COMP%] { display: inline-block; }\n\n apolopay-button[_ngcontent-%COMP%] { display: block; }"] }); }
29
+ }
30
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ApoloPayButtonComponent, [{
31
+ type: Component,
32
+ args: [{ selector: 'apolopay-button-component', standalone: true, template: `
33
+ <apolopay-button
34
+ [client]="client"
35
+ [attr.process-id]="processId"
36
+ [label]="label"
37
+ [lang]="lang"
38
+ [attr.product-title]="productTitle"
39
+ [loading]="loading"
40
+ [disabled]="disabled"
41
+ [attr.barrier-dismissible]="barrierDismissible ? '' : null"
42
+ (success)="onSuccess($event)"
43
+ (error)="onError($event)"
44
+ >
45
+ <ng-content></ng-content>
46
+ </apolopay-button>
47
+ `, schemas: [
48
+ CUSTOM_ELEMENTS_SCHEMA
49
+ ], styles: ["\n :host { display: inline-block; }\n\n apolopay-button { display: block; }\n "] }]
50
+ }], null, { client: [{
51
+ type: Input
52
+ }], processId: [{
53
+ type: Input
54
+ }], productTitle: [{
55
+ type: Input
56
+ }], lang: [{
57
+ type: Input
58
+ }], label: [{
59
+ type: Input
60
+ }], loading: [{
61
+ type: Input
62
+ }], disabled: [{
63
+ type: Input
64
+ }], barrierDismissible: [{
65
+ type: Input
66
+ }], success: [{
67
+ type: Output
68
+ }], error: [{
69
+ type: Output
70
+ }] }); })();
71
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ApoloPayButtonComponent, { className: "ApoloPayButtonComponent", filePath: "lib\\apolopay-button.component.ts", lineNumber: 33 }); })();
@@ -0,0 +1,10 @@
1
+ import '@apolopay-sdk/ui';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "@angular/common";
4
+ import * as i2 from "./apolopay-button.component";
5
+ export declare class ApoloPayButtonModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApoloPayButtonModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ApoloPayButtonModule, never, [typeof i1.CommonModule, typeof i2.ApoloPayButtonComponent], [typeof i2.ApoloPayButtonComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<ApoloPayButtonModule>;
9
+ }
10
+ //# sourceMappingURL=apolopay-button.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolopay-button.module.d.ts","sourceRoot":"","sources":["../../src/lib/apolopay-button.module.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;;;;AAE1B,qBAaa,oBAAoB;yCAApB,oBAAoB;0CAApB,oBAAoB;0CAApB,oBAAoB;CAAI"}
@@ -0,0 +1,28 @@
1
+ import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ApoloPayButtonComponent } from './apolopay-button.component';
4
+ import '@apolopay-sdk/ui';
5
+ import * as i0 from "@angular/core";
6
+ export class ApoloPayButtonModule {
7
+ static { this.ɵfac = function ApoloPayButtonModule_Factory(t) { return new (t || ApoloPayButtonModule)(); }; }
8
+ static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ApoloPayButtonModule }); }
9
+ static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule] }); }
10
+ }
11
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ApoloPayButtonModule, [{
12
+ type: NgModule,
13
+ args: [{
14
+ declarations: [],
15
+ imports: [
16
+ CommonModule,
17
+ ApoloPayButtonComponent
18
+ ],
19
+ exports: [
20
+ ApoloPayButtonComponent
21
+ ],
22
+ schemas: [
23
+ CUSTOM_ELEMENTS_SCHEMA
24
+ ]
25
+ }]
26
+ }], null, null); })();
27
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ApoloPayButtonModule, { imports: [CommonModule,
28
+ ApoloPayButtonComponent], exports: [ApoloPayButtonComponent] }); })();
@@ -0,0 +1,20 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import type { ClientResponse, ClientError, Locale, ApoloPayClient } from '@payment-button-sdk/ui';
3
+ import * as i0 from "@angular/core";
4
+ export declare class PaymentButtonComponent {
5
+ client?: ApoloPayClient;
6
+ processId?: string;
7
+ productTitle?: string;
8
+ lang?: Locale;
9
+ label?: string;
10
+ loading?: boolean;
11
+ disabled?: boolean;
12
+ barrierDismissible?: boolean;
13
+ success: EventEmitter<ClientResponse<any>>;
14
+ error: EventEmitter<ClientError>;
15
+ onSuccess(event: Event): void;
16
+ onError(event: Event): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<PaymentButtonComponent, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<PaymentButtonComponent, "apolo-payment-button", never, { "client": { "alias": "client"; "required": false; }; "processId": { "alias": "processId"; "required": false; }; "productTitle": { "alias": "productTitle"; "required": false; }; "lang": { "alias": "lang"; "required": false; }; "label": { "alias": "label"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "barrierDismissible": { "alias": "barrierDismissible"; "required": false; }; }, { "success": "success"; "error": "error"; }, never, ["*"], true, never>;
19
+ }
20
+ //# sourceMappingURL=payment-button.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-button.component.d.ts","sourceRoot":"","sources":["../../src/lib/payment-button.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAA0B,MAAM,eAAe,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;;AAElG,qBA6Ba,sBAAsB;IAExB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG5B,OAAO,oCAAsC;IAC7C,KAAK,4BAAmC;IAGlD,SAAS,CAAC,KAAK,EAAE,KAAK;IAKtB,OAAO,CAAC,KAAK,EAAE,KAAK;yCArBT,sBAAsB;2CAAtB,sBAAsB;CAwBlC"}
@@ -0,0 +1,71 @@
1
+ import { Component, Input, Output, EventEmitter, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ const _c0 = ["*"];
4
+ export class PaymentButtonComponent {
5
+ constructor() {
6
+ // 6. Define los Outputs (eventos)
7
+ this.success = new EventEmitter();
8
+ this.error = new EventEmitter();
9
+ }
10
+ // 7. Traduce el CustomEvent ($event) a un EventEmitter de Angular
11
+ onSuccess(event) {
12
+ // $event.detail contiene los datos del evento del Web Component
13
+ this.success.emit(event.detail);
14
+ }
15
+ onError(event) {
16
+ this.error.emit(event.detail);
17
+ }
18
+ static { this.ɵfac = function PaymentButtonComponent_Factory(t) { return new (t || PaymentButtonComponent)(); }; }
19
+ static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PaymentButtonComponent, selectors: [["apolo-payment-button"]], inputs: { client: "client", processId: "processId", productTitle: "productTitle", lang: "lang", label: "label", loading: "loading", disabled: "disabled", barrierDismissible: "barrierDismissible" }, outputs: { success: "success", error: "error" }, standalone: true, features: [i0.ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 2, vars: 8, consts: [[3, "success", "error", "client", "label", "lang", "loading", "disabled"]], template: function PaymentButtonComponent_Template(rf, ctx) { if (rf & 1) {
20
+ i0.ɵɵprojectionDef();
21
+ i0.ɵɵelementStart(0, "payment-button", 0);
22
+ i0.ɵɵlistener("success", function PaymentButtonComponent_Template_payment_button_success_0_listener($event) { return ctx.onSuccess($event); })("error", function PaymentButtonComponent_Template_payment_button_error_0_listener($event) { return ctx.onError($event); });
23
+ i0.ɵɵprojection(1);
24
+ i0.ɵɵelementEnd();
25
+ } if (rf & 2) {
26
+ i0.ɵɵproperty("client", ctx.client)("label", ctx.label)("lang", ctx.lang)("loading", ctx.loading)("disabled", ctx.disabled);
27
+ i0.ɵɵattribute("process-id", ctx.processId)("product-title", ctx.productTitle)("barrier-dismissible", ctx.barrierDismissible ? "" : null);
28
+ } }, styles: ["[_nghost-%COMP%] { display: inline-block; }\n\n payment-button[_ngcontent-%COMP%] { display: block; }"] }); }
29
+ }
30
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaymentButtonComponent, [{
31
+ type: Component,
32
+ args: [{ selector: 'apolo-payment-button', standalone: true, template: `
33
+ <payment-button
34
+ [client]="client"
35
+ [attr.process-id]="processId"
36
+ [label]="label"
37
+ [lang]="lang"
38
+ [attr.product-title]="productTitle"
39
+ [loading]="loading"
40
+ [disabled]="disabled"
41
+ [attr.barrier-dismissible]="barrierDismissible ? '' : null"
42
+ (success)="onSuccess($event)"
43
+ (error)="onError($event)"
44
+ >
45
+ <ng-content></ng-content>
46
+ </payment-button>
47
+ `, schemas: [
48
+ CUSTOM_ELEMENTS_SCHEMA
49
+ ], styles: ["\n :host { display: inline-block; }\n\n payment-button { display: block; }\n "] }]
50
+ }], null, { client: [{
51
+ type: Input
52
+ }], processId: [{
53
+ type: Input
54
+ }], productTitle: [{
55
+ type: Input
56
+ }], lang: [{
57
+ type: Input
58
+ }], label: [{
59
+ type: Input
60
+ }], loading: [{
61
+ type: Input
62
+ }], disabled: [{
63
+ type: Input
64
+ }], barrierDismissible: [{
65
+ type: Input
66
+ }], success: [{
67
+ type: Output
68
+ }], error: [{
69
+ type: Output
70
+ }] }); })();
71
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PaymentButtonComponent, { className: "PaymentButtonComponent", filePath: "lib\\payment-button.component.ts", lineNumber: 33 }); })();
@@ -0,0 +1,10 @@
1
+ import '@payment-button-sdk/ui';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "@angular/common";
4
+ import * as i2 from "./payment-button.component";
5
+ export declare class PaymentButtonModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<PaymentButtonModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<PaymentButtonModule, never, [typeof i1.CommonModule, typeof i2.PaymentButtonComponent], [typeof i2.PaymentButtonComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<PaymentButtonModule>;
9
+ }
10
+ //# sourceMappingURL=payment-button.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-button.module.d.ts","sourceRoot":"","sources":["../../src/lib/payment-button.module.ts"],"names":[],"mappings":"AAGA,OAAO,wBAAwB,CAAC;;;;AAEhC,qBAaa,mBAAmB;yCAAnB,mBAAmB;0CAAnB,mBAAmB;0CAAnB,mBAAmB;CAAI"}
@@ -0,0 +1,28 @@
1
+ import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { PaymentButtonComponent } from './payment-button.component';
4
+ import '@payment-button-sdk/ui';
5
+ import * as i0 from "@angular/core";
6
+ export class PaymentButtonModule {
7
+ static { this.ɵfac = function PaymentButtonModule_Factory(t) { return new (t || PaymentButtonModule)(); }; }
8
+ static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: PaymentButtonModule }); }
9
+ static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule] }); }
10
+ }
11
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaymentButtonModule, [{
12
+ type: NgModule,
13
+ args: [{
14
+ declarations: [],
15
+ imports: [
16
+ CommonModule,
17
+ PaymentButtonComponent
18
+ ],
19
+ exports: [
20
+ PaymentButtonComponent
21
+ ],
22
+ schemas: [
23
+ CUSTOM_ELEMENTS_SCHEMA
24
+ ]
25
+ }]
26
+ }], null, null); })();
27
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(PaymentButtonModule, { imports: [CommonModule,
28
+ PaymentButtonComponent], exports: [PaymentButtonComponent] }); })();
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@apolopay-sdk/angular",
3
+ "version": "1.0.0",
4
+ "description": "Botón de pago de Tu Plataforma para Angular",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "dependencies": {
12
+ "@apolopay-sdk/ui": "1.0.0"
13
+ },
14
+ "peerDependencies": {
15
+ "@angular/common": ">=16.0.0",
16
+ "@angular/core": ">=16.0.0",
17
+ "rxjs": ">=7.0.0"
18
+ },
19
+ "devDependencies": {
20
+ "@angular/compiler": "17.3.0",
21
+ "@angular/compiler-cli": "17.3.0",
22
+ "@angular/core": "17.3.0",
23
+ "@angular/common": "17.3.0",
24
+ "tslib": "2.6.2",
25
+ "typescript": "5.4.5"
26
+ },
27
+ "sideEffects": false,
28
+ "scripts": {
29
+ "build": "ngc -p tsconfig.lib.json",
30
+ "dev": "ngc -p tsconfig.lib.json --watch"
31
+ }
32
+ }
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ /*
2
+ * API Pública de @apolopay-sdk/angular
3
+ */
4
+
5
+ export * from './lib/apolopay-button.module';
6
+ export * from './lib/apolopay-button.component';
7
+
8
+ // Re-exporta los tipos
9
+ export * from '@apolopay-sdk/ui';
@@ -0,0 +1,57 @@
1
+ import { Component, Input, Output, EventEmitter, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import type { ClientResponse, ClientError, Locale, ApoloPayClient } from '@apolopay-sdk/ui';
3
+
4
+ @Component({
5
+ selector: 'apolopay-button-component',
6
+ standalone: true,
7
+ template: `
8
+ <apolopay-button
9
+ [client]="client"
10
+ [attr.process-id]="processId"
11
+ [label]="label"
12
+ [lang]="lang"
13
+ [attr.product-title]="productTitle"
14
+ [loading]="loading"
15
+ [disabled]="disabled"
16
+ [attr.barrier-dismissible]="barrierDismissible ? '' : null"
17
+ (success)="onSuccess($event)"
18
+ (error)="onError($event)"
19
+ >
20
+ <ng-content></ng-content>
21
+ </apolopay-button>
22
+ `,
23
+ // 4. Asegura que el wrapper se comporte como un bloque
24
+ styles: [`
25
+ :host { display: inline-block; }
26
+
27
+ apolopay-button { display: block; }
28
+ `],
29
+ schemas: [
30
+ CUSTOM_ELEMENTS_SCHEMA
31
+ ]
32
+ })
33
+ export class ApoloPayButtonComponent {
34
+ // 5. Define los Inputs (props)
35
+ @Input() client?: ApoloPayClient;
36
+ @Input() processId?: string;
37
+ @Input() productTitle?: string;
38
+ @Input() lang?: Locale;
39
+ @Input() label?: string;
40
+ @Input() loading?: boolean;
41
+ @Input() disabled?: boolean;
42
+ @Input() barrierDismissible?: boolean;
43
+
44
+ // 6. Define los Outputs (eventos)
45
+ @Output() success = new EventEmitter<ClientResponse>();
46
+ @Output() error = new EventEmitter<ClientError>();
47
+
48
+ // 7. Traduce el CustomEvent ($event) a un EventEmitter de Angular
49
+ onSuccess(event: Event) {
50
+ // $event.detail contiene los datos del evento del Web Component
51
+ this.success.emit((event as CustomEvent<ClientResponse>).detail);
52
+ }
53
+
54
+ onError(event: Event) {
55
+ this.error.emit((event as CustomEvent<ClientError>).detail);
56
+ }
57
+ }
@@ -0,0 +1,19 @@
1
+ import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ApoloPayButtonComponent } from './apolopay-button.component';
4
+ import '@apolopay-sdk/ui';
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule,
10
+ ApoloPayButtonComponent
11
+ ],
12
+ exports: [
13
+ ApoloPayButtonComponent
14
+ ],
15
+ schemas: [
16
+ CUSTOM_ELEMENTS_SCHEMA
17
+ ]
18
+ })
19
+ export class ApoloPayButtonModule { }
@@ -0,0 +1,29 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "types": [],
9
+ "lib": ["DOM", "ES2022"],
10
+ "target": "ES2022",
11
+ "module": "es2020",
12
+ "moduleResolution": "node",
13
+ "emitDecoratorMetadata": true,
14
+ "experimentalDecorators": true,
15
+ "skipLibCheck": true
16
+ },
17
+ "angularCompilerOptions": {
18
+ "skipTemplateCodegen": true,
19
+ "strictMetadataEmit": true,
20
+ "enableResourceInlining": true
21
+ },
22
+ "exclude": [
23
+ "src/test.ts",
24
+ "**/*.spec.ts"
25
+ ],
26
+ "include": [
27
+ "src/**/*.ts"
28
+ ]
29
+ }