epp-lib 0.0.4 → 0.0.5

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.
@@ -1,102 +1,236 @@
1
- import * as i1 from '@angular/common/http';
2
- import { HttpParams, HttpHeaders } from '@angular/common/http';
3
1
  import * as i0 from '@angular/core';
4
- import { Injectable, inject } from '@angular/core';
5
- import { Observable, Subject } from 'rxjs';
2
+ import { Input, Component, Injectable, Inject, inject } from '@angular/core';
3
+ import { Subject, Observable, timer, takeUntil } from 'rxjs';
4
+ import * as i1 from '@angular/material/dialog';
5
+ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
6
+ import * as i1$1 from '@angular/common/http';
7
+ import { HttpHeaders, HttpParams } from '@angular/common/http';
6
8
 
7
- class IParam {
8
- getMobileFlag() {
9
- return /android|mobi/i.test(navigator.userAgent.toLowerCase());
10
- }
11
- toJson() {
12
- return JSON.stringify(this);
13
- }
14
- toFormUrlEncoded() {
15
- return new URLSearchParams(Object.entries(this).map(([key, value]) => [key, String(value)])).toString();
9
+ class VoddsLoaderComponent {
10
+ constructor() {
11
+ this.message = '';
12
+ this.showAjaxLoader = false;
16
13
  }
14
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
15
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: VoddsLoaderComponent, isStandalone: true, selector: "vodds-loader", inputs: { message: "message", showAjaxLoader: "showAjaxLoader" }, ngImport: i0, template: "@if (showAjaxLoader) {\r\n <div class=\"load-indicator\">\r\n <img src=\"/assets/jayeson/common/img/ajax-loader16.gif\">\r\n {{message != undefined ? message : ''}}\r\n </div>\r\n}\r\n", styles: [""] }); }
17
16
  }
17
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsLoaderComponent, decorators: [{
18
+ type: Component,
19
+ args: [{ selector: 'vodds-loader', standalone: true, imports: [], template: "@if (showAjaxLoader) {\r\n <div class=\"load-indicator\">\r\n <img src=\"/assets/jayeson/common/img/ajax-loader16.gif\">\r\n {{message != undefined ? message : ''}}\r\n </div>\r\n}\r\n" }]
20
+ }], propDecorators: { message: [{
21
+ type: Input
22
+ }], showAjaxLoader: [{
23
+ type: Input
24
+ }] } });
18
25
 
19
- class BaseForm extends IParam {
26
+ class EventEmitterService {
20
27
  constructor() {
21
- super();
22
- this.isMobile = 'false';
28
+ this.eventBus = new Subject();
23
29
  }
24
- /**
25
- * Use this function for building POST params with form url encoded content type.
26
- * Remeber to call params.toString() when passing to http request
27
- */
28
- getUrlSearchParam() {
29
- const params = new URLSearchParams();
30
- params.set('isMobile', this.isMobile);
31
- return params;
30
+ broadcast(event) {
31
+ this.eventBus.next(event);
32
32
  }
33
- /**
34
- * Use this function for building GET params
35
- */
36
- getHttpParams() {
37
- let params = new HttpParams();
38
- params = params.append('isMobile', this.isMobile);
39
- return params;
40
- }
41
- /**
42
- * Add isMobile = 'true' to paramters
43
- * @param params : object
44
- */
45
- addIsMobile(params) {
46
- params['isMobile'] = this.isMobile;
47
- }
48
- /**
49
- * For POST request with form-urlencoded
50
- */
51
- getHeaderWithContentTypeForm() {
52
- const headers = new HttpHeaders()
53
- .set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
54
- return headers;
55
- }
56
- /**
57
- * For POST request with json body
58
- */
59
- getHeaderWithContentTypeJson() {
60
- const headers = new HttpHeaders()
61
- .set('Content-Type', 'application/json; charset=utf-8');
62
- return headers;
33
+ getEventBus() {
34
+ return this.eventBus;
63
35
  }
36
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
37
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, providedIn: 'root' }); }
64
38
  }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, decorators: [{
40
+ type: Injectable,
41
+ args: [{
42
+ providedIn: 'root',
43
+ }]
44
+ }] });
65
45
 
