@fonixtree/magic-design 0.0.182 → 0.0.184

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.
@@ -207,26 +207,75 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
207
207
  /** 检查youtube依赖包 */
208
208
  var checkYoutuVIdeo = function checkYoutuVIdeo() {
209
209
  return __awaiter(void 0, void 0, void 0, function () {
210
+ var scriptUrl, ttPolicy, YT, YTConfig;
210
211
  return __generator(this, function (_a) {
211
- switch (_a.label) {
212
- case 0:
213
- if (!!window.YT) return [3
214
- /*break*/
215
- , 2];
216
- return [4
217
- /*yield*/
218
- , Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
212
+ if (!window.YT) {
213
+ scriptUrl = 'https:\/\/www.youtube.com\/s\/player\/36754c51\/www-widgetapi.vflset\/www-widgetapi.js';
219
214
 
220
- case 1:
221
- _a.sent();
215
+ try {
216
+ ttPolicy = window.trustedTypes.createPolicy('youtube-widget-api', {
217
+ createScriptURL: function createScriptURL(x) {
218
+ return x;
219
+ }
220
+ });
221
+ scriptUrl = ttPolicy.createScriptURL(scriptUrl);
222
+ } catch (e) {}
223
+
224
+ if (!window['YT']) YT = {
225
+ loading: 0,
226
+ loaded: 0
227
+ };
228
+ if (!window['YTConfig']) YTConfig = {
229
+ host: 'https://www.youtube.com'
230
+ };
231
+
232
+ if (!YT.loading) {
233
+ YT.loading = 1;
234
+
235
+ (function () {
236
+ var l = [];
237
+
238
+ YT.ready = function (f) {
239
+ if (YT.loaded) f();else l.push(f);
240
+ };
222
241
 
223
- _a.label = 2;
242
+ window.onYTReady = function () {
243
+ YT.loaded = 1;
224
244
 
225
- case 2:
226
- return [2
227
- /*return*/
228
- ];
245
+ for (var i = 0; i < l.length; i++) {
246
+ try {
247
+ l[i]();
248
+ } catch (e$0) {}
249
+ }
250
+ };
251
+
252
+ YT.setConfig = function (c) {
253
+ for (var k in c) {
254
+ if (c.hasOwnProperty(k)) YTConfig[k] = c[k];
255
+ }
256
+ };
257
+
258
+ var a = document.createElement('script');
259
+ a.type = 'text/javascript';
260
+ a.id = 'www-widgetapi-script';
261
+ a.src = scriptUrl;
262
+ a.async = true;
263
+ var c = document.currentScript;
264
+
265
+ if (c) {
266
+ var n = c.nonce || c.getAttribute('nonce');
267
+ if (n) a.setAttribute('nonce', n);
268
+ }
269
+
270
+ var b = document.getElementsByTagName('script')[0];
271
+ b.parentNode.insertBefore(a, b);
272
+ })();
273
+ }
229
274
  }
275
+
276
+ return [2
277
+ /*return*/
278
+ ];
230
279
  });
231
280
  });
232
281
  };
@@ -77,7 +77,7 @@ function (_super) {
77
77
  var panelProps = _this.props.panelProps;
78
78
  var source = [{
79
79
  key: '1',
80
- name: 'Overilay',
80
+ name: 'Overlay',
81
81
  value: /*#__PURE__*/_react["default"].createElement(_ImageConfig["default"], {
82
82
  data: panelProps.overilay,
83
83
  needClickArea: false,
@@ -130,7 +130,7 @@
130
130
  overflow: hidden;
131
131
  }
132
132
 
133
- .product-name {
133
+ .product-name-wrap {
134
134
  height: 38px;
135
135
  }
136
136
  }
@@ -81,7 +81,7 @@ var parseUrl = function parseUrl(url) {
81
81
  case _constants.urlType.ANCHOR:
82
82
  // document.getElementById(id) && document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
83
83
  params = {
84
- type: 'ANCHOR',
84
+ action: 'ANCHOR',
85
85
  data: {
86
86
  id: arg1
87
87
  }
@@ -91,9 +91,9 @@ var parseUrl = function parseUrl(url) {
91
91
  case _constants.urlType.GET_COUPON:
92
92
  // 领取优惠券
93
93
  params = {
94
- type: 'operation',
94
+ action: 'operation',
95
95
  params: {
96
- action: 'GET_COUPON',
96
+ type: 'GET_COUPON',
97
97
  couponId: arg1
98
98
  }
99
99
  };
@@ -102,7 +102,7 @@ var parseUrl = function parseUrl(url) {
102
102
  case _constants.urlType.VIDEO:
103
103
  // 播放视频
104
104
  params = {
105
- type: 'operation',
105
+ action: 'operation',
106
106
  params: {
107
107
  type: 'VIDEO',
108
108
  data: (0, _commonUtil.ensure)(function () {
@@ -310,7 +310,7 @@ var clickUrl = function clickUrl(url) {
310
310
  }
311
311
 
312
312
  if ((0, _androidUtil.browserVersion)().isApp) {
313
- (0, _androidUtil.sendToApp)(params);
313
+ (0, _androidUtil.sendToApp)(data);
314
314
  } else {
315
315
  // 视频
316
316
  if (params.type === 'VIDEO') {
@@ -207,26 +207,75 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
207
207
  /** 检查youtube依赖包 */
208
208
  var checkYoutuVIdeo = function checkYoutuVIdeo() {
209
209
  return __awaiter(void 0, void 0, void 0, function () {
210
+ var scriptUrl, ttPolicy, YT, YTConfig;
210
211
  return __generator(this, function (_a) {
211
- switch (_a.label) {
212
- case 0:
213
- if (!!window.YT) return [3
214
- /*break*/
215
- , 2];
216
- return [4
217
- /*yield*/
218
- , Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
212
+ if (!window.YT) {
213
+ scriptUrl = 'https:\/\/www.youtube.com\/s\/player\/36754c51\/www-widgetapi.vflset\/www-widgetapi.js';
219
214
 
220
- case 1:
221
- _a.sent();
215
+ try {
216
+ ttPolicy = window.trustedTypes.createPolicy('youtube-widget-api', {
217
+ createScriptURL: function createScriptURL(x) {
218
+ return x;
219
+ }
220
+ });
221
+ scriptUrl = ttPolicy.createScriptURL(scriptUrl);
222
+ } catch (e) {}
223
+
224
+ if (!window['YT']) YT = {
225
+ loading: 0,
226
+ loaded: 0
227
+ };
228
+ if (!window['YTConfig']) YTConfig = {
229
+ host: 'https://www.youtube.com'
230
+ };
231
+
232
+ if (!YT.loading) {
233
+ YT.loading = 1;
234
+
235
+ (function () {
236
+ var l = [];
237
+
238
+ YT.ready = function (f) {
239
+ if (YT.loaded) f();else l.push(f);
240
+ };
222
241
 
223
- _a.label = 2;
242
+ window.onYTReady = function () {
243
+ YT.loaded = 1;
224
244
 
225
- case 2:
226
- return [2
227
- /*return*/
228
- ];
245
+ for (var i = 0; i < l.length; i++) {
246
+ try {
247
+ l[i]();
248
+ } catch (e$0) {}
249
+ }
250
+ };
251
+
252
+ YT.setConfig = function (c) {
253
+ for (var k in c) {
254
+ if (c.hasOwnProperty(k)) YTConfig[k] = c[k];
255
+ }
256
+ };
257
+
258
+ var a = document.createElement('script');
259
+ a.type = 'text/javascript';
260
+ a.id = 'www-widgetapi-script';
261
+ a.src = scriptUrl;
262
+ a.async = true;
263
+ var c = document.currentScript;
264
+
265
+ if (c) {
266
+ var n = c.nonce || c.getAttribute('nonce');
267
+ if (n) a.setAttribute('nonce', n);
268
+ }
269
+
270
+ var b = document.getElementsByTagName('script')[0];
271
+ b.parentNode.insertBefore(a, b);
272
+ })();
273
+ }
229
274
  }
275
+
276
+ return [2
277
+ /*return*/
278
+ ];
230
279
  });
231
280
  });
232
281
  };
@@ -77,7 +77,7 @@ function (_super) {
77
77
  var panelProps = _this.props.panelProps;
78
78
  var source = [{
79
79
  key: '1',
80
- name: 'Overilay',
80
+ name: 'Overlay',
81
81
  value: /*#__PURE__*/_react["default"].createElement(_ImageConfig["default"], {
82
82
  data: panelProps.overilay,
83
83
  needClickArea: false,
@@ -130,7 +130,7 @@
130
130
  overflow: hidden;
131
131
  }
132
132
 
133
- .product-name {
133
+ .product-name-wrap {
134
134
  height: 38px;
135
135
  }
136
136
  }
@@ -81,7 +81,7 @@ var parseUrl = function parseUrl(url) {
81
81
  case _constants.urlType.ANCHOR:
82
82
  // document.getElementById(id) && document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
83
83
  params = {
84
- type: 'ANCHOR',
84
+ action: 'ANCHOR',
85
85
  data: {
86
86
  id: arg1
87
87
  }
@@ -91,9 +91,9 @@ var parseUrl = function parseUrl(url) {
91
91
  case _constants.urlType.GET_COUPON:
92
92
  // 领取优惠券
93
93
  params = {
94
- type: 'operation',
94
+ action: 'operation',
95
95
  params: {
96
- action: 'GET_COUPON',
96
+ type: 'GET_COUPON',
97
97
  couponId: arg1
98
98
  }
99
99
  };
@@ -102,7 +102,7 @@ var parseUrl = function parseUrl(url) {
102
102
  case _constants.urlType.VIDEO:
103
103
  // 播放视频
104
104
  params = {
105
- type: 'operation',
105
+ action: 'operation',
106
106
  params: {
107
107
  type: 'VIDEO',
108
108
  data: (0, _commonUtil.ensure)(function () {
@@ -310,7 +310,7 @@ var clickUrl = function clickUrl(url) {
310
310
  }
311
311
 
312
312
  if ((0, _androidUtil.browserVersion)().isApp) {
313
- (0, _androidUtil.sendToApp)(params);
313
+ (0, _androidUtil.sendToApp)(data);
314
314
  } else {
315
315
  // 视频
316
316
  if (params.type === 'VIDEO') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.0.182",
4
+ "version": "0.0.184",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",