@recursyve/nice-stripe-kit.v2 12.0.0-beta.0 → 13.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/esm2020/lib/components/card-element/stripe-card-element.component.mjs +130 -0
  2. package/esm2020/lib/components/card-form/stripe-card-form.component.mjs +138 -0
  3. package/{esm2015/lib/components/card-form/stripe-card-form.form.js → esm2020/lib/components/card-form/stripe-card-form.form.mjs} +0 -0
  4. package/{esm2015/lib/nice-stripe-kit.constant.js → esm2020/lib/nice-stripe-kit.constant.mjs} +0 -0
  5. package/esm2020/lib/nice-stripe-kit.module.mjs +73 -0
  6. package/{esm2015/lib/nice-stripe-kit.options.js → esm2020/lib/nice-stripe-kit.options.mjs} +0 -0
  7. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  8. package/{esm2015/recursyve-nice-stripe-kit.v2.js → esm2020/recursyve-nice-stripe-kit.v2.mjs} +0 -0
  9. package/fesm2015/{recursyve-nice-stripe-kit.v2.js → recursyve-nice-stripe-kit.v2.mjs} +36 -53
  10. package/fesm2015/recursyve-nice-stripe-kit.v2.mjs.map +1 -0
  11. package/fesm2020/recursyve-nice-stripe-kit.v2.mjs +346 -0
  12. package/fesm2020/recursyve-nice-stripe-kit.v2.mjs.map +1 -0
  13. package/lib/nice-stripe-kit.module.d.ts +10 -11
  14. package/package.json +25 -12
  15. package/bundles/recursyve-nice-stripe-kit.v2.umd.js +0 -755
  16. package/bundles/recursyve-nice-stripe-kit.v2.umd.js.map +0 -1
  17. package/esm2015/lib/components/card-element/stripe-card-element.component.js +0 -141
  18. package/esm2015/lib/components/card-form/stripe-card-form.component.js +0 -144
  19. package/esm2015/lib/nice-stripe-kit.module.js +0 -80
  20. package/fesm2015/recursyve-nice-stripe-kit.v2.js.map +0 -1
