@polyv/product-sdk 1.0.0-rc-20250612.4 → 1.1.0-rc-20250703.1
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/index.cjs.js +9 -1
- package/index.es.d.ts +85 -13
- package/index.es.js +2230 -727
- package/index.umd.js +9 -1
- package/package.json +2 -1
package/index.es.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
var PolyvApiUrl = /* @__PURE__ */ ((PolyvApiUrl2) => {
|
|
1
|
+
var PolyvApiUrl = /* @__PURE__ */ function(PolyvApiUrl2) {
|
|
5
2
|
PolyvApiUrl2["GetProductTagList"] = "/live/v4/watch/channel/product/tag/list";
|
|
6
3
|
PolyvApiUrl2["GetProductListByShowId"] = "/live/v3/sdk/watch/interactive/product/list-by-showId";
|
|
7
4
|
PolyvApiUrl2["GetProductListByTag"] = "/live/v4/watch/channel/product/list";
|
|
@@ -19,101 +16,704 @@ var PolyvApiUrl = /* @__PURE__ */ ((PolyvApiUrl2) => {
|
|
|
19
16
|
PolyvApiUrl2["UpdateAddress"] = "/live/v4/watch/channel/viewer/address/update";
|
|
20
17
|
PolyvApiUrl2["DeleteAddress"] = "/live/v4/watch/channel/viewer/address/delete";
|
|
21
18
|
return PolyvApiUrl2;
|
|
22
|
-
}
|
|
19
|
+
}({});
|
|
23
20
|
function boolToYN(o) {
|
|
24
21
|
if ("boolean" != typeof o) throw new Error("The value argument must be a boolean type");
|
|
25
22
|
return o ? "Y" : "N";
|
|
26
23
|
}
|
|
27
24
|
function ynToBool(o, n) {
|
|
28
|
-
|
|
25
|
+
var e = String(o).toUpperCase();
|
|
29
26
|
if ("Y" !== e && "N" !== e) {
|
|
30
27
|
if (null == n) throw new Error('The value argument must be "Y" or "N"');
|
|
31
28
|
e = String(n).toUpperCase();
|
|
32
29
|
}
|
|
33
30
|
return "Y" === e;
|
|
34
31
|
}
|
|
35
|
-
|
|
32
|
+
function canMatchKeywords(e, t) {
|
|
33
|
+
e = e.toLowerCase();
|
|
34
|
+
var n = /[/\s;_-]/, s = /[/\s;_-]/;
|
|
35
|
+
return t.some(function(t2) {
|
|
36
|
+
var o = e.indexOf(t2.toLowerCase());
|
|
37
|
+
if (-1 !== o && (n.test(e[o - 1]) || 0 === o) && (s.test(e[o + t2.length]) || o + t2.length >= e.length)) return true;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function canMatchModelRule(e, t) {
|
|
41
|
+
return !!/;\s*([^;)]*?)(?:\s+Build\/[^;)]+)?(?:;(?:\s*wv)?)?\)/.test(e) && t.test(RegExp.$1);
|
|
42
|
+
}
|
|
43
|
+
function execRules(e, t) {
|
|
44
|
+
var n;
|
|
45
|
+
return t.some(function(t2) {
|
|
46
|
+
var s, o = false;
|
|
47
|
+
return t2.regExp ? (o = t2.regExp.test(e), o && (s = RegExp.$1)) : t2.keywords ? o = canMatchKeywords(e, t2.keywords) : t2.modelRegExp && (o = canMatchModelRule(e, t2.modelRegExp)), o && (n = {
|
|
48
|
+
name: t2.name,
|
|
49
|
+
version: s
|
|
50
|
+
}), o;
|
|
51
|
+
}), n;
|
|
52
|
+
}
|
|
53
|
+
var osRules = [{
|
|
54
|
+
name: "windows",
|
|
55
|
+
regExp: /\bWindows\s?NT\s?(([\d.]+))\b/
|
|
56
|
+
}, {
|
|
57
|
+
name: "ios",
|
|
58
|
+
regExp: /\bOS(?:\s([\d_.]+))?\slike\sMac\sOS\sX\b/
|
|
59
|
+
}, {
|
|
60
|
+
name: "macos",
|
|
61
|
+
regExp: /\bMac\sOS\sX(?:\s([\d_.]+))?/
|
|
62
|
+
}, {
|
|
63
|
+
name: "openharmony",
|
|
64
|
+
regExp: /\bOpenHarmony\s([\d.]+)\b/
|
|
65
|
+
}, {
|
|
66
|
+
name: "android",
|
|
67
|
+
regExp: /\bAndroid;?(?:[-/\s]([\d.]+))?(?:\b|_)/
|
|
68
|
+
}, {
|
|
69
|
+
name: "android",
|
|
70
|
+
regExp: /\bAdr\s([\d.]+)(?:\b|_)/
|
|
71
|
+
}];
|
|
72
|
+
function _typeof$8(o) {
|
|
73
|
+
"@babel/helpers - typeof";
|
|
74
|
+
return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
75
|
+
return typeof o2;
|
|
76
|
+
} : function(o2) {
|
|
77
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
78
|
+
}, _typeof$8(o);
|
|
79
|
+
}
|
|
80
|
+
function _classCallCheck$a(a, n) {
|
|
81
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
82
|
+
}
|
|
83
|
+
function _defineProperties$5(e, r) {
|
|
84
|
+
for (var t = 0; t < r.length; t++) {
|
|
85
|
+
var o = r[t];
|
|
86
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$7(o.key), o);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function _createClass$a(e, r, t) {
|
|
90
|
+
return r && _defineProperties$5(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
91
|
+
}
|
|
92
|
+
function _toPropertyKey$7(t) {
|
|
93
|
+
var i = _toPrimitive$7(t, "string");
|
|
94
|
+
return "symbol" == _typeof$8(i) ? i : i + "";
|
|
95
|
+
}
|
|
96
|
+
function _toPrimitive$7(t, r) {
|
|
97
|
+
if ("object" != _typeof$8(t) || !t) return t;
|
|
98
|
+
var e = t[Symbol.toPrimitive];
|
|
99
|
+
if (void 0 !== e) {
|
|
100
|
+
var i = e.call(t, r);
|
|
101
|
+
if ("object" != _typeof$8(i)) return i;
|
|
102
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
103
|
+
}
|
|
104
|
+
return String(t);
|
|
105
|
+
}
|
|
106
|
+
function compareVersions(r, e) {
|
|
107
|
+
var t = /(\.0+)+$/, n = String(r).replace(t, "").split("."), s = String(e).replace(t, "").split("."), i = Math.min(n.length, s.length);
|
|
108
|
+
for (var _r2 = 0; _r2 < i; _r2++) {
|
|
109
|
+
var _e = parseInt(n[_r2]) - parseInt(s[_r2]);
|
|
110
|
+
if (_e) return _e;
|
|
111
|
+
}
|
|
112
|
+
return n.length - s.length;
|
|
113
|
+
}
|
|
114
|
+
var Version = /* @__PURE__ */ function() {
|
|
115
|
+
function Version2(r) {
|
|
116
|
+
_classCallCheck$a(this, Version2);
|
|
117
|
+
this._ver = (r || "").replace(/_/g, ".").replace(/\.+$/, ""), Object.freeze(this);
|
|
118
|
+
}
|
|
119
|
+
return _createClass$a(Version2, [{
|
|
120
|
+
key: "_compare",
|
|
121
|
+
value: function _compare(r, e) {
|
|
122
|
+
if (!this._ver || !r) return false;
|
|
123
|
+
var t = Array.isArray(e) ? e : [e], n = compareVersions(this._ver, r);
|
|
124
|
+
return t.some(function(r2) {
|
|
125
|
+
return n * r2 > 0 || 0 === n && 0 === r2;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "gt",
|
|
130
|
+
value: function gt(r) {
|
|
131
|
+
return this._compare(r, 1);
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "gte",
|
|
135
|
+
value: function gte(r) {
|
|
136
|
+
return this._compare(r, [1, 0]);
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: "lt",
|
|
140
|
+
value: function lt(r) {
|
|
141
|
+
return this._compare(r, -1);
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "lte",
|
|
145
|
+
value: function lte(r) {
|
|
146
|
+
return this._compare(r, [-1, 0]);
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "eq",
|
|
150
|
+
value: function eq(r) {
|
|
151
|
+
return this._compare(r, 0);
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "toString",
|
|
155
|
+
value: function toString() {
|
|
156
|
+
return this._ver;
|
|
157
|
+
}
|
|
158
|
+
}]);
|
|
159
|
+
}();
|
|
160
|
+
function _createClass$9(e, r, t) {
|
|
161
|
+
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
162
|
+
}
|
|
163
|
+
function _classCallCheck$9(a, n) {
|
|
164
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
165
|
+
}
|
|
166
|
+
var propMap$3 = {
|
|
167
|
+
ios: "isIOS",
|
|
168
|
+
openharmony: "isOpenHarmony",
|
|
169
|
+
android: "isAndroid",
|
|
170
|
+
windows: "isWindows",
|
|
171
|
+
macos: "isMacOS"
|
|
172
|
+
};
|
|
173
|
+
function platformToOS(s) {
|
|
174
|
+
switch (s) {
|
|
175
|
+
case "Android":
|
|
176
|
+
return "android";
|
|
177
|
+
case "iPad":
|
|
178
|
+
case "iPhone":
|
|
179
|
+
case "iPod":
|
|
180
|
+
return "ios";
|
|
181
|
+
case "MacIntel":
|
|
182
|
+
return "macos";
|
|
183
|
+
case "Win32":
|
|
184
|
+
return "windows";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
var OSInfo = /* @__PURE__ */ _createClass$9(function OSInfo2(s, o) {
|
|
188
|
+
_classCallCheck$9(this, OSInfo2);
|
|
189
|
+
var i;
|
|
190
|
+
var e;
|
|
191
|
+
if (this.isIOS = false, this.isAndroid = false, this.isHarmonyOS = false, this.isOpenHarmony = false, this.isWindows = false, this.isMacOS = false, null == o ? void 0 : o.platform) {
|
|
192
|
+
var _s = platformToOS(o.platform);
|
|
193
|
+
void 0 !== _s && (e = {
|
|
194
|
+
name: _s,
|
|
195
|
+
version: ""
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
var n = null !== (i = execRules(s, osRules)) && void 0 !== i ? i : e;
|
|
199
|
+
n ? (e && e.name !== n.name && (n = e), "macos" === n.name && (null == o ? void 0 : o.maxTouchPoints) && (n.name = "ios", n.version = ""), this[propMap$3[n.name]] = true, this.version = new Version(n.version), this.isAndroid && /\bHarmonyOS\b/.test(s) && (this.isHarmonyOS = true), Object.freeze(this)) : this.version = Object.freeze(new Version(""));
|
|
200
|
+
});
|
|
201
|
+
var appleRules = [{
|
|
202
|
+
name: "ipad",
|
|
203
|
+
regExp: /iPad/
|
|
204
|
+
}, {
|
|
205
|
+
name: "ipod",
|
|
206
|
+
regExp: /iPod/
|
|
207
|
+
}, {
|
|
208
|
+
name: "iphone",
|
|
209
|
+
regExp: /iPhone/
|
|
210
|
+
}];
|
|
211
|
+
var androidRules = [{
|
|
212
|
+
name: "huawei",
|
|
213
|
+
regExp: /\b(?:huawei|honor)/i
|
|
214
|
+
}, {
|
|
215
|
+
name: "huawei",
|
|
216
|
+
keywords: ["ideahub", "figi"]
|
|
217
|
+
}, {
|
|
218
|
+
name: "vivo",
|
|
219
|
+
keywords: ["vivo"]
|
|
220
|
+
}, {
|
|
221
|
+
name: "oppo",
|
|
222
|
+
keywords: ["oppo"]
|
|
223
|
+
}, {
|
|
224
|
+
name: "mi",
|
|
225
|
+
keywords: ["redmi", "hongmi", "shark", "Mi", "MIX", "POCO", "POCOPHONE"]
|
|
226
|
+
}, {
|
|
227
|
+
name: "mi",
|
|
228
|
+
regExp: /\bxiaomi/i
|
|
229
|
+
}, {
|
|
230
|
+
name: "samsung",
|
|
231
|
+
keywords: ["samsung", "galaxy"]
|
|
232
|
+
}, {
|
|
233
|
+
name: "oneplus",
|
|
234
|
+
keywords: ["oneplus", "one"]
|
|
235
|
+
}, {
|
|
236
|
+
name: "huawei",
|
|
237
|
+
modelRegExp: /^Mate\s*\d{2}/i
|
|
238
|
+
}, {
|
|
239
|
+
name: "huawei",
|
|
240
|
+
modelRegExp: /^Nova\s\d$/
|
|
241
|
+
}, {
|
|
242
|
+
name: "huawei",
|
|
243
|
+
regExp: /\b(?:Hi)?MatePad/i
|
|
244
|
+
}, {
|
|
245
|
+
name: "huawei",
|
|
246
|
+
regExp: /\b(?:Liantong|UNICOMVSENS)VP\d{3}\b/
|
|
247
|
+
}, {
|
|
248
|
+
name: "huawei",
|
|
249
|
+
regExp: /\bCMDCSP\d{3}\b/
|
|
250
|
+
}, {
|
|
251
|
+
name: "huawei",
|
|
252
|
+
regExp: /\bTDTECH/i
|
|
253
|
+
}, {
|
|
254
|
+
name: "huawei",
|
|
255
|
+
modelRegExp: /^[A-Z]{3}\d?-W[0-5]9[A-Z]*$/
|
|
256
|
+
}, {
|
|
257
|
+
name: "huawei",
|
|
258
|
+
modelRegExp: /^[A-Z][A-Za-z]{2,3}-(?:AN|BD|BX|AL|TL)\d{2}[A-Za-z]*$/
|
|
259
|
+
}, {
|
|
260
|
+
name: "huawei",
|
|
261
|
+
modelRegExp: /^TYH\d+[A-Z]?$/
|
|
262
|
+
}, {
|
|
263
|
+
name: "huawei",
|
|
264
|
+
modelRegExp: /^H60-L0[12]$/
|
|
265
|
+
}, {
|
|
266
|
+
name: "mi",
|
|
267
|
+
modelRegExp: /^MI\s?(?:\d|CC|Note|MAX|PLAY|PAD)/i
|
|
268
|
+
}, {
|
|
269
|
+
name: "mi",
|
|
270
|
+
modelRegExp: /^(?:AWM|SKR|SKW|DLT)-/
|
|
271
|
+
}, {
|
|
272
|
+
name: "mi",
|
|
273
|
+
modelRegExp: /^XIG\d{2}$/
|
|
274
|
+
}, {
|
|
275
|
+
name: "mi",
|
|
276
|
+
modelRegExp: /^M\d{4}[A-Z]\d{1,2}[A-Z]{1,3}$/
|
|
277
|
+
}, {
|
|
278
|
+
name: "mi",
|
|
279
|
+
modelRegExp: /^2\d{3}[A-Z0-9]{6}$/
|
|
280
|
+
}, {
|
|
281
|
+
name: "mi",
|
|
282
|
+
modelRegExp: /^2\d{5}[0-9A-Z]{2}[A-Z]$/
|
|
283
|
+
}, {
|
|
284
|
+
name: "mi",
|
|
285
|
+
modelRegExp: /^2\d{6}[A-Z]$/
|
|
286
|
+
}, {
|
|
287
|
+
name: "mi",
|
|
288
|
+
modelRegExp: /^2\d{7}[A-Z]{2,3}$/
|
|
289
|
+
}, {
|
|
290
|
+
name: "samsung",
|
|
291
|
+
modelRegExp: /^S(?:M|[CGP]H)-[A-Za-z0-9]+$/
|
|
292
|
+
}, {
|
|
293
|
+
name: "samsung",
|
|
294
|
+
modelRegExp: /^SCV3\d$/
|
|
295
|
+
}, {
|
|
296
|
+
name: "samsung",
|
|
297
|
+
modelRegExp: /^SC-\d{2}[A-Z]$/
|
|
298
|
+
}, {
|
|
299
|
+
name: "samsung",
|
|
300
|
+
modelRegExp: /^SH[WV]-/
|
|
301
|
+
}, {
|
|
302
|
+
name: "samsung",
|
|
303
|
+
modelRegExp: /^GT[-_][A-Z][A-Z0-9]{3,}$/i
|
|
304
|
+
}, {
|
|
305
|
+
name: "oppo",
|
|
306
|
+
modelRegExp: /^(?:CPH|OPD|iPA)\d{4}$/
|
|
307
|
+
}, {
|
|
308
|
+
name: "oppo",
|
|
309
|
+
modelRegExp: /^OPG\d{2}$/
|
|
310
|
+
}, {
|
|
311
|
+
name: "oppo",
|
|
312
|
+
modelRegExp: /^A[1-5]0[1-9]OP$/
|
|
313
|
+
}, {
|
|
314
|
+
name: "oneplus",
|
|
315
|
+
modelRegExp: /^(?:KB|HD|IN|GM|NE|LE|MT)\d{4}$/
|
|
316
|
+
}, {
|
|
317
|
+
name: "vivo",
|
|
318
|
+
modelRegExp: /^V[12]\d{3}[A-Z]{0,2}$/
|
|
319
|
+
}];
|
|
320
|
+
function _createClass$8(e, r, t) {
|
|
321
|
+
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
322
|
+
}
|
|
323
|
+
function _classCallCheck$8(a, n) {
|
|
324
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
325
|
+
}
|
|
326
|
+
var propMap$2 = {
|
|
327
|
+
ipod: "isIPod",
|
|
328
|
+
iphone: "isIPhone",
|
|
329
|
+
ipad: "isIPad",
|
|
330
|
+
huawei: "isHuawei",
|
|
331
|
+
mi: "isMi",
|
|
332
|
+
oppo: "isOppo",
|
|
333
|
+
vivo: "isVivo",
|
|
334
|
+
oneplus: "isOnePlus",
|
|
335
|
+
samsung: "isSamsung"
|
|
336
|
+
};
|
|
337
|
+
var BrandInfo = /* @__PURE__ */ _createClass$8(function BrandInfo2(i, s) {
|
|
338
|
+
_classCallCheck$8(this, BrandInfo2);
|
|
339
|
+
var e;
|
|
340
|
+
if (this.isHuawei = false, this.isMi = false, this.isOppo = false, this.isVivo = false, this.isOnePlus = false, this.isSamsung = false, this.isIPod = false, this.isIPhone = false, this.isIPad = false, this.isMac = false, this.isApple = false, s.isIOS ? (e = appleRules, this.isApple = true) : s.isMacOS ? (this.isMac = true, this.isApple = true) : (s.isAndroid || s.isOpenHarmony) && (e = androidRules), e) {
|
|
341
|
+
var o = execRules(i, e);
|
|
342
|
+
o ? this[propMap$2[o.name]] = true : s.isIOS && (this.isIPad = true);
|
|
343
|
+
}
|
|
344
|
+
Object.freeze(this);
|
|
345
|
+
});
|
|
346
|
+
var browserRules = [{
|
|
347
|
+
name: "edge",
|
|
348
|
+
regExp: /\bEdge\/([\d.]+)/
|
|
349
|
+
}, {
|
|
350
|
+
name: "chrome",
|
|
351
|
+
regExp: /\b(?:Chrome|CrMo|CriOS)\/([\d.]+)/
|
|
352
|
+
}, {
|
|
353
|
+
name: "safari",
|
|
354
|
+
regExp: /\b(?:Version\/([\d.]+).*\s?)?Safari\b/
|
|
355
|
+
}, {
|
|
356
|
+
name: "ie",
|
|
357
|
+
regExp: /\bMSIE\s(\d+)/i
|
|
358
|
+
}, {
|
|
359
|
+
name: "ie",
|
|
360
|
+
regExp: /\bTrident\/.*;\srv:(\d+)/
|
|
361
|
+
}, {
|
|
362
|
+
name: "firefox",
|
|
363
|
+
regExp: /\bFirefox\/([\d.]+)/
|
|
364
|
+
}, {
|
|
365
|
+
name: "opera-presto",
|
|
366
|
+
regExp: /\bOpera\/([\d.]+)/
|
|
367
|
+
}];
|
|
368
|
+
function _createClass$7(e, r, t) {
|
|
369
|
+
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
370
|
+
}
|
|
371
|
+
function _classCallCheck$7(a, n) {
|
|
372
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
373
|
+
}
|
|
374
|
+
var propMap$1 = {
|
|
375
|
+
chrome: "isChrome",
|
|
376
|
+
safari: "isSafari",
|
|
377
|
+
edge: "isEdge",
|
|
378
|
+
ie: "isIE",
|
|
379
|
+
firefox: "isFirefox",
|
|
380
|
+
"opera-presto": "isPrestoOpera"
|
|
381
|
+
};
|
|
382
|
+
var BrowserInfo = /* @__PURE__ */ _createClass$7(function BrowserInfo2(e) {
|
|
383
|
+
_classCallCheck$7(this, BrowserInfo2);
|
|
384
|
+
this.isChrome = false, this.isSafari = false, this.isEdge = false, this.isIE = false, this.isFirefox = false, this.isPrestoOpera = false;
|
|
385
|
+
var s = execRules(e, browserRules);
|
|
386
|
+
s ? (this[propMap$1[s.name]] = true, this.version = new Version(s.version)) : this.version = new Version(""), Object.freeze(this);
|
|
387
|
+
});
|
|
388
|
+
var clientRules = [{
|
|
389
|
+
name: "wxwork",
|
|
390
|
+
regExp: /\bwxwork\/([\d.]+)/
|
|
391
|
+
}, {
|
|
392
|
+
name: "wx",
|
|
393
|
+
regExp: /\bMicroMessenger\/([\d.]+)/
|
|
394
|
+
}, {
|
|
395
|
+
name: "ding",
|
|
396
|
+
regExp: /\bDingTalk\/([\d.]+)/
|
|
397
|
+
}, {
|
|
398
|
+
name: "qq",
|
|
399
|
+
regExp: /\bQQ\/([\d.]+)/
|
|
400
|
+
}, {
|
|
401
|
+
name: "qq",
|
|
402
|
+
regExp: /\bIPadQQ\b/
|
|
403
|
+
}, {
|
|
404
|
+
name: "weibo",
|
|
405
|
+
regExp: /(?:\b|_)Weibo(?:\b|_)/i
|
|
406
|
+
}, {
|
|
407
|
+
name: "edge",
|
|
408
|
+
regExp: /\bEdge?\/([\d.]+)/
|
|
409
|
+
}, {
|
|
410
|
+
name: "opera-blink",
|
|
411
|
+
regExp: /\bOPR\/([\d.]+)/
|
|
412
|
+
}, {
|
|
413
|
+
name: "qqbrowser",
|
|
414
|
+
regExp: /\bM?QQBrowser(?:\/([\d.]+))?/i
|
|
415
|
+
}, {
|
|
416
|
+
name: "ucbrowser",
|
|
417
|
+
regExp: /\b(?:UCBrowser|UCWEB)(?:-CMCC)?\/?\s?([\d.]+)/
|
|
418
|
+
}, {
|
|
419
|
+
name: "ucbrowser",
|
|
420
|
+
regExp: /\bUC\b/
|
|
421
|
+
}, {
|
|
422
|
+
name: "quark",
|
|
423
|
+
regExp: /\bQuark\/([\d.]+)/
|
|
424
|
+
}, {
|
|
425
|
+
name: "maxthon",
|
|
426
|
+
regExp: /\b(?:Maxthon|MxBrowser)(?:[/\s]([\d.]+))?/
|
|
427
|
+
}, {
|
|
428
|
+
name: "theworld",
|
|
429
|
+
regExp: /\bTheWorld(?:\s([\d.]+))?/i
|
|
430
|
+
}, {
|
|
431
|
+
name: "baidubrowser",
|
|
432
|
+
regExp: /\b(?:baidubrowser|bdbrowser_i18n|BIDUBrowser)(?:[/\s]([\d.]+))?/i
|
|
433
|
+
}, {
|
|
434
|
+
name: "baidubrowser",
|
|
435
|
+
regExp: /\bbaidubrowserpad\b/
|
|
436
|
+
}, {
|
|
437
|
+
name: "baiduapp",
|
|
438
|
+
regExp: /\bbaiduboxapp\b\/([\d.]+)?/i
|
|
439
|
+
}, {
|
|
440
|
+
name: "baiduapp",
|
|
441
|
+
regExp: /\bbaiduboxpad\b/i
|
|
442
|
+
}];
|
|
443
|
+
clientRules = clientRules.concat(browserRules);
|
|
444
|
+
function _createClass$6(e, r, t) {
|
|
445
|
+
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
446
|
+
}
|
|
447
|
+
function _classCallCheck$6(a, n) {
|
|
448
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
449
|
+
}
|
|
450
|
+
var propMap = {
|
|
451
|
+
wxwork: "isWxWork",
|
|
452
|
+
wx: "isWx",
|
|
453
|
+
ding: "isDing",
|
|
454
|
+
qq: "isQQ",
|
|
455
|
+
weibo: "isWeibo",
|
|
456
|
+
edge: "isEdge",
|
|
457
|
+
"opera-blink": "isOpera",
|
|
458
|
+
"opera-presto": "isOpera",
|
|
459
|
+
qqbrowser: "isQQBrowser",
|
|
460
|
+
ucbrowser: "isUCBrowser",
|
|
461
|
+
quark: "isQuark",
|
|
462
|
+
maxthon: "isMaxthon",
|
|
463
|
+
theworld: "isTheWorld",
|
|
464
|
+
baidubrowser: "isBaiduBrowser",
|
|
465
|
+
baiduapp: "isBaiduApp",
|
|
466
|
+
chrome: "isChrome",
|
|
467
|
+
safari: "isSafari",
|
|
468
|
+
ie: "isIE",
|
|
469
|
+
firefox: "isFirefox"
|
|
470
|
+
};
|
|
471
|
+
var ClientInfo = /* @__PURE__ */ _createClass$6(function ClientInfo2(i) {
|
|
472
|
+
_classCallCheck$6(this, ClientInfo2);
|
|
473
|
+
this.isWxWork = false, this.isWx = false, this.isWxMiniProgram = false, this.isDing = false, this.isQQ = false, this.isWeibo = false, this.isEdge = false, this.isOpera = false, this.isQQBrowser = false, this.isUCBrowser = false, this.isQuark = false, this.isMaxthon = false, this.isTheWorld = false, this.isBaiduBrowser = false, this.isBaiduApp = false, this.isChrome = false, this.isSafari = false, this.isIE = false, this.isFirefox = false;
|
|
474
|
+
var s = execRules(i, clientRules);
|
|
475
|
+
s ? (this[propMap[s.name]] = true, this.version = new Version(s.version)) : this.version = new Version(""), this.isWxMiniProgram = (this.isWx || this.isWxWork) && /\bMiniProgramEnv\b/.test(i), Object.freeze(this);
|
|
476
|
+
});
|
|
477
|
+
function _createClass$5(e, r, t) {
|
|
478
|
+
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
479
|
+
}
|
|
480
|
+
function _classCallCheck$5(a, n) {
|
|
481
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
482
|
+
}
|
|
483
|
+
var UAInfo = /* @__PURE__ */ _createClass$5(function UAInfo2(t, i) {
|
|
484
|
+
_classCallCheck$5(this, UAInfo2);
|
|
485
|
+
this.os = Object.freeze(new OSInfo(t, i)), this.brand = Object.freeze(new BrandInfo(t, this.os)), this.browser = Object.freeze(new BrowserInfo(t)), this.client = Object.freeze(new ClientInfo(t)), this.isTablet = this.brand.isIPad || /\bTablet\b/i.test(t) || this.os.isAndroid && !/\bMobile\b/i.test(t), this.os.isIOS || this.os.isAndroid || this.isTablet ? this.isPortable = true : /\(X11[;)]/i.test(t) || /\b(Windows\sNT|Macintosh)\b/.test(t) ? this.isPortable = false : this.isPortable = /mobile|android/i.test(t), Object.freeze(this);
|
|
486
|
+
});
|
|
487
|
+
var currentUAInfo;
|
|
488
|
+
function getCurrentUAInfo() {
|
|
489
|
+
return currentUAInfo || (currentUAInfo = Object.freeze("undefined" != typeof window ? new UAInfo(window.navigator.userAgent, window.navigator) : new UAInfo(""))), currentUAInfo;
|
|
490
|
+
}
|
|
491
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
492
|
+
function hasOwnProp(r, n) {
|
|
493
|
+
return hasOwnProperty.call(r, n);
|
|
494
|
+
}
|
|
495
|
+
function assignProps(r) {
|
|
496
|
+
if (null == r) throw new TypeError("Cannot convert undefined or null to object");
|
|
497
|
+
for (var o = 0; o < (arguments.length <= 1 ? 0 : arguments.length - 1); o++) {
|
|
498
|
+
var t = o + 1 < 1 || arguments.length <= o + 1 ? void 0 : arguments[o + 1];
|
|
499
|
+
if (null != t) for (var n in t) "__proto__" !== n && hasOwnProp(t, n) && (r[n] = t[n]);
|
|
500
|
+
}
|
|
501
|
+
return r;
|
|
502
|
+
}
|
|
503
|
+
function _typeof$7(o) {
|
|
504
|
+
"@babel/helpers - typeof";
|
|
505
|
+
return _typeof$7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
506
|
+
return typeof o2;
|
|
507
|
+
} : function(o2) {
|
|
508
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
509
|
+
}, _typeof$7(o);
|
|
510
|
+
}
|
|
511
|
+
function addToResult(n, o, e, t) {
|
|
512
|
+
if (null == e && (e = ""), "" !== e || !t.ignoreEmpty) {
|
|
513
|
+
if ("function" == typeof t.encode) {
|
|
514
|
+
o = t.encode(o);
|
|
515
|
+
e = -1 !== ["boolean", "string", "number"].indexOf(_typeof$7(e)) ? t.encode(String(e)) : "";
|
|
516
|
+
}
|
|
517
|
+
n.push(o + "=" + e);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function handleMultiValues(n, o, e, t) {
|
|
521
|
+
e.forEach(function(e2) {
|
|
522
|
+
addToResult(n, o, e2, t);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function stringify(n, o) {
|
|
526
|
+
var e = assignProps({
|
|
527
|
+
encode: encodeURIComponent
|
|
528
|
+
}, o), t = [];
|
|
529
|
+
var i, r;
|
|
530
|
+
for (i in n) hasOwnProp(n, i) && (r = n[i], Array.isArray(r) ? handleMultiValues(t, i, r, e) : addToResult(t, i, r, e));
|
|
531
|
+
return t.join("&");
|
|
532
|
+
}
|
|
533
|
+
function splitURL(e) {
|
|
534
|
+
var t = {
|
|
535
|
+
leftContext: ""
|
|
536
|
+
};
|
|
537
|
+
var n = e.indexOf("#");
|
|
538
|
+
return -1 !== n && (t.hash = e.slice(n + 1), e = e.slice(0, n)), n = e.indexOf("?"), -1 !== n && (t.search = e.slice(n + 1), e = e.slice(0, n)), t.leftContext = e, t;
|
|
539
|
+
}
|
|
540
|
+
function joinURL(e) {
|
|
541
|
+
var t = e.leftContext;
|
|
542
|
+
return null != e.search && (t += "?" + e.search), null != e.hash && (t += "#" + e.hash), t;
|
|
543
|
+
}
|
|
544
|
+
function concat(i, r, t) {
|
|
545
|
+
if (i = String(i), null == r) return i;
|
|
546
|
+
if (!(r = "string" == typeof r ? r.replace(/^[?&]/, "") : stringify(r, t))) return i;
|
|
547
|
+
var n = splitURL(i);
|
|
548
|
+
var e = n.search || "";
|
|
549
|
+
return e && "&" !== e.slice(-1) && (e += "&"), e += r, n.search = e, joinURL(n);
|
|
550
|
+
}
|
|
551
|
+
(function(i, n, o, t) {
|
|
552
|
+
return new (o || (o = Promise))(function(e, a) {
|
|
553
|
+
function r(i2) {
|
|
554
|
+
try {
|
|
555
|
+
k(t.next(i2));
|
|
556
|
+
} catch (i3) {
|
|
557
|
+
a(i3);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function l(i2) {
|
|
561
|
+
try {
|
|
562
|
+
k(t["throw"](i2));
|
|
563
|
+
} catch (i3) {
|
|
564
|
+
a(i3);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function k(i2) {
|
|
568
|
+
var n2;
|
|
569
|
+
i2.done ? e(i2.value) : (n2 = i2.value, n2 instanceof o ? n2 : new o(function(i3) {
|
|
570
|
+
i3(n2);
|
|
571
|
+
})).then(r, l);
|
|
572
|
+
}
|
|
573
|
+
k((t = t.apply(i, n || [])).next());
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
var uaInfo = getCurrentUAInfo();
|
|
577
|
+
uaInfo.os.isAndroid;
|
|
578
|
+
uaInfo.os.isIOS;
|
|
579
|
+
var LinkType;
|
|
580
|
+
!function(i) {
|
|
581
|
+
i[i.Normal = 10] = "Normal", i[i.MultiPlatform = 11] = "MultiPlatform", i[i.Native = 12] = "Native";
|
|
582
|
+
}(LinkType || (LinkType = {}));
|
|
583
|
+
var LinkJumpWay;
|
|
584
|
+
!function(i) {
|
|
585
|
+
i.PopUp = "POP_UP", i.NewWindow = "NEW_WINDOW", i.CurrentWindow = "CURRENT_WINDOW";
|
|
586
|
+
}(LinkJumpWay || (LinkJumpWay = {}));
|
|
587
|
+
var ProductType = /* @__PURE__ */ function(ProductType2) {
|
|
36
588
|
ProductType2["Normal"] = "normal";
|
|
37
589
|
ProductType2["Finance"] = "finance";
|
|
38
590
|
ProductType2["Position"] = "position";
|
|
39
591
|
return ProductType2;
|
|
40
|
-
}
|
|
41
|
-
var ProductLinkType = /* @__PURE__ */ (
|
|
592
|
+
}({});
|
|
593
|
+
var ProductLinkType = /* @__PURE__ */ function(ProductLinkType2) {
|
|
42
594
|
ProductLinkType2[ProductLinkType2["Normal"] = 10] = "Normal";
|
|
43
595
|
ProductLinkType2[ProductLinkType2["MultiPlatform"] = 11] = "MultiPlatform";
|
|
44
596
|
ProductLinkType2[ProductLinkType2["Native"] = 12] = "Native";
|
|
45
597
|
return ProductLinkType2;
|
|
46
|
-
}
|
|
47
|
-
var ProductLinkJumpWay = /* @__PURE__ */ (
|
|
598
|
+
}({});
|
|
599
|
+
var ProductLinkJumpWay = /* @__PURE__ */ function(ProductLinkJumpWay2) {
|
|
48
600
|
ProductLinkJumpWay2["PopUp"] = "POP_UP";
|
|
49
601
|
ProductLinkJumpWay2["NewWindow"] = "NEW_WINDOW";
|
|
50
602
|
ProductLinkJumpWay2["CurrentWindow"] = "CURRENT_WINDOW";
|
|
51
603
|
return ProductLinkJumpWay2;
|
|
52
|
-
}
|
|
53
|
-
var ProductStatus = /* @__PURE__ */ (
|
|
604
|
+
}({});
|
|
605
|
+
var ProductStatus = /* @__PURE__ */ function(ProductStatus2) {
|
|
54
606
|
ProductStatus2[ProductStatus2["OnSale"] = 1] = "OnSale";
|
|
55
607
|
ProductStatus2[ProductStatus2["OffSale"] = 0] = "OffSale";
|
|
56
608
|
return ProductStatus2;
|
|
57
|
-
}
|
|
58
|
-
var ProductMediaType = /* @__PURE__ */ (
|
|
609
|
+
}({});
|
|
610
|
+
var ProductMediaType = /* @__PURE__ */ function(ProductMediaType2) {
|
|
59
611
|
ProductMediaType2["Image"] = "image";
|
|
60
612
|
ProductMediaType2["MaterialVideo"] = "material-video";
|
|
61
613
|
return ProductMediaType2;
|
|
62
|
-
}
|
|
63
|
-
var ProductExplainStatus = /* @__PURE__ */ (
|
|
614
|
+
}({});
|
|
615
|
+
var ProductExplainStatus = /* @__PURE__ */ function(ProductExplainStatus2) {
|
|
64
616
|
ProductExplainStatus2["NotExplained"] = "notExplained";
|
|
65
617
|
ProductExplainStatus2["Explaining"] = "explaining";
|
|
66
618
|
ProductExplainStatus2["Explained"] = "explained";
|
|
67
619
|
return ProductExplainStatus2;
|
|
68
|
-
}
|
|
69
|
-
var ProductExplainType = /* @__PURE__ */ (
|
|
620
|
+
}({});
|
|
621
|
+
var ProductExplainType = /* @__PURE__ */ function(ProductExplainType2) {
|
|
70
622
|
ProductExplainType2["Live"] = "live";
|
|
71
623
|
ProductExplainType2["Playback"] = "recordFile";
|
|
72
624
|
return ProductExplainType2;
|
|
73
|
-
}
|
|
74
|
-
var ProductBuyType = /* @__PURE__ */ (
|
|
625
|
+
}({});
|
|
626
|
+
var ProductBuyType = /* @__PURE__ */ function(ProductBuyType2) {
|
|
75
627
|
ProductBuyType2["DirectBuy"] = "inner";
|
|
76
628
|
ProductBuyType2["Link"] = "link";
|
|
77
629
|
return ProductBuyType2;
|
|
78
|
-
}
|
|
79
|
-
var ProductPriceType = /* @__PURE__ */ (
|
|
630
|
+
}({});
|
|
631
|
+
var ProductPriceType = /* @__PURE__ */ function(ProductPriceType2) {
|
|
80
632
|
ProductPriceType2["Amount"] = "AMOUNT";
|
|
81
633
|
ProductPriceType2["Custom"] = "CUSTOM";
|
|
82
634
|
return ProductPriceType2;
|
|
83
|
-
}
|
|
84
|
-
var ProductDeliveryType = /* @__PURE__ */ (
|
|
635
|
+
}({});
|
|
636
|
+
var ProductDeliveryType = /* @__PURE__ */ function(ProductDeliveryType2) {
|
|
85
637
|
ProductDeliveryType2["Express"] = "express";
|
|
86
638
|
ProductDeliveryType2["Virtual"] = "virtual";
|
|
87
639
|
return ProductDeliveryType2;
|
|
88
|
-
}
|
|
89
|
-
var ProductServiceType = /* @__PURE__ */ (
|
|
640
|
+
}({});
|
|
641
|
+
var ProductServiceType = /* @__PURE__ */ function(ProductServiceType2) {
|
|
90
642
|
ProductServiceType2["WxWorkCode"] = "wxWorkCode";
|
|
91
643
|
ProductServiceType2["Custom"] = "custom";
|
|
92
644
|
return ProductServiceType2;
|
|
93
|
-
}
|
|
94
|
-
var AuthType = /* @__PURE__ */ (
|
|
645
|
+
}({});
|
|
646
|
+
var AuthType = /* @__PURE__ */ function(AuthType2) {
|
|
95
647
|
AuthType2["None"] = "none";
|
|
96
648
|
AuthType2["Custom"] = "custom";
|
|
97
649
|
AuthType2["External"] = "external";
|
|
98
650
|
AuthType2["Direct"] = "direct";
|
|
99
651
|
AuthType2["EnterpriseWeChat"] = "enterpriseWeChat";
|
|
100
652
|
return AuthType2;
|
|
101
|
-
}
|
|
653
|
+
}({});
|
|
654
|
+
function _typeof$6(o) {
|
|
655
|
+
"@babel/helpers - typeof";
|
|
656
|
+
return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
657
|
+
return typeof o2;
|
|
658
|
+
} : function(o2) {
|
|
659
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
660
|
+
}, _typeof$6(o);
|
|
661
|
+
}
|
|
662
|
+
function ownKeys$4(e, r) {
|
|
663
|
+
var t = Object.keys(e);
|
|
664
|
+
if (Object.getOwnPropertySymbols) {
|
|
665
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
666
|
+
r && (o = o.filter(function(r2) {
|
|
667
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
668
|
+
})), t.push.apply(t, o);
|
|
669
|
+
}
|
|
670
|
+
return t;
|
|
671
|
+
}
|
|
672
|
+
function _objectSpread$4(e) {
|
|
673
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
674
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
675
|
+
r % 2 ? ownKeys$4(Object(t), true).forEach(function(r2) {
|
|
676
|
+
_defineProperty$5(e, r2, t[r2]);
|
|
677
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r2) {
|
|
678
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
return e;
|
|
682
|
+
}
|
|
683
|
+
function _defineProperty$5(e, r, t) {
|
|
684
|
+
return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
685
|
+
}
|
|
686
|
+
function _toPropertyKey$6(t) {
|
|
687
|
+
var i = _toPrimitive$6(t, "string");
|
|
688
|
+
return "symbol" == _typeof$6(i) ? i : i + "";
|
|
689
|
+
}
|
|
690
|
+
function _toPrimitive$6(t, r) {
|
|
691
|
+
if ("object" != _typeof$6(t) || !t) return t;
|
|
692
|
+
var e = t[Symbol.toPrimitive];
|
|
693
|
+
if (void 0 !== e) {
|
|
694
|
+
var i = e.call(t, r);
|
|
695
|
+
if ("object" != _typeof$6(i)) return i;
|
|
696
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
697
|
+
}
|
|
698
|
+
return ("string" === r ? String : Number)(t);
|
|
699
|
+
}
|
|
102
700
|
function parseFeature(features) {
|
|
103
|
-
|
|
701
|
+
var list = [];
|
|
104
702
|
if (!features) {
|
|
105
703
|
return list;
|
|
106
704
|
}
|
|
107
705
|
try {
|
|
108
|
-
|
|
109
|
-
list = arr.filter((i)
|
|
706
|
+
var arr = JSON.parse(features);
|
|
707
|
+
list = arr.filter(function(i) {
|
|
708
|
+
return !!i;
|
|
709
|
+
});
|
|
110
710
|
} catch (e) {
|
|
111
711
|
console.error("parseFeature error", e);
|
|
112
712
|
}
|
|
113
713
|
return list;
|
|
114
714
|
}
|
|
115
715
|
function filterInternalData(internalData) {
|
|
116
|
-
|
|
716
|
+
var basicData = {
|
|
117
717
|
productId: internalData.productId,
|
|
118
718
|
cover: internalData.cover,
|
|
119
719
|
coverList: [internalData.cover],
|
|
@@ -125,11 +725,13 @@ function filterInternalData(internalData) {
|
|
|
125
725
|
status: internalData.status,
|
|
126
726
|
displayNumber: internalData.showId,
|
|
127
727
|
buttonText: internalData.btnShow,
|
|
128
|
-
featureTags: parseFeature(internalData.features)
|
|
728
|
+
featureTags: parseFeature(internalData.features),
|
|
729
|
+
pushRule: internalData.productPushRule,
|
|
730
|
+
pushLogId: internalData.logId
|
|
129
731
|
};
|
|
130
|
-
|
|
732
|
+
var linkData = {
|
|
131
733
|
linkType: internalData.linkType,
|
|
132
|
-
jumpWay:
|
|
734
|
+
jumpWay: LinkJumpWay.NewWindow,
|
|
133
735
|
link: internalData.link,
|
|
134
736
|
pcLink: internalData.pcLink,
|
|
135
737
|
mobileLink: internalData.mobileLink,
|
|
@@ -143,18 +745,20 @@ function filterInternalData(internalData) {
|
|
|
143
745
|
};
|
|
144
746
|
if (internalData.ext) {
|
|
145
747
|
try {
|
|
146
|
-
|
|
748
|
+
var extData = JSON.parse(internalData.ext);
|
|
147
749
|
basicData.coverList = extData.coverList || [internalData.cover];
|
|
148
|
-
basicData.videoList = (extData.videoList || []).map((item)
|
|
750
|
+
basicData.videoList = (extData.videoList || []).map(function(item) {
|
|
751
|
+
return item.videoId;
|
|
752
|
+
});
|
|
149
753
|
linkData.jumpWay = extData.jumpWay;
|
|
150
|
-
|
|
151
|
-
basicData.videoList.forEach((item)
|
|
754
|
+
var mediaList = [];
|
|
755
|
+
basicData.videoList.forEach(function(item) {
|
|
152
756
|
mediaList.push({
|
|
153
757
|
type: ProductMediaType.MaterialVideo,
|
|
154
758
|
materialId: item
|
|
155
759
|
});
|
|
156
760
|
});
|
|
157
|
-
basicData.coverList.forEach((item)
|
|
761
|
+
basicData.coverList.forEach(function(item) {
|
|
158
762
|
mediaList.push({
|
|
159
763
|
type: ProductMediaType.Image,
|
|
160
764
|
url: item
|
|
@@ -165,18 +769,15 @@ function filterInternalData(internalData) {
|
|
|
165
769
|
console.error("filterInternlData error", e);
|
|
166
770
|
}
|
|
167
771
|
}
|
|
168
|
-
|
|
772
|
+
var explainData = {
|
|
169
773
|
explainStatus: internalData.explainStatus,
|
|
170
774
|
explainType: internalData.explainType
|
|
171
775
|
};
|
|
172
|
-
|
|
173
|
-
|
|
776
|
+
var productData;
|
|
777
|
+
var productType = internalData.productType;
|
|
174
778
|
switch (productType) {
|
|
175
779
|
case ProductType.Normal: {
|
|
176
|
-
productData = {
|
|
177
|
-
...basicData,
|
|
178
|
-
...linkData,
|
|
179
|
-
...explainData,
|
|
780
|
+
productData = _objectSpread$4(_objectSpread$4(_objectSpread$4(_objectSpread$4({}, basicData), linkData), explainData), {}, {
|
|
180
781
|
productType: ProductType.Normal,
|
|
181
782
|
priceType: internalData.priceType,
|
|
182
783
|
buyType: internalData.buyType,
|
|
@@ -189,36 +790,30 @@ function filterInternalData(internalData) {
|
|
|
189
790
|
customerServiceType: internalData.customerServiceType,
|
|
190
791
|
stockEnabled: ynToBool(internalData.stockEnabled, "N"),
|
|
191
792
|
stock: internalData.stock
|
|
192
|
-
};
|
|
793
|
+
});
|
|
193
794
|
break;
|
|
194
795
|
}
|
|
195
796
|
case ProductType.Finance: {
|
|
196
|
-
productData = {
|
|
197
|
-
...basicData,
|
|
198
|
-
...linkData,
|
|
199
|
-
...explainData,
|
|
797
|
+
productData = _objectSpread$4(_objectSpread$4(_objectSpread$4(_objectSpread$4({}, basicData), linkData), explainData), {}, {
|
|
200
798
|
productType: ProductType.Finance,
|
|
201
|
-
yield: internalData
|
|
202
|
-
};
|
|
799
|
+
"yield": internalData["yield"]
|
|
800
|
+
});
|
|
203
801
|
break;
|
|
204
802
|
}
|
|
205
803
|
case ProductType.Position: {
|
|
206
804
|
basicData.description = "";
|
|
207
805
|
basicData.detail = internalData.productDesc;
|
|
208
|
-
|
|
806
|
+
var treatment = "";
|
|
209
807
|
try {
|
|
210
|
-
|
|
808
|
+
var params = JSON.parse(internalData.params);
|
|
211
809
|
treatment = params.treatment;
|
|
212
810
|
} catch (e) {
|
|
213
811
|
console.error(e);
|
|
214
812
|
}
|
|
215
|
-
productData = {
|
|
216
|
-
...basicData,
|
|
217
|
-
...linkData,
|
|
218
|
-
...explainData,
|
|
813
|
+
productData = _objectSpread$4(_objectSpread$4(_objectSpread$4(_objectSpread$4({}, basicData), linkData), explainData), {}, {
|
|
219
814
|
productType: ProductType.Position,
|
|
220
815
|
treatment
|
|
221
|
-
};
|
|
816
|
+
});
|
|
222
817
|
break;
|
|
223
818
|
}
|
|
224
819
|
}
|
|
@@ -227,85 +822,99 @@ function filterInternalData(internalData) {
|
|
|
227
822
|
}
|
|
228
823
|
return productData;
|
|
229
824
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
r || (r = []), r.push({ type: t, handler: n, callbackHandler: n.bind(o) }), this.__eventStore[e] = r;
|
|
238
|
-
}
|
|
239
|
-
on(t, e, n = this) {
|
|
240
|
-
this.__addOnEvent("normal", t, e, n);
|
|
241
|
-
}
|
|
242
|
-
once(t, e, n = this) {
|
|
243
|
-
this.__addOnEvent("once", t, e, n);
|
|
244
|
-
}
|
|
245
|
-
off(t, e) {
|
|
246
|
-
let n = this.__eventStore[t];
|
|
247
|
-
n && (n = n.filter((t2) => t2.handler !== e), this.__eventStore[t] = n);
|
|
248
|
-
}
|
|
249
|
-
emit(t, e) {
|
|
250
|
-
const n = this.__eventStore[t];
|
|
251
|
-
n && n.forEach((n2) => {
|
|
252
|
-
const { type: o, handler: r, callbackHandler: _ } = n2;
|
|
253
|
-
"function" == typeof _ && _(e), "once" === o && this.off(t, r);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
destroy() {
|
|
257
|
-
this.__eventStore = {};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
261
|
-
function hasOwnProp(r, n) {
|
|
262
|
-
return hasOwnProperty.call(r, n);
|
|
825
|
+
function _typeof$5(o) {
|
|
826
|
+
"@babel/helpers - typeof";
|
|
827
|
+
return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
828
|
+
return typeof o2;
|
|
829
|
+
} : function(o2) {
|
|
830
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
831
|
+
}, _typeof$5(o);
|
|
263
832
|
}
|
|
264
|
-
function
|
|
265
|
-
if (
|
|
266
|
-
for (let o = 0; o < n.length; o++) {
|
|
267
|
-
const t = n[o];
|
|
268
|
-
if (null != t) for (const n2 in t) "__proto__" !== n2 && hasOwnProp(t, n2) && (r[n2] = t[n2]);
|
|
269
|
-
}
|
|
270
|
-
return r;
|
|
833
|
+
function _classCallCheck$4(a, n) {
|
|
834
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
271
835
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
e = -1 !== ["boolean", "string", "number"].indexOf(typeof e) ? t.encode(String(e)) : "";
|
|
277
|
-
}
|
|
278
|
-
n.push(o + "=" + e);
|
|
836
|
+
function _defineProperties$4(e, r) {
|
|
837
|
+
for (var t = 0; t < r.length; t++) {
|
|
838
|
+
var o = r[t];
|
|
839
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$5(o.key), o);
|
|
279
840
|
}
|
|
280
841
|
}
|
|
281
|
-
function
|
|
282
|
-
e.
|
|
283
|
-
addToResult(n, o, e2, t);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
function stringify(n, o) {
|
|
287
|
-
const e = assignProps({ encode: encodeURIComponent }, o), t = [];
|
|
288
|
-
let i, r;
|
|
289
|
-
for (i in n) hasOwnProp(n, i) && (r = n[i], Array.isArray(r) ? handleMultiValues(t, i, r, e) : addToResult(t, i, r, e));
|
|
290
|
-
return t.join("&");
|
|
291
|
-
}
|
|
292
|
-
function splitURL(e) {
|
|
293
|
-
const t = { leftContext: "" };
|
|
294
|
-
let n = e.indexOf("#");
|
|
295
|
-
return -1 !== n && (t.hash = e.slice(n + 1), e = e.slice(0, n)), n = e.indexOf("?"), -1 !== n && (t.search = e.slice(n + 1), e = e.slice(0, n)), t.leftContext = e, t;
|
|
842
|
+
function _createClass$4(e, r, t) {
|
|
843
|
+
return r && _defineProperties$4(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
296
844
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
return
|
|
845
|
+
function _toPropertyKey$5(t) {
|
|
846
|
+
var i = _toPrimitive$5(t, "string");
|
|
847
|
+
return "symbol" == _typeof$5(i) ? i : i + "";
|
|
300
848
|
}
|
|
301
|
-
function
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
849
|
+
function _toPrimitive$5(t, r) {
|
|
850
|
+
if ("object" != _typeof$5(t) || !t) return t;
|
|
851
|
+
var e = t[Symbol.toPrimitive];
|
|
852
|
+
if (void 0 !== e) {
|
|
853
|
+
var i = e.call(t, r);
|
|
854
|
+
if ("object" != _typeof$5(i)) return i;
|
|
855
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
856
|
+
}
|
|
857
|
+
return String(t);
|
|
307
858
|
}
|
|
308
|
-
var
|
|
859
|
+
var EventEmitter = /* @__PURE__ */ function() {
|
|
860
|
+
function EventEmitter2() {
|
|
861
|
+
_classCallCheck$4(this, EventEmitter2);
|
|
862
|
+
this.__eventStore = {};
|
|
863
|
+
}
|
|
864
|
+
return _createClass$4(EventEmitter2, [{
|
|
865
|
+
key: "__addOnEvent",
|
|
866
|
+
value: function __addOnEvent(t, e, n, o) {
|
|
867
|
+
if (!e || !n) return;
|
|
868
|
+
var r = this.__eventStore[e];
|
|
869
|
+
r || (r = []), r.push({
|
|
870
|
+
type: t,
|
|
871
|
+
handler: n,
|
|
872
|
+
callbackHandler: n.bind(o)
|
|
873
|
+
}), this.__eventStore[e] = r;
|
|
874
|
+
}
|
|
875
|
+
}, {
|
|
876
|
+
key: "on",
|
|
877
|
+
value: function on(t, e) {
|
|
878
|
+
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this;
|
|
879
|
+
this.__addOnEvent("normal", t, e, n);
|
|
880
|
+
}
|
|
881
|
+
}, {
|
|
882
|
+
key: "once",
|
|
883
|
+
value: function once(t, e) {
|
|
884
|
+
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this;
|
|
885
|
+
this.__addOnEvent("once", t, e, n);
|
|
886
|
+
}
|
|
887
|
+
}, {
|
|
888
|
+
key: "off",
|
|
889
|
+
value: function off(t, e) {
|
|
890
|
+
var n = this.__eventStore[t];
|
|
891
|
+
n && (n = n.filter(function(t2) {
|
|
892
|
+
return t2.handler !== e;
|
|
893
|
+
}), this.__eventStore[t] = n);
|
|
894
|
+
}
|
|
895
|
+
}, {
|
|
896
|
+
key: "emit",
|
|
897
|
+
value: function emit(t, e) {
|
|
898
|
+
var _this = this;
|
|
899
|
+
var n = this.__eventStore[t];
|
|
900
|
+
n && n.forEach(function(n2) {
|
|
901
|
+
var o = n2.type, r = n2.handler, _ = n2.callbackHandler;
|
|
902
|
+
"function" == typeof _ && _(e), "once" === o && _this.off(t, r);
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
}, {
|
|
906
|
+
key: "destroy",
|
|
907
|
+
value: function destroy() {
|
|
908
|
+
this.__eventStore = {};
|
|
909
|
+
}
|
|
910
|
+
}]);
|
|
911
|
+
}();
|
|
912
|
+
var ProductPushRule = /* @__PURE__ */ function(ProductPushRule2) {
|
|
913
|
+
ProductPushRule2["BigCard"] = "bigCard";
|
|
914
|
+
ProductPushRule2["SmallCard"] = "smallCard";
|
|
915
|
+
return ProductPushRule2;
|
|
916
|
+
}({});
|
|
917
|
+
var ProductEvents = /* @__PURE__ */ function(ProductEvents2) {
|
|
309
918
|
ProductEvents2["OnSaleProduct"] = "OnSaleProduct";
|
|
310
919
|
ProductEvents2["OffSaleProduct"] = "OffSaleProduct";
|
|
311
920
|
ProductEvents2["AddProduct"] = "AddProduct";
|
|
@@ -321,128 +930,287 @@ var ProductEvents = /* @__PURE__ */ ((ProductEvents2) => {
|
|
|
321
930
|
ProductEvents2["ProductClick"] = "ProductClick";
|
|
322
931
|
ProductEvents2["ProductClickTimes"] = "ProductClickTimes";
|
|
323
932
|
return ProductEvents2;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
933
|
+
}({});
|
|
934
|
+
function _typeof$4(o) {
|
|
935
|
+
"@babel/helpers - typeof";
|
|
936
|
+
return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
937
|
+
return typeof o2;
|
|
938
|
+
} : function(o2) {
|
|
939
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
940
|
+
}, _typeof$4(o);
|
|
941
|
+
}
|
|
942
|
+
function ownKeys$3(e, r) {
|
|
943
|
+
var t = Object.keys(e);
|
|
944
|
+
if (Object.getOwnPropertySymbols) {
|
|
945
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
946
|
+
r && (o = o.filter(function(r2) {
|
|
947
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
948
|
+
})), t.push.apply(t, o);
|
|
949
|
+
}
|
|
950
|
+
return t;
|
|
951
|
+
}
|
|
952
|
+
function _objectSpread$3(e) {
|
|
953
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
954
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
955
|
+
r % 2 ? ownKeys$3(Object(t), true).forEach(function(r2) {
|
|
956
|
+
_defineProperty$4(e, r2, t[r2]);
|
|
957
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r2) {
|
|
958
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
return e;
|
|
962
|
+
}
|
|
963
|
+
function _regenerator$3() {
|
|
964
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
965
|
+
var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag";
|
|
966
|
+
function i(r2, n2, o2, i2) {
|
|
967
|
+
var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype);
|
|
968
|
+
return _regeneratorDefine2$3(u2, "_invoke", function(r3, n3, o3) {
|
|
969
|
+
var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d2(t2, r4) {
|
|
970
|
+
return i3 = t2, c3 = 0, u3 = e, G.n = r4, a;
|
|
971
|
+
} };
|
|
972
|
+
function d(r4, n4) {
|
|
973
|
+
for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) {
|
|
974
|
+
var o4, i4 = p[t], d2 = G.p, l = i4[2];
|
|
975
|
+
r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0));
|
|
976
|
+
}
|
|
977
|
+
if (o4 || r4 > 1) return a;
|
|
978
|
+
throw y = true, n4;
|
|
979
|
+
}
|
|
980
|
+
return function(o4, p2, l) {
|
|
981
|
+
if (f2 > 1) throw TypeError("Generator is already running");
|
|
982
|
+
for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) {
|
|
983
|
+
i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3);
|
|
984
|
+
try {
|
|
985
|
+
if (f2 = 2, i3) {
|
|
986
|
+
if (c3 || (o4 = "next"), t = i3[o4]) {
|
|
987
|
+
if (!(t = t.call(i3, u3))) throw TypeError("iterator result is not an object");
|
|
988
|
+
if (!t.done) return t;
|
|
989
|
+
u3 = t.value, c3 < 2 && (c3 = 0);
|
|
990
|
+
} else 1 === c3 && (t = i3["return"]) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1);
|
|
991
|
+
i3 = e;
|
|
992
|
+
} else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) break;
|
|
993
|
+
} catch (t2) {
|
|
994
|
+
i3 = e, c3 = 1, u3 = t2;
|
|
995
|
+
} finally {
|
|
996
|
+
f2 = 1;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return { value: t, done: y };
|
|
1000
|
+
};
|
|
1001
|
+
}(r2, o2, i2), true), u2;
|
|
1002
|
+
}
|
|
1003
|
+
var a = {};
|
|
1004
|
+
function Generator() {
|
|
1005
|
+
}
|
|
1006
|
+
function GeneratorFunction() {
|
|
1007
|
+
}
|
|
1008
|
+
function GeneratorFunctionPrototype() {
|
|
1009
|
+
}
|
|
1010
|
+
t = Object.getPrototypeOf;
|
|
1011
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$3(t = {}, n, function() {
|
|
1012
|
+
return this;
|
|
1013
|
+
}), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
1014
|
+
function f(e2) {
|
|
1015
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$3(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2;
|
|
1016
|
+
}
|
|
1017
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$3(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$3(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$3(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$3(u), _regeneratorDefine2$3(u, o, "Generator"), _regeneratorDefine2$3(u, n, function() {
|
|
1018
|
+
return this;
|
|
1019
|
+
}), _regeneratorDefine2$3(u, "toString", function() {
|
|
1020
|
+
return "[object Generator]";
|
|
1021
|
+
}), (_regenerator$3 = function _regenerator2() {
|
|
1022
|
+
return { w: i, m: f };
|
|
1023
|
+
})();
|
|
1024
|
+
}
|
|
1025
|
+
function _regeneratorDefine2$3(e, r, n, t) {
|
|
1026
|
+
var i = Object.defineProperty;
|
|
1027
|
+
try {
|
|
1028
|
+
i({}, "", {});
|
|
1029
|
+
} catch (e2) {
|
|
1030
|
+
i = 0;
|
|
1031
|
+
}
|
|
1032
|
+
_regeneratorDefine2$3 = function _regeneratorDefine(e2, r2, n2, t2) {
|
|
1033
|
+
if (r2) i ? i(e2, r2, { value: n2, enumerable: !t2, configurable: !t2, writable: !t2 }) : e2[r2] = n2;
|
|
1034
|
+
else {
|
|
1035
|
+
var o = function o2(r3, n3) {
|
|
1036
|
+
_regeneratorDefine2$3(e2, r3, function(e3) {
|
|
1037
|
+
return this._invoke(r3, n3, e3);
|
|
1038
|
+
});
|
|
1039
|
+
};
|
|
1040
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
1041
|
+
}
|
|
1042
|
+
}, _regeneratorDefine2$3(e, r, n, t);
|
|
1043
|
+
}
|
|
1044
|
+
function asyncGeneratorStep$3(n, t, e, r, o, a, c) {
|
|
1045
|
+
try {
|
|
1046
|
+
var i = n[a](c), u = i.value;
|
|
1047
|
+
} catch (n2) {
|
|
1048
|
+
return void e(n2);
|
|
1049
|
+
}
|
|
1050
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
1051
|
+
}
|
|
1052
|
+
function _asyncToGenerator$3(n) {
|
|
1053
|
+
return function() {
|
|
1054
|
+
var t = this, e = arguments;
|
|
1055
|
+
return new Promise(function(r, o) {
|
|
1056
|
+
var a = n.apply(t, e);
|
|
1057
|
+
function _next(n2) {
|
|
1058
|
+
asyncGeneratorStep$3(a, r, o, _next, _throw, "next", n2);
|
|
1059
|
+
}
|
|
1060
|
+
function _throw(n2) {
|
|
1061
|
+
asyncGeneratorStep$3(a, r, o, _next, _throw, "throw", n2);
|
|
1062
|
+
}
|
|
1063
|
+
_next(void 0);
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
function _classCallCheck$3(a, n) {
|
|
1068
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
1069
|
+
}
|
|
1070
|
+
function _defineProperties$3(e, r) {
|
|
1071
|
+
for (var t = 0; t < r.length; t++) {
|
|
1072
|
+
var o = r[t];
|
|
1073
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$4(o.key), o);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
function _createClass$3(e, r, t) {
|
|
1077
|
+
return r && _defineProperties$3(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
1078
|
+
}
|
|
1079
|
+
function _defineProperty$4(e, r, t) {
|
|
1080
|
+
return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
1081
|
+
}
|
|
1082
|
+
function _toPropertyKey$4(t) {
|
|
1083
|
+
var i = _toPrimitive$4(t, "string");
|
|
1084
|
+
return "symbol" == _typeof$4(i) ? i : i + "";
|
|
1085
|
+
}
|
|
1086
|
+
function _toPrimitive$4(t, r) {
|
|
1087
|
+
if ("object" != _typeof$4(t) || !t) return t;
|
|
1088
|
+
var e = t[Symbol.toPrimitive];
|
|
1089
|
+
if (void 0 !== e) {
|
|
1090
|
+
var i = e.call(t, r);
|
|
1091
|
+
if ("object" != _typeof$4(i)) return i;
|
|
1092
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1093
|
+
}
|
|
1094
|
+
return String(t);
|
|
1095
|
+
}
|
|
1096
|
+
var appName = "product";
|
|
1097
|
+
var Product = /* @__PURE__ */ function() {
|
|
1098
|
+
function Product2(iarCore, config) {
|
|
1099
|
+
var _this = this;
|
|
1100
|
+
_classCallCheck$3(this, Product2);
|
|
1101
|
+
_defineProperty$4(this, "ProductType", ProductType);
|
|
1102
|
+
_defineProperty$4(this, "ProductLinkType", ProductLinkType);
|
|
1103
|
+
_defineProperty$4(this, "ProductLinkJumpWay", ProductLinkJumpWay);
|
|
1104
|
+
_defineProperty$4(this, "ProductBuyType", ProductBuyType);
|
|
1105
|
+
_defineProperty$4(this, "ProductStatus", ProductStatus);
|
|
1106
|
+
_defineProperty$4(this, "ProductEvents", ProductEvents);
|
|
1107
|
+
_defineProperty$4(this, "ProductPriceType", ProductPriceType);
|
|
1108
|
+
_defineProperty$4(this, "ProductExplainStatus", ProductExplainStatus);
|
|
1109
|
+
_defineProperty$4(this, "ProductMediaType", ProductMediaType);
|
|
1110
|
+
_defineProperty$4(this, "ProductDeliveryType", ProductDeliveryType);
|
|
1111
|
+
_defineProperty$4(this, "ProductServiceType", ProductServiceType);
|
|
1112
|
+
_defineProperty$4(this, "ProductPushRule", ProductPushRule);
|
|
1113
|
+
_defineProperty$4(this, "eventEmitter", new EventEmitter());
|
|
1114
|
+
_defineProperty$4(this, "__handleProductMessage", function(socketData) {
|
|
1115
|
+
var status = Number(socketData.status);
|
|
342
1116
|
switch (status) {
|
|
343
1117
|
// 上架商品
|
|
344
1118
|
case 1: {
|
|
345
|
-
|
|
1119
|
+
_this.eventEmitter.emit(ProductEvents.OnSaleProduct, {
|
|
346
1120
|
productData: filterInternalData(socketData.content)
|
|
347
1121
|
});
|
|
348
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
349
1122
|
break;
|
|
350
1123
|
}
|
|
351
1124
|
// 下架商品
|
|
352
1125
|
case 2: {
|
|
353
|
-
|
|
1126
|
+
_this.eventEmitter.emit(ProductEvents.OffSaleProduct, {
|
|
354
1127
|
productData: filterInternalData(socketData.content)
|
|
355
1128
|
});
|
|
356
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
357
1129
|
break;
|
|
358
1130
|
}
|
|
359
1131
|
// 删除商品
|
|
360
1132
|
case 3: {
|
|
361
|
-
|
|
1133
|
+
_this.eventEmitter.emit(ProductEvents.DeleteProduct, {
|
|
362
1134
|
productId: socketData.content.productId
|
|
363
1135
|
});
|
|
364
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
365
1136
|
break;
|
|
366
1137
|
}
|
|
367
1138
|
// 添加商品
|
|
368
1139
|
case 4: {
|
|
369
|
-
|
|
1140
|
+
_this.eventEmitter.emit(ProductEvents.AddProduct, {
|
|
370
1141
|
productData: filterInternalData(socketData.content)
|
|
371
1142
|
});
|
|
372
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
373
1143
|
break;
|
|
374
1144
|
}
|
|
375
1145
|
// 修改商品,例如商品开价
|
|
376
1146
|
case 5: {
|
|
377
|
-
|
|
1147
|
+
_this.eventEmitter.emit(ProductEvents.ChangeProduct, {
|
|
378
1148
|
productData: filterInternalData(socketData.content)
|
|
379
1149
|
});
|
|
380
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
381
1150
|
break;
|
|
382
1151
|
}
|
|
383
1152
|
// 移动商品
|
|
384
1153
|
case 6:
|
|
385
1154
|
case 7: {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
filterInternalData(content[1])
|
|
390
|
-
];
|
|
391
|
-
this.eventEmitter.emit(ProductEvents.MoveProduct, {
|
|
1155
|
+
var content = socketData.content;
|
|
1156
|
+
var targetProducts = [filterInternalData(content[0]), filterInternalData(content[1])];
|
|
1157
|
+
_this.eventEmitter.emit(ProductEvents.MoveProduct, {
|
|
392
1158
|
targetProducts
|
|
393
1159
|
});
|
|
394
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
395
1160
|
break;
|
|
396
1161
|
}
|
|
397
1162
|
// 修改排序
|
|
398
1163
|
case 15: {
|
|
399
|
-
|
|
1164
|
+
_this.eventEmitter.emit(ProductEvents.ChangeProductRank, {
|
|
400
1165
|
productData: filterInternalData(socketData.content)
|
|
401
1166
|
});
|
|
402
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
403
1167
|
break;
|
|
404
1168
|
}
|
|
405
1169
|
// 推送商品
|
|
406
1170
|
case 9: {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
productData: filterInternalData(
|
|
410
|
-
pushRule:
|
|
1171
|
+
var _content = socketData.content;
|
|
1172
|
+
_this.eventEmitter.emit(ProductEvents.PushProduct, {
|
|
1173
|
+
productData: filterInternalData(_content),
|
|
1174
|
+
pushRule: _content.productPushRule
|
|
411
1175
|
});
|
|
412
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
413
1176
|
break;
|
|
414
1177
|
}
|
|
415
1178
|
// 商品列表开关
|
|
416
1179
|
case 10: {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
enabled:
|
|
1180
|
+
var _content2 = socketData.content;
|
|
1181
|
+
_this.eventEmitter.emit(ProductEvents.ProductListEnabled, {
|
|
1182
|
+
enabled: _content2.enabled === "Y"
|
|
420
1183
|
});
|
|
421
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
422
1184
|
break;
|
|
423
1185
|
}
|
|
424
1186
|
// 取消推送
|
|
425
1187
|
case 11: {
|
|
426
|
-
|
|
1188
|
+
_this.eventEmitter.emit(ProductEvents.CancelPushProduct, {
|
|
1189
|
+
productId: socketData.content.productId
|
|
1190
|
+
});
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
// 商品售罄
|
|
1194
|
+
case 12: {
|
|
1195
|
+
_this.eventEmitter.emit(ProductEvents.ProductSoldOut, {
|
|
427
1196
|
productId: socketData.content.productId
|
|
428
1197
|
});
|
|
429
|
-
this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
430
1198
|
break;
|
|
431
1199
|
}
|
|
432
1200
|
}
|
|
433
1201
|
});
|
|
434
|
-
|
|
435
|
-
|
|
1202
|
+
_defineProperty$4(this, "__handleRefreshProductList", function() {
|
|
1203
|
+
_this.eventEmitter.emit(ProductEvents.RefreshProductList, {});
|
|
436
1204
|
});
|
|
437
|
-
|
|
438
|
-
|
|
1205
|
+
_defineProperty$4(this, "__handleProductClickEvent", function(socketData) {
|
|
1206
|
+
_this.eventEmitter.emit(ProductEvents.ProductClick, {
|
|
439
1207
|
productId: socketData.productId,
|
|
440
1208
|
name: socketData.positionName,
|
|
441
1209
|
productType: socketData.type
|
|
442
1210
|
});
|
|
443
1211
|
});
|
|
444
|
-
|
|
445
|
-
|
|
1212
|
+
_defineProperty$4(this, "__handleProductClickTimes", function(socketData) {
|
|
1213
|
+
_this.eventEmitter.emit(ProductEvents.ProductClickTimes, {
|
|
446
1214
|
productId: socketData.productId,
|
|
447
1215
|
name: socketData.positionName,
|
|
448
1216
|
productType: socketData.type,
|
|
@@ -460,241 +1228,407 @@ class Product {
|
|
|
460
1228
|
PRODUCT_CLICK_TIMES: this.__handleProductClickTimes
|
|
461
1229
|
}, "product");
|
|
462
1230
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
1231
|
+
return _createClass$3(Product2, [{
|
|
1232
|
+
key: "getProductTagList",
|
|
1233
|
+
value: function() {
|
|
1234
|
+
var _getProductTagList = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee() {
|
|
1235
|
+
var _params$pageNumber, _params$pageSize;
|
|
1236
|
+
var params, pageNumber, pageSize, _args = arguments;
|
|
1237
|
+
return _regenerator$3().w(function(_context) {
|
|
1238
|
+
while (1) switch (_context.n) {
|
|
1239
|
+
case 0:
|
|
1240
|
+
params = _args.length > 0 && _args[0] !== void 0 ? _args[0] : {};
|
|
1241
|
+
pageNumber = (_params$pageNumber = params.pageNumber) !== null && _params$pageNumber !== void 0 ? _params$pageNumber : 1;
|
|
1242
|
+
pageSize = (_params$pageSize = params.pageSize) !== null && _params$pageSize !== void 0 ? _params$pageSize : 10;
|
|
1243
|
+
return _context.a(2, this.iarCore.polyvApi.get(PolyvApiUrl.GetProductTagList, {
|
|
1244
|
+
pageNumber,
|
|
1245
|
+
pageSize
|
|
1246
|
+
}));
|
|
1247
|
+
}
|
|
1248
|
+
}, _callee, this);
|
|
1249
|
+
}));
|
|
1250
|
+
function getProductTagList() {
|
|
1251
|
+
return _getProductTagList.apply(this, arguments);
|
|
480
1252
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
* 获取商品数据
|
|
540
|
-
* @param productId 商品 id
|
|
541
|
-
*/
|
|
542
|
-
async getProductData(productId) {
|
|
543
|
-
var _a;
|
|
544
|
-
const data = await this.iarCore.polyvApi.get(
|
|
545
|
-
PolyvApiUrl.GetProductDataById,
|
|
546
|
-
{
|
|
547
|
-
productId
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
useAESDecrypt: true
|
|
1253
|
+
return getProductTagList;
|
|
1254
|
+
}()
|
|
1255
|
+
}, {
|
|
1256
|
+
key: "getProductList",
|
|
1257
|
+
value: function() {
|
|
1258
|
+
var _getProductList = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee2() {
|
|
1259
|
+
var params, _params$count, count, productList, toppingProduct, total, _params$page, page, data, _data, _args2 = arguments;
|
|
1260
|
+
return _regenerator$3().w(function(_context2) {
|
|
1261
|
+
while (1) switch (_context2.n) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
params = _args2.length > 0 && _args2[0] !== void 0 ? _args2[0] : {};
|
|
1264
|
+
_params$count = params.count, count = _params$count === void 0 ? 10 : _params$count;
|
|
1265
|
+
productList = [];
|
|
1266
|
+
total = 0;
|
|
1267
|
+
if (!(params.keyword || params.tagId)) {
|
|
1268
|
+
_context2.n = 2;
|
|
1269
|
+
break;
|
|
1270
|
+
}
|
|
1271
|
+
_params$page = params.page, page = _params$page === void 0 ? 1 : _params$page;
|
|
1272
|
+
_context2.n = 1;
|
|
1273
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetProductListByTag, {
|
|
1274
|
+
keyword: params.keyword,
|
|
1275
|
+
tagId: params.tagId,
|
|
1276
|
+
pageNumber: page,
|
|
1277
|
+
pageSize: count
|
|
1278
|
+
});
|
|
1279
|
+
case 1:
|
|
1280
|
+
data = _context2.v;
|
|
1281
|
+
productList = data.contents;
|
|
1282
|
+
total = data.totalItems;
|
|
1283
|
+
_context2.n = 4;
|
|
1284
|
+
break;
|
|
1285
|
+
case 2:
|
|
1286
|
+
_context2.n = 3;
|
|
1287
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetProductListByShowId, {
|
|
1288
|
+
count,
|
|
1289
|
+
showId: params.displayNumber
|
|
1290
|
+
}, {
|
|
1291
|
+
useAESDecrypt: true
|
|
1292
|
+
});
|
|
1293
|
+
case 3:
|
|
1294
|
+
_data = _context2.v;
|
|
1295
|
+
productList = _data.content;
|
|
1296
|
+
toppingProduct = _data.toppingProduct;
|
|
1297
|
+
total = _data.total;
|
|
1298
|
+
case 4:
|
|
1299
|
+
return _context2.a(2, {
|
|
1300
|
+
contents: productList.map(function(data2) {
|
|
1301
|
+
return filterInternalData(data2);
|
|
1302
|
+
}),
|
|
1303
|
+
toppingProduct: toppingProduct ? filterInternalData(toppingProduct) : void 0,
|
|
1304
|
+
total
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
}, _callee2, this);
|
|
1308
|
+
}));
|
|
1309
|
+
function getProductList() {
|
|
1310
|
+
return _getProductList.apply(this, arguments);
|
|
551
1311
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
};
|
|
642
|
-
return concat(`${domainInfo.watchPageDomain}/landing/product/explain`, queryParams);
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* 获取商品支付订单是否开启
|
|
646
|
-
* @example
|
|
647
|
-
* ```js
|
|
648
|
-
* const enabled = await productTarget.getProductPayOrderEnabled();
|
|
649
|
-
* console.log('商品支付订单是否开启', enabled);
|
|
650
|
-
* ```
|
|
651
|
-
*/
|
|
652
|
-
async getProductPayOrderEnabled() {
|
|
653
|
-
const channelConfig = await this.config.getProductConfig();
|
|
654
|
-
if (!channelConfig) return false;
|
|
655
|
-
return channelConfig.productPayOrderEnabled;
|
|
656
|
-
}
|
|
657
|
-
async getCurrentPushingProduct() {
|
|
658
|
-
const channelConfig = await this.config.getProductConfig();
|
|
659
|
-
if (!channelConfig) return;
|
|
660
|
-
return channelConfig.channelProductPushingStatusVO;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* 判断当前用户是否支持直接购买商品
|
|
664
|
-
* @example
|
|
665
|
-
* ```js
|
|
666
|
-
* const supported = await productTarget.getSupportToDirectBuy();
|
|
667
|
-
* console.log('是否支持直接购买', supported);
|
|
668
|
-
* ```
|
|
669
|
-
*/
|
|
670
|
-
async getSupportToDirectBuy() {
|
|
671
|
-
if (!await this.getProductPayOrderEnabled()) {
|
|
672
|
-
return false;
|
|
673
|
-
}
|
|
674
|
-
const userInfo = await this.iarCore.getUserInfo();
|
|
675
|
-
if (!userInfo.unionId) return false;
|
|
676
|
-
const authType = userInfo.authType;
|
|
677
|
-
if (!authType || authType === AuthType.None) {
|
|
678
|
-
return true;
|
|
679
|
-
}
|
|
680
|
-
const notSupportAuthTypes = [
|
|
681
|
-
AuthType.Custom,
|
|
682
|
-
AuthType.External,
|
|
683
|
-
AuthType.Direct,
|
|
684
|
-
AuthType.EnterpriseWeChat
|
|
685
|
-
];
|
|
686
|
-
if (notSupportAuthTypes.includes(authType)) {
|
|
687
|
-
return false;
|
|
1312
|
+
return getProductList;
|
|
1313
|
+
}()
|
|
1314
|
+
}, {
|
|
1315
|
+
key: "getProductData",
|
|
1316
|
+
value: function() {
|
|
1317
|
+
var _getProductData = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee3(productId) {
|
|
1318
|
+
var _productData$detail;
|
|
1319
|
+
var data, productData, res;
|
|
1320
|
+
return _regenerator$3().w(function(_context3) {
|
|
1321
|
+
while (1) switch (_context3.n) {
|
|
1322
|
+
case 0:
|
|
1323
|
+
_context3.n = 1;
|
|
1324
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetProductDataById, {
|
|
1325
|
+
productId
|
|
1326
|
+
}, {
|
|
1327
|
+
useAESDecrypt: true
|
|
1328
|
+
});
|
|
1329
|
+
case 1:
|
|
1330
|
+
data = _context3.v;
|
|
1331
|
+
productData = filterInternalData(data);
|
|
1332
|
+
if (!((_productData$detail = productData.detail) !== null && _productData$detail !== void 0 && _productData$detail.endsWith(".json"))) {
|
|
1333
|
+
_context3.n = 3;
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
_context3.n = 2;
|
|
1337
|
+
return this.iarCore.otherApi.get(productData.detail, {});
|
|
1338
|
+
case 2:
|
|
1339
|
+
res = _context3.v;
|
|
1340
|
+
productData.detail = res.productDetail;
|
|
1341
|
+
case 3:
|
|
1342
|
+
return _context3.a(2, productData);
|
|
1343
|
+
}
|
|
1344
|
+
}, _callee3, this);
|
|
1345
|
+
}));
|
|
1346
|
+
function getProductData(_x) {
|
|
1347
|
+
return _getProductData.apply(this, arguments);
|
|
1348
|
+
}
|
|
1349
|
+
return getProductData;
|
|
1350
|
+
}()
|
|
1351
|
+
}, {
|
|
1352
|
+
key: "sendProductClickEvent",
|
|
1353
|
+
value: function() {
|
|
1354
|
+
var _sendProductClickEvent = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee4(params) {
|
|
1355
|
+
var userInfo, channelInfo, productConfig;
|
|
1356
|
+
return _regenerator$3().w(function(_context4) {
|
|
1357
|
+
while (1) switch (_context4.n) {
|
|
1358
|
+
case 0:
|
|
1359
|
+
_context4.n = 1;
|
|
1360
|
+
return this.iarCore.getUserInfo();
|
|
1361
|
+
case 1:
|
|
1362
|
+
userInfo = _context4.v;
|
|
1363
|
+
_context4.n = 2;
|
|
1364
|
+
return this.iarCore.getChannelInfo();
|
|
1365
|
+
case 2:
|
|
1366
|
+
channelInfo = _context4.v;
|
|
1367
|
+
_context4.n = 3;
|
|
1368
|
+
return this.config.getProductConfig();
|
|
1369
|
+
case 3:
|
|
1370
|
+
productConfig = _context4.v;
|
|
1371
|
+
if (!(!productConfig.productHotEffectEnabled && !productConfig.productLinkJumpTipEnabled)) {
|
|
1372
|
+
_context4.n = 4;
|
|
1373
|
+
break;
|
|
1374
|
+
}
|
|
1375
|
+
return _context4.a(2);
|
|
1376
|
+
case 4:
|
|
1377
|
+
this.iarCore.emitSocket({
|
|
1378
|
+
EVENT: "PRODUCT_CLICK",
|
|
1379
|
+
data: {
|
|
1380
|
+
productId: params.productId,
|
|
1381
|
+
type: params.productType,
|
|
1382
|
+
nickName: userInfo.nick,
|
|
1383
|
+
positionName: params.name
|
|
1384
|
+
},
|
|
1385
|
+
roomId: channelInfo.channelId
|
|
1386
|
+
}, "product");
|
|
1387
|
+
case 5:
|
|
1388
|
+
return _context4.a(2);
|
|
1389
|
+
}
|
|
1390
|
+
}, _callee4, this);
|
|
1391
|
+
}));
|
|
1392
|
+
function sendProductClickEvent(_x2) {
|
|
1393
|
+
return _sendProductClickEvent.apply(this, arguments);
|
|
1394
|
+
}
|
|
1395
|
+
return sendProductClickEvent;
|
|
1396
|
+
}()
|
|
1397
|
+
}, {
|
|
1398
|
+
key: "closeProductPush",
|
|
1399
|
+
value: function closeProductPush() {
|
|
1400
|
+
this.eventEmitter.emit(ProductEvents.CancelPushProduct, {});
|
|
688
1401
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
1402
|
+
/**
|
|
1403
|
+
* 获取商品讲解开关
|
|
1404
|
+
*
|
|
1405
|
+
* 获取当前频道是否开启商品讲解
|
|
1406
|
+
* @example
|
|
1407
|
+
* ```js
|
|
1408
|
+
* const enabled = await productTarget.getProductExplainEnabled();
|
|
1409
|
+
* console.log('商品讲解开关', enabled);
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
}, {
|
|
1413
|
+
key: "getProductExplainEnabled",
|
|
1414
|
+
value: function() {
|
|
1415
|
+
var _getProductExplainEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee5() {
|
|
1416
|
+
var _productConfig$produc;
|
|
1417
|
+
var productConfig;
|
|
1418
|
+
return _regenerator$3().w(function(_context5) {
|
|
1419
|
+
while (1) switch (_context5.n) {
|
|
1420
|
+
case 0:
|
|
1421
|
+
_context5.n = 1;
|
|
1422
|
+
return this.config.getProductConfig();
|
|
1423
|
+
case 1:
|
|
1424
|
+
productConfig = _context5.v;
|
|
1425
|
+
return _context5.a(2, (_productConfig$produc = productConfig === null || productConfig === void 0 ? void 0 : productConfig.productExplainEnabled) !== null && _productConfig$produc !== void 0 ? _productConfig$produc : false);
|
|
1426
|
+
}
|
|
1427
|
+
}, _callee5, this);
|
|
1428
|
+
}));
|
|
1429
|
+
function getProductExplainEnabled() {
|
|
1430
|
+
return _getProductExplainEnabled.apply(this, arguments);
|
|
1431
|
+
}
|
|
1432
|
+
return getProductExplainEnabled;
|
|
1433
|
+
}()
|
|
1434
|
+
}, {
|
|
1435
|
+
key: "generateProductExplainPageUrl",
|
|
1436
|
+
value: function() {
|
|
1437
|
+
var _generateProductExplainPageUrl = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee6(params) {
|
|
1438
|
+
var domainInfo, channelInfo, queryParams;
|
|
1439
|
+
return _regenerator$3().w(function(_context6) {
|
|
1440
|
+
while (1) switch (_context6.n) {
|
|
1441
|
+
case 0:
|
|
1442
|
+
domainInfo = this.iarCore.getDomainInfo();
|
|
1443
|
+
_context6.n = 1;
|
|
1444
|
+
return this.iarCore.getChannelInfo();
|
|
1445
|
+
case 1:
|
|
1446
|
+
channelInfo = _context6.v;
|
|
1447
|
+
queryParams = _objectSpread$3({
|
|
1448
|
+
channelId: channelInfo.channelId
|
|
1449
|
+
}, params || {});
|
|
1450
|
+
return _context6.a(2, concat("".concat(domainInfo.watchPageDomain, "/landing/product/explain"), queryParams));
|
|
1451
|
+
}
|
|
1452
|
+
}, _callee6, this);
|
|
1453
|
+
}));
|
|
1454
|
+
function generateProductExplainPageUrl(_x3) {
|
|
1455
|
+
return _generateProductExplainPageUrl.apply(this, arguments);
|
|
1456
|
+
}
|
|
1457
|
+
return generateProductExplainPageUrl;
|
|
1458
|
+
}()
|
|
1459
|
+
}, {
|
|
1460
|
+
key: "getOutLinkProductRedirectEnabled",
|
|
1461
|
+
value: function() {
|
|
1462
|
+
var _getOutLinkProductRedirectEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee7() {
|
|
1463
|
+
var _productConfig$outLin;
|
|
1464
|
+
var productConfig;
|
|
1465
|
+
return _regenerator$3().w(function(_context7) {
|
|
1466
|
+
while (1) switch (_context7.n) {
|
|
1467
|
+
case 0:
|
|
1468
|
+
_context7.n = 1;
|
|
1469
|
+
return this.config.getProductConfig();
|
|
1470
|
+
case 1:
|
|
1471
|
+
productConfig = _context7.v;
|
|
1472
|
+
return _context7.a(2, (_productConfig$outLin = productConfig === null || productConfig === void 0 ? void 0 : productConfig.outLinkProductRedirectEnabled) !== null && _productConfig$outLin !== void 0 ? _productConfig$outLin : false);
|
|
1473
|
+
}
|
|
1474
|
+
}, _callee7, this);
|
|
1475
|
+
}));
|
|
1476
|
+
function getOutLinkProductRedirectEnabled() {
|
|
1477
|
+
return _getOutLinkProductRedirectEnabled.apply(this, arguments);
|
|
1478
|
+
}
|
|
1479
|
+
return getOutLinkProductRedirectEnabled;
|
|
1480
|
+
}()
|
|
1481
|
+
}, {
|
|
1482
|
+
key: "getProductPayOrderEnabled",
|
|
1483
|
+
value: function() {
|
|
1484
|
+
var _getProductPayOrderEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee8() {
|
|
1485
|
+
var productConfig;
|
|
1486
|
+
return _regenerator$3().w(function(_context8) {
|
|
1487
|
+
while (1) switch (_context8.n) {
|
|
1488
|
+
case 0:
|
|
1489
|
+
_context8.n = 1;
|
|
1490
|
+
return this.config.getProductConfig();
|
|
1491
|
+
case 1:
|
|
1492
|
+
productConfig = _context8.v;
|
|
1493
|
+
if (productConfig) {
|
|
1494
|
+
_context8.n = 2;
|
|
1495
|
+
break;
|
|
1496
|
+
}
|
|
1497
|
+
return _context8.a(2, false);
|
|
1498
|
+
case 2:
|
|
1499
|
+
return _context8.a(2, productConfig.productPayOrderEnabled);
|
|
1500
|
+
}
|
|
1501
|
+
}, _callee8, this);
|
|
1502
|
+
}));
|
|
1503
|
+
function getProductPayOrderEnabled() {
|
|
1504
|
+
return _getProductPayOrderEnabled.apply(this, arguments);
|
|
1505
|
+
}
|
|
1506
|
+
return getProductPayOrderEnabled;
|
|
1507
|
+
}()
|
|
1508
|
+
}, {
|
|
1509
|
+
key: "getProductHotSaleConfig",
|
|
1510
|
+
value: function() {
|
|
1511
|
+
var _getProductHotSaleConfig = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee9() {
|
|
1512
|
+
var _productConfig$produc2;
|
|
1513
|
+
var productConfig;
|
|
1514
|
+
return _regenerator$3().w(function(_context9) {
|
|
1515
|
+
while (1) switch (_context9.n) {
|
|
1516
|
+
case 0:
|
|
1517
|
+
_context9.n = 1;
|
|
1518
|
+
return this.config.getProductConfig();
|
|
1519
|
+
case 1:
|
|
1520
|
+
productConfig = _context9.v;
|
|
1521
|
+
if (productConfig) {
|
|
1522
|
+
_context9.n = 2;
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
return _context9.a(2);
|
|
1526
|
+
case 2:
|
|
1527
|
+
return _context9.a(2, {
|
|
1528
|
+
productHotEffectEnabled: (_productConfig$produc2 = productConfig.productHotEffectEnabled) !== null && _productConfig$produc2 !== void 0 ? _productConfig$produc2 : false,
|
|
1529
|
+
productHotEffectTips: productConfig.productHotEffectTips
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
}, _callee9, this);
|
|
1533
|
+
}));
|
|
1534
|
+
function getProductHotSaleConfig() {
|
|
1535
|
+
return _getProductHotSaleConfig.apply(this, arguments);
|
|
1536
|
+
}
|
|
1537
|
+
return getProductHotSaleConfig;
|
|
1538
|
+
}()
|
|
1539
|
+
}, {
|
|
1540
|
+
key: "getCurrentPushingProduct",
|
|
1541
|
+
value: function() {
|
|
1542
|
+
var _getCurrentPushingProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee0(productId) {
|
|
1543
|
+
var _productConfig$channe;
|
|
1544
|
+
var productConfig, pid, result;
|
|
1545
|
+
return _regenerator$3().w(function(_context0) {
|
|
1546
|
+
while (1) switch (_context0.n) {
|
|
1547
|
+
case 0:
|
|
1548
|
+
_context0.n = 1;
|
|
1549
|
+
return this.config.getProductConfig();
|
|
1550
|
+
case 1:
|
|
1551
|
+
productConfig = _context0.v;
|
|
1552
|
+
if (!(!productConfig || !((_productConfig$channe = productConfig.channelProductPushingStatusVO) !== null && _productConfig$channe !== void 0 && _productConfig$channe.productId))) {
|
|
1553
|
+
_context0.n = 2;
|
|
1554
|
+
break;
|
|
1555
|
+
}
|
|
1556
|
+
return _context0.a(2);
|
|
1557
|
+
case 2:
|
|
1558
|
+
pid = productId !== null && productId !== void 0 ? productId : productConfig.channelProductPushingStatusVO.productId;
|
|
1559
|
+
_context0.n = 3;
|
|
1560
|
+
return this.getProductData(pid);
|
|
1561
|
+
case 3:
|
|
1562
|
+
result = _context0.v;
|
|
1563
|
+
return _context0.a(2, _objectSpread$3(_objectSpread$3({}, result), {}, {
|
|
1564
|
+
pushRule: productConfig.channelProductPushingStatusVO.pushRule
|
|
1565
|
+
}));
|
|
1566
|
+
}
|
|
1567
|
+
}, _callee0, this);
|
|
1568
|
+
}));
|
|
1569
|
+
function getCurrentPushingProduct(_x4) {
|
|
1570
|
+
return _getCurrentPushingProduct.apply(this, arguments);
|
|
1571
|
+
}
|
|
1572
|
+
return getCurrentPushingProduct;
|
|
1573
|
+
}()
|
|
1574
|
+
}, {
|
|
1575
|
+
key: "getSupportToDirectBuy",
|
|
1576
|
+
value: function() {
|
|
1577
|
+
var _getSupportToDirectBuy = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee1() {
|
|
1578
|
+
var userInfo, authType, notSupportAuthTypes;
|
|
1579
|
+
return _regenerator$3().w(function(_context1) {
|
|
1580
|
+
while (1) switch (_context1.n) {
|
|
1581
|
+
case 0:
|
|
1582
|
+
_context1.n = 1;
|
|
1583
|
+
return this.getProductPayOrderEnabled();
|
|
1584
|
+
case 1:
|
|
1585
|
+
if (_context1.v) {
|
|
1586
|
+
_context1.n = 2;
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
return _context1.a(2, false);
|
|
1590
|
+
case 2:
|
|
1591
|
+
_context1.n = 3;
|
|
1592
|
+
return this.iarCore.getUserInfo();
|
|
1593
|
+
case 3:
|
|
1594
|
+
userInfo = _context1.v;
|
|
1595
|
+
if (userInfo.unionId) {
|
|
1596
|
+
_context1.n = 4;
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
return _context1.a(2, false);
|
|
1600
|
+
case 4:
|
|
1601
|
+
authType = userInfo.authType;
|
|
1602
|
+
if (!(!authType || authType === AuthType.None)) {
|
|
1603
|
+
_context1.n = 5;
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1606
|
+
return _context1.a(2, true);
|
|
1607
|
+
case 5:
|
|
1608
|
+
notSupportAuthTypes = [AuthType.Custom, AuthType.External, AuthType.Direct, AuthType.EnterpriseWeChat];
|
|
1609
|
+
if (!notSupportAuthTypes.includes(authType)) {
|
|
1610
|
+
_context1.n = 6;
|
|
1611
|
+
break;
|
|
1612
|
+
}
|
|
1613
|
+
return _context1.a(2, false);
|
|
1614
|
+
case 6:
|
|
1615
|
+
return _context1.a(2, true);
|
|
1616
|
+
}
|
|
1617
|
+
}, _callee1, this);
|
|
1618
|
+
}));
|
|
1619
|
+
function getSupportToDirectBuy() {
|
|
1620
|
+
return _getSupportToDirectBuy.apply(this, arguments);
|
|
1621
|
+
}
|
|
1622
|
+
return getSupportToDirectBuy;
|
|
1623
|
+
}()
|
|
1624
|
+
}]);
|
|
1625
|
+
}();
|
|
1626
|
+
var PaymentProvider = /* @__PURE__ */ function(PaymentProvider2) {
|
|
693
1627
|
PaymentProvider2["Wechat"] = "WECHAT";
|
|
694
1628
|
PaymentProvider2["Alipay"] = "ALIPAY";
|
|
695
1629
|
return PaymentProvider2;
|
|
696
|
-
}
|
|
697
|
-
var OrderStatus = /* @__PURE__ */ (
|
|
1630
|
+
}({});
|
|
1631
|
+
var OrderStatus = /* @__PURE__ */ function(OrderStatus2) {
|
|
698
1632
|
OrderStatus2["WaitPay"] = "wait_pay";
|
|
699
1633
|
OrderStatus2["WaitDelivery"] = "wait_delivery";
|
|
700
1634
|
OrderStatus2["Delivering"] = "delivering";
|
|
@@ -703,27 +1637,73 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
703
1637
|
OrderStatus2["Refunding"] = "refunding";
|
|
704
1638
|
OrderStatus2["Refunded"] = "refunded";
|
|
705
1639
|
return OrderStatus2;
|
|
706
|
-
}
|
|
707
|
-
var PayStatus = /* @__PURE__ */ (
|
|
1640
|
+
}({});
|
|
1641
|
+
var PayStatus = /* @__PURE__ */ function(PayStatus2) {
|
|
708
1642
|
PayStatus2["WaitPay"] = "wait_pay";
|
|
709
1643
|
PayStatus2["Payed"] = "payed";
|
|
710
1644
|
PayStatus2["Free"] = "free";
|
|
711
1645
|
return PayStatus2;
|
|
712
|
-
}
|
|
713
|
-
var RefundStatus = /* @__PURE__ */ (
|
|
1646
|
+
}({});
|
|
1647
|
+
var RefundStatus = /* @__PURE__ */ function(RefundStatus2) {
|
|
714
1648
|
RefundStatus2["Success"] = "SUCCESS";
|
|
715
1649
|
RefundStatus2["Fail"] = "FAIL";
|
|
716
1650
|
RefundStatus2["Processing"] = "PROCESSING";
|
|
717
1651
|
return RefundStatus2;
|
|
718
|
-
}
|
|
719
|
-
var CreateOrderFailReason = /* @__PURE__ */ (
|
|
1652
|
+
}({});
|
|
1653
|
+
var CreateOrderFailReason = /* @__PURE__ */ function(CreateOrderFailReason2) {
|
|
720
1654
|
CreateOrderFailReason2["Unknown"] = "unknown";
|
|
721
1655
|
return CreateOrderFailReason2;
|
|
722
|
-
}
|
|
723
|
-
var OrderRefundFailReason = /* @__PURE__ */ (
|
|
1656
|
+
}({});
|
|
1657
|
+
var OrderRefundFailReason = /* @__PURE__ */ function(OrderRefundFailReason2) {
|
|
724
1658
|
OrderRefundFailReason2["Unknown"] = "unknown";
|
|
725
1659
|
return OrderRefundFailReason2;
|
|
726
|
-
}
|
|
1660
|
+
}({});
|
|
1661
|
+
function _typeof$3(o) {
|
|
1662
|
+
"@babel/helpers - typeof";
|
|
1663
|
+
return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
1664
|
+
return typeof o2;
|
|
1665
|
+
} : function(o2) {
|
|
1666
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
1667
|
+
}, _typeof$3(o);
|
|
1668
|
+
}
|
|
1669
|
+
function ownKeys$2(e, r) {
|
|
1670
|
+
var t = Object.keys(e);
|
|
1671
|
+
if (Object.getOwnPropertySymbols) {
|
|
1672
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1673
|
+
r && (o = o.filter(function(r2) {
|
|
1674
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
1675
|
+
})), t.push.apply(t, o);
|
|
1676
|
+
}
|
|
1677
|
+
return t;
|
|
1678
|
+
}
|
|
1679
|
+
function _objectSpread$2(e) {
|
|
1680
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1681
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1682
|
+
r % 2 ? ownKeys$2(Object(t), true).forEach(function(r2) {
|
|
1683
|
+
_defineProperty$3(e, r2, t[r2]);
|
|
1684
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r2) {
|
|
1685
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
return e;
|
|
1689
|
+
}
|
|
1690
|
+
function _defineProperty$3(e, r, t) {
|
|
1691
|
+
return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
1692
|
+
}
|
|
1693
|
+
function _toPropertyKey$3(t) {
|
|
1694
|
+
var i = _toPrimitive$3(t, "string");
|
|
1695
|
+
return "symbol" == _typeof$3(i) ? i : i + "";
|
|
1696
|
+
}
|
|
1697
|
+
function _toPrimitive$3(t, r) {
|
|
1698
|
+
if ("object" != _typeof$3(t) || !t) return t;
|
|
1699
|
+
var e = t[Symbol.toPrimitive];
|
|
1700
|
+
if (void 0 !== e) {
|
|
1701
|
+
var i = e.call(t, r);
|
|
1702
|
+
if ("object" != _typeof$3(i)) return i;
|
|
1703
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1704
|
+
}
|
|
1705
|
+
return ("string" === r ? String : Number)(t);
|
|
1706
|
+
}
|
|
727
1707
|
function mapInternalProductToOrderProduct(internalProduct) {
|
|
728
1708
|
return {
|
|
729
1709
|
customerServiceContact: internalProduct.customerServiceContact,
|
|
@@ -757,7 +1737,7 @@ function mapInternalAddressToExpressInfo(internalAddress) {
|
|
|
757
1737
|
};
|
|
758
1738
|
}
|
|
759
1739
|
function mapInternalOrderToOrderData(internalOrder) {
|
|
760
|
-
|
|
1740
|
+
var basicDataForList = {
|
|
761
1741
|
amount: internalOrder.amount,
|
|
762
1742
|
channelId: internalOrder.channelId,
|
|
763
1743
|
products: internalOrder.products.map(mapInternalProductToOrderProduct),
|
|
@@ -766,27 +1746,24 @@ function mapInternalOrderToOrderData(internalOrder) {
|
|
|
766
1746
|
};
|
|
767
1747
|
switch (internalOrder.status) {
|
|
768
1748
|
case OrderStatus.WaitPay:
|
|
769
|
-
return {
|
|
770
|
-
...basicDataForList,
|
|
1749
|
+
return _objectSpread$2(_objectSpread$2({}, basicDataForList), {}, {
|
|
771
1750
|
status: OrderStatus.WaitPay,
|
|
772
1751
|
expiredAt: internalOrder.expireTime
|
|
773
|
-
};
|
|
1752
|
+
});
|
|
774
1753
|
case OrderStatus.Close:
|
|
775
|
-
return {
|
|
776
|
-
...basicDataForList,
|
|
1754
|
+
return _objectSpread$2(_objectSpread$2({}, basicDataForList), {}, {
|
|
777
1755
|
status: OrderStatus.Close,
|
|
778
1756
|
expiredAt: internalOrder.expireTime
|
|
779
|
-
};
|
|
1757
|
+
});
|
|
780
1758
|
default:
|
|
781
|
-
return {
|
|
782
|
-
...basicDataForList,
|
|
1759
|
+
return _objectSpread$2(_objectSpread$2({}, basicDataForList), {}, {
|
|
783
1760
|
status: internalOrder.status
|
|
784
|
-
};
|
|
1761
|
+
});
|
|
785
1762
|
}
|
|
786
1763
|
}
|
|
787
1764
|
function mapInternalOrderDetailToOrderData(detail) {
|
|
788
|
-
|
|
789
|
-
|
|
1765
|
+
var expressInfo = mapInternalAddressToExpressInfo(detail.addressExt);
|
|
1766
|
+
var basicData = {
|
|
790
1767
|
amount: detail.amount,
|
|
791
1768
|
channelId: null,
|
|
792
1769
|
products: detail.products.map(mapInternalProductToOrderProduct),
|
|
@@ -798,61 +1775,53 @@ function mapInternalOrderDetailToOrderData(detail) {
|
|
|
798
1775
|
};
|
|
799
1776
|
switch (detail.status) {
|
|
800
1777
|
case OrderStatus.WaitPay:
|
|
801
|
-
return {
|
|
802
|
-
...basicData,
|
|
1778
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
803
1779
|
status: OrderStatus.WaitPay,
|
|
804
1780
|
expiredAt: detail.expireTime
|
|
805
|
-
};
|
|
1781
|
+
});
|
|
806
1782
|
case OrderStatus.WaitDelivery:
|
|
807
|
-
return {
|
|
808
|
-
...basicData,
|
|
1783
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
809
1784
|
status: OrderStatus.WaitDelivery,
|
|
810
1785
|
payAt: detail.payTime
|
|
811
|
-
};
|
|
1786
|
+
});
|
|
812
1787
|
case OrderStatus.Delivering:
|
|
813
|
-
return {
|
|
814
|
-
...basicData,
|
|
1788
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
815
1789
|
status: OrderStatus.Delivering,
|
|
816
1790
|
payAt: detail.payTime,
|
|
817
1791
|
deliveryAt: detail.deliveryTime
|
|
818
|
-
};
|
|
1792
|
+
});
|
|
819
1793
|
case OrderStatus.Finish:
|
|
820
|
-
return {
|
|
821
|
-
...basicData,
|
|
1794
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
822
1795
|
status: OrderStatus.Finish,
|
|
823
1796
|
payAt: detail.payTime,
|
|
824
1797
|
deliveryAt: detail.deliveryTime,
|
|
825
1798
|
finishAt: detail.finishTime
|
|
826
|
-
};
|
|
1799
|
+
});
|
|
827
1800
|
case OrderStatus.Close:
|
|
828
|
-
return {
|
|
829
|
-
...basicData,
|
|
1801
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
830
1802
|
status: OrderStatus.Close,
|
|
831
1803
|
expiredAt: detail.expireTime
|
|
832
|
-
};
|
|
1804
|
+
});
|
|
833
1805
|
case OrderStatus.Refunding:
|
|
834
|
-
return {
|
|
835
|
-
...basicData,
|
|
1806
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
836
1807
|
status: OrderStatus.Refunding,
|
|
837
1808
|
payAt: detail.payTime,
|
|
838
1809
|
refundAt: detail.refundTime,
|
|
839
1810
|
deliveryAt: detail.deliveryTime
|
|
840
|
-
};
|
|
1811
|
+
});
|
|
841
1812
|
case OrderStatus.Refunded:
|
|
842
|
-
return {
|
|
843
|
-
...basicData,
|
|
1813
|
+
return _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
844
1814
|
status: OrderStatus.Refunded,
|
|
845
1815
|
payAt: detail.payTime,
|
|
846
1816
|
refundAt: detail.refundTime,
|
|
847
1817
|
deliveryAt: detail.deliveryTime,
|
|
848
1818
|
expiredAt: detail.expireTime
|
|
849
|
-
};
|
|
1819
|
+
});
|
|
850
1820
|
default: {
|
|
851
|
-
console.error(
|
|
852
|
-
|
|
853
|
-
...basicData,
|
|
1821
|
+
console.error("Unknown order status:".concat(detail.status));
|
|
1822
|
+
var fallback = _objectSpread$2(_objectSpread$2({}, basicData), {}, {
|
|
854
1823
|
status: detail.status
|
|
855
|
-
};
|
|
1824
|
+
});
|
|
856
1825
|
return fallback;
|
|
857
1826
|
}
|
|
858
1827
|
}
|
|
@@ -865,144 +1834,333 @@ function mapInternalCreateOrderResponse(data) {
|
|
|
865
1834
|
payStatus: data.payStatus,
|
|
866
1835
|
wxAppId: data.appId,
|
|
867
1836
|
nonceStr: data.nonceStr,
|
|
868
|
-
package: data.prepayId,
|
|
1837
|
+
"package": data.prepayId,
|
|
869
1838
|
paySign: data.paySign,
|
|
870
1839
|
signType: data.signType,
|
|
871
1840
|
timeStamp: Number(data.timeStamp),
|
|
872
1841
|
payProvider: data.payProvider
|
|
873
1842
|
};
|
|
874
1843
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
1844
|
+
function _typeof$2(o) {
|
|
1845
|
+
"@babel/helpers - typeof";
|
|
1846
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
1847
|
+
return typeof o2;
|
|
1848
|
+
} : function(o2) {
|
|
1849
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
1850
|
+
}, _typeof$2(o);
|
|
1851
|
+
}
|
|
1852
|
+
function ownKeys$1(e, r) {
|
|
1853
|
+
var t = Object.keys(e);
|
|
1854
|
+
if (Object.getOwnPropertySymbols) {
|
|
1855
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1856
|
+
r && (o = o.filter(function(r2) {
|
|
1857
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
1858
|
+
})), t.push.apply(t, o);
|
|
888
1859
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const { pageNumber = 1, pageSize = 10, orderStatus } = params;
|
|
900
|
-
const res = await this.iarCore.polyvApi.get(
|
|
901
|
-
PolyvApiUrl.GetOrderList,
|
|
902
|
-
{
|
|
903
|
-
pageNumber,
|
|
904
|
-
pageSize,
|
|
905
|
-
orderStatus
|
|
906
|
-
}
|
|
907
|
-
);
|
|
908
|
-
return {
|
|
909
|
-
pageNumber: res.pageNumber,
|
|
910
|
-
pageSize: res.pageSize,
|
|
911
|
-
totalItems: res.totalItems,
|
|
912
|
-
totalPages: res.totalPages,
|
|
913
|
-
contents: res.contents.map(mapInternalOrderToOrderData)
|
|
914
|
-
};
|
|
1860
|
+
return t;
|
|
1861
|
+
}
|
|
1862
|
+
function _objectSpread$1(e) {
|
|
1863
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1864
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1865
|
+
r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
|
|
1866
|
+
_defineProperty$2(e, r2, t[r2]);
|
|
1867
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
|
|
1868
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
1869
|
+
});
|
|
915
1870
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1871
|
+
return e;
|
|
1872
|
+
}
|
|
1873
|
+
function _regenerator$2() {
|
|
1874
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
1875
|
+
var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag";
|
|
1876
|
+
function i(r2, n2, o2, i2) {
|
|
1877
|
+
var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype);
|
|
1878
|
+
return _regeneratorDefine2$2(u2, "_invoke", function(r3, n3, o3) {
|
|
1879
|
+
var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d2(t2, r4) {
|
|
1880
|
+
return i3 = t2, c3 = 0, u3 = e, G.n = r4, a;
|
|
1881
|
+
} };
|
|
1882
|
+
function d(r4, n4) {
|
|
1883
|
+
for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) {
|
|
1884
|
+
var o4, i4 = p[t], d2 = G.p, l = i4[2];
|
|
1885
|
+
r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0));
|
|
1886
|
+
}
|
|
1887
|
+
if (o4 || r4 > 1) return a;
|
|
1888
|
+
throw y = true, n4;
|
|
931
1889
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
params
|
|
953
|
-
);
|
|
954
|
-
return {
|
|
955
|
-
success: true,
|
|
956
|
-
...mapInternalCreateOrderResponse(res)
|
|
957
|
-
};
|
|
958
|
-
} catch (err) {
|
|
959
|
-
return {
|
|
960
|
-
success: false,
|
|
961
|
-
failReason: CreateOrderFailReason.Unknown,
|
|
962
|
-
failMessage: err instanceof Error ? err.message : void 0
|
|
1890
|
+
return function(o4, p2, l) {
|
|
1891
|
+
if (f2 > 1) throw TypeError("Generator is already running");
|
|
1892
|
+
for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) {
|
|
1893
|
+
i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3);
|
|
1894
|
+
try {
|
|
1895
|
+
if (f2 = 2, i3) {
|
|
1896
|
+
if (c3 || (o4 = "next"), t = i3[o4]) {
|
|
1897
|
+
if (!(t = t.call(i3, u3))) throw TypeError("iterator result is not an object");
|
|
1898
|
+
if (!t.done) return t;
|
|
1899
|
+
u3 = t.value, c3 < 2 && (c3 = 0);
|
|
1900
|
+
} else 1 === c3 && (t = i3["return"]) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1);
|
|
1901
|
+
i3 = e;
|
|
1902
|
+
} else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) break;
|
|
1903
|
+
} catch (t2) {
|
|
1904
|
+
i3 = e, c3 = 1, u3 = t2;
|
|
1905
|
+
} finally {
|
|
1906
|
+
f2 = 1;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return { value: t, done: y };
|
|
963
1910
|
};
|
|
964
|
-
}
|
|
1911
|
+
}(r2, o2, i2), true), u2;
|
|
965
1912
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
return this
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1913
|
+
var a = {};
|
|
1914
|
+
function Generator() {
|
|
1915
|
+
}
|
|
1916
|
+
function GeneratorFunction() {
|
|
1917
|
+
}
|
|
1918
|
+
function GeneratorFunctionPrototype() {
|
|
1919
|
+
}
|
|
1920
|
+
t = Object.getPrototypeOf;
|
|
1921
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$2(t = {}, n, function() {
|
|
1922
|
+
return this;
|
|
1923
|
+
}), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
1924
|
+
function f(e2) {
|
|
1925
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$2(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2;
|
|
1926
|
+
}
|
|
1927
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$2(u), _regeneratorDefine2$2(u, o, "Generator"), _regeneratorDefine2$2(u, n, function() {
|
|
1928
|
+
return this;
|
|
1929
|
+
}), _regeneratorDefine2$2(u, "toString", function() {
|
|
1930
|
+
return "[object Generator]";
|
|
1931
|
+
}), (_regenerator$2 = function _regenerator2() {
|
|
1932
|
+
return { w: i, m: f };
|
|
1933
|
+
})();
|
|
1934
|
+
}
|
|
1935
|
+
function _regeneratorDefine2$2(e, r, n, t) {
|
|
1936
|
+
var i = Object.defineProperty;
|
|
1937
|
+
try {
|
|
1938
|
+
i({}, "", {});
|
|
1939
|
+
} catch (e2) {
|
|
1940
|
+
i = 0;
|
|
1941
|
+
}
|
|
1942
|
+
_regeneratorDefine2$2 = function _regeneratorDefine(e2, r2, n2, t2) {
|
|
1943
|
+
if (r2) i ? i(e2, r2, { value: n2, enumerable: !t2, configurable: !t2, writable: !t2 }) : e2[r2] = n2;
|
|
1944
|
+
else {
|
|
1945
|
+
var o = function o2(r3, n3) {
|
|
1946
|
+
_regeneratorDefine2$2(e2, r3, function(e3) {
|
|
1947
|
+
return this._invoke(r3, n3, e3);
|
|
1948
|
+
});
|
|
1002
1949
|
};
|
|
1950
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
1003
1951
|
}
|
|
1952
|
+
}, _regeneratorDefine2$2(e, r, n, t);
|
|
1953
|
+
}
|
|
1954
|
+
function asyncGeneratorStep$2(n, t, e, r, o, a, c) {
|
|
1955
|
+
try {
|
|
1956
|
+
var i = n[a](c), u = i.value;
|
|
1957
|
+
} catch (n2) {
|
|
1958
|
+
return void e(n2);
|
|
1959
|
+
}
|
|
1960
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
1961
|
+
}
|
|
1962
|
+
function _asyncToGenerator$2(n) {
|
|
1963
|
+
return function() {
|
|
1964
|
+
var t = this, e = arguments;
|
|
1965
|
+
return new Promise(function(r, o) {
|
|
1966
|
+
var a = n.apply(t, e);
|
|
1967
|
+
function _next(n2) {
|
|
1968
|
+
asyncGeneratorStep$2(a, r, o, _next, _throw, "next", n2);
|
|
1969
|
+
}
|
|
1970
|
+
function _throw(n2) {
|
|
1971
|
+
asyncGeneratorStep$2(a, r, o, _next, _throw, "throw", n2);
|
|
1972
|
+
}
|
|
1973
|
+
_next(void 0);
|
|
1974
|
+
});
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
function _classCallCheck$2(a, n) {
|
|
1978
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
1979
|
+
}
|
|
1980
|
+
function _defineProperties$2(e, r) {
|
|
1981
|
+
for (var t = 0; t < r.length; t++) {
|
|
1982
|
+
var o = r[t];
|
|
1983
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
function _createClass$2(e, r, t) {
|
|
1987
|
+
return r && _defineProperties$2(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
1988
|
+
}
|
|
1989
|
+
function _defineProperty$2(e, r, t) {
|
|
1990
|
+
return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
1991
|
+
}
|
|
1992
|
+
function _toPropertyKey$2(t) {
|
|
1993
|
+
var i = _toPrimitive$2(t, "string");
|
|
1994
|
+
return "symbol" == _typeof$2(i) ? i : i + "";
|
|
1995
|
+
}
|
|
1996
|
+
function _toPrimitive$2(t, r) {
|
|
1997
|
+
if ("object" != _typeof$2(t) || !t) return t;
|
|
1998
|
+
var e = t[Symbol.toPrimitive];
|
|
1999
|
+
if (void 0 !== e) {
|
|
2000
|
+
var i = e.call(t, r);
|
|
2001
|
+
if ("object" != _typeof$2(i)) return i;
|
|
2002
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1004
2003
|
}
|
|
2004
|
+
return String(t);
|
|
1005
2005
|
}
|
|
2006
|
+
var Order = /* @__PURE__ */ function() {
|
|
2007
|
+
function Order2(iarCore, config) {
|
|
2008
|
+
_classCallCheck$2(this, Order2);
|
|
2009
|
+
_defineProperty$2(this, "OrderStatus", OrderStatus);
|
|
2010
|
+
_defineProperty$2(this, "PayStatus", PayStatus);
|
|
2011
|
+
_defineProperty$2(this, "PaymentProvider", PaymentProvider);
|
|
2012
|
+
_defineProperty$2(this, "ProductBuyType", ProductBuyType);
|
|
2013
|
+
_defineProperty$2(this, "ProductType", ProductType);
|
|
2014
|
+
_defineProperty$2(this, "ProductDeliveryType", ProductDeliveryType);
|
|
2015
|
+
_defineProperty$2(this, "RefundStatus", RefundStatus);
|
|
2016
|
+
_defineProperty$2(this, "CreateOrderFailReason", CreateOrderFailReason);
|
|
2017
|
+
_defineProperty$2(this, "OrderRefundFailReason", OrderRefundFailReason);
|
|
2018
|
+
this.iarCore = iarCore;
|
|
2019
|
+
this.config = config;
|
|
2020
|
+
}
|
|
2021
|
+
return _createClass$2(Order2, [{
|
|
2022
|
+
key: "getOrderList",
|
|
2023
|
+
value: function() {
|
|
2024
|
+
var _getOrderList = _asyncToGenerator$2(/* @__PURE__ */ _regenerator$2().m(function _callee() {
|
|
2025
|
+
var params, _params$pageNumber, pageNumber, _params$pageSize, pageSize, orderStatus, res, _args = arguments;
|
|
2026
|
+
return _regenerator$2().w(function(_context) {
|
|
2027
|
+
while (1) switch (_context.n) {
|
|
2028
|
+
case 0:
|
|
2029
|
+
params = _args.length > 0 && _args[0] !== void 0 ? _args[0] : {};
|
|
2030
|
+
_params$pageNumber = params.pageNumber, pageNumber = _params$pageNumber === void 0 ? 1 : _params$pageNumber, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 10 : _params$pageSize, orderStatus = params.orderStatus;
|
|
2031
|
+
_context.n = 1;
|
|
2032
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetOrderList, {
|
|
2033
|
+
pageNumber,
|
|
2034
|
+
pageSize,
|
|
2035
|
+
orderStatus
|
|
2036
|
+
});
|
|
2037
|
+
case 1:
|
|
2038
|
+
res = _context.v;
|
|
2039
|
+
return _context.a(2, {
|
|
2040
|
+
pageNumber: res.pageNumber,
|
|
2041
|
+
pageSize: res.pageSize,
|
|
2042
|
+
totalItems: res.totalItems,
|
|
2043
|
+
totalPages: res.totalPages,
|
|
2044
|
+
contents: res.contents.map(mapInternalOrderToOrderData)
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
}, _callee, this);
|
|
2048
|
+
}));
|
|
2049
|
+
function getOrderList() {
|
|
2050
|
+
return _getOrderList.apply(this, arguments);
|
|
2051
|
+
}
|
|
2052
|
+
return getOrderList;
|
|
2053
|
+
}()
|
|
2054
|
+
}, {
|
|
2055
|
+
key: "getOrderDetail",
|
|
2056
|
+
value: function() {
|
|
2057
|
+
var _getOrderDetail = _asyncToGenerator$2(/* @__PURE__ */ _regenerator$2().m(function _callee2(params) {
|
|
2058
|
+
var internalDetail;
|
|
2059
|
+
return _regenerator$2().w(function(_context2) {
|
|
2060
|
+
while (1) switch (_context2.n) {
|
|
2061
|
+
case 0:
|
|
2062
|
+
_context2.n = 1;
|
|
2063
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetOrderDetail, {
|
|
2064
|
+
orderNo: params.orderNo,
|
|
2065
|
+
syncPayStatus: boolToYN(params.syncPayStatus)
|
|
2066
|
+
});
|
|
2067
|
+
case 1:
|
|
2068
|
+
internalDetail = _context2.v;
|
|
2069
|
+
return _context2.a(2, mapInternalOrderDetailToOrderData(internalDetail));
|
|
2070
|
+
}
|
|
2071
|
+
}, _callee2, this);
|
|
2072
|
+
}));
|
|
2073
|
+
function getOrderDetail(_x) {
|
|
2074
|
+
return _getOrderDetail.apply(this, arguments);
|
|
2075
|
+
}
|
|
2076
|
+
return getOrderDetail;
|
|
2077
|
+
}()
|
|
2078
|
+
}, {
|
|
2079
|
+
key: "createOrder",
|
|
2080
|
+
value: function() {
|
|
2081
|
+
var _createOrder = _asyncToGenerator$2(/* @__PURE__ */ _regenerator$2().m(function _callee3(params) {
|
|
2082
|
+
var res, _t;
|
|
2083
|
+
return _regenerator$2().w(function(_context3) {
|
|
2084
|
+
while (1) switch (_context3.n) {
|
|
2085
|
+
case 0:
|
|
2086
|
+
_context3.p = 0;
|
|
2087
|
+
_context3.n = 1;
|
|
2088
|
+
return this.iarCore.polyvApi.post(PolyvApiUrl.CreateOrder, params);
|
|
2089
|
+
case 1:
|
|
2090
|
+
res = _context3.v;
|
|
2091
|
+
return _context3.a(2, _objectSpread$1({
|
|
2092
|
+
success: true
|
|
2093
|
+
}, mapInternalCreateOrderResponse(res)));
|
|
2094
|
+
case 2:
|
|
2095
|
+
_context3.p = 2;
|
|
2096
|
+
_t = _context3.v;
|
|
2097
|
+
return _context3.a(2, {
|
|
2098
|
+
success: false,
|
|
2099
|
+
failReason: CreateOrderFailReason.Unknown,
|
|
2100
|
+
failMessage: _t instanceof Error ? _t.message : void 0
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
}, _callee3, this, [[0, 2]]);
|
|
2104
|
+
}));
|
|
2105
|
+
function createOrder(_x2) {
|
|
2106
|
+
return _createOrder.apply(this, arguments);
|
|
2107
|
+
}
|
|
2108
|
+
return createOrder;
|
|
2109
|
+
}()
|
|
2110
|
+
}, {
|
|
2111
|
+
key: "confirmOrder",
|
|
2112
|
+
value: function() {
|
|
2113
|
+
var _confirmOrder = _asyncToGenerator$2(/* @__PURE__ */ _regenerator$2().m(function _callee4(orderNo) {
|
|
2114
|
+
return _regenerator$2().w(function(_context4) {
|
|
2115
|
+
while (1) switch (_context4.n) {
|
|
2116
|
+
case 0:
|
|
2117
|
+
return _context4.a(2, this.iarCore.polyvApi.post(concat(PolyvApiUrl.ConfirmOrder, {
|
|
2118
|
+
orderNo
|
|
2119
|
+
}), {}));
|
|
2120
|
+
}
|
|
2121
|
+
}, _callee4, this);
|
|
2122
|
+
}));
|
|
2123
|
+
function confirmOrder(_x3) {
|
|
2124
|
+
return _confirmOrder.apply(this, arguments);
|
|
2125
|
+
}
|
|
2126
|
+
return confirmOrder;
|
|
2127
|
+
}()
|
|
2128
|
+
}, {
|
|
2129
|
+
key: "applyOrderRefund",
|
|
2130
|
+
value: function() {
|
|
2131
|
+
var _applyOrderRefund = _asyncToGenerator$2(/* @__PURE__ */ _regenerator$2().m(function _callee5(orderNo) {
|
|
2132
|
+
var res, _t2;
|
|
2133
|
+
return _regenerator$2().w(function(_context5) {
|
|
2134
|
+
while (1) switch (_context5.n) {
|
|
2135
|
+
case 0:
|
|
2136
|
+
_context5.p = 0;
|
|
2137
|
+
_context5.n = 1;
|
|
2138
|
+
return this.iarCore.polyvApi.post(PolyvApiUrl.ApplyOrderRefund, {
|
|
2139
|
+
orderNo
|
|
2140
|
+
});
|
|
2141
|
+
case 1:
|
|
2142
|
+
res = _context5.v;
|
|
2143
|
+
return _context5.a(2, _objectSpread$1({
|
|
2144
|
+
success: true
|
|
2145
|
+
}, res));
|
|
2146
|
+
case 2:
|
|
2147
|
+
_context5.p = 2;
|
|
2148
|
+
_t2 = _context5.v;
|
|
2149
|
+
return _context5.a(2, {
|
|
2150
|
+
success: false,
|
|
2151
|
+
failReason: OrderRefundFailReason.Unknown,
|
|
2152
|
+
failMessage: _t2 instanceof Error ? _t2.message : void 0
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
}, _callee5, this, [[0, 2]]);
|
|
2156
|
+
}));
|
|
2157
|
+
function applyOrderRefund(_x4) {
|
|
2158
|
+
return _applyOrderRefund.apply(this, arguments);
|
|
2159
|
+
}
|
|
2160
|
+
return applyOrderRefund;
|
|
2161
|
+
}()
|
|
2162
|
+
}]);
|
|
2163
|
+
}();
|
|
1006
2164
|
function mapInternalAddressToAddressData(data) {
|
|
1007
2165
|
if (!data) {
|
|
1008
2166
|
return {
|
|
@@ -1021,160 +2179,505 @@ function mapInternalAddressToAddressData(data) {
|
|
|
1021
2179
|
name: data.name
|
|
1022
2180
|
};
|
|
1023
2181
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
2182
|
+
function _typeof$1(o) {
|
|
2183
|
+
"@babel/helpers - typeof";
|
|
2184
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
2185
|
+
return typeof o2;
|
|
2186
|
+
} : function(o2) {
|
|
2187
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
2188
|
+
}, _typeof$1(o);
|
|
2189
|
+
}
|
|
2190
|
+
function _regenerator$1() {
|
|
2191
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
2192
|
+
var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag";
|
|
2193
|
+
function i(r2, n2, o2, i2) {
|
|
2194
|
+
var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype);
|
|
2195
|
+
return _regeneratorDefine2$1(u2, "_invoke", function(r3, n3, o3) {
|
|
2196
|
+
var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d2(t2, r4) {
|
|
2197
|
+
return i3 = t2, c3 = 0, u3 = e, G.n = r4, a;
|
|
2198
|
+
} };
|
|
2199
|
+
function d(r4, n4) {
|
|
2200
|
+
for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) {
|
|
2201
|
+
var o4, i4 = p[t], d2 = G.p, l = i4[2];
|
|
2202
|
+
r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0));
|
|
2203
|
+
}
|
|
2204
|
+
if (o4 || r4 > 1) return a;
|
|
2205
|
+
throw y = true, n4;
|
|
2206
|
+
}
|
|
2207
|
+
return function(o4, p2, l) {
|
|
2208
|
+
if (f2 > 1) throw TypeError("Generator is already running");
|
|
2209
|
+
for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) {
|
|
2210
|
+
i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3);
|
|
2211
|
+
try {
|
|
2212
|
+
if (f2 = 2, i3) {
|
|
2213
|
+
if (c3 || (o4 = "next"), t = i3[o4]) {
|
|
2214
|
+
if (!(t = t.call(i3, u3))) throw TypeError("iterator result is not an object");
|
|
2215
|
+
if (!t.done) return t;
|
|
2216
|
+
u3 = t.value, c3 < 2 && (c3 = 0);
|
|
2217
|
+
} else 1 === c3 && (t = i3["return"]) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1);
|
|
2218
|
+
i3 = e;
|
|
2219
|
+
} else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) break;
|
|
2220
|
+
} catch (t2) {
|
|
2221
|
+
i3 = e, c3 = 1, u3 = t2;
|
|
2222
|
+
} finally {
|
|
2223
|
+
f2 = 1;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
return { value: t, done: y };
|
|
2227
|
+
};
|
|
2228
|
+
}(r2, o2, i2), true), u2;
|
|
2229
|
+
}
|
|
2230
|
+
var a = {};
|
|
2231
|
+
function Generator() {
|
|
2232
|
+
}
|
|
2233
|
+
function GeneratorFunction() {
|
|
2234
|
+
}
|
|
2235
|
+
function GeneratorFunctionPrototype() {
|
|
1028
2236
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
2237
|
+
t = Object.getPrototypeOf;
|
|
2238
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2$1(t = {}, n, function() {
|
|
2239
|
+
return this;
|
|
2240
|
+
}), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
2241
|
+
function f(e2) {
|
|
2242
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2$1(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2;
|
|
2243
|
+
}
|
|
2244
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2$1(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2$1(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2$1(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2$1(u), _regeneratorDefine2$1(u, o, "Generator"), _regeneratorDefine2$1(u, n, function() {
|
|
2245
|
+
return this;
|
|
2246
|
+
}), _regeneratorDefine2$1(u, "toString", function() {
|
|
2247
|
+
return "[object Generator]";
|
|
2248
|
+
}), (_regenerator$1 = function _regenerator2() {
|
|
2249
|
+
return { w: i, m: f };
|
|
2250
|
+
})();
|
|
2251
|
+
}
|
|
2252
|
+
function _regeneratorDefine2$1(e, r, n, t) {
|
|
2253
|
+
var i = Object.defineProperty;
|
|
2254
|
+
try {
|
|
2255
|
+
i({}, "", {});
|
|
2256
|
+
} catch (e2) {
|
|
2257
|
+
i = 0;
|
|
2258
|
+
}
|
|
2259
|
+
_regeneratorDefine2$1 = function _regeneratorDefine(e2, r2, n2, t2) {
|
|
2260
|
+
if (r2) i ? i(e2, r2, { value: n2, enumerable: !t2, configurable: !t2, writable: !t2 }) : e2[r2] = n2;
|
|
2261
|
+
else {
|
|
2262
|
+
var o = function o2(r3, n3) {
|
|
2263
|
+
_regeneratorDefine2$1(e2, r3, function(e3) {
|
|
2264
|
+
return this._invoke(r3, n3, e3);
|
|
2265
|
+
});
|
|
2266
|
+
};
|
|
2267
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
2268
|
+
}
|
|
2269
|
+
}, _regeneratorDefine2$1(e, r, n, t);
|
|
2270
|
+
}
|
|
2271
|
+
function ownKeys(e, r) {
|
|
2272
|
+
var t = Object.keys(e);
|
|
2273
|
+
if (Object.getOwnPropertySymbols) {
|
|
2274
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
2275
|
+
r && (o = o.filter(function(r2) {
|
|
2276
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
2277
|
+
})), t.push.apply(t, o);
|
|
2278
|
+
}
|
|
2279
|
+
return t;
|
|
2280
|
+
}
|
|
2281
|
+
function _objectSpread(e) {
|
|
2282
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
2283
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
2284
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
2285
|
+
_defineProperty$1(e, r2, t[r2]);
|
|
2286
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
2287
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
return e;
|
|
2291
|
+
}
|
|
2292
|
+
function _defineProperty$1(e, r, t) {
|
|
2293
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
2294
|
+
}
|
|
2295
|
+
function asyncGeneratorStep$1(n, t, e, r, o, a, c) {
|
|
2296
|
+
try {
|
|
2297
|
+
var i = n[a](c), u = i.value;
|
|
2298
|
+
} catch (n2) {
|
|
2299
|
+
return void e(n2);
|
|
2300
|
+
}
|
|
2301
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
2302
|
+
}
|
|
2303
|
+
function _asyncToGenerator$1(n) {
|
|
2304
|
+
return function() {
|
|
2305
|
+
var t = this, e = arguments;
|
|
2306
|
+
return new Promise(function(r, o) {
|
|
2307
|
+
var a = n.apply(t, e);
|
|
2308
|
+
function _next(n2) {
|
|
2309
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n2);
|
|
1045
2310
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
};
|
|
2311
|
+
function _throw(n2) {
|
|
2312
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n2);
|
|
2313
|
+
}
|
|
2314
|
+
_next(void 0);
|
|
2315
|
+
});
|
|
2316
|
+
};
|
|
2317
|
+
}
|
|
2318
|
+
function _classCallCheck$1(a, n) {
|
|
2319
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2320
|
+
}
|
|
2321
|
+
function _defineProperties$1(e, r) {
|
|
2322
|
+
for (var t = 0; t < r.length; t++) {
|
|
2323
|
+
var o = r[t];
|
|
2324
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
|
|
1051
2325
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
* name: '张三',
|
|
1074
|
-
* area: '广东省/广州市/番禺区',
|
|
1075
|
-
* address: '国家创新创业基地',
|
|
1076
|
-
* });
|
|
1077
|
-
* console.log('新增地址', data);
|
|
1078
|
-
*/
|
|
1079
|
-
async addAddress(params) {
|
|
1080
|
-
const res = await this.iarCore.polyvApi.post(
|
|
1081
|
-
PolyvApiUrl.AddAddress,
|
|
1082
|
-
params
|
|
1083
|
-
);
|
|
1084
|
-
return mapInternalAddressToAddressData(res);
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* 修改地址
|
|
1088
|
-
* @param params 修改地址参数
|
|
1089
|
-
* @example
|
|
1090
|
-
* ```js
|
|
1091
|
-
* await addressTarget.updateAddress({
|
|
1092
|
-
* id: '123',
|
|
1093
|
-
* address: '国家创新创业基地',
|
|
1094
|
-
* area: '广东省/广州市/番禺区',
|
|
1095
|
-
* phone: '13800138000',
|
|
1096
|
-
* name: '张三',
|
|
1097
|
-
* });
|
|
1098
|
-
*/
|
|
1099
|
-
async updateAddress(params) {
|
|
1100
|
-
return await this.iarCore.polyvApi.post(
|
|
1101
|
-
PolyvApiUrl.UpdateAddress,
|
|
1102
|
-
params
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* 删除地址
|
|
1107
|
-
* @param id 地址 id
|
|
1108
|
-
* @example
|
|
1109
|
-
* ```js
|
|
1110
|
-
* await addressTarget.deleteAddress('123');
|
|
1111
|
-
* ```
|
|
1112
|
-
*/
|
|
1113
|
-
async deleteAddress(id) {
|
|
1114
|
-
return await this.iarCore.polyvApi.post(
|
|
1115
|
-
PolyvApiUrl.DeleteAddress,
|
|
1116
|
-
{ id }
|
|
1117
|
-
);
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
class Payment {
|
|
1121
|
-
constructor(iarCore, config) {
|
|
1122
|
-
__publicField(this, "PaymentProvider", PaymentProvider);
|
|
1123
|
-
/** 支付方式缓存 */
|
|
1124
|
-
__publicField(this, "__payProviderCache");
|
|
2326
|
+
}
|
|
2327
|
+
function _createClass$1(e, r, t) {
|
|
2328
|
+
return r && _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
2329
|
+
}
|
|
2330
|
+
function _toPropertyKey$1(t) {
|
|
2331
|
+
var i = _toPrimitive$1(t, "string");
|
|
2332
|
+
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
2333
|
+
}
|
|
2334
|
+
function _toPrimitive$1(t, r) {
|
|
2335
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
2336
|
+
var e = t[Symbol.toPrimitive];
|
|
2337
|
+
if (void 0 !== e) {
|
|
2338
|
+
var i = e.call(t, r);
|
|
2339
|
+
if ("object" != _typeof$1(i)) return i;
|
|
2340
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2341
|
+
}
|
|
2342
|
+
return String(t);
|
|
2343
|
+
}
|
|
2344
|
+
var Address = /* @__PURE__ */ function() {
|
|
2345
|
+
function Address2(iarCore, config) {
|
|
2346
|
+
_classCallCheck$1(this, Address2);
|
|
1125
2347
|
this.iarCore = iarCore;
|
|
1126
2348
|
this.config = config;
|
|
1127
2349
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
return
|
|
2350
|
+
return _createClass$1(Address2, [{
|
|
2351
|
+
key: "getAddressList",
|
|
2352
|
+
value: function() {
|
|
2353
|
+
var _getAddressList = _asyncToGenerator$1(/* @__PURE__ */ _regenerator$1().m(function _callee() {
|
|
2354
|
+
var options, _options$pageNumber, pageNumber, _options$pageSize, pageSize, res, _args = arguments;
|
|
2355
|
+
return _regenerator$1().w(function(_context) {
|
|
2356
|
+
while (1) switch (_context.n) {
|
|
2357
|
+
case 0:
|
|
2358
|
+
options = _args.length > 0 && _args[0] !== void 0 ? _args[0] : {};
|
|
2359
|
+
_options$pageNumber = options.pageNumber, pageNumber = _options$pageNumber === void 0 ? 1 : _options$pageNumber, _options$pageSize = options.pageSize, pageSize = _options$pageSize === void 0 ? 10 : _options$pageSize;
|
|
2360
|
+
_context.n = 1;
|
|
2361
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetAddressList, {
|
|
2362
|
+
pageNumber,
|
|
2363
|
+
pageSize
|
|
2364
|
+
});
|
|
2365
|
+
case 1:
|
|
2366
|
+
res = _context.v;
|
|
2367
|
+
return _context.a(2, _objectSpread(_objectSpread({}, res), {}, {
|
|
2368
|
+
contents: res.contents.map(mapInternalAddressToAddressData)
|
|
2369
|
+
}));
|
|
2370
|
+
}
|
|
2371
|
+
}, _callee, this);
|
|
2372
|
+
}));
|
|
2373
|
+
function getAddressList() {
|
|
2374
|
+
return _getAddressList.apply(this, arguments);
|
|
2375
|
+
}
|
|
2376
|
+
return getAddressList;
|
|
2377
|
+
}()
|
|
2378
|
+
}, {
|
|
2379
|
+
key: "getDefaultAddress",
|
|
2380
|
+
value: function() {
|
|
2381
|
+
var _getDefaultAddress = _asyncToGenerator$1(/* @__PURE__ */ _regenerator$1().m(function _callee2() {
|
|
2382
|
+
var res;
|
|
2383
|
+
return _regenerator$1().w(function(_context2) {
|
|
2384
|
+
while (1) switch (_context2.n) {
|
|
2385
|
+
case 0:
|
|
2386
|
+
_context2.n = 1;
|
|
2387
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.GetDefaultAddress, {});
|
|
2388
|
+
case 1:
|
|
2389
|
+
res = _context2.v;
|
|
2390
|
+
return _context2.a(2, mapInternalAddressToAddressData(res));
|
|
2391
|
+
}
|
|
2392
|
+
}, _callee2, this);
|
|
2393
|
+
}));
|
|
2394
|
+
function getDefaultAddress() {
|
|
2395
|
+
return _getDefaultAddress.apply(this, arguments);
|
|
2396
|
+
}
|
|
2397
|
+
return getDefaultAddress;
|
|
2398
|
+
}()
|
|
2399
|
+
}, {
|
|
2400
|
+
key: "addAddress",
|
|
2401
|
+
value: function() {
|
|
2402
|
+
var _addAddress = _asyncToGenerator$1(/* @__PURE__ */ _regenerator$1().m(function _callee3(params) {
|
|
2403
|
+
var res;
|
|
2404
|
+
return _regenerator$1().w(function(_context3) {
|
|
2405
|
+
while (1) switch (_context3.n) {
|
|
2406
|
+
case 0:
|
|
2407
|
+
_context3.n = 1;
|
|
2408
|
+
return this.iarCore.polyvApi.post(PolyvApiUrl.AddAddress, params);
|
|
2409
|
+
case 1:
|
|
2410
|
+
res = _context3.v;
|
|
2411
|
+
return _context3.a(2, mapInternalAddressToAddressData(res));
|
|
2412
|
+
}
|
|
2413
|
+
}, _callee3, this);
|
|
2414
|
+
}));
|
|
2415
|
+
function addAddress(_x) {
|
|
2416
|
+
return _addAddress.apply(this, arguments);
|
|
2417
|
+
}
|
|
2418
|
+
return addAddress;
|
|
2419
|
+
}()
|
|
2420
|
+
}, {
|
|
2421
|
+
key: "updateAddress",
|
|
2422
|
+
value: function() {
|
|
2423
|
+
var _updateAddress = _asyncToGenerator$1(/* @__PURE__ */ _regenerator$1().m(function _callee4(params) {
|
|
2424
|
+
return _regenerator$1().w(function(_context4) {
|
|
2425
|
+
while (1) switch (_context4.n) {
|
|
2426
|
+
case 0:
|
|
2427
|
+
_context4.n = 1;
|
|
2428
|
+
return this.iarCore.polyvApi.post(PolyvApiUrl.UpdateAddress, params);
|
|
2429
|
+
case 1:
|
|
2430
|
+
return _context4.a(2, _context4.v);
|
|
2431
|
+
}
|
|
2432
|
+
}, _callee4, this);
|
|
2433
|
+
}));
|
|
2434
|
+
function updateAddress(_x2) {
|
|
2435
|
+
return _updateAddress.apply(this, arguments);
|
|
2436
|
+
}
|
|
2437
|
+
return updateAddress;
|
|
2438
|
+
}()
|
|
2439
|
+
}, {
|
|
2440
|
+
key: "deleteAddress",
|
|
2441
|
+
value: function() {
|
|
2442
|
+
var _deleteAddress = _asyncToGenerator$1(/* @__PURE__ */ _regenerator$1().m(function _callee5(id) {
|
|
2443
|
+
return _regenerator$1().w(function(_context5) {
|
|
2444
|
+
while (1) switch (_context5.n) {
|
|
2445
|
+
case 0:
|
|
2446
|
+
_context5.n = 1;
|
|
2447
|
+
return this.iarCore.polyvApi.post(PolyvApiUrl.DeleteAddress, {
|
|
2448
|
+
id
|
|
2449
|
+
});
|
|
2450
|
+
case 1:
|
|
2451
|
+
return _context5.a(2, _context5.v);
|
|
2452
|
+
}
|
|
2453
|
+
}, _callee5, this);
|
|
2454
|
+
}));
|
|
2455
|
+
function deleteAddress(_x3) {
|
|
2456
|
+
return _deleteAddress.apply(this, arguments);
|
|
2457
|
+
}
|
|
2458
|
+
return deleteAddress;
|
|
2459
|
+
}()
|
|
2460
|
+
}]);
|
|
2461
|
+
}();
|
|
2462
|
+
function _typeof(o) {
|
|
2463
|
+
"@babel/helpers - typeof";
|
|
2464
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
2465
|
+
return typeof o2;
|
|
2466
|
+
} : function(o2) {
|
|
2467
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
2468
|
+
}, _typeof(o);
|
|
2469
|
+
}
|
|
2470
|
+
function _regenerator() {
|
|
2471
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
2472
|
+
var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag";
|
|
2473
|
+
function i(r2, n2, o2, i2) {
|
|
2474
|
+
var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype);
|
|
2475
|
+
return _regeneratorDefine2(u2, "_invoke", function(r3, n3, o3) {
|
|
2476
|
+
var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d2(t2, r4) {
|
|
2477
|
+
return i3 = t2, c3 = 0, u3 = e, G.n = r4, a;
|
|
2478
|
+
} };
|
|
2479
|
+
function d(r4, n4) {
|
|
2480
|
+
for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) {
|
|
2481
|
+
var o4, i4 = p[t], d2 = G.p, l = i4[2];
|
|
2482
|
+
r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0));
|
|
2483
|
+
}
|
|
2484
|
+
if (o4 || r4 > 1) return a;
|
|
2485
|
+
throw y = true, n4;
|
|
2486
|
+
}
|
|
2487
|
+
return function(o4, p2, l) {
|
|
2488
|
+
if (f2 > 1) throw TypeError("Generator is already running");
|
|
2489
|
+
for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) {
|
|
2490
|
+
i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3);
|
|
2491
|
+
try {
|
|
2492
|
+
if (f2 = 2, i3) {
|
|
2493
|
+
if (c3 || (o4 = "next"), t = i3[o4]) {
|
|
2494
|
+
if (!(t = t.call(i3, u3))) throw TypeError("iterator result is not an object");
|
|
2495
|
+
if (!t.done) return t;
|
|
2496
|
+
u3 = t.value, c3 < 2 && (c3 = 0);
|
|
2497
|
+
} else 1 === c3 && (t = i3["return"]) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1);
|
|
2498
|
+
i3 = e;
|
|
2499
|
+
} else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) break;
|
|
2500
|
+
} catch (t2) {
|
|
2501
|
+
i3 = e, c3 = 1, u3 = t2;
|
|
2502
|
+
} finally {
|
|
2503
|
+
f2 = 1;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
return { value: t, done: y };
|
|
2507
|
+
};
|
|
2508
|
+
}(r2, o2, i2), true), u2;
|
|
2509
|
+
}
|
|
2510
|
+
var a = {};
|
|
2511
|
+
function Generator() {
|
|
2512
|
+
}
|
|
2513
|
+
function GeneratorFunction() {
|
|
2514
|
+
}
|
|
2515
|
+
function GeneratorFunctionPrototype() {
|
|
2516
|
+
}
|
|
2517
|
+
t = Object.getPrototypeOf;
|
|
2518
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function() {
|
|
2519
|
+
return this;
|
|
2520
|
+
}), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
2521
|
+
function f(e2) {
|
|
2522
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2;
|
|
2523
|
+
}
|
|
2524
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function() {
|
|
2525
|
+
return this;
|
|
2526
|
+
}), _regeneratorDefine2(u, "toString", function() {
|
|
2527
|
+
return "[object Generator]";
|
|
2528
|
+
}), (_regenerator = function _regenerator2() {
|
|
2529
|
+
return { w: i, m: f };
|
|
2530
|
+
})();
|
|
2531
|
+
}
|
|
2532
|
+
function _regeneratorDefine2(e, r, n, t) {
|
|
2533
|
+
var i = Object.defineProperty;
|
|
2534
|
+
try {
|
|
2535
|
+
i({}, "", {});
|
|
2536
|
+
} catch (e2) {
|
|
2537
|
+
i = 0;
|
|
2538
|
+
}
|
|
2539
|
+
_regeneratorDefine2 = function _regeneratorDefine(e2, r2, n2, t2) {
|
|
2540
|
+
if (r2) i ? i(e2, r2, { value: n2, enumerable: !t2, configurable: !t2, writable: !t2 }) : e2[r2] = n2;
|
|
2541
|
+
else {
|
|
2542
|
+
var o = function o2(r3, n3) {
|
|
2543
|
+
_regeneratorDefine2(e2, r3, function(e3) {
|
|
2544
|
+
return this._invoke(r3, n3, e3);
|
|
2545
|
+
});
|
|
2546
|
+
};
|
|
2547
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
1155
2548
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
2549
|
+
}, _regeneratorDefine2(e, r, n, t);
|
|
2550
|
+
}
|
|
2551
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
2552
|
+
try {
|
|
2553
|
+
var i = n[a](c), u = i.value;
|
|
2554
|
+
} catch (n2) {
|
|
2555
|
+
return void e(n2);
|
|
2556
|
+
}
|
|
2557
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
2558
|
+
}
|
|
2559
|
+
function _asyncToGenerator(n) {
|
|
2560
|
+
return function() {
|
|
2561
|
+
var t = this, e = arguments;
|
|
2562
|
+
return new Promise(function(r, o) {
|
|
2563
|
+
var a = n.apply(t, e);
|
|
2564
|
+
function _next(n2) {
|
|
2565
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
|
|
2566
|
+
}
|
|
2567
|
+
function _throw(n2) {
|
|
2568
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
|
|
2569
|
+
}
|
|
2570
|
+
_next(void 0);
|
|
1162
2571
|
});
|
|
1163
|
-
|
|
1164
|
-
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
function _classCallCheck(a, n) {
|
|
2575
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2576
|
+
}
|
|
2577
|
+
function _defineProperties(e, r) {
|
|
2578
|
+
for (var t = 0; t < r.length; t++) {
|
|
2579
|
+
var o = r[t];
|
|
2580
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
1165
2581
|
}
|
|
1166
2582
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
2583
|
+
function _createClass(e, r, t) {
|
|
2584
|
+
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
2585
|
+
}
|
|
2586
|
+
function _defineProperty(e, r, t) {
|
|
2587
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
2588
|
+
}
|
|
2589
|
+
function _toPropertyKey(t) {
|
|
2590
|
+
var i = _toPrimitive(t, "string");
|
|
2591
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
2592
|
+
}
|
|
2593
|
+
function _toPrimitive(t, r) {
|
|
2594
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
2595
|
+
var e = t[Symbol.toPrimitive];
|
|
2596
|
+
if (void 0 !== e) {
|
|
2597
|
+
var i = e.call(t, r);
|
|
2598
|
+
if ("object" != _typeof(i)) return i;
|
|
2599
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2600
|
+
}
|
|
2601
|
+
return String(t);
|
|
2602
|
+
}
|
|
2603
|
+
var Payment = /* @__PURE__ */ function() {
|
|
2604
|
+
function Payment2(iarCore, config) {
|
|
2605
|
+
_classCallCheck(this, Payment2);
|
|
2606
|
+
_defineProperty(this, "PaymentProvider", PaymentProvider);
|
|
2607
|
+
this.iarCore = iarCore;
|
|
2608
|
+
this.config = config;
|
|
2609
|
+
}
|
|
2610
|
+
return _createClass(Payment2, [{
|
|
2611
|
+
key: "getPayOrderParams",
|
|
2612
|
+
value: function() {
|
|
2613
|
+
var _getPayOrderParams = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee(options) {
|
|
2614
|
+
var res;
|
|
2615
|
+
return _regenerator().w(function(_context) {
|
|
2616
|
+
while (1) switch (_context.n) {
|
|
2617
|
+
case 0:
|
|
2618
|
+
_context.n = 1;
|
|
2619
|
+
return this.iarCore.polyvApi.get(PolyvApiUrl.PayOrder, options);
|
|
2620
|
+
case 1:
|
|
2621
|
+
res = _context.v;
|
|
2622
|
+
return _context.a(2, mapInternalCreateOrderResponse(res));
|
|
2623
|
+
}
|
|
2624
|
+
}, _callee, this);
|
|
2625
|
+
}));
|
|
2626
|
+
function getPayOrderParams(_x) {
|
|
2627
|
+
return _getPayOrderParams.apply(this, arguments);
|
|
2628
|
+
}
|
|
2629
|
+
return getPayOrderParams;
|
|
2630
|
+
}()
|
|
2631
|
+
}, {
|
|
2632
|
+
key: "getPayProviders",
|
|
2633
|
+
value: (
|
|
2634
|
+
/**
|
|
2635
|
+
* 获取支付方式
|
|
2636
|
+
* @example
|
|
2637
|
+
* ```js
|
|
2638
|
+
* const data = await paymentTarget.getPayProviders();
|
|
2639
|
+
* console.log('支付方式', data);
|
|
2640
|
+
* ```
|
|
2641
|
+
*/
|
|
2642
|
+
function() {
|
|
2643
|
+
var _getPayProviders = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2() {
|
|
2644
|
+
var _this = this;
|
|
2645
|
+
var fetchPromise;
|
|
2646
|
+
return _regenerator().w(function(_context2) {
|
|
2647
|
+
while (1) switch (_context2.n) {
|
|
2648
|
+
case 0:
|
|
2649
|
+
if (!this.__payProviderCache) {
|
|
2650
|
+
_context2.n = 1;
|
|
2651
|
+
break;
|
|
2652
|
+
}
|
|
2653
|
+
return _context2.a(2, this.__payProviderCache);
|
|
2654
|
+
case 1:
|
|
2655
|
+
fetchPromise = this.iarCore.polyvApi.get(PolyvApiUrl.GetOrderPaymentProviders, {})["catch"](function(error) {
|
|
2656
|
+
_this.__payProviderCache = void 0;
|
|
2657
|
+
throw error;
|
|
2658
|
+
});
|
|
2659
|
+
this.__payProviderCache = fetchPromise;
|
|
2660
|
+
_context2.n = 2;
|
|
2661
|
+
return fetchPromise;
|
|
2662
|
+
case 2:
|
|
2663
|
+
return _context2.a(2, _context2.v);
|
|
2664
|
+
}
|
|
2665
|
+
}, _callee2, this);
|
|
2666
|
+
}));
|
|
2667
|
+
function getPayProviders() {
|
|
2668
|
+
return _getPayProviders.apply(this, arguments);
|
|
2669
|
+
}
|
|
2670
|
+
return getPayProviders;
|
|
2671
|
+
}()
|
|
2672
|
+
)
|
|
2673
|
+
}]);
|
|
2674
|
+
}();
|
|
1172
2675
|
;
|
|
1173
2676
|
console.log(
|
|
1174
2677
|
"%c@polyv/product-sdk",
|
|
1175
2678
|
"background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff",
|
|
1176
|
-
"[version: 1.
|
|
1177
|
-
"[buildTime: 2025-
|
|
2679
|
+
"[version: 1.1.0-rc-20250703.1]",
|
|
2680
|
+
"[buildTime: 2025-07-03 01:47:38]"
|
|
1178
2681
|
);
|
|
1179
2682
|
export {
|
|
1180
2683
|
Address,
|