66
- class CallbackMessage {
67
- constructor(errorMessage) {
68
- this.errorMessage = '';
69
- this.errorMessage = errorMessage;
46
+ class BroadcastEvent {
47
+ constructor(eventType, eventData) {
48
+ this.eventType = eventType;
49
+ this.eventData = eventData;
50
+ }
51
+ getEventType() {
52
+ return this.eventType;
53
+ }
54
+ getEventData() {
55
+ return this.eventData;
70
56
  }
71
57
  }
72
58
 
73
- var PaymentType;
74
- (function (PaymentType) {
75
- PaymentType[PaymentType["NA"] = 0] = "NA";
76
- PaymentType[PaymentType["JETON"] = 1] = "JETON";
77
- PaymentType[PaymentType["ECOPAYZ"] = 2] = "ECOPAYZ";
78
- PaymentType[PaymentType["RAPYD"] = 3] = "RAPYD";
79
- })(PaymentType || (PaymentType = {}));
59
+ var BroadcastEventType;
60
+ (function (BroadcastEventType) {
61
+ BroadcastEventType[BroadcastEventType["COMPLETE_RAPYD"] = 0] = "COMPLETE_RAPYD";
62
+ })(BroadcastEventType || (BroadcastEventType = {}));
80
63
 
81
- class Checkout {
82
- constructor() {
83
- this.requestId = 0;
84
- this.paymentType = PaymentType.NA;
85
- this.url = '';
86
- this.expiration = 300;
87
- this.errorMessage = '';
88
- this.successMessage = '';
64
+ class RapydComponent {
65
+ constructor(dialogRef, data, eventEmitter) {
66
+ this.dialogRef = dialogRef;
67
+ this.data = data;
68
+ this.eventEmitter = eventEmitter;
69
+ this.isOpen = false;
70
+ this.checkoutToolKit = undefined;
71
+ this.visaMasterTimeout = 300;
72
+ this.visaMasterCheckoutId = '';
73
+ this.displayTimer = "00:00";
74
+ this.isShow = false;
75
+ this.isLoading = true;
76
+ this.errorMessage = "";
77
+ this.defaultExpirationSec = 300; // 5mins
78
+ this.handleLoading = (event) => {
79
+ console.log("handleLoading");
80
+ if (!event.detail.loading && this.isLoading) {
81
+ this.isShow = true;
82
+ this.isLoading = false;
83
+ this.startTimer();
84
+ }
85
+ };
86
+ this.handleCheckoutPaymentSuccess = (event) => {
87
+ console.log("handleCheckoutPaymentSuccess");
88
+ this.closeDialog(false);
89
+ this.emitCompleteRapyd('');
90
+ };
91
+ this.handleCheckoutPaymentFailure = (event) => {
92
+ console.log("handleCheckoutPaymentFailure");
93
+ this.stopTimer();
94
+ this.isShow = false;
95
+ console.error("Failed to deposit visa!", event.detail);
96
+ this.emitCompleteRapyd(event.detail.message);
97
+ };
98
+ this.visaMasterTimeout = data.expiration ?? data.expiration;
99
+ this.visaMasterCheckoutId = data.checkoutUrl;
89
100
  }
90
- setErrorMessage(errorMessage) {
91
- this.errorMessage = errorMessage;
92
- this.popup = undefined;
101
+ ngOnDestroy() {
102
+ this.stopTimer();
103
+ window.removeEventListener('onLoading', this.handleLoading);
104
+ window.removeEventListener('onCheckoutPaymentSuccess', this.handleCheckoutPaymentSuccess);
105
+ window.removeEventListener('onCheckoutPaymentFailure', this.handleCheckoutPaymentFailure);
106
+ }
107
+ ngAfterViewInit() {
108
+ if (this.checkout) {
109
+ this.visaMasterTimeout = this.checkout.expiration;
110
+ this.visaMasterCheckoutId = this.checkout.url;
111
+ }
112
+ console.log("constructor: ", this.visaMasterCheckoutId, this.visaMasterTimeout);
113
+ this.createCheckoutToolKit();
114
+ }
115
+ createCheckoutToolKit() {
116
+ this.checkoutToolKit = new RapydCheckoutToolkit({
117
+ pay_button_text: "Rapyd checkout",
118
+ id: this.visaMasterCheckoutId,
119
+ wait_on_payment_redirect: true,
120
+ style: {
121
+ cardFields: {
122
+ title: {
123
+ color: '#80807F'
124
+ },
125
+ saveForFutureLabel: {
126
+ color: '#80807F'
127
+ }
128
+ },
129
+ input: {
130
+ base: {
131
+ fontWeight: "400",
132
+ borderRadius: "5px",
133
+ }
134
+ },
135
+ orderDetails: {
136
+ title: {
137
+ color: '#80807F'
138
+ },
139
+ totalLabel: {
140
+ color: '#80807F'
141
+ },
142
+ totalValue: {
143
+ color: '#80807F'
144
+ }
145
+ },
146
+ submit: {
147
+ base: {
148
+ backgroundColor: "#F48215",
149
+ color: "#FFFFFF",
150
+ fontWeight: "900",
151
+ borderRadius: "5px",
152
+ border: "none",
153
+ boxShadow: "0px 0px 20px 0px #28303A33",
154
+ height: "35px",
155
+ }
156
+ }
157
+ }
158
+ });
159
+ this.displayCheckout();
160
+ window.addEventListener('onLoading', this.handleLoading);
161
+ window.addEventListener('onCheckoutPaymentSuccess', this.handleCheckoutPaymentSuccess);
162
+ window.addEventListener('onCheckoutPaymentFailure', this.handleCheckoutPaymentFailure);
163
+ }
164
+ closeDialog(isCloseCheckout = true) {
165
+ console.log("closeDialog");
166
+ this.stopTimer();
167
+ if (this.checkoutToolKit && isCloseCheckout) {
168
+ try {
169
+ this.checkoutToolKit.closeCheckout();
170
+ }
171
+ catch (err) {
172
+ console.error("Error when closing checkout", err);
173
+ }
174
+ }
175
+ this.checkoutToolKit = undefined;
176
+ this.isShow = false;
177
+ // this.dialogRef.close();
178
+ }
179
+ ;
180
+ startTimer() {
181
+ console.log("startTimer");
182
+ if (this.visaMasterTimer)
183
+ this.stopTimer();
184
+ this.visaMasterTimer = setInterval(() => {
185
+ if (this.visaMasterTimeout <= 0) {
186
+ this.closeDialog();
187
+ return;
188
+ }
189
+ this.visaMasterTimeout--;
190
+ this.updateDisplayTimer();
191
+ }, 1000);
192
+ }
193
+ stopTimer() {
194
+ console.log("stopTimer");
195
+ clearInterval(this.visaMasterTimer);
196
+ }
197
+ updateDisplayTimer() {
198
+ console.log("updateDisplayTimer");
199
+ const min = this.pad(Math.floor(this.visaMasterTimeout / 60));
200
+ const sec = this.pad(this.visaMasterTimeout % 60);
201
+ this.displayTimer = `${min}:${sec}`;
202
+ }
203
+ pad(number) {
204
+ console.log("pad");
205
+ return `${number < 10 ? '0' : ''}${number}`;
206
+ }
207
+ displayCheckout() {
208
+ console.log("padisplayCheckoutd");
209
+ if (document.getElementById("rapyd-checkout")) {
210
+ this.checkoutToolKit.displayCheckout();
211
+ }
212
+ else {
213
+ setTimeout(() => {
214
+ this.displayCheckout();
215
+ }, 10);
216
+ }
93
217
  }
94
- setCallback(callback) {
95
- this.successMessage = 'success';
96
- this.callback = callback;
97
- this.popup = undefined;
218
+ emitCompleteRapyd(errorMessage) {
219
+ console.log("emitCompleteRapyd");
220
+ this.eventEmitter.broadcast(new BroadcastEvent(BroadcastEventType.COMPLETE_RAPYD, errorMessage));
98
221
  }
222
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RapydComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: EventEmitterService }], target: i0.ɵɵFactoryTarget.Component }); }
223
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: RapydComponent, isStandalone: true, selector: "v-rapyd", inputs: { checkout: "checkout" }, providers: [EventEmitterService], ngImport: i0, template: "<div id=\"visa-card\">\r\n <div class=\"top\">\r\n <h2>$-addpwdr_paymentInformation-$</h2>\r\n <svg class=\"clsbtn my-account\" (click)=\"closeDialog()\" width=\"11\" height=\"11\" viewBox=\"0 0 11 11\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M9.89214 0L5.5 4.39214L1.10786 0L0 1.10786L4.39214 5.5L0 9.89214L1.10786 11L5.5 6.60786L9.89214 11L11 9.89214L6.60786 5.5L11 1.10786L9.89214 0Z\" fill=\"white\"/>\r\n </svg>\r\n </div>\r\n <div class=\"flex-center\">\r\n <vodds-loader [showAjaxLoader]=\"isLoading\"></vodds-loader>\r\n </div>\r\n @if (!isLoading && !isShow) {\r\n <div class=\"visa-card-message\">\r\n $-addpwdr_visaCardErrorMessage-$ <br> $-addpwdr_visaCardErrorMessage2-$\r\n </div>\r\n }\r\n <div class=\"visa-card-form\" [style]=\"{display: isShow ? 'flex' : 'none'}\">\r\n <div class=\"timer\">\r\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M7 2.56067C9.76142 2.56067 12 4.79925 12 7.56067C12 10.3221 9.76142 12.5607 7 12.5607C4.23858 12.5607 2 10.3221 2 7.56067C2 4.79925 4.23858 2.56067 7 2.56067ZM6.25 4.06067V7.93567L6.5498 8.16028L8.5498 9.66028L9.4502 8.46106L7.75 7.18567V4.06067H6.25Z\" fill=\"#B5B5B5\"/>\r\n <line x1=\"10.0303\" y1=\"0.530339\" x2=\"12.8588\" y2=\"3.35877\" stroke=\"#B5B5B5\" stroke-width=\"1.5\"/>\r\n <line y1=\"-0.75\" x2=\"4\" y2=\"-0.75\" transform=\"matrix(-0.707107 0.707107 0.707107 0.707107 4.82861 1.06067)\" stroke=\"#B5B5B5\" stroke-width=\"1.5\"/>\r\n </svg>\r\n <span class=\"label\">&nbsp;$-addpwdr_visaCardTimeout-$&nbsp;</span> <span class=\"display-time\"> {{displayTimer}}</span>\r\n </div>\r\n <div id=\"rapyd-checkout\"></div>\r\n </div>\r\n</div>\r\n", styles: [".flex-center{display:flex;justify-content:center;align-items:center}#visa-card{height:auto;width:500px;top:0;left:710px;z-index:101}.top{width:100%;align-items:center;margin-bottom:8px;border-radius:0;background:#dd453c;position:relative;color:#fff;display:flex;justify-content:space-between}.top h2{padding-left:15px;text-align:left;font-size:16px;font-weight:800}.top svg{position:unset;padding-right:15px;width:18px;height:18px}.visa-card-form{display:flex;flex-direction:column;align-items:center;min-height:500px!important;width:100%}.visa-card-form .timer{display:flex;align-items:center}#rapyd-checkout{min-height:550px;max-height:550px;overflow-y:auto;scrollbar-width:none}#rapyd-checkout::-webkit-scrollbar{display:none}.ui-widget.ui-widget-content.vodds-visa-card-dialog{padding:0;border:none;border-radius:10px}.vodds-visa-card-dialog .ui-dialog-content{display:flex;align-items:center;flex-direction:column;padding:0;margin:0}.vodds-visa-card-dialog .ui-dialog-content .top{width:100%;display:flex;align-items:center;padding:6px 18px;margin-bottom:8px;border-radius:8px}.vodds-visa-card-dialog .ui-dialog-content .top h2{text-align:left;font-size:16px;font-weight:800}#trading-platform.dark .vodds-visa-card-dialog .label,.vodds-visa-card-dialog .label{color:#80807f!important}#trading-platform.dark .vodds-visa-card-dialog span{color:#000!important}#trading-platform.dark .vodds-visa-card-dialog{background:#fff!important}\n"], dependencies: [{ kind: "component", type: VoddsLoaderComponent, selector: "vodds-loader", inputs: ["message", "showAjaxLoader"] }] }); }
99
224
  }
