@kbapp/market-partner-sdk 0.0.5 → 0.0.6

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/index.es.js CHANGED
@@ -1,6 +1,15 @@
1
+ function R(e) {
2
+ if (Object.prototype.toString.call(e) !== "[object Object]")
3
+ return e;
4
+ const n = {};
5
+ return Object.keys(e).forEach((o) => {
6
+ const r = e[o];
7
+ r != null && (n[o] = Object.prototype.toString.call(r) === "[object Object]" ? R(r) : r);
8
+ }), n;
9
+ }
1
10
  const l = class l {
2
- constructor(r) {
3
- this.errorCode = r.errorCode, this.errorMsg = r.errorMsg;
11
+ constructor(n) {
12
+ this.errorCode = n.errorCode, this.errorMsg = n.errorMsg;
4
13
  }
5
14
  };
6
15
  l.UNKNOWN = new l({
@@ -17,46 +26,46 @@ l.UNKNOWN = new l({
17
26
  errorMsg: "请在开吧app内执行"
18
27
  });
19
28
  let f = l;
20
- const T = () => {
21
- const e = (t, o, n) => {
29
+ const k = () => {
30
+ const e = (t, s, i) => {
22
31
  var a = "";
23
- typeof o == "function" && (n = o, o = {});
24
- var u = { data: o === void 0 ? null : o };
25
- if (typeof n == "function") {
32
+ typeof s == "function" && (i = s, s = {});
33
+ var c = { data: s === void 0 ? null : s };
34
+ if (typeof i == "function") {
26
35
  var v = "dscb" + window.dscb++;
27
- window[v] = n, u._dscbstub = v;
36
+ window[v] = i, c._dscbstub = v;
28
37
  }
29
- if (u = JSON.stringify(u), window.flutter_inappwebview ? window.flutter_inappwebview.callHandler && (a = window.flutter_inappwebview.callHandler("" + t, u)) : (window._dswk || navigator.userAgent.indexOf("_dsbridge") != -1) && (a = prompt("_flutterDsbridge=" + t, u)), a instanceof Promise)
38
+ if (c = JSON.stringify(c), window.flutter_inappwebview ? window.flutter_inappwebview.callHandler && (a = window.flutter_inappwebview.callHandler("" + t, c)) : (window._dswk || navigator.userAgent.indexOf("_dsbridge") != -1) && (a = prompt("_flutterDsbridge=" + t, c)), a instanceof Promise)
30
39
  return a;
31
40
  try {
32
41
  return JSON.parse(a || "{}").data;
33
42
  } catch {
34
43
  console.error("callHandle异常,JSON.parse错误");
35
44
  }
36
- }, r = () => window.navigator.userAgent.includes("Android") ? window.flutter_inappwebview && window.flutter_inappwebview._platformReady : !0, i = (() => {
37
- const t = [], o = setInterval(() => {
38
- r() && (clearInterval(o), t.forEach((n) => {
39
- e.apply(window, n);
45
+ }, n = () => window.navigator.userAgent.includes("Android") ? window.flutter_inappwebview && window.flutter_inappwebview._platformReady : !0, o = (() => {
46
+ const t = [], s = setInterval(() => {
47
+ n() && (clearInterval(s), t.forEach((i) => {
48
+ e.apply(window, i);
40
49
  }), t.length = 0);
41
50
  }, 500);
42
- return (...n) => {
43
- t.push(n);
51
+ return (...i) => {
52
+ t.push(i);
44
53
  };
45
54
  })();
46
- var s = {
55
+ var r = {
47
56
  default: void 0,
48
57
  // for typescript
49
- callHandler: function(t, o, n) {
50
- return r() ? e(t, o, n) : i(t, o, n);
58
+ callHandler: function(t, s, i) {
59
+ return n() ? e(t, s, i) : o(t, s, i);
51
60
  },
52
- register: function(t, o, n) {
53
- var a = n ? window._dsaf : window._dsf;
61
+ register: function(t, s, i) {
62
+ var a = i ? window._dsaf : window._dsf;
54
63
  window._dsInit || (window._dsInit = !0, setTimeout(function() {
55
- s.callHandler("_dsb.dsinit");
56
- }, 0)), typeof o == "object" ? a._obs[t] = o : a[t] = o;
64
+ r.callHandler("_dsb.dsinit");
65
+ }, 0)), typeof s == "object" ? a._obs[t] = s : a[t] = s;
57
66
  },
58
- registerHandler: function(t, o) {
59
- this.register(t, o, !0);
67
+ registerHandler: function(t, s) {
68
+ this.register(t, s, !0);
60
69
  }
61
70
  };
62
71
  return (function() {
@@ -71,119 +80,119 @@ const T = () => {
71
80
  _obs: {}
72
81
  },
73
82
  dscb: 0,
74
- jsBridge: s,
75
- _handleMessageFromNative: function(n) {
76
- var a = JSON.parse(n.data), u = {
77
- id: n.callbackId,
83
+ jsBridge: r,
84
+ _handleMessageFromNative: function(i) {
85
+ var a = JSON.parse(i.data), c = {
86
+ id: i.callbackId,
78
87
  complete: !0
79
- }, v = this._dsf[n.method], _ = this._dsaf[n.method], S = function(m, E) {
80
- u.data = m.apply(E, a), s.callHandler("_dsb.returnValue", u);
81
- }, N = function(m, E) {
82
- a.push(function(b, I) {
83
- u.data = b, u.complete = I !== !1, s.callHandler("_dsb.returnValue", u);
84
- }), m.apply(E, a);
88
+ }, v = this._dsf[i.method], _ = this._dsaf[i.method], S = function(E, m) {
89
+ c.data = E.apply(m, a), r.callHandler("_dsb.returnValue", c);
90
+ }, O = function(E, m) {
91
+ a.push(function(I, T) {
92
+ c.data = I, c.complete = T !== !1, r.callHandler("_dsb.returnValue", c);
93
+ }), E.apply(m, a);
85
94
  };
86
95
  if (v)
87
96
  S(v, this._dsf);
88
97
  else if (_)
89
- N(_, this._dsaf);
98
+ O(_, this._dsaf);
90
99
  else {
91
- var A = n.method.split(".");
100
+ var A = i.method.split(".");
92
101
  if (A.length < 2) return;
93
- var O = A.pop(), R = A.join("."), g = this._dsf._obs, y = g[R] || {}, w = y[O];
102
+ var b = A.pop(), N = A.join("."), g = this._dsf._obs, y = g[N] || {}, w = y[b];
94
103
  if (w && typeof w == "function") {
95
104
  S(w, y);
96
105
  return;
97
106
  }
98
- if (g = this._dsaf._obs, y = g[R] || {}, w = y[O], w && typeof w == "function") {
99
- N(w, y);
107
+ if (g = this._dsaf._obs, y = g[N] || {}, w = y[b], w && typeof w == "function") {
108
+ O(w, y);
100
109
  return;
101
110
  }
102
111
  }
103
112
  }
104
113
  };
105
- for (var o in t)
106
- window[o] = t[o];
114
+ for (var s in t)
115
+ window[s] = t[s];
107
116
  }
108
- })(), s;
109
- }, P = ((e) => /(kb)/i.test(e) ? T() : {
110
- registerHandler(r, i) {
117
+ })(), r;
118
+ }, P = ((e) => /(kb)/i.test(e) ? k() : {
119
+ registerHandler(n, o) {
111
120
  throw f.UNSUPPORTED_BRIDGE_ENV;
112
121
  },
113
- callHandler(r, i, s) {
122
+ callHandler(n, o, r) {
114
123
  throw f.UNSUPPORTED_BRIDGE_ENV;
115
124
  }
116
- })(window?.navigator?.userAgent), k = (e) => new Promise((r, i) => {
125
+ })(window?.navigator?.userAgent), H = (e) => new Promise((n, o) => {
117
126
  try {
118
- P.registerHandler(e.name, e.handler), e.success?.(), r();
119
- } catch (s) {
120
- e.fail?.(s), i(s);
127
+ P.registerHandler(e.name, e.handler), e.success?.(), n();
128
+ } catch (r) {
129
+ e.fail?.(r), o(r);
121
130
  } finally {
122
131
  e.complete?.();
123
132
  }
124
133
  });
125
134
  function d(e) {
126
- const r = (i) => {
127
- let s;
128
- const t = (n) => {
129
- (!s || s === "success") && (s = "success", i.success?.(n));
130
- }, o = (n) => {
131
- (!s || s === "error") && (s = "error", i.fail?.(n));
135
+ const n = (o) => {
136
+ let r;
137
+ const t = (i) => {
138
+ (!r || r === "success") && (r = "success", o.success?.(i));
139
+ }, s = (i) => {
140
+ (!r || r === "error") && (r = "error", o.fail?.(i));
132
141
  };
133
- i.timeout && setTimeout(() => {
134
- o(f.TIMEOUT);
135
- }, i.timeout);
142
+ o.timeout && setTimeout(() => {
143
+ s(f.TIMEOUT);
144
+ }, o.timeout);
136
145
  try {
137
- P.callHandler(i.name, i.params, (n) => {
146
+ P.callHandler(o.name, o.params, (i) => {
138
147
  let a;
139
148
  try {
140
- a = typeof n == "string" ? JSON.parse(n.replace(/\n/g, "\\n").replace(/\r/g, "\\r")) : n;
149
+ a = typeof i == "string" ? JSON.parse(i.replace(/\n/g, "\\n").replace(/\r/g, "\\r")) : i;
141
150
  } catch {
142
151
  a = null;
143
152
  }
144
153
  t(a);
145
154
  });
146
- } catch (n) {
147
- o(n);
155
+ } catch (i) {
156
+ s(i);
148
157
  }
149
158
  };
150
- return new Promise((i, s) => {
151
- r({
159
+ return new Promise((o, r) => {
160
+ n({
152
161
  name: e.name,
153
- params: e.params,
162
+ params: R(e.params),
154
163
  timeout: e.timeout,
155
164
  success: (t) => {
156
- e.success?.(t), e.complete?.(), i(t);
165
+ e.success?.(t), e.complete?.(), o(t);
157
166
  },
158
167
  fail: (t) => {
159
- e.fail?.(t), e.complete?.(), s(t);
168
+ e.fail?.(t), e.complete?.(), r(t);
160
169
  }
161
170
  });
162
171
  });
163
172
  }
164
173
  const q = /(kb_flutter|kb_dsbridge_flutter|kb_ios|kb_android|kb_dsbridge_android)/i.test(window.navigator.userAgent);
165
- function c(e, r) {
166
- return new Promise(async (i, s) => {
174
+ function u(e, n) {
175
+ return new Promise(async (o, r) => {
167
176
  try {
168
- const t = await r();
169
- e.success?.(t), i(t);
177
+ const t = await n();
178
+ e.success?.(t), o(t);
170
179
  } catch (t) {
171
- const o = t?.errorCode ? t : new f({ errorCode: f.UNKNOWN.errorCode, errorMsg: String(t) });
172
- e.fail?.(o), s(o);
180
+ const s = t?.errorCode ? t : new f({ errorCode: f.UNKNOWN.errorCode, errorMsg: String(t) });
181
+ e.fail?.(s), r(s);
173
182
  } finally {
174
183
  e.complete?.();
175
184
  }
176
185
  });
177
186
  }
178
187
  function V(e) {
179
- let r;
180
- return function(...i) {
181
- return r || (r = e(...i), Promise.resolve(r).catch(() => {
182
- r = void 0;
183
- }), r);
188
+ let n;
189
+ return function(...o) {
190
+ return n || (n = e(...o), Promise.resolve(n).catch(() => {
191
+ n = void 0;
192
+ }), n);
184
193
  };
185
194
  }
186
- const H = V(() => d({
195
+ const M = V(() => d({
187
196
  name: "OpenActRequest",
188
197
  params: {
189
198
  // 这个函数只能使用35, 而不能使用新提供的60001, 这是因为写这个sdk的时候, 60001 也没有提供!!!
@@ -191,20 +200,20 @@ const H = V(() => d({
191
200
  data: {}
192
201
  }
193
202
  }));
194
- function M(e) {
195
- return c(e, async () => (await H()).vcode >= e.minVersion);
203
+ function U(e) {
204
+ return u(e, async () => (await M()).vcode >= e.minVersion);
196
205
  }
197
- function p(e, r) {
198
- return (...i) => M({
206
+ function p(e, n) {
207
+ return (...o) => U({
199
208
  minVersion: e.minVersion
200
- }).then((s) => s ? r(...i) : Promise.reject(new f({
209
+ }).then((r) => r ? n(...o) : Promise.reject(new f({
201
210
  errorCode: f.UNSUPPORTED_VERSION.errorCode,
202
211
  errorMsg: `最低版本要求${e.minVersion}`
203
212
  })));
204
213
  }
205
214
  class D {
206
215
  }
207
- const C = V((e) => c(
216
+ const C = V((e) => u(
208
217
  e || {},
209
218
  p({ minVersion: 80805 }, () => d({
210
219
  name: "OpenActRequest",
@@ -214,36 +223,27 @@ const C = V((e) => c(
214
223
  }
215
224
  }))
216
225
  ));
217
- function U(e) {
218
- if (typeof e != "object" || e === null || Array.isArray(e))
219
- return {};
220
- const r = {};
221
- return Object.keys(e).forEach((i) => {
222
- const s = e[i];
223
- s !== void 0 && (r[i] = s);
224
- }), r;
225
- }
226
- function J(e) {
227
- return c(
226
+ function j(e) {
227
+ return u(
228
228
  e,
229
229
  p({ minVersion: 80805 }, async () => d({
230
230
  name: "OpenActRequest",
231
231
  params: {
232
232
  type: 60400,
233
- data: U({
233
+ data: {
234
234
  /** 事件名 */
235
235
  eventId: e.eventName,
236
236
  /** 上报值 */
237
237
  trackParams: e.eventParams,
238
238
  /** 开始结束类型传递 */
239
239
  ExtEventType: e.eventType
240
- })
240
+ }
241
241
  }
242
242
  }))
243
243
  );
244
244
  }
245
- function B(e) {
246
- return c(
245
+ function J(e) {
246
+ return u(
247
247
  { ...e },
248
248
  p({ minVersion: 80805 }, async () => d({
249
249
  name: "OpenActRequest",
@@ -254,7 +254,7 @@ function B(e) {
254
254
  }))
255
255
  );
256
256
  }
257
- const x = (e) => c(
257
+ const B = (e) => u(
258
258
  e,
259
259
  p({ minVersion: 80805 }, async () => d({
260
260
  name: "OpenActRequest",
@@ -264,18 +264,18 @@ const x = (e) => c(
264
264
  }
265
265
  }))
266
266
  ), h = "SHARE_EVENT_NAME";
267
- class G {
267
+ class x {
268
268
  }
269
- function K(e) {
270
- return c(e, async () => k({
269
+ function G(e) {
270
+ return u(e, async () => H({
271
271
  name: "CommonShare",
272
- handler(r, i) {
273
- window.dispatchEvent(new Event(h)), "onShareApp" in e && e.onShareApp ? i({ type: 12, data: e.onShareApp() }) : i({ type: 12, data: e });
272
+ handler(n, o) {
273
+ window.dispatchEvent(new Event(h)), "onShareApp" in e && e.onShareApp ? o({ type: 12, data: e.onShareApp() }) : o({ type: 12, data: e });
274
274
  }
275
275
  }));
276
276
  }
277
- function W(e) {
278
- return c(
277
+ function K(e) {
278
+ return u(
279
279
  e,
280
280
  p({ minVersion: 80805 }, async () => (window.dispatchEvent(new Event(h)), d({
281
281
  name: "OpenActRequest",
@@ -286,15 +286,15 @@ function W(e) {
286
286
  })))
287
287
  );
288
288
  }
289
- function $(e) {
289
+ function W(e) {
290
290
  return window.addEventListener(h, e), () => {
291
291
  window.removeEventListener(h, e);
292
292
  };
293
293
  }
294
- class j {
294
+ class $ {
295
295
  }
296
296
  async function F(e) {
297
- return c(
297
+ return u(
298
298
  e || {},
299
299
  p({ minVersion: 80805 }, async () => (await d({
300
300
  name: "OpenActRequest",
@@ -303,7 +303,7 @@ async function F(e) {
303
303
  );
304
304
  }
305
305
  function L(e) {
306
- return c(
306
+ return u(
307
307
  e || {},
308
308
  p({ minVersion: 80805 }, async () => (await d({
309
309
  name: "OpenActRequest",
@@ -312,41 +312,44 @@ function L(e) {
312
312
  );
313
313
  }
314
314
  async function z(e) {
315
- return c(
315
+ return u(
316
316
  e || {},
317
317
  p({ minVersion: 80805 }, async () => (await d({
318
318
  name: "OpenActRequest",
319
- params: { type: 60201 }
319
+ params: { type: 60201, data: e }
320
320
  })).data)
321
321
  );
322
322
  }
323
323
  function Q(e) {
324
- return c(
324
+ return u(
325
325
  e || {},
326
326
  p({ minVersion: 80805 }, async () => (await d({
327
327
  name: "OpenActRequest",
328
- params: { type: 60210 }
328
+ params: {
329
+ type: 60210,
330
+ data: e
331
+ }
329
332
  })).data)
330
333
  );
331
334
  }
332
335
  export {
333
336
  D as AppBaseInfo,
334
- G as AppShareModel,
335
- j as AuthResult,
337
+ x as AppShareModel,
338
+ $ as AuthResult,
336
339
  f as BridgeCode,
337
340
  q as IS_KB_APP_ENV,
338
- K as defineAppShareModel,
341
+ G as defineAppShareModel,
339
342
  C as getAppBaseInfo,
340
343
  F as getAuthToken,
341
344
  L as getAuthTokenWithSilent,
342
345
  d as invokeNativeApi,
343
- M as isAppVersionSupport,
344
- $ as onAppSharePanelShow,
345
- W as openAppSharePanel,
346
- k as registerNativeApiHandler,
347
- J as reportDAEvent,
346
+ U as isAppVersionSupport,
347
+ W as onAppSharePanelShow,
348
+ K as openAppSharePanel,
349
+ H as registerNativeApiHandler,
350
+ j as reportDAEvent,
348
351
  z as requestPayment,
349
352
  Q as requestRefund,
350
- B as runAction,
351
- x as shareImage
353
+ J as runAction,
354
+ B as shareImage
352
355
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.kbMarket={}))})(this,(function(s){"use strict";const p=class p{constructor(t){this.errorCode=t.errorCode,this.errorMsg=t.errorMsg}};p.UNKNOWN=new p({errorCode:1e3,errorMsg:"未知错误"}),p.UNSUPPORTED_VERSION=new p({errorCode:1001,errorMsg:"当前开吧版本不支持"}),p.TIMEOUT=new p({errorCode:1002,errorMsg:"执行超时"}),p.UNSUPPORTED_BRIDGE_ENV=new p({errorCode:1003,errorMsg:"请在开吧app内执行"});let c=p;const k=()=>{const e=(n,o,r)=>{var u="";typeof o=="function"&&(r=o,o={});var l={data:o===void 0?null:o};if(typeof r=="function"){var v="dscb"+window.dscb++;window[v]=r,l._dscbstub=v}if(l=JSON.stringify(l),window.flutter_inappwebview?window.flutter_inappwebview.callHandler&&(u=window.flutter_inappwebview.callHandler(""+n,l)):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(u=prompt("_flutterDsbridge="+n,l)),u instanceof Promise)return u;try{return JSON.parse(u||"{}").data}catch{console.error("callHandle异常,JSON.parse错误")}},t=()=>window.navigator.userAgent.includes("Android")?window.flutter_inappwebview&&window.flutter_inappwebview._platformReady:!0,i=(()=>{const n=[],o=setInterval(()=>{t()&&(clearInterval(o),n.forEach(r=>{e.apply(window,r)}),n.length=0)},500);return(...r)=>{n.push(r)}})();var a={default:void 0,callHandler:function(n,o,r){return t()?e(n,o,r):i(n,o,r)},register:function(n,o,r){var u=r?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){a.callHandler("_dsb.dsinit")},0)),typeof o=="object"?u._obs[n]=o:u[n]=o},registerHandler:function(n,o){this.register(n,o,!0)}};return(function(){if(!window._dsf){var n={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,jsBridge:a,_handleMessageFromNative:function(r){var u=JSON.parse(r.data),l={id:r.callbackId,complete:!0},v=this._dsf[r.method],_=this._dsaf[r.method],b=function(m,E){l.data=m.apply(E,u),a.callHandler("_dsb.returnValue",l)},V=function(m,E){u.push(function(X,Y){l.data=X,l.complete=Y!==!1,a.callHandler("_dsb.returnValue",l)}),m.apply(E,u)};if(v)b(v,this._dsf);else if(_)V(_,this._dsaf);else{var g=r.method.split(".");if(g.length<2)return;var I=g.pop(),T=g.join("."),S=this._dsf._obs,A=S[T]||{},h=A[I];if(h&&typeof h=="function"){b(h,A);return}if(S=this._dsaf._obs,A=S[T]||{},h=A[I],h&&typeof h=="function"){V(h,A);return}}}};for(var o in n)window[o]=n[o]}})(),a},P=(e=>/(kb)/i.test(e)?k():{registerHandler(t,i){throw c.UNSUPPORTED_BRIDGE_ENV},callHandler(t,i,a){throw c.UNSUPPORTED_BRIDGE_ENV}})(window?.navigator?.userAgent),N=e=>new Promise((t,i)=>{try{P.registerHandler(e.name,e.handler),e.success?.(),t()}catch(a){e.fail?.(a),i(a)}finally{e.complete?.()}});function d(e){const t=i=>{let a;const n=r=>{(!a||a==="success")&&(a="success",i.success?.(r))},o=r=>{(!a||a==="error")&&(a="error",i.fail?.(r))};i.timeout&&setTimeout(()=>{o(c.TIMEOUT)},i.timeout);try{P.callHandler(i.name,i.params,r=>{let u;try{u=typeof r=="string"?JSON.parse(r.replace(/\n/g,"\\n").replace(/\r/g,"\\r")):r}catch{u=null}n(u)})}catch(r){o(r)}};return new Promise((i,a)=>{t({name:e.name,params:e.params,timeout:e.timeout,success:n=>{e.success?.(n),e.complete?.(),i(n)},fail:n=>{e.fail?.(n),e.complete?.(),a(n)}})})}const M=/(kb_flutter|kb_dsbridge_flutter|kb_ios|kb_android|kb_dsbridge_android)/i.test(window.navigator.userAgent);function f(e,t){return new Promise(async(i,a)=>{try{const n=await t();e.success?.(n),i(n)}catch(n){const o=n?.errorCode?n:new c({errorCode:c.UNKNOWN.errorCode,errorMsg:String(n)});e.fail?.(o),a(o)}finally{e.complete?.()}})}function R(e){let t;return function(...i){return t||(t=e(...i),Promise.resolve(t).catch(()=>{t=void 0}),t)}}const H=R(()=>d({name:"OpenActRequest",params:{type:35,data:{}}}));function O(e){return f(e,async()=>(await H()).vcode>=e.minVersion)}function w(e,t){return(...i)=>O({minVersion:e.minVersion}).then(a=>a?t(...i):Promise.reject(new c({errorCode:c.UNSUPPORTED_VERSION.errorCode,errorMsg:`最低版本要求${e.minVersion}`})))}class q{}const U=R(e=>f(e||{},w({minVersion:80805},()=>d({name:"OpenActRequest",params:{type:60001,data:{}}}))));function D(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};const t={};return Object.keys(e).forEach(i=>{const a=e[i];a!==void 0&&(t[i]=a)}),t}function C(e){return f(e,w({minVersion:80805},async()=>d({name:"OpenActRequest",params:{type:60400,data:D({eventId:e.eventName,trackParams:e.eventParams,ExtEventType:e.eventType})}})))}function B(e){return f({...e},w({minVersion:80805},async()=>d({name:"OpenActRequest",params:{type:60300,data:e}})))}const J=e=>f(e,w({minVersion:80805},async()=>d({name:"OpenActRequest",params:{type:60500,data:e}}))),y="SHARE_EVENT_NAME";class j{}function K(e){return f(e,async()=>N({name:"CommonShare",handler(t,i){window.dispatchEvent(new Event(y)),"onShareApp"in e&&e.onShareApp?i({type:12,data:e.onShareApp()}):i({type:12,data:e})}}))}function W(e){return f(e,w({minVersion:80805},async()=>(window.dispatchEvent(new Event(y)),d({name:"OpenActRequest",params:{type:60500,data:e}}))))}function G(e){return window.addEventListener(y,e),()=>{window.removeEventListener(y,e)}}class ${}async function F(e){return f(e||{},w({minVersion:80805},async()=>(await d({name:"OpenActRequest",params:{type:60101}})).data||null))}function L(e){return f(e||{},w({minVersion:80805},async()=>(await d({name:"OpenActRequest",params:{type:60100}})).data||null))}async function z(e){return f(e||{},w({minVersion:80805},async()=>(await d({name:"OpenActRequest",params:{type:60201}})).data))}function Q(e){return f(e||{},w({minVersion:80805},async()=>(await d({name:"OpenActRequest",params:{type:60210}})).data))}s.AppBaseInfo=q,s.AppShareModel=j,s.AuthResult=$,s.BridgeCode=c,s.IS_KB_APP_ENV=M,s.defineAppShareModel=K,s.getAppBaseInfo=U,s.getAuthToken=F,s.getAuthTokenWithSilent=L,s.invokeNativeApi=d,s.isAppVersionSupport=O,s.onAppSharePanelShow=G,s.openAppSharePanel=W,s.registerNativeApiHandler=N,s.reportDAEvent=C,s.requestPayment=z,s.requestRefund=Q,s.runAction=B,s.shareImage=J,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(s,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(s=typeof globalThis<"u"?globalThis:s||self,v(s.kbMarket={}))})(this,(function(s){"use strict";function v(e){if(Object.prototype.toString.call(e)!=="[object Object]")return e;const n={};return Object.keys(e).forEach(o=>{const r=e[o];r!=null&&(n[o]=Object.prototype.toString.call(r)==="[object Object]"?v(r):r)}),n}const p=class p{constructor(n){this.errorCode=n.errorCode,this.errorMsg=n.errorMsg}};p.UNKNOWN=new p({errorCode:1e3,errorMsg:"未知错误"}),p.UNSUPPORTED_VERSION=new p({errorCode:1001,errorMsg:"当前开吧版本不支持"}),p.TIMEOUT=new p({errorCode:1002,errorMsg:"执行超时"}),p.UNSUPPORTED_BRIDGE_ENV=new p({errorCode:1003,errorMsg:"请在开吧app内执行"});let f=p;const M=()=>{const e=(t,a,i)=>{var u="";typeof a=="function"&&(i=a,a={});var c={data:a===void 0?null:a};if(typeof i=="function"){var A="dscb"+window.dscb++;window[A]=i,c._dscbstub=A}if(c=JSON.stringify(c),window.flutter_inappwebview?window.flutter_inappwebview.callHandler&&(u=window.flutter_inappwebview.callHandler(""+t,c)):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(u=prompt("_flutterDsbridge="+t,c)),u instanceof Promise)return u;try{return JSON.parse(u||"{}").data}catch{console.error("callHandle异常,JSON.parse错误")}},n=()=>window.navigator.userAgent.includes("Android")?window.flutter_inappwebview&&window.flutter_inappwebview._platformReady:!0,o=(()=>{const t=[],a=setInterval(()=>{n()&&(clearInterval(a),t.forEach(i=>{e.apply(window,i)}),t.length=0)},500);return(...i)=>{t.push(i)}})();var r={default:void 0,callHandler:function(t,a,i){return n()?e(t,a,i):o(t,a,i)},register:function(t,a,i){var u=i?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){r.callHandler("_dsb.dsinit")},0)),typeof a=="object"?u._obs[t]=a:u[t]=a},registerHandler:function(t,a){this.register(t,a,!0)}};return(function(){if(!window._dsf){var t={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,jsBridge:r,_handleMessageFromNative:function(i){var u=JSON.parse(i.data),c={id:i.callbackId,complete:!0},A=this._dsf[i.method],g=this._dsaf[i.method],V=function(E,b){c.data=E.apply(b,u),r.callHandler("_dsb.returnValue",c)},I=function(E,b){u.push(function(X,Y){c.data=X,c.complete=Y!==!1,r.callHandler("_dsb.returnValue",c)}),E.apply(b,u)};if(A)V(A,this._dsf);else if(g)I(g,this._dsaf);else{var S=i.method.split(".");if(S.length<2)return;var T=S.pop(),k=S.join("."),m=this._dsf._obs,y=m[k]||{},h=y[T];if(h&&typeof h=="function"){V(h,y);return}if(m=this._dsaf._obs,y=m[k]||{},h=y[T],h&&typeof h=="function"){I(h,y);return}}}};for(var a in t)window[a]=t[a]}})(),r},N=(e=>/(kb)/i.test(e)?M():{registerHandler(n,o){throw f.UNSUPPORTED_BRIDGE_ENV},callHandler(n,o,r){throw f.UNSUPPORTED_BRIDGE_ENV}})(window?.navigator?.userAgent),O=e=>new Promise((n,o)=>{try{N.registerHandler(e.name,e.handler),e.success?.(),n()}catch(r){e.fail?.(r),o(r)}finally{e.complete?.()}});function l(e){const n=o=>{let r;const t=i=>{(!r||r==="success")&&(r="success",o.success?.(i))},a=i=>{(!r||r==="error")&&(r="error",o.fail?.(i))};o.timeout&&setTimeout(()=>{a(f.TIMEOUT)},o.timeout);try{N.callHandler(o.name,o.params,i=>{let u;try{u=typeof i=="string"?JSON.parse(i.replace(/\n/g,"\\n").replace(/\r/g,"\\r")):i}catch{u=null}t(u)})}catch(i){a(i)}};return new Promise((o,r)=>{n({name:e.name,params:v(e.params),timeout:e.timeout,success:t=>{e.success?.(t),e.complete?.(),o(t)},fail:t=>{e.fail?.(t),e.complete?.(),r(t)}})})}const H=/(kb_flutter|kb_dsbridge_flutter|kb_ios|kb_android|kb_dsbridge_android)/i.test(window.navigator.userAgent);function d(e,n){return new Promise(async(o,r)=>{try{const t=await n();e.success?.(t),o(t)}catch(t){const a=t?.errorCode?t:new f({errorCode:f.UNKNOWN.errorCode,errorMsg:String(t)});e.fail?.(a),r(a)}finally{e.complete?.()}})}function P(e){let n;return function(...o){return n||(n=e(...o),Promise.resolve(n).catch(()=>{n=void 0}),n)}}const q=P(()=>l({name:"OpenActRequest",params:{type:35,data:{}}}));function R(e){return d(e,async()=>(await q()).vcode>=e.minVersion)}function w(e,n){return(...o)=>R({minVersion:e.minVersion}).then(r=>r?n(...o):Promise.reject(new f({errorCode:f.UNSUPPORTED_VERSION.errorCode,errorMsg:`最低版本要求${e.minVersion}`})))}class U{}const D=P(e=>d(e||{},w({minVersion:80805},()=>l({name:"OpenActRequest",params:{type:60001,data:{}}}))));function C(e){return d(e,w({minVersion:80805},async()=>l({name:"OpenActRequest",params:{type:60400,data:{eventId:e.eventName,trackParams:e.eventParams,ExtEventType:e.eventType}}})))}function j(e){return d({...e},w({minVersion:80805},async()=>l({name:"OpenActRequest",params:{type:60300,data:e}})))}const B=e=>d(e,w({minVersion:80805},async()=>l({name:"OpenActRequest",params:{type:60500,data:e}}))),_="SHARE_EVENT_NAME";class J{}function K(e){return d(e,async()=>O({name:"CommonShare",handler(n,o){window.dispatchEvent(new Event(_)),"onShareApp"in e&&e.onShareApp?o({type:12,data:e.onShareApp()}):o({type:12,data:e})}}))}function W(e){return d(e,w({minVersion:80805},async()=>(window.dispatchEvent(new Event(_)),l({name:"OpenActRequest",params:{type:60500,data:e}}))))}function G(e){return window.addEventListener(_,e),()=>{window.removeEventListener(_,e)}}class ${}async function F(e){return d(e||{},w({minVersion:80805},async()=>(await l({name:"OpenActRequest",params:{type:60101}})).data||null))}function L(e){return d(e||{},w({minVersion:80805},async()=>(await l({name:"OpenActRequest",params:{type:60100}})).data||null))}async function z(e){return d(e||{},w({minVersion:80805},async()=>(await l({name:"OpenActRequest",params:{type:60201,data:e}})).data))}function Q(e){return d(e||{},w({minVersion:80805},async()=>(await l({name:"OpenActRequest",params:{type:60210,data:e}})).data))}s.AppBaseInfo=U,s.AppShareModel=J,s.AuthResult=$,s.BridgeCode=f,s.IS_KB_APP_ENV=H,s.defineAppShareModel=K,s.getAppBaseInfo=D,s.getAuthToken=F,s.getAuthTokenWithSilent=L,s.invokeNativeApi=l,s.isAppVersionSupport=R,s.onAppSharePanelShow=G,s.openAppSharePanel=W,s.registerNativeApiHandler=O,s.reportDAEvent=C,s.requestPayment=z,s.requestRefund=Q,s.runAction=j,s.shareImage=B,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
@@ -1,8 +1,6 @@
1
1
  /**
2
- * 过滤对象第一层中值为 undefined 的属性(不处理嵌套对象)
2
+ * 递归过滤对象中所有层级的 undefined 和 null 属性
3
3
  * @param obj 待过滤的对象(仅支持纯对象,不支持数组/非对象类型)
4
- * @returns 过滤后的新对象(自动剔除值为 undefined 的属性)
4
+ * @returns 过滤后的新对象(自动剔除所有层级的 undefined 和 null 值)
5
5
  */
6
- export declare function filterUndefinedProperties<T extends Record<string, any>>(obj: T): Pick<T, {
7
- [K in keyof T]: T[K] extends undefined ? never : K;
8
- }[keyof T]>;
6
+ export declare function filterUndefinedAndNullProperties<T extends Record<string, any>>(obj: T): T;
@@ -263,7 +263,7 @@
263
263
  ],
264
264
  },
265
265
  done: decorateDone(function () {
266
- return requestPayment({ ...this.form.data })
266
+ return requestPayment({ ...this.form.data, success() {} })
267
267
  }),
268
268
  },
269
269
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbapp/market-partner-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "开吧商城接入jssdk",
5
5
  "publishConfig": {
6
6
  "access": "public"