@osovitny/anatoly 3.17.66 → 3.17.68
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/esm2022/lib/core/interceptors/httpInterceptor.mjs +2 -5
- package/esm2022/lib/payments/PayPal/components/paypal.component.mjs +317 -0
- package/esm2022/lib/payments/PayPal/models/paypal-models.mjs +17 -0
- package/esm2022/lib/payments/PayPal/services/paypal-script.service.mjs +98 -0
- package/esm2022/lib/payments/index.mjs +22 -0
- package/esm2022/lib/payments/payments.module.mjs +54 -0
- package/esm2022/lib/payments/services/script.service.mjs +63 -0
- package/esm2022/public-api.mjs +5 -7
- package/fesm2022/osovitny-anatoly.mjs +551 -5
- package/fesm2022/osovitny-anatoly.mjs.map +1 -1
- package/lib/payments/PayPal/components/paypal.component.d.ts +50 -0
- package/lib/payments/PayPal/models/paypal-models.d.ts +309 -0
- package/lib/payments/PayPal/services/paypal-script.service.d.ts +14 -0
- package/lib/payments/index.d.ts +4 -0
- package/lib/payments/payments.module.d.ts +8 -0
- package/lib/payments/services/script.service.d.ts +11 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import js_beautify from 'js-beautify';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, Inject, EventEmitter, Output, Pipe, APP_INITIALIZER, Injector, NgModule, Component, Input, ViewEncapsulation, Directive,
|
|
3
|
+
import { Injectable, Inject, EventEmitter, Output, Pipe, APP_INITIALIZER, Injector, NgModule, Component, ChangeDetectionStrategy, Input, ViewChild, ViewEncapsulation, Directive, HostBinding, HostListener, Optional, SkipSelf } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/router';
|
|
5
5
|
import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
|
|
6
6
|
import * as i1$1 from '@angular/common/http';
|
|
7
7
|
import { HttpResponse, HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
8
|
-
import { map, tap, mergeMap
|
|
8
|
+
import { map, tap, mergeMap } from 'rxjs/operators';
|
|
9
9
|
import { BehaviorSubject, Subject, filter, takeUntil, map as map$1, catchError, of, timer, merge, fromEvent, forkJoin } from 'rxjs';
|
|
10
10
|
import * as i4 from '@azure/msal-angular';
|
|
11
11
|
import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG, MSAL_INSTANCE, MsalService, MsalBroadcastService, MsalModule } from '@azure/msal-angular';
|
|
@@ -1940,8 +1940,6 @@ class AnatolyHttpInterceptor {
|
|
|
1940
1940
|
req = req.clone({ headers: req.headers.set('Authorization', 'Bearer ' + token) });
|
|
1941
1941
|
}
|
|
1942
1942
|
return this.handleHttpRequest(req, next, loadingRequired);
|
|
1943
|
-
}), catchError$1(err => {
|
|
1944
|
-
return of(null);
|
|
1945
1943
|
}));
|
|
1946
1944
|
}
|
|
1947
1945
|
else {
|
|
@@ -3620,6 +3618,508 @@ class EmailsApiService extends ApiServiceBase {
|
|
|
3620
3618
|
*/
|
|
3621
3619
|
//base
|
|
3622
3620
|
|
|
3621
|
+
/*
|
|
3622
|
+
<file>
|
|
3623
|
+
Project:
|
|
3624
|
+
@osovitny/anatoly
|
|
3625
|
+
|
|
3626
|
+
Authors:
|
|
3627
|
+
Vadim Osovitny vadim@osovitny.com
|
|
3628
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
3629
|
+
|
|
3630
|
+
Created:
|
|
3631
|
+
14 Jun 2024
|
|
3632
|
+
|
|
3633
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
3634
|
+
</file>
|
|
3635
|
+
*/
|
|
3636
|
+
//Node
|
|
3637
|
+
class ScriptService {
|
|
3638
|
+
constructor(zone) {
|
|
3639
|
+
this.zone = zone;
|
|
3640
|
+
}
|
|
3641
|
+
registerScript(url, globalVar, onReady) {
|
|
3642
|
+
const existingGlobalVar = window[globalVar];
|
|
3643
|
+
if (existingGlobalVar) {
|
|
3644
|
+
// global variable is present = script was already loaded
|
|
3645
|
+
this.zone.run(() => {
|
|
3646
|
+
onReady(existingGlobalVar);
|
|
3647
|
+
});
|
|
3648
|
+
return;
|
|
3649
|
+
}
|
|
3650
|
+
// prepare script elem
|
|
3651
|
+
const scriptElem = document.createElement('script');
|
|
3652
|
+
scriptElem.id = this.getElemId(globalVar);
|
|
3653
|
+
scriptElem.innerHTML = '';
|
|
3654
|
+
scriptElem.onload = () => {
|
|
3655
|
+
this.zone.run(() => {
|
|
3656
|
+
onReady(window[globalVar]);
|
|
3657
|
+
});
|
|
3658
|
+
};
|
|
3659
|
+
scriptElem.src = url;
|
|
3660
|
+
scriptElem.async = true;
|
|
3661
|
+
scriptElem.defer = true;
|
|
3662
|
+
// add script to header
|
|
3663
|
+
document.getElementsByTagName('head')[0].appendChild(scriptElem);
|
|
3664
|
+
}
|
|
3665
|
+
cleanup(globalVar) {
|
|
3666
|
+
// remove script from DOM
|
|
3667
|
+
const scriptElem = document.getElementById(this.getElemId(globalVar));
|
|
3668
|
+
if (scriptElem) {
|
|
3669
|
+
scriptElem.remove();
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
getElemId(globalVar) {
|
|
3673
|
+
return `anatoly-script-${globalVar}`;
|
|
3674
|
+
}
|
|
3675
|
+
static { this.ɵfac = function ScriptService_Factory(t) { return new (t || ScriptService)(i0.ɵɵinject(i0.NgZone)); }; }
|
|
3676
|
+
static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ScriptService, factory: ScriptService.ɵfac }); }
|
|
3677
|
+
}
|
|
3678
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ScriptService, [{
|
|
3679
|
+
type: Injectable
|
|
3680
|
+
}], () => [{ type: i0.NgZone }], null); })();
|
|
3681
|
+
|
|
3682
|
+
/*
|
|
3683
|
+
<file>
|
|
3684
|
+
Project:
|
|
3685
|
+
@osovitny/anatoly
|
|
3686
|
+
|
|
3687
|
+
Authors:
|
|
3688
|
+
Vadim Osovitny vadim@osovitny.com
|
|
3689
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
3690
|
+
|
|
3691
|
+
Created:
|
|
3692
|
+
14 Jun 2024
|
|
3693
|
+
|
|
3694
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
3695
|
+
</file>
|
|
3696
|
+
*/
|
|
3697
|
+
class PayPalScriptService {
|
|
3698
|
+
constructor(scriptService) {
|
|
3699
|
+
this.scriptService = scriptService;
|
|
3700
|
+
this.paypalWindowName = 'paypal';
|
|
3701
|
+
}
|
|
3702
|
+
registerPayPalScript(config, onReady) {
|
|
3703
|
+
this.scriptService.registerScript(this.getUrlForConfig(config), this.paypalWindowName, onReady);
|
|
3704
|
+
}
|
|
3705
|
+
destroyPayPalScript() {
|
|
3706
|
+
this.scriptService.cleanup(this.paypalWindowName);
|
|
3707
|
+
}
|
|
3708
|
+
getUrlForConfig(config) {
|
|
3709
|
+
const params = [
|
|
3710
|
+
{
|
|
3711
|
+
name: 'client-id',
|
|
3712
|
+
value: config.clientId
|
|
3713
|
+
}
|
|
3714
|
+
];
|
|
3715
|
+
if (config.locale) {
|
|
3716
|
+
params.push({
|
|
3717
|
+
name: 'locale',
|
|
3718
|
+
value: config.locale
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
if (config.currency) {
|
|
3722
|
+
params.push({
|
|
3723
|
+
name: 'currency',
|
|
3724
|
+
value: config.currency
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
if (config.commit) {
|
|
3728
|
+
params.push({
|
|
3729
|
+
name: 'commit',
|
|
3730
|
+
value: config.commit
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3733
|
+
if (config.vault) {
|
|
3734
|
+
params.push({
|
|
3735
|
+
name: 'vault',
|
|
3736
|
+
value: config.vault
|
|
3737
|
+
});
|
|
3738
|
+
}
|
|
3739
|
+
if (config.intent) {
|
|
3740
|
+
params.push({
|
|
3741
|
+
name: 'intent',
|
|
3742
|
+
value: config.intent
|
|
3743
|
+
});
|
|
3744
|
+
}
|
|
3745
|
+
if (config.funding) {
|
|
3746
|
+
params.push({
|
|
3747
|
+
name: 'components',
|
|
3748
|
+
value: 'buttons,funding-eligibility'
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
if (config.extraParams) {
|
|
3752
|
+
params.push(...config.extraParams);
|
|
3753
|
+
}
|
|
3754
|
+
return `https://www.paypal.com/sdk/js${this.getQueryString(params)}`;
|
|
3755
|
+
}
|
|
3756
|
+
getQueryString(queryParams) {
|
|
3757
|
+
let queryString = '';
|
|
3758
|
+
for (let i = 0; i < queryParams.length; i++) {
|
|
3759
|
+
const queryParam = queryParams[i];
|
|
3760
|
+
if (i === 0) {
|
|
3761
|
+
queryString += '?';
|
|
3762
|
+
}
|
|
3763
|
+
else {
|
|
3764
|
+
queryString += '&';
|
|
3765
|
+
}
|
|
3766
|
+
queryString += `${queryParam.name}=${queryParam.value}`;
|
|
3767
|
+
}
|
|
3768
|
+
return queryString;
|
|
3769
|
+
}
|
|
3770
|
+
static { this.ɵfac = function PayPalScriptService_Factory(t) { return new (t || PayPalScriptService)(i0.ɵɵinject(ScriptService)); }; }
|
|
3771
|
+
static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PayPalScriptService, factory: PayPalScriptService.ɵfac }); }
|
|
3772
|
+
}
|
|
3773
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PayPalScriptService, [{
|
|
3774
|
+
type: Injectable
|
|
3775
|
+
}], () => [{ type: ScriptService }], null); })();
|
|
3776
|
+
|
|
3777
|
+
/*
|
|
3778
|
+
<file>
|
|
3779
|
+
Project:
|
|
3780
|
+
@osovitny/anatoly
|
|
3781
|
+
|
|
3782
|
+
Authors:
|
|
3783
|
+
Vadim Osovitny vadim@osovitny.com
|
|
3784
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
3785
|
+
|
|
3786
|
+
Created:
|
|
3787
|
+
14 Jun 2024
|
|
3788
|
+
|
|
3789
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
3790
|
+
</file>
|
|
3791
|
+
*/
|
|
3792
|
+
const _c0$f = ["payPalButtonContainer"];
|
|
3793
|
+
class PayPalComponent {
|
|
3794
|
+
set payPalButtonContainer(content) {
|
|
3795
|
+
this.payPalButtonContainerElem = content;
|
|
3796
|
+
}
|
|
3797
|
+
constructor(paypalScriptService, cdr, ngZone) {
|
|
3798
|
+
this.paypalScriptService = paypalScriptService;
|
|
3799
|
+
this.cdr = cdr;
|
|
3800
|
+
this.ngZone = ngZone;
|
|
3801
|
+
/**
|
|
3802
|
+
* If enabled, paypal SDK script will be loaded. Useful if you want to have multiple PayPal components on the same page
|
|
3803
|
+
* sharing base configuration. In such a case only a single component may register script.
|
|
3804
|
+
*/
|
|
3805
|
+
this.registerScript = true;
|
|
3806
|
+
/**
|
|
3807
|
+
* Emitted when paypal script is loaded
|
|
3808
|
+
*/
|
|
3809
|
+
this.scriptLoaded = new EventEmitter();
|
|
3810
|
+
this.ngUnsubscribe = new Subject();
|
|
3811
|
+
/**
|
|
3812
|
+
* Flag that indicates if paypal should be initialized (required for handling script load events and availability of DOM element)
|
|
3813
|
+
*/
|
|
3814
|
+
this.initializePayPal = true;
|
|
3815
|
+
}
|
|
3816
|
+
ngOnChanges(changes) {
|
|
3817
|
+
if (!this.payPalButtonContainerId) {
|
|
3818
|
+
this.payPalButtonContainerId = this.generateElementId();
|
|
3819
|
+
}
|
|
3820
|
+
// first time config setup
|
|
3821
|
+
const config = this.config;
|
|
3822
|
+
const name = 'PayPalConfig';
|
|
3823
|
+
if (changes[name].isFirstChange()) {
|
|
3824
|
+
if (config && this.registerScript) {
|
|
3825
|
+
this.initPayPalScript(config, (payPal) => {
|
|
3826
|
+
// store reference to paypal global script
|
|
3827
|
+
this.payPal = payPal;
|
|
3828
|
+
this.doPayPalCheck();
|
|
3829
|
+
});
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
// changes to config
|
|
3833
|
+
if (!changes[name].isFirstChange()) {
|
|
3834
|
+
this.reinitialize(config);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
ngOnDestroy() {
|
|
3838
|
+
this.paypalScriptService.destroyPayPalScript();
|
|
3839
|
+
this.ngUnsubscribe.next();
|
|
3840
|
+
this.ngUnsubscribe.complete();
|
|
3841
|
+
}
|
|
3842
|
+
ngAfterViewInit() {
|
|
3843
|
+
this.doPayPalCheck();
|
|
3844
|
+
}
|
|
3845
|
+
customInit(payPal) {
|
|
3846
|
+
this.payPal = payPal;
|
|
3847
|
+
this.doPayPalCheck();
|
|
3848
|
+
}
|
|
3849
|
+
reinitialize(config) {
|
|
3850
|
+
this.config = config;
|
|
3851
|
+
this.payPal = undefined;
|
|
3852
|
+
this.paypalScriptService.destroyPayPalScript();
|
|
3853
|
+
this.payPalButtonContainerId = this.generateElementId();
|
|
3854
|
+
this.initializePayPal = true;
|
|
3855
|
+
if (this.payPalButtonContainerElem) {
|
|
3856
|
+
try {
|
|
3857
|
+
while (this.payPalButtonContainerElem.nativeElement.firstChild) {
|
|
3858
|
+
this.payPalButtonContainerElem.nativeElement.removeChild(this.payPalButtonContainerElem.nativeElement.firstChild);
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
catch (error) {
|
|
3862
|
+
console.error(error);
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
this.cdr.detectChanges();
|
|
3866
|
+
if (this.config) {
|
|
3867
|
+
if (!this.payPal) {
|
|
3868
|
+
this.initPayPalScript(this.config, (payPal) => {
|
|
3869
|
+
// store reference to paypal global script
|
|
3870
|
+
this.payPal = payPal;
|
|
3871
|
+
this.doPayPalCheck();
|
|
3872
|
+
});
|
|
3873
|
+
}
|
|
3874
|
+
else {
|
|
3875
|
+
this.doPayPalCheck();
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
doPayPalCheck() {
|
|
3880
|
+
if (this.initializePayPal &&
|
|
3881
|
+
this.config &&
|
|
3882
|
+
this.payPal &&
|
|
3883
|
+
this.payPalButtonContainerElem) {
|
|
3884
|
+
// make sure that id is also set
|
|
3885
|
+
if (this.payPalButtonContainerElem.nativeElement.id) {
|
|
3886
|
+
this.initializePayPal = false;
|
|
3887
|
+
this.initPayPal(this.config, this.payPal);
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
initPayPalScript(config, initPayPal) {
|
|
3892
|
+
this.paypalScriptService.registerPayPalScript({
|
|
3893
|
+
clientId: config.clientId,
|
|
3894
|
+
locale: config.advanced?.locale,
|
|
3895
|
+
commit: config.advanced && config.advanced.commit
|
|
3896
|
+
? config.advanced.commit
|
|
3897
|
+
: undefined,
|
|
3898
|
+
currency: config.currency,
|
|
3899
|
+
vault: config.vault,
|
|
3900
|
+
intent: config.intent,
|
|
3901
|
+
funding: config.fundingSource != undefined || config.fundingSource != null ? true : false,
|
|
3902
|
+
extraParams: config.advanced && config.advanced.extraQueryParams
|
|
3903
|
+
? config.advanced.extraQueryParams
|
|
3904
|
+
: [],
|
|
3905
|
+
}, (paypal) => {
|
|
3906
|
+
this.scriptLoaded.next(paypal);
|
|
3907
|
+
initPayPal(paypal);
|
|
3908
|
+
});
|
|
3909
|
+
}
|
|
3910
|
+
generateElementId() {
|
|
3911
|
+
return `ngx-captcha-id-${this.generateGuid()}`;
|
|
3912
|
+
}
|
|
3913
|
+
initPayPal(config, paypal) {
|
|
3914
|
+
// Running outside angular zone prevents infinite ngDoCheck lifecycle calls
|
|
3915
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3916
|
+
// https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-script-to-your-web-page
|
|
3917
|
+
const createOrder = (data, actions) => {
|
|
3918
|
+
return this.ngZone.run(() => {
|
|
3919
|
+
if (config.createOrderOnClient && config.createOrderOnServer) {
|
|
3920
|
+
throw Error(`Both 'createOrderOnClient' and 'createOrderOnServer' are defined.
|
|
3921
|
+
Please choose one or the other.`);
|
|
3922
|
+
}
|
|
3923
|
+
if (!config.createOrderOnClient && !config.createOrderOnServer) {
|
|
3924
|
+
throw Error(`Neither 'createOrderOnClient' or 'createOrderOnServer' are defined.
|
|
3925
|
+
Please define one of these to create order.`);
|
|
3926
|
+
}
|
|
3927
|
+
if (config.createOrderOnClient) {
|
|
3928
|
+
return actions.order.create(config.createOrderOnClient(data));
|
|
3929
|
+
}
|
|
3930
|
+
if (config.createOrderOnServer) {
|
|
3931
|
+
return config.createOrderOnServer(data);
|
|
3932
|
+
}
|
|
3933
|
+
throw Error(`Invalid state for 'createOrder'.`);
|
|
3934
|
+
});
|
|
3935
|
+
};
|
|
3936
|
+
const createSubscription = (data, actions) => {
|
|
3937
|
+
return this.ngZone.run(() => {
|
|
3938
|
+
if (config.createSubscriptionOnClient) {
|
|
3939
|
+
return actions.subscription.create(config.createSubscriptionOnClient(data));
|
|
3940
|
+
}
|
|
3941
|
+
return;
|
|
3942
|
+
});
|
|
3943
|
+
};
|
|
3944
|
+
const onShippingChange = (data, actions) => {
|
|
3945
|
+
return this.ngZone.run(() => {
|
|
3946
|
+
if (config.onShippingChange) {
|
|
3947
|
+
return config.onShippingChange(data, actions);
|
|
3948
|
+
}
|
|
3949
|
+
});
|
|
3950
|
+
};
|
|
3951
|
+
const buttonsConfig = {
|
|
3952
|
+
style: config.style,
|
|
3953
|
+
fundingSource: undefined,
|
|
3954
|
+
onApprove: (data, actions) => {
|
|
3955
|
+
return this.ngZone.run(() => {
|
|
3956
|
+
if (config.onApprove) {
|
|
3957
|
+
config.onApprove(data, actions);
|
|
3958
|
+
}
|
|
3959
|
+
// capture on server
|
|
3960
|
+
if (config.authorizeOnServer) {
|
|
3961
|
+
return config.authorizeOnServer(data, actions);
|
|
3962
|
+
}
|
|
3963
|
+
// capture on client
|
|
3964
|
+
const onClientAuthorization = config.onClientAuthorization;
|
|
3965
|
+
if (onClientAuthorization) {
|
|
3966
|
+
actions.order
|
|
3967
|
+
.capture()
|
|
3968
|
+
.then((details) => {
|
|
3969
|
+
this.ngZone.run(() => {
|
|
3970
|
+
onClientAuthorization(details);
|
|
3971
|
+
});
|
|
3972
|
+
});
|
|
3973
|
+
}
|
|
3974
|
+
});
|
|
3975
|
+
},
|
|
3976
|
+
onError: (error) => {
|
|
3977
|
+
this.ngZone.run(() => {
|
|
3978
|
+
if (config.onError) {
|
|
3979
|
+
config.onError(error);
|
|
3980
|
+
}
|
|
3981
|
+
});
|
|
3982
|
+
},
|
|
3983
|
+
onCancel: (data, actions) => {
|
|
3984
|
+
this.ngZone.run(() => {
|
|
3985
|
+
if (config.onCancel) {
|
|
3986
|
+
config.onCancel(data, actions);
|
|
3987
|
+
}
|
|
3988
|
+
});
|
|
3989
|
+
},
|
|
3990
|
+
onClick: (data, actions) => {
|
|
3991
|
+
this.ngZone.run(() => {
|
|
3992
|
+
if (config.onClick) {
|
|
3993
|
+
config.onClick(data, actions);
|
|
3994
|
+
}
|
|
3995
|
+
});
|
|
3996
|
+
},
|
|
3997
|
+
onInit: (data, actions) => {
|
|
3998
|
+
this.ngZone.run(() => {
|
|
3999
|
+
if (config.onInit) {
|
|
4000
|
+
config.onInit(data, actions);
|
|
4001
|
+
}
|
|
4002
|
+
});
|
|
4003
|
+
},
|
|
4004
|
+
// Add the functions if they've been created in the config object
|
|
4005
|
+
// The API only allows one of the two to be set
|
|
4006
|
+
...((config.createOrderOnClient || config.createOrderOnServer) && {
|
|
4007
|
+
createOrder,
|
|
4008
|
+
}),
|
|
4009
|
+
...(config.createSubscriptionOnClient && { createSubscription }),
|
|
4010
|
+
// The onShippingChange callback cannot be used with subscriptions
|
|
4011
|
+
// so we only add it if it is set
|
|
4012
|
+
...(config.onShippingChange && { onShippingChange }),
|
|
4013
|
+
};
|
|
4014
|
+
let fundSource = undefined;
|
|
4015
|
+
switch (config.fundingSource) {
|
|
4016
|
+
case "PAYPAL":
|
|
4017
|
+
fundSource = paypal.FUNDING.PAYPAL;
|
|
4018
|
+
break;
|
|
4019
|
+
case "CARD":
|
|
4020
|
+
fundSource = paypal.FUNDING.CARD;
|
|
4021
|
+
break;
|
|
4022
|
+
case "PAYLATER":
|
|
4023
|
+
fundSource = paypal.FUNDING.PAYLATER;
|
|
4024
|
+
break;
|
|
4025
|
+
case "CREDIT":
|
|
4026
|
+
fundSource = paypal.FUNDING.CREDIT;
|
|
4027
|
+
break;
|
|
4028
|
+
case "VENMO":
|
|
4029
|
+
fundSource = paypal.FUNDING.VENMO;
|
|
4030
|
+
break;
|
|
4031
|
+
default:
|
|
4032
|
+
break;
|
|
4033
|
+
}
|
|
4034
|
+
if (fundSource != undefined) {
|
|
4035
|
+
buttonsConfig.fundingSource = fundSource;
|
|
4036
|
+
if (config.fundingSource !== "PAYPAL")
|
|
4037
|
+
delete buttonsConfig.style?.color;
|
|
4038
|
+
}
|
|
4039
|
+
paypal.Buttons(buttonsConfig).render(`#${this.payPalButtonContainerId}`);
|
|
4040
|
+
});
|
|
4041
|
+
}
|
|
4042
|
+
generateGuid() {
|
|
4043
|
+
let d = new Date().getTime(), d2 = (performance && performance.now && performance.now() * 1000) || 0;
|
|
4044
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
4045
|
+
let r = Math.random() * 16;
|
|
4046
|
+
if (d > 0) {
|
|
4047
|
+
r = (d + r) % 16 | 0;
|
|
4048
|
+
d = Math.floor(d / 16);
|
|
4049
|
+
}
|
|
4050
|
+
else {
|
|
4051
|
+
r = (d2 + r) % 16 | 0;
|
|
4052
|
+
d2 = Math.floor(d2 / 16);
|
|
4053
|
+
}
|
|
4054
|
+
return (c == "x" ? r : (r & 0x7) | 0x8).toString(16);
|
|
4055
|
+
});
|
|
4056
|
+
}
|
|
4057
|
+
static { this.ɵfac = function PayPalComponent_Factory(t) { return new (t || PayPalComponent)(i0.ɵɵdirectiveInject(PayPalScriptService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.NgZone)); }; }
|
|
4058
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PayPalComponent, selectors: [["anatoly-paypal"]], viewQuery: function PayPalComponent_Query(rf, ctx) { if (rf & 1) {
|
|
4059
|
+
i0.ɵɵviewQuery(_c0$f, 5);
|
|
4060
|
+
} if (rf & 2) {
|
|
4061
|
+
let _t;
|
|
4062
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.payPalButtonContainer = _t.first);
|
|
4063
|
+
} }, inputs: { config: "config", registerScript: "registerScript" }, outputs: { scriptLoaded: "scriptLoaded" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 1, consts: [[3, "id"], ["payPalButtonContainer", ""]], template: function PayPalComponent_Template(rf, ctx) { if (rf & 1) {
|
|
4064
|
+
i0.ɵɵelement(0, "div", 0, 1);
|
|
4065
|
+
} if (rf & 2) {
|
|
4066
|
+
i0.ɵɵproperty("id", ctx.payPalButtonContainerId);
|
|
4067
|
+
} }, encapsulation: 2, changeDetection: 0 }); }
|
|
4068
|
+
}
|
|
4069
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PayPalComponent, [{
|
|
4070
|
+
type: Component,
|
|
4071
|
+
args: [{
|
|
4072
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4073
|
+
selector: "anatoly-paypal",
|
|
4074
|
+
template: `
|
|
4075
|
+
<div #payPalButtonContainer [id]="payPalButtonContainerId"></div>
|
|
4076
|
+
`,
|
|
4077
|
+
}]
|
|
4078
|
+
}], () => [{ type: PayPalScriptService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], { config: [{
|
|
4079
|
+
type: Input
|
|
4080
|
+
}], registerScript: [{
|
|
4081
|
+
type: Input
|
|
4082
|
+
}], scriptLoaded: [{
|
|
4083
|
+
type: Output
|
|
4084
|
+
}], payPalButtonContainer: [{
|
|
4085
|
+
type: ViewChild,
|
|
4086
|
+
args: ["payPalButtonContainer", { static: false }]
|
|
4087
|
+
}] }); })();
|
|
4088
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PayPalComponent, { className: "PayPalComponent", filePath: "lib\\payments\\PayPal\\components\\paypal.component.ts", lineNumber: 58 }); })();
|
|
4089
|
+
|
|
4090
|
+
/*
|
|
4091
|
+
<file>
|
|
4092
|
+
Project:
|
|
4093
|
+
@osovitny/anatoly
|
|
4094
|
+
|
|
4095
|
+
Authors:
|
|
4096
|
+
Vadim Osovitny vadim@osovitny.com
|
|
4097
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
4098
|
+
|
|
4099
|
+
Created:
|
|
4100
|
+
14 Jun 2024
|
|
4101
|
+
|
|
4102
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
4103
|
+
</file>
|
|
4104
|
+
*/
|
|
4105
|
+
|
|
4106
|
+
/*
|
|
4107
|
+
<file>
|
|
4108
|
+
Project:
|
|
4109
|
+
@osovitny/anatoly
|
|
4110
|
+
|
|
4111
|
+
Authors:
|
|
4112
|
+
Vadim Osovitny vadim@osovitny.com
|
|
4113
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
4114
|
+
|
|
4115
|
+
Created:
|
|
4116
|
+
14 Jun 2024
|
|
4117
|
+
|
|
4118
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
4119
|
+
</file>
|
|
4120
|
+
*/
|
|
4121
|
+
//services
|
|
4122
|
+
|
|
3623
4123
|
/*
|
|
3624
4124
|
<file>
|
|
3625
4125
|
Project:
|
|
@@ -7495,6 +7995,52 @@ class AnatolyIAMPagesModule {
|
|
|
7495
7995
|
RouterModule,
|
|
7496
7996
|
HttpClientModule, i1.RouterModule] }); })();
|
|
7497
7997
|
|
|
7998
|
+
/*
|
|
7999
|
+
<file>
|
|
8000
|
+
Project:
|
|
8001
|
+
@osovitny/anatoly
|
|
8002
|
+
|
|
8003
|
+
Authors:
|
|
8004
|
+
Vadim Osovitny vadim@osovitny.com
|
|
8005
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
8006
|
+
|
|
8007
|
+
Created:
|
|
8008
|
+
14 Jun 2024
|
|
8009
|
+
|
|
8010
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
8011
|
+
</file>
|
|
8012
|
+
*/
|
|
8013
|
+
//Node
|
|
8014
|
+
class AnatolyPaymentsModule {
|
|
8015
|
+
static { this.ɵfac = function AnatolyPaymentsModule_Factory(t) { return new (t || AnatolyPaymentsModule)(); }; }
|
|
8016
|
+
static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyPaymentsModule }); }
|
|
8017
|
+
static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
|
|
8018
|
+
ScriptService,
|
|
8019
|
+
//PayPal
|
|
8020
|
+
PayPalScriptService
|
|
8021
|
+
], imports: [CommonModule] }); }
|
|
8022
|
+
}
|
|
8023
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnatolyPaymentsModule, [{
|
|
8024
|
+
type: NgModule,
|
|
8025
|
+
args: [{
|
|
8026
|
+
imports: [
|
|
8027
|
+
CommonModule
|
|
8028
|
+
],
|
|
8029
|
+
declarations: [
|
|
8030
|
+
PayPalComponent
|
|
8031
|
+
],
|
|
8032
|
+
exports: [
|
|
8033
|
+
PayPalComponent
|
|
8034
|
+
],
|
|
8035
|
+
providers: [
|
|
8036
|
+
ScriptService,
|
|
8037
|
+
//PayPal
|
|
8038
|
+
PayPalScriptService
|
|
8039
|
+
]
|
|
8040
|
+
}]
|
|
8041
|
+
}], null, null); })();
|
|
8042
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyPaymentsModule, { declarations: [PayPalComponent], imports: [CommonModule], exports: [PayPalComponent] }); })();
|
|
8043
|
+
|
|
7498
8044
|
/*
|
|
7499
8045
|
<file>
|
|
7500
8046
|
Project:
|
|
@@ -7853,5 +8399,5 @@ class AnatolyModule {
|
|
|
7853
8399
|
* Generated bundle index. Do not edit.
|
|
7854
8400
|
*/
|
|
7855
8401
|
|
|
7856
|
-
export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10NUrl, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, QSUtils, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, is, localizationInitializerFactory, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
|
|
8402
|
+
export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyPaymentsModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10NUrl, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, PayPalComponent, PayPalScriptService, QSUtils, ReplaceTextPipe, SafeHtmlPipe, ScriptService, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, is, localizationInitializerFactory, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
|
|
7857
8403
|
//# sourceMappingURL=osovitny-anatoly.mjs.map
|