ngx-stripe
Advanced tools
Comparing version 0.6.1 to 6.0.0-beta.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/BehaviorSubject'), require('rxjs/Observable'), require('rxjs/add/observable/combineLatest'), require('rxjs/add/observable/fromPromise'), require('rxjs/add/operator/switchMap'), require('rxjs/add/operator/filter'), require('rxjs/add/operator/map'), require('rxjs/add/operator/publishLast')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs/BehaviorSubject', 'rxjs/Observable', 'rxjs/add/observable/combineLatest', 'rxjs/add/observable/fromPromise', 'rxjs/add/operator/switchMap', 'rxjs/add/operator/filter', 'rxjs/add/operator/map', 'rxjs/add/operator/publishLast'], factory) : | ||
(factory((global.ng = global.ng || {}, global.ng.stripe = global.ng.stripe || {}),global.ng.core,global.Rx,global.Rx)); | ||
}(this, (function (exports,_angular_core,rxjs_BehaviorSubject,rxjs_Observable) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('src/services/stripe-instance.class')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', 'rxjs', 'rxjs/operators', 'src/services/stripe-instance.class'], factory) : | ||
(factory((global.ng = global.ng || {}, global.ng.stripe = global.ng.stripe || {}),global.ng.core,global.ng.common,global.Rx,global.Rx)); | ||
}(this, (function (exports,_angular_core,_angular_common,rxjs,rxjs_operators) { 'use strict'; | ||
var WindowRef = (function () { | ||
function WindowRef() { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var WindowRef = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
function WindowRef(platformId) { | ||
this.platformId = platformId; | ||
} | ||
@@ -14,8 +22,26 @@ /** | ||
WindowRef.prototype.getNativeWindow = function () { | ||
return window; | ||
if (_angular_common.isPlatformBrowser(this.platformId)) { | ||
return window; | ||
} | ||
return /** @type {?} */ ({}); | ||
}; | ||
return WindowRef; | ||
}()); | ||
var DocumentRef = (function () { | ||
function DocumentRef() { | ||
WindowRef.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
WindowRef.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var DocumentRef = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
function DocumentRef(platformId) { | ||
this.platformId = platformId; | ||
} | ||
@@ -26,15 +52,34 @@ /** | ||
DocumentRef.prototype.getNativeDocument = function () { | ||
return document; | ||
if (_angular_common.isPlatformBrowser(this.platformId)) { | ||
return document; | ||
} | ||
return /** @type {?} */ ({}); | ||
}; | ||
return DocumentRef; | ||
}()); | ||
var LazyStripeAPILoader = (function () { | ||
DocumentRef.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
DocumentRef.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
var LazyStripeAPILoader = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} window | ||
* @param {?} document | ||
*/ | ||
function LazyStripeAPILoader(window, document) { | ||
function LazyStripeAPILoader(platformId, window, document) { | ||
this.platformId = platformId; | ||
this.window = window; | ||
this.document = document; | ||
this.status = new rxjs_BehaviorSubject.BehaviorSubject({ | ||
this.status = new rxjs.BehaviorSubject({ | ||
error: false, | ||
@@ -63,2 +108,5 @@ loaded: false, | ||
var _this = this; | ||
if (_angular_common.isPlatformServer(this.platformId)) { | ||
return; | ||
} | ||
var /** @type {?} */ status = this.status.getValue(); | ||
@@ -101,12 +149,34 @@ if (this.window.getNativeWindow().hasOwnProperty('Stripe')) { | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
LazyStripeAPILoader.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, | ||
{ type: WindowRef, }, | ||
{ type: DocumentRef, }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var STRIPE_PUBLISHABLE_KEY = new _angular_core.InjectionToken('Stripe Publishable Key'); | ||
var STRIPE_OPTIONS = new _angular_core.InjectionToken('Stripe Options'); | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} sourceData | ||
@@ -119,2 +189,24 @@ * @return {?} | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} account | ||
@@ -154,4 +246,9 @@ * @return {?} | ||
} | ||
var StripeInstance = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeInstance$1 = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} loader | ||
@@ -162,4 +259,5 @@ * @param {?} window | ||
*/ | ||
function StripeInstance(loader, window, key, options) { | ||
function StripeInstance$1(platformId, loader, window, key, options) { | ||
var _this = this; | ||
this.platformId = platformId; | ||
this.loader = loader; | ||
@@ -170,5 +268,7 @@ this.window = window; | ||
this.stripeObject().subscribe(function (Stripe) { | ||
_this.stripe = _this.options | ||
? Stripe(_this.key, _this.options) | ||
: Stripe(_this.key); | ||
if (Stripe) { | ||
_this.stripe = _this.options | ||
? ((Stripe(_this.key, _this.options))) | ||
: ((Stripe(_this.key))); | ||
} | ||
}); | ||
@@ -179,3 +279,3 @@ } | ||
*/ | ||
StripeInstance.prototype.getInstance = function () { | ||
StripeInstance$1.prototype.getInstance = function () { | ||
return this.stripe; | ||
@@ -187,5 +287,5 @@ }; | ||
*/ | ||
StripeInstance.prototype.elements = function (options) { | ||
StripeInstance$1.prototype.elements = function (options) { | ||
var _this = this; | ||
return this.stripeObject().map(function () { return _this.stripe.elements(options); }); | ||
return this.stripeObject().pipe(rxjs_operators.map(function () { return _this.stripe.elements(options); })); | ||
}; | ||
@@ -197,11 +297,11 @@ /** | ||
*/ | ||
StripeInstance.prototype.createToken = function (a, b) { | ||
StripeInstance$1.prototype.createToken = function (a, b) { | ||
if (isBankAccount(a) && isBankAccountData(b)) { | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return rxjs.from(this.stripe.createToken(a, b)); | ||
} | ||
else if (isPii(a) && isPiiData(b)) { | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return rxjs.from(this.stripe.createToken(a, b)); | ||
} | ||
else { | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
return rxjs.from(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
} | ||
@@ -214,7 +314,7 @@ }; | ||
*/ | ||
StripeInstance.prototype.createSource = function (a, b) { | ||
StripeInstance$1.prototype.createSource = function (a, b) { | ||
if (isSourceData(a)) { | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a))); | ||
return rxjs.from(this.stripe.createSource(/** @type {?} */ (a))); | ||
} | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
return rxjs.from(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
}; | ||
@@ -225,4 +325,4 @@ /** | ||
*/ | ||
StripeInstance.prototype.retrieveSource = function (source) { | ||
return rxjs_Observable.Observable.fromPromise(this.stripe.retrieveSource(source)); | ||
StripeInstance$1.prototype.retrieveSource = function (source) { | ||
return rxjs.from(this.stripe.retrieveSource(source)); | ||
}; | ||
@@ -233,3 +333,3 @@ /** | ||
*/ | ||
StripeInstance.prototype.paymentRequest = function (options) { | ||
StripeInstance$1.prototype.paymentRequest = function (options) { | ||
return this.stripe.paymentRequest(options); | ||
@@ -240,13 +340,20 @@ }; | ||
*/ | ||
StripeInstance.prototype.stripeObject = function () { | ||
StripeInstance$1.prototype.stripeObject = function () { | ||
var _this = this; | ||
if (_angular_common.isPlatformBrowser(this.platformId)) { | ||
return rxjs.of(null); | ||
} | ||
return this.loader | ||
.asStream() | ||
.filter(function (status) { return status.loaded === true; }) | ||
.map(function () { return ((_this.window.getNativeWindow())).Stripe; }); | ||
.pipe(rxjs_operators.filter(function (status) { return status.loaded === true; }), rxjs_operators.map(function () { return ((_this.window.getNativeWindow())).Stripe; })); | ||
}; | ||
return StripeInstance; | ||
return StripeInstance$1; | ||
}()); | ||
var StripeService = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeService = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} key | ||
@@ -257,3 +364,4 @@ * @param {?} options | ||
*/ | ||
function StripeService(key, options, loader, window) { | ||
function StripeService(platformId, key, options, loader, window) { | ||
this.platformId = platformId; | ||
this.key = key; | ||
@@ -264,3 +372,3 @@ this.options = options; | ||
if (key) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
} | ||
@@ -275,4 +383,3 @@ } | ||
.asStream() | ||
.filter(function (status) { return status.loaded === true; }) | ||
.map(function () { return ((_this.window.getNativeWindow())).Stripe; }); | ||
.pipe(rxjs_operators.filter(function (status) { return status.loaded === true; }), rxjs_operators.map(function () { return ((_this.window.getNativeWindow())).Stripe; })); | ||
}; | ||
@@ -299,3 +406,3 @@ /** | ||
StripeService.prototype.changeKey = function (key, options) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
return this.stripe; | ||
@@ -345,6 +452,5 @@ }; | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeService.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -355,4 +461,9 @@ { type: undefined, decorators: [{ type: _angular_core.Inject, args: [STRIPE_OPTIONS,] },] }, | ||
]; }; | ||
var StripeFactoryService = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeFactoryService = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} baseKey | ||
@@ -363,3 +474,4 @@ * @param {?} baseOptions | ||
*/ | ||
function StripeFactoryService(baseKey, baseOptions, loader, window) { | ||
function StripeFactoryService(platformId, baseKey, baseOptions, loader, window) { | ||
this.platformId = platformId; | ||
this.baseKey = baseKey; | ||
@@ -376,3 +488,3 @@ this.baseOptions = baseOptions; | ||
StripeFactoryService.prototype.create = function (key, options) { | ||
return new StripeInstance(this.loader, this.window, key, options); | ||
return new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
}; | ||
@@ -384,6 +496,5 @@ return StripeFactoryService; | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeFactoryService.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -394,3 +505,7 @@ { type: undefined, decorators: [{ type: _angular_core.Inject, args: [STRIPE_OPTIONS,] },] }, | ||
]; }; | ||
var StripeCardComponent = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeCardComponent = /** @class */ (function () { | ||
/** | ||
@@ -403,5 +518,5 @@ * @param {?} stripeService | ||
this.on = new _angular_core.EventEmitter(); | ||
this.options$ = new rxjs_BehaviorSubject.BehaviorSubject({}); | ||
this.elementsOptions$ = new rxjs_BehaviorSubject.BehaviorSubject({}); | ||
this.stripe$ = new rxjs_BehaviorSubject.BehaviorSubject(null); | ||
this.options$ = new rxjs.BehaviorSubject({}); | ||
this.elementsOptions$ = new rxjs.BehaviorSubject({}); | ||
this.stripe$ = new rxjs.BehaviorSubject(null); | ||
} | ||
@@ -446,3 +561,3 @@ Object.defineProperty(StripeCardComponent.prototype, "options", { | ||
var _this = this; | ||
var /** @type {?} */ elements$ = rxjs_Observable.Observable.combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).switchMap(function (_a) { | ||
var /** @type {?} */ elements$ = rxjs.combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).pipe(rxjs_operators.switchMap(function (_a) { | ||
var options = _a[0], stripe = _a[1]; | ||
@@ -461,4 +576,4 @@ if (stripe) { | ||
} | ||
}); | ||
rxjs_Observable.Observable.combineLatest(elements$, this.options$.asObservable().filter(function (options) { return Boolean(options); })).subscribe(function (_a) { | ||
})); | ||
rxjs.combineLatest(elements$, this.options$.asObservable().pipe(rxjs_operators.filter(function (options) { return Boolean(options); }))).subscribe(function (_a) { | ||
var elements = _a[0], options = _a[1]; | ||
@@ -504,5 +619,3 @@ _this.element = elements.create('card', options); | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeCardComponent.ctorParameters = function () { return [ | ||
@@ -512,10 +625,14 @@ { type: StripeService, }, | ||
StripeCardComponent.propDecorators = { | ||
'card': [{ type: _angular_core.Output },], | ||
'on': [{ type: _angular_core.Output },], | ||
'stripeCard': [{ type: _angular_core.ViewChild, args: ['stripeCard',] },], | ||
'options': [{ type: _angular_core.Input },], | ||
'elementsOptions': [{ type: _angular_core.Input },], | ||
'stripe': [{ type: _angular_core.Input },], | ||
"card": [{ type: _angular_core.Output },], | ||
"on": [{ type: _angular_core.Output },], | ||
"stripeCard": [{ type: _angular_core.ViewChild, args: ['stripeCard',] },], | ||
"options": [{ type: _angular_core.Input },], | ||
"elementsOptions": [{ type: _angular_core.Input },], | ||
"stripe": [{ type: _angular_core.Input },], | ||
}; | ||
var NgxStripeModule = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var NgxStripeModule = /** @class */ (function () { | ||
function NgxStripeModule() { | ||
@@ -556,5 +673,3 @@ } | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
NgxStripeModule.ctorParameters = function () { return []; }; | ||
@@ -566,3 +681,3 @@ | ||
exports.StripeFactoryService = StripeFactoryService; | ||
exports.StripeInstance = StripeInstance; | ||
exports.StripeInstance = StripeInstance$1; | ||
exports.LazyStripeAPILoader = LazyStripeAPILoader; | ||
@@ -569,0 +684,0 @@ exports.WindowRef = WindowRef; |
@@ -1,2 +0,2 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs/BehaviorSubject"),require("rxjs/Observable"),require("rxjs/add/observable/combineLatest"),require("rxjs/add/observable/fromPromise"),require("rxjs/add/operator/switchMap"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/map"),require("rxjs/add/operator/publishLast")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/BehaviorSubject","rxjs/Observable","rxjs/add/observable/combineLatest","rxjs/add/observable/fromPromise","rxjs/add/operator/switchMap","rxjs/add/operator/filter","rxjs/add/operator/map","rxjs/add/operator/publishLast"],factory):factory((global.ng=global.ng||{},global.ng.stripe=global.ng.stripe||{}),global.ng.core,global.Rx,global.Rx)}(this,function(exports,_angular_core,rxjs_BehaviorSubject,rxjs_Observable){"use strict";function isSourceData(sourceData){return"type"in sourceData}function isBankAccount(account){return"bank_account"===account}function isBankAccountData(bankAccountData){return"country"in bankAccountData&&"currency"in bankAccountData&&"routing_number"in bankAccountData&&"account_number"in bankAccountData&&"account_holder_name"in bankAccountData&&"account_holder_type"in bankAccountData&&("individual"===bankAccountData.account_holder_type||"company"===bankAccountData.account_holder_type)}function isPii(pii){return"pii"===pii}function isPiiData(piiData){return"personal_id_number"in piiData}var WindowRef=function(){function WindowRef(){}return WindowRef.prototype.getNativeWindow=function(){return window},WindowRef}(),DocumentRef=function(){function DocumentRef(){}return DocumentRef.prototype.getNativeDocument=function(){return document},DocumentRef}(),LazyStripeAPILoader=function(){function LazyStripeAPILoader(window,document){this.window=window,this.document=document,this.status=new rxjs_BehaviorSubject.BehaviorSubject({error:!1,loaded:!1,loading:!1})}return LazyStripeAPILoader.prototype.asStream=function(){return this.load(),this.status.asObservable()},LazyStripeAPILoader.prototype.isReady=function(){return this.status.getValue().loaded},LazyStripeAPILoader.prototype.load=function(){var _this=this,status=this.status.getValue();if(this.window.getNativeWindow().hasOwnProperty("Stripe"))this.status.next({error:!1,loaded:!0,loading:!1});else if(!status.loaded&&!status.loading){this.status.next(Object.assign({},status,{loading:!0}));var script=this.document.getNativeDocument().createElement("script");script.type="text/javascript",script.async=!0,script.defer=!0,script.src="https://js.stripe.com/v3/",script.onload=function(){_this.status.next({error:!1,loaded:!0,loading:!1})},script.onerror=function(){_this.status.next({error:!0,loaded:!1,loading:!1})},this.document.getNativeDocument().body.appendChild(script)}},LazyStripeAPILoader}();LazyStripeAPILoader.decorators=[{type:_angular_core.Injectable}],LazyStripeAPILoader.ctorParameters=function(){return[{type:WindowRef},{type:DocumentRef}]};var STRIPE_PUBLISHABLE_KEY=new _angular_core.InjectionToken("Stripe Publishable Key"),STRIPE_OPTIONS=new _angular_core.InjectionToken("Stripe Options"),StripeInstance=function(){function StripeInstance(loader,window,key,options){var _this=this;this.loader=loader,this.window=window,this.key=key,this.options=options,this.stripeObject().subscribe(function(Stripe){_this.stripe=_this.options?Stripe(_this.key,_this.options):Stripe(_this.key)})}return StripeInstance.prototype.getInstance=function(){return this.stripe},StripeInstance.prototype.elements=function(options){var _this=this;return this.stripeObject().map(function(){return _this.stripe.elements(options)})},StripeInstance.prototype.createToken=function(a,b){return isBankAccount(a)&&isBankAccountData(b)?rxjs_Observable.Observable.fromPromise(this.stripe.createToken(a,b)):(isPii(a)&&isPiiData(b),rxjs_Observable.Observable.fromPromise(this.stripe.createToken(a,b)))},StripeInstance.prototype.createSource=function(a,b){return isSourceData(a)?rxjs_Observable.Observable.fromPromise(this.stripe.createSource(a)):rxjs_Observable.Observable.fromPromise(this.stripe.createSource(a,b))},StripeInstance.prototype.retrieveSource=function(source){return rxjs_Observable.Observable.fromPromise(this.stripe.retrieveSource(source))},StripeInstance.prototype.paymentRequest=function(options){return this.stripe.paymentRequest(options)},StripeInstance.prototype.stripeObject=function(){var _this=this;return this.loader.asStream().filter(function(status){return!0===status.loaded}).map(function(){return _this.window.getNativeWindow().Stripe})},StripeInstance}(),StripeService=function(){function StripeService(key,options,loader,window){this.key=key,this.options=options,this.loader=loader,this.window=window,key&&(this.stripe=new StripeInstance(this.loader,this.window,key,options))}return StripeService.prototype.getStripeReference=function(){var _this=this;return this.loader.asStream().filter(function(status){return!0===status.loaded}).map(function(){return _this.window.getNativeWindow().Stripe})},StripeService.prototype.getInstance=function(){return this.stripe.getInstance()},StripeService.prototype.setKey=function(key,options){return this.changeKey(key,options)},StripeService.prototype.changeKey=function(key,options){return this.stripe=new StripeInstance(this.loader,this.window,key,options),this.stripe},StripeService.prototype.elements=function(options){return this.stripe.elements(options)},StripeService.prototype.createToken=function(a,b){return this.stripe.createToken(a,b)},StripeService.prototype.createSource=function(a,b){return this.stripe.createSource(a,b)},StripeService.prototype.retrieveSource=function(source){return this.stripe.retrieveSource(source)},StripeService.prototype.paymentRequest=function(options){return this.stripe.paymentRequest(options)},StripeService}();StripeService.decorators=[{type:_angular_core.Injectable}],StripeService.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_PUBLISHABLE_KEY]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_OPTIONS]}]},{type:LazyStripeAPILoader},{type:WindowRef}]};var StripeFactoryService=function(){function StripeFactoryService(baseKey,baseOptions,loader,window){this.baseKey=baseKey,this.baseOptions=baseOptions,this.loader=loader,this.window=window}return StripeFactoryService.prototype.create=function(key,options){return new StripeInstance(this.loader,this.window,key,options)},StripeFactoryService}();StripeFactoryService.decorators=[{type:_angular_core.Injectable}],StripeFactoryService.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_PUBLISHABLE_KEY]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_OPTIONS]}]},{type:LazyStripeAPILoader},{type:WindowRef}]};var StripeCardComponent=function(){function StripeCardComponent(stripeService){this.stripeService=stripeService,this.card=new _angular_core.EventEmitter,this.on=new _angular_core.EventEmitter,this.options$=new rxjs_BehaviorSubject.BehaviorSubject({}),this.elementsOptions$=new rxjs_BehaviorSubject.BehaviorSubject({}),this.stripe$=new rxjs_BehaviorSubject.BehaviorSubject(null)}return Object.defineProperty(StripeCardComponent.prototype,"options",{set:function(optionsIn){this.options$.next(optionsIn)},enumerable:!0,configurable:!0}),Object.defineProperty(StripeCardComponent.prototype,"elementsOptions",{set:function(optionsIn){this.elementsOptions$.next(optionsIn)},enumerable:!0,configurable:!0}),Object.defineProperty(StripeCardComponent.prototype,"stripe",{set:function(stripeIn){this.stripe$.next(stripeIn)},enumerable:!0,configurable:!0}),StripeCardComponent.prototype.ngOnInit=function(){var _this=this,elements$=rxjs_Observable.Observable.combineLatest(this.elementsOptions$.asObservable(),this.stripe$.asObservable()).switchMap(function(_a){var options=_a[0],stripe=_a[1];return stripe?Object.keys(options).length>0?stripe.elements(options):stripe.elements():Object.keys(options).length>0?_this.stripeService.elements(options):_this.stripeService.elements()});rxjs_Observable.Observable.combineLatest(elements$,this.options$.asObservable().filter(function(options){return Boolean(options)})).subscribe(function(_a){var elements=_a[0],options=_a[1];_this.element=elements.create("card",options),_this.element.on("blur",function(ev){return _this.on.emit({event:ev,type:"blur"})}),_this.element.on("change",function(ev){return _this.on.emit({event:ev,type:"change"})}),_this.element.on("click",function(ev){return _this.on.emit({event:ev,type:"click"})}),_this.element.on("focus",function(ev){return _this.on.emit({event:ev,type:"focus"})}),_this.element.on("ready",function(ev){return _this.on.emit({event:ev,type:"ready"})}),_this.element.mount(_this.stripeCard.nativeElement),_this.card.emit(_this.element)})},StripeCardComponent.prototype.getCard=function(){return this.element},StripeCardComponent}();StripeCardComponent.decorators=[{type:_angular_core.Component,args:[{selector:"ngx-stripe-card",template:'<div class="field" #stripeCard></div>'}]}],StripeCardComponent.ctorParameters=function(){return[{type:StripeService}]},StripeCardComponent.propDecorators={card:[{type:_angular_core.Output}],on:[{type:_angular_core.Output}],stripeCard:[{type:_angular_core.ViewChild,args:["stripeCard"]}],options:[{type:_angular_core.Input}],elementsOptions:[{type:_angular_core.Input}],stripe:[{type:_angular_core.Input}]};var NgxStripeModule=function(){function NgxStripeModule(){}return NgxStripeModule.forRoot=function(publishableKey,options){return{ngModule:NgxStripeModule,providers:[LazyStripeAPILoader,StripeService,StripeFactoryService,WindowRef,DocumentRef,{provide:STRIPE_PUBLISHABLE_KEY,useValue:publishableKey},{provide:STRIPE_OPTIONS,useValue:options}]}},NgxStripeModule}();NgxStripeModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[StripeCardComponent],exports:[StripeCardComponent]}]}],NgxStripeModule.ctorParameters=function(){return[]},exports.NgxStripeModule=NgxStripeModule,exports.StripeCardComponent=StripeCardComponent,exports.StripeService=StripeService,exports.StripeFactoryService=StripeFactoryService,exports.StripeInstance=StripeInstance,exports.LazyStripeAPILoader=LazyStripeAPILoader,exports.WindowRef=WindowRef,exports.DocumentRef=DocumentRef,exports.isSourceData=isSourceData,exports.STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY,exports.STRIPE_OPTIONS=STRIPE_OPTIONS,exports.isBankAccount=isBankAccount,exports.isBankAccountData=isBankAccountData,exports.isPii=isPii,exports.isPiiData=isPiiData,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("src/services/stripe-instance.class")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common","rxjs","rxjs/operators","src/services/stripe-instance.class"],factory):factory((global.ng=global.ng||{},global.ng.stripe=global.ng.stripe||{}),global.ng.core,global.ng.common,global.Rx,global.Rx)}(this,function(exports,_angular_core,_angular_common,rxjs,rxjs_operators){"use strict";function isSourceData(sourceData){return"type"in sourceData}function isBankAccount(account){return"bank_account"===account}function isBankAccountData(bankAccountData){return"country"in bankAccountData&&"currency"in bankAccountData&&"routing_number"in bankAccountData&&"account_number"in bankAccountData&&"account_holder_name"in bankAccountData&&"account_holder_type"in bankAccountData&&("individual"===bankAccountData.account_holder_type||"company"===bankAccountData.account_holder_type)}function isPii(pii){return"pii"===pii}function isPiiData(piiData){return"personal_id_number"in piiData}var WindowRef=function(){function WindowRef(platformId){this.platformId=platformId}return WindowRef.prototype.getNativeWindow=function(){return _angular_common.isPlatformBrowser(this.platformId)?window:{}},WindowRef}();WindowRef.decorators=[{type:_angular_core.Injectable}],WindowRef.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[_angular_core.PLATFORM_ID]}]}]};var DocumentRef=function(){function DocumentRef(platformId){this.platformId=platformId}return DocumentRef.prototype.getNativeDocument=function(){return _angular_common.isPlatformBrowser(this.platformId)?document:{}},DocumentRef}();DocumentRef.decorators=[{type:_angular_core.Injectable}],DocumentRef.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[_angular_core.PLATFORM_ID]}]}]};var LazyStripeAPILoader=function(){function LazyStripeAPILoader(platformId,window,document){this.platformId=platformId,this.window=window,this.document=document,this.status=new rxjs.BehaviorSubject({error:!1,loaded:!1,loading:!1})}return LazyStripeAPILoader.prototype.asStream=function(){return this.load(),this.status.asObservable()},LazyStripeAPILoader.prototype.isReady=function(){return this.status.getValue().loaded},LazyStripeAPILoader.prototype.load=function(){var _this=this;if(!_angular_common.isPlatformServer(this.platformId)){var status=this.status.getValue();if(this.window.getNativeWindow().hasOwnProperty("Stripe"))this.status.next({error:!1,loaded:!0,loading:!1});else if(!status.loaded&&!status.loading){this.status.next(Object.assign({},status,{loading:!0}));var script=this.document.getNativeDocument().createElement("script");script.type="text/javascript",script.async=!0,script.defer=!0,script.src="https://js.stripe.com/v3/",script.onload=function(){_this.status.next({error:!1,loaded:!0,loading:!1})},script.onerror=function(){_this.status.next({error:!0,loaded:!1,loading:!1})},this.document.getNativeDocument().body.appendChild(script)}}},LazyStripeAPILoader}();LazyStripeAPILoader.decorators=[{type:_angular_core.Injectable}],LazyStripeAPILoader.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[_angular_core.PLATFORM_ID]}]},{type:WindowRef},{type:DocumentRef}]};var STRIPE_PUBLISHABLE_KEY=new _angular_core.InjectionToken("Stripe Publishable Key"),STRIPE_OPTIONS=new _angular_core.InjectionToken("Stripe Options"),StripeInstance$1=function(){function StripeInstance$1(platformId,loader,window,key,options){var _this=this;this.platformId=platformId,this.loader=loader,this.window=window,this.key=key,this.options=options,this.stripeObject().subscribe(function(Stripe){Stripe&&(_this.stripe=_this.options?Stripe(_this.key,_this.options):Stripe(_this.key))})}return StripeInstance$1.prototype.getInstance=function(){return this.stripe},StripeInstance$1.prototype.elements=function(options){var _this=this;return this.stripeObject().pipe(rxjs_operators.map(function(){return _this.stripe.elements(options)}))},StripeInstance$1.prototype.createToken=function(a,b){return isBankAccount(a)&&isBankAccountData(b)?rxjs.from(this.stripe.createToken(a,b)):(isPii(a)&&isPiiData(b),rxjs.from(this.stripe.createToken(a,b)))},StripeInstance$1.prototype.createSource=function(a,b){return isSourceData(a)?rxjs.from(this.stripe.createSource(a)):rxjs.from(this.stripe.createSource(a,b))},StripeInstance$1.prototype.retrieveSource=function(source){return rxjs.from(this.stripe.retrieveSource(source))},StripeInstance$1.prototype.paymentRequest=function(options){return this.stripe.paymentRequest(options)},StripeInstance$1.prototype.stripeObject=function(){var _this=this;return _angular_common.isPlatformBrowser(this.platformId)?rxjs.of(null):this.loader.asStream().pipe(rxjs_operators.filter(function(status){return!0===status.loaded}),rxjs_operators.map(function(){return _this.window.getNativeWindow().Stripe}))},StripeInstance$1}(),StripeService=function(){function StripeService(platformId,key,options,loader,window){this.platformId=platformId,this.key=key,this.options=options,this.loader=loader,this.window=window,key&&(this.stripe=new StripeInstance$1(this.platformId,this.loader,this.window,key,options))}return StripeService.prototype.getStripeReference=function(){var _this=this;return this.loader.asStream().pipe(rxjs_operators.filter(function(status){return!0===status.loaded}),rxjs_operators.map(function(){return _this.window.getNativeWindow().Stripe}))},StripeService.prototype.getInstance=function(){return this.stripe.getInstance()},StripeService.prototype.setKey=function(key,options){return this.changeKey(key,options)},StripeService.prototype.changeKey=function(key,options){return this.stripe=new StripeInstance$1(this.platformId,this.loader,this.window,key,options),this.stripe},StripeService.prototype.elements=function(options){return this.stripe.elements(options)},StripeService.prototype.createToken=function(a,b){return this.stripe.createToken(a,b)},StripeService.prototype.createSource=function(a,b){return this.stripe.createSource(a,b)},StripeService.prototype.retrieveSource=function(source){return this.stripe.retrieveSource(source)},StripeService.prototype.paymentRequest=function(options){return this.stripe.paymentRequest(options)},StripeService}();StripeService.decorators=[{type:_angular_core.Injectable}],StripeService.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[_angular_core.PLATFORM_ID]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_PUBLISHABLE_KEY]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_OPTIONS]}]},{type:LazyStripeAPILoader},{type:WindowRef}]};var StripeFactoryService=function(){function StripeFactoryService(platformId,baseKey,baseOptions,loader,window){this.platformId=platformId,this.baseKey=baseKey,this.baseOptions=baseOptions,this.loader=loader,this.window=window}return StripeFactoryService.prototype.create=function(key,options){return new StripeInstance$1(this.platformId,this.loader,this.window,key,options)},StripeFactoryService}();StripeFactoryService.decorators=[{type:_angular_core.Injectable}],StripeFactoryService.ctorParameters=function(){return[{type:void 0,decorators:[{type:_angular_core.Inject,args:[_angular_core.PLATFORM_ID]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_PUBLISHABLE_KEY]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STRIPE_OPTIONS]}]},{type:LazyStripeAPILoader},{type:WindowRef}]};var StripeCardComponent=function(){function StripeCardComponent(stripeService){this.stripeService=stripeService,this.card=new _angular_core.EventEmitter,this.on=new _angular_core.EventEmitter,this.options$=new rxjs.BehaviorSubject({}),this.elementsOptions$=new rxjs.BehaviorSubject({}),this.stripe$=new rxjs.BehaviorSubject(null)}return Object.defineProperty(StripeCardComponent.prototype,"options",{set:function(optionsIn){this.options$.next(optionsIn)},enumerable:!0,configurable:!0}),Object.defineProperty(StripeCardComponent.prototype,"elementsOptions",{set:function(optionsIn){this.elementsOptions$.next(optionsIn)},enumerable:!0,configurable:!0}),Object.defineProperty(StripeCardComponent.prototype,"stripe",{set:function(stripeIn){this.stripe$.next(stripeIn)},enumerable:!0,configurable:!0}),StripeCardComponent.prototype.ngOnInit=function(){var _this=this,elements$=rxjs.combineLatest(this.elementsOptions$.asObservable(),this.stripe$.asObservable()).pipe(rxjs_operators.switchMap(function(_a){var options=_a[0],stripe=_a[1];return stripe?Object.keys(options).length>0?stripe.elements(options):stripe.elements():Object.keys(options).length>0?_this.stripeService.elements(options):_this.stripeService.elements()}));rxjs.combineLatest(elements$,this.options$.asObservable().pipe(rxjs_operators.filter(function(options){return Boolean(options)}))).subscribe(function(_a){var elements=_a[0],options=_a[1];_this.element=elements.create("card",options),_this.element.on("blur",function(ev){return _this.on.emit({event:ev,type:"blur"})}),_this.element.on("change",function(ev){return _this.on.emit({event:ev,type:"change"})}),_this.element.on("click",function(ev){return _this.on.emit({event:ev,type:"click"})}),_this.element.on("focus",function(ev){return _this.on.emit({event:ev,type:"focus"})}),_this.element.on("ready",function(ev){return _this.on.emit({event:ev,type:"ready"})}),_this.element.mount(_this.stripeCard.nativeElement),_this.card.emit(_this.element)})},StripeCardComponent.prototype.getCard=function(){return this.element},StripeCardComponent}();StripeCardComponent.decorators=[{type:_angular_core.Component,args:[{selector:"ngx-stripe-card",template:'<div class="field" #stripeCard></div>'}]}],StripeCardComponent.ctorParameters=function(){return[{type:StripeService}]},StripeCardComponent.propDecorators={card:[{type:_angular_core.Output}],on:[{type:_angular_core.Output}],stripeCard:[{type:_angular_core.ViewChild,args:["stripeCard"]}],options:[{type:_angular_core.Input}],elementsOptions:[{type:_angular_core.Input}],stripe:[{type:_angular_core.Input}]};var NgxStripeModule=function(){function NgxStripeModule(){}return NgxStripeModule.forRoot=function(publishableKey,options){return{ngModule:NgxStripeModule,providers:[LazyStripeAPILoader,StripeService,StripeFactoryService,WindowRef,DocumentRef,{provide:STRIPE_PUBLISHABLE_KEY,useValue:publishableKey},{provide:STRIPE_OPTIONS,useValue:options}]}},NgxStripeModule}();NgxStripeModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[StripeCardComponent],exports:[StripeCardComponent]}]}],NgxStripeModule.ctorParameters=function(){return[]},exports.NgxStripeModule=NgxStripeModule,exports.StripeCardComponent=StripeCardComponent,exports.StripeService=StripeService,exports.StripeFactoryService=StripeFactoryService,exports.StripeInstance=StripeInstance$1,exports.LazyStripeAPILoader=LazyStripeAPILoader,exports.WindowRef=WindowRef,exports.DocumentRef=DocumentRef,exports.isSourceData=isSourceData,exports.STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY,exports.STRIPE_OPTIONS=STRIPE_OPTIONS,exports.isBankAccount=isBankAccount,exports.isBankAccountData=isBankAccountData,exports.isPii=isPii,exports.isPiiData=isPiiData,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-stripe.umd.min.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":3,"metadata":{"NgxStripeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","name":"StripeCardComponent"}],"exports":[{"__symbolic":"reference","name":"StripeCardComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["publishableKey","options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxStripeModule"},"providers":[{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"StripeService"},{"__symbolic":"reference","name":"StripeFactoryService"},{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"DocumentRef"},{"provide":{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"},"useValue":{"__symbolic":"reference","name":"publishableKey"}},{"provide":{"__symbolic":"reference","name":"STRIPE_OPTIONS"},"useValue":{"__symbolic":"reference","name":"options"}}]}}}},"StripeCardComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ngx-stripe-card","template":"<div class=\"field\" #stripeCard></div>"}]}],"members":{"card":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"on":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"stripeCard":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["stripeCard"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"elementsOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"stripe":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"StripeService"}]}],"ngOnInit":[{"__symbolic":"method"}],"getCard":[{"__symbolic":"method"}]}},"StripeService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"STRIPE_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Options"},{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"}]}],"getStripeReference":[{"__symbolic":"method"}],"getInstance":[{"__symbolic":"method"}],"setKey":[{"__symbolic":"method"}],"changeKey":[{"__symbolic":"method"}],"elements":[{"__symbolic":"method"}],"createToken":[{"__symbolic":"method"}],"createSource":[{"__symbolic":"method"}],"retrieveSource":[{"__symbolic":"method"}],"paymentRequest":[{"__symbolic":"method"}]}},"StripeFactoryService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"STRIPE_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"}]}],"create":[{"__symbolic":"method"}]}},"StripeInstance":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Options"}]}],"getInstance":[{"__symbolic":"method"}],"elements":[{"__symbolic":"method"}],"createToken":[{"__symbolic":"method"}],"createSource":[{"__symbolic":"method"}],"retrieveSource":[{"__symbolic":"method"}],"paymentRequest":[{"__symbolic":"method"}],"stripeObject":[{"__symbolic":"method"}]}},"StripeServiceInterface":{"__symbolic":"interface"},"LazyStripeAPILoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"DocumentRef"}]}],"asStream":[{"__symbolic":"method"}],"isReady":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}]}},"WindowRef":{"__symbolic":"class","members":{"getNativeWindow":[{"__symbolic":"method"}]}},"DocumentRef":{"__symbolic":"class","members":{"getNativeDocument":[{"__symbolic":"method"}]}},"Element":{"__symbolic":"interface"},"ElementOptions":{"__symbolic":"interface"},"ElementStyleAttributes":{"__symbolic":"interface"},"Elements":{"__symbolic":"interface"},"ElementsOptions":{"__symbolic":"interface"},"Source":{"__symbolic":"interface"},"SourceParams":{"__symbolic":"interface"},"SourceData":{"__symbolic":"interface"},"isSourceData":{"__symbolic":"function","parameters":["sourceData"],"value":{"__symbolic":"binop","operator":"in","left":"type","right":{"__symbolic":"reference","name":"sourceData"}}},"SourceResult":{"__symbolic":"interface"},"STRIPE_PUBLISHABLE_KEY":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Stripe Publishable Key"]},"STRIPE_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Stripe Options"]},"StripeJS":{"__symbolic":"interface"},"Options":{"__symbolic":"interface"},"Token":{"__symbolic":"interface"},"CardDataOptions":{"__symbolic":"interface"},"TokenResult":{"__symbolic":"interface"},"BankAccountData":{"__symbolic":"interface"},"PiiData":{"__symbolic":"interface"},"isBankAccount":{"__symbolic":"function","parameters":["account"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"account"},"right":"bank_account"}},"isBankAccountData":{"__symbolic":"function","parameters":["bankAccountData"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"country","right":{"__symbolic":"reference","name":"bankAccountData"}},"right":{"__symbolic":"binop","operator":"in","left":"currency","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"routing_number","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_number","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_holder_name","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_holder_type","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"bankAccountData"},"member":"account_holder_type"},"right":"individual"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"bankAccountData"},"member":"account_holder_type"},"right":"company"}}}},"isPii":{"__symbolic":"function","parameters":["pii"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"pii"},"right":"pii"}},"isPiiData":{"__symbolic":"function","parameters":["piiData"],"value":{"__symbolic":"binop","operator":"in","left":"personal_id_number","right":{"__symbolic":"reference","name":"piiData"}}},"Error":{"__symbolic":"interface"},"Address":{"__symbolic":"interface"}},"origins":{"NgxStripeModule":"./src/modules/ngx-stripe.module","StripeCardComponent":"./src/components/stripe-card.component","StripeService":"./src/services/stripe.service","StripeFactoryService":"./src/services/stripe-factory.service","StripeInstance":"./src/services/stripe-instance.class","StripeServiceInterface":"./src/services/stripe-instance.interface","LazyStripeAPILoader":"./src/services/api-loader.service","WindowRef":"./src/services/window-ref","DocumentRef":"./src/services/document-ref","Element":"./src/interfaces/element","ElementEventType":"./src/interfaces/element","ElementType":"./src/interfaces/element","ElementOptions":"./src/interfaces/element","ElementStyleAttributes":"./src/interfaces/element","Elements":"./src/interfaces/elements","ElementsOptions":"./src/interfaces/elements","FontElement":"./src/interfaces/elements","Source":"./src/interfaces/sources","UsageTypes":"./src/interfaces/sources","FlowTypes":"./src/interfaces/sources","SourceParams":"./src/interfaces/sources","SourceData":"./src/interfaces/sources","isSourceData":"./src/interfaces/sources","SourceResult":"./src/interfaces/sources","STRIPE_PUBLISHABLE_KEY":"./src/interfaces/stripe","STRIPE_OPTIONS":"./src/interfaces/stripe","StripeJS":"./src/interfaces/stripe","Options":"./src/interfaces/stripe","Token":"./src/interfaces/token","FieldCheck":"./src/interfaces/token","CardDataOptions":"./src/interfaces/token","TokenResult":"./src/interfaces/token","BankAccount":"./src/interfaces/token","BankAccountData":"./src/interfaces/token","Pii":"./src/interfaces/token","PiiData":"./src/interfaces/token","isBankAccount":"./src/interfaces/token","isBankAccountData":"./src/interfaces/token","isPii":"./src/interfaces/token","isPiiData":"./src/interfaces/token","Error":"./src/interfaces/utils","Address":"./src/interfaces/utils"},"importAs":"ngx-stripe"} | ||
{"__symbolic":"module","version":4,"metadata":{"NgxStripeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":16,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"StripeCardComponent"}],"exports":[{"__symbolic":"reference","name":"StripeCardComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["publishableKey","options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxStripeModule"},"providers":[{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"StripeService"},{"__symbolic":"reference","name":"StripeFactoryService"},{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"DocumentRef"},{"provide":{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"},"useValue":{"__symbolic":"reference","name":"publishableKey"}},{"provide":{"__symbolic":"reference","name":"STRIPE_OPTIONS"},"useValue":{"__symbolic":"reference","name":"options"}}]}}}},"StripeCardComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":22,"character":1},"arguments":[{"selector":"ngx-stripe-card","template":"<div class=\"field\" #stripeCard></div>"}]}],"members":{"card":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":27,"character":3}}]}],"on":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":28,"character":3}}]}],"stripeCard":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":31,"character":3},"arguments":["stripeCard"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"elementsOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"stripe":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"StripeService"}]}],"ngOnInit":[{"__symbolic":"method"}],"getCard":[{"__symbolic":"method"}]}},"StripeService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":38,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":43,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":43,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":44,"character":5},"arguments":[{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":45,"character":5},"arguments":[{"__symbolic":"reference","name":"STRIPE_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Options"},{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"}]}],"getStripeReference":[{"__symbolic":"method"}],"getInstance":[{"__symbolic":"method"}],"setKey":[{"__symbolic":"method"}],"changeKey":[{"__symbolic":"method"}],"elements":[{"__symbolic":"method"}],"createToken":[{"__symbolic":"method"}],"createSource":[{"__symbolic":"method"}],"retrieveSource":[{"__symbolic":"method"}],"paymentRequest":[{"__symbolic":"method"}]}},"StripeFactoryService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":12,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":15,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":15,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":16,"character":5},"arguments":[{"__symbolic":"reference","name":"STRIPE_PUBLISHABLE_KEY"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":17,"character":5},"arguments":[{"__symbolic":"reference","name":"STRIPE_OPTIONS"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"}]}],"create":[{"__symbolic":"method"}]}},"StripeInstance":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"LazyStripeAPILoader"},{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"Options"}]}],"getInstance":[{"__symbolic":"method"}],"elements":[{"__symbolic":"method"}],"createToken":[{"__symbolic":"method"}],"createSource":[{"__symbolic":"method"}],"retrieveSource":[{"__symbolic":"method"}],"paymentRequest":[{"__symbolic":"method"}],"stripeObject":[{"__symbolic":"method"}]}},"StripeServiceInterface":{"__symbolic":"interface"},"LazyStripeAPILoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":14,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":23,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":23,"character":12}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"WindowRef"},{"__symbolic":"reference","name":"DocumentRef"}]}],"asStream":[{"__symbolic":"method"}],"isReady":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}]}},"WindowRef":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":5,"character":15},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":5,"character":22}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}],"getNativeWindow":[{"__symbolic":"method"}]}},"DocumentRef":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":5,"character":15},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":5,"character":22}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}],"getNativeDocument":[{"__symbolic":"method"}]}},"Element":{"__symbolic":"interface"},"ElementEventType":{"__symbolic":"interface"},"ElementType":{"__symbolic":"interface"},"ElementOptions":{"__symbolic":"interface"},"ElementStyleAttributes":{"__symbolic":"interface"},"Elements":{"__symbolic":"interface"},"ElementsOptions":{"__symbolic":"interface"},"FontElement":{"__symbolic":"interface"},"Source":{"__symbolic":"interface"},"UsageTypes":{"__symbolic":"interface"},"FlowTypes":{"__symbolic":"interface"},"SourceParams":{"__symbolic":"interface"},"SourceData":{"__symbolic":"interface"},"isSourceData":{"__symbolic":"function","parameters":["sourceData"],"value":{"__symbolic":"binop","operator":"in","left":"type","right":{"__symbolic":"reference","name":"sourceData"}}},"SourceResult":{"__symbolic":"interface"},"STRIPE_PUBLISHABLE_KEY":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":15,"character":42},"arguments":["Stripe Publishable Key"]},"STRIPE_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":18,"character":34},"arguments":["Stripe Options"]},"StripeJS":{"__symbolic":"interface"},"Options":{"__symbolic":"interface"},"Token":{"__symbolic":"interface"},"FieldCheck":{"__symbolic":"interface"},"CardDataOptions":{"__symbolic":"interface"},"TokenResult":{"__symbolic":"interface"},"BankAccount":{"__symbolic":"interface"},"BankAccountData":{"__symbolic":"interface"},"Pii":{"__symbolic":"interface"},"PiiData":{"__symbolic":"interface"},"isBankAccount":{"__symbolic":"function","parameters":["account"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"account"},"right":"bank_account"}},"isBankAccountData":{"__symbolic":"function","parameters":["bankAccountData"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"in","left":"country","right":{"__symbolic":"reference","name":"bankAccountData"}},"right":{"__symbolic":"binop","operator":"in","left":"currency","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"routing_number","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_number","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_holder_name","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"in","left":"account_holder_type","right":{"__symbolic":"reference","name":"bankAccountData"}}},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"bankAccountData"},"member":"account_holder_type"},"right":"individual"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"bankAccountData"},"member":"account_holder_type"},"right":"company"}}}},"isPii":{"__symbolic":"function","parameters":["pii"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"pii"},"right":"pii"}},"isPiiData":{"__symbolic":"function","parameters":["piiData"],"value":{"__symbolic":"binop","operator":"in","left":"personal_id_number","right":{"__symbolic":"reference","name":"piiData"}}},"Error":{"__symbolic":"interface"},"Address":{"__symbolic":"interface"}},"origins":{"NgxStripeModule":"./src/modules/ngx-stripe.module","StripeCardComponent":"./src/components/stripe-card.component","StripeService":"./src/services/stripe.service","StripeFactoryService":"./src/services/stripe-factory.service","StripeInstance":"./src/services/stripe-instance.class","StripeServiceInterface":"./src/services/stripe-instance.interface","LazyStripeAPILoader":"./src/services/api-loader.service","WindowRef":"./src/services/window-ref.service","DocumentRef":"./src/services/document-ref.service","Element":"./src/interfaces/element","ElementEventType":"./src/interfaces/element","ElementType":"./src/interfaces/element","ElementOptions":"./src/interfaces/element","ElementStyleAttributes":"./src/interfaces/element","Elements":"./src/interfaces/elements","ElementsOptions":"./src/interfaces/elements","FontElement":"./src/interfaces/elements","Source":"./src/interfaces/sources","UsageTypes":"./src/interfaces/sources","FlowTypes":"./src/interfaces/sources","SourceParams":"./src/interfaces/sources","SourceData":"./src/interfaces/sources","isSourceData":"./src/interfaces/sources","SourceResult":"./src/interfaces/sources","STRIPE_PUBLISHABLE_KEY":"./src/interfaces/stripe","STRIPE_OPTIONS":"./src/interfaces/stripe","StripeJS":"./src/interfaces/stripe","Options":"./src/interfaces/stripe","Token":"./src/interfaces/token","FieldCheck":"./src/interfaces/token","CardDataOptions":"./src/interfaces/token","TokenResult":"./src/interfaces/token","BankAccount":"./src/interfaces/token","BankAccountData":"./src/interfaces/token","Pii":"./src/interfaces/token","PiiData":"./src/interfaces/token","isBankAccount":"./src/interfaces/token","isBankAccountData":"./src/interfaces/token","isPii":"./src/interfaces/token","isPiiData":"./src/interfaces/token","Error":"./src/interfaces/utils","Address":"./src/interfaces/utils"},"importAs":"ngx-stripe"} |
@@ -1,12 +0,16 @@ | ||
import { Component, EventEmitter, Inject, Injectable, InjectionToken, Input, NgModule, Output, ViewChild } from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/combineLatest'; | ||
import 'rxjs/add/observable/fromPromise'; | ||
import 'rxjs/add/operator/switchMap'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/publishLast'; | ||
var WindowRef = (function () { | ||
function WindowRef() { | ||
import { Component, EventEmitter, Inject, Injectable, InjectionToken, Input, NgModule, Output, PLATFORM_ID, ViewChild } from '@angular/core'; | ||
import { isPlatformBrowser, isPlatformServer } from '@angular/common'; | ||
import { BehaviorSubject, combineLatest, from, of } from 'rxjs'; | ||
import { filter, map, switchMap } from 'rxjs/operators'; | ||
import 'src/services/stripe-instance.class'; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var WindowRef = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
function WindowRef(platformId) { | ||
this.platformId = platformId; | ||
} | ||
@@ -17,8 +21,26 @@ /** | ||
WindowRef.prototype.getNativeWindow = function () { | ||
return window; | ||
if (isPlatformBrowser(this.platformId)) { | ||
return window; | ||
} | ||
return /** @type {?} */ ({}); | ||
}; | ||
return WindowRef; | ||
}()); | ||
var DocumentRef = (function () { | ||
function DocumentRef() { | ||
WindowRef.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
WindowRef.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var DocumentRef = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
function DocumentRef(platformId) { | ||
this.platformId = platformId; | ||
} | ||
@@ -29,12 +51,31 @@ /** | ||
DocumentRef.prototype.getNativeDocument = function () { | ||
return document; | ||
if (isPlatformBrowser(this.platformId)) { | ||
return document; | ||
} | ||
return /** @type {?} */ ({}); | ||
}; | ||
return DocumentRef; | ||
}()); | ||
var LazyStripeAPILoader = (function () { | ||
DocumentRef.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
DocumentRef.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
var LazyStripeAPILoader = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} window | ||
* @param {?} document | ||
*/ | ||
function LazyStripeAPILoader(window, document) { | ||
function LazyStripeAPILoader(platformId, window, document) { | ||
this.platformId = platformId; | ||
this.window = window; | ||
@@ -66,2 +107,5 @@ this.document = document; | ||
var _this = this; | ||
if (isPlatformServer(this.platformId)) { | ||
return; | ||
} | ||
var /** @type {?} */ status = this.status.getValue(); | ||
@@ -104,12 +148,34 @@ if (this.window.getNativeWindow().hasOwnProperty('Stripe')) { | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
LazyStripeAPILoader.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: WindowRef, }, | ||
{ type: DocumentRef, }, | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var STRIPE_PUBLISHABLE_KEY = new InjectionToken('Stripe Publishable Key'); | ||
var STRIPE_OPTIONS = new InjectionToken('Stripe Options'); | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} sourceData | ||
@@ -122,2 +188,24 @@ * @return {?} | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} account | ||
@@ -157,4 +245,9 @@ * @return {?} | ||
} | ||
var StripeInstance = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeInstance$1 = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} loader | ||
@@ -165,4 +258,5 @@ * @param {?} window | ||
*/ | ||
function StripeInstance(loader, window, key, options) { | ||
function StripeInstance$1(platformId, loader, window, key, options) { | ||
var _this = this; | ||
this.platformId = platformId; | ||
this.loader = loader; | ||
@@ -173,5 +267,7 @@ this.window = window; | ||
this.stripeObject().subscribe(function (Stripe) { | ||
_this.stripe = _this.options | ||
? Stripe(_this.key, _this.options) | ||
: Stripe(_this.key); | ||
if (Stripe) { | ||
_this.stripe = _this.options | ||
? ((Stripe(_this.key, _this.options))) | ||
: ((Stripe(_this.key))); | ||
} | ||
}); | ||
@@ -182,3 +278,3 @@ } | ||
*/ | ||
StripeInstance.prototype.getInstance = function () { | ||
StripeInstance$1.prototype.getInstance = function () { | ||
return this.stripe; | ||
@@ -190,5 +286,5 @@ }; | ||
*/ | ||
StripeInstance.prototype.elements = function (options) { | ||
StripeInstance$1.prototype.elements = function (options) { | ||
var _this = this; | ||
return this.stripeObject().map(function () { return _this.stripe.elements(options); }); | ||
return this.stripeObject().pipe(map(function () { return _this.stripe.elements(options); })); | ||
}; | ||
@@ -200,11 +296,11 @@ /** | ||
*/ | ||
StripeInstance.prototype.createToken = function (a, b) { | ||
StripeInstance$1.prototype.createToken = function (a, b) { | ||
if (isBankAccount(a) && isBankAccountData(b)) { | ||
return Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return from(this.stripe.createToken(a, b)); | ||
} | ||
else if (isPii(a) && isPiiData(b)) { | ||
return Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return from(this.stripe.createToken(a, b)); | ||
} | ||
else { | ||
return Observable.fromPromise(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
return from(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
} | ||
@@ -217,7 +313,7 @@ }; | ||
*/ | ||
StripeInstance.prototype.createSource = function (a, b) { | ||
StripeInstance$1.prototype.createSource = function (a, b) { | ||
if (isSourceData(a)) { | ||
return Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a))); | ||
return from(this.stripe.createSource(/** @type {?} */ (a))); | ||
} | ||
return Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
return from(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
}; | ||
@@ -228,4 +324,4 @@ /** | ||
*/ | ||
StripeInstance.prototype.retrieveSource = function (source) { | ||
return Observable.fromPromise(this.stripe.retrieveSource(source)); | ||
StripeInstance$1.prototype.retrieveSource = function (source) { | ||
return from(this.stripe.retrieveSource(source)); | ||
}; | ||
@@ -236,3 +332,3 @@ /** | ||
*/ | ||
StripeInstance.prototype.paymentRequest = function (options) { | ||
StripeInstance$1.prototype.paymentRequest = function (options) { | ||
return this.stripe.paymentRequest(options); | ||
@@ -243,13 +339,20 @@ }; | ||
*/ | ||
StripeInstance.prototype.stripeObject = function () { | ||
StripeInstance$1.prototype.stripeObject = function () { | ||
var _this = this; | ||
if (isPlatformBrowser(this.platformId)) { | ||
return of(null); | ||
} | ||
return this.loader | ||
.asStream() | ||
.filter(function (status) { return status.loaded === true; }) | ||
.map(function () { return ((_this.window.getNativeWindow())).Stripe; }); | ||
.pipe(filter(function (status) { return status.loaded === true; }), map(function () { return ((_this.window.getNativeWindow())).Stripe; })); | ||
}; | ||
return StripeInstance; | ||
return StripeInstance$1; | ||
}()); | ||
var StripeService = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeService = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} key | ||
@@ -260,3 +363,4 @@ * @param {?} options | ||
*/ | ||
function StripeService(key, options, loader, window) { | ||
function StripeService(platformId, key, options, loader, window) { | ||
this.platformId = platformId; | ||
this.key = key; | ||
@@ -267,3 +371,3 @@ this.options = options; | ||
if (key) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
} | ||
@@ -278,4 +382,3 @@ } | ||
.asStream() | ||
.filter(function (status) { return status.loaded === true; }) | ||
.map(function () { return ((_this.window.getNativeWindow())).Stripe; }); | ||
.pipe(filter(function (status) { return status.loaded === true; }), map(function () { return ((_this.window.getNativeWindow())).Stripe; })); | ||
}; | ||
@@ -302,3 +405,3 @@ /** | ||
StripeService.prototype.changeKey = function (key, options) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
return this.stripe; | ||
@@ -348,6 +451,5 @@ }; | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeService.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -358,4 +460,9 @@ { type: undefined, decorators: [{ type: Inject, args: [STRIPE_OPTIONS,] },] }, | ||
]; }; | ||
var StripeFactoryService = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeFactoryService = /** @class */ (function () { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} baseKey | ||
@@ -366,3 +473,4 @@ * @param {?} baseOptions | ||
*/ | ||
function StripeFactoryService(baseKey, baseOptions, loader, window) { | ||
function StripeFactoryService(platformId, baseKey, baseOptions, loader, window) { | ||
this.platformId = platformId; | ||
this.baseKey = baseKey; | ||
@@ -379,3 +487,3 @@ this.baseOptions = baseOptions; | ||
StripeFactoryService.prototype.create = function (key, options) { | ||
return new StripeInstance(this.loader, this.window, key, options); | ||
return new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
}; | ||
@@ -387,6 +495,5 @@ return StripeFactoryService; | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeFactoryService.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -397,3 +504,7 @@ { type: undefined, decorators: [{ type: Inject, args: [STRIPE_OPTIONS,] },] }, | ||
]; }; | ||
var StripeCardComponent = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var StripeCardComponent = /** @class */ (function () { | ||
/** | ||
@@ -448,3 +559,3 @@ * @param {?} stripeService | ||
var _this = this; | ||
var /** @type {?} */ elements$ = Observable.combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).switchMap(function (_a) { | ||
var /** @type {?} */ elements$ = combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).pipe(switchMap(function (_a) { | ||
var options = _a[0], stripe = _a[1]; | ||
@@ -463,4 +574,4 @@ if (stripe) { | ||
} | ||
}); | ||
Observable.combineLatest(elements$, this.options$.asObservable().filter(function (options) { return Boolean(options); })).subscribe(function (_a) { | ||
})); | ||
combineLatest(elements$, this.options$.asObservable().pipe(filter(function (options) { return Boolean(options); }))).subscribe(function (_a) { | ||
var elements = _a[0], options = _a[1]; | ||
@@ -506,5 +617,3 @@ _this.element = elements.create('card', options); | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeCardComponent.ctorParameters = function () { return [ | ||
@@ -514,10 +623,14 @@ { type: StripeService, }, | ||
StripeCardComponent.propDecorators = { | ||
'card': [{ type: Output },], | ||
'on': [{ type: Output },], | ||
'stripeCard': [{ type: ViewChild, args: ['stripeCard',] },], | ||
'options': [{ type: Input },], | ||
'elementsOptions': [{ type: Input },], | ||
'stripe': [{ type: Input },], | ||
"card": [{ type: Output },], | ||
"on": [{ type: Output },], | ||
"stripeCard": [{ type: ViewChild, args: ['stripeCard',] },], | ||
"options": [{ type: Input },], | ||
"elementsOptions": [{ type: Input },], | ||
"stripe": [{ type: Input },], | ||
}; | ||
var NgxStripeModule = (function () { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var NgxStripeModule = /** @class */ (function () { | ||
function NgxStripeModule() { | ||
@@ -558,14 +671,23 @@ } | ||
]; | ||
/** @nocollapse */ | ||
NgxStripeModule.ctorParameters = function () { return []; }; | ||
/** | ||
* @nocollapse | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
NgxStripeModule.ctorParameters = function () { return []; }; | ||
// Public classes. | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Entry point for all public APIs of the package. | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { NgxStripeModule, StripeCardComponent, StripeService, StripeFactoryService, StripeInstance, LazyStripeAPILoader, WindowRef, DocumentRef, isSourceData, STRIPE_PUBLISHABLE_KEY, STRIPE_OPTIONS, isBankAccount, isBankAccountData, isPii, isPiiData }; | ||
export { NgxStripeModule, StripeCardComponent, StripeService, StripeFactoryService, StripeInstance$1 as StripeInstance, LazyStripeAPILoader, WindowRef, DocumentRef, isSourceData, STRIPE_PUBLISHABLE_KEY, STRIPE_OPTIONS, isBankAccount, isBankAccountData, isPii, isPiiData }; | ||
//# sourceMappingURL=ngx-stripe.es5.js.map |
@@ -1,35 +0,81 @@ | ||
import { Component, EventEmitter, Inject, Injectable, InjectionToken, Input, NgModule, Output, ViewChild } from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/combineLatest'; | ||
import 'rxjs/add/observable/fromPromise'; | ||
import 'rxjs/add/operator/switchMap'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/publishLast'; | ||
import { Component, EventEmitter, Inject, Injectable, InjectionToken, Input, NgModule, Output, PLATFORM_ID, ViewChild } from '@angular/core'; | ||
import { isPlatformBrowser, isPlatformServer } from '@angular/common'; | ||
import { BehaviorSubject, combineLatest, from, of } from 'rxjs'; | ||
import { filter, map, switchMap } from 'rxjs/operators'; | ||
import 'src/services/stripe-instance.class'; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class WindowRef { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
constructor(platformId) { | ||
this.platformId = platformId; | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
getNativeWindow() { | ||
return window; | ||
if (isPlatformBrowser(this.platformId)) { | ||
return window; | ||
} | ||
return /** @type {?} */ ({}); | ||
} | ||
} | ||
WindowRef.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
WindowRef.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
]; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class DocumentRef { | ||
/** | ||
* @param {?} platformId | ||
*/ | ||
constructor(platformId) { | ||
this.platformId = platformId; | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
getNativeDocument() { | ||
return document; | ||
if (isPlatformBrowser(this.platformId)) { | ||
return document; | ||
} | ||
return /** @type {?} */ ({}); | ||
} | ||
} | ||
DocumentRef.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
DocumentRef.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
]; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
class LazyStripeAPILoader { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} window | ||
* @param {?} document | ||
*/ | ||
constructor(window, document) { | ||
constructor(platformId, window, document) { | ||
this.platformId = platformId; | ||
this.window = window; | ||
@@ -60,2 +106,5 @@ this.document = document; | ||
load() { | ||
if (isPlatformServer(this.platformId)) { | ||
return; | ||
} | ||
const /** @type {?} */ status = this.status.getValue(); | ||
@@ -97,6 +146,5 @@ if (this.window.getNativeWindow().hasOwnProperty('Stripe')) { | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
LazyStripeAPILoader.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: WindowRef, }, | ||
@@ -106,6 +154,33 @@ { type: DocumentRef, }, | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
const STRIPE_PUBLISHABLE_KEY = new InjectionToken('Stripe Publishable Key'); | ||
const STRIPE_OPTIONS = new InjectionToken('Stripe Options'); | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} sourceData | ||
@@ -117,4 +192,31 @@ * @return {?} | ||
} | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @record | ||
*/ | ||
/** | ||
* @param {?} account | ||
@@ -155,4 +257,9 @@ * @return {?} | ||
class StripeInstance { | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class StripeInstance$1 { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} loader | ||
@@ -163,3 +270,4 @@ * @param {?} window | ||
*/ | ||
constructor(loader, window, key, options) { | ||
constructor(platformId, loader, window, key, options) { | ||
this.platformId = platformId; | ||
this.loader = loader; | ||
@@ -170,5 +278,7 @@ this.window = window; | ||
this.stripeObject().subscribe((Stripe) => { | ||
this.stripe = this.options | ||
? Stripe(this.key, this.options) | ||
: Stripe(this.key); | ||
if (Stripe) { | ||
this.stripe = this.options | ||
? (/** @type {?} */ (Stripe(this.key, this.options))) | ||
: (/** @type {?} */ (Stripe(this.key))); | ||
} | ||
}); | ||
@@ -187,3 +297,3 @@ } | ||
elements(options) { | ||
return this.stripeObject().map(() => this.stripe.elements(options)); | ||
return this.stripeObject().pipe(map(() => this.stripe.elements(options))); | ||
} | ||
@@ -197,9 +307,9 @@ /** | ||
if (isBankAccount(a) && isBankAccountData(b)) { | ||
return Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return from(this.stripe.createToken(a, b)); | ||
} | ||
else if (isPii(a) && isPiiData(b)) { | ||
return Observable.fromPromise(this.stripe.createToken(a, b)); | ||
return from(this.stripe.createToken(a, b)); | ||
} | ||
else { | ||
return Observable.fromPromise(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
return from(this.stripe.createToken(/** @type {?} */ (a), /** @type {?} */ (b))); | ||
} | ||
@@ -214,5 +324,5 @@ } | ||
if (isSourceData(a)) { | ||
return Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a))); | ||
return from(this.stripe.createSource(/** @type {?} */ (a))); | ||
} | ||
return Observable.fromPromise(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
return from(this.stripe.createSource(/** @type {?} */ (a), b)); | ||
} | ||
@@ -224,3 +334,3 @@ /** | ||
retrieveSource(source) { | ||
return Observable.fromPromise(this.stripe.retrieveSource(source)); | ||
return from(this.stripe.retrieveSource(source)); | ||
} | ||
@@ -238,11 +348,18 @@ /** | ||
stripeObject() { | ||
if (isPlatformBrowser(this.platformId)) { | ||
return of(null); | ||
} | ||
return this.loader | ||
.asStream() | ||
.filter((status) => status.loaded === true) | ||
.map(() => ((this.window.getNativeWindow())).Stripe); | ||
.pipe(filter((status) => status.loaded === true), map(() => (/** @type {?} */ (this.window.getNativeWindow())).Stripe)); | ||
} | ||
} | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class StripeService { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} key | ||
@@ -253,3 +370,4 @@ * @param {?} options | ||
*/ | ||
constructor(key, options, loader, window) { | ||
constructor(platformId, key, options, loader, window) { | ||
this.platformId = platformId; | ||
this.key = key; | ||
@@ -260,3 +378,3 @@ this.options = options; | ||
if (key) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
} | ||
@@ -270,4 +388,3 @@ } | ||
.asStream() | ||
.filter((status) => status.loaded === true) | ||
.map(() => ((this.window.getNativeWindow())).Stripe); | ||
.pipe(filter((status) => status.loaded === true), map(() => (/** @type {?} */ (this.window.getNativeWindow())).Stripe)); | ||
} | ||
@@ -294,3 +411,3 @@ /** | ||
changeKey(key, options) { | ||
this.stripe = new StripeInstance(this.loader, this.window, key, options); | ||
this.stripe = new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
return this.stripe; | ||
@@ -339,6 +456,5 @@ } | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeService.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -350,4 +466,9 @@ { type: undefined, decorators: [{ type: Inject, args: [STRIPE_OPTIONS,] },] }, | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class StripeFactoryService { | ||
/** | ||
* @param {?} platformId | ||
* @param {?} baseKey | ||
@@ -358,3 +479,4 @@ * @param {?} baseOptions | ||
*/ | ||
constructor(baseKey, baseOptions, loader, window) { | ||
constructor(platformId, baseKey, baseOptions, loader, window) { | ||
this.platformId = platformId; | ||
this.baseKey = baseKey; | ||
@@ -371,3 +493,3 @@ this.baseOptions = baseOptions; | ||
create(key, options) { | ||
return new StripeInstance(this.loader, this.window, key, options); | ||
return new StripeInstance$1(this.platformId, this.loader, this.window, key, options); | ||
} | ||
@@ -378,6 +500,5 @@ } | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeFactoryService.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [STRIPE_PUBLISHABLE_KEY,] },] }, | ||
@@ -389,2 +510,6 @@ { type: undefined, decorators: [{ type: Inject, args: [STRIPE_OPTIONS,] },] }, | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class StripeCardComponent { | ||
@@ -427,3 +552,3 @@ /** | ||
ngOnInit() { | ||
const /** @type {?} */ elements$ = Observable.combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).switchMap(([options, stripe]) => { | ||
const /** @type {?} */ elements$ = combineLatest(this.elementsOptions$.asObservable(), this.stripe$.asObservable()).pipe(switchMap(([options, stripe]) => { | ||
if (stripe) { | ||
@@ -441,4 +566,4 @@ if (Object.keys(options).length > 0) { | ||
} | ||
}); | ||
Observable.combineLatest(elements$, this.options$.asObservable().filter(options => Boolean(options))).subscribe(([elements, options]) => { | ||
})); | ||
combineLatest(elements$, this.options$.asObservable().pipe(filter(options => Boolean(options)))).subscribe(([elements, options]) => { | ||
this.element = elements.create('card', options); | ||
@@ -482,5 +607,3 @@ this.element.on('blur', ev => this.on.emit({ | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
/** @nocollapse */ | ||
StripeCardComponent.ctorParameters = () => [ | ||
@@ -490,10 +613,14 @@ { type: StripeService, }, | ||
StripeCardComponent.propDecorators = { | ||
'card': [{ type: Output },], | ||
'on': [{ type: Output },], | ||
'stripeCard': [{ type: ViewChild, args: ['stripeCard',] },], | ||
'options': [{ type: Input },], | ||
'elementsOptions': [{ type: Input },], | ||
'stripe': [{ type: Input },], | ||
"card": [{ type: Output },], | ||
"on": [{ type: Output },], | ||
"stripeCard": [{ type: ViewChild, args: ['stripeCard',] },], | ||
"options": [{ type: Input },], | ||
"elementsOptions": [{ type: Input },], | ||
"stripe": [{ type: Input },], | ||
}; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class NgxStripeModule { | ||
@@ -532,10 +659,15 @@ /** | ||
]; | ||
/** @nocollapse */ | ||
NgxStripeModule.ctorParameters = () => []; | ||
/** | ||
* @nocollapse | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
NgxStripeModule.ctorParameters = () => []; | ||
// Public classes. | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Entry point for all public APIs of the package. | ||
@@ -545,6 +677,10 @@ */ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { NgxStripeModule, StripeCardComponent, StripeService, StripeFactoryService, StripeInstance, LazyStripeAPILoader, WindowRef, DocumentRef, isSourceData, STRIPE_PUBLISHABLE_KEY, STRIPE_OPTIONS, isBankAccount, isBankAccountData, isPii, isPiiData }; | ||
export { NgxStripeModule, StripeCardComponent, StripeService, StripeFactoryService, StripeInstance$1 as StripeInstance, LazyStripeAPILoader, WindowRef, DocumentRef, isSourceData, STRIPE_PUBLISHABLE_KEY, STRIPE_OPTIONS, isBankAccount, isBankAccountData, isPii, isPiiData }; | ||
//# sourceMappingURL=ngx-stripe.js.map |
{ | ||
"name": "ngx-stripe", | ||
"version": "0.6.1", | ||
"version": "6.0.0-beta.0", | ||
"description": "Angular 2+ wrapper for StripeJS", | ||
@@ -33,14 +33,14 @@ "main": "./bundles/ngx-stripe.umd.js", | ||
"peerDependencies": { | ||
"@angular/common": ">= 4.1.0", | ||
"@angular/core": ">= 4.1.0" | ||
"@angular/common": "^6.0.0-rc.1", | ||
"@angular/core": "^6.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"@angular/animations": "4.1.0", | ||
"@angular/common": "4.1.0", | ||
"@angular/compiler": "4.1.0", | ||
"@angular/compiler-cli": "4.1.0", | ||
"@angular/core": "4.1.0", | ||
"@angular/platform-browser": "4.1.0", | ||
"@angular/platform-browser-dynamic": "4.1.0", | ||
"@angular/platform-server": "4.1.0", | ||
"@angular/animations": "^6.0.0-rc.1", | ||
"@angular/common": "^6.0.0-rc.1", | ||
"@angular/compiler": "^6.0.0-rc.1", | ||
"@angular/compiler-cli": "^6.0.0-rc.1", | ||
"@angular/core": "^6.0.0-rc.1", | ||
"@angular/platform-browser": "^6.0.0-rc.1", | ||
"@angular/platform-browser-dynamic": "^6.0.0-rc.1", | ||
"@angular/platform-server": "^6.0.0-rc.1", | ||
"@compodoc/compodoc": "1.0.0-beta.10", | ||
@@ -62,3 +62,3 @@ "@types/jasmine": "2.5.52", | ||
"rollup-plugin-node-resolve": "3.0.0", | ||
"rxjs": "5.4.1", | ||
"rxjs": "6.0.0-rc.0", | ||
"shelljs": "0.7.8", | ||
@@ -69,7 +69,7 @@ "sorcery": "0.10.0", | ||
"tslint": "5.4.3", | ||
"typescript": "2.3.4", | ||
"typescript": "2.7.2", | ||
"uglify-js": "2.8.29", | ||
"webpack": "3.0.0", | ||
"yargs": "8.0.2", | ||
"zone.js": "0.8.12" | ||
"zone.js": "0.8.20" | ||
}, | ||
@@ -76,0 +76,0 @@ "prettier": { |
@@ -50,3 +50,3 @@ import { Error, Address } from './utils'; | ||
export interface SourceData { | ||
type: string; | ||
type?: string; | ||
amount?: number; | ||
@@ -53,0 +53,0 @@ currency?: string; |
import { ModuleWithProviders } from '@angular/core'; | ||
import { Options } from '../interfaces/stripe'; | ||
import 'rxjs/add/observable/combineLatest'; | ||
import 'rxjs/add/observable/fromPromise'; | ||
import 'rxjs/add/operator/switchMap'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/publishLast'; | ||
export declare class NgxStripeModule { | ||
static forRoot(publishableKey?: string, options?: Options): ModuleWithProviders; | ||
} |
@@ -8,4 +8,4 @@ export { NgxStripeModule } from './modules/ngx-stripe.module'; | ||
export { LazyStripeAPILoader } from './services/api-loader.service'; | ||
export { WindowRef } from './services/window-ref'; | ||
export { DocumentRef } from './services/document-ref'; | ||
export { WindowRef } from './services/window-ref.service'; | ||
export { DocumentRef } from './services/document-ref.service'; | ||
export { Element, ElementEventType, ElementType, ElementOptions, ElementStyleAttributes } from './interfaces/element'; | ||
@@ -12,0 +12,0 @@ export { Elements, ElementsOptions, FontElement } from './interfaces/elements'; |
@@ -1,4 +0,4 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { WindowRef } from './window-ref'; | ||
import { DocumentRef } from './document-ref'; | ||
import { Observable } from 'rxjs'; | ||
import { WindowRef } from './window-ref.service'; | ||
import { DocumentRef } from './document-ref.service'; | ||
export interface Status { | ||
@@ -10,6 +10,7 @@ loaded: boolean; | ||
export declare class LazyStripeAPILoader { | ||
private platformId; | ||
private window; | ||
private document; | ||
private status; | ||
constructor(window: WindowRef, document: DocumentRef); | ||
constructor(platformId: any, window: WindowRef, document: DocumentRef); | ||
asStream(): Observable<Status>; | ||
@@ -16,0 +17,0 @@ isReady(): boolean; |
import { Options } from '../interfaces/stripe'; | ||
import { LazyStripeAPILoader } from './api-loader.service'; | ||
import { WindowRef } from './window-ref'; | ||
import { WindowRef } from './window-ref.service'; | ||
import { StripeInstance } from './stripe-instance.class'; | ||
export declare class StripeFactoryService { | ||
private platformId; | ||
private baseKey; | ||
@@ -10,4 +11,4 @@ private baseOptions; | ||
private window; | ||
constructor(baseKey: string, baseOptions: string, loader: LazyStripeAPILoader, window: WindowRef); | ||
constructor(platformId: any, baseKey: string, baseOptions: string, loader: LazyStripeAPILoader, window: WindowRef); | ||
create(key: string, options?: Options): StripeInstance; | ||
} |
@@ -1,3 +0,3 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { WindowRef } from './window-ref'; | ||
import { Observable } from 'rxjs'; | ||
import { WindowRef } from './window-ref.service'; | ||
import { LazyStripeAPILoader } from './api-loader.service'; | ||
@@ -12,2 +12,3 @@ import { StripeJS, Options } from '../interfaces/stripe'; | ||
export declare class StripeInstance implements StripeServiceInterface { | ||
private platformId; | ||
private loader; | ||
@@ -18,3 +19,3 @@ private window; | ||
private stripe; | ||
constructor(loader: LazyStripeAPILoader, window: WindowRef, key: string, options?: Options); | ||
constructor(platformId: any, loader: LazyStripeAPILoader, window: WindowRef, key: string, options?: Options | undefined); | ||
getInstance(): StripeJS; | ||
@@ -21,0 +22,0 @@ elements(options?: ElementsOptions): Observable<Elements>; |
@@ -1,2 +0,2 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Observable } from 'rxjs'; | ||
import { Element } from '../interfaces/element'; | ||
@@ -3,0 +3,0 @@ import { ElementsOptions, Elements } from '../interfaces/elements'; |
@@ -1,3 +0,3 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { WindowRef } from './window-ref'; | ||
import { Observable } from 'rxjs'; | ||
import { WindowRef } from './window-ref.service'; | ||
import { LazyStripeAPILoader } from './api-loader.service'; | ||
@@ -13,2 +13,3 @@ import { StripeJS, Options } from '../interfaces/stripe'; | ||
export declare class StripeService implements StripeServiceInterface { | ||
private platformId; | ||
private key; | ||
@@ -19,3 +20,3 @@ private options; | ||
private stripe; | ||
constructor(key: string, options: Options, loader: LazyStripeAPILoader, window: WindowRef); | ||
constructor(platformId: any, key: string, options: Options, loader: LazyStripeAPILoader, window: WindowRef); | ||
getStripeReference(): Observable<any>; | ||
@@ -22,0 +23,0 @@ getInstance(): StripeJS; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2442
238869