@soyio/soyio-widget 0.0.33 → 0.0.35
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/README.md +65 -18
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Soyio desktop widget</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<em>
|
|
5
|
+
Use the Soyio widget within your web application as a Window.
|
|
6
|
+
</em>
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@soyio/soyio-widget" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/@soyio/soyio-widget?label=version&logo=nodedotjs&logoColor=%23fff&color=306998" alt="NPM - Version">
|
|
12
|
+
</a>
|
|
13
|
+
</p>
|
|
6
14
|
|
|
7
|
-
##
|
|
15
|
+
## Installation
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
Install using npm! (or your favorite package manager)
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
# Using npm
|
|
21
|
+
npm install @soyio/soyio-widget
|
|
22
|
+
|
|
23
|
+
# Using yarn
|
|
24
|
+
yarn add @soyio/soyio-widget
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Integrate the widget into your frontend framework using the script below. Ensure to replace placeholders (e.g., <flow>, <company id>) with actual values relevant to your implementation.
|
|
10
30
|
|
|
11
31
|
```html
|
|
12
32
|
<script>
|
|
33
|
+
// Widget configuration
|
|
13
34
|
const widgetConfig = {
|
|
14
|
-
flow:
|
|
15
|
-
configProps
|
|
16
|
-
companyId:
|
|
17
|
-
userReference:
|
|
18
|
-
userEmail:
|
|
19
|
-
flowTemplateId:
|
|
20
|
-
identityId:
|
|
21
|
-
}
|
|
22
|
-
onEvent: (data) => console.log(
|
|
23
|
-
isSandbox: true
|
|
24
|
-
}
|
|
35
|
+
flow: "<flow>",
|
|
36
|
+
configProps: {
|
|
37
|
+
companyId: "<company id>",
|
|
38
|
+
userReference: "<user identifier of company>",
|
|
39
|
+
userEmail: "<user email>",
|
|
40
|
+
flowTemplateId: "<flow template id>",
|
|
41
|
+
identityId: "<identity id>",
|
|
42
|
+
},
|
|
43
|
+
onEvent: (data) => console.log("Data: ", data),
|
|
44
|
+
isSandbox: true,
|
|
45
|
+
};
|
|
25
46
|
|
|
26
47
|
// Create widget when needed. In this example, widget is created when page is loaded.
|
|
27
|
-
document.addEventListener(
|
|
28
|
-
new Widget(widgetConfig)
|
|
48
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
49
|
+
new Widget(widgetConfig);
|
|
29
50
|
});
|
|
30
51
|
</script>
|
|
31
52
|
|
|
@@ -33,3 +54,29 @@ For frontend frameworks, this should be imported as follows.
|
|
|
33
54
|
<div id="soyio-widget-iframe-container"></div>
|
|
34
55
|
</body>
|
|
35
56
|
```
|
|
57
|
+
|
|
58
|
+
#### Attribute Descriptions
|
|
59
|
+
|
|
60
|
+
- **`flow`**: A string that can only take the values `'register'` or `'authenticate'`. Specifies the workflow of the widget.
|
|
61
|
+
- **`companyId`**: The unique identifier for the company, must start with `'com_'`.
|
|
62
|
+
- **`userReference`**: (Optional) A reference identifier provided by the company for the user engaging with the widget. This identifier is used in events (`onEvent` and `webhooks`) to inform the company which user the events are associated with.
|
|
63
|
+
- **`userEmail`**: The user's email address. This field is optional when the flow is `'register'`, where if not provided, Soyio will prompt the user to enter their email. However, for the `'authenticate'` flow, this field should not be provided.
|
|
64
|
+
- **`flowTemplateId`**: : Required only in the `'register'` flow, this identifier specifies the order and quantity of documents requested from the user. It must start with `'vft_'`.
|
|
65
|
+
- **`identityId`**: Necessary only in the `'authenticate'` flow, this identifier must start with `'id_'` and signifies the user's identity.
|
|
66
|
+
- **`onEvent`**: A callback function triggered upon event occurrences, used for capturing and logging event-related data.
|
|
67
|
+
- **`isSandbox`**: (Optional) Indicates if the widget should operate in sandbox mode, defaulting to false.
|
|
68
|
+
|
|
69
|
+
#### Events
|
|
70
|
+
|
|
71
|
+
The `onEvent` callback is designed to handle various events that occur during widget interaction. Specifically, it receives detailed information upon the successful completion of user flows. Here are the events it handles:
|
|
72
|
+
|
|
73
|
+
- **`IDENTITY_REGISTERED`**: This event is dispatched when a user successfully completes the registration flow. The event object contains:
|
|
74
|
+
|
|
75
|
+
- `eventName`: The name of the event, in this case, `'IDENTITY_REGISTERED'`.
|
|
76
|
+
- `identityId`: The unique identifier for the newly registered identity.
|
|
77
|
+
- `userReference`: The reference identifier for the user, facilitating the association of the event with the user within the company's context.
|
|
78
|
+
|
|
79
|
+
- **`IDENTITY_AUTHENTICATED`**: This event occurs when a user successfully completes the authentication flow. The event object includes:
|
|
80
|
+
- `eventName`: The name of the event, here `'IDENTITY_AUTHENTICATED'`.
|
|
81
|
+
- `identityId`: The unique identifier for the authenticated identity.
|
|
82
|
+
- `userReference`: The reference identifier for the user, facilitating the association of the event with the user within the company's context.
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function Jt(E, y, D, S) {
|
|
|
24
24
|
}
|
|
25
25
|
let _ = null;
|
|
26
26
|
function qt(E, y, D, S) {
|
|
27
|
-
const g = Jt(E, y, D, S), v =
|
|
27
|
+
const g = Jt(E, y, D, S), v = 710, W = 720, B = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : window.screen.width, Z = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : window.screen.height, k = B / 2 - v / 2, J = Z / 2 - W / 2;
|
|
28
28
|
if (_ = window.open(g, "Soyio", `scrollbars=yes, width=${v}, height=${W}, top=${J}, left=${k}`), _)
|
|
29
29
|
_.focus();
|
|
30
30
|
else
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(N,O){typeof exports=="object"&&typeof module<"u"?module.exports=O():typeof define=="function"&&define.amd?define(O):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=O())})(this,function(){"use strict";var Qt=Object.defineProperty;var _t=(N,O,L)=>O in N?Qt(N,O,{enumerable:!0,configurable:!0,writable:!0,value:L}):N[O]=L;var ln=(N,O,L)=>(_t(N,typeof O!="symbol"?O+"":O,L),L),ne=(N,O,L)=>{if(!O.has(N))throw TypeError("Cannot "+L)};var vt=(N,O,L)=>{if(O.has(N))throw TypeError("Cannot add the same private member more than once");O instanceof WeakSet?O.add(N):O.set(N,L)};var wt=(N,O,L)=>(ne(N,O,"access private method"),L);var vn,mt;const N="https://app.soyio.id/widget",O="https://sandbox.soyio.id/widget",L=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED"];function pt(A,z,J,W){const g=W||(J?O:N),v=`platform=web&companyId=${encodeURIComponent(z.companyId)}`,y=z.userEmail?`&userEmail=${z.userEmail}`:"";switch(A){case"authenticate":return`${g}/authenticate?${v}&identityId=${z.identityId}`;case"register":return`${g}/register?${v}&flowTemplateId=${z.flowTemplateId}${y}`;default:return"INVALID_PARAMS"}}let nn=null;function gt(A,z,J,W){const g=pt(A,z,J,W),v=
|
|
1
|
+
(function(N,O){typeof exports=="object"&&typeof module<"u"?module.exports=O():typeof define=="function"&&define.amd?define(O):(N=typeof globalThis<"u"?globalThis:N||self,N["soyio-widget"]=O())})(this,function(){"use strict";var Qt=Object.defineProperty;var _t=(N,O,L)=>O in N?Qt(N,O,{enumerable:!0,configurable:!0,writable:!0,value:L}):N[O]=L;var ln=(N,O,L)=>(_t(N,typeof O!="symbol"?O+"":O,L),L),ne=(N,O,L)=>{if(!O.has(N))throw TypeError("Cannot "+L)};var vt=(N,O,L)=>{if(O.has(N))throw TypeError("Cannot add the same private member more than once");O instanceof WeakSet?O.add(N):O.set(N,L)};var wt=(N,O,L)=>(ne(N,O,"access private method"),L);var vn,mt;const N="https://app.soyio.id/widget",O="https://sandbox.soyio.id/widget",L=["IDENTITY_AUTHENTICATED","IDENTITY_REGISTERED"];function pt(A,z,J,W){const g=W||(J?O:N),v=`platform=web&companyId=${encodeURIComponent(z.companyId)}`,y=z.userEmail?`&userEmail=${z.userEmail}`:"";switch(A){case"authenticate":return`${g}/authenticate?${v}&identityId=${z.identityId}`;case"register":return`${g}/register?${v}&flowTemplateId=${z.flowTemplateId}${y}`;default:return"INVALID_PARAMS"}}let nn=null;function gt(A,z,J,W){const g=pt(A,z,J,W),v=710,y=720,q=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,K=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,tn=q/2-v/2,Z=K/2-y/2;if(nn=window.open(g,"Soyio",`scrollbars=yes, width=${v}, height=${y}, top=${Z}, left=${tn}`),nn)nn.focus();else throw new Error("Failed to open new window")}function yt(){nn&&(nn.close(),nn=null)}var Et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wt(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Tn={exports:{}},Cn={exports:{}};(function(A,z){(function(J,W){A.exports=W()})(typeof self<"u"?self:Et,function(){return function(J){var W={};function g(v){if(W[v])return W[v].exports;var y=W[v]={i:v,l:!1,exports:{}};return J[v].call(y.exports,y,y.exports,g),y.l=!0,y.exports}return g.m=J,g.c=W,g.d=function(v,y,q){g.o(v,y)||Object.defineProperty(v,y,{enumerable:!0,get:q})},g.r=function(v){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})},g.t=function(v,y){if(1&y&&(v=g(v)),8&y||4&y&&typeof v=="object"&&v&&v.__esModule)return v;var q=Object.create(null);if(g.r(q),Object.defineProperty(q,"default",{enumerable:!0,value:v}),2&y&&typeof v!="string")for(var K in v)g.d(q,K,(function(tn){return v[tn]}).bind(null,K));return q},g.n=function(v){var y=v&&v.__esModule?function(){return v.default}:function(){return v};return g.d(y,"a",y),y},g.o=function(v,y){return{}.hasOwnProperty.call(v,y)},g.p="",g(g.s=0)}([function(J,W,g){g.r(W),g.d(W,"Promise",function(){return x}),g.d(W,"TYPES",function(){return Xt}),g.d(W,"ProxyWindow",function(){return U}),g.d(W,"setup",function(){return lt}),g.d(W,"destroy",function(){return Kt}),g.d(W,"serializeMessage",function(){return $t}),g.d(W,"deserializeMessage",function(){return Zt}),g.d(W,"createProxyWindow",function(){return Vt}),g.d(W,"toProxyWindow",function(){return Yt}),g.d(W,"on",function(){return V}),g.d(W,"once",function(){return qt}),g.d(W,"send",function(){return Y}),g.d(W,"markWindowKnown",function(){return tt}),g.d(W,"cleanUpWindow",function(){return kt}),g.d(W,"bridge",function(){});function v(n){return{}.toString.call(n)==="[object RegExp]"}var y=`Call was rejected by callee.\r
|
|
2
2
|
`;function q(n){return n===void 0&&(n=window),n.location.protocol}function K(n){if(n===void 0&&(n=window),n.mockDomain){var e=n.mockDomain.split("//")[0];if(e)return e}return q(n)}function tn(n){return n===void 0&&(n=window),K(n)==="about:"}function Z(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Mn(n){if(n===void 0&&(n=window),n&&!Z(n))try{return n.opener}catch{}}function wn(n){try{return!0}catch{}return!1}function mn(n){n===void 0&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var t=q(n);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=Z(n);return r&&wn()?mn(r):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function C(n){n===void 0&&(n=window);var e=mn(n);return e&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:e}function X(n){if(!function(e){try{if(e===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(tn(e)&&wn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),K(r)==="mock:"}(e)&&wn())return!0}catch{}try{if(mn(e)===mn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||tn(n)&&wn()||C(window)===C(n))return!0}catch{}return!1}function pn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Ln(n,e){if(!n||!e)return!1;var t=Z(e);return t?t===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(e).indexOf(n)!==-1}function Fn(n){var e=[],t;try{t=n.frames}catch{t=n}var r;try{r=t.length}catch{}if(r===0)return e;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}e.push(i)}return e}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch{return e}if(!s)return e;e.push(s)}return e}var Dt=[],Nt=[];function B(n,e){e===void 0&&(e=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==y}if(e&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(Dt,n);if(t!==-1){var r=Nt[t];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function Hn(n){return n===void 0&&(n=window),Mn(n=n||window)||Z(n)||void 0}function en(n,e){if(typeof n=="string"){if(typeof e=="string")return n==="*"||e===n;if(v(e)||Array.isArray(e))return!1}return v(n)?v(e)?n.toString()===e.toString():!Array.isArray(e)&&!!e.match(n):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!v(e)&&n.some(function(t){return en(t,e)}))}function gn(n){try{if(n===window)return!0}catch(e){if(e&&e.message===y)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(e){if(e&&e.message===y)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.self===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.parent===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.top===n)return!0}catch(e){if(e&&e.message===y)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Un(n){if(X(n))return pn(n).frameElement;for(var e=0,t=document.querySelectorAll("iframe");e<t.length;e++){var r=t[e];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function Rt(n){if(function(t){return t===void 0&&(t=window),!!Z(t)}(n)){var e=Un(n);if(e&&e.parentElement){e.parentElement.removeChild(e);return}}try{n.close()}catch{}}function k(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var t=e.call(n);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Bn=[],rn=[],Sn=0,on;function Gn(){if(!Sn&&on){var n=on;on=null,n.resolve()}}function bn(){Sn+=1}function an(){Sn-=1,Gn()}var x=function(){function n(t){var r=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var o,i,a=!1,s=!1,c=!1;bn();try{t(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){an(),this.reject(u);return}an(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var e=n.prototype;return e.resolve=function(t){if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},e.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(k(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(Bn.indexOf(i)===-1){Bn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<rn.length;s++)rn[s](i,a)}}(t,r)},1),this.dispatch(),this},e.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},e.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,bn();for(var i=function(l,p){return l.then(function(w){p.resolve(w)},function(w){p.reject(w)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,h=s.promise,d=void 0;if(t)try{d=c?c(this.value):this.value}catch(l){h.reject(l);continue}else if(r){if(!u){h.reject(this.error);continue}try{d=u(this.error)}catch(l){h.reject(l);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?h.resolve(f.value):h.reject(f.error),f.errorHandled=!0}else k(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?h.resolve(d.value):h.reject(d.error):i(d,h):h.resolve(d)}o.length=0,this.dispatching=!1,an()}},e.then=function(t,r){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},e.catch=function(t){return this.then(void 0,t)},e.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(t).then(function(){return r})},function(r){return n.try(t).then(function(){throw r})})},e.timeout=function(t,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},e.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(t){return t instanceof n?t:k(t)?new n(function(r,o){return t.then(r,o)}):new n().resolve(t)},n.reject=function(t){return new n().reject(t)},n.asyncReject=function(t){return new n().asyncReject(t)},n.all=function(t){var r=new n,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,h,d){return h.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<t.length;s++){var c=t[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!k(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(t){var r={},o=[],i=function(s){if(t.hasOwnProperty(s)){var c=t[s];k(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in t)i(a);return n.all(o).then(function(){return r})},n.map=function(t,r){return n.all(t.map(r))},n.onPossiblyUnhandledException=function(t){return function(r){return rn.push(r),{cancel:function(){rn.splice(rn.indexOf(r),1)}}}(t)},n.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;bn();try{i=t.apply(r,o||[])}catch(a){return an(),n.reject(a)}return an(),n.resolve(i)},n.delay=function(t){return new n(function(r){setTimeout(r,t)})},n.isPromise=function(t){return!!(t&&t instanceof n)||k(t)},n.flush=function(){return function(t){var r=on=on||new t;return Gn(),r}(n)},n}();function yn(n,e){for(var t=0;t<n.length;t++)try{if(n[t]===e)return t}catch{}return-1}var Pn=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(gn(i)&&B(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},e.isSafeToReadWrite=function(t){return!gn(t)},e.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=yn(s,t);u===-1?(s.push(t),c.push(r)):c[u]=r},e.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=yn(this.keys,t);if(i!==-1)return this.values[i]},e.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=yn(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},e.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),yn(this.keys,t)!==-1},e.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},n}();function Jn(n){return n.name||n.__name__||n.displayName||"anonymous"}function qn(n,e){try{delete n.name,n.name=e}catch{}return n.__name__=n.displayName=e,n}function $(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(e){if(typeof btoa=="function")return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var En;function $n(n){try{return JSON.stringify([].slice.call(n),function(e,t){return typeof t=="function"?"memoize["+function(r){if(En=En||new Pn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=En.get(r);return o||(o=typeof r+":"+$(),En.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function zt(){return{}}var un=0,Zn=0;function cn(n,e){e===void 0&&(e={});var t=e.thisNamespace,r=t!==void 0&&t,o=e.time,i,a,s=un;un+=1;var c=function(){for(var u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];s<Zn&&(i=null,a=null,s=un,un+=1);var f;f=r?(a=a||new Pn).getOrSet(this,zt):i=i||{};var l;try{l=$n(h)}catch{return n.apply(this,arguments)}var p=f[l];if(p&&o&&Date.now()-p.time<o&&(delete f[l],p=null),p)return p.value;var w=Date.now(),m=n.apply(this,arguments);return f[l]={time:w,value:m},m};return c.reset=function(){i=null,a=null},qn(c,(e.name||Jn(n))+"::memoized")}cn.clear=function(){Zn=un};function jt(n){var e={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=$n(a);return e.hasOwnProperty(c)||(e[c]=x.try(function(){return n.apply(o,r)}).finally(function(){delete e[c]})),e[c]}return t.reset=function(){e={}},qn(t,Jn(n)+"::promiseMemoized")}function Q(){}function sn(n,e){if(e===void 0&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var t=n&&n.stack,r=n&&n.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
3
3
|
`+t;if(t)return t;if(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+sn(o,e+1)}}function Vn(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}cn(function(n){if(Object.values)return Object.values(n);var e=[];for(var t in n)n.hasOwnProperty(t)&&e.push(n[t]);return e});function In(n){return{}.toString.call(n)==="[object RegExp]"}function dn(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r}function Yn(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function Kn(){return!!document.body&&document.readyState==="complete"}function Xn(){return!!document.body&&document.readyState==="interactive"}cn(function(){return new x(function(n){if(Kn()||Xn())return n();var e=setInterval(function(){if(Kn()||Xn())return clearInterval(e),n()},10)})});var Wn=typeof document<"u"?document.currentScript:null,Tt=cn(function(){if(Wn||(Wn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),t=e&&e[1];if(!t)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===t)return i}}catch{}}()))return Wn;throw new Error("Can not determine current script")}),Ct=$();cn(function(){var n;try{n=Tt()}catch{return Ct}var e=n.getAttribute("data-uid");if(e&&typeof e=="string"||(e=n.getAttribute("data-uid-auto"))&&typeof e=="string")return e;if(n.src){var t=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));e="uid_"+t.slice(t.length-30)}else e=$();return n.setAttribute("data-uid-auto",e),e});function fn(n){n===void 0&&(n=window);var e="__post_robot_10_0_46__";return n!==window?n[e]:n[e]=n[e]||{}}var kn=function(){return{}};function j(n,e){return n===void 0&&(n="store"),e===void 0&&(e=kn),dn(fn(),n,function(){var t=e();return{has:function(r){return t.hasOwnProperty(r)},get:function(r,o){return t.hasOwnProperty(r)?t[r]:o},set:function(r,o){return t[r]=o,o},del:function(r){delete t[r]},getOrSet:function(r,o){return dn(t,r,o)},reset:function(){t=e()},keys:function(){return Object.keys(t)}}})}var Mt=function(){};function xn(){var n=fn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new Mt,n.WINDOW_WILDCARD}function M(n,e){return n===void 0&&(n="store"),e===void 0&&(e=kn),j("windowStore").getOrSet(n,function(){var t=new Pn,r=function(o){return t.getOrSet(o,e)};return{has:function(o){return r(o).hasOwnProperty(n)},get:function(o,i){var a=r(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return r(o)[n]=i,i},del:function(o){delete r(o)[n]},getOrSet:function(o,i){return dn(r(o),n,i)}}})}function Qn(){return j("instance").getOrSet("instanceID",$)}function _n(n,e){var t=e.domain,r=M("helloPromises"),o=r.get(n);o&&o.resolve({domain:t});var i=x.resolve({domain:t});return r.set(n,i),i}function On(n,e){return(0,e.send)(n,"postrobot_hello",{instanceID:Qn()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return _n(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function nt(n,e){var t=e.send;return M("windowInstanceIDPromises").getOrSet(n,function(){return On(n,{send:t}).then(function(r){return r.instanceID})})}function tt(n){M("knownWindows").set(n,!0)}function An(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function et(n){return n===void 0?"undefined":n===null?"null":Array.isArray(n)?"array":typeof n=="function"?"function":typeof n=="object"?n instanceof Error?"error":typeof n.then=="function"?"promise":{}.toString.call(n)==="[object RegExp]"?"regex":{}.toString.call(n)==="[object Date]"?"date":"object":typeof n=="string"?"string":typeof n=="number"?"number":typeof n=="boolean"?"boolean":void 0}function _(n,e){return{__type__:n,__val__:e}}var F,Lt=((F={}).function=function(){},F.error=function(n){return _("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},F.promise=function(){},F.regex=function(n){return _("regex",n.source)},F.date=function(n){return _("date",n.toJSON())},F.array=function(n){return n},F.object=function(n){return n},F.string=function(n){return n},F.number=function(n){return n},F.boolean=function(n){return n},F.null=function(n){return n},F[void 0]=function(n){return _("undefined",n)},F),Ft={},H,Ht=((H={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},H.error=function(n){var e=n.stack,t=n.code,r=n.data,o=new Error(n.message);return o.code=t,r&&(o.data=r),o.stack=e+`
|
|
4
4
|
|