@alipay/ams-checkout 0.0.1767075519-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.
@@ -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}()}));
@@ -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 && !!!payload.openInApp)) {
360
+ if (!(options.isNativeAppWebview && !payload.openInApp)) {
361
361
  _context4.next = 46;
362
362
  break;
363
363
  }
package/esm/index.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import { AMSCheckout } from './main';
2
- export { AMSEasyPayWrapper as AMSEasyPay, AMSElementWrapper as AMSElement } from './loader/index';
3
- export { AddressElement, AMSAutoDebit, AMSAutoDebitPay, AMSCashierPayment, AMSCheckout, AMSCheckoutPage, AMSVaulting, AntomElement, } from './main';
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, AMSElementWrapper as AMSElement } from "./loader/index";
5
- export { AddressElement, AMSAutoDebit, AMSAutoDebitPay, AMSCashierPayment, AMSCheckout, AMSCheckoutPage, AMSVaulting, AntomElement } from "./main";
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);
@@ -0,0 +1,7 @@
1
+ import type { AntomSDK } from './antom';
2
+ import type { LoadAntomConfig } from './types';
3
+ /**
4
+ * @description npm package users can use this function
5
+ */
6
+ export declare const load: (config: LoadAntomConfig) => Promise<AntomSDK>;
7
+ export type { AntomSDK };
@@ -0,0 +1,39 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(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(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ import { createLoader } from "./sdkLoader";
11
+ var loader = createLoader({
12
+ sdkURL: 'http://localhost:54901/antom.umd.js',
13
+ globalName: 'AntomSDK'
14
+ });
15
+
16
+ /**
17
+ * @description npm package users can use this function
18
+ */
19
+ export var load = /*#__PURE__*/function () {
20
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
21
+ var targetOrigin;
22
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ // Determine targetOrigin based on environment
26
+ targetOrigin = config.env === 'SANDBOX' ? 'https://sandbox.example.com' : 'https://api.example.com';
27
+ return _context.abrupt("return", loader(_objectSpread(_objectSpread({}, config), {}, {
28
+ targetOrigin: targetOrigin
29
+ })));
30
+ case 2:
31
+ case "end":
32
+ return _context.stop();
33
+ }
34
+ }, _callee);
35
+ }));
36
+ return function load(_x) {
37
+ return _ref.apply(this, arguments);
38
+ };
39
+ }();
@@ -0,0 +1,34 @@
1
+ type Code = 'NO_REMOTE_CLASS' | 'LOAD_ERROR' | 'INIT_ERROR';
2
+ declare class LoaderError extends Error {
3
+ code: Code;
4
+ constructor(code: Code, message: string);
5
+ }
6
+ interface InitType<ClassType> {
7
+ init: () => Promise<ClassType>;
8
+ }
9
+ interface LoaderConfig<Config, ClassType> {
10
+ sdkURL: string;
11
+ globalName: string | (() => new (config: Config) => ClassType);
12
+ /**
13
+ * @description when load error occurs, you can use this callback to monitoring report
14
+ * @param code
15
+ */
16
+ onError?: (e: LoaderError) => void;
17
+ /**
18
+ * @description when start to call load method, you can use this callback to monitoring report
19
+ */
20
+ onLoadStart?: () => void;
21
+ /**
22
+ * @description you can use this callback to monitoring report
23
+ * @param fromCache whether the SDK is loaded from cache
24
+ */
25
+ onLoadComplete?: (fromCache: boolean) => void;
26
+ /**
27
+ * @description when the SDK is initialized successfully, you can use this callback to monitoring report
28
+ */
29
+ onInitialized?: (instance: ClassType, url: string) => void;
30
+ }
31
+ export declare function createInstance<Config, ClassType extends InitType<ClassType>>(ClassConstructor: new (config: Config) => ClassType, config: Config): Promise<ClassType>;
32
+ export declare function createLoader<Config, ClassType extends InitType<ClassType>>(loadConfig: LoaderConfig<Config, ClassType>): (config: Config) => Promise<ClassType>;
33
+ export declare function loadScript<T = any>(url: string): Promise<T>;
34
+ export {};