@alipay/ams-checkout 0.0.1767873844-dev.0 → 0.0.1767941604-dev.0
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/ams-checkout.js +3 -3
- package/dist/ams-checkout.min.js +1 -0
- package/dist/antom-cls.min.js +1 -0
- package/esm/core/component/element/elementController/index.js +5 -21
- package/esm/foundation/core/index.js +1 -1
- package/esm/foundation/service/log/index.d.ts +1 -1
- package/esm/foundation/service/log/index.js +11 -16
- package/esm/index.d.ts +10 -2
- package/esm/index.js +21 -2
- package/esm/modern/antom.d.ts +12 -0
- package/esm/modern/antom.js +54 -0
- package/esm/modern/elements/ExpressElement.d.ts +15 -0
- package/esm/modern/elements/ExpressElement.js +68 -0
- package/esm/modern/elements/SubElement.d.ts +15 -0
- package/esm/modern/elements/SubElement.js +61 -0
- package/esm/modern/elements.d.ts +10 -0
- package/esm/modern/elements.js +48 -0
- package/esm/modern/index.d.ts +7 -0
- package/esm/modern/index.js +39 -0
- package/esm/modern/sdkLoader.d.ts +34 -0
- package/esm/modern/sdkLoader.js +112 -0
- package/esm/modern/types.d.ts +5 -0
- package/esm/modern/types.js +1 -0
- package/esm/modern/umd.d.ts +7 -0
- package/esm/modern/umd.js +37 -0
- package/esm/util/logger.js +1 -6
- package/package.json +5 -4
- package/dist/umd/ams-checkout.min.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return function(){var e={786:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},459:function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},100:function(e,t,n){var r=n(786);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},218:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},140:function(e){function t(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,u,"next",e)}function u(e){t(a,o,i,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},697:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},709:function(e,t,n){var r=n(896);function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}e.exports=function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},825:function(e,t,n){var r=n(234),o=n(185),i=n(93);e.exports=function(e){var t=o();return function(){var n,o=r(e);if(t){var a=r(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return i(this,n)}},e.exports.__esModule=!0,e.exports.default=e.exports},738:function(e,t,n){var r=n(896);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},234:function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},878:function(e,t,n){var r=n(685);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},185:function(e){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},256:function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},274:function(e){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}},e.exports.__esModule=!0,e.exports.default=e.exports},132:function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},136:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},782:function(e,t,n){var r=n(738);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},93:function(e,t,n){var r=n(158).default,o=n(218);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},357:function(e,t,n){var r=n(158).default;function o(){"use strict";e.exports=o=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},i=Object.prototype,a=i.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(t){d=function(e,t,n){return e[t]=n}}function p(e,t,n,r){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),a=new D(r||[]);return s(i,"_invoke",{value:R(e,n,a)}),i}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=p;var g="suspendedStart",y="executing",m="completed",v={};function E(){}function b(){}function w(){}var _={};d(_,c,(function(){return this}));var x=Object.getPrototypeOf,S=x&&x(x(N([])));S&&S!==i&&a.call(S,c)&&(_=S);var O=w.prototype=E.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(o,i,s,u){var c=h(e[o],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(f).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var o;s(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}})}function R(e,n,r){var o=g;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=k(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===g)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=h(e,n,r);if("normal"===c.type){if(o=r.done?m:"suspendedYield",c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function k(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,k(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(a.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(r(e)+" is not iterable")}return b.prototype=w,s(O,"constructor",{value:w,configurable:!0}),s(w,"constructor",{value:b,configurable:!0}),b.displayName=d(w,f,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,d(e,f,"GeneratorFunction")),e.prototype=Object.create(O),e},n.awrap=function(e){return{__await:e}},P(M.prototype),d(M.prototype,l,(function(){return this})),n.AsyncIterator=M,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new M(p(e,t,r,o),i);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(O),d(O,f,"Generator"),d(O,c,(function(){return this})),d(O,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=N,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},n}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},685:function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},661:function(e,t,n){var r=n(459),o=n(274),i=n(449),a=n(132);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},147:function(e,t,n){var r=n(100),o=n(256),i=n(449),a=n(136);e.exports=function(e){return r(e)||o(e)||i(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},165:function(e,t,n){var r=n(158).default;e.exports=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},896:function(e,t,n){var r=n(158).default,o=n(165);e.exports=function(e){var t=o(e,"string");return"symbol"==r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},158:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},449:function(e,t,n){var r=n(786);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{AntomSDK:function(){return G},default:function(){return F}});var e,t=n(697),o=n.n(t),i=n(709),a=n.n(i),s=n(878),u=n.n(s),c=n(825),l=n.n(c),f=n(738),d=n.n(f),p=n(782),h=n.n(p),g=n(218),y=n(357),m=n.n(y),v=n(140),E=n.n(v),b=n(661),w=n.n(b),_=n(147),x=n.n(_),S=function(e,t){return function(){return Promise.race([new Promise((function(e,n){setTimeout((function(){n(new Error("timeout"))}),t)})),e.apply(void 0,arguments)])}},O=function(){function e(t){o()(this,e),d()(this,"targetPorts",[]),d()(this,"name",void 0),this.name=t}var t;return a()(e,[{key:"addPort",value:function(e){var t;(t=this.targetPorts).push.apply(t,x()(e))}},{key:"removePort",value:function(e){this.targetPorts=this.targetPorts.filter((function(t){return e!==t}))}},{key:"getValues",value:(t=E()(m()().mark((function e(t){var n,r,o=this;return m()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(null==t?void 0:t.timeout)||1e4,r=S((function(){return Promise.all(o.targetPorts.map((function(e){return new Promise((function(t,n){e.postMessage({id:Math.random()+"",type:"".concat(o.name,":START_COLLECT_VALUE")}),e.onmessage=function(e){var r=e.data;r&&r.type||n(new Error("collect error"));var o=r.type.split(":"),i=w()(o,2),a=i[0];"SEND_ELEMENT_VALUE"===i[1]&&t(d()({},a,r.payload))}}))}))).then((function(e){return e.reduce((function(e,t){return h()(h()({},e),t)}),{})}))}),n),e.abrupt("return",r());case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}(),P=function(){function e(t,n){o()(this,e),d()(this,"targetPort",void 0),d()(this,"name",void 0),this.targetPort=n,this.name=t}return a()(e,[{key:"onSendRequest",value:function(e){this.targetPort.onmessage=function(){var t=E()(m()().mark((function t(n){var r,o,i;return m()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((r=n.data)&&r.type){t.next=3;break}return t.abrupt("return");case 3:o=r.type.split(":"),i=w()(o,2),i[0],"START_COLLECT_VALUE"===i[1]&&e();case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}},{key:"send",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={id:Math.random()+"",payload:e,type:"".concat(this.name,":SEND_ELEMENT_VALUE")};this.targetPort.postMessage(t)}}]),e}();!function(e){e.HANDSHAKE="SDK@HANDSHAKE",e.HANDSHAKE_ACK="SDK@HANDSHAKE_ACK",e.UPDATE_CONFIG="SDK@UPDATE_CONFIG",e.INITIAL_CONFIG="SDK@INITIAL_CONFIG",e.ERROR="SDK@ERROR",e.TRANSFER_RECEIVE_PORT="SDK_INNER@TRANSFER_RECEIVE_PORT",e.TRANSFER_SEND_PORT="SDK_INNER@TRANSFER_SEND_PORT"}(e||(e={}));var M=[e.TRANSFER_RECEIVE_PORT,e.TRANSFER_SEND_PORT],R=function(){function t(e,n){var r=this;o()(this,t),d()(this,"targetWindow",null),d()(this,"targetOrigin","*"),d()(this,"scope",void 0),d()(this,"handlers",new Map),d()(this,"mode",void 0),d()(this,"debugCallback",void 0),d()(this,"receivePort",void 0),d()(this,"handleMessage",(function(e){var t=e.data;if(t&&t.type){var n=t.type.split(":"),o=w()(n,2),i=o[0],a=o[1];if(M.includes(t.type)&&(a="HOST",i="__$$SpecialScope$$__"),["WEBAPP","HOST"].includes(a)&&("*"===r.targetOrigin||e.origin===r.targetOrigin)&&r.mode!==a){!r.debugCallback||r.scope!==i&&"__$$SpecialScope$$__"!==i||r.debugCallback(t,"IN");var s=r.handlers.get(t.type);s&&new Set(s).forEach((function(n){return n(t.payload,e.ports)}))}}})),this.mode=e,this.scope=n,"undefined"!=typeof window&&window.addEventListener("message",this.handleMessage),"WEBAPP"===this.mode&&"undefined"!=typeof window&&(this.targetWindow=window.parent)}return a()(t,[{key:"setTarget",value:function(e){"HOST"===this.mode&&(this.targetWindow=e)}},{key:"setOrigin",value:function(e){this.targetOrigin=e}},{key:"setDebugCallback",value:function(e){this.debugCallback=e}},{key:"destroy",value:function(){"undefined"!=typeof window&&window.removeEventListener("message",this.handleMessage),this.handlers.clear()}},{key:"_addPort",value:function(t){var n;this._transferPort({id:Math.random()+"",type:e.TRANSFER_RECEIVE_PORT,payload:null===(n=this.receivePort)||void 0===n?void 0:n.name},t)}},{key:"_transferReceivePort",value:function(t){this._transferPort({id:Math.random()+"",type:e.TRANSFER_RECEIVE_PORT,payload:t.name},t.targetPorts)}},{key:"_transferSendPort",value:function(t){this._transferPort({id:Math.random()+"",type:e.TRANSFER_SEND_PORT,payload:t.name},[t.targetPort])}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.targetWindow){var n={id:Math.random()+"",type:this.getOriginSendType(e),payload:t};this.debugCallback&&this.debugCallback(n,"OUT"),this.targetWindow.postMessage(n,this.targetOrigin)}else console.warn("[Bridge] Target window not set. Cannot send message:",e)}},{key:"on",value:function(e,t){var n=this.getOriginListenType(e);this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(t)}},{key:"once",value:function(e,t){var n=this,r=this.getOriginListenType(e);this.on(r,(function e(o){try{t(o)}finally{n.off(r,e)}}))}},{key:"off",value:function(e,t){var n=this.getOriginListenType(e),r=this.handlers.get(n);r&&r.delete(t)}},{key:"handsShake",value:function(t,n){var r=this;"WEBAPP"===this.mode&&this.on(e.HANDSHAKE,function(){var o=E()(m()().mark((function o(i){return m()().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:"GROUP"===i.elementMode?i.isMainElement?r.getReceivePort().then((function(e){n(i,e)})).catch((function(){n(i)})):r.getSendPort().then((function(e){n(i,e)})).catch((function(){n(i)})):n(i),r.send(e.HANDSHAKE_ACK,{status:"ready",version:t});case 2:case"end":return o.stop()}}),o)})));return function(e){return o.apply(this,arguments)}}())}},{key:"getOriginListenType",value:function(e){return M.includes(e)?e:"".concat(this.scope,":").concat("WEBAPP"===this.mode?"HOST":"WEBAPP",":").concat(e)}},{key:"getOriginSendType",value:function(e){return"".concat(this.scope,":").concat(this.mode,":").concat(e)}},{key:"_transferPort",value:function(e,t){this.targetWindow?this.targetWindow.postMessage(e,this.targetOrigin,t):console.warn("[Bridge] Target window not set. Cannot send port")}},{key:"getReceivePort",value:function(){var t=this;return new Promise((function(n){t.on(e.TRANSFER_RECEIVE_PORT,(function(e,r){t.receivePort||(t.receivePort=new O(e)),t.receivePort.addPort(r),n(t.receivePort)}))}))}},{key:"getSendPort",value:function(){var t=this;return new Promise((function(n,r){t.on(e.TRANSFER_SEND_PORT,(function(e,t){if(t){var o=new P(e,t[0]);n(o)}else r(new Error("no ports transfer"))}))}))}}]),t}(),k=function(e){s(r,e);var n=c(r);function r(){return t(this,r),n.apply(this,arguments)}return i(r)}(function(){function e(){t(this,e)}return i(e,[{key:"debug",value:function(e,t,n,r){var o;null===(o=window.sdkDebugger)||void 0===o||o.log(e,t,n,r)}},{key:"destoryDebugger",value:function(){var e;null===(e=window.sdkDebugger)||void 0===e||e.destory()}},{key:"mountDebugger",value:function(){var e;null===(e=window.sdkDebugger)||void 0===e||e.mount()}}]),e}()),A=function(n){s(o,n);var r=c(o);function o(n,i){var a;return t(this,o),a=r.call(this),f(g(a),"name",void 0),f(g(a),"_elementMode",void 0),f(g(a),"_isMainElement",void 0),f(g(a),"config",void 0),f(g(a),"bridge",void 0),f(g(a),"iframe",null),f(g(a),"isDestroyed",!1),a.config=i,a.config.appConfig?(a.config.appConfig.elementMode=i.elementMode,a.config.appConfig.isMainElement=i.isMainElement):a.config.appConfig={elementMode:i.elementMode,isMainElement:i.isMainElement},a._isMainElement=i.isMainElement,a._elementMode=i.elementMode,a.name=n,a.bridge=new R("HOST",n),a.bridge.setOrigin(i.targetOrigin),a.config.debug&&a.bridge.setDebugCallback((function(t,n){var r="OUT"===n?"->":"<-";a.debug("INFO","SDK_INTERNAL","".concat(r," ").concat(t.type),t.payload),t.type.endsWith(e.ERROR)&&"IN"===n&&a.debug("ERROR","APP_RUNTIME",t.payload.message||"Unknown App Error",t.payload)})),a}return i(o,[{key:"mount",value:function(t){var n=this;if(!this.isMainElement&&this.isSingleMode)throw this.debug("ERROR","SDK_USAGE","".concat(this.name," element can not be used with single mode")),new Error("SDK Init Failed: ".concat(this.name," element can not be used with single mode"));if(this.isDestroyed)this.debug("ERROR","SDK_USAGE","element already destory");else try{if(!t)throw this.debug("ERROR","SDK_USAGE","container is required instance mount"),new Error("SDK Init Failed: container missing");var r="string"==typeof t?document.getElementById(t):t;if(!r)return void this.debug("ERROR","SDK_USAGE","Container element not found");var o=this.config.appUrl,i=new URL(this.config.appUrl);try{i.searchParams.set("origin",window.location.origin),o=i.toString()}catch(e){console.warn("Could not construct absolute URL for iframe, using relative path.");var a=o.includes("?")?"&":"?";o="".concat(o).concat(a,"origin=").concat(encodeURIComponent(window.location.origin))}if(this.iframe)return void r.appendChild(this.iframe);this.iframe=document.createElement("iframe"),this.iframe.src=o,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none",this.iframe.style.borderRadius="inherit",r.appendChild(this.iframe),this.iframe.onload=function(){var t;if(null!==(t=n.iframe)&&void 0!==t&&t.contentWindow){n.debug("INFO","SYSTEM","Iframe ".concat(n.name," loaded, initiating handshake..."));var r="*";try{"null"===(r=new URL(n.iframe.src).origin)&&(r="*")}catch(e){r="*"}n.bridge.setOrigin(r),n.bridge.setTarget(n.iframe.contentWindow),n.bridge.on(e.HANDSHAKE_ACK,(function(e){console.log((null==e?void 0:e.version)||"异常的版本")})),setTimeout((function(){n.bridge.send(e.HANDSHAKE,n.config.appConfig)}))}},this.config.debug&&this.mountDebugger()}catch(e){this.debug("ERROR","SDK_INTERNAL","Initialization crashed",e.message)}}},{key:"updateConfig",value:function(t){try{if(this.isDestroyed)throw new Error("Cannot update destroyed SDK instance");this.config.appConfig=p(p(p({},this.config.appConfig),t),{},{elementMode:this._elementMode,isMainElement:this.isMainElement}),this.debug("INFO","SDK_USAGE","Updating configuration via API",t),this.bridge.send(e.UPDATE_CONFIG,this.config.appConfig)}catch(e){this.debug("ERROR","SDK_USAGE",e.message)}}},{key:"umount",value:function(){this.iframe&&this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe)}},{key:"isSingleMode",get:function(){return"SINGLE"===this._elementMode}},{key:"_on",value:function(e,t){this.bridge.on(e,t)}},{key:"_send",value:function(e,t){this.bridge.send(e,t)}},{key:"_addPort",value:function(e){!this.isSingleMode&&this.isMainElement&&this.bridge._addPort(e)}},{key:"_transferReceivePort",value:function(e){!this.isSingleMode&&this.isMainElement&&this.bridge._transferReceivePort(e)}},{key:"_transferSendPort",value:function(e){this.isSingleMode||this.isMainElement||this.bridge._transferSendPort(e)}},{key:"destroy",value:function(){this.isDestroyed=!0,this.bridge.send("destory"),this.bridge.destroy(),this.umount(),this.isSingleMode&&this.destoryDebugger()}},{key:"isMainElement",get:function(){return this._isMainElement}}]),o}(k);var T=function(){return window.sdkDebugger?Promise.resolve(window.sdkDebugger):(e="http://localhost:3000/main.umd.js",new Promise((function(t,n){var r=document.querySelector('script[src="'.concat(e,'"]')),o=r||document.createElement("script");o.src=e,o.async=!0,o.addEventListener("load",(function(){t(!0)})),o.addEventListener("error",(function(){n(new Error("load debugger error"))})),r||document.head.appendChild(o)}))).then((function(){return window.sdkDebugger}));var e},D=function(){function e(n,r){t(this,e),f(this,"config",void 0),f(this,"targetOrigin","*"),f(this,"isInit",!1),this.config=n,this.targetOrigin=r}var n;return i(e,[{key:"init",value:(n=v(y().mark((function e(){return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isInit){e.next=2;break}return e.abrupt("return",this);case 2:if(!this.config.debug){e.next=5;break}return e.next=5,T();case 5:return this.isInit=!0,e.abrupt("return",this);case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_createElement",value:function(e,t){return new e(p(p({debug:this.config.debug},t),{},{targetOrigin:this.targetOrigin,elementMode:"SINGLE"}))}}]),e}(),N=function(n){s(o,n);var r=c(o);function o(e){var n;return t(this,o),n=r.call(this),f(g(n),"_elements",new Map),f(g(n),"waitSendPort",[]),f(g(n),"mainElement",void 0),f(g(n),"config",void 0),n.config=e,n}return i(o,[{key:"_createElement",value:function(e,t){return new e(p(p({},t),{},{debug:this.config.debug,targetOrigin:this.config.targetOrigin,elementMode:"GROUP"}))}},{key:"_createGroupElement",value:function(t,n){var r=this,o=this.create(t,p(p(p({},this.config),n),{},{debug:this.config.debug,elementMode:"GROUP"}));if(this._elements.get(t))throw this.debug("ERROR","SDK_USAGE","Only create one ".concat(t," element")),new Error("Only create one ".concat(t," element"));if(o.isMainElement){if(this.mainElement)throw this.debug("ERROR","SDK_USAGE","Only has one main element"),new Error("Only has one main element");this.mainElement=o;var i=new O(t);o.on(e.HANDSHAKE_ACK,(function(){o._transferReceivePort(i),r.waitSendPort.length&&(o._addPort(_(r.waitSendPort)),r.waitSendPort=[])}))}else{var a=new MessageChannel,s=new P(t,a.port1);o.on(e.HANDSHAKE_ACK,(function(){o._transferSendPort(s),r.mainElement?r.mainElement._addPort([a.port2]):r.waitSendPort.push(a.port2)}))}return this._elements.set(t,o),o.on("destory",(function(){r._elements.delete(t),r._elements.size||r.destoryDebugger()})),o}},{key:"submit",value:function(){var e;if(!this.mainElement)throw this.debug("ERROR","SDK_USAGE","There is no main element, Must has one main element, can not be submit"),new Error("Must has one main element");null===(e=this.mainElement)||void 0===e||e.submit()}},{key:"_getElement",value:function(e){return this._elements.get(e)}}]),o}(k),L=function(e){s(r,e);var n=c(r);function r(){return t(this,r),n.apply(this,arguments)}return i(r)}(D),j=function(e){u()(n,e);var t=l()(n);function n(e){return o()(this,n),t.call(this,n.elementType,h()(h()({},e),{},{isMainElement:!0,appUrl:"http://api-sandbox.local.alipay.net:5173/child.html",appConfig:{appearance:{displaySetting:{showFooter:!0}}}}))}return a()(n,[{key:"submit",value:function(e){throw new Error("Method not implemented.")}},{key:"focus",value:function(){throw new Error("Method not implemented.")}},{key:"blur",value:function(){throw new Error("Method not implemented.")}},{key:"clear",value:function(){throw new Error("Method not implemented.")}},{key:"isMainElement",get:function(){return!0}},{key:"on",value:function(e,t){this._on(e,t)}}]),n}(A);d()(j,"elementType","expressElement");var C=function(e){u()(n,e);var t=l()(n);function n(e){return o()(this,n),t.call(this,n.elementType,h()(h()({},e),{},{isMainElement:!1,appUrl:"http://api-sandbox.local.alipay.net:5173/child2.html"}))}return a()(n,[{key:"submit",value:function(e){throw new Error("Method not implemented.")}},{key:"focus",value:function(){throw new Error("Method not implemented.")}},{key:"blur",value:function(){throw new Error("Method not implemented.")}},{key:"clear",value:function(){throw new Error("Method not implemented.")}},{key:"on",value:function(e,t){this._on(e,t)}},{key:"isMainElement",get:function(){return!1}}]),n}(A);d()(C,"elementType","subElement");var I={expressElement:j,subElement:C},K=function(e){u()(n,e);var t=l()(n);function n(e){return o()(this,n),t.call(this,e)}return a()(n,[{key:"createElement",value:function(e,t){return this._createGroupElement(e,t)}},{key:"getElement",value:function(e,t){throw new Error("Method not implemented.")}},{key:"create",value:function(e,t){if(I[e])return this._createElement(I[e],t);throw new Error("Element type ".concat(e," not supported."))}}]),n}(N),U={expressElement:j},G=function(e){u()(n,e);var t=l()(n);function n(e){return o()(this,n),t.call(this,e,null==e?void 0:e.targetOrigin)}return a()(n,[{key:"elements",value:function(){return new K({debug:this.config.debug,targetOrigin:this.targetOrigin})}},{key:"createElement",value:function(e,t){if(U[e])return this._createElement(U[e],t);throw new Error("Element type ".concat(e," not supported."))}},{key:"getElement",value:function(e){throw console.log(e),new Error("Method not implemented.")}}]),n}(L);d()(G,"version","__SDK_VERSION__");var F=G}(),r}()}));
|
|
@@ -23,6 +23,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
23
23
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
import { ServiceProvider } from "../../../../foundation/service";
|
|
27
|
+
import { ELEMENT_SPM_MAP } from "../../../../util/spm-map";
|
|
26
28
|
import { cleanMockup, removeRetentionPopup } from "../../../../component/component.popup.style";
|
|
27
29
|
import { destroyModal } from "../../../../component/popupWindow.style";
|
|
28
30
|
import { ERRORMESSAGE, EVENT, PROMISE_CALLBACK_CODE } from "../../../../constant";
|
|
@@ -32,16 +34,14 @@ import PaymentProcessor from "../../../../core/component/element/elementProcesso
|
|
|
32
34
|
import { IElementStatus } from "../../../../foundation";
|
|
33
35
|
import { AntomSDKCore } from "../../../../foundation/core";
|
|
34
36
|
import { ElementProcessor } from "../../../../foundation/product-processor/element";
|
|
35
|
-
import { ServiceProvider } from "../../../../foundation/service";
|
|
36
|
-
import { convertPaymentSession } from "../../../../foundation/utils/payment_context_utils";
|
|
37
37
|
import { ProductSceneEnum } from "../../../../types";
|
|
38
|
-
import { ELEMENT_SPM_MAP } from "../../../../util/spm-map";
|
|
39
38
|
import { ElementContainerService } from "../elementContainerService"; // 引入 ElementContainerService
|
|
40
39
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
|
41
40
|
import { EventCenter as ElementEventCenter } from "../EventCenter/index";
|
|
42
41
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
|
43
42
|
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
|
|
44
43
|
import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, safeStringify, showToast } from "../util";
|
|
44
|
+
import { convertPaymentSession } from "../../../../foundation/utils/payment_context_utils";
|
|
45
45
|
var TIMEOUT_DURATION = 10000;
|
|
46
46
|
var ElementController = /*#__PURE__*/function () {
|
|
47
47
|
function ElementController(options) {
|
|
@@ -89,16 +89,13 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
89
89
|
this.options = options;
|
|
90
90
|
var _options = options;
|
|
91
91
|
this.onStatusChangeCallback = _options === null || _options === void 0 ? void 0 : _options.onStatusChangeCallback;
|
|
92
|
-
// 初始化 this.elementContainer 的 status 为 INITING
|
|
93
92
|
this.elementContainer = new AntomSDKCore();
|
|
94
93
|
this.elementContainer.registerProcessor(ProductSceneEnum.ELEMENT_PAYMENT, '', new ElementProcessor());
|
|
95
|
-
// 初始化实例 id,监听 onRedirect 事件
|
|
96
94
|
this.elementContainer.init(this.options, ProductSceneEnum.ELEMENT_PAYMENT);
|
|
97
95
|
this.initService();
|
|
98
96
|
this.elementContainerService = new ElementContainerService({
|
|
99
97
|
instanceId: this.elementContainer.getInstanceId()
|
|
100
98
|
});
|
|
101
|
-
// status 设置为 READY
|
|
102
99
|
this.setControllerStatusOrView(IElementStatus.READY);
|
|
103
100
|
this.elementEventCenter = new ElementEventCenter({
|
|
104
101
|
logger: this.elementContainer.getServiceProvider().getService('Log')
|
|
@@ -208,7 +205,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
208
205
|
key: "initializeAndMountProcessor",
|
|
209
206
|
value: function initializeAndMountProcessor(type, selector, options) {
|
|
210
207
|
this.initElementProcessors(type);
|
|
211
|
-
// 创建 iframe,拉起应用页面,同时监听全局的数据更新和获取事件
|
|
212
208
|
this.elementContainerService.mount({
|
|
213
209
|
type: type,
|
|
214
210
|
selector: selector,
|
|
@@ -245,7 +241,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
245
241
|
key: "mount",
|
|
246
242
|
value: function mount(renderOptions, sdkSelector) {
|
|
247
243
|
var _this2 = this;
|
|
248
|
-
// 此处的 id 是 sessionData && 分割的前3位
|
|
249
244
|
var _convertPaymentSessio = convertPaymentSession(this.options.sessionData),
|
|
250
245
|
sessionData = _convertPaymentSessio.id;
|
|
251
246
|
var startEventId = this.elementEventCenter.registerEvent(EXPOSURE_API_EVENT.MOUNT, sessionData);
|
|
@@ -269,7 +264,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
269
264
|
return;
|
|
270
265
|
}
|
|
271
266
|
_this2.clearAndSetInitTimeout(readyCallback);
|
|
272
|
-
// 回调 loading 的 onStartLoading
|
|
273
267
|
_this2.changeLoading(true);
|
|
274
268
|
try {
|
|
275
269
|
var startBizFlowData = {
|
|
@@ -278,14 +272,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
278
272
|
appendAliasContainerId: true
|
|
279
273
|
})
|
|
280
274
|
};
|
|
281
|
-
// status 设置为 IN_BIZ_FLOW
|
|
282
275
|
_this2.setControllerStatusOrView(IElementStatus.IN_BIZ_FLOW);
|
|
283
276
|
_this2.elementContainer.startBizFlow(startBizFlowData);
|
|
284
|
-
// 创建 iframe 加载应用页面
|
|
285
277
|
_this2.initializeAndMountProcessor(renderOptions.type, sdkSelector, renderOptions);
|
|
286
|
-
// 监听应用页面 onLaunch 事件,请求 sdkAction.query 接口的数据,请求完成后处理数据异常情况或发送 renderComponent 事件及数据给应用层渲染页面内容
|
|
287
278
|
_this2.sendRequestAndWaitWebLaunch(renderOptions, readyCallback);
|
|
288
|
-
// 监听事件
|
|
289
279
|
_this2.addEventListener(readyCallback);
|
|
290
280
|
_this2.serviceMap.EventCenter.addIFrame(_this2.elementContainerService.getContainerService(renderOptions.type).getContainerService().getWebApp());
|
|
291
281
|
} catch (error) {
|
|
@@ -627,10 +617,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
627
617
|
return _context5.abrupt("return");
|
|
628
618
|
case 7:
|
|
629
619
|
_context5.next = 9;
|
|
630
|
-
return Promise.all([containerService.createWebLaunchPromise(),
|
|
631
|
-
// 监听 onLaunch 事件
|
|
632
|
-
this.elementProcessors[type].obtainData() // 请求 sdkAction.query 的数据,connect 还会请求 account.query
|
|
633
|
-
]);
|
|
620
|
+
return Promise.all([containerService.createWebLaunchPromise(), this.elementProcessors[type].obtainData()]);
|
|
634
621
|
case 9:
|
|
635
622
|
_yield$Promise$all = _context5.sent;
|
|
636
623
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
@@ -639,15 +626,12 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
639
626
|
this.serviceMap.Log.logInfo({
|
|
640
627
|
title: 'sdk_event_webAppOnLaunch'
|
|
641
628
|
});
|
|
642
|
-
// 应用页面加载完成且接口请求完成,状态设置为 READY
|
|
643
629
|
containerService === null || containerService === void 0 || containerService.switchContainerStatus(IContainerStatus.READY);
|
|
644
|
-
// 处理接口数据异常情况,直接回调,结束流程
|
|
645
630
|
errorResult = this.getErrorFromResponse(obtainDataResult);
|
|
646
631
|
if (errorResult) {
|
|
647
|
-
// 仅结束
|
|
632
|
+
// 仅结束resove,传出回调码
|
|
648
633
|
readyCallback(errorResult);
|
|
649
634
|
}
|
|
650
|
-
// 页面加载和数据状态 READY 后,SDK 向应用层发送 renderComponent 事件,传递应用层渲染必须的数据
|
|
651
635
|
if (this.areAllContainersReady()) {
|
|
652
636
|
this.elementContainerService.getContainerServices().forEach(function (_, key) {
|
|
653
637
|
_this5.sendReady(key, options);
|
|
@@ -357,7 +357,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
|
357
357
|
console.log('sdk 打印', payload);
|
|
358
358
|
console.log('sdk 触发', options);
|
|
359
359
|
//Sessiondata中authUrlInfo的openInApp为true,说明端内打开,不需要处理isNativeAppWebview的外跳事件逻辑
|
|
360
|
-
if (!(options.isNativeAppWebview &&
|
|
360
|
+
if (!(options.isNativeAppWebview && !payload.openInApp)) {
|
|
361
361
|
_context4.next = 46;
|
|
362
362
|
break;
|
|
363
363
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IoptionsParams } from '../../../types';
|
|
2
1
|
import { PaymentContext, SDKMetaData, Service } from '../../index';
|
|
2
|
+
import { IoptionsParams } from '../../../types';
|
|
3
3
|
import { LogExtra, LogMetaData, LogPayload } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
|
@@ -8,10 +8,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
import { EnvironmentEnum } from "../../../types";
|
|
11
|
+
import { LogComplianceProcessor } from "./processor";
|
|
11
12
|
import { isPC } from "../../../util";
|
|
12
|
-
import { SPM_MAP } from "../../../util/spm-map";
|
|
13
13
|
import { getStorageString, setStorageString } from "../../../util/storage";
|
|
14
|
-
import {
|
|
14
|
+
import { SPM_MAP } from "../../../util/spm-map";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
|
@@ -185,14 +185,14 @@ export var LogService = /*#__PURE__*/function () {
|
|
|
185
185
|
value: function loadScript(url, callback) {
|
|
186
186
|
var _this3 = this;
|
|
187
187
|
/*
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
188
|
+
* 如果宿主环境存在AMD加载器,通过直接创建script标签的方式加载会造成宿主环境报错:
|
|
189
|
+
* Message: Mismatched anonymous define() module
|
|
190
|
+
* 原因是直接通过script标签加载的模块如果没有定义模块名,会被AMD加载器认为是匿名模块,
|
|
191
|
+
* 而宿主环境中已经存在匿名模块,导致报错。
|
|
192
|
+
*
|
|
193
|
+
* TODO: 所有通过window.iTracker调用的方法都需要判断
|
|
194
|
+
* 是否是AMD环境,如果是,需要通过require加载获取iTracker实例
|
|
195
|
+
* */
|
|
196
196
|
if (typeof window.define === 'function' && window.define.amd && typeof window.require === 'function') {
|
|
197
197
|
var moduleId = 'antom_iTracker';
|
|
198
198
|
try {
|
|
@@ -227,12 +227,7 @@ export var LogService = /*#__PURE__*/function () {
|
|
|
227
227
|
script.onerror = function () {
|
|
228
228
|
console.error("unable to load Antom script: ".concat(url));
|
|
229
229
|
};
|
|
230
|
-
|
|
231
|
-
if (document.body) {
|
|
232
|
-
document.body.appendChild(script);
|
|
233
|
-
} else if (document.head) {
|
|
234
|
-
document.head.appendChild(script);
|
|
235
|
-
}
|
|
230
|
+
document.body.appendChild(script);
|
|
236
231
|
}
|
|
237
232
|
}, {
|
|
238
233
|
key: "initTracker",
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { AMSCheckout } from './main';
|
|
2
|
-
export { AMSEasyPayWrapper as AMSEasyPay,
|
|
3
|
-
|
|
2
|
+
export { AMSEasyPayWrapper as AMSEasyPay, // 异步加载动态更新 - 代扣
|
|
3
|
+
AMSElementWrapper as AMSElement } from './loader/index';
|
|
4
|
+
export { AMSCashierPayment, // 线上使用率最大的,老的卡支付SDK
|
|
5
|
+
AMSCheckoutPage, // 嵌入式CKP
|
|
6
|
+
AMSVaulting, // 老的绑卡,与AMSCashierPayment代码复用率到95%
|
|
7
|
+
AntomElement, // 最早版本的element,未在商户使用,只在测试中使用
|
|
8
|
+
AMSCheckout, // 为超类,理论不需要导出
|
|
9
|
+
AMSAutoDebit, // 被EasyPay代替,已废弃
|
|
10
|
+
AMSAutoDebitPay, // 被EasyPay代替,已废弃
|
|
11
|
+
AddressElement, } from './main';
|
|
4
12
|
export * from './types';
|
|
5
13
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { AMSCheckout } from "./main";
|
|
2
2
|
import { injectAntomSDKIntegrationType } from "./util/integrationType";
|
|
3
3
|
injectAntomSDKIntegrationType('NPM');
|
|
4
|
-
export { AMSEasyPayWrapper as AMSEasyPay,
|
|
5
|
-
|
|
4
|
+
export { AMSEasyPayWrapper as AMSEasyPay,
|
|
5
|
+
// 异步加载动态更新 - 代扣
|
|
6
|
+
AMSElementWrapper as AMSElement // 异步加载动态更新 - element
|
|
7
|
+
} from "./loader/index";
|
|
8
|
+
export { AMSCashierPayment,
|
|
9
|
+
// 线上使用率最大的,老的卡支付SDK
|
|
10
|
+
AMSCheckoutPage,
|
|
11
|
+
// 嵌入式CKP
|
|
12
|
+
AMSVaulting,
|
|
13
|
+
// 老的绑卡,与AMSCashierPayment代码复用率到95%
|
|
14
|
+
|
|
15
|
+
AntomElement,
|
|
16
|
+
// 最早版本的element,未在商户使用,只在测试中使用
|
|
17
|
+
AMSCheckout,
|
|
18
|
+
// 为超类,理论不需要导出
|
|
19
|
+
AMSAutoDebit,
|
|
20
|
+
// 被EasyPay代替,已废弃
|
|
21
|
+
AMSAutoDebitPay,
|
|
22
|
+
// 被EasyPay代替,已废弃
|
|
23
|
+
AddressElement // 未使用
|
|
24
|
+
} from "./main";
|
|
6
25
|
export * from "./types";
|
|
7
26
|
export default AMSCheckout;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseElement, BaseElementsFactory } from '@antintl/opensdk-core';
|
|
2
|
+
import { Elements } from './elements';
|
|
3
|
+
import { ExpressElement, type ExpressElementConfig } from './elements/ExpressElement';
|
|
4
|
+
import type { AntomSDKConfig } from './types';
|
|
5
|
+
export declare class AntomSDK extends BaseElementsFactory {
|
|
6
|
+
static version: string;
|
|
7
|
+
constructor(config?: AntomSDKConfig);
|
|
8
|
+
elements(): Elements;
|
|
9
|
+
createElement(elementType: 'expressElement', options?: ExpressElementConfig): ExpressElement;
|
|
10
|
+
getElement(elementType: string): BaseElement;
|
|
11
|
+
}
|
|
12
|
+
export default AntomSDK;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
import { BaseElementsFactory } from '@antintl/opensdk-core';
|
|
16
|
+
import { Elements } from "./elements";
|
|
17
|
+
import { ExpressElement } from "./elements/ExpressElement";
|
|
18
|
+
var supportedElements = {
|
|
19
|
+
expressElement: ExpressElement
|
|
20
|
+
};
|
|
21
|
+
export var AntomSDK = /*#__PURE__*/function (_BaseElementsFactory) {
|
|
22
|
+
_inherits(AntomSDK, _BaseElementsFactory);
|
|
23
|
+
var _super = _createSuper(AntomSDK);
|
|
24
|
+
function AntomSDK(config) {
|
|
25
|
+
_classCallCheck(this, AntomSDK);
|
|
26
|
+
return _super.call(this, config, config === null || config === void 0 ? void 0 : config.targetOrigin);
|
|
27
|
+
}
|
|
28
|
+
_createClass(AntomSDK, [{
|
|
29
|
+
key: "elements",
|
|
30
|
+
value: function elements() {
|
|
31
|
+
return new Elements({
|
|
32
|
+
debug: this.config.debug,
|
|
33
|
+
targetOrigin: this.targetOrigin
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "createElement",
|
|
38
|
+
value: function createElement(elementType, options) {
|
|
39
|
+
if (supportedElements[elementType]) {
|
|
40
|
+
return this._createElement(supportedElements[elementType], options);
|
|
41
|
+
}
|
|
42
|
+
throw new Error("Element type ".concat(elementType, " not supported."));
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "getElement",
|
|
46
|
+
value: function getElement(elementType) {
|
|
47
|
+
console.log(elementType);
|
|
48
|
+
throw new Error('Method not implemented.');
|
|
49
|
+
}
|
|
50
|
+
}]);
|
|
51
|
+
return AntomSDK;
|
|
52
|
+
}(BaseElementsFactory);
|
|
53
|
+
_defineProperty(AntomSDK, "version", '__SDK_VERSION__');
|
|
54
|
+
export default AntomSDK;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseElement, type BaseElementConfig, type BaseAppearance } from '@antintl/opensdk-core';
|
|
2
|
+
export interface ExpressElementConfig extends BaseElementConfig<BaseAppearance<{
|
|
3
|
+
displaySetting: 'showFooter';
|
|
4
|
+
}>> {
|
|
5
|
+
}
|
|
6
|
+
export declare class ExpressElement extends BaseElement<ExpressElementConfig> {
|
|
7
|
+
submit(something?: Record<string, any>): void;
|
|
8
|
+
protected focus(): void;
|
|
9
|
+
protected blur(): void;
|
|
10
|
+
protected clear(): void;
|
|
11
|
+
get isMainElement(): boolean;
|
|
12
|
+
static elementType: string;
|
|
13
|
+
on(event: string, handler: (...args: []) => any): void;
|
|
14
|
+
constructor(config: ExpressElementConfig);
|
|
15
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
import { BaseElement } from '@antintl/opensdk-core';
|
|
18
|
+
export var ExpressElement = /*#__PURE__*/function (_BaseElement) {
|
|
19
|
+
_inherits(ExpressElement, _BaseElement);
|
|
20
|
+
var _super = _createSuper(ExpressElement);
|
|
21
|
+
function ExpressElement(config) {
|
|
22
|
+
_classCallCheck(this, ExpressElement);
|
|
23
|
+
return _super.call(this, ExpressElement.elementType, _objectSpread(_objectSpread({}, config), {}, {
|
|
24
|
+
isMainElement: true,
|
|
25
|
+
appUrl: 'http://api-sandbox.local.alipay.net:5173/child.html',
|
|
26
|
+
appConfig: {
|
|
27
|
+
appearance: {
|
|
28
|
+
displaySetting: {
|
|
29
|
+
showFooter: true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
_createClass(ExpressElement, [{
|
|
36
|
+
key: "submit",
|
|
37
|
+
value: function submit(something) {
|
|
38
|
+
throw new Error('Method not implemented.');
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "focus",
|
|
42
|
+
value: function focus() {
|
|
43
|
+
throw new Error('Method not implemented.');
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "blur",
|
|
47
|
+
value: function blur() {
|
|
48
|
+
throw new Error('Method not implemented.');
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "clear",
|
|
52
|
+
value: function clear() {
|
|
53
|
+
throw new Error('Method not implemented.');
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "isMainElement",
|
|
57
|
+
get: function get() {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "on",
|
|
62
|
+
value: function on(event, handler) {
|
|
63
|
+
this._on(event, handler);
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
66
|
+
return ExpressElement;
|
|
67
|
+
}(BaseElement);
|
|
68
|
+
_defineProperty(ExpressElement, "elementType", 'expressElement');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseElement, type BaseElementConfig, type BaseAppearance } from '@antintl/opensdk-core';
|
|
2
|
+
export interface SubElementConfig extends BaseElementConfig<BaseAppearance<{
|
|
3
|
+
variables: '--primary' | '--radius';
|
|
4
|
+
}>> {
|
|
5
|
+
}
|
|
6
|
+
export declare class SubElement extends BaseElement<SubElementConfig> {
|
|
7
|
+
protected submit(something?: Record<string, any>): void;
|
|
8
|
+
protected focus(): void;
|
|
9
|
+
protected blur(): void;
|
|
10
|
+
protected clear(): void;
|
|
11
|
+
static elementType: string;
|
|
12
|
+
on(event: string, handler: (...args: []) => any): void;
|
|
13
|
+
constructor(config: SubElementConfig);
|
|
14
|
+
get isMainElement(): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
import { BaseElement } from '@antintl/opensdk-core';
|
|
18
|
+
export var SubElement = /*#__PURE__*/function (_BaseElement) {
|
|
19
|
+
_inherits(SubElement, _BaseElement);
|
|
20
|
+
var _super = _createSuper(SubElement);
|
|
21
|
+
function SubElement(config) {
|
|
22
|
+
_classCallCheck(this, SubElement);
|
|
23
|
+
return _super.call(this, SubElement.elementType, _objectSpread(_objectSpread({}, config), {}, {
|
|
24
|
+
isMainElement: false,
|
|
25
|
+
appUrl: 'http://api-sandbox.local.alipay.net:5173/child2.html'
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
_createClass(SubElement, [{
|
|
29
|
+
key: "submit",
|
|
30
|
+
value: function submit(something) {
|
|
31
|
+
throw new Error('Method not implemented.');
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "focus",
|
|
35
|
+
value: function focus() {
|
|
36
|
+
throw new Error('Method not implemented.');
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "blur",
|
|
40
|
+
value: function blur() {
|
|
41
|
+
throw new Error('Method not implemented.');
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "clear",
|
|
45
|
+
value: function clear() {
|
|
46
|
+
throw new Error('Method not implemented.');
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "on",
|
|
50
|
+
value: function on(event, handler) {
|
|
51
|
+
this._on(event, handler);
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "isMainElement",
|
|
55
|
+
get: function get() {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}]);
|
|
59
|
+
return SubElement;
|
|
60
|
+
}(BaseElement);
|
|
61
|
+
_defineProperty(SubElement, "elementType", 'subElement');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseElement, type BaseElementsConfig, BaseElements, BaseElementConfig } from '@antintl/opensdk-core';
|
|
2
|
+
import { ExpressElement, ExpressElementConfig } from './elements/ExpressElement';
|
|
3
|
+
import { SubElement, SubElementConfig } from './elements/SubElement';
|
|
4
|
+
export declare class Elements extends BaseElements {
|
|
5
|
+
constructor(config: BaseElementsConfig);
|
|
6
|
+
createElement(elementType: 'expressElement', options?: ExpressElementConfig): ExpressElement;
|
|
7
|
+
createElement(elementType: 'subElement', options?: SubElementConfig): SubElement;
|
|
8
|
+
protected getElement(elementType: string, options?: BaseElementConfig): BaseElement;
|
|
9
|
+
protected create(elementType: string, options?: BaseElementConfig): BaseElement;
|
|
10
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
import { BaseElements } from '@antintl/opensdk-core';
|
|
15
|
+
import { ExpressElement } from "./elements/ExpressElement";
|
|
16
|
+
import { SubElement } from "./elements/SubElement";
|
|
17
|
+
var supportedElements = {
|
|
18
|
+
expressElement: ExpressElement,
|
|
19
|
+
subElement: SubElement
|
|
20
|
+
};
|
|
21
|
+
export var Elements = /*#__PURE__*/function (_BaseElements) {
|
|
22
|
+
_inherits(Elements, _BaseElements);
|
|
23
|
+
var _super = _createSuper(Elements);
|
|
24
|
+
function Elements(config) {
|
|
25
|
+
_classCallCheck(this, Elements);
|
|
26
|
+
return _super.call(this, config);
|
|
27
|
+
}
|
|
28
|
+
_createClass(Elements, [{
|
|
29
|
+
key: "createElement",
|
|
30
|
+
value: function createElement(elementType, options) {
|
|
31
|
+
return this._createGroupElement(elementType, options);
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "getElement",
|
|
35
|
+
value: function getElement(elementType, options) {
|
|
36
|
+
throw new Error('Method not implemented.');
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "create",
|
|
40
|
+
value: function create(elementType, options) {
|
|
41
|
+
if (supportedElements[elementType]) {
|
|
42
|
+
return this._createElement(supportedElements[elementType], options);
|
|
43
|
+
}
|
|
44
|
+
throw new Error("Element type ".concat(elementType, " not supported."));
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return Elements;
|
|
48
|
+
}(BaseElements);
|