Skip to content

Commit

Permalink
Switch to ng-packagr, adds 'custom' parameter to IPayPalTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Enngage committed Jun 19, 2018
1 parent c3269e2 commit ff4d0bf
Show file tree
Hide file tree
Showing 61 changed files with 3,914 additions and 3,783 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

# compiled output
/dist
/dist-server
/dist-demo
/tmp
/out-tsc
/ngx-dist
/ngx-paypal-dist

# dependencies
/node_modules
Expand All @@ -33,13 +31,10 @@
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ node_js:
before_script:
- npm install
script:
- ng build --aot
- ng build ngx-paypal-lib
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

96 changes: 73 additions & 23 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,44 @@
"root": "",
"sourceRoot": "demo",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"outputPath": "dist-demo",
"index": "demo/index.html",
"main": "demo/main.ts",
"tsConfig": "demo/tsconfig.app.json",
"polyfills": "demo/polyfills.ts",
"tsConfig": "demo/tsconfig.app.json",
"assets": [
"demo/assets/images-compressed"
],
"styles": [
"demo/styles.css"
],
"scripts": []
},
"configurations": {
"production": {}
"production": {
"fileReplacements": [
{
"replace": "demo/environments/environment.ts",
"with": "demo/environments/environment.prod.ts"
}
],
"baseHref": "https://enngage.github.io/ngx-paypal/",
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
Expand All @@ -33,7 +53,9 @@
"browserTarget": "ngx-paypal:build"
},
"configurations": {
"production": {}
"production": {
"browserTarget": "ngx-paypal:build:production"
}
}
},
"extract-i18n": {
Expand All @@ -46,13 +68,13 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "demo/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "demo/polyfills.ts",
"tsConfig": "demo/tsconfig.spec.json",
"scripts": [],
"karmaConfig": "demo/karma.conf.js",
"styles": [
"demo/styles.css"
"styles.css"
],
"scripts": [],
"assets": [
]
}
Expand All @@ -61,8 +83,8 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"demo/tsconfig.app.json",
"demo/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
Expand All @@ -72,22 +94,59 @@
}
},
"ngx-paypal-e2e": {
"root": "",
"sourceRoot": "",
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ngx-paypal:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ngx-paypal-lib": {
"root": "projects/ngx-paypal-lib",
"sourceRoot": "projects/ngx-paypal-lib/src",
"projectType": "library",
"prefix": "ngx",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ngx-paypal-lib/tsconfig.lib.json",
"project": "projects/ngx-paypal-lib/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/ngx-paypal-lib/ng-package.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ngx-paypal-lib/src/test.ts",
"tsConfig": "projects/ngx-paypal-lib/tsconfig.spec.json",
"karmaConfig": "projects/ngx-paypal-lib/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
"projects/ngx-paypal-lib/tsconfig.lib.json",
"projects/ngx-paypal-lib/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
Expand All @@ -97,14 +156,5 @@
}
}
},
"defaultProject": "ngx-paypal",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
"defaultProject": "ngx-paypal"
}
Empty file added demo/app/app.component.css
Empty file.
117 changes: 117 additions & 0 deletions demo/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<h1>Angular PayPal</h1>

<div class="mt-2">
Supported versions: <strong>Angular 6+</strong>
</div>

<div class="alert alert-warning mt-2" role="alert">
More features will be added depending on how much traction this gets. <a href="https://github.com/Enngage/ngx-paypal">Star repo</a>.
</div>

<h2 class="mt-3">
Live Preview (Sandbox - client side integration)
</h2>

<div class="mt-2">
<ngx-paypal [config]="payPalConfig"></ngx-paypal>
</div>

<h2 class="mt-3">
Installation
</h2>

<div class="mt-2">
<pre>
<code [innerText]="npmCode"></code>
<code [innerText]="moduleInstallation"></code>
</pre>
</div>

<h2>
Usage
</h2>

<div class="mt-2">
<pre >
<code [innerText]="usageCodeTs"></code>
<code [innerText]="htmlCode"></code>
</pre>
</div>

<h2>
Configuration (<em>PayPalConfig</em>)
</h2>

<div class="mt-2">
<table class="table">
<thead>
<tr>
<th scope="col">Property</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>integrationType</td>
<td>PayPalIntegrationType</td>
<td>Type of the integration (client | server)</td>
</tr>
<tr>
<td>environment</td>
<td>PayPalEnvironment</td>
<td>Environment (sandbox | production)</td>
</tr>
<tr>
<td>commit</td>
<td>boolean</td>
<td>SShow 'Pay Now' button config</td>
</tr>
<tr>
<td>payment</td>
<td>() => Observable&#x3C;string&#x3E;</td>
<td>Called to create new payment for server side integration</td>
</tr>
<tr>
<td>onAuthorize</td>
<td>(data: IPayPalPaymentCompleteData, actions: any) =&#x3E; Observable&#x3C;void&#x3E;</td>
<td>Called to execute payment for server side integration</td>
</tr>
<tr>
<td>client</td>
<td>IPaypalClient</td>
<td>Client tokens for client side integration</td>
</tr>
<tr>
<td>transactions</td>
<td>IPayPalTransaction[]</td>
<td>Array of transaction, required for client side integration</td>
</tr>
<tr>
<td>onPaymentComplete</td>
<td>(data: IPayPalPaymentCompleteData, actions: any) => void</td>
<td>Called for client side integration when payment is executed</td>
</tr>
<tr>
<td>button</td>
<td>IPayPalButtonStyle</td>
<td>Button configuration</td>
</tr>
<tr>
<td>funding</td>
<td>IPayPalFunding</td>
<td>Paypal funding configuration</td>
</tr>
<tr>
<td>onError</td>
<td>(err: any) => void</td>
<td>Called when PayPal experiences an error</td>
</tr>
<tr>
<td>onCancel</td>
<td>(data: IPayPalCancelPayment, actions: any) => void</td>
<td>Called when user cancels payment</td>
</tr>
</tbody>
</table>
</div>
27 changes: 27 additions & 0 deletions demo/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
}));
});
Loading

0 comments on commit ff4d0bf

Please sign in to comment.