epp-lib 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/component/index.mjs +4 -0
- package/esm2022/lib/component/payment.mjs +147 -0
- package/esm2022/lib/component/rapyd/rapyd.component.mjs +222 -0
- package/esm2022/lib/component/vodds-loader/vodds-loader.component.mjs +19 -0
- package/esm2022/lib/model/broadcast/broadcast-event-type.mjs +5 -0
- package/esm2022/lib/model/broadcast/ibroadcast-event.mjs +2 -0
- package/esm2022/lib/model/count-down-time.mjs +56 -0
- package/esm2022/lib/model/domain.mjs +4 -2
- package/esm2022/lib/model/index.mjs +9 -0
- package/esm2022/lib/pipe/index.mjs +2 -0
- package/esm2022/lib/pipe/transloco.pipe.mjs +22 -0
- package/esm2022/lib/service/common-util.mjs +7 -0
- package/esm2022/lib/service/event-emitter.service.mjs +23 -0
- package/esm2022/lib/service/iframe-message.service.mjs +22 -13
- package/esm2022/lib/service/index.mjs +5 -0
- package/esm2022/lib/service/vodds-http.service.mjs +7 -8
- package/esm2022/lib/translation/epp-lib-loader.mjs +23 -0
- package/esm2022/lib/translation/epp-lib-translation.service.mjs +23 -0
- package/esm2022/lib/translation/epp-lib.providers.mjs +25 -0
- package/esm2022/lib/translation/i18n/cs.json +6 -0
- package/esm2022/lib/translation/i18n/en.json +7 -0
- package/esm2022/lib/translation/i18n/es.json +6 -0
- package/esm2022/lib/translation/i18n/ru.json +6 -0
- package/esm2022/lib/translation/index.mjs +4 -0
- package/esm2022/public-api.mjs +6 -16
- package/fesm2022/epp-lib-cs-Cq7S0zUq.mjs +13 -0
- package/fesm2022/epp-lib-cs-Cq7S0zUq.mjs.map +1 -0
- package/fesm2022/epp-lib-en-Bt5VLnlu.mjs +15 -0
- package/fesm2022/epp-lib-en-Bt5VLnlu.mjs.map +1 -0
- package/fesm2022/epp-lib-es--n1OPBgV.mjs +13 -0
- package/fesm2022/epp-lib-es--n1OPBgV.mjs.map +1 -0
- package/fesm2022/epp-lib-ru-DCZzQ5FE.mjs +13 -0
- package/fesm2022/epp-lib-ru-DCZzQ5FE.mjs.map +1 -0
- package/fesm2022/epp-lib.mjs +529 -128
- package/fesm2022/epp-lib.mjs.map +1 -1
- package/lib/component/index.d.ts +3 -0
- package/lib/{service/payment.service.d.ts → component/payment.d.ts} +9 -4
- package/lib/component/rapyd/rapyd.component.d.ts +37 -0
- package/lib/component/vodds-loader/vodds-loader.component.d.ts +7 -0
- package/lib/model/broadcast/broadcast-event-type.d.ts +3 -0
- package/lib/model/broadcast/ibroadcast-event.d.ts +5 -0
- package/lib/model/count-down-time.d.ts +16 -0
- package/lib/model/domain.d.ts +2 -0
- package/lib/model/index.d.ts +8 -0
- package/lib/pipe/index.d.ts +1 -0
- package/lib/pipe/transloco.pipe.d.ts +9 -0
- package/lib/service/common-util.d.ts +3 -0
- package/lib/service/event-emitter.service.d.ts +10 -0
- package/lib/service/iframe-message.service.d.ts +7 -5
- package/lib/service/index.d.ts +4 -0
- package/lib/service/vodds-http.service.d.ts +1 -3
- package/lib/translation/epp-lib-loader.d.ts +31 -0
- package/lib/translation/epp-lib-translation.service.d.ts +8 -0
- package/lib/translation/epp-lib.providers.d.ts +6 -0
- package/lib/translation/index.d.ts +3 -0
- package/package.json +4 -2
- package/public-api.d.ts +5 -12
- package/src/lib/translation/i18n/cs.json +6 -0
- package/src/lib/translation/i18n/en.json +7 -0
- package/src/lib/translation/i18n/es.json +6 -0
- package/src/lib/translation/i18n/ru.json +6 -0
- package/esm2022/lib/model/base-form.mjs +0 -49
- package/esm2022/lib/model/callback-message.mjs +0 -7
- package/esm2022/lib/service/payment.service.mjs +0 -100
- package/lib/model/base-form.d.ts +0 -28
- package/lib/model/callback-message.d.ts +0 -4
package/fesm2022/epp-lib.mjs
CHANGED
|
@@ -1,125 +1,112 @@
|
|
|
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
|
|
2
|
+
import { Injectable, inject, makeEnvironmentProviders, Pipe, Input, Component, Inject } from '@angular/core';
|
|
3
|
+
import * as i2 from '@jsverse/transloco';
|
|
4
|
+
import { TranslocoService, provideTransloco, provideTranslocoScope, TranslocoModule } from '@jsverse/transloco';
|
|
5
|
+
import { Subject, Observable, timer, takeUntil } from 'rxjs';
|
|
6
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
7
|
+
import * as i1 from '@angular/material/dialog';
|
|
8
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
9
|
+
import * as i3 from '@angular/material/progress-spinner';
|
|
10
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
11
|
+
import { NgStyle } from '@angular/common';
|
|
6
12
|
|
|
7
|
-
class
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
class EppLibLoader {
|
|
14
|
+
getTranslation(lang) {
|
|
15
|
+
switch (lang) {
|
|
16
|
+
case 'cs':
|
|
17
|
+
return import('./epp-lib-cs-Cq7S0zUq.mjs');
|
|
18
|
+
case 'ru':
|
|
19
|
+
return import('./epp-lib-ru-DCZzQ5FE.mjs');
|
|
20
|
+
case 'es':
|
|
21
|
+
return import('./epp-lib-es--n1OPBgV.mjs');
|
|
22
|
+
case 'en':
|
|
23
|
+
default:
|
|
24
|
+
return import('./epp-lib-en-Bt5VLnlu.mjs');
|
|
25
|
+
}
|
|
16
26
|
}
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
28
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibLoader }); }
|
|
17
29
|
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibLoader, decorators: [{
|
|
31
|
+
type: Injectable
|
|
32
|
+
}] });
|
|
18
33
|
|
|
19
|
-
class
|
|
34
|
+
class EppLibTranslationService {
|
|
20
35
|
constructor() {
|
|
21
|
-
|
|
22
|
-
this.isMobile = 'false';
|
|
36
|
+
this.transloco = inject(TranslocoService);
|
|
23
37
|
}
|
|
24
|
-
|
|
25
|
-
|
|
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;
|
|
38
|
+
setLanguage(lang) {
|
|
39
|
+
this.transloco.setActiveLang(lang);
|
|
32
40
|
}
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
41
|
+
getLanguage() {
|
|
42
|
+
return this.transloco.getActiveLang();
|
|
63
43
|
}
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
45
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibTranslationService, providedIn: 'root' }); }
|
|
64
46
|
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EppLibTranslationService, decorators: [{
|
|
48
|
+
type: Injectable,
|
|
49
|
+
args: [{
|
|
50
|
+
providedIn: 'root'
|
|
51
|
+
}]
|
|
52
|
+
}] });
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
function provideEppLibTranslations(config) {
|
|
55
|
+
return makeEnvironmentProviders([
|
|
56
|
+
provideTransloco({
|
|
57
|
+
config: {
|
|
58
|
+
availableLangs: config.availableLangs,
|
|
59
|
+
defaultLang: config.defaultLang,
|
|
60
|
+
reRenderOnLangChange: true,
|
|
61
|
+
},
|
|
62
|
+
loader: EppLibLoader,
|
|
63
|
+
}),
|
|
64
|
+
provideTranslocoScope({
|
|
65
|
+
scope: 'epp-lib',
|
|
66
|
+
loader: {
|
|
67
|
+
en: () => import('./epp-lib-en-Bt5VLnlu.mjs'),
|
|
68
|
+
cs: () => import('./epp-lib-cs-Cq7S0zUq.mjs'),
|
|
69
|
+
es: () => import('./epp-lib-es--n1OPBgV.mjs'),
|
|
70
|
+
ru: () => import('./epp-lib-ru-DCZzQ5FE.mjs'),
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
]);
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
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 = {}));
|
|
80
|
-
|
|
81
|
-
class Checkout {
|
|
76
|
+
class EventEmitterService {
|
|
82
77
|
constructor() {
|
|
83
|
-
this.
|
|
84
|
-
this.paymentType = PaymentType.NA;
|
|
85
|
-
this.url = '';
|
|
86
|
-
this.expiration = 300;
|
|
87
|
-
this.errorMessage = '';
|
|
88
|
-
this.successMessage = '';
|
|
78
|
+
this.eventBus = new Subject();
|
|
89
79
|
}
|
|
90
|
-
|
|
91
|
-
this.
|
|
92
|
-
this.popup = undefined;
|
|
80
|
+
broadcast(event) {
|
|
81
|
+
this.eventBus.next(event);
|
|
93
82
|
}
|
|
94
|
-
|
|
95
|
-
this.
|
|
96
|
-
this.callback = callback;
|
|
97
|
-
this.popup = undefined;
|
|
83
|
+
getEventBus() {
|
|
84
|
+
return this.eventBus;
|
|
98
85
|
}
|
|
86
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
87
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, providedIn: 'root' }); }
|
|
99
88
|
}
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EventEmitterService, decorators: [{
|
|
90
|
+
type: Injectable,
|
|
91
|
+
args: [{
|
|
92
|
+
providedIn: 'root',
|
|
93
|
+
}]
|
|
94
|
+
}] });
|
|
100
95
|
|
|
101
96
|
class Domain {
|
|
102
97
|
constructor() {
|
|
103
98
|
this.defaultDomain = '';
|
|
104
|
-
this.allowedOrigins = ['http://localhost:9000'];
|
|
99
|
+
this.allowedOrigins = ['http://localhost:9000', 'http://localhost:4200'];
|
|
105
100
|
this.specialDomain = [];
|
|
106
101
|
this.jetonDomain = '';
|
|
102
|
+
this.ecopayzDomain = '';
|
|
103
|
+
this.rapydDomain = 'https://sandboxcheckout.rapyd.net';
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
106
|
|
|
110
|
-
var IframeMessageType;
|
|
111
|
-
(function (IframeMessageType) {
|
|
112
|
-
IframeMessageType[IframeMessageType["OPEN_PAYMENT_FORM"] = 0] = "OPEN_PAYMENT_FORM";
|
|
113
|
-
IframeMessageType[IframeMessageType["PAYMENT_CALLBACK"] = 1] = "PAYMENT_CALLBACK";
|
|
114
|
-
})(IframeMessageType || (IframeMessageType = {}));
|
|
115
|
-
|
|
116
|
-
const ApiRoute = {
|
|
117
|
-
GET_DOMAIN: { url: "/getDomain", method: "get" }
|
|
118
|
-
};
|
|
119
|
-
|
|
120
107
|
class VoddsHttpService {
|
|
121
|
-
constructor(
|
|
122
|
-
this.httpClient =
|
|
108
|
+
constructor() {
|
|
109
|
+
this.httpClient = inject(HttpClient);
|
|
123
110
|
}
|
|
124
111
|
postJson(url, request) {
|
|
125
112
|
const headers = new HttpHeaders({ 'Content-type': 'application/json' });
|
|
@@ -159,7 +146,7 @@ class VoddsHttpService {
|
|
|
159
146
|
getFullUrl(url, param) {
|
|
160
147
|
return `${url}?${param.toFormUrlEncoded()}`;
|
|
161
148
|
}
|
|
162
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, deps: [
|
|
149
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
163
150
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, providedIn: 'root' }); }
|
|
164
151
|
}
|
|
165
152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsHttpService, decorators: [{
|
|
@@ -167,19 +154,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
167
154
|
args: [{
|
|
168
155
|
providedIn: 'root',
|
|
169
156
|
}]
|
|
170
|
-
}]
|
|
157
|
+
}] });
|
|
158
|
+
|
|
159
|
+
const ApiRoute = {
|
|
160
|
+
GET_DOMAIN: { url: "/getDomain", method: "get" }
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var PaymentType;
|
|
164
|
+
(function (PaymentType) {
|
|
165
|
+
PaymentType[PaymentType["NA"] = 0] = "NA";
|
|
166
|
+
PaymentType[PaymentType["JETON"] = 1] = "JETON";
|
|
167
|
+
PaymentType[PaymentType["ECOPAYZ"] = 2] = "ECOPAYZ";
|
|
168
|
+
PaymentType[PaymentType["RAPYD"] = 3] = "RAPYD";
|
|
169
|
+
})(PaymentType || (PaymentType = {}));
|
|
170
|
+
|
|
171
|
+
var IframeMessageType;
|
|
172
|
+
(function (IframeMessageType) {
|
|
173
|
+
IframeMessageType[IframeMessageType["OPEN_PAYMENT_FORM"] = 0] = "OPEN_PAYMENT_FORM";
|
|
174
|
+
IframeMessageType[IframeMessageType["PAYMENT_CALLBACK"] = 1] = "PAYMENT_CALLBACK";
|
|
175
|
+
})(IframeMessageType || (IframeMessageType = {}));
|
|
171
176
|
|
|
172
177
|
class IframeMessageService {
|
|
173
|
-
constructor(ngZone
|
|
178
|
+
constructor(ngZone) {
|
|
174
179
|
this.ngZone = ngZone;
|
|
175
|
-
this.http = http;
|
|
176
180
|
this.messages$ = new Subject();
|
|
177
181
|
this.thirdPartyMessages$ = new Subject();
|
|
182
|
+
this.http = inject(VoddsHttpService);
|
|
178
183
|
this.listener = (event) => {
|
|
179
|
-
// console.log("message: ", event);
|
|
180
184
|
if (!this.domain.allowedOrigins.includes(event.origin)) {
|
|
181
|
-
|
|
182
|
-
if (this.domain.jetonDomain == event.origin) {
|
|
185
|
+
if (this.isValidDomain(PaymentType.NA, event.origin)) {
|
|
183
186
|
this.ngZone.run(() => {
|
|
184
187
|
this.thirdPartyMessages$.next(event);
|
|
185
188
|
});
|
|
@@ -204,10 +207,10 @@ class IframeMessageService {
|
|
|
204
207
|
});
|
|
205
208
|
window.addEventListener('message', this.listener);
|
|
206
209
|
}
|
|
207
|
-
|
|
210
|
+
onMessages() {
|
|
208
211
|
return this.messages$.asObservable();
|
|
209
212
|
}
|
|
210
|
-
|
|
213
|
+
onThirdPartyMessages() {
|
|
211
214
|
return this.thirdPartyMessages$.asObservable();
|
|
212
215
|
}
|
|
213
216
|
ngOnDestroy() {
|
|
@@ -215,12 +218,23 @@ class IframeMessageService {
|
|
|
215
218
|
this.messages$.complete();
|
|
216
219
|
this.thirdPartyMessages$.complete();
|
|
217
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Skip for RAPYD - It will process when the dialog close
|
|
223
|
+
*/
|
|
218
224
|
isValidDomain(paymentType, origin) {
|
|
219
|
-
if (paymentType == null)
|
|
225
|
+
if (paymentType == undefined || paymentType == null)
|
|
220
226
|
return false;
|
|
221
227
|
switch (paymentType) {
|
|
222
228
|
case PaymentType.JETON:
|
|
223
229
|
return this.domain.jetonDomain == origin;
|
|
230
|
+
case PaymentType.ECOPAYZ:
|
|
231
|
+
return this.domain.ecopayzDomain == origin;
|
|
232
|
+
// case PaymentType.RAPYD:
|
|
233
|
+
// return this.domain.rapydDomain == origin;
|
|
234
|
+
case PaymentType.NA:
|
|
235
|
+
return this.domain.jetonDomain == origin
|
|
236
|
+
// || this.domain.rapydDomain == origin
|
|
237
|
+
|| this.domain.ecopayzDomain == origin;
|
|
224
238
|
default:
|
|
225
239
|
return false;
|
|
226
240
|
}
|
|
@@ -230,7 +244,7 @@ class IframeMessageService {
|
|
|
230
244
|
return;
|
|
231
245
|
iframe.nativeElement.contentWindow?.postMessage(message, window.location.origin);
|
|
232
246
|
}
|
|
233
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: IframeMessageService, deps: [{ token: i0.NgZone }
|
|
247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: IframeMessageService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
234
248
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: IframeMessageService, providedIn: 'root' }); }
|
|
235
249
|
}
|
|
236
250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: IframeMessageService, decorators: [{
|
|
@@ -238,7 +252,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
238
252
|
args: [{
|
|
239
253
|
providedIn: 'root'
|
|
240
254
|
}]
|
|
241
|
-
}], ctorParameters: () => [{ type: i0.NgZone }
|
|
255
|
+
}], ctorParameters: () => [{ type: i0.NgZone }] });
|
|
256
|
+
|
|
257
|
+
class CommonUtil {
|
|
258
|
+
static isMobileTemplate() {
|
|
259
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
260
|
+
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|Mobile/i.test(userAgent.toLowerCase());
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
class Checkout {
|
|
265
|
+
constructor() {
|
|
266
|
+
this.requestId = 0;
|
|
267
|
+
this.paymentType = PaymentType.NA;
|
|
268
|
+
this.url = '';
|
|
269
|
+
this.expiration = 300;
|
|
270
|
+
this.errorMessage = '';
|
|
271
|
+
this.successMessage = '';
|
|
272
|
+
}
|
|
273
|
+
setErrorMessage(errorMessage) {
|
|
274
|
+
this.errorMessage = errorMessage;
|
|
275
|
+
this.popup = undefined;
|
|
276
|
+
}
|
|
277
|
+
setCallback(callback) {
|
|
278
|
+
this.successMessage = 'success';
|
|
279
|
+
this.callback = callback;
|
|
280
|
+
this.popup = undefined;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
class CountDownTime {
|
|
285
|
+
constructor(initTime) {
|
|
286
|
+
this.isStart = false;
|
|
287
|
+
this.isStop = false;
|
|
288
|
+
this.nextRound = false;
|
|
289
|
+
this.initTime = 0;
|
|
290
|
+
this.timeLeft = 0;
|
|
291
|
+
this.isCancel = false;
|
|
292
|
+
this.destroy$ = new Subject();
|
|
293
|
+
this.initTime = initTime;
|
|
294
|
+
}
|
|
295
|
+
start() {
|
|
296
|
+
this.isStart = true;
|
|
297
|
+
this.isStop = false;
|
|
298
|
+
this.timeLeft = this.initTime;
|
|
299
|
+
}
|
|
300
|
+
stop() {
|
|
301
|
+
this.isStart = false;
|
|
302
|
+
this.isStop = true;
|
|
303
|
+
this.timeLeft = 0;
|
|
304
|
+
this.nextRound = true;
|
|
305
|
+
}
|
|
306
|
+
downTime() {
|
|
307
|
+
this.timeLeft = this.timeLeft - 1;
|
|
308
|
+
}
|
|
309
|
+
cancel() {
|
|
310
|
+
this.isCancel = true;
|
|
311
|
+
this.stop();
|
|
312
|
+
}
|
|
313
|
+
oberserableTimer(isStop) {
|
|
314
|
+
timer(0, 1000)
|
|
315
|
+
.pipe(takeUntil(this.destroy$))
|
|
316
|
+
.subscribe(val => {
|
|
317
|
+
if (this.timeLeft === 0) {
|
|
318
|
+
if (this.isStart) {
|
|
319
|
+
this.stop();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
this.downTime();
|
|
324
|
+
}
|
|
325
|
+
if (this.nextRound) {
|
|
326
|
+
this.nextRound = false;
|
|
327
|
+
if (isStop) {
|
|
328
|
+
isStop.emit();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
onDestroy() {
|
|
334
|
+
this.destroy$.next();
|
|
335
|
+
this.destroy$.complete();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
class IParam {
|
|
340
|
+
getMobileFlag() {
|
|
341
|
+
return /android|mobi/i.test(navigator.userAgent.toLowerCase());
|
|
342
|
+
}
|
|
343
|
+
toJson() {
|
|
344
|
+
return JSON.stringify(this);
|
|
345
|
+
}
|
|
346
|
+
toFormUrlEncoded() {
|
|
347
|
+
return new URLSearchParams(Object.entries(this).map(([key, value]) => [key, String(value)])).toString();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
242
350
|
|
|
243
351
|
class Timer {
|
|
244
352
|
constructor(interval, maxTime) {
|
|
@@ -280,15 +388,265 @@ class Timer {
|
|
|
280
388
|
}
|
|
281
389
|
}
|
|
282
390
|
|
|
283
|
-
class
|
|
391
|
+
class TranslocoPipe {
|
|
284
392
|
constructor() {
|
|
393
|
+
this.transloco = inject(TranslocoService);
|
|
394
|
+
}
|
|
395
|
+
transform(key) {
|
|
396
|
+
return this.transloco.translate(key, {}, 'epp-lib');
|
|
397
|
+
// return this.transloco.selectTranslate(key, {}, 'epp-lib');
|
|
398
|
+
}
|
|
399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TranslocoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
400
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: TranslocoPipe, isStandalone: true, name: "vTransloco" }); }
|
|
401
|
+
}
|
|
402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TranslocoPipe, decorators: [{
|
|
403
|
+
type: Pipe,
|
|
404
|
+
args: [{
|
|
405
|
+
name: 'vTransloco',
|
|
406
|
+
standalone: true
|
|
407
|
+
}]
|
|
408
|
+
}] });
|
|
409
|
+
|
|
410
|
+
class VoddsLoaderComponent {
|
|
411
|
+
constructor() {
|
|
412
|
+
this.message = '';
|
|
413
|
+
this.showAjaxLoader = false;
|
|
414
|
+
}
|
|
415
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
416
|
+
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=\"https://cdn.voddos.net/vodds/static/ajax-loader16.gif\">\r\n {{message != undefined ? message : ''}}\r\n </div>\r\n}\r\n", styles: [""] }); }
|
|
417
|
+
}
|
|
418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VoddsLoaderComponent, decorators: [{
|
|
419
|
+
type: Component,
|
|
420
|
+
args: [{ selector: 'vodds-loader', standalone: true, imports: [], template: "@if (showAjaxLoader) {\r\n <div class=\"load-indicator\">\r\n <img src=\"https://cdn.voddos.net/vodds/static/ajax-loader16.gif\">\r\n {{message != undefined ? message : ''}}\r\n </div>\r\n}\r\n" }]
|
|
421
|
+
}], propDecorators: { message: [{
|
|
422
|
+
type: Input
|
|
423
|
+
}], showAjaxLoader: [{
|
|
424
|
+
type: Input
|
|
425
|
+
}] } });
|
|
426
|
+
|
|
427
|
+
class RapydComponent {
|
|
428
|
+
constructor(dialogRef, data, translocoService) {
|
|
429
|
+
this.dialogRef = dialogRef;
|
|
430
|
+
this.data = data;
|
|
431
|
+
this.translocoService = translocoService;
|
|
432
|
+
this.isOpen = false;
|
|
433
|
+
this.checkoutToolKit = undefined;
|
|
434
|
+
this.visaMasterTimeout = 300;
|
|
435
|
+
this.visaMasterCheckoutId = '';
|
|
436
|
+
this.displayTimer = "00:00";
|
|
437
|
+
this.isShow = false;
|
|
438
|
+
this.isLoading = true;
|
|
439
|
+
this.errorMessage = "";
|
|
440
|
+
this.defaultExpirationSec = 300; // 5mins
|
|
441
|
+
this.checkoutFailureMessage = '';
|
|
442
|
+
this.handleLoading = (event) => {
|
|
443
|
+
if (!event.detail.loading && this.isLoading) {
|
|
444
|
+
this.isShow = true;
|
|
445
|
+
this.isLoading = false;
|
|
446
|
+
this.startTimer();
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
this.handleCheckoutPaymentSuccess = (event) => {
|
|
450
|
+
this.closeDialog(false);
|
|
451
|
+
};
|
|
452
|
+
this.handleCheckoutPaymentFailure = (event) => {
|
|
453
|
+
this.stopTimer();
|
|
454
|
+
this.isShow = false;
|
|
455
|
+
this.checkoutFailureMessage = event.detail.message;
|
|
456
|
+
};
|
|
457
|
+
this.visaMasterTimeout = data.expiration ?? data.expiration;
|
|
458
|
+
this.visaMasterCheckoutId = data.checkoutUrl;
|
|
459
|
+
}
|
|
460
|
+
ngOnDestroy() {
|
|
461
|
+
this.stopTimer();
|
|
462
|
+
window.removeEventListener('onLoading', this.handleLoading);
|
|
463
|
+
window.removeEventListener('onCheckoutPaymentSuccess', this.handleCheckoutPaymentSuccess);
|
|
464
|
+
window.removeEventListener('onCheckoutPaymentFailure', this.handleCheckoutPaymentFailure);
|
|
465
|
+
}
|
|
466
|
+
ngAfterViewInit() {
|
|
467
|
+
if (this.checkout) {
|
|
468
|
+
this.visaMasterTimeout = this.checkout.expiration;
|
|
469
|
+
this.visaMasterCheckoutId = this.checkout.url;
|
|
470
|
+
}
|
|
471
|
+
this.translocoService.selectTranslate('mobile_payment_form_title').subscribe(buttonText => {
|
|
472
|
+
console.log('Async translations loaded:', buttonText);
|
|
473
|
+
this.checkoutToolKit = this.isMobile() ? this.createCheckoutToolKitOnMobile(buttonText) : this.createCheckoutToolKitOnDesktop(buttonText);
|
|
474
|
+
this.displayCheckout();
|
|
475
|
+
window.addEventListener('onLoading', this.handleLoading);
|
|
476
|
+
window.addEventListener('onCheckoutPaymentSuccess', this.handleCheckoutPaymentSuccess);
|
|
477
|
+
window.addEventListener('onCheckoutPaymentFailure', this.handleCheckoutPaymentFailure);
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
createCheckoutToolKitOnDesktop(buttonText) {
|
|
481
|
+
return new RapydCheckoutToolkit({
|
|
482
|
+
pay_button_text: buttonText,
|
|
483
|
+
id: this.visaMasterCheckoutId,
|
|
484
|
+
wait_on_payment_redirect: true,
|
|
485
|
+
style: {
|
|
486
|
+
cardFields: {
|
|
487
|
+
title: {
|
|
488
|
+
color: '#80807F'
|
|
489
|
+
},
|
|
490
|
+
saveForFutureLabel: {
|
|
491
|
+
color: '#80807F'
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
input: {
|
|
495
|
+
base: {
|
|
496
|
+
fontWeight: "400",
|
|
497
|
+
borderRadius: "5px",
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
orderDetails: {
|
|
501
|
+
title: {
|
|
502
|
+
color: '#80807F'
|
|
503
|
+
},
|
|
504
|
+
totalLabel: {
|
|
505
|
+
color: '#80807F'
|
|
506
|
+
},
|
|
507
|
+
totalValue: {
|
|
508
|
+
color: '#80807F'
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
submit: {
|
|
512
|
+
base: {
|
|
513
|
+
backgroundColor: "#F48215",
|
|
514
|
+
color: "#FFFFFF",
|
|
515
|
+
fontWeight: "900",
|
|
516
|
+
borderRadius: "5px",
|
|
517
|
+
border: "none",
|
|
518
|
+
boxShadow: "0px 0px 20px 0px #28303A33",
|
|
519
|
+
height: "35px",
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
createCheckoutToolKitOnMobile(buttonText) {
|
|
526
|
+
return new RapydCheckoutToolkit({
|
|
527
|
+
pay_button_text: buttonText,
|
|
528
|
+
id: this.visaMasterCheckoutId,
|
|
529
|
+
wait_on_payment_redirect: true,
|
|
530
|
+
style: {
|
|
531
|
+
input: {
|
|
532
|
+
base: {
|
|
533
|
+
fontWeight: "400",
|
|
534
|
+
borderRadius: "5px",
|
|
535
|
+
fontSize: "12px"
|
|
536
|
+
},
|
|
537
|
+
placeholder: {
|
|
538
|
+
fontSize: "12px !important",
|
|
539
|
+
fontWeight: "700",
|
|
540
|
+
fontFamily: "Manrope",
|
|
541
|
+
color: '#8C8C8C',
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
cardFields: {
|
|
545
|
+
title: {
|
|
546
|
+
color: '#8C8C8C'
|
|
547
|
+
},
|
|
548
|
+
saveForFutureLabel: {
|
|
549
|
+
color: '#8C8C8C',
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
orderDetails: {
|
|
553
|
+
title: {
|
|
554
|
+
color: '#8C8C8C',
|
|
555
|
+
},
|
|
556
|
+
totalLabel: {
|
|
557
|
+
color: '#8C8C8C',
|
|
558
|
+
},
|
|
559
|
+
totalValue: {
|
|
560
|
+
color: '#8C8C8C',
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
submit: {
|
|
564
|
+
base: {
|
|
565
|
+
backgroundColor: "#28303A",
|
|
566
|
+
color: "#FFFFFF",
|
|
567
|
+
fontWeight: "900 !important",
|
|
568
|
+
borderRadius: "12px",
|
|
569
|
+
boxShadow: "0 0 8.57px #ff6b0066 !important",
|
|
570
|
+
height: "40px",
|
|
571
|
+
width: "100%",
|
|
572
|
+
fontSize: "12px !important",
|
|
573
|
+
border: "none"
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
closeDialog(isCloseCheckout = true) {
|
|
580
|
+
this.stopTimer();
|
|
581
|
+
if (this.checkoutToolKit && isCloseCheckout) {
|
|
582
|
+
try {
|
|
583
|
+
this.checkoutToolKit.closeCheckout();
|
|
584
|
+
}
|
|
585
|
+
catch (err) {
|
|
586
|
+
console.error("Error when closing checkout", err);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
this.checkoutToolKit = undefined;
|
|
590
|
+
this.isShow = false;
|
|
591
|
+
this.dialogRef.close(this.checkoutFailureMessage);
|
|
592
|
+
}
|
|
593
|
+
;
|
|
594
|
+
startTimer() {
|
|
595
|
+
if (this.visaMasterTimer)
|
|
596
|
+
this.stopTimer();
|
|
597
|
+
this.visaMasterTimer = setInterval(() => {
|
|
598
|
+
if (this.visaMasterTimeout <= 0) {
|
|
599
|
+
this.closeDialog();
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
this.visaMasterTimeout--;
|
|
603
|
+
this.displayTimer = `${this.pad(Math.floor(this.visaMasterTimeout / 60))}:${this.pad(this.visaMasterTimeout % 60)}`;
|
|
604
|
+
}, 1000);
|
|
605
|
+
}
|
|
606
|
+
stopTimer() {
|
|
607
|
+
clearInterval(this.visaMasterTimer);
|
|
608
|
+
}
|
|
609
|
+
pad(number) {
|
|
610
|
+
return `${number < 10 ? '0' : ''}${number}`;
|
|
611
|
+
}
|
|
612
|
+
displayCheckout() {
|
|
613
|
+
if (document.getElementById("rapyd-checkout")) {
|
|
614
|
+
this.checkoutToolKit.displayCheckout();
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
setTimeout(() => {
|
|
618
|
+
this.displayCheckout();
|
|
619
|
+
}, 10);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
isMobile() {
|
|
623
|
+
return true;
|
|
624
|
+
// return CommonUtil.isMobileTemplate();
|
|
625
|
+
}
|
|
626
|
+
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: i2.TranslocoService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
627
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: RapydComponent, isStandalone: true, selector: "v-rapyd", inputs: { checkout: "checkout" }, ngImport: i0, template: "@if(isMobile()) {\r\n <div class=\"v-dialog mobile\">\r\n <div class=\"v-flex-center-between header text-black-cs\">\r\n <div class=\"v-flex-center-none\">\r\n <span class=\"ml-8\">{{ 'mobile_payment_form_title' | transloco }}</span>\r\n </div>\r\n <div class=\"v-flex-center-between mr-8\">\r\n <div (click)=\"closeDialog()\">\r\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\r\n d=\"M11.0121 12.3959L16.6455 18.0293C16.8333 18.2107 17.0849 18.3111 17.346 18.3088C17.6071 18.3065 17.8569 18.2018 18.0415 18.0172C18.2261 17.8325 18.3309 17.5828 18.3331 17.3217C18.3354 17.0606 18.235 16.809 18.0536 16.6212L12.4202 10.9878L18.0536 5.35431C18.235 5.16649 18.3354 4.91494 18.3331 4.65384C18.3309 4.39273 18.2261 4.14297 18.0415 3.95833C17.8569 3.77369 17.6071 3.66896 17.346 3.66669C17.0849 3.66443 16.8333 3.7648 16.6455 3.9462L11.0121 9.57964L5.37863 3.9462C5.18997 3.76928 4.93988 3.67271 4.68128 3.67691C4.42268 3.68111 4.17585 3.78575 3.99304 3.9687C3.81022 4.15165 3.70575 4.39854 3.70173 4.65715C3.69772 4.91575 3.79447 5.16577 3.97152 5.35431L9.60396 10.9878L3.97052 16.6212C3.87541 16.7131 3.79954 16.8229 3.74735 16.9444C3.69516 17.0659 3.66769 17.1966 3.66654 17.3288C3.66539 17.4611 3.69059 17.5922 3.74066 17.7146C3.79073 17.837 3.86468 17.9481 3.95818 18.0416C4.05168 18.1352 4.16287 18.2091 4.28525 18.2592C4.40764 18.3092 4.53877 18.3344 4.67099 18.3333C4.80322 18.3321 4.93389 18.3047 5.05539 18.2525C5.17688 18.2003 5.28677 18.1244 5.37863 18.0293L11.0121 12.3959Z\" />\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n @if (isLoading) {\r\n <div class=\"v-spinner\">\r\n <mat-spinner diameter=\"50\" strokeWidth=\"4\"></mat-spinner>\r\n </div>\r\n }\r\n <div class=\"v-content\" id=\"deposit-id\">\r\n @if (!isLoading && !isShow) {\r\n <div class=\"visa-card-message\">\r\n {{ 'visaCardErrorMessage' | transloco }} <br> {{ 'visaCardErrorMessage2' | transloco }}\r\n </div>\r\n }\r\n <div class=\"vodds-checkout-deposit\">\r\n @if(!isLoading && isShow) {\r\n <div class=\"vodds-checkout-expiration\">\r\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path\r\n 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\"\r\n fill=\"#8C8C8C\" />\r\n <line x1=\"10.0303\" y1=\"0.530339\" x2=\"12.8588\" y2=\"3.35877\" stroke=\"#8C8C8C\" 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.82843 1.06067)\"\r\n stroke=\"#8C8C8C\" stroke-width=\"1.5\" />\r\n </svg>\r\n <span>{{ 'visaCardTimeout' | transloco }} <span class=\"countdown-timer\">{{displayTimer}}</span></span>\r\n </div>\r\n }\r\n <div id=\"rapyd-checkout\" class=\"iframe-wrapper\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n} @else {\r\n <div id=\"visa-card\">\r\n <div class=\"top\">\r\n <h2>{{ 'payment_form_title' | transloco }}</h2>\r\n <svg class=\"clsbtn my-account\" (click)=\"closeDialog()\" width=\"11\" height=\"11\" viewBox=\"0 0 11 11\" fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\">\r\n <path\r\n 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\"\r\n 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 {{ 'visaCardErrorMessage' | transloco }} <br> {{ 'visaCardErrorMessage2' | transloco }}\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\r\n 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\"\r\n 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\"\r\n transform=\"matrix(-0.707107 0.707107 0.707107 0.707107 4.82861 1.06067)\" stroke=\"#B5B5B5\"\r\n stroke-width=\"1.5\" />\r\n </svg>\r\n <span class=\"label\"> {{ 'visaCardTimeout' | transloco }} </span> <span class=\"display-time\">\r\n {{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}.mobile .header{font-weight:800;font-size:18px;line-height:18px;margin:0 7px;border-bottom:1px solid #96A2B3;padding:20px 0 15px}.mobile .header .dark{color:#fff}.mobile .header .light{color:#2c3644}.mobile .header svg{fill:#2c3644}.mobile .v-flex-center-between{display:flex;justify-content:space-between;align-items:center;padding-left:10px;padding-right:10px}.mobile .vodds-checkout-expiration{display:flex;justify-content:center;align-items:center;font-weight:700;gap:5px;color:#8c8c8c;font-size:12px}.mobile .countdown-timer{color:#000}.mobile .iframe-wrapper{position:relative;overflow:hidden}.mobile .v-dialog .v-content{padding:0!important;max-height:74vh}.mobile .vodds-checkout-deposit{overflow:auto;margin-top:10px}.mobile .v-dialog{background:#f3f2f9;color:#28303a}.mobile .v-spinner{display:flex;justify-content:center;width:100%}.mobile ::ng-deep .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:#dd443c!important}.mobile .visa-card-message{margin:28px 20px;color:#dd453c;font-size:14px}.mobile .v-dialog .v-content{background-color:#f1f1f1}\n"], dependencies: [{ kind: "component", type: VoddsLoaderComponent, selector: "vodds-loader", inputs: ["message", "showAjaxLoader"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] }); }
|
|
628
|
+
}
|
|
629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RapydComponent, decorators: [{
|
|
630
|
+
type: Component,
|
|
631
|
+
args: [{ selector: 'v-rapyd', standalone: true, imports: [NgStyle, VoddsLoaderComponent, MatDialogModule, MatProgressSpinnerModule, TranslocoModule], template: "@if(isMobile()) {\r\n <div class=\"v-dialog mobile\">\r\n <div class=\"v-flex-center-between header text-black-cs\">\r\n <div class=\"v-flex-center-none\">\r\n <span class=\"ml-8\">{{ 'mobile_payment_form_title' | transloco }}</span>\r\n </div>\r\n <div class=\"v-flex-center-between mr-8\">\r\n <div (click)=\"closeDialog()\">\r\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\r\n d=\"M11.0121 12.3959L16.6455 18.0293C16.8333 18.2107 17.0849 18.3111 17.346 18.3088C17.6071 18.3065 17.8569 18.2018 18.0415 18.0172C18.2261 17.8325 18.3309 17.5828 18.3331 17.3217C18.3354 17.0606 18.235 16.809 18.0536 16.6212L12.4202 10.9878L18.0536 5.35431C18.235 5.16649 18.3354 4.91494 18.3331 4.65384C18.3309 4.39273 18.2261 4.14297 18.0415 3.95833C17.8569 3.77369 17.6071 3.66896 17.346 3.66669C17.0849 3.66443 16.8333 3.7648 16.6455 3.9462L11.0121 9.57964L5.37863 3.9462C5.18997 3.76928 4.93988 3.67271 4.68128 3.67691C4.42268 3.68111 4.17585 3.78575 3.99304 3.9687C3.81022 4.15165 3.70575 4.39854 3.70173 4.65715C3.69772 4.91575 3.79447 5.16577 3.97152 5.35431L9.60396 10.9878L3.97052 16.6212C3.87541 16.7131 3.79954 16.8229 3.74735 16.9444C3.69516 17.0659 3.66769 17.1966 3.66654 17.3288C3.66539 17.4611 3.69059 17.5922 3.74066 17.7146C3.79073 17.837 3.86468 17.9481 3.95818 18.0416C4.05168 18.1352 4.16287 18.2091 4.28525 18.2592C4.40764 18.3092 4.53877 18.3344 4.67099 18.3333C4.80322 18.3321 4.93389 18.3047 5.05539 18.2525C5.17688 18.2003 5.28677 18.1244 5.37863 18.0293L11.0121 12.3959Z\" />\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n @if (isLoading) {\r\n <div class=\"v-spinner\">\r\n <mat-spinner diameter=\"50\" strokeWidth=\"4\"></mat-spinner>\r\n </div>\r\n }\r\n <div class=\"v-content\" id=\"deposit-id\">\r\n @if (!isLoading && !isShow) {\r\n <div class=\"visa-card-message\">\r\n {{ 'visaCardErrorMessage' | transloco }} <br> {{ 'visaCardErrorMessage2' | transloco }}\r\n </div>\r\n }\r\n <div class=\"vodds-checkout-deposit\">\r\n @if(!isLoading && isShow) {\r\n <div class=\"vodds-checkout-expiration\">\r\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path\r\n 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\"\r\n fill=\"#8C8C8C\" />\r\n <line x1=\"10.0303\" y1=\"0.530339\" x2=\"12.8588\" y2=\"3.35877\" stroke=\"#8C8C8C\" 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.82843 1.06067)\"\r\n stroke=\"#8C8C8C\" stroke-width=\"1.5\" />\r\n </svg>\r\n <span>{{ 'visaCardTimeout' | transloco }} <span class=\"countdown-timer\">{{displayTimer}}</span></span>\r\n </div>\r\n }\r\n <div id=\"rapyd-checkout\" class=\"iframe-wrapper\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n} @else {\r\n <div id=\"visa-card\">\r\n <div class=\"top\">\r\n <h2>{{ 'payment_form_title' | transloco }}</h2>\r\n <svg class=\"clsbtn my-account\" (click)=\"closeDialog()\" width=\"11\" height=\"11\" viewBox=\"0 0 11 11\" fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\">\r\n <path\r\n 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\"\r\n 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 {{ 'visaCardErrorMessage' | transloco }} <br> {{ 'visaCardErrorMessage2' | transloco }}\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\r\n 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\"\r\n 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\"\r\n transform=\"matrix(-0.707107 0.707107 0.707107 0.707107 4.82861 1.06067)\" stroke=\"#B5B5B5\"\r\n stroke-width=\"1.5\" />\r\n </svg>\r\n <span class=\"label\"> {{ 'visaCardTimeout' | transloco }} </span> <span class=\"display-time\">\r\n {{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}.mobile .header{font-weight:800;font-size:18px;line-height:18px;margin:0 7px;border-bottom:1px solid #96A2B3;padding:20px 0 15px}.mobile .header .dark{color:#fff}.mobile .header .light{color:#2c3644}.mobile .header svg{fill:#2c3644}.mobile .v-flex-center-between{display:flex;justify-content:space-between;align-items:center;padding-left:10px;padding-right:10px}.mobile .vodds-checkout-expiration{display:flex;justify-content:center;align-items:center;font-weight:700;gap:5px;color:#8c8c8c;font-size:12px}.mobile .countdown-timer{color:#000}.mobile .iframe-wrapper{position:relative;overflow:hidden}.mobile .v-dialog .v-content{padding:0!important;max-height:74vh}.mobile .vodds-checkout-deposit{overflow:auto;margin-top:10px}.mobile .v-dialog{background:#f3f2f9;color:#28303a}.mobile .v-spinner{display:flex;justify-content:center;width:100%}.mobile ::ng-deep .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:#dd443c!important}.mobile .visa-card-message{margin:28px 20px;color:#dd453c;font-size:14px}.mobile .v-dialog .v-content{background-color:#f1f1f1}\n"] }]
|
|
632
|
+
}], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
633
|
+
type: Inject,
|
|
634
|
+
args: [MAT_DIALOG_DATA]
|
|
635
|
+
}] }, { type: i2.TranslocoService }], propDecorators: { checkout: [{
|
|
636
|
+
type: Input
|
|
637
|
+
}] } });
|
|
638
|
+
|
|
639
|
+
class Payment {
|
|
640
|
+
constructor(dialog) {
|
|
641
|
+
this.dialog = dialog;
|
|
285
642
|
this.cache = new Map();
|
|
286
643
|
this.timer = new Timer(500); // 0.5s
|
|
287
644
|
this.iframeMessageService = inject(IframeMessageService);
|
|
645
|
+
this.rapydScriptLoaded = false;
|
|
288
646
|
/**
|
|
289
647
|
* Listen OPEN_PAYMENT_FORM message to open 3th party page
|
|
290
648
|
*/
|
|
291
|
-
this.iframeMessageService.
|
|
649
|
+
this.iframeMessageService.onMessages().subscribe(message => {
|
|
292
650
|
console.log('Received from iframe:', message);
|
|
293
651
|
if (IframeMessageType.OPEN_PAYMENT_FORM == message.type) {
|
|
294
652
|
const checkout = Object.assign(new Checkout(), message.payload);
|
|
@@ -321,43 +679,92 @@ class PaymentService {
|
|
|
321
679
|
console.log("Open windown: ", this.cache);
|
|
322
680
|
const width = 470;
|
|
323
681
|
const height = 550;
|
|
324
|
-
|
|
325
|
-
// top = Math.max(0, (screen.height - height) / 2) + (screen.availTop | 0);
|
|
682
|
+
var left = Math.max(0, (screen.width - width) / 2), top = Math.max(0, (screen.height - height) / 2);
|
|
326
683
|
// var popup = window.open(url, "VOdds", 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',status=0,location=0,menubar=0,toolbar=0');
|
|
327
|
-
|
|
684
|
+
let popup = window.open(checkout.url, "VOdds", 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',status=0,location=0,menubar=0,toolbar=0');
|
|
328
685
|
if (!popup) {
|
|
329
686
|
checkout.errorMessage = 'Your setting prevents popups. Please change your setting to allow it.';
|
|
330
687
|
this.sendMessageToIframe(checkout);
|
|
331
688
|
return;
|
|
332
689
|
}
|
|
333
690
|
checkout.popup = popup;
|
|
334
|
-
window.addEventListener("beforeunload", () => {
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
691
|
+
// window.addEventListener("beforeunload", () => {
|
|
692
|
+
// window.opener?.postMessage(
|
|
693
|
+
// { type: "vodds-popup-closing12" },
|
|
694
|
+
// window.location.origin
|
|
695
|
+
// );
|
|
696
|
+
// });
|
|
697
|
+
// popup.postMessage(
|
|
698
|
+
// { type: "vodds-popup-closing" },
|
|
699
|
+
// window.location.origin
|
|
700
|
+
// );
|
|
338
701
|
this.cache.set(checkout.requestId, checkout);
|
|
339
702
|
popup.focus();
|
|
340
|
-
this.
|
|
703
|
+
this.onThirdPartyMessage(checkout);
|
|
704
|
+
this.timer.oberserableTimer(checkout, () => this.sendMessageToIframe(checkout));
|
|
705
|
+
}
|
|
706
|
+
async openVisaCheckout(checkout) {
|
|
707
|
+
try {
|
|
708
|
+
await this.load();
|
|
709
|
+
this.dialog.open(RapydComponent, {
|
|
710
|
+
data: {
|
|
711
|
+
checkoutUrl: checkout.url,
|
|
712
|
+
expiration: checkout.expiration
|
|
713
|
+
},
|
|
714
|
+
width: '500px',
|
|
715
|
+
maxWidth: '90vw'
|
|
716
|
+
}).afterClosed().subscribe(checkoutFailureMessage => {
|
|
717
|
+
checkout.errorMessage = checkoutFailureMessage;
|
|
718
|
+
this.sendMessageToIframe(checkout);
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
catch (error) {
|
|
722
|
+
console.error(error);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
load() {
|
|
726
|
+
if (this.rapydScriptLoaded) {
|
|
727
|
+
return Promise.resolve();
|
|
728
|
+
}
|
|
729
|
+
return new Promise((resolve, reject) => {
|
|
730
|
+
const script = document.createElement('script');
|
|
731
|
+
script.src = 'https://sandboxcheckouttoolkit.rapyd.net';
|
|
732
|
+
script.async = true;
|
|
733
|
+
script.onload = () => {
|
|
734
|
+
this.rapydScriptLoaded = true;
|
|
735
|
+
resolve();
|
|
736
|
+
};
|
|
737
|
+
script.onerror = () => {
|
|
738
|
+
reject(new Error('Failed to load Rapyd Checkout Toolkit'));
|
|
739
|
+
};
|
|
740
|
+
document.head.appendChild(script);
|
|
741
|
+
});
|
|
341
742
|
}
|
|
342
743
|
/**
|
|
343
744
|
* Listen message or action from 3th party on the popup
|
|
745
|
+
* Skip for RAPYD - It will process when the dialog close
|
|
344
746
|
*/
|
|
345
|
-
|
|
346
|
-
this.iframeMessageService.
|
|
747
|
+
onThirdPartyMessage(checkout) {
|
|
748
|
+
this.iframeMessageService.onThirdPartyMessages().subscribe(event => {
|
|
347
749
|
if (this.iframeMessageService.isValidDomain(checkout.paymentType, event.origin)) {
|
|
750
|
+
switch (checkout.paymentType) {
|
|
751
|
+
case PaymentType.NA:
|
|
752
|
+
break;
|
|
753
|
+
case PaymentType.JETON:
|
|
754
|
+
case PaymentType.ECOPAYZ:
|
|
755
|
+
}
|
|
348
756
|
console.log('Received from 3th party:', event.data);
|
|
349
757
|
checkout.setCallback(event.data);
|
|
350
758
|
this.timer.stopWatcher();
|
|
351
759
|
this.sendMessageToIframe(checkout);
|
|
352
760
|
}
|
|
353
761
|
});
|
|
354
|
-
this.timer.oberserableTimer(checkout, () => this.sendMessageToIframe(checkout));
|
|
355
762
|
}
|
|
356
763
|
/**
|
|
357
764
|
* send the message from the parent to the iframe
|
|
358
765
|
*/
|
|
359
766
|
sendMessageToIframe(checkout) {
|
|
360
|
-
console.log("send message to iframe");
|
|
767
|
+
console.log("send message to iframe: ", checkout);
|
|
361
768
|
if (this.iframe == undefined)
|
|
362
769
|
return;
|
|
363
770
|
let message = {
|
|
@@ -365,23 +772,17 @@ class PaymentService {
|
|
|
365
772
|
payload: checkout
|
|
366
773
|
};
|
|
367
774
|
this.iframeMessageService.sendMessageToIframe(this.iframe, message);
|
|
368
|
-
|
|
369
|
-
// removePaymentIframe() {
|
|
370
|
-
// //TODO
|
|
371
|
-
// this.iframe = undefined;
|
|
372
|
-
// }
|
|
373
|
-
async openVisaCheckout(checkout) {
|
|
775
|
+
this.cache.delete(checkout.requestId);
|
|
374
776
|
}
|
|
375
777
|
}
|
|
376
778
|
|
|
377
779
|
/*
|
|
378
780
|
* Public API Surface of epp-lib
|
|
379
781
|
*/
|
|
380
|
-
// Models
|
|
381
782
|
|
|
382
783
|
/**
|
|
383
784
|
* Generated bundle index. Do not edit.
|
|
384
785
|
*/
|
|
385
786
|
|
|
386
|
-
export {
|
|
787
|
+
export { Checkout, CommonUtil, CountDownTime, Domain, EppLibLoader, EppLibTranslationService, EventEmitterService, IParam, IframeMessageService, IframeMessageType, Payment, PaymentType, RapydComponent, Timer, TranslocoPipe, VoddsHttpService, VoddsLoaderComponent, provideEppLibTranslations };
|
|
387
788
|
//# sourceMappingURL=epp-lib.mjs.map
|