@everymatrix/pam-account-balance-modal 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/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-f01eba32.js +1227 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/pam-account-balance-modal-81ade12d.js +1704 -0
- package/dist/cjs/pam-account-balance-modal.cjs.js +25 -0
- package/dist/cjs/pam-account-balance-modal_2.cjs.entry.js +175 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/pam-account-balance-modal/index.js +1 -0
- package/dist/collection/components/pam-account-balance-modal/pam-account-balance-modal.css +217 -0
- package/dist/collection/components/pam-account-balance-modal/pam-account-balance-modal.interface.js +1 -0
- package/dist/collection/components/pam-account-balance-modal/pam-account-balance-modal.js +635 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +227 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-ee727666.js +1200 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/pam-account-balance-modal-8ebcc863.js +1702 -0
- package/dist/esm/pam-account-balance-modal.js +20 -0
- package/dist/esm/pam-account-balance-modal_2.entry.js +170 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pam-account-balance-modal/index.esm.js +1 -0
- package/dist/pam-account-balance-modal/p-86b371f2.js +2 -0
- package/dist/pam-account-balance-modal/p-b60c42bd.js +7 -0
- package/dist/pam-account-balance-modal/p-d74c687e.entry.js +1 -0
- package/dist/pam-account-balance-modal/p-e1255160.js +1 -0
- package/dist/pam-account-balance-modal/pam-account-balance-modal.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +18 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/packages/stencil/pam-account-balance-modal/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/packages/stencil/pam-account-balance-modal/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/packages/stencil/pam-account-balance-modal/storybook/main.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/packages/stencil/pam-account-balance-modal/storybook/preview.d.ts +70 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/tools/plugins/index.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-account-balance-modal/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/pam-account-balance-modal/index.d.ts +1 -0
- package/dist/types/components/pam-account-balance-modal/pam-account-balance-modal.d.ts +52 -0
- package/dist/types/components/pam-account-balance-modal/pam-account-balance-modal.interface.d.ts +10 -0
- package/dist/types/components.d.ts +65 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +31 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
@@ -0,0 +1,635 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
3
|
+
import { EventSourcePolyfill } from "event-source-polyfill";
|
4
|
+
import * as currencyFormatter from "currency.js";
|
5
|
+
import { translate } from "../../utils/locale.utils";
|
6
|
+
import "../../../../../ui-skeleton/dist/types/index";
|
7
|
+
export class PamAccountBalanceModal {
|
8
|
+
constructor() {
|
9
|
+
this.totalCalculationModes = ['totalCashAmount', 'totalRealAmount'];
|
10
|
+
this.setLocaleIdentifier = () => {
|
11
|
+
if (this.customLocaleIdentifier.includes(this.language)) {
|
12
|
+
return this.customLocaleIdentifier;
|
13
|
+
}
|
14
|
+
};
|
15
|
+
this.formatBalance = (balance) => {
|
16
|
+
if (this.customLocaleIdentifier) {
|
17
|
+
return new Intl.NumberFormat(this.setLocaleIdentifier(), { useGrouping: true }).format(balance);
|
18
|
+
}
|
19
|
+
if (this.currencySeparator && this.currencyDecimal) {
|
20
|
+
// @ts-ignore
|
21
|
+
return currencyFormatter.default(balance, { separator: this.currencySeparator, decimal: this.currencyDecimal, symbol: '', precision: parseInt(this.currencyPrecision || '2', 10) }).format();
|
22
|
+
}
|
23
|
+
// @ts-ignore
|
24
|
+
return currencyFormatter.default(balance, { separator: '.', decimal: ',', symbol: '', precision: parseInt(this.currencyPrecision || '2', 10) }).format();
|
25
|
+
};
|
26
|
+
this.getBalances = () => {
|
27
|
+
this.isLoading = true;
|
28
|
+
const url = new URL(`/v2/player/${this.userId}/balance/`, this.endpoint);
|
29
|
+
const headers = new Headers();
|
30
|
+
headers.append('X-SessionID', this.session);
|
31
|
+
const params = {
|
32
|
+
method: 'GET',
|
33
|
+
headers: headers
|
34
|
+
};
|
35
|
+
return new Promise((resolve) => {
|
36
|
+
return fetch(url, params)
|
37
|
+
.then(res => res.json())
|
38
|
+
.then(res => resolve(res))
|
39
|
+
.catch((err) => {
|
40
|
+
console.log('Balance fetch error', err);
|
41
|
+
throw new Error('Failed to fetch balance data!');
|
42
|
+
})
|
43
|
+
.finally(() => this.isLoading = false);
|
44
|
+
});
|
45
|
+
};
|
46
|
+
this.subscribeToBalanceUpdates = () => {
|
47
|
+
if (this.currentStream) {
|
48
|
+
this.currentStream.close();
|
49
|
+
}
|
50
|
+
;
|
51
|
+
if (this.session.length < 1) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
const url = new URL(`/v2/player/${this.userId}/information/updates/`, this.endpoint);
|
55
|
+
const headers = {
|
56
|
+
'accept': 'text/event-stream',
|
57
|
+
'X-SessionId': this.session
|
58
|
+
};
|
59
|
+
const stream = new EventSourcePolyfill(url, { headers: headers });
|
60
|
+
this.currentStream = stream;
|
61
|
+
stream.addEventListener("message", this.updateBalances);
|
62
|
+
};
|
63
|
+
this.parseData = (data) => {
|
64
|
+
let parsedData;
|
65
|
+
try {
|
66
|
+
parsedData = JSON.parse(data);
|
67
|
+
}
|
68
|
+
catch (e) {
|
69
|
+
console.log('Balance stream failed: ', e);
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
return parsedData;
|
73
|
+
};
|
74
|
+
this.updateRealAmount = (currentRealAmount, state, balanceItem) => {
|
75
|
+
let updatedRealAmount = null;
|
76
|
+
switch (balanceItem.walletAccountType) {
|
77
|
+
case 'Ordinary':
|
78
|
+
if (balanceItem.afterAmount !== balanceItem.affectedAmount || state.lastOrdinaryAfterAmount === 0) {
|
79
|
+
state.lastOrdinaryAfterAmount = balanceItem.afterAmount;
|
80
|
+
if (!state.showCreditLineAfterAmount) {
|
81
|
+
updatedRealAmount = balanceItem.afterAmount;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
break;
|
85
|
+
case 'CreditLine':
|
86
|
+
if (balanceItem.afterAmount !== 0) {
|
87
|
+
updatedRealAmount = balanceItem.afterAmount;
|
88
|
+
state.showCreditLineAfterAmount = true;
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
updatedRealAmount = state.lastOrdinaryAfterAmount;
|
92
|
+
state.showCreditLineAfterAmount = false;
|
93
|
+
}
|
94
|
+
break;
|
95
|
+
default:
|
96
|
+
updatedRealAmount = balanceItem.afterAmount;
|
97
|
+
}
|
98
|
+
return updatedRealAmount === null ? currentRealAmount : updatedRealAmount;
|
99
|
+
};
|
100
|
+
this.updateTotalAmount = () => {
|
101
|
+
switch (this.totalCalculationMode) {
|
102
|
+
case 'totalCashAmount':
|
103
|
+
let totalCashAmount = 0;
|
104
|
+
for (const balanceType of ['Real', 'Bonus']) {
|
105
|
+
for (const balance of this.balances[balanceType]) {
|
106
|
+
totalCashAmount += Math.max(balance.amount, 0);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
this.balances['Total'][0].amount = totalCashAmount;
|
110
|
+
break;
|
111
|
+
case 'totalRealAmount':
|
112
|
+
if (!this.isSplitWallet) {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
let totalRealAmount = 0;
|
116
|
+
for (const balance of this.balances['Real']) {
|
117
|
+
totalRealAmount += balance.amount;
|
118
|
+
}
|
119
|
+
this.balances['Total'][0].amount = totalRealAmount;
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
};
|
123
|
+
this.updateBalances = (e) => {
|
124
|
+
const parsedData = this.parseData(e.data);
|
125
|
+
if (!parsedData) {
|
126
|
+
this.subscribeToBalanceUpdates();
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
if (parsedData.type !== 'BALANCE_UPDATE_V2') {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
const balanceChange = parsedData.body.balanceChange;
|
133
|
+
for (const [balanceType, balanceItem] of Object.entries(balanceChange)) {
|
134
|
+
// Compute totalRealAmount for single wallet
|
135
|
+
if (this.totalCalculationMode === 'totalRealAmount' && balanceType === 'Real' && !this.isSplitWallet) {
|
136
|
+
this.balances["Total"][0].amount = this.updateRealAmount(this.balances["Total"][0].amount, this.updateRealAmountState, balanceItem);
|
137
|
+
}
|
138
|
+
if (!this.balances[balanceType]) {
|
139
|
+
continue;
|
140
|
+
}
|
141
|
+
// Assign new balance values
|
142
|
+
for (const balance of this.balances[balanceType]) {
|
143
|
+
if (!this.isSplitWallet) {
|
144
|
+
balance.amount = balanceType === 'Real'
|
145
|
+
? this.updateRealAmount(balance.amount, this.updateRealAmountState, balanceItem)
|
146
|
+
: balanceItem.afterAmount;
|
147
|
+
continue;
|
148
|
+
}
|
149
|
+
if (balanceItem.productType === balance.productType) {
|
150
|
+
balance.amount = balanceType === 'Real'
|
151
|
+
? this.updateRealAmount(balance.amount, this.updateRealAmountState[balance.productType], balanceItem)
|
152
|
+
: balanceItem.afterAmount;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
this.updateTotalAmount();
|
157
|
+
this.balances = Object.assign({}, this.balances);
|
158
|
+
};
|
159
|
+
this.balanceModalOpenDeposit = () => {
|
160
|
+
this.toggleModal('close');
|
161
|
+
window.postMessage({ type: 'GoToDeposit' }, window.location.href);
|
162
|
+
// @ts-ignore Analytics event
|
163
|
+
if (typeof gtag == 'function') {
|
164
|
+
// @ts-ignore
|
165
|
+
gtag('event', 'GoToDeposit', {
|
166
|
+
'context': 'PlayerAccountBalanceModal'
|
167
|
+
});
|
168
|
+
}
|
169
|
+
};
|
170
|
+
this.validateTotalCalculationMode = () => {
|
171
|
+
if (!this.totalCalculationModes.includes(this.totalCalculationMode)) {
|
172
|
+
console.error(`Unsupported value ('${this.totalCalculationMode}') for totalcalculationmode parameter. Only the following values are supported ${this.totalCalculationModes}. Using default value ('${this.totalCalculationModes[0]}').`);
|
173
|
+
this.totalCalculationMode = this.totalCalculationModes[0];
|
174
|
+
}
|
175
|
+
};
|
176
|
+
this.messageHandler = (e) => e.data && e.data.type === 'LogoutSuccessfull' && this.currentStream.close();
|
177
|
+
this.updateBalanceStyling = () => {
|
178
|
+
window.postMessage({ type: 'UpdateBalanceBackground' }, window.location.href);
|
179
|
+
};
|
180
|
+
this.toggleModal = (action) => {
|
181
|
+
switch (action) {
|
182
|
+
case 'open':
|
183
|
+
window.postMessage({ type: 'BalanceModalStatus', status: 'open' }, window.location.href);
|
184
|
+
this.isModalDisplayed = true;
|
185
|
+
break;
|
186
|
+
case 'close':
|
187
|
+
window.postMessage({ type: 'BalanceModalStatus', status: 'close' }, window.location.href);
|
188
|
+
this.isModalDisplayed = false;
|
189
|
+
break;
|
190
|
+
}
|
191
|
+
};
|
192
|
+
this.userId = undefined;
|
193
|
+
this.session = undefined;
|
194
|
+
this.endpoint = undefined;
|
195
|
+
this.customLocaleIdentifier = undefined;
|
196
|
+
this.displayBalanceOption = undefined;
|
197
|
+
this.totalCalculationMode = undefined;
|
198
|
+
this.currencySeparator = undefined;
|
199
|
+
this.currencyDecimal = undefined;
|
200
|
+
this.currencyPrecision = undefined;
|
201
|
+
this.mbSource = undefined;
|
202
|
+
this.clientStyling = undefined;
|
203
|
+
this.clientStylingUrl = undefined;
|
204
|
+
this.translationUrl = undefined;
|
205
|
+
this.language = 'en';
|
206
|
+
this.isLoading = true;
|
207
|
+
this.isModalDisplayed = false;
|
208
|
+
this.isSplitWallet = false;
|
209
|
+
this.currentStream = undefined;
|
210
|
+
this.currency = undefined;
|
211
|
+
this.updateRealAmountState = undefined;
|
212
|
+
this.balances = { Total: [], Real: [], Bonus: [], Credit: [] };
|
213
|
+
}
|
214
|
+
handleClientStylingChange(newValue, oldValue) {
|
215
|
+
if (newValue != oldValue) {
|
216
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
220
|
+
if (newValue != oldValue) {
|
221
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
handleMbSourceChange(newValue, oldValue) {
|
225
|
+
if (newValue != oldValue) {
|
226
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
componentWillLoad() {
|
230
|
+
this.validateTotalCalculationMode();
|
231
|
+
this.getBalances()
|
232
|
+
.then(balanceData => this.setBalances(balanceData));
|
233
|
+
this.subscribeToBalanceUpdates();
|
234
|
+
}
|
235
|
+
componentDidLoad() {
|
236
|
+
if (this.stylingContainer) {
|
237
|
+
if (this.mbSource)
|
238
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
239
|
+
if (this.clientStyling)
|
240
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
241
|
+
if (this.clientStylingUrl)
|
242
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
243
|
+
}
|
244
|
+
}
|
245
|
+
disconnectedCallback() {
|
246
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
247
|
+
}
|
248
|
+
setBalances(balanceData) {
|
249
|
+
if (!balanceData[this.totalCalculationMode]) {
|
250
|
+
this.totalCalculationMode = this.totalCalculationModes[0];
|
251
|
+
}
|
252
|
+
this.balances.Total.push({ amount: 0, productType: '' });
|
253
|
+
// we consider the first real ordinary balance to be a source of truth
|
254
|
+
const firstRealOrdinaryBalance = balanceData.items.find(item => item['type'] === 'Real' && item['walletAccountType'] === 'Ordinary');
|
255
|
+
this.currency = firstRealOrdinaryBalance['currency'];
|
256
|
+
this.isSplitWallet = Boolean(firstRealOrdinaryBalance['productType']);
|
257
|
+
if (this.isSplitWallet) {
|
258
|
+
this.setBalancesWhenSplitWallet(balanceData);
|
259
|
+
}
|
260
|
+
else {
|
261
|
+
this.setBalancesWhenSingleWallet(balanceData);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
setBalancesWhenSingleWallet(balanceData) {
|
265
|
+
this.updateRealAmountState = { lastOrdinaryAfterAmount: 0, showCreditLineAfterAmount: false };
|
266
|
+
this.balances['Total'][0].amount = balanceData[this.totalCalculationMode][this.currency];
|
267
|
+
for (const balance of balanceData.items) {
|
268
|
+
switch (balance.type) {
|
269
|
+
case 'Bonus':
|
270
|
+
if (this.balances['Bonus'].length === 0) {
|
271
|
+
this.balances['Bonus'].push({ amount: balance.amount, productType: '' });
|
272
|
+
}
|
273
|
+
else {
|
274
|
+
this.balances['Bonus'][0].amount += balance.amount;
|
275
|
+
}
|
276
|
+
break;
|
277
|
+
case 'Real':
|
278
|
+
if (balance.creditLine && this.balances['Credit'].length === 0) {
|
279
|
+
this.balances['Credit'].push({ amount: balance.creditLine, productType: '' });
|
280
|
+
}
|
281
|
+
/*
|
282
|
+
In the case of "totalRealAmount", Real and Total will always have the same value,
|
283
|
+
therefore we only show the Total balance ( required for Fitzdares )
|
284
|
+
**/
|
285
|
+
if (this.totalCalculationMode === 'totalRealAmount') {
|
286
|
+
continue;
|
287
|
+
}
|
288
|
+
if (this.balances['Real'].length === 0) {
|
289
|
+
this.balances['Real'].push({ amount: balance.amount, productType: '' });
|
290
|
+
}
|
291
|
+
else {
|
292
|
+
this.balances['Real'][0].amount += balance.amount;
|
293
|
+
}
|
294
|
+
break;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
for (const [balanceType, balance] of Object.entries(this.balances)) {
|
298
|
+
if (balance.length < 1) {
|
299
|
+
delete this.balances[balanceType];
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
setBalancesWhenSplitWallet(balanceData) {
|
304
|
+
this.updateRealAmountState = {
|
305
|
+
'Casino': { lastOrdinaryAfterAmount: 0, showCreditLineAfterAmount: false },
|
306
|
+
'Sports': { lastOrdinaryAfterAmount: 0, showCreditLineAfterAmount: false }
|
307
|
+
};
|
308
|
+
let balanceItems = balanceData.items;
|
309
|
+
if (this.displayBalanceOption && this.displayBalanceOption !== 'All') {
|
310
|
+
balanceItems = balanceData.items.filter((elem) => elem.productType === this.displayBalanceOption);
|
311
|
+
}
|
312
|
+
for (const balance of balanceItems) {
|
313
|
+
let idx;
|
314
|
+
switch (balance.type) {
|
315
|
+
case 'Bonus':
|
316
|
+
idx = this.balances['Bonus'].findIndex(b => b.productType === balance.productType);
|
317
|
+
if (idx > 0) {
|
318
|
+
this.balances['Bonus'][idx].amount += balance.amount;
|
319
|
+
}
|
320
|
+
else {
|
321
|
+
this.balances['Bonus'].push({ amount: balance.amount, productType: balance.productType });
|
322
|
+
}
|
323
|
+
break;
|
324
|
+
case 'Real':
|
325
|
+
if (balance.creditLine) {
|
326
|
+
this.balances['Credit'].push({ amount: balance.creditLine, productType: balance.productType });
|
327
|
+
}
|
328
|
+
idx = this.balances['Real'].findIndex(b => b.productType === balance.productType);
|
329
|
+
if (idx > 0) {
|
330
|
+
this.balances['Real'][idx].amount += balance.amount;
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
this.balances['Real'].push({ amount: balance.amount, productType: balance.productType });
|
334
|
+
}
|
335
|
+
break;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
this.updateTotalAmount();
|
339
|
+
for (const [balanceType, balance] of Object.entries(this.balances)) {
|
340
|
+
if (balance.length < 1) {
|
341
|
+
delete this.balances[balanceType];
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
render() {
|
346
|
+
const balanceButton = (h("button", { class: "BalanceValue", onClick: () => this.toggleModal('open') }, h("p", null, this.balances['Total'].length > 0 ? this.formatBalance(this.balances['Total'][0].amount) : '0', " ", this.currency), h("span", { class: " {isModalDisplayed ? 'TriangleActive' : 'TriangleInactive'}" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "6.835", viewBox: "0 0 14 6.835" }, h("path", { id: "arrow", d: "M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z", transform: "translate(-274.511 -441.088)", fill: "#d1d1d1" })))));
|
347
|
+
const balanceModal = (h("div", { class: this.isModalDisplayed ? 'BalanceModalWrapper Open' : 'BalanceModalWrapper' }, h("button", { class: "BalanceModalClose", onClick: () => this.toggleModal('close') }), h("div", { class: "BalanceModal" }, h("div", { class: "ModalContent" }, h("div", { class: "BalanceModalHeader" }, h("p", { class: "BalanceModalTitle" }, translate('Title', this.language))), h("div", { class: "BalanceModalBody" }, Object.keys(this.balances).map((key) => {
|
348
|
+
return (h("div", { class: "BalanceModalRowBoth" }, this.balances[key].map((balance) => {
|
349
|
+
return (h("div", { class: "BalanceModalRowLine" }, h("p", { class: "BalanceModalText" }, translate(key, this.language), " ", balance.productType ? translate(balance.productType, this.language) : ''), h("p", { class: "BalanceModalValue" }, h("span", { class: "BalanceModalAmount" }, balance.amount ? this.formatBalance(balance.amount) : '0'), h("span", { class: "BalanceModalCurrency" }, " " + this.currency))));
|
350
|
+
})));
|
351
|
+
})), h("div", { class: "BalanceModalFooter" }, h("button", { class: "BalanceModalAction", onClick: () => this.balanceModalOpenDeposit() }, translate('DepositButton', this.language)))))));
|
352
|
+
const skeleton = (h("div", { class: "LoadingSkeleton" }, h("ui-skeleton", { structure: "title", height: "20px", width: "auto" })));
|
353
|
+
return (h("div", { ref: (el) => (this.stylingContainer = el) }, h("div", { class: "PamAccountBalanceModal" }, this.isLoading
|
354
|
+
? skeleton
|
355
|
+
: h("div", null, balanceButton, balanceModal)), this.isModalDisplayed && (h("button", { class: "PamAccountBalanceModalOverlay", onClick: () => this.toggleModal('close') }))));
|
356
|
+
}
|
357
|
+
static get is() { return "pam-account-balance-modal"; }
|
358
|
+
static get encapsulation() { return "shadow"; }
|
359
|
+
static get originalStyleUrls() {
|
360
|
+
return {
|
361
|
+
"$": ["pam-account-balance-modal.scss"]
|
362
|
+
};
|
363
|
+
}
|
364
|
+
static get styleUrls() {
|
365
|
+
return {
|
366
|
+
"$": ["pam-account-balance-modal.css"]
|
367
|
+
};
|
368
|
+
}
|
369
|
+
static get properties() {
|
370
|
+
return {
|
371
|
+
"userId": {
|
372
|
+
"type": "string",
|
373
|
+
"mutable": false,
|
374
|
+
"complexType": {
|
375
|
+
"original": "string",
|
376
|
+
"resolved": "string",
|
377
|
+
"references": {}
|
378
|
+
},
|
379
|
+
"required": false,
|
380
|
+
"optional": false,
|
381
|
+
"docs": {
|
382
|
+
"tags": [],
|
383
|
+
"text": ""
|
384
|
+
},
|
385
|
+
"attribute": "user-id",
|
386
|
+
"reflect": true
|
387
|
+
},
|
388
|
+
"session": {
|
389
|
+
"type": "string",
|
390
|
+
"mutable": false,
|
391
|
+
"complexType": {
|
392
|
+
"original": "string",
|
393
|
+
"resolved": "string",
|
394
|
+
"references": {}
|
395
|
+
},
|
396
|
+
"required": false,
|
397
|
+
"optional": false,
|
398
|
+
"docs": {
|
399
|
+
"tags": [],
|
400
|
+
"text": ""
|
401
|
+
},
|
402
|
+
"attribute": "session",
|
403
|
+
"reflect": true
|
404
|
+
},
|
405
|
+
"endpoint": {
|
406
|
+
"type": "string",
|
407
|
+
"mutable": false,
|
408
|
+
"complexType": {
|
409
|
+
"original": "string",
|
410
|
+
"resolved": "string",
|
411
|
+
"references": {}
|
412
|
+
},
|
413
|
+
"required": false,
|
414
|
+
"optional": false,
|
415
|
+
"docs": {
|
416
|
+
"tags": [],
|
417
|
+
"text": ""
|
418
|
+
},
|
419
|
+
"attribute": "endpoint",
|
420
|
+
"reflect": true
|
421
|
+
},
|
422
|
+
"customLocaleIdentifier": {
|
423
|
+
"type": "string",
|
424
|
+
"mutable": false,
|
425
|
+
"complexType": {
|
426
|
+
"original": "string",
|
427
|
+
"resolved": "string",
|
428
|
+
"references": {}
|
429
|
+
},
|
430
|
+
"required": false,
|
431
|
+
"optional": false,
|
432
|
+
"docs": {
|
433
|
+
"tags": [],
|
434
|
+
"text": ""
|
435
|
+
},
|
436
|
+
"attribute": "custom-locale-identifier",
|
437
|
+
"reflect": true
|
438
|
+
},
|
439
|
+
"displayBalanceOption": {
|
440
|
+
"type": "string",
|
441
|
+
"mutable": false,
|
442
|
+
"complexType": {
|
443
|
+
"original": "string",
|
444
|
+
"resolved": "string",
|
445
|
+
"references": {}
|
446
|
+
},
|
447
|
+
"required": false,
|
448
|
+
"optional": false,
|
449
|
+
"docs": {
|
450
|
+
"tags": [],
|
451
|
+
"text": ""
|
452
|
+
},
|
453
|
+
"attribute": "display-balance-option",
|
454
|
+
"reflect": true
|
455
|
+
},
|
456
|
+
"totalCalculationMode": {
|
457
|
+
"type": "string",
|
458
|
+
"mutable": false,
|
459
|
+
"complexType": {
|
460
|
+
"original": "string",
|
461
|
+
"resolved": "string",
|
462
|
+
"references": {}
|
463
|
+
},
|
464
|
+
"required": false,
|
465
|
+
"optional": false,
|
466
|
+
"docs": {
|
467
|
+
"tags": [],
|
468
|
+
"text": ""
|
469
|
+
},
|
470
|
+
"attribute": "total-calculation-mode",
|
471
|
+
"reflect": true
|
472
|
+
},
|
473
|
+
"currencySeparator": {
|
474
|
+
"type": "string",
|
475
|
+
"mutable": false,
|
476
|
+
"complexType": {
|
477
|
+
"original": "string",
|
478
|
+
"resolved": "string",
|
479
|
+
"references": {}
|
480
|
+
},
|
481
|
+
"required": false,
|
482
|
+
"optional": false,
|
483
|
+
"docs": {
|
484
|
+
"tags": [],
|
485
|
+
"text": ""
|
486
|
+
},
|
487
|
+
"attribute": "currency-separator",
|
488
|
+
"reflect": true
|
489
|
+
},
|
490
|
+
"currencyDecimal": {
|
491
|
+
"type": "string",
|
492
|
+
"mutable": false,
|
493
|
+
"complexType": {
|
494
|
+
"original": "string",
|
495
|
+
"resolved": "string",
|
496
|
+
"references": {}
|
497
|
+
},
|
498
|
+
"required": false,
|
499
|
+
"optional": false,
|
500
|
+
"docs": {
|
501
|
+
"tags": [],
|
502
|
+
"text": ""
|
503
|
+
},
|
504
|
+
"attribute": "currency-decimal",
|
505
|
+
"reflect": true
|
506
|
+
},
|
507
|
+
"currencyPrecision": {
|
508
|
+
"type": "string",
|
509
|
+
"mutable": false,
|
510
|
+
"complexType": {
|
511
|
+
"original": "string",
|
512
|
+
"resolved": "string",
|
513
|
+
"references": {}
|
514
|
+
},
|
515
|
+
"required": false,
|
516
|
+
"optional": false,
|
517
|
+
"docs": {
|
518
|
+
"tags": [],
|
519
|
+
"text": ""
|
520
|
+
},
|
521
|
+
"attribute": "currency-precision",
|
522
|
+
"reflect": true
|
523
|
+
},
|
524
|
+
"mbSource": {
|
525
|
+
"type": "string",
|
526
|
+
"mutable": false,
|
527
|
+
"complexType": {
|
528
|
+
"original": "string",
|
529
|
+
"resolved": "string",
|
530
|
+
"references": {}
|
531
|
+
},
|
532
|
+
"required": false,
|
533
|
+
"optional": false,
|
534
|
+
"docs": {
|
535
|
+
"tags": [],
|
536
|
+
"text": ""
|
537
|
+
},
|
538
|
+
"attribute": "mb-source",
|
539
|
+
"reflect": true
|
540
|
+
},
|
541
|
+
"clientStyling": {
|
542
|
+
"type": "string",
|
543
|
+
"mutable": false,
|
544
|
+
"complexType": {
|
545
|
+
"original": "string",
|
546
|
+
"resolved": "string",
|
547
|
+
"references": {}
|
548
|
+
},
|
549
|
+
"required": false,
|
550
|
+
"optional": false,
|
551
|
+
"docs": {
|
552
|
+
"tags": [],
|
553
|
+
"text": ""
|
554
|
+
},
|
555
|
+
"attribute": "client-styling",
|
556
|
+
"reflect": true
|
557
|
+
},
|
558
|
+
"clientStylingUrl": {
|
559
|
+
"type": "string",
|
560
|
+
"mutable": false,
|
561
|
+
"complexType": {
|
562
|
+
"original": "string",
|
563
|
+
"resolved": "string",
|
564
|
+
"references": {}
|
565
|
+
},
|
566
|
+
"required": false,
|
567
|
+
"optional": false,
|
568
|
+
"docs": {
|
569
|
+
"tags": [],
|
570
|
+
"text": ""
|
571
|
+
},
|
572
|
+
"attribute": "client-styling-url",
|
573
|
+
"reflect": true
|
574
|
+
},
|
575
|
+
"translationUrl": {
|
576
|
+
"type": "string",
|
577
|
+
"mutable": false,
|
578
|
+
"complexType": {
|
579
|
+
"original": "string",
|
580
|
+
"resolved": "string",
|
581
|
+
"references": {}
|
582
|
+
},
|
583
|
+
"required": false,
|
584
|
+
"optional": false,
|
585
|
+
"docs": {
|
586
|
+
"tags": [],
|
587
|
+
"text": ""
|
588
|
+
},
|
589
|
+
"attribute": "translation-url",
|
590
|
+
"reflect": true
|
591
|
+
},
|
592
|
+
"language": {
|
593
|
+
"type": "string",
|
594
|
+
"mutable": false,
|
595
|
+
"complexType": {
|
596
|
+
"original": "string",
|
597
|
+
"resolved": "string",
|
598
|
+
"references": {}
|
599
|
+
},
|
600
|
+
"required": false,
|
601
|
+
"optional": false,
|
602
|
+
"docs": {
|
603
|
+
"tags": [],
|
604
|
+
"text": ""
|
605
|
+
},
|
606
|
+
"attribute": "language",
|
607
|
+
"reflect": true,
|
608
|
+
"defaultValue": "'en'"
|
609
|
+
}
|
610
|
+
};
|
611
|
+
}
|
612
|
+
static get states() {
|
613
|
+
return {
|
614
|
+
"isLoading": {},
|
615
|
+
"isModalDisplayed": {},
|
616
|
+
"isSplitWallet": {},
|
617
|
+
"currentStream": {},
|
618
|
+
"currency": {},
|
619
|
+
"updateRealAmountState": {},
|
620
|
+
"balances": {}
|
621
|
+
};
|
622
|
+
}
|
623
|
+
static get watchers() {
|
624
|
+
return [{
|
625
|
+
"propName": "clientStyling",
|
626
|
+
"methodName": "handleClientStylingChange"
|
627
|
+
}, {
|
628
|
+
"propName": "clientStylingUrl",
|
629
|
+
"methodName": "handleClientStylingUrlChange"
|
630
|
+
}, {
|
631
|
+
"propName": "mbSource",
|
632
|
+
"methodName": "handleMbSourceChange"
|
633
|
+
}];
|
634
|
+
}
|
635
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/pam-account-balance-modal';
|