@optable/web-sdk 0.7.1 → 0.9.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Optable Web SDK [![buildkite](https://badge.buildkite.com/314d07ac4946d31b6fde7a7534a9f13ab72c8aedf761a7ed24.svg)](https://buildkite.com/optable/web-sdk-publish-tag)
2
2
 
3
- JavaScript SDK for integrating with optable-sandbox from a web site or web application.
3
+ JavaScript SDK for integrating with an [Optable Data Connectivity Node (DCN)](https://docs.optable.co/) from a web site or web application.
4
4
 
5
5
  ## Contents
6
6
 
@@ -29,7 +29,7 @@ JavaScript SDK for integrating with optable-sandbox from a web site or web appli
29
29
 
30
30
  The [Optable](https://optable.co/) web SDK can be installed as a ES6 compatible [npm](https://www.npmjs.com/) module paired with module bundlers such as [webpack](https://webpack.js.org/) or [browserify](http://browserify.org/), or can be loaded on a webpage directly by referencing a release build from the page HTML via a `<script>` tag.
31
31
 
32
- > :warning: **CORS Configuration**: Regardless of how you install the SDK, make sure that the _Allowed HTTP Origins_ setting in the Optable sandbox that you are integrating with contains the URL(s) of any web site(s) where the SDK is being used, otherwise your browser may block communication with the sandbox.
32
+ > :warning: **CORS Configuration**: Regardless of how you install the SDK, make sure that the _Allowed HTTP Origins_ setting in the Optable DCN that you are integrating with contains the URL(s) of any web site(s) where the SDK is being used, otherwise your browser may block communication with the DCN.
33
33
 
34
34
  ### npm module
35
35
 
@@ -69,43 +69,43 @@ You can therefore expect that there will not be any breaking API changes if you
69
69
 
70
70
  ## Domains and Cookies
71
71
 
72
- The SDK does **not** depend on the availability of the third-party cookie feature in browsers. By default, the [Optable](https://optable.co/) SDK makes use of a secure HTTP-only _first-party_ browser cookie in order to anonymously identify browsers via a _visitor ID_, within the context of any web sites sharing an _effective top-level domain plus one_ (eTLD+1) with the configured sandbox host.
72
+ By default, the [Optable](https://optable.co/) SDK makes use of a secure HTTP-only _first-party_ browser cookie in order to anonymously identify browsers via a _visitor ID_, within the context of any web sites sharing an _effective top-level domain plus one_ (eTLD+1) with the configured DCN host.
73
73
 
74
- For example, if your website runs at `www.customer.com` or `customer.com`, then ideally your sandbox will be configured to run at `sandbox.customer.com`, and will read/write a domain-level first-party cookie at `customer.com`. The contents of the cookie will not be accessible to any third-party scripts. Finally, the cookie will have the `SameSite=Lax`attribute so that it is available on the first visit.
74
+ For example, if your website runs at `www.customer.com` or `customer.com`, then ideally your DCN will be configured to run at `dcn.customer.com`, and will read/write a first-party cookie at `customer.com`. The contents of the cookie will not be accessible to any third-party scripts. Finally, the cookie will have the `SameSite=Lax`attribute so that it is available on the first visit.
75
75
 
76
- > :warning: **Optable Visitor ID Scope**: The _visitor ID_ configured by the Optable sandbox will be unique to a browser only within the top-level domain that the sandbox shares with the calling web site.
76
+ > :warning: **Optable Visitor ID Scope**: The _visitor ID_ configured by the Optable DCN will be unique to a browser only within the top-level domain that the DCN shares with the calling web site.
77
77
 
78
78
  ### LocalStorage
79
79
 
80
- In cases where it is not practical or possible to configure your sandbox to run on the same effective top-level domain plus one (eTLD+1) as your website(s), then the default cookie-based transport that the SDK depends on will not work. Instead, a fallback cookie-less transport utilizing browser `LocalStorage` is recommended. To switch to the cookie-less transport, simply set the optional `cookies` parameter to `false` when creating your SDK instance. For example:
80
+ In cases where it is not practical or possible to configure your DCN to run on the same effective top-level domain plus one (eTLD+1) as your website(s), then the default cookie-based transport that the SDK depends on will not work. Instead, you can configure the SDK to use browser `LocalStorage`. To switch to the `LocalStorage` based configuration, simply set the optional `cookies` parameter to `false` when creating your SDK instance. For example:
81
81
 
82
82
  ```javascript
83
83
  import OptableSDK from "@optable/web-sdk";
84
84
 
85
- const sdk = new OptableSDK({ host: "sandbox.customer.com", site: "my-site", cookies: false });
85
+ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site", cookies: false });
86
86
  ```
87
87
 
88
88
  Note that the default is `cookies: true` and will be inferred if you do not specify the `cookies` parameter at all.
89
89
 
90
90
  ## Using (npm module)
91
91
 
92
- To configure an instance of `OptableSDK` integrating with an [Optable](https://optable.co/) sandbox running at hostname `sandbox.customer.com`, from a configured web site origin identified by slug `my-site`, you simply create an instance of the `OptableSDK` class exported by the `@optable/web-sdk` module:
92
+ To configure an instance of `OptableSDK` integrating with an [Optable](https://optable.co/) DCN running at hostname `dcn.customer.com`, from a configured web site origin identified by slug `my-site`, you simply create an instance of the `OptableSDK` class exported by the `@optable/web-sdk` module:
93
93
 
94
94
  ```js
95
95
  import OptableSDK from "@optable/web-sdk";
96
96
 
97
- const sdk = new OptableSDK({ host: "sandbox.customer.com", site: "my-site" });
97
+ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site" });
98
98
  ```
99
99
 
100
- You can then call various SDK APIs on the instance as shown in the examples below. It's also possible to configure multiple instances of `OptableSDK` in order to connect to other (e.g., partner) sandboxes and/or reference other configured web site slug IDs.
100
+ You can then call various SDK APIs on the instance as shown in the examples below. It's also possible to configure multiple instances of `OptableSDK` in order to connect to other (e.g., partner) DCNs and/or reference other configured web site slug IDs.
101
101
 
102
- Note that all SDK communication with Optable sandboxes is done over TLS. The only exception to this is if you instantiate the `OptableSDK` class with the `insecure` optional boolean parameter set to `true`. For example:
102
+ Note that all SDK communication with Optable DCNs is done over TLS. The only exception to this is if you instantiate the `OptableSDK` class with the `insecure` optional boolean parameter set to `true`. For example:
103
103
 
104
104
  ```js
105
- const sdk = new OptableSDK({ host: "sandbox.customer.com", site: "my-site", insecure: true });
105
+ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site", insecure: true });
106
106
  ```
107
107
 
108
- However, since production sandboxes only listen to TLS traffic, the above is really only useful for developers of `optable-sandbox` running the sandbox locally for testing. See [developer docs](https://github.com/Optable/optable-web-sdk/tree/master/docs) for other developer notes.
108
+ Note that production DCNs only listen to TLS traffic. The `insecure: true` option is meant to be used by Optable developers running the DCN locally for testing. See [developer docs](https://github.com/Optable/optable-web-sdk/tree/master/docs) for other developer notes.
109
109
 
110
110
  ### Identify API
111
111
 
@@ -120,16 +120,16 @@ const emailID = OptableSDK.eid("some.email@address.com");
120
120
  // Identify with Email ID (eid):
121
121
  sdk.identify(emailID).then(onSuccess).catch(onFailure);
122
122
 
123
- // You can optionally link it with your own PPID in the same sandbox identification call,
123
+ // You can optionally link it with your own PPID in the same DCN identification call,
124
124
  // simply pass a second argument to identify(). A custom PPID value can be sent to identify()
125
125
  // after it is prepared with the OptableSDK.cid() helper:
126
126
  const ppid = OptableSDK.cid("some.ppid");
127
127
  sdk.identify(emailID, ppid).then(onSuccess).catch(onFailure);
128
128
  ```
129
129
 
130
- The `identify()` method will asynchronously connect to the configured sandbox and send IDs for resolution.
130
+ The `identify()` method will asynchronously connect to the configured DCN and send IDs for resolution.
131
131
 
132
- > :warning: **Client-Side Email Hashing**: The `OptableSDK.eid()` helper will compute the SHA-256 hash of the Email address on the client-side and send the hashed value to the sandbox. The Email address is **not** sent by the browser in plain text.
132
+ > :warning: **Client-Side Email Hashing**: The `OptableSDK.eid()` helper will compute the SHA-256 hash of the Email address on the client-side and send the hashed value to the DCN. The Email address is **not** sent by the browser in plain text.
133
133
 
134
134
  The frequency of invocation of `identify` is up to you, however for optimal identity resolution we recommended to call the `identify()` method on your `OptableSDK` instance on each page load while the user is authenticated, or periodically such as for example once every 15 to 60 minutes while the user is authenticated and actively using your site.
135
135
 
@@ -163,7 +163,7 @@ type ProfileTraits = {
163
163
 
164
164
  ### Targeting API
165
165
 
166
- To get the targeting key values associated by the configured sandbox with the user's browser in real-time, you can call the targeting API as follows:
166
+ To get the targeting key values associated by the configured DCN with the user's browser in real-time, you can call the targeting API as follows:
167
167
 
168
168
  ```js
169
169
  sdk
@@ -202,7 +202,7 @@ Note that both `targetingFromCache()` and `targetingClearCache()` are synchronou
202
202
 
203
203
  ### Witness API
204
204
 
205
- To send real-time event data from the user's browser to the sandbox for eventual audience assembly, you can call the witness API as follows:
205
+ To send real-time event data from the user's browser to the DCN for eventual audience assembly, you can call the witness API as follows:
206
206
 
207
207
  ```js
208
208
  const onSuccess = () => console.log("Witness API success!");
@@ -235,7 +235,7 @@ As described in the **Installation** section above, in order to avoid having to
235
235
 
236
236
  The browser bundle exports the same `OptableSDK` constructor documented in the **npm module** section above in the `optable` window object, as `optable.SDK`
237
237
 
238
- The following shows an example of how to safely initialize the SDK and dispatch an `identify` API request to a sandbox, from an input element after the document was loaded.
238
+ The following shows an example of how to safely initialize the SDK and dispatch an `identify` API request to a DCN, from an input element after the document was loaded.
239
239
 
240
240
  ```html
241
241
  <!-- Asynchronously load the SDK as early as possible: -->
@@ -250,7 +250,7 @@ The following shows an example of how to safely initialize the SDK and dispatch
250
250
  // At this point optable.SDK is available and can be used to create a new sdk instance.
251
251
  // That instance can be stored anywhere for later referencing.
252
252
  // One option is to keep it within the global optable object space.
253
- optable.instance = new optable.SDK({ host: "sandbox.customer.com", site: "my-site" });
253
+ optable.instance = new optable.SDK({ host: "dcn.customer.com", site: "my-site" });
254
254
  });
255
255
 
256
256
  // Now configure DOM content loaded event listener to dispatch identify() API:
@@ -268,13 +268,13 @@ The following shows an example of how to safely initialize the SDK and dispatch
268
268
 
269
269
  ## Integrating GAM360
270
270
 
271
- The Optable Web SDK can fetch targeting keyvalue data from a sandbox and send it to a [Google Ad Manager 360](https://admanager.google.com/home/) ad server account for real-time targeting. It's also capable of intercepting advertising events from the [Google Publisher Tag](https://developers.google.com/doubleclick-gpt/guides/get-started) and logging them to a sandbox via the **witness API**.
271
+ The Optable Web SDK can fetch targeting keyvalue data from a DCN and send it to a [Google Ad Manager 360](https://admanager.google.com/home/) ad server account for real-time targeting. It's also capable of intercepting advertising events from the [Google Publisher Tag](https://developers.google.com/doubleclick-gpt/guides/get-started) and logging them to a DCN via the **witness API**.
272
272
 
273
273
  ### Targeting key values
274
274
 
275
275
  Loading the Optable SDK via a `script tag` on a web page which also uses the [Google Publisher Tag](https://developers.google.com/doubleclick-gpt/guides/get-started), we can further extend the `targeting` example above to show an integration with a [Google Ad Manager 360](https://admanager.google.com/home/) ad server account.
276
276
 
277
- It's suggested to load the GAM banner view with an ad even when the call to your sandbox `targeting()` method raises an exception, as shown in the example below:
277
+ It's suggested to load the GAM banner view with an ad even when the call to your DCN `targeting()` method raises an exception, as shown in the example below:
278
278
 
279
279
  ```html
280
280
  <!-- Optable SDK async load: -->
@@ -290,7 +290,7 @@ It's suggested to load the GAM banner view with an ad even when the call to your
290
290
 
291
291
  // Init Optable SDK via command:
292
292
  optable.cmd.push(function () {
293
- optable.instance = new optable.SDK({ host: "sandbox.customer.com", site: "my-site" });
293
+ optable.instance = new optable.SDK({ host: "dcn.customer.com", site: "my-site" });
294
294
  });
295
295
 
296
296
  // Init GPT and disable initial ad load so that we can load targeting data first:
@@ -323,7 +323,7 @@ It's suggested to load the GAM banner view with an ad even when the call to your
323
323
  });
324
324
  };
325
325
 
326
- // Call Optable sandbox for targeting data and setup GPT page-level targeting, then
326
+ // Call Optable DCN for targeting data and setup GPT page-level targeting, then
327
327
  // explicitly refresh GPT ads.
328
328
  //
329
329
  // NOTE: We load and refresh GPT ads without targeting data when there is an exception,
@@ -365,7 +365,7 @@ It's also possible to avoid disabling of the initial ad load by using the SDK's
365
365
 
366
366
  // Init Optable SDK via command:
367
367
  optable.cmd.push(function () {
368
- optable.instance = new optable.SDK({ host: "sandbox.customer.com", site: "my-site" });
368
+ optable.instance = new optable.SDK({ host: "dcn.customer.com", site: "my-site" });
369
369
  });
370
370
 
371
371
  // Init GPT and disable initial ad load so that we can load targeting data first:
@@ -391,7 +391,7 @@ It's also possible to avoid disabling of the initial ad load by using the SDK's
391
391
  <div id="div-gpt-ad-12345-0"></div>
392
392
 
393
393
  <script>
394
- // Call Optable sandbox for targeting data which will update the local cache on success.
394
+ // Call Optable DCN for targeting data which will update the local cache on success.
395
395
  optable.cmd.push(function () {
396
396
  optable.instance.targeting().catch((err) => {
397
397
  // Maybe log error
@@ -408,7 +408,7 @@ Note that the above example fetches locally cached targeting key values and call
408
408
 
409
409
  ### Witnessing ad events
410
410
 
411
- To automatically capture GPT [SlotRenderEndedEvent](https://developers.google.com/doubleclick-gpt/reference#googletag.events.slotrenderendedevent) and [ImpressionViewableEvent](https://developers.google.com/doubleclick-gpt/reference#googletag.events.impressionviewableevent) and send log data to your sandbox using the **witness API**, simply install GPT event listeners on the SDK instance as follows:
411
+ To automatically capture GPT [SlotRenderEndedEvent](https://developers.google.com/doubleclick-gpt/reference#googletag.events.slotrenderendedevent) and [ImpressionViewableEvent](https://developers.google.com/doubleclick-gpt/reference#googletag.events.impressionviewableevent) and send log data to your DCN using the **witness API**, simply install GPT event listeners on the SDK instance as follows:
412
412
 
413
413
  ```html
414
414
  <!-- Optable SDK async load: -->
@@ -427,7 +427,7 @@ A working example of both targeting and event witnessing is available in the dem
427
427
 
428
428
  ## Identifying visitors arriving from Email newsletters
429
429
 
430
- If you send Email newsletters that contain links to your website, then you may want to automatically _identify_ visitors that have clicked on any such links via their Email address. Website traffic which is originating from a subscriber click on a link in a newsletter is considered to be implicitly authenticated by the recipient of the Email, therefore serving as an excellent source of linking of online user identities.
430
+ If you send Email newsletters that contain links to your website, then you may want to automatically _identify_ visitors that have clicked on any such links via their Email address.
431
431
 
432
432
  ### Insert oeid into your Email newsletter template
433
433
 
@@ -449,7 +449,7 @@ On your website destination page, you can call a helper method provided by the S
449
449
  <script>
450
450
  window.optable = window.optable || { cmd: [] };
451
451
  optable.cmd.push(function () {
452
- optable.instance = new optable.SDK({ host: "sandbox.customer.com", site: "my-site" });
452
+ optable.instance = new optable.SDK({ host: "dcn.customer.com", site: "my-site" });
453
453
  optable.instance.tryIdentifyFromParams();
454
454
  });
455
455
  </script>
@@ -457,6 +457,6 @@ On your website destination page, you can call a helper method provided by the S
457
457
 
458
458
  ## Demo Pages
459
459
 
460
- The demo pages are working examples of both `identify` and `targeting` APIs, as well as an integration with the [Google Ad Manager 360](https://admanager.google.com/home/) ad server, enabling the targeting of ads served by GAM360 to audiences activated in the [Optable](https://optable.co/) sandbox.
460
+ The demo pages are working examples of both `identify` and `targeting` APIs, as well as an integration with the [Google Ad Manager 360](https://admanager.google.com/home/) ad server, enabling the targeting of ads served by GAM360 to audiences activated in the [Optable](https://optable.co/) DCN.
461
461
 
462
- You can browse a recent (but not necessarily the latest) released version of the demo pages at [https://demo.optable.co/](https://demo.optable.co/). The source code to the demos can be found [here](https://github.com/Optable/optable-web-sdk/tree/master/demos). The demo pages will connect to the [Optable](https://optable.co/) demo sandbox at `sandbox.optable.co` and reference the web site slug `web-sdk-demo`. The GAM360 targeting demo loads ads from a GAM360 account operated by [Optable](https://optable.co/).
462
+ You can browse a recent (but not necessarily the latest) released version of the demo pages at [https://demo.optable.co/](https://demo.optable.co/). The source code to the demos can be found [here](https://github.com/Optable/optable-web-sdk/tree/master/demos). The demo pages will connect to the [Optable](https://optable.co/) demo DCN at `sandbox.optable.co` and reference the web site slug `web-sdk-demo`. The GAM360 targeting demo loads ads from a GAM360 account operated by [Optable](https://optable.co/).
@@ -1,9 +1,2 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=21)}([function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e,r){t.exports=r(11)},function(t,e){function r(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function s(t){r(a,o,i,s,c,"next",t)}function c(t){r(a,o,i,s,c,"throw",t)}s(void 0)}))}}},function(t){t.exports=JSON.parse('{"a":"v0.7.1"}')},function(t,e,r){var n=r(7);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e,r){var n=r(12),o=r(13),i=r(6),a=r(14);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||a()}},function(t,e,r){var n=r(15),o=r(16),i=r(6),a=r(17);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;
2
- /**
3
- * [js-sha256]{@link https://github.com/emn178/js-sha256}
4
- *
5
- * @version 0.9.0
6
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
7
- * @copyright Chen, Yi-Cyuan 2014-2017
8
- * @license MIT
9
- */!function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(20),ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(r){return new Sha256(e,!0).update(r)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<OUTPUT_TYPES.length;++r){var n=OUTPUT_TYPES[r];e[n]=createOutputMethod(n,t)}return e},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(t){if("string"==typeof t)return crypto.createHash(algorithm).update(t,"utf8").digest("hex");if(null==t)throw new Error(ERROR);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod},createHmacOutputMethod=function(t,e){return function(r,n){return new HmacSha256(r,e,!0).update(n)[t]()}},createHmacMethod=function(t){var e=createHmacOutputMethod("hex",t);e.create=function(e){return new HmacSha256(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<OUTPUT_TYPES.length;++r){var n=OUTPUT_TYPES[r];e[n]=createHmacOutputMethod(n,t)}return e};function Sha256(t,e){e?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}function HmacSha256(t,e,r){var n,o=typeof t;if("string"===o){var i,a=[],s=t.length,c=0;for(n=0;n<s;++n)(i=t.charCodeAt(n))<128?a[c++]=i:i<2048?(a[c++]=192|i>>6,a[c++]=128|63&i):i<55296||i>=57344?(a[c++]=224|i>>12,a[c++]=128|i>>6&63,a[c++]=128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++n)),a[c++]=240|i>>18,a[c++]=128|i>>12&63,a[c++]=128|i>>6&63,a[c++]=128|63&i);t=a}else{if("object"!==o)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(e,!0).update(t).array());var u=[],l=[];for(n=0;n<64;++n){var h=t[n]||0;u[n]=92^h,l[n]=54^h}Sha256.call(this,e,r),this.update(l),this.oKeyPad=u,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);e=!0}for(var n,o,i=0,a=t.length,s=this.blocks;i<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(o=this.start;i<a&&o<64;++i)s[o>>2]|=t[i]<<SHIFT[3&o++];else for(o=this.start;i<a&&o<64;++i)(n=t.charCodeAt(i))<128?s[o>>2]|=n<<SHIFT[3&o++]:n<2048?(s[o>>2]|=(192|n>>6)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]):n<55296||n>=57344?(s[o>>2]|=(224|n>>12)<<SHIFT[3&o++],s[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++i)),s[o>>2]|=(240|n>>18)<<SHIFT[3&o++],s[o>>2]|=(128|n>>12&63)<<SHIFT[3&o++],s[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,e,r,n,o,i,a,s,c,u=this.h0,l=this.h1,h=this.h2,f=this.h3,d=this.h4,p=this.h5,y=this.h6,v=this.h7,g=this.blocks;for(t=16;t<64;++t)e=((o=g[t-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,r=((o=g[t-2])>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,g[t]=g[t-16]+e+g[t-7]+r<<0;for(c=l&h,t=0;t<64;t+=4)this.first?(this.is224?(i=300032,v=(o=g[0]-1413257819)-150054599<<0,f=o+24177077<<0):(i=704751109,v=(o=g[0]-210244248)-1521486534<<0,f=o+143694565<<0),this.first=!1):(e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),n=(i=u&l)^u&h^c,v=f+(o=v+(r=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&p^~d&y)+K[t]+g[t])<<0,f=o+(e+n)<<0),e=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(a=f&u)^f&l^i,y=h+(o=y+(r=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&d^~v&p)+K[t+1]+g[t+1])<<0,e=((h=o+(e+n)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),n=(s=h&f)^h&u^a,p=l+(o=p+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&v^~y&d)+K[t+2]+g[t+2])<<0,e=((l=o+(e+n)<<0)>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),n=(c=l&h)^l&f^s,d=u+(o=d+(r=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&y^~p&v)+K[t+3]+g[t+3])<<0,u=o+(e+n)<<0;this.h0=this.h0+u<<0,this.h1=this.h1+l<<0,this.h2=this.h2+h<<0,this.h3=this.h3+f<<0,this.h4=this.h4+d<<0,this.h5=this.h5+p<<0,this.h6=this.h6+y<<0,this.h7=this.h7+v<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,c=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a];return this.is224||(c+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,c=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||c.push(s>>24&255,s>>16&255,s>>8&255,255&s),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()}).call(this,__webpack_require__(18),__webpack_require__(19))},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return H()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function h(){}function f(){}function d(){}var p={};p[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(_([])));v&&v!==e&&r.call(v,o)&&(p=v);var g=d.prototype=h.prototype=Object.create(p);function m(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function S(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:H}}function H(){return{value:void 0,done:!0}}return f.prototype=g.constructor=d,d.constructor=f,f.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(b.prototype),b.prototype[i]=function(){return this},t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),s(g,a,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=_,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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,l):this.complete(a)},complete:function(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),l},finish:function(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),E(r),l}},catch:function(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;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}},function(t,e){t.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.")}},function(t,e,r){var n=r(7);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.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.")}},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var c,u=[],l=!1,h=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&d())}function d(){if(!l){var t=s(f);l=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){"use strict";r.r(e);var n=r(1),o=r.n(n),i=r(2),a=r.n(i);function s(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var u=function(){function t(e){if(o()(this,t),this.cmds=e,Array.isArray(this.cmds)){var r,n=s(this.cmds);try{for(n.s();!(r=n.n()).done;){var i=r.value;"function"==typeof i&&i()}}catch(t){n.e(t)}finally{n.f()}}}return a()(t,[{key:"push",value:function(t){t()}}]),t}(),l=r(3),h=r.n(l),f=r(8),d=r.n(f),p=r(4),y=r.n(p),v=r(0),g=r.n(v);function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var w={insecure:!1,cookies:!0};var S=r(5),E=r(9),A=r.n(E);var _=function(){function t(e){o()(this,t),this.Config=e,g()(this,"passportKey",void 0),g()(this,"targetingKey",void 0);var r=btoa(function(t){for(var e=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return String.fromCharCode.apply(String,A()(new Uint8Array(e.buffer)))}("".concat(this.Config.host,"/").concat(this.Config.site)));this.passportKey="OPTABLE_PASS_"+r,this.targetingKey="OPTABLE_TGT_"+r}return a()(t,[{key:"getPassport",value:function(){return window.localStorage.getItem(this.passportKey)}},{key:"getTargeting",value:function(){var t=window.localStorage.getItem(this.targetingKey);return t?JSON.parse(t):null}},{key:"setPassport",value:function(t){t&&t.length>0&&window.localStorage.setItem(this.passportKey,t)}},{key:"setTargeting",value:function(t){t&&window.localStorage.setItem(this.targetingKey,JSON.stringify(t))}},{key:"clearPassport",value:function(){window.localStorage.removeItem(this.passportKey)}},{key:"clearTargeting",value:function(){window.localStorage.removeItem(this.targetingKey)}}]),t}();function H(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t,e,r){var n=function(t){return b(b({},w),t)}(e),o=n.site,i=n.host,a=n.insecure,s=n.cookies,c=a?"http":"https",u=new URL("".concat(o).concat(t),"".concat(c,"://").concat(i));if(s)u.search=new URLSearchParams({cookies:"yes",osdk:"web-".concat(S.a)}).toString();else{var l=new _(e).getPassport();u.search=new URLSearchParams({cookies:"no",passport:l||"",osdk:"web-".concat(S.a)}).toString()}var h=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?H(Object(r),!0).forEach((function(e){g()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},r);return h.credentials="include",new Request(u.toString(),h)}function O(t,e,r){return k.apply(this,arguments)}function k(){return(k=y()(h.a.mark((function t(e,r,n){var o,i,a;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,window.fetch(C(e,r,n));case 2:if(o=t.sent,!(null==(i=o.headers.get("Content-Type"))?void 0:i.startsWith("application/json"))){t.next=10;break}return t.next=7,o.json();case 7:t.t0=t.sent,t.next=13;break;case 10:return t.next=12,o.text();case 12:t.t0=t.sent;case 13:if(a=t.t0,o.ok){t.next=16;break}throw new Error(a.error);case 16:return a.passport&&(new _(r).setPassport(a.passport),delete a.passport),t.abrupt("return",a);case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function R(t){return x.apply(this,arguments)}function x(){return(x=y()(h.a.mark((function t(e){var r;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O("/targeting",e,{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return(r=t.sent)&&new _(e).setTargeting(r),t.abrupt("return",r);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function T(t){return new _(t).getTargeting()}function M(t,e){return O("/identify",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function L(t,e,r){var n={event:e,properties:r};return O("/witness",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function j(t,e){var r={traits:e};return O("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}var I=r(10),F=function(){function t(e){o()(this,t),this.sandbox=e}return a()(t,[{key:"identify",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return M(this.sandbox,e.filter((function(t){return t})))}},{key:"targeting",value:function(){return R(this.sandbox)}},{key:"targetingFromCache",value:function(){return T(this.sandbox)}},{key:"targetingClearCache",value:function(){var t;t=this.sandbox,new _(t).clearTargeting()}},{key:"prebidUserDataFromCache",value:function(){return function(t){for(var e=T(t),r=[],n=function(){var t=d()(i[o],2),e=t[0],n=t[1].map((function(t){return{name:e,value:t}}));n.length>0&&r.push({id:"optable",name:"optable",segment:n})},o=0,i=Object.entries(e||{});o<i.length;o++)n();return r}(this.sandbox)}},{key:"witness",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return L(this.sandbox,t,e)}},{key:"profile",value:function(t){return j(this.sandbox,t)}}],[{key:"eid",value:function(t){return t?"e:"+I.sha256.hex(t.toLowerCase().trim()):""}},{key:"cid",value:function(t){return t?"c:"+t.trim():""}}]),t}();function P(t){var e,r,n,o,i,a,s,c,u,l;return{advertiserId:null===(e=t.advertiserId)||void 0===e?void 0:e.toString(),campaignId:null===(r=t.campaignId)||void 0===r?void 0:r.toString(),creativeId:null===(n=t.creativeId)||void 0===n?void 0:n.toString(),isEmpty:null===(o=t.isEmpty)||void 0===o?void 0:o.toString(),lineItemId:null===(i=t.lineItemId)||void 0===i?void 0:i.toString(),serviceName:null===(a=t.serviceName)||void 0===a?void 0:a.toString(),size:null===(s=t.size)||void 0===s?void 0:s.toString(),slotElementId:null===(c=t.slot)||void 0===c?void 0:c.getSlotElementId(),sourceAgnosticCreativeId:null===(u=t.sourceAgnosticCreativeId)||void 0===u?void 0:u.toString(),sourceAgnosticLineItemId:null===(l=t.sourceAgnosticLineItemId)||void 0===l?void 0:l.toString()}}function X(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}F.prototype.installGPTEventListeners=function(){var t=this;t.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};var e=window.googletag;e.cmd.push((function(){e.pubads().addEventListener("slotRenderEnded",(function(e){t.witness("googletag.events.slotRenderEnded",P(e))})),e.pubads().addEventListener("impressionViewable",(function(e){t.witness("googletag.events.impressionViewable",P(e))}))}))},F.prototype.tryIdentifyFromParams=function(){var t,e=new URLSearchParams(window.location.search),r="",n=X(e.keys());try{for(n.s();!(t=n.n()).done;){var o=t.value;if(o.match(/^oeid$/i)){r=e.get(o);break}}}catch(t){n.e(t)}finally{n.f()}(function(t){return null!==t.match(/^[a-f0-9]{64}$/i)})(r=r||"")&&this.identify("e:"+r.toLowerCase())};var D=function(){function t(e){o()(this,t),this.Config=e,g()(this,"authenticated",void 0),this.authenticated=!1}var e;return a()(t,[{key:"ready",value:(e=y()(h.a.mark((function t(){var e;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O("/authenticated",this.Config,{method:"GET"});case 2:return(e=t.sent).origin==this.Config.site&&(this.authenticated=e.authenticated),t.abrupt("return",e);case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"emailAuth",value:function(t){return O("/auth/email",this.Config,{method:"POST",body:t})}},{key:"googleAuthURL",value:function(){var t=this.Config.insecure?"http":"https";return"".concat(t,"://").concat(this.Config.host,"/").concat(this.Config.site,"/auth/google?cookies=yes")}},{key:"facebookAuthURL",value:function(){var t=this.Config.insecure?"http":"https";return"".concat(t,"://").concat(this.Config.host,"/").concat(this.Config.site,"/auth/facebook?cookies=yes")}}]),t}();function U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function N(t){return function(t){if(Array.isArray(t))return K(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return K(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return K(t,e)}(t)||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.")}()}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var W,J,G,Y,z,q=(W=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],J=function(){function t(e){var r=e.targetModal,n=e.triggers,o=void 0===n?[]:n,i=e.onShow,a=void 0===i?function(){}:i,s=e.onClose,c=void 0===s?function(){}:s,u=e.openTrigger,l=void 0===u?"data-micromodal-trigger":u,h=e.closeTrigger,f=void 0===h?"data-micromodal-close":h,d=e.openClass,p=void 0===d?"is-open":d,y=e.disableScroll,v=void 0!==y&&y,g=e.disableFocus,m=void 0!==g&&g,b=e.awaitCloseAnimation,w=void 0!==b&&b,S=e.awaitOpenAnimation,E=void 0!==S&&S,A=e.debugMode,_=void 0!==A&&A;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modal=document.getElementById(r),this.config={debugMode:_,disableScroll:v,openTrigger:l,closeTrigger:f,openClass:p,onShow:a,onClose:c,awaitCloseAnimation:w,awaitOpenAnimation:E,disableFocus:m},o.length>0&&this.registerTriggers.apply(this,N(o)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var e,r,n;return e=t,(r=[{key:"registerTriggers",value:function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];r.filter(Boolean).forEach((function(e){e.addEventListener("click",(function(e){return t.showModal(e)}))}))}},{key:"showModal",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var r=function e(){t.modal.removeEventListener("animationend",e,!1),t.setFocusToFirstNode()};this.modal.addEventListener("animationend",r,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,e)}},{key:"closeModal",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,t),this.config.awaitCloseAnimation){var r=this.config.openClass;this.modal.addEventListener("animationend",(function t(){e.classList.remove(r),e.removeEventListener("animationend",t,!1)}),!1)}else e.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(t){this.modal=document.getElementById(t),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(t){if(this.config.disableScroll){var e=document.querySelector("body");switch(t){case"enable":Object.assign(e.style,{overflow:""});break;case"disable":Object.assign(e.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(t){t.target.hasAttribute(this.config.closeTrigger)&&this.closeModal(t)}},{key:"onKeydown",value:function(t){27===t.keyCode&&this.closeModal(t),9===t.keyCode&&this.retainFocus(t)}},{key:"getFocusableNodes",value:function(){var t=this.modal.querySelectorAll(W);return Array.apply(void 0,N(t))}},{key:"setFocusToFirstNode",value:function(){var t=this;if(!this.config.disableFocus){var e=this.getFocusableNodes();if(0!==e.length){var r=e.filter((function(e){return!e.hasAttribute(t.config.closeTrigger)}));r.length>0&&r[0].focus(),0===r.length&&e[0].focus()}}}},{key:"retainFocus",value:function(t){var e=this.getFocusableNodes();if(0!==e.length)if(e=e.filter((function(t){return null!==t.offsetParent})),this.modal.contains(document.activeElement)){var r=e.indexOf(document.activeElement);t.shiftKey&&0===r&&(e[e.length-1].focus(),t.preventDefault()),!t.shiftKey&&e.length>0&&r===e.length-1&&(e[0].focus(),t.preventDefault())}else e[0].focus()}}])&&U(e.prototype,r),n&&U(e,n),t}(),G=null,Y=function(t){if(!document.getElementById(t))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(t,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'.concat(t,'"></div>')),!1},z=function(t,e){if(function(t){t.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'))}(t),!e)return!0;for(var r in e)Y(r);return!0},{init:function(t){var e=Object.assign({},{openTrigger:"data-micromodal-trigger"},t),r=N(document.querySelectorAll("[".concat(e.openTrigger,"]"))),n=function(t,e){var r=[];return t.forEach((function(t){var n=t.attributes[e].value;void 0===r[n]&&(r[n]=[]),r[n].push(t)})),r}(r,e.openTrigger);if(!0!==e.debugMode||!1!==z(r,n))for(var o in n){var i=n[o];e.targetModal=o,e.triggers=N(i),G=new J(e)}},show:function(t,e){var r=e||{};r.targetModal=t,!0===r.debugMode&&!1===Y(t)||(G&&G.removeEventListeners(),(G=new J(r)).showModal())},close:function(t){t?G.closeModalById(t):G.closeModal()}});window.MicroModal=q;var V=q;function $(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Z=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{modalDiv:"optable-login",emailSentModalDiv:"optable-login-email-sent",emailSentModalMsg:"data-optable-login-email",emailErrorModalDiv:"optable-login-email-error",emailErrorModalMsg:"data-optable-login-error",emailForm:"optable-login-form",emailFormRedirURL:"optable-login-form-rurl",googleButton:"optable-login-button-google",facebookButton:"optable-login-button-facebook"},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{openTrigger:"data-optable-login-open",closeTrigger:"data-optable-login-close",openClass:"is-open",disableScroll:!0,disableFocus:!1,awaitOpenAnimation:!0,awaitCloseAnimation:!0,debugMode:!1};o()(this,t),this.Config=e,this.DOMConfig=n,this.MicroModalConfig=i,g()(this,"auth",void 0);var a=this.ready.bind(this);V.init(this.MicroModalConfig),this.auth=new D(this.Config),"loading"!==document.readyState?this.auth.ready().then(a):window.addEventListener("DOMContentLoaded",(function(){r.auth.ready().then(a)}),!1)}return a()(t,[{key:"ready",value:function(){this.installEmailLogin(),this.installGoogleLogin(),this.installFacebookLogin(),this.hijackLinks(),this.auth.authenticated||this.show(window.location.href)}},{key:"show",value:function(t){var e=!t||this.installRedirectURL(t);e&&V.show(this.DOMConfig.modalDiv,this.MicroModalConfig)}},{key:"close",value:function(){V.close(this.DOMConfig.modalDiv)}},{key:"hide",value:function(){this.close()}},{key:"disableForm",value:function(t){Array.from(t.elements).forEach((function(t){return t.disabled=!0}))}},{key:"enableForm",value:function(t){Array.from(t.elements).forEach((function(t){return t.disabled=!1}))}},{key:"showMessageModal",value:function(t,e,r){var n=document.getElementById(t);if(null!=n){var o=n.querySelector("["+e+"]");null!=o&&(o.innerHTML=r),V.show(t,this.MicroModalConfig)}}},{key:"installEmailLogin",value:function(){var t=this,e=document.getElementById(this.DOMConfig.emailForm);return null!=e&&(e.addEventListener("submit",(function(r){r.preventDefault();var n=new FormData(r.target);t.disableForm(e),t.auth.emailAuth(n).then((function(r){r.authenticated?window.location.href=r.redir:(t.enableForm(e),t.hide(),t.showMessageModal(t.DOMConfig.emailSentModalDiv,t.DOMConfig.emailSentModalMsg,r.email))})).catch((function(r){t.enableForm(e),t.hide(),t.showMessageModal(t.DOMConfig.emailErrorModalDiv,t.DOMConfig.emailErrorModalMsg,r.toString())}))})),!0)}},{key:"installGoogleLogin",value:function(){var t=this,e=document.getElementById(this.DOMConfig.googleButton);return null!=e&&(e.addEventListener("click",(function(){window.location.href=t.auth.googleAuthURL()}),!1),!0)}},{key:"installFacebookLogin",value:function(){var t=this,e=document.getElementById(this.DOMConfig.facebookButton);return null!=e&&(e.addEventListener("click",(function(){window.location.href=t.auth.facebookAuthURL()}),!1),!0)}},{key:"installRedirectURL",value:function(t){var e=document.getElementById(this.DOMConfig.emailFormRedirURL);return null!=e&&(e.value=t,!0)}},{key:"hijackLinks",value:function(){var t=this;if(!this.auth.authenticated){var e,r=$(document.getElementsByTagName("A"));try{var n=function(){var r=e.value;r.addEventListener("click",(function(e){e.preventDefault(),t.show(r.href)}),!1)};for(r.s();!(e=r.n()).done;)n()}catch(t){r.e(t)}finally{r.f()}}}}]),t}();F.prototype.authenticator=function(t,e){return new Z(this.sandbox,t,e)},window.optable=window.optable||{},window.optable.SDK=F,window.optable.cmd=new u(window.optable.cmd||[])}]);
1
+ /*! For license information please see sdk.js.LICENSE.txt */
2
+ (()=>{var __webpack_modules__={228:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},858:t=>{t.exports=function(t){if(Array.isArray(t))return t}},646:(t,e,r)=>{var n=r(228);t.exports=function(t){if(Array.isArray(t))return n(t)}},926:t=>{function e(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)}))}}},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},860:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},884:t=>{t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}},521:t=>{t.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.")}},206:t=>{t.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.")}},38:(t,e,r)=>{var n=r(858),o=r(884),i=r(379),a=r(521);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||a()}},319:(t,e,r)=>{var n=r(646),o=r(860),i=r(379),a=r(206);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},379:(t,e,r)=>{var n=r(228);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},757:(t,e,r)=>{t.exports=r(666)},869:(t,e,r)=>{"use strict";var n=r(575),o=r.n(n),i=r(913),a=r.n(i);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const c=function(){function t(e){if(o()(this,t),this.cmds=e,Array.isArray(this.cmds)){var r,n=function(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(this.cmds);try{for(n.s();!(r=n.n()).done;){var i=r.value;"function"==typeof i&&i()}}catch(t){n.e(t)}finally{n.f()}}}return a()(t,[{key:"push",value:function(t){t()}}]),t}();var u=r(757),h=r.n(u),f=r(38),l=r.n(f),p=r(926),y=r.n(p),d=r(713),_=r.n(d);function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){_()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var b={insecure:!1,cookies:!0};const w="v0.9.1";var S=r(319),m=r.n(S),E=function(){function t(e){o()(this,t),this.Config=e,_()(this,"passportKey",void 0),_()(this,"targetingKey",void 0);var r=btoa(function(t){for(var e=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return String.fromCharCode.apply(String,m()(new Uint8Array(e.buffer)))}("".concat(this.Config.host,"/").concat(this.Config.site)));this.passportKey="OPTABLE_PASS_"+r,this.targetingKey="OPTABLE_TGT_"+r}return a()(t,[{key:"getPassport",value:function(){return window.localStorage.getItem(this.passportKey)}},{key:"getTargeting",value:function(){var t=window.localStorage.getItem(this.targetingKey);return t?JSON.parse(t):null}},{key:"setPassport",value:function(t){t&&t.length>0&&window.localStorage.setItem(this.passportKey,t)}},{key:"setTargeting",value:function(t){t&&window.localStorage.setItem(this.targetingKey,JSON.stringify(t))}},{key:"clearPassport",value:function(){window.localStorage.removeItem(this.passportKey)}},{key:"clearTargeting",value:function(){window.localStorage.removeItem(this.targetingKey)}}]),t}();function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function H(t,e,r){var n=function(t){return g(g({},b),t)}(e),o=n.site,i=n.host,a=n.insecure,s=n.cookies,c=a?"http":"https",u=new URL("".concat(o).concat(t),"".concat(c,"://").concat(i));if(s)u.search=new URLSearchParams({cookies:"yes",osdk:"web-".concat(w)}).toString();else{var h=new E(e).getPassport();u.search=new URLSearchParams({cookies:"no",passport:h||"",osdk:"web-".concat(w)}).toString()}var f=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){_()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},r);return f.credentials="include",new Request(u.toString(),f)}function R(t,e,r){return O.apply(this,arguments)}function O(){return(O=y()(h().mark((function t(e,r,n){var o,i,a;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,window.fetch(H(e,r,n));case 2:if(o=t.sent,!(null==(i=o.headers.get("Content-Type"))?void 0:i.startsWith("application/json"))){t.next=10;break}return t.next=7,o.json();case 7:t.t0=t.sent,t.next=13;break;case 10:return t.next=12,o.text();case 12:t.t0=t.sent;case 13:if(a=t.t0,o.ok){t.next=16;break}throw new Error(a.error);case 16:return a.passport&&(new E(r).setPassport(a.passport),delete a.passport),t.abrupt("return",a);case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function C(){return(C=y()(h().mark((function t(e){var r;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,R("/targeting",e,{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return(r=t.sent)&&new E(e).setTargeting(r),t.abrupt("return",r);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function x(t){return new E(t).getTargeting()}function k(t,e){return R("/identify",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function X(t,e,r){var n={event:e,properties:r};return R("/witness",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}var j=r(23);const T=function(){function t(e){o()(this,t),this.sandbox=e}return a()(t,[{key:"identify",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return k(this.sandbox,e.filter((function(t){return t})))}},{key:"targeting",value:function(){return function(t){return C.apply(this,arguments)}(this.sandbox)}},{key:"targetingFromCache",value:function(){return x(this.sandbox)}},{key:"targetingClearCache",value:function(){var t;t=this.sandbox,new E(t).clearTargeting()}},{key:"prebidUserDataFromCache",value:function(){return function(t){for(var e=x(t),r=[],n=function(){var t=l()(i[o],2),e=t[0],n=t[1].map((function(t){return{name:e,value:t}}));n.length>0&&r.push({id:"optable",name:"optable",segment:n})},o=0,i=Object.entries(e||{});o<i.length;o++)n();return r}(this.sandbox)}},{key:"witness",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return X(this.sandbox,t,e)}},{key:"profile",value:function(t){return function(t,e){var r={traits:e};return R("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.sandbox,t)}}],[{key:"eid",value:function(t){return t?"e:"+j.sha256.hex(t.toLowerCase().trim()):""}},{key:"cid",value:function(t){return t?"c:"+t.trim():""}}]),t}();function I(t){var e,r,n,o,i,a,s,c,u,h;return{advertiserId:null===(e=t.advertiserId)||void 0===e?void 0:e.toString(),campaignId:null===(r=t.campaignId)||void 0===r?void 0:r.toString(),creativeId:null===(n=t.creativeId)||void 0===n?void 0:n.toString(),isEmpty:null===(o=t.isEmpty)||void 0===o?void 0:o.toString(),lineItemId:null===(i=t.lineItemId)||void 0===i?void 0:i.toString(),serviceName:null===(a=t.serviceName)||void 0===a?void 0:a.toString(),size:null===(s=t.size)||void 0===s?void 0:s.toString(),slotElementId:null===(c=t.slot)||void 0===c?void 0:c.getSlotElementId(),sourceAgnosticCreativeId:null===(u=t.sourceAgnosticCreativeId)||void 0===u?void 0:u.toString(),sourceAgnosticLineItemId:null===(h=t.sourceAgnosticLineItemId)||void 0===h?void 0:h.toString()}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}T.prototype.installGPTEventListeners=function(){var t=this;t.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};var e=window.googletag;e.cmd.push((function(){e.pubads().addEventListener("slotRenderEnded",(function(e){t.witness("googletag.events.slotRenderEnded",I(e))})),e.pubads().addEventListener("impressionViewable",(function(e){t.witness("googletag.events.impressionViewable",I(e))}))}))},T.prototype.tryIdentifyFromParams=function(){var t,e=new URLSearchParams(window.location.search),r="",n=function(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return P(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.keys());try{for(n.s();!(t=n.n()).done;){var o=t.value;if(o.match(/^oeid$/i)){r=e.get(o);break}}}catch(t){n.e(t)}finally{n.f()}(function(t){return null!==t.match(/^[a-f0-9]{64}$/i)})(r=r||"")&&this.identify("e:"+r.toLowerCase())},window.optable=window.optable||{},window.optable.SDK=T,window.optable.cmd=new c(window.optable.cmd||[])},23:(module,exports,__webpack_require__)=>{var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(r){return new Sha256(e,!0).update(r)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<OUTPUT_TYPES.length;++r){var n=OUTPUT_TYPES[r];e[n]=createOutputMethod(n,t)}return e},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(t){if("string"==typeof t)return crypto.createHash(algorithm).update(t,"utf8").digest("hex");if(null==t)throw new Error(ERROR);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod},createHmacOutputMethod=function(t,e){return function(r,n){return new HmacSha256(r,e,!0).update(n)[t]()}},createHmacMethod=function(t){var e=createHmacOutputMethod("hex",t);e.create=function(e){return new HmacSha256(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<OUTPUT_TYPES.length;++r){var n=OUTPUT_TYPES[r];e[n]=createHmacOutputMethod(n,t)}return e};function Sha256(t,e){e?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}function HmacSha256(t,e,r){var n,o=typeof t;if("string"===o){var i,a=[],s=t.length,c=0;for(n=0;n<s;++n)(i=t.charCodeAt(n))<128?a[c++]=i:i<2048?(a[c++]=192|i>>6,a[c++]=128|63&i):i<55296||i>=57344?(a[c++]=224|i>>12,a[c++]=128|i>>6&63,a[c++]=128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++n)),a[c++]=240|i>>18,a[c++]=128|i>>12&63,a[c++]=128|i>>6&63,a[c++]=128|63&i);t=a}else{if("object"!==o)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(e,!0).update(t).array());var u=[],h=[];for(n=0;n<64;++n){var f=t[n]||0;u[n]=92^f,h[n]=54^f}Sha256.call(this,e,r),this.update(h),this.oKeyPad=u,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);e=!0}for(var n,o,i=0,a=t.length,s=this.blocks;i<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(o=this.start;i<a&&o<64;++i)s[o>>2]|=t[i]<<SHIFT[3&o++];else for(o=this.start;i<a&&o<64;++i)(n=t.charCodeAt(i))<128?s[o>>2]|=n<<SHIFT[3&o++]:n<2048?(s[o>>2]|=(192|n>>6)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]):n<55296||n>=57344?(s[o>>2]|=(224|n>>12)<<SHIFT[3&o++],s[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++i)),s[o>>2]|=(240|n>>18)<<SHIFT[3&o++],s[o>>2]|=(128|n>>12&63)<<SHIFT[3&o++],s[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&n)<<SHIFT[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,e,r,n,o,i,a,s,c,u=this.h0,h=this.h1,f=this.h2,l=this.h3,p=this.h4,y=this.h5,d=this.h6,_=this.h7,v=this.blocks;for(t=16;t<64;++t)e=((o=v[t-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,r=((o=v[t-2])>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,v[t]=v[t-16]+e+v[t-7]+r<<0;for(c=h&f,t=0;t<64;t+=4)this.first?(this.is224?(i=300032,_=(o=v[0]-1413257819)-150054599<<0,l=o+24177077<<0):(i=704751109,_=(o=v[0]-210244248)-1521486534<<0,l=o+143694565<<0),this.first=!1):(e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),n=(i=u&h)^u&f^c,_=l+(o=_+(r=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&y^~p&d)+K[t]+v[t])<<0,l=o+(e+n)<<0),e=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),n=(a=l&u)^l&h^i,d=f+(o=d+(r=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&p^~_&y)+K[t+1]+v[t+1])<<0,e=((f=o+(e+n)<<0)>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(s=f&l)^f&u^a,y=h+(o=y+(r=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&_^~d&p)+K[t+2]+v[t+2])<<0,e=((h=o+(e+n)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),n=(c=h&f)^h&l^s,p=u+(o=p+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&d^~y&_)+K[t+3]+v[t+3])<<0,u=o+(e+n)<<0;this.h0=this.h0+u<<0,this.h1=this.h1+h<<0,this.h2=this.h2+f<<0,this.h3=this.h3+l<<0,this.h4=this.h4+p<<0,this.h5=this.h5+y<<0,this.h6=this.h6+d<<0,this.h7=this.h7+_<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,c=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a];return this.is224||(c+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,c=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||c.push(s>>24&255,s>>16&255,s>>8&255,255&s),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof _?e:_,i=Object.create(o.prototype),a=new C(n||[]);return i._invoke=function(t,e,r){var n=f;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=H(a,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var c=h(t,e,r);if("normal"===c.type){if(n=r.done?y:l,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f="suspendedStart",l="suspendedYield",p="executing",y="completed",d={};function _(){}function v(){}function g(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,S=w&&w(w(x([])));S&&S!==r&&n.call(S,i)&&(b=S);var m=g.prototype=_.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,a,s){var c=h(t[o],t,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function H(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,H(t,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function R(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function x(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:e,done:!0}}return v.prototype=m.constructor=g,g.constructor=v,v.displayName=c(g,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,s,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},E(A.prototype),A.prototype[a]=function(){return this},t.AsyncIterator=A,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new A(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(m),c(m,s,"Generator"),m[i]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=x,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return s.type="throw",s.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(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,d):this.complete(a)},complete:function(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),d},finish:function(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),O(r),d}},catch:function(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;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](r,r.exports,__webpack_require__),r.exports}__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var r in e)__webpack_require__.o(e,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__=__webpack_require__(869)})();
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "v0.7.1"
2
+ "version": "v0.9.1"
3
3
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "repository": "https://github.com/optable/optable-web-sdk",
7
7
  "homepage": "https://optable.co",
8
8
  "license": "SEE LICENSE IN LICENSE",
9
- "version": "v0.7.1",
9
+ "version": "v0.9.1",
10
10
  "devDependencies": {
11
11
  "@babel/core": "^7.12.3",
12
12
  "@babel/plugin-proposal-class-properties": "^7.12.1",
@@ -15,18 +15,16 @@
15
15
  "@babel/preset-typescript": "^7.12.1",
16
16
  "@types/jest": "^26.0.15",
17
17
  "babel-jest": "^26.6.3",
18
- "babel-loader": "^8.2.0",
18
+ "babel-loader": "^8.2.2",
19
19
  "core-js": "^3.7.0",
20
20
  "jest": "^26.6.3",
21
21
  "typescript": "^4.0.5",
22
- "webpack": "^4.44.2",
23
- "webpack-cli": "^3.3.11"
22
+ "webpack": "^5.46.0",
23
+ "webpack-cli": "^4.7.2"
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.12.5",
27
- "@types/micromodal": "^0.3.2",
28
27
  "js-sha256": "^0.9.0",
29
- "micromodal": "^0.4.6",
30
28
  "regenerator-runtime": "^0.13.7"
31
29
  },
32
30
  "files": [
@@ -1,49 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- import Auth from "../edge/auth";
3
- declare type AuthModalDOMConfig = {
4
- modalDiv: string;
5
- emailSentModalDiv: string;
6
- emailSentModalMsg: string;
7
- emailErrorModalDiv: string;
8
- emailErrorModalMsg: string;
9
- emailFormRedirURL: string;
10
- emailForm: string;
11
- googleButton: string;
12
- facebookButton: string;
13
- };
14
- declare type MicroModalConfig = {
15
- openTrigger: string;
16
- closeTrigger: string;
17
- openClass: string;
18
- disableScroll: boolean;
19
- disableFocus: boolean;
20
- awaitOpenAnimation: boolean;
21
- awaitCloseAnimation: boolean;
22
- debugMode: boolean;
23
- };
24
- declare class AuthModal {
25
- private Config;
26
- DOMConfig: AuthModalDOMConfig;
27
- MicroModalConfig: MicroModalConfig;
28
- auth: Auth;
29
- constructor(Config: OptableConfig, DOMConfig?: AuthModalDOMConfig, MicroModalConfig?: MicroModalConfig);
30
- ready(): void;
31
- show(url?: string): void;
32
- close(): void;
33
- hide(): void;
34
- disableForm(form: HTMLFormElement): void;
35
- enableForm(form: HTMLFormElement): void;
36
- showMessageModal(modalDivID: string, msgSelector: string, msg: string): void;
37
- installEmailLogin(): boolean;
38
- installGoogleLogin(): boolean;
39
- installFacebookLogin(): boolean;
40
- installRedirectURL(url: string): boolean;
41
- hijackLinks(): void;
42
- }
43
- export { AuthModal, AuthModalDOMConfig, MicroModalConfig };
44
- export default AuthModal;
45
- declare module "../sdk" {
46
- interface OptableSDK {
47
- authenticator: (DOMConfig?: AuthModalDOMConfig, MicroModalConfig?: MicroModalConfig) => AuthModal;
48
- }
49
- }
@@ -1,149 +0,0 @@
1
- import Auth from "../edge/auth";
2
- import MicroModal from "micromodal";
3
- import OptableSDK from "../sdk";
4
- class AuthModal {
5
- constructor(Config, DOMConfig = {
6
- modalDiv: "optable-login",
7
- emailSentModalDiv: "optable-login-email-sent",
8
- emailSentModalMsg: "data-optable-login-email",
9
- emailErrorModalDiv: "optable-login-email-error",
10
- emailErrorModalMsg: "data-optable-login-error",
11
- emailForm: "optable-login-form",
12
- emailFormRedirURL: "optable-login-form-rurl",
13
- googleButton: "optable-login-button-google",
14
- facebookButton: "optable-login-button-facebook",
15
- }, MicroModalConfig = {
16
- openTrigger: "data-optable-login-open",
17
- closeTrigger: "data-optable-login-close",
18
- openClass: "is-open",
19
- disableScroll: true,
20
- disableFocus: false,
21
- awaitOpenAnimation: true,
22
- awaitCloseAnimation: true,
23
- debugMode: false,
24
- }) {
25
- this.Config = Config;
26
- this.DOMConfig = DOMConfig;
27
- this.MicroModalConfig = MicroModalConfig;
28
- const ready = this.ready.bind(this);
29
- MicroModal.init(this.MicroModalConfig);
30
- this.auth = new Auth(this.Config);
31
- if (document.readyState !== "loading") {
32
- this.auth.ready().then(ready);
33
- }
34
- else {
35
- window.addEventListener("DOMContentLoaded", () => {
36
- this.auth.ready().then(ready);
37
- }, false);
38
- }
39
- }
40
- ready() {
41
- this.installEmailLogin();
42
- this.installGoogleLogin();
43
- this.installFacebookLogin();
44
- this.hijackLinks();
45
- if (!this.auth.authenticated) {
46
- this.show(window.location.href);
47
- }
48
- }
49
- show(url) {
50
- const show = !url || this.installRedirectURL(url);
51
- if (show) {
52
- MicroModal.show(this.DOMConfig.modalDiv, this.MicroModalConfig);
53
- }
54
- }
55
- close() {
56
- MicroModal.close(this.DOMConfig.modalDiv);
57
- }
58
- hide() {
59
- this.close();
60
- }
61
- disableForm(form) {
62
- Array.from(form.elements).forEach((field) => (field.disabled = true));
63
- }
64
- enableForm(form) {
65
- Array.from(form.elements).forEach((field) => (field.disabled = false));
66
- }
67
- showMessageModal(modalDivID, msgSelector, msg) {
68
- const modal = document.getElementById(modalDivID);
69
- if (modal != null) {
70
- const sel = modal.querySelector("[" + msgSelector + "]");
71
- if (sel != null) {
72
- sel.innerHTML = msg;
73
- }
74
- MicroModal.show(modalDivID, this.MicroModalConfig);
75
- }
76
- }
77
- installEmailLogin() {
78
- let lform = document.getElementById(this.DOMConfig.emailForm);
79
- if (lform == null) {
80
- return false;
81
- }
82
- lform.addEventListener("submit", (e) => {
83
- e.preventDefault();
84
- const formData = new FormData(e.target);
85
- this.disableForm(lform);
86
- this.auth
87
- .emailAuth(formData)
88
- .then((res) => {
89
- if (res.authenticated) {
90
- window.location.href = res.redir;
91
- return;
92
- }
93
- this.enableForm(lform);
94
- this.hide();
95
- this.showMessageModal(this.DOMConfig.emailSentModalDiv, this.DOMConfig.emailSentModalMsg, res.email);
96
- })
97
- .catch((err) => {
98
- this.enableForm(lform);
99
- this.hide();
100
- this.showMessageModal(this.DOMConfig.emailErrorModalDiv, this.DOMConfig.emailErrorModalMsg, err.toString());
101
- });
102
- });
103
- return true;
104
- }
105
- installGoogleLogin() {
106
- let button = document.getElementById(this.DOMConfig.googleButton);
107
- if (button == null) {
108
- return false;
109
- }
110
- button.addEventListener("click", () => {
111
- window.location.href = this.auth.googleAuthURL();
112
- }, false);
113
- return true;
114
- }
115
- installFacebookLogin() {
116
- let button = document.getElementById(this.DOMConfig.facebookButton);
117
- if (button == null) {
118
- return false;
119
- }
120
- button.addEventListener("click", () => {
121
- window.location.href = this.auth.facebookAuthURL();
122
- }, false);
123
- return true;
124
- }
125
- installRedirectURL(url) {
126
- let redir = document.getElementById(this.DOMConfig.emailFormRedirURL);
127
- if (redir != null) {
128
- redir.value = url;
129
- return true;
130
- }
131
- return false;
132
- }
133
- hijackLinks() {
134
- if (!this.auth.authenticated) {
135
- const links = document.getElementsByTagName("A");
136
- for (const link of links) {
137
- link.addEventListener("click", (e) => {
138
- e.preventDefault();
139
- this.show(link.href);
140
- }, false);
141
- }
142
- }
143
- }
144
- }
145
- export { AuthModal };
146
- export default AuthModal;
147
- OptableSDK.prototype.authenticator = function (DOMConfig, MicroModalConfig) {
148
- return new AuthModal(this.sandbox, DOMConfig, MicroModalConfig);
149
- };
@@ -1,22 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- declare type AuthReadyResponse = {
3
- origin: string;
4
- authenticated: boolean;
5
- };
6
- declare type AuthEmailResponse = {
7
- origin: string;
8
- authenticated: boolean;
9
- email: string;
10
- redir: string;
11
- };
12
- declare class Auth {
13
- private Config;
14
- authenticated: boolean;
15
- constructor(Config: OptableConfig);
16
- ready(): Promise<AuthReadyResponse>;
17
- emailAuth(formData: FormData): Promise<AuthEmailResponse>;
18
- googleAuthURL(): string;
19
- facebookAuthURL(): string;
20
- }
21
- export { Auth, AuthReadyResponse, AuthEmailResponse };
22
- export default Auth;
@@ -1,43 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { fetch } from "../core/network";
11
- class Auth {
12
- constructor(Config) {
13
- this.Config = Config;
14
- this.authenticated = false;
15
- }
16
- ready() {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const res = yield fetch("/authenticated", this.Config, {
19
- method: "GET",
20
- });
21
- if (res.origin == this.Config.site) {
22
- this.authenticated = res.authenticated;
23
- }
24
- return res;
25
- });
26
- }
27
- emailAuth(formData) {
28
- return fetch("/auth/email", this.Config, {
29
- method: "POST",
30
- body: formData,
31
- });
32
- }
33
- googleAuthURL() {
34
- const proto = this.Config.insecure ? "http" : "https";
35
- return `${proto}://${this.Config.host}/${this.Config.site}/auth/google?cookies=yes`;
36
- }
37
- facebookAuthURL() {
38
- const proto = this.Config.insecure ? "http" : "https";
39
- return `${proto}://${this.Config.host}/${this.Config.site}/auth/facebook?cookies=yes`;
40
- }
41
- }
42
- export { Auth };
43
- export default Auth;