225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RapydComponent, decorators: [{
226
+ type: Component,
227
+ args: [{ selector: 'v-rapyd', standalone: true, imports: [VoddsLoaderComponent], providers: [EventEmitterService], template: "<div id=\"visa-card\">\r\n <div class=\"top\">\r\n <h2>$-addpwdr_paymentInformation-$</h2>\r\n <svg class=\"clsbtn my-account\" (click)=\"closeDialog()\" width=\"11\" height=\"11\" viewBox=\"0 0 11 11\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M9.89214 0L5.5 4.39214L1.10786 0L0 1.10786L4.39214 5.5L0 9.89214L1.10786 11L5.5 6.60786L9.89214 11L11 9.89214L6.60786 5.5L11 1.10786L9.89214 0Z\" fill=\"white\"/>\r\n </svg>\r\n </div>\r\n <div class=\"flex-center\">\r\n <vodds-loader [showAjaxLoader]=\"isLoading\"></vodds-loader>\r\n </div>\r\n @if (!isLoading && !isShow) {\r\n <div class=\"visa-card-message\">\r\n $-addpwdr_visaCardErrorMessage-$ <br> $-addpwdr_visaCardErrorMessage2-$\r\n </div>\r\n }\r\n <div class=\"visa-card-form\" [style]=\"{display: isShow ? 'flex' : 'none'}\">\r\n <div class=\"timer\">\r\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M7 2.56067C9.76142 2.56067 12 4.79925 12 7.56067C12 10.3221 9.76142 12.5607 7 12.5607C4.23858 12.5607 2 10.3221 2 7.56067C2 4.79925 4.23858 2.56067 7 2.56067ZM6.25 4.06067V7.93567L6.5498 8.16028L8.5498 9.66028L9.4502 8.46106L7.75 7.18567V4.06067H6.25Z\" fill=\"#B5B5B5\"/>\r\n <line x1=\"10.0303\" y1=\"0.530339\" x2=\"12.8588\" y2=\"3.35877\" stroke=\"#B5B5B5\" stroke-width=\"1.5\"/>\r\n <line y1=\"-0.75\" x2=\"4\" y2=\"-0.75\" transform=\"matrix(-0.707107 0.707107 0.707107 0.707107 4.82861 1.06067)\" stroke=\"#B5B5B5\" stroke-width=\"1.5\"/>\r\n </svg>\r\n <span class=\"label\">&nbsp;$-addpwdr_visaCardTimeout-$&nbsp;</span> <span class=\"display-time\"> {{displayTimer}}</span>\r\n </div>\r\n <div id=\"rapyd-checkout\"></div>\r\n </div>\r\n</div>\r\n", styles: [".flex-center{display:flex;justify-content:center;align-items:center}#visa-card{height:auto;width:500px;top:0;left:710px;z-index:101}.top{width:100%;align-items:center;margin-bottom:8px;border-radius:0;background:#dd453c;position:relative;color:#fff;display:flex;justify-content:space-between}.top h2{padding-left:15px;text-align:left;font-size:16px;font-weight:800}.top svg{position:unset;padding-right:15px;width:18px;height:18px}.visa-card-form{display:flex;flex-direction:column;align-items:center;min-height:500px!important;width:100%}.visa-card-form .timer{display:flex;align-items:center}#rapyd-checkout{min-height:550px;max-height:550px;overflow-y:auto;scrollbar-width:none}#rapyd-checkout::-webkit-scrollbar{display:none}.ui-widget.ui-widget-content.vodds-visa-card-dialog{padding:0;border:none;border-radius:10px}.vodds-visa-card-dialog .ui-dialog-content{display:flex;align-items:center;flex-direction:column;padding:0;margin:0}.vodds-visa-card-dialog .ui-dialog-content .top{width:100%;display:flex;align-items:center;padding:6px 18px;margin-bottom:8px;border-radius:8px}.vodds-visa-card-dialog .ui-dialog-content .top h2{text-align:left;font-size:16px;font-weight:800}#trading-platform.dark .vodds-visa-card-dialog .label,.vodds-visa-card-dialog .label{color:#80807f!important}#trading-platform.dark .vodds-visa-card-dialog span{color:#000!important}#trading-platform.dark .vodds-visa-card-dialog{background:#fff!important}\n"] }]
228
+ }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
229
+ type: Inject,
230
+ args: [MAT_DIALOG_DATA]
231
+ }] }, { type: EventEmitterService }], propDecorators: { checkout: [{
232
+ type: Input
233
+ }] } });
100
234
 
