Skip to content

Commit c90f88c

Browse files
committed
scaffolded out a new plugin - payments
1 parent 29d34aa commit c90f88c

24 files changed

+231
-29
lines changed

README.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
# @nativescript/\* plugins
2-
3-
```bash
4-
npm run setup
5-
npm start
6-
```
7-
8-
- [@nativescript/animated-circle](/packages/animated-circle/README.md)
9-
- [@nativescript/appavailability](/packages/appavailability/README.md)
10-
- [@nativescript/auto-fit-text](/packages/auto-fit-text/README.md)
11-
- [@nativescript/background-http](/packages/background-http/README.md)
12-
- [@nativescript/brightness](/packages/brightness/README.md)
13-
- [@nativescript/camera](/packages/camera/README.md)
14-
- [@nativescript/datetimepicker](/packages/datetimepicker/README.md)
15-
- [@nativescript/detox](/packages/detox/README.md)
16-
- [@nativescript/directions](/packages/directions/README.md)
17-
- [@nativescript/email](/packages/email/README.md)
18-
- [@nativescript/fingerprint-auth](/packages/fingerprint-auth/README.md)
19-
- [@nativescript/geolocation](/packages/geolocation/README.md)
20-
- [@nativescript/imagepicker](/packages/imagepicker/README.md)
21-
- [@nativescript/iqkeyboardmanager](/packages/iqkeyboardmanager/README.md)
22-
- [@nativescript/local-notifications](/packages/local-notifications/README.md)
23-
- [@nativescript/localize](/packages/localize/README.md)
24-
- [@nativescript/shared-notification-delegate](/packages/shared-notification-delegate/README.md)
25-
- [@nativescript/social-share](/packages/social-share/README.md)
26-
- [@nativescript/zip](/packages/zip/README.md)
1+
- @nativescript/animated-circle
2+
- @nativescript/appavailability
3+
- @nativescript/auto-fit-text
4+
- @nativescript/background-http
5+
- @nativescript/brightness
6+
- @nativescript/camera
7+
- @nativescript/datetimepicker
8+
- @nativescript/detox
9+
- @nativescript/directions
10+
- @nativescript/email
11+
- @nativescript/fingerprint-auth
12+
- @nativescript/geolocation
13+
- @nativescript/imagepicker
14+
- @nativescript/iqkeyboardmanager
15+
- @nativescript/local-notifications
16+
- @nativescript/localize
17+
- @nativescript/payments
18+
- @nativescript/shared-notification-delegate
19+
- @nativescript/social-share
20+
- @nativescript/zip
2721

2822
# How to use?
2923

