@galacean/effects-plugin-alipay-downgrade 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/alipay.js CHANGED
@@ -459,7 +459,7 @@ function resumePausedPlayers(e) {
459
459
  });
460
460
  }
461
461
  }
462
- var version = "1.5.1";
462
+ var version = "1.5.2";
463
463
  effects.logger.info('plugin alipay downgrade version: ' + version);
464
464
 
465
465
  exports.checkDowngrade = checkDowngrade;
package/dist/alipay.mjs CHANGED
@@ -455,7 +455,7 @@ function resumePausedPlayers(e) {
455
455
  });
456
456
  }
457
457
  }
458
- var version = "1.5.1";
458
+ var version = "1.5.2";
459
459
  logger.info('plugin alipay downgrade version: ' + version);
460
460
 
461
461
  export { checkDowngrade, downgradeForMiniprogram, getAlipayDowngradeBizId, getDeviceName, getRenderLevelByDevice, getSystemInfo, resetDevicePending, setAlipayDowngradeBizId, version };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin for Alipay
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,意绮
6
- * Version: v1.5.1
6
+ * Version: v1.5.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -478,7 +478,7 @@ function resumePausedPlayers(e) {
478
478
  });
479
479
  }
480
480
  }
481
- var version = "1.5.1";
481
+ var version = "1.5.2";
482
482
  effects.logger.info('plugin alipay downgrade version: ' + version);
483
483
 
484
484
  exports.checkDowngrade = checkDowngrade;
package/dist/index.min.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin for Alipay
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,意绮
6
- * Version: v1.5.1
6
+ * Version: v1.5.2
7
7
  */
