@everymatrix/user-deposit-withdrawal 1.13.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/index-3568d1cc.js +1111 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +21 -0
  4. package/dist/cjs/user-deposit-withdrawal.cjs.entry.js +107 -0
  5. package/dist/cjs/user-deposit-withdrawal.cjs.js +19 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/user-deposit-withdrawal/user-deposit-withdrawal.css +5 -0
  8. package/dist/collection/components/user-deposit-withdrawal/user-deposit-withdrawal.js +368 -0
  9. package/dist/collection/index.js +1 -0
  10. package/dist/collection/utils/utils.js +3 -0
  11. package/dist/components/index.d.ts +26 -0
  12. package/dist/components/index.js +1 -0
  13. package/dist/components/user-deposit-withdrawal.d.ts +11 -0
  14. package/dist/components/user-deposit-withdrawal.js +137 -0
  15. package/dist/esm/index-363130bb.js +1085 -0
  16. package/dist/esm/index.js +1 -0
  17. package/dist/esm/loader.js +17 -0
  18. package/dist/esm/polyfills/core-js.js +11 -0
  19. package/dist/esm/polyfills/css-shim.js +1 -0
  20. package/dist/esm/polyfills/dom.js +79 -0
  21. package/dist/esm/polyfills/es5-html-element.js +1 -0
  22. package/dist/esm/polyfills/index.js +34 -0
  23. package/dist/esm/polyfills/system.js +6 -0
  24. package/dist/esm/user-deposit-withdrawal.entry.js +103 -0
  25. package/dist/esm/user-deposit-withdrawal.js +17 -0
  26. package/dist/index.cjs.js +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/stencil.config.js +22 -0
  29. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/user-deposit-withdrawal/.stencil/packages/user-deposit-withdrawal/stencil.config.d.ts +2 -0
  30. package/dist/types/components/user-deposit-withdrawal/user-deposit-withdrawal.d.ts +50 -0
  31. package/dist/types/components.d.ts +68 -0
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  34. package/dist/types/utils/utils.d.ts +1 -0
  35. package/dist/user-deposit-withdrawal/index.esm.js +0 -0
  36. package/dist/user-deposit-withdrawal/p-05851c56.entry.js +1 -0
  37. package/dist/user-deposit-withdrawal/p-ed11cb75.js +1 -0
  38. package/dist/user-deposit-withdrawal/user-deposit-withdrawal.esm.js +1 -0
  39. package/loader/cdn.js +3 -0
  40. package/loader/index.cjs.js +3 -0
  41. package/loader/index.d.ts +12 -0
  42. package/loader/index.es2017.js +3 -0
  43. package/loader/index.js +4 -0
  44. package/loader/package.json +10 -0
  45. package/package.json +19 -0