apps/demo-angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"@nativescript/local-notifications": "file:../../dist/packages/local-notifications",
3333
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
3434
"@nativescript/social-share": "file:../../dist/packages/social-share",
35-
"@nativescript/zip": "file:../../dist/packages/zip"
35+
"@nativescript/zip": "file:../../dist/packages/zip",
36+
"@nativescript/payments": "file:../../dist/packages/payments"
3637
},
3738
"devDependencies": {
3839
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const routes: Routes = [
1414
{ path: 'brightness', loadChildren: () => import('./plugin-demos/brightness.module').then((m) => m.BrightnessModule) },
1515
{ path: 'camera', loadChildren: () => import('./plugin-demos/camera.module').then((m) => m.CameraModule) },
1616
{ path: 'datetimepicker', loadChildren: () => import('./plugin-demos/datetimepicker.module').then((m) => m.DatetimepickerModule) },
17+
{ path: 'detox', loadChildren: () => import('./plugin-demos/detox.module').then((m) => m.DetoxModule) },
1718
{ path: 'directions', loadChildren: () => import('./plugin-demos/directions.module').then((m) => m.DirectionsModule) },
1819
{ path: 'email', loadChildren: () => import('./plugin-demos/email.module').then((m) => m.EmailModule) },
1920
{ path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then((m) => m.FingerprintAuthModule) },
@@ -22,6 +23,7 @@ const routes: Routes = [
2223
{ path: 'iqkeyboardmanager', loadChildren: () => import('./plugin-demos/iqkeyboardmanager.module').then((m) => m.IqkeyboardmanagerModule) },
2324
{ path: 'local-notifications', loadChildren: () => import('./plugin-demos/local-notifications.module').then((m) => m.LocalNotificationsModule) },
2425
{ path: 'localize', loadChildren: () => import('./plugin-demos/localize.module').then((m) => m.LocalizeModule) },
26+
{ path: 'payments', loadChildren: () => import('./plugin-demos/payments.module').then((m) => m.PaymentsModule) },
2527
{ path: 'shared-notification-delegate', loadChildren: () => import('./plugin-demos/shared-notification-delegate.module').then((m) => m.SharedNotificationDelegateModule) },
2628
{ path: 'social-share', loadChildren: () => import('./plugin-demos/social-share.module').then((m) => m.SocialShareModule) },
2729
{ path: 'zip', loadChildren: () => import('./plugin-demos/zip.module').then((m) => m.ZipModule) },

apps/demo-angular/src/home.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class HomeComponent {
2727
{
2828
name: 'datetimepicker',
2929
},
30+
{
31+
name: 'detox',
32+
},
3033
{
3134
name: 'directions',
3235
},
@@ -51,6 +54,9 @@ export class HomeComponent {
5154
{
5255
name: 'localize',
5356
},
57+
{
58+
name: 'payments',
59+
},
5460
{
5561
name: 'shared-notification-delegate',
5662
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="payments" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test payments" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedPayments } from '@demo/shared';
3+
import {} from '@nativescript/payments';
4+
5+
@Component({
6+
selector: 'demo-payments',
7+
templateUrl: 'payments.component.html',
8+
})
9+
export class PaymentsComponent {
10+
demoShared: DemoSharedPayments;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedPayments();
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { PaymentsComponent } from './payments.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: PaymentsComponent }])],
7+
declarations: [PaymentsComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class PaymentsModule {}

apps/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"@nativescript/local-notifications": "file:../../packages/local-notifications",
2424
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",
2525
"@nativescript/social-share": "file:../../packages/social-share",
26-
"@nativescript/zip": "file:../../packages/zip"
26+
"@nativescript/zip": "file:../../packages/zip",
27+
"@nativescript/payments": "file:../../packages/payments"
2728
},
2829
"devDependencies": {
2930
"@nativescript/android": "7.0.0",

apps/demo/src/main-page.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<Button text="shared-notification-delegate" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2424
<Button text="social-share" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2525
<Button text="zip" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
26+
<Button text="payments" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2627
</StackLayout>
2728
</ScrollView>
2829
</StackLayout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Observable, EventData, Page } from '@nativescript/core';
2+
import { DemoSharedPayments } from '@demo/shared';
3+
import {} from '@nativescript/payments';
4+
5+
export function navigatingTo(args: EventData) {
6+
const page = <Page>args.object;
7+
page.bindingContext = new DemoModel();
8+
}
9+
10+
export class DemoModel extends DemoSharedPayments {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
2+
<Page.actionBar>
3+
<ActionBar title="payments" icon="" class="action-bar">
4+
</ActionBar>
5+
</Page.actionBar>
6+
<StackLayout class="p-20">
7+
<ScrollView class="h-full">
8+
<StackLayout>
9+
<Button text="Test payments" tap="{{ testIt }}" class="btn btn-primary"/>
10+
11+
</StackLayout>
12+
</ScrollView>
13+
</StackLayout>
14+
</Page>

nx.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
},
8080
"detox": {
8181
"tags": []
82+
},
83+
"payments": {
84+
"tags": []
8285
}
8386
},
8487
"workspaceLayout": {

packages/payments/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @nativescript/payments
2+
3+
```javascript
4+
ns plugin add @nativescript/payments
5+
```
6+
7+
## Usage
8+
9+
// TODO
10+
11+
## License
12+
13+
Apache License Version 2.0

packages/payments/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Observable } from '@nativescript/core';
2+
3+
export class PaymentsCommon extends Observable {}

packages/payments/index.android.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { PaymentsCommon } from './common';
2+
3+
export class Payments extends PaymentsCommon {}

packages/payments/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { PaymentsCommon } from './common';
2+
3+
export declare class Payments extends PaymentsCommon {}

packages/payments/index.ios.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { PaymentsCommon } from './common';
2+
3+
export class Payments extends PaymentsCommon {}

packages/payments/package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@nativescript/payments",
3+
"version": "1.0.0",
4+
"description": "Add a plugin description",
5+
"main": "index",
6+
"typings": "index.d.ts",
7+
"nativescript": {
8+
"platforms": {
9+
"ios": "6.0.0",
10+
"android": "6.0.0"
11+
}
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/NativeScript/plugins.git"
16+
},
17+
"keywords": [
18+
"NativeScript",
19+
"JavaScript",
20+
"TypeScript",
21+
"iOS",
22+
"Android"
23+
],
24+
"author": {
25+
"name": "NativeScript",
26+
"email": "oss@nativescript.org"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/NativeScript/plugins/issues"
30+
},
31+
"license": "Apache-2.0",
32+
"homepage": "https://github.com/NativeScript/plugins",
33+
"readmeFilename": "README.md",
34+
"bootstrapper": "@nativescript/plugin-seed"
35+
}

packages/payments/references.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../../references.d.ts" />

packages/payments/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"rootDir": "."
6+
},
7+
"exclude": ["**/*.spec.ts", "angular"],
8+
"include": ["**/*.ts", "references.d.ts"]
9+
}

tools/demo/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export * from './background-http';
66
export * from './brightness';
77
export * from './camera';
88
export * from './datetimepicker';
9+
export * from './detox';
910
export * from './directions';
1011
export * from './email';
1112
export * from './fingerprint-auth';
@@ -14,6 +15,7 @@ export * from './imagepicker';
1415
export * from './iqkeyboardmanager';
1516
export * from './local-notifications';
1617
export * from './localize';
18+
export * from './payments';
1719
export * from './shared-notification-delegate';
1820
export * from './social-share';
1921
export * from './zip';

tools/demo/payments/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { DemoSharedBase } from '../utils';
2+
import {} from '@nativescript/payments';
3+
4+
export class DemoSharedPayments extends DemoSharedBase {
5+
testIt() {
6+
console.log('test payments!');
7+
}
8+
}

tools/workspace-scripts.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ module.exports = {
196196
description: '@nativescript/detox: Build',
197197
},
198198
},
199+
// @nativescript/payments
200+
payments: {
201+
build: {
202+
script: 'nx run payments:build.all',
203+
description: '@nativescript/payments: Build',
204+
},
205+
},
199206
'build-all': {
200207
script: 'nx run all:build',
201208
description: 'Build all packages',
@@ -282,6 +289,10 @@ module.exports = {
282289
script: 'nx run detox:focus',
283290
description: 'Focus on @nativescript/detox',
284291
},
292+
payments: {
293+
script: 'nx run payments:focus',
294+
description: 'Focus on @nativescript/payments',
295+
},
285296
reset: {
286297
script: 'nx run all:focus',
287298
description: 'Reset Focus',

workspace.json

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@
221221
"nx run auto-fit-text:build.all",
222222
"nx run animated-circle:build.all",
223223
"nx run localize:build.all",
224-
"nx run detox:build.all"
224+
"nx run detox:build.all",
225+
"nx run payments:build.all"
225226
],
226227
"parallel": false
227228
}
@@ -925,6 +926,49 @@
925926
}
926927
}
927928
}
929+
},
930+
"payments": {
931+
"root": "packages/payments",
932+
"sourceRoot": "packages/payments",
933+
"projectType": "library",
934+
"schematics": {},
935+
"architect": {
936+
"build": {
937+
"builder": "@nrwl/node:package",
938+
"options": {
939+
"outputPath": "dist/packages/payments",
940+
"tsConfig": "packages/payments/tsconfig.json",
941+
"packageJson": "packages/payments/package.json",
942+
"main": "packages/payments/index.ts",
943+
"assets": [
944+
"packages/payments/*.md",
945+
"packages/payments/index.d.ts",
946+
"LICENSE",
947+
{
948+
"glob": "**/*",
949+
"input": "packages/payments/platforms/",
950+
"output": "./platforms/"
951+
}
952+
]
953+
}
954+
},
955+
"build.all": {
956+
"builder": "@nrwl/workspace:run-commands",
957+
"outputs": ["dist/packages"],
958+
"options": {
959+
"commands": ["nx run payments:build", "node tools/scripts/build-finish.ts payments"],
960+
"parallel": false
961+
}
962+
},
963+
"focus": {
964+
"builder": "@nrwl/workspace:run-commands",
965+
"outputs": ["dist/packages"],
966+
"options": {
967+
"commands": ["nx g @nativescript/plugin-tools:focus-packages payments"],
968+
"parallel": false
969+
}
970+
}
971+
}
928972
}
929973
},
930974
"cli": {

0 commit comments

Comments
 (0)