@@ -1,755 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/flex-layout'), require('@angular/forms'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/list'), require('@ngx-translate/core'), require('@recursyve/nice-ui-kit.v2'), require('ngx-stripe'), require('@angular/cdk/coercion'), require('rxjs'), require('uuid'), require('@recursyve/ngx-form-generator'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@recursyve/nice-stripe-kit.v2', ['exports', '@angular/common', '@angular/core', '@angular/flex-layout', '@angular/forms', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/material/list', '@ngx-translate/core', '@recursyve/nice-ui-kit.v2', 'ngx-stripe', '@angular/cdk/coercion', 'rxjs', 'uuid', '@recursyve/ngx-form-generator', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.recursyve = global.recursyve || {}, global.recursyve['nice-stripe-kit'] = global.recursyve['nice-stripe-kit'] || {}, global.recursyve['nice-stripe-kit'].v2 = {}), global.ng.common, global.ng.core, global.ng.flexLayout, global.ng.forms, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.material.list, global.i3, global.i8, global.i2, global.ng.cdk.coercion, global.rxjs, global.uuid, global.i1, global.rxjs.operators));
5
- }(this, (function (exports, i10, i0, i11, i7, button, i5, i9, i4, i3, i8, i2, coercion, rxjs, uuid, i1, operators) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
28
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
29
- var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
30
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
31
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
32
- var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
33
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
34
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
35
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
36
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
37
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
38
-
39
- /*! *****************************************************************************
40
- Copyright (c) Microsoft Corporation.
41
-
42
- Permission to use, copy, modify, and/or distribute this software for any
43
- purpose with or without fee is hereby granted.
44
-
45
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
46
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
47
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
- PERFORMANCE OF THIS SOFTWARE.
52
- ***************************************************************************** */
53
- /* global Reflect, Promise */
54
- var extendStatics = function (d, b) {
55
- extendStatics = Object.setPrototypeOf ||
56
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
57
- function (d, b) { for (var p in b)
58
- if (Object.prototype.hasOwnProperty.call(b, p))
59
- d[p] = b[p]; };
60
- return extendStatics(d, b);
61
- };
62
- function __extends(d, b) {
63
- if (typeof b !== "function" && b !== null)
64
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
65
- extendStatics(d, b);
66
- function __() { this.constructor = d; }
67
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
68
- }
69
- var __assign = function () {
70
- __assign = Object.assign || function __assign(t) {
71
- for (var s, i = 1, n = arguments.length; i < n; i++) {
72
- s = arguments[i];
73
- for (var p in s)
74
- if (Object.prototype.hasOwnProperty.call(s, p))
75
- t[p] = s[p];
76
- }
77
- return t;
78
- };
79
- return __assign.apply(this, arguments);
80
- };
81
- function __rest(s, e) {
82
- var t = {};
83
- for (var p in s)
84
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
85
- t[p] = s[p];
86
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
87
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
88
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
89
- t[p[i]] = s[p[i]];
90
- }
91
- return t;
92
- }
93
- function __decorate(decorators, target, key, desc) {
94
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
95
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
96
- r = Reflect.decorate(decorators, target, key, desc);
97
- else
98
- for (var i = decorators.length - 1; i >= 0; i--)
99
- if (d = decorators[i])
100
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101
- return c > 3 && r && Object.defineProperty(target, key, r), r;
102
- }
103
- function __param(paramIndex, decorator) {
104
- return function (target, key) { decorator(target, key, paramIndex); };
105
- }
106
- function __metadata(metadataKey, metadataValue) {
107
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
108
- return Reflect.metadata(metadataKey, metadataValue);
109
- }
110
- function __awaiter(thisArg, _arguments, P, generator) {
111
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
112
- return new (P || (P = Promise))(function (resolve, reject) {
113
- function fulfilled(value) { try {
114
- step(generator.next(value));
115
- }
116
- catch (e) {
117
- reject(e);
118
- } }
119
- function rejected(value) { try {
120
- step(generator["throw"](value));
121
- }
122
- catch (e) {
123
- reject(e);
124
- } }
125
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
126
- step((generator = generator.apply(thisArg, _arguments || [])).next());
127
- });
128
- }
129
- function __generator(thisArg, body) {
130
- var _ = { label: 0, sent: function () { if (t[0] & 1)
131
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
132
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
133
- function verb(n) { return function (v) { return step([n, v]); }; }
134
- function step(op) {
135
- if (f)
136
- throw new TypeError("Generator is already executing.");
137
- while (_)
138
- try {
139
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
140
- return t;
141
- if (y = 0, t)
142
- op = [op[0] & 2, t.value];
143
- switch (op[0]) {
144
- case 0:
145
- case 1:
146
- t = op;
147
- break;
148
- case 4:
149
- _.label++;
150
- return { value: op[1], done: false };
151
- case 5:
152
- _.label++;
153
- y = op[1];
154
- op = [0];
155
- continue;
156
- case 7:
157
- op = _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- default:
161
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
162
- _ = 0;
163
- continue;
164
- }
165
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
166
- _.label = op[1];
167
- break;
168
- }
169
- if (op[0] === 6 && _.label < t[1]) {
170
- _.label = t[1];
171
- t = op;
172
- break;
173
- }
174
- if (t && _.label < t[2]) {
175
- _.label = t[2];
176
- _.ops.push(op);
177
- break;
178
- }
179
- if (t[2])
180
- _.ops.pop();
181
- _.trys.pop();
182
- continue;
183
- }
184
- op = body.call(thisArg, _);
185
- }
186
- catch (e) {
187
- op = [6, e];
188
- y = 0;
189
- }
190
- finally {
191
- f = t = 0;
192
- }
193
- if (op[0] & 5)
194
- throw op[1];
195
- return { value: op[0] ? op[1] : void 0, done: true };
196
- }
197
- }
198
- var __createBinding = Object.create ? (function (o, m, k, k2) {
199
- if (k2 === undefined)
200
- k2 = k;
201
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
202
- }) : (function (o, m, k, k2) {
203
- if (k2 === undefined)
204
- k2 = k;
205
- o[k2] = m[k];
206
- });
207
- function __exportStar(m, o) {
208
- for (var p in m)
209
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
210
- __createBinding(o, m, p);
211
- }
212
- function __values(o) {
213
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
214
- if (m)
215
- return m.call(o);
216
- if (o && typeof o.length === "number")
217
- return {
218
- next: function () {
219
- if (o && i >= o.length)
220
- o = void 0;
221
- return { value: o && o[i++], done: !o };
222
- }
223
- };
224
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
225
- }
226
- function __read(o, n) {
227
- var m = typeof Symbol === "function" && o[Symbol.iterator];
228
- if (!m)
229
- return o;
230
- var i = m.call(o), r, ar = [], e;
231
- try {
232
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
233
- ar.push(r.value);
234
- }
235
- catch (error) {
236
- e = { error: error };
237
- }
238
- finally {
239
- try {
240
- if (r && !r.done && (m = i["return"]))
241
- m.call(i);
242
- }
243
- finally {
244
- if (e)
245
- throw e.error;
246
- }
247
- }
248
- return ar;
249
- }
250
- /** @deprecated */
251
- function __spread() {
252
- for (var ar = [], i = 0; i < arguments.length; i++)
253
- ar = ar.concat(__read(arguments[i]));
254
- return ar;
255
- }
256
- /** @deprecated */
257
- function __spreadArrays() {
258
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
259
- s += arguments[i].length;
260
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
261
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
262
- r[k] = a[j];
263
- return r;
264
- }
265
- function __spreadArray(to, from) {
266
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
267
- to[j] = from[i];
268
- return to;
269
- }
270
- function __await(v) {
271
- return this instanceof __await ? (this.v = v, this) : new __await(v);
272
- }
273
- function __asyncGenerator(thisArg, _arguments, generator) {
274
- if (!Symbol.asyncIterator)
275
- throw new TypeError("Symbol.asyncIterator is not defined.");
276
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
277
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
278
- function verb(n) { if (g[n])
279
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
280
- function resume(n, v) { try {
281
- step(g[n](v));
282
- }
283
- catch (e) {
284
- settle(q[0][3], e);
285
- } }
286
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
287
- function fulfill(value) { resume("next", value); }
288
- function reject(value) { resume("throw", value); }
289
- function settle(f, v) { if (f(v), q.shift(), q.length)
290
- resume(q[0][0], q[0][1]); }
291
- }
292
- function __asyncDelegator(o) {
293
- var i, p;
294
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
295
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
296
- }
297
- function __asyncValues(o) {
298
- if (!Symbol.asyncIterator)
299
- throw new TypeError("Symbol.asyncIterator is not defined.");
300
- var m = o[Symbol.asyncIterator], i;
301
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
302
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
303
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
304
- }
305
- function __makeTemplateObject(cooked, raw) {
306
- if (Object.defineProperty) {
307
- Object.defineProperty(cooked, "raw", { value: raw });
308
- }
309
- else {
310
- cooked.raw = raw;
311
- }
312
- return cooked;
313
- }
314
- ;
315
- var __setModuleDefault = Object.create ? (function (o, v) {
316
- Object.defineProperty(o, "default", { enumerable: true, value: v });
317
- }) : function (o, v) {
318
- o["default"] = v;
319
- };
320
- function __importStar(mod) {
321
- if (mod && mod.__esModule)
322
- return mod;
323
- var result = {};
324
- if (mod != null)
325
- for (var k in mod)
326
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
327
- __createBinding(result, mod, k);
328
- __setModuleDefault(result, mod);
329
- return result;
330
- }
331
- function __importDefault(mod) {
332
- return (mod && mod.__esModule) ? mod : { default: mod };
333
- }
334
- function __classPrivateFieldGet(receiver, state, kind, f) {
335
- if (kind === "a" && !f)
336
- throw new TypeError("Private accessor was defined without a getter");
337
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
338
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
339
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
340
- }
341
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
342
- if (kind === "m")
343
- throw new TypeError("Private method is not writable");
344
- if (kind === "a" && !f)
345
- throw new TypeError("Private accessor was defined without a setter");
346
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
347
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
348
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
349
- }
350
-
351
- var NiceStripeCardElementComponent = /** @class */ (function () {
352
- function NiceStripeCardElementComponent(ngControl) {
353
- this.ngControl = ngControl;
354
- this._focused = false;
355
- this._required = false;
356
- this._disabled = false;
357
- this.stateChanges = new rxjs.Subject();
358
- this.empty = true;
359
- this.errorState = false;
360
- this.complete = false;
361
- this.describedBy = "";
362
- this.id = uuid.v4();
363
- }
364
- Object.defineProperty(NiceStripeCardElementComponent.prototype, "placeholder", {
365
- get: function () {
366
- return this._placeholder;
367
- },
368
- set: function (placeholder) {
369
- this._placeholder = placeholder;
370
- this.stateChanges.next();
371
- },
372
- enumerable: false,
373
- configurable: true
374
- });
375
- Object.defineProperty(NiceStripeCardElementComponent.prototype, "focused", {
376
- get: function () {
377
- return this._focused;
378
- },
379
- set: function (focused) {
380
- this._focused = focused;
381
- this.stateChanges.next();
382
- },
383
- enumerable: false,
384
- configurable: true
385
- });
386
- Object.defineProperty(NiceStripeCardElementComponent.prototype, "required", {
387
- get: function () {
388
- return this._required;
389
- },
390
- set: function (req) {
391
- this._required = coercion.coerceBooleanProperty(req);
392
- this.stateChanges.next();
393
- },
394
- enumerable: false,
395
- configurable: true
396
- });
397
- Object.defineProperty(NiceStripeCardElementComponent.prototype, "disabled", {
398
- get: function () {
399
- return this._disabled;
400
- },
401
- set: function (value) {
402
- this._disabled = coercion.coerceBooleanProperty(value);
403
- this.stateChanges.next();
404
- },
405
- enumerable: false,
406
- configurable: true
407
- });
408
- Object.defineProperty(NiceStripeCardElementComponent.prototype, "shouldLabelFloat", {
409
- get: function () {
410
- return this.focused || !this.empty;
411
- },
412
- enumerable: false,
413
- configurable: true
414
- });
415
- NiceStripeCardElementComponent.prototype.setDescribedByIds = function (ids) {
416
- this.describedBy = ids.join(" ");
417
- };
418
- NiceStripeCardElementComponent.prototype.ngAfterViewInit = function () {
419
- return __awaiter(this, void 0, void 0, function () {
420
- return __generator(this, function (_a) {
421
- if (this.elementRef) {
422
- this.empty = !this.value;
423
- }
424
- return [2 /*return*/];
425
- });
426
- });
427
- };
428
- NiceStripeCardElementComponent.prototype.init = function (element) {
429
- return __awaiter(this, void 0, void 0, function () {
430
- var _this = this;
431
- return __generator(this, function (_a) {
432
- this.element = element;
433
- this.element.mount(this.elementRef.nativeElement);
434
- this.stateChanges.next();
435
- this.element.update({
436
- placeholder: this.placeholder
437
- });
438
- this.element.on("blur", function () {
439
- _this.focused = false;
440
- if (_this.empty && _this._required) {
441
- _this.errorState = true;
442
- }
443
- });
444
- this.element.on("focus", function () {
445
- _this.focused = true;
446
- });
447
- this.element.on("change", function (event) {
448
- _this.empty = event.empty;
449
- _this.errorState = !!event.error;
450
- _this.complete = event.complete;
451
- _this.stateChanges.next();
452
- });
453
- return [2 /*return*/];
454
- });
455
- });
456
- };
457
- NiceStripeCardElementComponent.prototype.markAsTouched = function () {
458
- this.errorState = !!this.empty;
459
- this.stateChanges.next();
460
- };
461
- NiceStripeCardElementComponent.prototype.onContainerClick = function (event) {
462
- };
463
- return NiceStripeCardElementComponent;
464
- }());
465
- NiceStripeCardElementComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeCardElementComponent, deps: [{ token: i7__namespace.NgControl, optional: true, self: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
466
- NiceStripeCardElementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.0", type: NiceStripeCardElementComponent, selector: "nice-stripe-card-element", inputs: { placeholder: "placeholder", focused: "focused", required: "required", disabled: "disabled" }, host: { properties: { "attr.aria-describedby": "this.describedBy", "id": "this.id", "class.floating": "this.shouldLabelFloat" } }, providers: [
467
- {
468
- provide: i5.MatFormFieldControl,
469
- useExisting: NiceStripeCardElementComponent
470
- }
471
- ], viewQueries: [{ propertyName: "elementRef", first: true, predicate: ["element"], descendants: true }], ngImport: i0__namespace, template: "<div class='stripe-element' #element></div>", isInline: true, styles: ["nice-stripe-card-element .stripe-element{height:15px}"], encapsulation: i0__namespace.ViewEncapsulation.None });
472
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeCardElementComponent, decorators: [{
473
- type: i0.Component,
474
- args: [{
475
- selector: "nice-stripe-card-element",
476
- template: "<div class='stripe-element' #element></div>",
477
- styleUrls: ["./stripe-card-element.style.scss"],
478
- encapsulation: i0.ViewEncapsulation.None,
479
- providers: [
480
- {
481
- provide: i5.MatFormFieldControl,
482
- useExisting: NiceStripeCardElementComponent
483
- }
484
- ]
485
- }]
486
- }], ctorParameters: function () {
487
- return [{ type: i7__namespace.NgControl, decorators: [{
488
- type: i0.Optional
489
- }, {
490
- type: i0.Self
491
- }] }];
492
- }, propDecorators: { elementRef: [{
493
- type: i0.ViewChild,
494
- args: ["element"]
495
- }], describedBy: [{
496
- type: i0.HostBinding,
497
- args: ["attr.aria-describedby"]
498
- }], id: [{
499
- type: i0.HostBinding
500
- }], placeholder: [{
501
- type: i0.Input
502
- }], focused: [{
503
- type: i0.Input
504
- }], required: [{
505
- type: i0.Input
506
- }], disabled: [{
507
- type: i0.Input
508
- }], shouldLabelFloat: [{
509
- type: i0.HostBinding,
510
- args: ["class.floating"]
511
- }] } });
512
-
513
- var NICE_STRIPE_OPTIONS = new i0.InjectionToken("nice_stripe_options");
514
-
515
- var StripeForm = /** @class */ (function () {
516
- function StripeForm() {
517
- }
518
- return StripeForm;
519
- }());
520
- __decorate([
521
- i1.Control(),
522
- i1.Required(),
523
- __metadata("design:type", String)
524
- ], StripeForm.prototype, "name", void 0);
525
-
526
- var NiceStripeCardFormComponent = /** @class */ (function () {
527
- function NiceStripeCardFormComponent(options, formGroup, stripeService, translateService) {
528
- this.options = options;
529
- this.formGroup = formGroup;
530
- this.stripeService = stripeService;
531
- this.translateService = translateService;
532
- this.showIcons = false;
533
- }
534
- Object.defineProperty(NiceStripeCardFormComponent.prototype, "isValid", {
535
- get: function () {
536
- return this.cardNumberInput.complete &&
537
- this.cardExpiryInput.complete &&
538
- this.cardCvcInput.complete &&
539
- this.formGroup.valid;
540
- },
541
- enumerable: false,
542
- configurable: true
543
- });
544
- Object.defineProperty(NiceStripeCardFormComponent.prototype, "cardToken", {
545
- get: function () {
546
- if (!this.isValid) {
547
- return null;
548
- }
549
- return this.stripeService.createToken(this.cardNumberElement, {
550
- name: this.formGroup.get("name").value
551
- }).pipe(operators.map(function (x) { var _a; return (_a = x === null || x === void 0 ? void 0 : x.token) === null || _a === void 0 ? void 0 : _a.id; })).toPromise();
552
- },
553
- enumerable: false,
554
- configurable: true
555
- });
556
- NiceStripeCardFormComponent.prototype.ngOnInit = function () {
557
- var _a, _b;
558
- return __awaiter(this, void 0, void 0, function () {
559
- var _c;
560
- return __generator(this, function (_d) {
561
- switch (_d.label) {
562
- case 0:
563
- this.stripeOptions = {
564
- placeholder: "",
565
- style: {
566
- base: this.options.styling
567
- }
568
- };
569
- _c = this;
570
- return [4 /*yield*/, this.stripeService.elements({
571
- locale: this.translateService.currentLang,
572
- fonts: (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.fonts) !== null && _b !== void 0 ? _b : []
573
- }).toPromise()];
574
- case 1:
575
- _c.elements = _d.sent();
576
- this.initCardNumber();
577
- this.initCardExpiry();
578
- this.initCardCvc();
579
- return [2 /*return*/];
580
- }
581
- });
582
- });
583
- };
584
- NiceStripeCardFormComponent.prototype.initCardNumber = function () {
585
- var _this = this;
586
- this.cardNumberElement = this.elements.create("cardNumber", Object.assign({}, this.stripeOptions));
587
- this.cardNumberElement.on("change", function (event) {
588
- _this.cardNumberError = event.error ? event.error.message : null;
589
- });
590
- this.cardNumberInput.init(this.cardNumberElement);
591
- };
592
- NiceStripeCardFormComponent.prototype.initCardExpiry = function () {
593
- var _this = this;
594
- this.cardExpiryElement = this.elements.create("cardExpiry", Object.assign({}, this.stripeOptions));
595
- this.cardExpiryElement.on("change", function (event) {
596
- _this.cardExpiryError = event.error ? event.error.message : null;
597
- });
598
- this.cardExpiryInput.init(this.cardExpiryElement);
599
- };
600
- NiceStripeCardFormComponent.prototype.initCardCvc = function () {
601
- var _this = this;
602
- this.cardCvcElement = this.elements.create("cardCvc", Object.assign({}, this.stripeOptions));
603
- this.cardCvcElement.on("change", function (event) {
604
- _this.cardCvcError = event.error ? event.error.message : null;
605
- });
606
- this.cardCvcInput.init(this.cardCvcElement);
607
- };
608
- NiceStripeCardFormComponent.prototype.ngOnDestroy = function () {
609
- this.cardNumberElement.unmount();
610
- this.cardExpiryElement.unmount();
611
- this.cardCvcElement.unmount();
612
- };
613
- NiceStripeCardFormComponent.prototype.patchName = function (name) {
614
- this.formGroup.get("name").patchValue(name);
615
- };
616
- NiceStripeCardFormComponent.prototype.markAllAsTouched = function () {
617
- this.formGroup.markAllAsTouched();
618
- this.cardCvcInput.markAsTouched();
619
- this.cardNumberInput.markAsTouched();
620
- this.cardExpiryInput.markAsTouched();
621
- };
622
- NiceStripeCardFormComponent.prototype.getYear = function () {
623
- var date = new Date();
624
- return +date.getFullYear().toString().substr(-2);
625
- };
626
- return NiceStripeCardFormComponent;
627
- }());
628
- NiceStripeCardFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeCardFormComponent, deps: [{ token: NICE_STRIPE_OPTIONS, optional: true }, { token: i1__namespace.GeneratedFormGroup }, { token: i2__namespace.StripeService }, { token: i3__namespace.TranslateService }], target: i0__namespace.ɵɵFactoryTarget.Component });
629
- NiceStripeCardFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.0", type: NiceStripeCardFormComponent, selector: "nice-stripe-card-form", inputs: { appearance: "appearance", showIcons: "showIcons" }, providers: [
630
- {
631
- provide: i1.GeneratedFormGroup,
632
- useFactory: i1.ngxFormGeneratorFactory(StripeForm)
633
- }
634
- ], viewQueries: [{ propertyName: "cardNumberInput", first: true, predicate: ["cardNumber"], descendants: true }, { propertyName: "cardExpiryInput", first: true, predicate: ["cardExpiry"], descendants: true }, { propertyName: "cardCvcInput", first: true, predicate: ["cardCvc"], descendants: true }], ngImport: i0__namespace, template: "<mat-list [formGroup]=\"formGroup\">\n <mat-list-item>\n <mat-form-field [appearance]=\"appearance\" niceControlStatus floatLabel=\"always\">\n <mat-label>{{ \"nice_ui_kit.stripe.name_on_card.label\" | translate}}</mat-label>\n <input [placeholder]=\"'nice_ui_kit.stripe.name_on_card.placeholder' | translate\" matInput type=\"text\"\n formControlName=\"name\" required/>\n <div matPrefix class=\"pl-12\" *ngIf=\"showIcons\">\n <i class=\"fad fa-user-circle accent-fg\"></i>\n </div>\n </mat-form-field>\n </mat-list-item>\n <mat-list-item>\n <div fxLayout=\"column\" class=\"w-100-p\">\n <div fxLayout=\"row\">\n <mat-form-field fxFlex=\"100\" [appearance]=\"appearance\" floatLabel=\"always\">\n <mat-label>{{ \"nice_ui_kit.stripe.card_number.label\" | translate}}</mat-label>\n <div matPrefix class=\"pl-12\" *ngIf=\"showIcons\">\n <i class=\"fad fa-credit-card accent-fg\"></i>\n </div>\n <nice-stripe-card-element [placeholder]=\"'nice_ui_kit.stripe.card_number.placeholder' | translate\"\n #cardNumber required></nice-stripe-card-element>\n <mat-error [@slideInBottom] *ngIf=\"cardNumberError\">{{ cardNumberError }}</mat-error>\n </mat-form-field>\n </div>\n <div fxLayout=\"row\" fxLayoutGap=\"15px\">\n <mat-form-field fxFlex=\"50\" fxFlex.lt-md=\"48\" [appearance]=\"appearance\" floatLabel=\"always\">\n <mat-label>{{ \"nice_ui_kit.stripe.expiration.label\" | translate}}</mat-label>\n <nice-stripe-card-element [placeholder]=\"'nice_ui_kit.stripe.expiration.placeholder' | translate\"\n #cardExpiry required></nice-stripe-card-element>\n <mat-error [@slideInBottom] *ngIf=\"cardExpiryError\">{{ cardExpiryError }}</mat-error>\n </mat-form-field>\n <mat-form-field fxFlex=\"50\" fxFlex.lt-md=\"48\" [appearance]=\"appearance\" floatLabel=\"always\">\n <mat-label>{{ \"nice_ui_kit.stripe.cvc.label\" | translate}}</mat-label>\n <nice-stripe-card-element [placeholder]=\"'nice_ui_kit.stripe.cvc.placeholder' | translate\" #cardCvc\n required></nice-stripe-card-element>\n <mat-error [@slideInBottom] *ngIf=\"cardCvcError\">{{ cardCvcError }}</mat-error>\n </mat-form-field>\n </div>\n </div>\n </mat-list-item>\n</mat-list>\n", styles: ["nice-stripe-card-form mat-list-item{height:auto!important}"], components: [{ type: i4__namespace.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i4__namespace.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { type: i5__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: NiceStripeCardElementComponent, selector: "nice-stripe-card-element", inputs: ["placeholder", "focused", "required", "disabled"] }], directives: [{ type: i7__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i7__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i8__namespace.NiceControlStatusDirective, selector: "[niceControlStatus]" }, { type: i5__namespace.MatLabel, selector: "mat-label" }, { type: i9__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i7__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i7__namespace.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.MatPrefix, selector: "[matPrefix]" }, { type: i11__namespace.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i11__namespace.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i5__namespace.MatError, selector: "mat-error", inputs: ["id"] }, { type: i11__namespace.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }], pipes: { "translate": i3__namespace.TranslatePipe }, animations: i8.niceAnimations, encapsulation: i0__namespace.ViewEncapsulation.None });
635
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeCardFormComponent, decorators: [{
636
- type: i0.Component,
637
- args: [{
638
- selector: "nice-stripe-card-form",
639
- templateUrl: "stripe-card-form.template.html",
640
- styleUrls: ["stripe-card-form.style.scss"],
641
- encapsulation: i0.ViewEncapsulation.None,
642
- providers: [
643
- {
644
- provide: i1.GeneratedFormGroup,
645
- useFactory: i1.ngxFormGeneratorFactory(StripeForm)
646
- }
647
- ],
648
- animations: i8.niceAnimations
649
- }]
650
- }], ctorParameters: function () {
651
- return [{ type: undefined, decorators: [{
652
- type: i0.Optional
653
- }, {
654
- type: i0.Inject,
655
- args: [NICE_STRIPE_OPTIONS]
656
- }] }, { type: i1__namespace.GeneratedFormGroup }, { type: i2__namespace.StripeService }, { type: i3__namespace.TranslateService }];
657
- }, propDecorators: { appearance: [{
658
- type: i0.Input
659
- }], showIcons: [{
660
- type: i0.Input
661
- }], cardNumberInput: [{
662
- type: i0.ViewChild,
663
- args: ["cardNumber"]
664
- }], cardExpiryInput: [{
665
- type: i0.ViewChild,
666
- args: ["cardExpiry"]
667
- }], cardCvcInput: [{
668
- type: i0.ViewChild,
669
- args: ["cardCvc"]
670
- }] } });
671
-
672
- var NiceStripeModule = /** @class */ (function () {
673
- function NiceStripeModule() {
674
- }
675
- NiceStripeModule.forRoot = function (options) {
676
- return {
677
- ngModule: NiceStripeModule,
678
- providers: [
679
- {
680
- provide: NICE_STRIPE_OPTIONS,
681
- useValue: options
682
- }
683
- ]
684
- };
685
- };
686
- return NiceStripeModule;
687
- }());
688
- NiceStripeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
689
- NiceStripeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeModule, declarations: [NiceStripeCardElementComponent,
690
- NiceStripeCardFormComponent], imports: [i11.FlexModule,
691
- i2.NgxStripeModule,
692
- i7.ReactiveFormsModule,
693
- i3.TranslateModule,
694
- i5.MatFormFieldModule,
695
- i9.MatInputModule,
696
- i4.MatListModule,
697
- i8.NiceFormErrorModule,
698
- button.MatButtonModule,
699
- i10.CommonModule,
700
- i11.ExtendedModule], exports: [NiceStripeCardFormComponent] });
701
- NiceStripeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeModule, imports: [[
702
- i11.FlexModule,
703
- i2.NgxStripeModule,
704
- i7.ReactiveFormsModule,
705
- i3.TranslateModule,
706
- i5.MatFormFieldModule,
707
- i9.MatInputModule,
708
- i4.MatListModule,
709
- i8.NiceFormErrorModule,
710
- button.MatButtonModule,
711
- i10.CommonModule,
712
- i11.ExtendedModule
713
- ]] });
714
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: NiceStripeModule, decorators: [{
715
- type: i0.NgModule,
716
- args: [{
717
- imports: [
718
- i11.FlexModule,
719
- i2.NgxStripeModule,
720
- i7.ReactiveFormsModule,
721
- i3.TranslateModule,
722
- i5.MatFormFieldModule,
723
- i9.MatInputModule,
724
- i4.MatListModule,
725
- i8.NiceFormErrorModule,
726
- button.MatButtonModule,
727
- i10.CommonModule,
728
- i11.ExtendedModule
729
- ],
730
- declarations: [
731
- NiceStripeCardElementComponent,
732
- NiceStripeCardFormComponent
733
- ],
734
- exports: [
735
- NiceStripeCardFormComponent
736
- ]
737
- }]
738
- }] });
739
-
740
- /*
741
- * Public API Surface of nice-stripe-kit
742
- */
743
-
744
- /**
745
- * Generated bundle index. Do not edit.
746
- */
747
-
748
- exports.NiceStripeCardElementComponent = NiceStripeCardElementComponent;
749
- exports.NiceStripeCardFormComponent = NiceStripeCardFormComponent;
750
- exports.NiceStripeModule = NiceStripeModule;
751
-
752
- Object.defineProperty(exports, '__esModule', { value: true });
753
-
754
- })));
755
- //# sourceMappingURL=recursyve-nice-stripe-kit.v2.umd.js.map