@@ -0,0 +1,137 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const userDepositWithdrawalCss = ":host{display:block;height:100%;overflow:hidden}";
4
+
5
+ const emptyFunction = () => { };
6
+ const UserDepositWithdrawal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.beforeRedirect = emptyFunction;
12
+ this.bindedHandler = this.handleMessage.bind(this);
13
+ }
14
+ get typeParameter() {
15
+ if (this.type === 'deposit') {
16
+ return 'Deposit';
17
+ }
18
+ if (this.type === 'withdraw') {
19
+ return 'Withdraw';
20
+ }
21
+ }
22
+ watchLoadWidget() {
23
+ this.loadWidget();
24
+ }
25
+ async componentWillLoad() {
26
+ await this.loadWidget();
27
+ }
28
+ componentDidLoad() {
29
+ window.addEventListener('message', this.bindedHandler, false);
30
+ }
31
+ disconnectedCallback() {
32
+ window.removeEventListener('message', this.bindedHandler, false);
33
+ }
34
+ render() {
35
+ return (h(Host, null, h("iframe", { width: "100%", height: "100%", src: this.cashierInfoUrl })));
36
+ }
37
+ async loadWidget() {
38
+ const requestObject = {
39
+ Channel: this.channel,
40
+ Type: this.typeParameter,
41
+ SuccessUrl: this.successUrl,
42
+ CancelUrl: this.cancelUrl,
43
+ FailUrl: this.failUrl,
44
+ Language: this.language,
45
+ productType: this.productType,
46
+ };
47
+ try {
48
+ const url = `${this.endpoint}v1/player/${this.userId}/payment/GetPaymentSession`;
49
+ const response = await fetch(url, {
50
+ method: 'POST',
51
+ headers: {
52
+ 'X-Sessionid': this.session,
53
+ 'Content-Type': 'application/json',
54
+ },
55
+ body: JSON.stringify(requestObject)
56
+ });
57
+ if (!response.ok) {
58
+ const err = await response.text();
59
+ throw new Error(err);
60
+ }
61
+ const data = await response.json();
62
+ this.cashierInfoUrl = data.CashierInfo.Url;
63
+ }
64
+ catch (ex) {
65
+ console.error(ex);
66
+ }
67
+ }
68
+ handleMessage(message) {
69
+ var _a, _b, _c, _d, _e, _f;
70
+ if (((_a = message.data) === null || _a === void 0 ? void 0 : _a.type) === 'mm-hcback-to-merchant') {
71
+ this.doRedirect(message.data.type, this.homeUrl);
72
+ }
73
+ if (((_b = message.data) === null || _b === void 0 ? void 0 : _b.redirect) === 'mm-hc-back-tomerchant') {
74
+ this.doRedirect(message.data.redirect, this.homeUrl);
75
+ }
76
+ if (((_c = message.data) === null || _c === void 0 ? void 0 : _c.redirect) === 'mm-hc-sports') {
77
+ this.doRedirect((_d = message.data) === null || _d === void 0 ? void 0 : _d.redirect, this.sportsUrl);
78
+ }
79
+ if (((_e = message.data) === null || _e === void 0 ? void 0 : _e.redirect) === 'mm-hc-casino') {
80
+ this.doRedirect(window.location.href, this.casinoUrl);
81
+ }
82
+ if (((_f = message.data) === null || _f === void 0 ? void 0 : _f.redirect) === 'mm-hc-contact') {
83
+ this.doRedirect(window.location.href, this.contactUrl);
84
+ }
85
+ }
86
+ doRedirect(reason, url) {
87
+ const redirectArgs = { reason, url, cancel: false };
88
+ this.beforeRedirect(redirectArgs);
89
+ if (redirectArgs.cancel) {
90
+ return;
91
+ }
92
+ if (!redirectArgs.url) {
93
+ window.location.href = '/';
94
+ return;
95
+ }
96
+ window.location.href = redirectArgs.url;
97
+ }
98
+ static get watchers() { return {
99
+ "session": ["watchLoadWidget"],
100
+ "userId": ["watchLoadWidget"]
101
+ }; }
102
+ static get style() { return userDepositWithdrawalCss; }
103
+ }, [1, "user-deposit-withdrawal", {
104
+ "endpoint": [513],
105
+ "type": [513],
106
+ "channel": [513],
107
+ "language": [513],
108
+ "productType": [513, "product-type"],
109
+ "userId": [513, "user-id"],
110
+ "session": [513],
111
+ "successUrl": [513, "success-url"],
112
+ "cancelUrl": [513, "cancel-url"],
113
+ "failUrl": [513, "fail-url"],
114
+ "sportsUrl": [513, "sports-url"],
115
+ "casinoUrl": [513, "casino-url"],
116
+ "contactUrl": [513, "contact-url"],
117
+ "homeUrl": [513, "home-url"],
118
+ "beforeRedirect": [16]
119
+ }]);
120
+ function defineCustomElement$1() {
121
+ if (typeof customElements === "undefined") {
122
+ return;
123
+ }
124
+ const components = ["user-deposit-withdrawal"];
125
+ components.forEach(tagName => { switch (tagName) {
126
+ case "user-deposit-withdrawal":
127
+ if (!customElements.get(tagName)) {
128
+ customElements.define(tagName, UserDepositWithdrawal$1);
129
+ }
130
+ break;
131
+ } });
132
+ }
133
+
134
+ const UserDepositWithdrawal = UserDepositWithdrawal$1;
135
+ const defineCustomElement = defineCustomElement$1;
136
+
137
+ export { UserDepositWithdrawal, defineCustomElement };