101
235
  class Domain {
102
236
  constructor() {
@@ -107,16 +241,24 @@ class Domain {
107
241
  }
108
242
  }
109
243
 
244
+ const ApiRoute = {
245
+ GET_DOMAIN: { url: "/getDomain", method: "get" }
246
+ };
247
+
248
+ var PaymentType;
249
+ (function (PaymentType) {
250
+ PaymentType[PaymentType["NA"] = 0] = "NA";
251
+ PaymentType[PaymentType["JETON"] = 1] = "JETON";
252
+ PaymentType[PaymentType["ECOPAYZ"] = 2] = "ECOPAYZ";
253
+ PaymentType[PaymentType["RAPYD"] = 3] = "RAPYD";
254
+ })(PaymentType || (PaymentType = {}));
255
+
110
256
  var IframeMessageType;
111
257
  (function (IframeMessageType) {
112
258
  IframeMessageType[IframeMessageType["OPEN_PAYMENT_FORM"] = 0] = "OPEN_PAYMENT_FORM";
113
259
  IframeMessageType[IframeMessageType["PAYMENT_CALLBACK"] = 1] = "PAYMENT_CALLBACK";
114
260
  })(IframeMessageType || (IframeMessageType = {}));
115
261
 
116
- const ApiRoute = {
117
- GET_DOMAIN: { url: "/getDomain", method: "get" }
118
- };
119
-
120
262
  class VoddsHttpService {
121
263
  constructor(httpClient) {
122
264
  this.httpClient = httpClient;
@@ -159,7 +301,7 @@ class VoddsHttpService {
159
301
  getFullUrl(url, param) {
160
302
  return `${url}?${param.toFormUrlEncoded()}`;
161
303
  }
162
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
163
305
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, providedIn: 'root' }); }
164
306
  }
