@osovitny/anatoly 1.0.1 → 1.2.1
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.
- package/README.md +5 -0
- package/ng-package.json +7 -0
- package/package.json +1 -16
- package/src/lib/billing/billing.module.ts +62 -0
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.html +15 -0
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.ts +70 -0
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.html +21 -0
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.ts +60 -0
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.html +3 -0
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.ts +47 -0
- package/src/lib/billing/index.ts +10 -0
- package/src/lib/billing/services/base-billing-api.service.ts +56 -0
- package/src/lib/core/consts.ts +7 -0
- package/src/lib/core/core.module.ts +45 -0
- package/src/lib/core/index.ts +10 -0
- package/src/lib/core/services/appcontext.service.ts +81 -0
- package/src/lib/core/services/base-api.service.ts +87 -0
- package/src/lib/core/services/base-go.service.ts +33 -0
- package/src/lib/core/services/base-gridedit.service.ts +124 -0
- package/src/lib/identity/components/signin-button.component.html +1 -0
- package/src/lib/identity/components/signin-button.component.ts +27 -0
- package/src/lib/identity/components/signout-button.component.html +1 -0
- package/src/lib/identity/components/signout-button.component.ts +27 -0
- package/src/lib/identity/components/signup-button.component.html +1 -0
- package/src/lib/identity/components/signup-button.component.ts +28 -0
- package/src/lib/identity/identity.module.ts +41 -0
- package/src/lib/identity/index.ts +7 -0
- package/src/lib/ui/components/base-edit.component.ts +77 -0
- package/src/lib/ui/components/base.component.ts +45 -0
- package/src/lib/ui/components/content-header/content-header.component.html +4 -0
- package/src/lib/ui/components/content-header/content-header.component.ts +32 -0
- package/src/lib/ui/components/html-editor/base-html-editor.component.ts +97 -0
- package/src/lib/ui/components/html-editor/forms-html-editor.component.html +14 -0
- package/src/lib/ui/components/html-editor/forms-html-editor.component.ts +35 -0
- package/src/lib/ui/components/html-editor/html-editor.component.html +6 -0
- package/src/lib/ui/components/html-editor/html-editor.component.ts +51 -0
- package/src/lib/ui/components/html-editor/html-editor.defaultoptions.ts +38 -0
- package/src/lib/ui/components/validation/form-validation-summary.component.html +4 -0
- package/src/lib/ui/components/validation/form-validation-summary.component.ts +36 -0
- package/src/lib/ui/components/validation/item-validation-summary.component.html +5 -0
- package/src/lib/ui/components/validation/item-validation-summary.component.ts +32 -0
- package/src/lib/ui/components/validation/validation-summary.component.ts +74 -0
- package/src/lib/ui/index.js +13 -0
- package/src/lib/ui/index.js.map +1 -0
- package/src/lib/ui/index.ts +14 -0
- package/src/lib/ui/ui.module.ts +83 -0
- package/{public-api.d.ts → src/public-api.ts} +4 -4
- package/tsconfig.lib.json +32 -0
- package/tsconfig.lib.prod.json +6 -0
- package/tslint.json +17 -0
- package/typings/osovitny-ui/index.d.ts +24 -0
- package/bundles/osovitny-anatoly.umd.js +0 -2065
- package/bundles/osovitny-anatoly.umd.js.map +0 -1
- package/bundles/osovitny-anatoly.umd.min.js +0 -16
- package/bundles/osovitny-anatoly.umd.min.js.map +0 -1
- package/esm2015/lib/billing/billing.module.js +0 -62
- package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -123
- package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -97
- package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -84
- package/esm2015/lib/billing/index.js +0 -6
- package/esm2015/lib/billing/services/base-billing-api.service.js +0 -116
- package/esm2015/lib/core/consts.js +0 -15
- package/esm2015/lib/core/core.module.js +0 -47
- package/esm2015/lib/core/index.js +0 -12
- package/esm2015/lib/core/services/appcontext.service.js +0 -123
- package/esm2015/lib/core/services/base-api.service.js +0 -154
- package/esm2015/lib/core/services/base-go.service.js +0 -58
- package/esm2015/lib/core/services/base-gridedit.service.js +0 -202
- package/esm2015/lib/identity/components/signin-button.component.js +0 -38
- package/esm2015/lib/identity/components/signout-button.component.js +0 -38
- package/esm2015/lib/identity/components/signup-button.component.js +0 -39
- package/esm2015/lib/identity/identity.module.js +0 -43
- package/esm2015/lib/identity/index.js +0 -6
- package/esm2015/lib/ui/components/base-edit.component.js +0 -102
- package/esm2015/lib/ui/components/base.component.js +0 -57
- package/esm2015/lib/ui/components/content-header/content-header.component.js +0 -44
- package/esm2015/lib/ui/components/html-editor/html-editor.component.js +0 -267
- package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +0 -51
- package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +0 -45
- package/esm2015/lib/ui/components/validation/validation-summary.component.js +0 -93
- package/esm2015/lib/ui/index.js +0 -11
- package/esm2015/lib/ui/ui.module.js +0 -72
- package/esm2015/osovitny-anatoly.js +0 -9
- package/esm2015/public-api.js +0 -9
- package/esm5/lib/billing/billing.module.js +0 -66
- package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -128
- package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -100
- package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -86
- package/esm5/lib/billing/index.js +0 -6
- package/esm5/lib/billing/services/base-billing-api.service.js +0 -135
- package/esm5/lib/core/consts.js +0 -15
- package/esm5/lib/core/core.module.js +0 -51
- package/esm5/lib/core/index.js +0 -12
- package/esm5/lib/core/services/appcontext.service.js +0 -140
- package/esm5/lib/core/services/base-api.service.js +0 -205
- package/esm5/lib/core/services/base-go.service.js +0 -59
- package/esm5/lib/core/services/base-gridedit.service.js +0 -240
- package/esm5/lib/identity/components/signin-button.component.js +0 -41
- package/esm5/lib/identity/components/signout-button.component.js +0 -41
- package/esm5/lib/identity/components/signup-button.component.js +0 -41
- package/esm5/lib/identity/identity.module.js +0 -47
- package/esm5/lib/identity/index.js +0 -6
- package/esm5/lib/ui/components/base-edit.component.js +0 -137
- package/esm5/lib/ui/components/base.component.js +0 -72
- package/esm5/lib/ui/components/content-header/content-header.component.js +0 -51
- package/esm5/lib/ui/components/html-editor/html-editor.component.js +0 -309
- package/esm5/lib/ui/components/validation/form-validation-summary.component.js +0 -59
- package/esm5/lib/ui/components/validation/item-validation-summary.component.js +0 -49
- package/esm5/lib/ui/components/validation/validation-summary.component.js +0 -106
- package/esm5/lib/ui/index.js +0 -11
- package/esm5/lib/ui/ui.module.js +0 -76
- package/esm5/osovitny-anatoly.js +0 -9
- package/esm5/public-api.js +0 -9
- package/fesm2015/osovitny-anatoly.js +0 -1622
- package/fesm2015/osovitny-anatoly.js.map +0 -1
- package/fesm5/osovitny-anatoly.js +0 -1877
- package/fesm5/osovitny-anatoly.js.map +0 -1
- package/lib/billing/billing.module.d.ts +0 -2
- package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +0 -16
- package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +0 -15
- package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +0 -9
- package/lib/billing/index.d.ts +0 -1
- package/lib/billing/services/base-billing-api.service.d.ts +0 -9
- package/lib/core/consts.d.ts +0 -5
- package/lib/core/core.module.d.ts +0 -2
- package/lib/core/index.d.ts +0 -5
- package/lib/core/services/appcontext.service.d.ts +0 -14
- package/lib/core/services/base-api.service.d.ts +0 -18
- package/lib/core/services/base-go.service.d.ts +0 -7
- package/lib/core/services/base-gridedit.service.d.ts +0 -19
- package/lib/identity/components/signin-button.component.d.ts +0 -4
- package/lib/identity/components/signout-button.component.d.ts +0 -4
- package/lib/identity/components/signup-button.component.d.ts +0 -4
- package/lib/identity/identity.module.d.ts +0 -2
- package/lib/identity/index.d.ts +0 -1
- package/lib/ui/components/base-edit.component.d.ts +0 -14
- package/lib/ui/components/base.component.d.ts +0 -7
- package/lib/ui/components/content-header/content-header.component.d.ts +0 -5
- package/lib/ui/components/html-editor/html-editor.component.d.ts +0 -22
- package/lib/ui/components/validation/form-validation-summary.component.d.ts +0 -6
- package/lib/ui/components/validation/item-validation-summary.component.d.ts +0 -6
- package/lib/ui/components/validation/validation-summary.component.d.ts +0 -6
- package/lib/ui/index.d.ts +0 -4
- package/lib/ui/ui.module.d.ts +0 -2
- package/osovitny-anatoly.d.ts +0 -4
- package/osovitny-anatoly.metadata.json +0 -1
package/README.md
CHANGED
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osovitny/anatoly",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@angular/common": "^8.2.9",
|
|
7
|
-
"@angular/core": "^8.2.9"
|
|
8
|
-
},
|
|
9
|
-
"main": "bundles/osovitny-anatoly.umd.js",
|
|
10
|
-
"module": "fesm5/osovitny-anatoly.js",
|
|
11
|
-
"es2015": "fesm2015/osovitny-anatoly.js",
|
|
12
|
-
"esm5": "esm5/osovitny-anatoly.js",
|
|
13
|
-
"esm2015": "esm2015/osovitny-anatoly.js",
|
|
14
|
-
"fesm5": "fesm5/osovitny-anatoly.js",
|
|
15
|
-
"fesm2015": "fesm2015/osovitny-anatoly.js",
|
|
16
|
-
"typings": "osovitny-anatoly.d.ts",
|
|
17
|
-
"metadata": "osovitny-anatoly.metadata.json",
|
|
18
|
-
"sideEffects": false,
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"tslib": "^1.9.0"
|
|
21
6
|
}
|
|
22
7
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
10 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { NgModule } from '@angular/core';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
import { HttpClientModule, HttpClientXsrfModule, HttpClientJsonpModule, HttpClient } from '@angular/common/http';
|
|
20
|
+
|
|
21
|
+
//@osovitny/anatoly
|
|
22
|
+
import { AnatolyIdentityModule } from '../identity'
|
|
23
|
+
|
|
24
|
+
//Components/subscriptions
|
|
25
|
+
import { SubscribePlanButtonComponent } from './components/subscriptions/subscribe-plan-button.component';
|
|
26
|
+
import { UpgradePlanButtonComponent } from './components/subscriptions/upgrade-plan-button.component';
|
|
27
|
+
|
|
28
|
+
//Components/buyaccess
|
|
29
|
+
import { BuyAccessButtonComponent } from './components/buyaccess/buyaccess-button.component';
|
|
30
|
+
|
|
31
|
+
//Services
|
|
32
|
+
import { BaseBillingApiService } from './services/base-billing-api.service';
|
|
33
|
+
|
|
34
|
+
@NgModule({
|
|
35
|
+
imports: [
|
|
36
|
+
CommonModule,
|
|
37
|
+
HttpClientModule,
|
|
38
|
+
HttpClientXsrfModule,
|
|
39
|
+
HttpClientJsonpModule,
|
|
40
|
+
AnatolyIdentityModule
|
|
41
|
+
],
|
|
42
|
+
exports: [
|
|
43
|
+
CommonModule,
|
|
44
|
+
HttpClientModule,
|
|
45
|
+
HttpClientXsrfModule,
|
|
46
|
+
HttpClientJsonpModule,
|
|
47
|
+
SubscribePlanButtonComponent,
|
|
48
|
+
UpgradePlanButtonComponent,
|
|
49
|
+
BuyAccessButtonComponent
|
|
50
|
+
],
|
|
51
|
+
declarations: [
|
|
52
|
+
SubscribePlanButtonComponent,
|
|
53
|
+
UpgradePlanButtonComponent,
|
|
54
|
+
BuyAccessButtonComponent
|
|
55
|
+
],
|
|
56
|
+
providers: [
|
|
57
|
+
BaseBillingApiService
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
export class AnatolyBillingModule {
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div *ngIf="contextUpdated">
|
|
2
|
+
<div *ngIf="!isUserSignedIn">
|
|
3
|
+
<anatoly-signup-button classbtn="btn btn-block btn-primary"></anatoly-signup-button>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div *ngIf="isUserSignedIn">
|
|
7
|
+
<button class="btn btn-block btn-success selectPlan" *ngIf="plan == currentPlan">
|
|
8
|
+
Your Plan
|
|
9
|
+
</button>
|
|
10
|
+
|
|
11
|
+
<button class="btn btn-block btn-warning selectPlan" *ngIf="plan != currentPlan && currentPlan == 1" (click)="onBuyPlan()">
|
|
12
|
+
Buy Now
|
|
13
|
+
</button>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
14 Aug 2018
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
18
|
+
|
|
19
|
+
//Services
|
|
20
|
+
import { AppContextService } from '../../../core/services/appcontext.service';
|
|
21
|
+
import { BaseBillingApiService } from '../../services/base-billing-api.service';
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
selector: 'anatoly-buyaccess-button',
|
|
25
|
+
templateUrl: './buyaccess-button.component.html'
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export class BuyAccessButtonComponent implements OnInit {
|
|
29
|
+
public contextUpdated: boolean = false;
|
|
30
|
+
public isUserSignedIn: boolean = false;
|
|
31
|
+
public currentPlan: number = 0;
|
|
32
|
+
public currentPlanTitle: string = "";
|
|
33
|
+
|
|
34
|
+
@Input() plan: number;
|
|
35
|
+
@Input() plantitle: string;
|
|
36
|
+
|
|
37
|
+
constructor(private appcontext: AppContextService, private api: BaseBillingApiService) {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ngOnInit() {
|
|
41
|
+
if (!this.appcontext.isUserSignedIn()) {
|
|
42
|
+
this.contextUpdated = true;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.appcontext.getCurrent((current) => {
|
|
47
|
+
this.isUserSignedIn = current.isUserSignedIn;
|
|
48
|
+
|
|
49
|
+
if (this.isUserSignedIn) {
|
|
50
|
+
this.currentPlan = current.account.billingPlan;
|
|
51
|
+
this.currentPlanTitle = current.account.billingPlanAsString;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.contextUpdated = true;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onBuyPlan() {
|
|
59
|
+
const text = `Requested plan: ${this.plantitle} `;
|
|
60
|
+
|
|
61
|
+
var that = this;
|
|
62
|
+
osovitny.ui.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
|
|
63
|
+
that.api.buyAccess(that.plan, () => {
|
|
64
|
+
osovitny.ui.alertSuccess('Access Granted', null, () => {
|
|
65
|
+
(<any>window).location.reload();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div *ngIf="contextUpdated">
|
|
2
|
+
<div *ngIf="!isUserSignedIn">
|
|
3
|
+
<anatoly-signup-button classbtn="btn btn-block btn-primary"></anatoly-signup-button>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div *ngIf="isUserSignedIn">
|
|
7
|
+
<button class="btn btn-block btn-success selectPlan" *ngIf="plan == currentPlan">
|
|
8
|
+
Your Plan
|
|
9
|
+
</button>
|
|
10
|
+
|
|
11
|
+
<button class="btn btn-block btn-warning selectPlan" *ngIf="requestedPlan != null && requestedPlan != 0 && plan == requestedPlan">
|
|
12
|
+
Requested
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
<anatoly-upgrade-plan-button *ngIf="plan != currentPlan && plan != requestedPlan"
|
|
16
|
+
[currentplantitle]="currentPlanTitle"
|
|
17
|
+
[requestedplan]=plan
|
|
18
|
+
[requestedplantitle]="plantitle">
|
|
19
|
+
</anatoly-upgrade-plan-button>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
1 Jun 2018
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
18
|
+
|
|
19
|
+
//Services
|
|
20
|
+
import { AppContextService } from '../../../core/services/appcontext.service';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'anatoly-subscribe-plan-button',
|
|
24
|
+
templateUrl: './subscribe-plan-button.component.html'
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export class SubscribePlanButtonComponent implements OnInit {
|
|
28
|
+
public contextUpdated: boolean = false;
|
|
29
|
+
public isUserSignedIn: boolean = false;
|
|
30
|
+
public currentPlan: number = 0;
|
|
31
|
+
public currentPlanTitle: string = "";
|
|
32
|
+
public requestedPlan: number = 0;
|
|
33
|
+
public requestedPlanTitle: string = "";
|
|
34
|
+
|
|
35
|
+
@Input() plan: number;
|
|
36
|
+
@Input() plantitle: string;
|
|
37
|
+
|
|
38
|
+
constructor(private appcontext: AppContextService) {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ngOnInit() {
|
|
42
|
+
if (!this.appcontext.isUserSignedIn()) {
|
|
43
|
+
this.contextUpdated = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this.appcontext.getCurrent((current) => {
|
|
48
|
+
this.isUserSignedIn = current.isUserSignedIn;
|
|
49
|
+
|
|
50
|
+
if (this.isUserSignedIn) {
|
|
51
|
+
this.currentPlan = current.account.billingPlan;
|
|
52
|
+
this.currentPlanTitle = current.account.billingPlanAsString;
|
|
53
|
+
this.requestedPlan = current.account.requestedBillingPlan;
|
|
54
|
+
this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.contextUpdated = true;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
12 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { Component, Input } from '@angular/core';
|
|
18
|
+
|
|
19
|
+
//Services
|
|
20
|
+
import { BaseBillingApiService } from '../../services/base-billing-api.service';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'anatoly-upgrade-plan-button',
|
|
24
|
+
templateUrl: './upgrade-plan-button.component.html'
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export class UpgradePlanButtonComponent {
|
|
28
|
+
@Input() currentplantitle: string;
|
|
29
|
+
@Input() requestedplan: number;
|
|
30
|
+
@Input() requestedplantitle: string;
|
|
31
|
+
|
|
32
|
+
constructor(private api: BaseBillingApiService) {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onUpgradePlan() {
|
|
36
|
+
const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
|
|
37
|
+
|
|
38
|
+
var that = this;
|
|
39
|
+
osovitny.ui.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
|
|
40
|
+
that.api.requestNewSubscription(that.requestedplan, () => {
|
|
41
|
+
osovitny.ui.alertSuccess('Your request for changing plan has been sent.', null, () => {
|
|
42
|
+
(<any>window).location.reload();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Components
|
|
2
|
+
export * from './components/buyaccess/buyaccess-button.component';
|
|
3
|
+
export * from './components/subscriptions/subscribe-plan-button.component';
|
|
4
|
+
export * from './components/subscriptions/upgrade-plan-button.component';
|
|
5
|
+
|
|
6
|
+
// Services
|
|
7
|
+
export * from './services/base-billing-api.service';
|
|
8
|
+
|
|
9
|
+
//Module
|
|
10
|
+
export { AnatolyBillingModule } from './billing.module';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
12 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { Injectable } from '@angular/core';
|
|
18
|
+
import { HttpClient } from '@angular/common/http';
|
|
19
|
+
|
|
20
|
+
//@osovitny/anatoly
|
|
21
|
+
import { BaseApiService } from '../../core'
|
|
22
|
+
|
|
23
|
+
@Injectable()
|
|
24
|
+
export class BaseBillingApiService extends BaseApiService {
|
|
25
|
+
constructor(protected http: HttpClient) {
|
|
26
|
+
super(http);
|
|
27
|
+
this.baseUrl += 'billing/';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public requestNewSubscription(requestedPlan: Number, success?: Function, error?: Function) {
|
|
31
|
+
this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
|
|
32
|
+
.subscribe(
|
|
33
|
+
data => { },
|
|
34
|
+
e => { if (error) error() },
|
|
35
|
+
() => { if (success) success() }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public cancelRequestedSubscription(success?: Function, error?: Function) {
|
|
40
|
+
this.postQS('cancelRequestedSubscription', null)
|
|
41
|
+
.subscribe(
|
|
42
|
+
data => { },
|
|
43
|
+
e => { if (error) error() },
|
|
44
|
+
() => { if (success) success() }
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public buyAccess(requestedPlan: Number, success?: Function, error?: Function) {
|
|
49
|
+
this.postQS('buyAccess', { requestedPlan: requestedPlan })
|
|
50
|
+
.subscribe(
|
|
51
|
+
data => { },
|
|
52
|
+
e => { if (error) error() },
|
|
53
|
+
() => { if (success) success() }
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
10 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { NgModule } from '@angular/core';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
import { HttpClientModule, HttpClientXsrfModule, HttpClientJsonpModule, HttpClient } from '@angular/common/http';
|
|
20
|
+
|
|
21
|
+
//Services
|
|
22
|
+
import { AppContextService } from './services/appcontext.service';
|
|
23
|
+
|
|
24
|
+
@NgModule({
|
|
25
|
+
imports: [
|
|
26
|
+
CommonModule,
|
|
27
|
+
HttpClientModule,
|
|
28
|
+
HttpClientXsrfModule,
|
|
29
|
+
HttpClientJsonpModule
|
|
30
|
+
],
|
|
31
|
+
exports: [
|
|
32
|
+
CommonModule,
|
|
33
|
+
HttpClientModule,
|
|
34
|
+
HttpClientXsrfModule,
|
|
35
|
+
HttpClientJsonpModule
|
|
36
|
+
],
|
|
37
|
+
declarations: [
|
|
38
|
+
],
|
|
39
|
+
providers: [
|
|
40
|
+
AppContextService
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export class AnatolyCoreModule {
|
|
45
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Base
|
|
2
|
+
export * from './services/base-api.service';
|
|
3
|
+
export * from './services/base-gridedit.service';
|
|
4
|
+
export * from './services/base-go.service';
|
|
5
|
+
|
|
6
|
+
// Services
|
|
7
|
+
export * from './services/appcontext.service';
|
|
8
|
+
|
|
9
|
+
//Module
|
|
10
|
+
export { AnatolyCoreModule } from './core.module';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
13 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
//Node
|
|
17
|
+
import { Injectable } from '@angular/core';
|
|
18
|
+
import { HttpClient } from '@angular/common/http';
|
|
19
|
+
import { Subscription } from 'rxjs';
|
|
20
|
+
|
|
21
|
+
//Custom
|
|
22
|
+
import { BaseApiService } from './base-api.service';
|
|
23
|
+
import '../consts';
|
|
24
|
+
|
|
25
|
+
@Injectable()
|
|
26
|
+
export class AppContextService extends BaseApiService {
|
|
27
|
+
private current = null;
|
|
28
|
+
private successes = [];
|
|
29
|
+
private subscription: Subscription = null;
|
|
30
|
+
|
|
31
|
+
constructor(protected http: HttpClient) {
|
|
32
|
+
super(http);
|
|
33
|
+
this.baseUrl = anatoly.consts.apiUrl + 'appcontext/';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getCurrent(success: Function) {
|
|
37
|
+
if (typeof success == "undefined") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (this.current != null) {
|
|
42
|
+
success(this.current);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.successes.push(success);
|
|
47
|
+
|
|
48
|
+
if (this.subscription != null) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.subscription = this.get('GetCurrentContext', null).subscribe(
|
|
53
|
+
data => {
|
|
54
|
+
this.dataReceived(data);
|
|
55
|
+
},
|
|
56
|
+
e => { }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
dataReceived(data) {
|
|
61
|
+
this.current = data;
|
|
62
|
+
|
|
63
|
+
for (var i = 0; i < this.successes.length; i++) {
|
|
64
|
+
var success = this.successes[i];
|
|
65
|
+
success(data);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.successes = [];
|
|
69
|
+
this.subscription.unsubscribe();
|
|
70
|
+
this.subscription = null;
|
|
71
|
+
this.current = null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
isUserSignedIn() {
|
|
75
|
+
return (<any>window).__context_isUserSignedIn;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
isUserAdmin() {
|
|
79
|
+
return (<any>window).__context_isUserAdmin;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
13 Nov 2017
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { Injectable } from '@angular/core';
|
|
17
|
+
import { HttpClient } from '@angular/common/http';
|
|
18
|
+
|
|
19
|
+
//RxJs
|
|
20
|
+
import { Observable } from 'rxjs';
|
|
21
|
+
import { map } from 'rxjs/operators';
|
|
22
|
+
|
|
23
|
+
import '../consts';
|
|
24
|
+
|
|
25
|
+
@Injectable()
|
|
26
|
+
export class BaseApiService {
|
|
27
|
+
protected baseUrl: string;
|
|
28
|
+
protected jsonUrl: string;
|
|
29
|
+
|
|
30
|
+
constructor(protected http: HttpClient) {
|
|
31
|
+
this.baseUrl = anatoly.consts.apiUrl;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private serializeParams(data?: any): string {
|
|
35
|
+
return data ? ('?' + $.param(data)) : '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//webApi
|
|
39
|
+
public get<T>(action: String, data?: any): Observable<T> {
|
|
40
|
+
var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
|
|
41
|
+
return this.http.get(url).pipe(
|
|
42
|
+
map(res => <T>res)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public post(action: String, data?: any): Observable<any> {
|
|
47
|
+
var url = this.baseUrl + `${action}`;
|
|
48
|
+
return this.http.post(url, data, { responseType: 'text' });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public postQS(action: String, data?: any): Observable<any> {
|
|
52
|
+
var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
|
|
53
|
+
return this.http.post(url, null, { responseType: 'text' });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//gets
|
|
57
|
+
public getAll<T>(data?: any): Observable<T[]> {
|
|
58
|
+
return this.get('getall', data).pipe(
|
|
59
|
+
map(res => <T[]>res)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public getJsonFile(fileName: string, jsonVersion: string): Observable<any[]> {
|
|
64
|
+
if (!jsonVersion) {
|
|
65
|
+
jsonVersion = "1.0";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var url = anatoly.consts.jsonUrl + fileName + '?' + jsonVersion;
|
|
69
|
+
return this.http.get(url).pipe(
|
|
70
|
+
map(res => <any[]>res)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public getNewGuid(): Observable<string> {
|
|
75
|
+
var url = this.baseUrl + 'getNewGuid';
|
|
76
|
+
return this.http.get(url, { responseType: 'text' });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//CRUD function
|
|
80
|
+
public getById<T>(id: any): Observable<T> {
|
|
81
|
+
return this.get<T>('getById', { id: id });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public remove(id: any): Observable<string> {
|
|
85
|
+
return this.postQS('remove', { id: id });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<file>
|
|
3
|
+
Authors:
|
|
4
|
+
Vadim Osovitny
|
|
5
|
+
|
|
6
|
+
Created:
|
|
7
|
+
17 Jun 2018
|
|
8
|
+
|
|
9
|
+
Version:
|
|
10
|
+
1.0
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
|
|
13
|
+
</file>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { Injectable } from '@angular/core';
|
|
17
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
18
|
+
|
|
19
|
+
@Injectable()
|
|
20
|
+
export class BaseGoService {
|
|
21
|
+
protected route: ActivatedRoute;
|
|
22
|
+
protected router: Router;
|
|
23
|
+
|
|
24
|
+
constructor(route: ActivatedRoute, router: Router) {
|
|
25
|
+
this.route = route;
|
|
26
|
+
this.router = router;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
locationReload() {
|
|
30
|
+
//this.router.navigate([this.route.url]);
|
|
31
|
+
(<any>window).location.reload();
|
|
32
|
+
}
|
|
33
|
+
}
|