@dcloudio/uni-cli-shared 2.0.1-alpha-36020220901001 → 2.0.1-alpha-36120220907002

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.
@@ -27,6 +27,12 @@ export default {
27
27
  loadnext: {
28
28
  type: [Boolean, String],
29
29
  default: false
30
+ },
31
+ urlCallback: {
32
+ type: Object,
33
+ default () {
34
+ return {}
35
+ }
30
36
  }
31
37
  },
32
38
  data () {
@@ -58,7 +64,31 @@ export default {
58
64
  show () {
59
65
  this.errorMessage = null
60
66
  this._ad = this.selectComponent('.uniad-plugin')
61
- this._ad.show()
67
+ if (this._hasCallback()) {
68
+ const userCryptoManager = wx.getUserCryptoManager()
69
+ userCryptoManager.getLatestUserKey({
70
+ success: ({
71
+ encryptKey,
72
+ iv,
73
+ version,
74
+ expireTime
75
+ }) => {
76
+ this._ad.show({
77
+ userId: this.urlCallback.userId || '',
78
+ extra: this.urlCallback.extra || '',
79
+ encryptKey,
80
+ iv,
81
+ version,
82
+ expireTime
83
+ })
84
+ },
85
+ fail: (err) => {
86
+ this._dispatchEvent(EventType.Error, err)
87
+ }
88
+ })
89
+ } else {
90
+ this._ad.show()
91
+ }
62
92
  },
63
93
 
64
94
  _onclick () {
@@ -80,6 +110,11 @@ export default {
80
110
  return result
81
111
  },
82
112
 
113
+ _hasCallback () {
114
+ return false
115
+ // return (typeof this.urlCallback === 'object' && Object.keys(this.urlCallback).length > 0)
116
+ },
117
+
83
118
  _onmpload (e) {
84
119
  this.loading = false
85
120
  this._dispatchEvent(EventType.Load, {})
@@ -87,6 +122,31 @@ export default {
87
122
 
88
123
  _onmpclose (e) {
89
124
  this._dispatchEvent(EventType.Close, e.detail)
125
+ if (e.detail.adsdata) {
126
+ const adv = e.detail.adv
127
+ const adsdata = e.detail.adsdata
128
+ const version = e.detail.version
129
+
130
+ /* eslint-disable no-undef */
131
+ uniCloud.callFunction({
132
+ name: 'uniAdCallback',
133
+ data: {
134
+ adv: adv,
135
+ adsdata: adsdata,
136
+ version: version
137
+ },
138
+ secretType: 'both',
139
+ success: (res) => {
140
+ },
141
+ fail: (err) => {
142
+ this._dispatchEvent(EventType.Error, err)
143
+ }
144
+ })
145
+
146
+ delete e.detail.adv
147
+ delete e.detail.adsdata
148
+ delete e.detail.version
149
+ }
90
150
  },
91
151
 
92
152
  _onmperror (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.1-alpha-36020220901001",
3
+ "version": "2.0.1-alpha-36120220907002",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -25,5 +25,5 @@
25
25
  "postcss-urlrewrite": "^0.2.2",
26
26
  "strip-json-comments": "^2.0.1"
27
27
  },
28
- "gitHead": "734c563240436d5f63a8200d676ccc8bead9f10d"
28
+ "gitHead": "11b3ae743d9e35e4a5f7a12be93711fe1c415f74"
29
29
  }