165
307
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, decorators: [{
@@ -167,7 +309,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
167
309
  args: [{
168
310
  providedIn: 'root',
169
311
  }]
170
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
312
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }] });
171
313
 
172
314
  class IframeMessageService {
173
315
  constructor(ngZone, http) {
@@ -240,6 +382,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
240
382
  }]
241
383
  }], ctorParameters: () => [{ type: i0.NgZone }, { type: VoddsHttpService }] });
242
384
 
385
+ class Checkout {
386
+ constructor() {
387
+ this.requestId = 0;
388
+ this.paymentType = PaymentType.NA;
389
+ this.url = '';
390
+ this.expiration = 300;
391
+ this.errorMessage = '';
392
+ this.successMessage = '';
393
+ }
394
+ setErrorMessage(errorMessage) {
395
+ this.errorMessage = errorMessage;
396
+ this.popup = undefined;
397
+ }
398
+ setCallback(callback) {
399
+ this.successMessage = 'success';
400
+ this.callback = callback;
401
+ this.popup = undefined;
402
+ }
403
+ }
404
+
243
405
  class Timer {
244
406
  constructor(interval, maxTime) {
245
407
  this.interval = 0;
@@ -374,14 +536,134 @@ class PaymentService {
374
536
  }
375
537
  }
376
538
 
539
+ class IParam {
540
+ getMobileFlag() {
541
+ return /android|mobi/i.test(navigator.userAgent.toLowerCase());
542
+ }
543
+ toJson() {
544
+ return JSON.stringify(this);
545
+ }
546
+ toFormUrlEncoded() {
547
+ return new URLSearchParams(Object.entries(this).map(([key, value]) => [key, String(value)])).toString();
548
+ }
549
+ }
550
+
551
+ class BaseForm extends IParam {
552
+ constructor() {
553
+ super();
554
+ this.isMobile = 'false';
555
+ }
556
+ /**
557
+ * Use this function for building POST params with form url encoded content type.
558
+ * Remeber to call params.toString() when passing to http request
559
+ */
560
+ getUrlSearchParam() {
561
+ const params = new URLSearchParams();
562
+ params.set('isMobile', this.isMobile);
563
+ return params;
564
+ }
565
+ /**
566
+ * Use this function for building GET params
567
+ */
568
+ getHttpParams() {
569
+ let params = new HttpParams();
570
+ params = params.append('isMobile', this.isMobile);
571
+ return params;
572
+ }
573
+ /**
574
+ * Add isMobile = 'true' to paramters
575
+ * @param params : object
576
+ */
577
+ addIsMobile(params) {
578
+ params['isMobile'] = this.isMobile;
579
+ }
580
+ /**
581
+ * For POST request with form-urlencoded
582
+ */
583
+ getHeaderWithContentTypeForm() {
584
+ const headers = new HttpHeaders()
585
+ .set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
586
+ return headers;
587
+ }
588
+ /**
589
+ * For POST request with json body
590
+ */
591
+ getHeaderWithContentTypeJson() {
592
+ const headers = new HttpHeaders()
593
+ .set('Content-Type', 'application/json; charset=utf-8');
594
+ return headers;
595
+ }
596
+ }
597
+
598
+ class CallbackMessage {
599
+ constructor(errorMessage) {
600
+ this.errorMessage = '';
601
+ this.errorMessage = errorMessage;
602
+ }
603
+ }
604
+
605
+ class CountDownTime {
606
+ constructor(initTime) {
607
+ this.isStart = false;
608
+ this.isStop = false;
609
+ this.nextRound = false;
610
+ this.initTime = 0;
611
+ this.timeLeft = 0;
612
+ this.isCancel = false;
613
+ this.destroy$ = new Subject();
614
+ this.initTime = initTime;
615
+ }
616
+ start() {
617
+ this.isStart = true;
618
+ this.isStop = false;
619
+ this.timeLeft = this.initTime;
620
+ }
621
+ stop() {
622
+ this.isStart = false;
623
+ this.isStop = true;
624
+ this.timeLeft = 0;
625
+ this.nextRound = true;
626
+ }
627
+ downTime() {
628
+ this.timeLeft = this.timeLeft - 1;
629
+ }
630
+ cancel() {
631
+ this.isCancel = true;
632
+ this.stop();
633
+ }
634
+ oberserableTimer(isStop) {
635
+ timer(0, 1000)
636
+ .pipe(takeUntil(this.destroy$))
637
+ .subscribe(val => {
638
+ if (this.timeLeft === 0) {
639
+ if (this.isStart) {
640
+ this.stop();
641
+ }
642
+ }
643
+ else {
644
+ this.downTime();
645
+ }
646
+ if (this.nextRound) {
647
+ this.nextRound = false;
648
+ if (isStop) {
649
+ isStop.emit();
650
+ }
651
+ }
652
+ });
653
+ }
654
+ onDestroy() {
655
+ this.destroy$.next();
656
+ this.destroy$.complete();
657
+ }
658
+ }
659
+
377
660
  /*
378
661
  * Public API Surface of epp-lib
379
662
  */
380
- // Models
381
663
 
382
664
  /**
383
665
  * Generated bundle index. Do not edit.
384
666
  */
385
667
 
386
- export { ApiRoute, BaseForm, CallbackMessage, Checkout, Domain, IParam, IframeMessageService, IframeMessageType, PaymentService, PaymentType, VoddsHttpService };
668
+ export { BaseForm, CallbackMessage, Checkout, CountDownTime, Domain, EventEmitterService, IParam, IframeMessageService, IframeMessageType, PaymentService, PaymentType, RapydComponent, Timer, VoddsHttpService, VoddsLoaderComponent };
387
669
  //# sourceMappingURL=epp-lib.mjs.map