8
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,(function(e,n){"use strict";var r=function(e,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},r(e,n)};function t(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}function o(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function l(e){try{c(t.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}c((t=t.apply(e,n||[])).next())}))}function i(e,n){var r,t,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,t=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=n.call(e,a)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}"function"==typeof SuppressedError&&SuppressedError;var a,l,c="low",u="middle",s="high",d="DESKTOP_DEBUG",f="Unknown",p=!1;function v(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return a||(a=h().then((function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system;if(l||(l=n),p="iOS"===r,f=void 0===i?"Unknown":i,/iPhone(\d+),/.test(d=o)&&!l){var a=+RegExp.$1;l=a<=9?c:a<10?u:s}return 0===d.indexOf(e.brand)&&(d=d.replace(e.brand,"").trim()),d}),(function(e){}))),[2,a.then((function(){return d}),(function(){return d}))]}))}))}function g(e){return"auto"!==e&&e?/[ABS]/.test(e)?e:n.spec.RenderLevel.S:l===s?n.spec.RenderLevel.S:l===u?n.spec.RenderLevel.A:l===c?n.spec.RenderLevel.B:p?n.spec.RenderLevel.S:n.spec.RenderLevel.B}var y="mock-fail";function w(e,r){return void 0===r&&(r={}),o(this,void 0,void 0,(function(){var t,o;return i(this,(function(i){return e===y||"mock-pass"===e?[2,Promise.resolve({downgrade:e===y,reason:"mock"})]:(t=n.isAlipayMiniApp()?my:window.AlipayJSBridge)?(o=performance.now(),[2,v().then((function(){return new Promise((function(i){var a,d=["mars"],f=r.techPoint;f&&d.push.apply(d,function(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}([],function(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}(f),!1)),(null!==(a=r.callBridge)&&void 0!==a?a:t.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:d}},(function(e){var r=void 0;if(console.info("downgrade time: ".concat(performance.now()-o,"ms")),e.error)i({downgrade:4!==e.error,reason:"api error:"+e.error});else try{var t=n.isString(e)?JSON.parse(e):e;if("downgradeResultType"in t?r=t.downgradeResultType:"resultType"in t&&(r=t.resultType),e.context){var a=e.context.deviceInfo;if(a){var d=a.deviceLevel;d===s||d===c?l=d:"medium"===d&&(l=u)}}}catch(e){console.error(e)}void 0===r?i({downgrade:!0,reason:"call downgrade fail"}):n.isAlipayMiniApp()&&b()?i({downgrade:!0,reason:"Force downgrade by downgrade plugin"}):i({downgrade:1===r,reason:r})}))}))}))]):[2,Promise.resolve({downgrade:!1,reason:"no AP env"})]}))}))}function h(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new Promise((function(e,r){var t=n.isAlipayMiniApp()?my:window.AlipayJSBridge;t?t.call("getSystemInfo",(function(n){n.error?r(n):e(n)})):r("no ap")}))]}))}))}var m=["12,8","13,1","13,2","13,3","13,4"];function b(){if(p&&m.find((function(e){return e===d}))){var e=f.split(".");if(e.length>0&&"16"===e[0])return!0}return!1}var A=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.onPlayerCreated=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return n.glLostOccurred?(console.warn("gl lost happened, new player will be destroyed."),[2,e.dispose()]):n.currentBizId?[4,w(n.currentBizId)]:[3,2];case 1:r.sent().downgrade&&(console.warn("automatically destroy downgraded player."),e.dispose()),r.label=2;case 2:return[2]}}))}))},n.processRawJSON=function(e,r){var t,a;return void 0===r&&(r={}),o(this,void 0,void 0,(function(){var e;return i(this,(function(o){switch(o.label){case 0:return n.glLostOccurred?[2,Promise.reject("gl lost happened")]:[4,w(null!==(a=null===(t=r.pluginData)||void 0===t?void 0:t.alipayBizId)&&void 0!==a?a:n.currentBizId)];case 1:if((e=o.sent()).downgrade)throw new Error("downgraded, reason: ".concat(e.reason));return r.renderLevel||(r.renderLevel=g(r.renderLevel)),[2]}}))}))},n.currentBizId="",n.glLostOccurred=!1,n}(n.AbstractPlugin),P=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(n.VFXItem),L=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register((function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var i={message:"".concat("[Galacean Effects]"," ").concat(r," ").concat(t.join("")),level:e};n.isAndroid()&&(i.anr_info="mars");try{null==L||L.call("localLog",i)}catch(e){console.error(e)}}));var S=!1;var E=Symbol("@@_inter_pause");function B(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded"),n.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[E]=!0)})))}function x(e){e.target===document&&(n.logger.info("auto resume all players"),n.getActivePlayers().forEach((function(e){e[E]&&(e.resume(),e[E]=!1)})))}var O="1.5.1";n.logger.info("plugin alipay downgrade version: "+O),e.checkDowngrade=w,e.downgradeForMiniprogram=b,e.getAlipayDowngradeBizId=function(){return A.currentBizId},e.getDeviceName=v,e.getRenderLevelByDevice=g,e.getSystemInfo=h,e.resetDevicePending=function(){a=void 0},e.setAlipayDowngradeBizId=function(e,r){void 0===r&&(r={});var t=r.ignoreGLLost,o=r.autoPause,i=r.disableGLLostEvent,a=void 0!==i&&i,l=!0!==t;A.currentBizId=e,S||(n.registerPlugin("alipay-downgrade",A,P,!0),window.addEventListener("unload",(function(){n.getActivePlayers().forEach((function(e){return e.dispose()}))})),a||window.addEventListener("webglcontextlost",(function(e){n.isCanvasUsedByPlayer(e.target)&&(A.glLostOccurred=!0,console.error("webgl lost occur"),l&&(console.warn("webgl lost occur, all players will be downgraded from now on"),n.disableAllPlayer(!0),n.getActivePlayers().forEach((function(e){return e.dispose()}))))}),!0),o&&(document.addEventListener("pause",B),document.addEventListener("resume",x)),S=!0,v())},e.version=O,Object.defineProperty(e,"__esModule",{value:!0})}));
8
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,(function(e,n){"use strict";var r=function(e,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},r(e,n)};function t(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}function o(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function l(e){try{c(t.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}c((t=t.apply(e,n||[])).next())}))}function i(e,n){var r,t,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,t=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=n.call(e,a)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}"function"==typeof SuppressedError&&SuppressedError;var a,l,c="low",u="middle",s="high",d="DESKTOP_DEBUG",f="Unknown",p=!1;function v(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return a||(a=h().then((function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system;if(l||(l=n),p="iOS"===r,f=void 0===i?"Unknown":i,/iPhone(\d+),/.test(d=o)&&!l){var a=+RegExp.$1;l=a<=9?c:a<10?u:s}return 0===d.indexOf(e.brand)&&(d=d.replace(e.brand,"").trim()),d}),(function(e){}))),[2,a.then((function(){return d}),(function(){return d}))]}))}))}function g(e){return"auto"!==e&&e?/[ABS]/.test(e)?e:n.spec.RenderLevel.S:l===s?n.spec.RenderLevel.S:l===u?n.spec.RenderLevel.A:l===c?n.spec.RenderLevel.B:p?n.spec.RenderLevel.S:n.spec.RenderLevel.B}var y="mock-fail";function w(e,r){return void 0===r&&(r={}),o(this,void 0,void 0,(function(){var t,o;return i(this,(function(i){return e===y||"mock-pass"===e?[2,Promise.resolve({downgrade:e===y,reason:"mock"})]:(t=n.isAlipayMiniApp()?my:window.AlipayJSBridge)?(o=performance.now(),[2,v().then((function(){return new Promise((function(i){var a,d=["mars"],f=r.techPoint;f&&d.push.apply(d,function(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}([],function(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}(f),!1)),(null!==(a=r.callBridge)&&void 0!==a?a:t.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:d}},(function(e){var r=void 0;if(console.info("downgrade time: ".concat(performance.now()-o,"ms")),e.error)i({downgrade:4!==e.error,reason:"api error:"+e.error});else try{var t=n.isString(e)?JSON.parse(e):e;if("downgradeResultType"in t?r=t.downgradeResultType:"resultType"in t&&(r=t.resultType),e.context){var a=e.context.deviceInfo;if(a){var d=a.deviceLevel;d===s||d===c?l=d:"medium"===d&&(l=u)}}}catch(e){console.error(e)}void 0===r?i({downgrade:!0,reason:"call downgrade fail"}):n.isAlipayMiniApp()&&b()?i({downgrade:!0,reason:"Force downgrade by downgrade plugin"}):i({downgrade:1===r,reason:r})}))}))}))]):[2,Promise.resolve({downgrade:!1,reason:"no AP env"})]}))}))}function h(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new Promise((function(e,r){var t=n.isAlipayMiniApp()?my:window.AlipayJSBridge;t?t.call("getSystemInfo",(function(n){n.error?r(n):e(n)})):r("no ap")}))]}))}))}var m=["12,8","13,1","13,2","13,3","13,4"];function b(){if(p&&m.find((function(e){return e===d}))){var e=f.split(".");if(e.length>0&&"16"===e[0])return!0}return!1}var A=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.onPlayerCreated=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return n.glLostOccurred?(console.warn("gl lost happened, new player will be destroyed."),[2,e.dispose()]):n.currentBizId?[4,w(n.currentBizId)]:[3,2];case 1:r.sent().downgrade&&(console.warn("automatically destroy downgraded player."),e.dispose()),r.label=2;case 2:return[2]}}))}))},n.processRawJSON=function(e,r){var t,a;return void 0===r&&(r={}),o(this,void 0,void 0,(function(){var e;return i(this,(function(o){switch(o.label){case 0:return n.glLostOccurred?[2,Promise.reject("gl lost happened")]:[4,w(null!==(a=null===(t=r.pluginData)||void 0===t?void 0:t.alipayBizId)&&void 0!==a?a:n.currentBizId)];case 1:if((e=o.sent()).downgrade)throw new Error("downgraded, reason: ".concat(e.reason));return r.renderLevel||(r.renderLevel=g(r.renderLevel)),[2]}}))}))},n.currentBizId="",n.glLostOccurred=!1,n}(n.AbstractPlugin),P=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(n.VFXItem),L=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register((function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var i={message:"".concat("[Galacean Effects]"," ").concat(r," ").concat(t.join("")),level:e};n.isAndroid()&&(i.anr_info="mars");try{null==L||L.call("localLog",i)}catch(e){console.error(e)}}));var S=!1;var E=Symbol("@@_inter_pause");function B(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded"),n.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[E]=!0)})))}function x(e){e.target===document&&(n.logger.info("auto resume all players"),n.getActivePlayers().forEach((function(e){e[E]&&(e.resume(),e[E]=!1)})))}var O="1.5.2";n.logger.info("plugin alipay downgrade version: "+O),e.checkDowngrade=w,e.downgradeForMiniprogram=b,e.getAlipayDowngradeBizId=function(){return A.currentBizId},e.getDeviceName=v,e.getRenderLevelByDevice=g,e.getSystemInfo=h,e.resetDevicePending=function(){a=void 0},e.setAlipayDowngradeBizId=function(e,r){void 0===r&&(r={});var t=r.ignoreGLLost,o=r.autoPause,i=r.disableGLLostEvent,a=void 0!==i&&i,l=!0!==t;A.currentBizId=e,S||(n.registerPlugin("alipay-downgrade",A,P,!0),window.addEventListener("unload",(function(){n.getActivePlayers().forEach((function(e){return e.dispose()}))})),a||window.addEventListener("webglcontextlost",(function(e){n.isCanvasUsedByPlayer(e.target)&&(A.glLostOccurred=!0,console.error("webgl lost occur"),l&&(console.warn("webgl lost occur, all players will be downgraded from now on"),n.disableAllPlayer(!0),n.getActivePlayers().forEach((function(e){return e.dispose()}))))}),!0),o&&(document.addEventListener("pause",B),document.addEventListener("resume",x)),S=!0,v())},e.version=O,Object.defineProperty(e,"__esModule",{value:!0})}));
9
9
  //# sourceMappingURL=index.min.js.map
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin for Alipay
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,意绮
6
- * Version: v1.5.1
6
+ * Version: v1.5.2
7
7
  */
8
8
 
9
9
  import { spec, isAlipayMiniApp, isString, AbstractPlugin, VFXItem, logger, isAndroid, registerPlugin, getActivePlayers, isCanvasUsedByPlayer, disableAllPlayer } from '@galacean/effects';
@@ -474,7 +474,7 @@ function resumePausedPlayers(e) {
474
474
  });
475
475
  }
476
476
  }
477
- var version = "1.5.1";
477
+ var version = "1.5.2";
478
478
  logger.info('plugin alipay downgrade version: ' + version);
479
479
 
480
480
  export { checkDowngrade, downgradeForMiniprogram, getAlipayDowngradeBizId, getDeviceName, getRenderLevelByDevice, getSystemInfo, resetDevicePending, setAlipayDowngradeBizId, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-plugin-alipay-downgrade",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Galacean Effects player downgrade plugin for Alipay",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "registry": "https://registry.npmjs.org"
37
37
  },
38
38
  "devDependencies": {
39
- "@galacean/effects": "1.5.1"
39
+ "@galacean/effects": "1.5.2"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "vite",