adata-ui 2.1.32 → 2.1.33

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.
@@ -54,6 +54,8 @@ function onBack(type: 'method' | 'kaspi') {
54
54
  const userInfo = useState('user-info', () => ({}))
55
55
 
56
56
  function pushReplenishmentEventToDataLayer() {
57
+ window.dataLayer = window.dataLayer || []
58
+
57
59
  window.dataLayer?.push({
58
60
  event: 'replenishment',
59
61
  user_id: `${userInfo.value.id}`,
@@ -89,8 +91,13 @@ async function directionsBanks(bank: 'kaspi' | 'other', sum: number) {
89
91
  }
90
92
  }
91
93
  else if (bank === 'other') {
92
- await payByCard(sum)
93
- pushReplenishmentEventToDataLayer()
94
+ try {
95
+ await payByCard(sum)
96
+ pushReplenishmentEventToDataLayer()
97
+ }
98
+ catch (error) {
99
+ console.error(error)
100
+ }
94
101
  }
95
102
  }
96
103
 
@@ -32,30 +32,34 @@ export function usePayment() {
32
32
  const { amount, id, user_id } = data
33
33
  const widget = new tiptop.Widget()
34
34
 
35
- widget.pay(
36
- 'charge',
37
- {
38
- publicId,
39
- description: t('payment.bank.description'),
40
- amount: Number.parseInt(amount),
41
- currency: 'KZT',
42
- invoiceId: id.toString(),
43
- accountId: user_id.toString(),
44
- skin: 'modern',
45
- data: {
46
- myProp: 'myProp value',
47
- rate,
35
+ await new Promise((resolve, reject) => {
36
+ widget.pay(
37
+ 'charge',
38
+ {
39
+ publicId,
40
+ description: t('payment.bank.description'),
41
+ amount: Number.parseInt(amount),
42
+ currency: 'KZT',
43
+ invoiceId: id.toString(),
44
+ accountId: user_id.toString(),
45
+ skin: 'modern',
46
+ data: {
47
+ myProp: 'myProp value',
48
+ rate,
49
+ },
48
50
  },
49
- },
50
- {
51
- onSuccess() {
52
- $toast.success(t('payment.bank.paySuccess'))
51
+ {
52
+ onSuccess() {
53
+ $toast.success(t('payment.bank.paySuccess'))
54
+ resolve()
55
+ },
56
+ onFail() {
57
+ $toast.error(t('payment.bank.payError'))
58
+ reject(new Error(t('payment.bank.payError')))
59
+ },
53
60
  },
54
- onFail() {
55
- $toast.error(t('payment.bank.payError'))
56
- },
57
- },
58
- )
61
+ )
62
+ })
59
63
  }
60
64
  }
61
65
  catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adata-ui",
3
3
  "type": "module",
4
- "version": "2.1.32",
4
+ "version": "2.1.33",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",