@everymatrix/user-actions 1.42.0 → 1.43.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.
@@ -52,7 +52,9 @@ const UserActions = class {
52
52
  return fetch(url.href)
53
53
  .then((response) => response.json())
54
54
  .then(data => {
55
- this.actionStack = data.actions;
55
+ // filtering necessary to prevent widget from throwing "cannot read properties of 'undefined'"
56
+ // when the actions received are not part of actionsMapping
57
+ this.actionStack = data.actions.filter(action => actionsMapping[action.action]);
56
58
  if (this.actionStack.length > 0)
57
59
  this.emitCurrentActionEvent();
58
60
  });
@@ -22,7 +22,9 @@ export class UserActions {
22
22
  return fetch(url.href)
23
23
  .then((response) => response.json())
24
24
  .then(data => {
25
- this.actionStack = data.actions;
25
+ // filtering necessary to prevent widget from throwing "cannot read properties of 'undefined'"
26
+ // when the actions received are not part of actionsMapping
27
+ this.actionStack = data.actions.filter(action => actionsMapping[action.action]);
26
28
  if (this.actionStack.length > 0)
27
29
  this.emitCurrentActionEvent();
28
30
  });
@@ -50,7 +50,9 @@ const UserActions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
50
50
  return fetch(url.href)
51
51
  .then((response) => response.json())
52
52
  .then(data => {
53
- this.actionStack = data.actions;
53
+ // filtering necessary to prevent widget from throwing "cannot read properties of 'undefined'"
54
+ // when the actions received are not part of actionsMapping
55
+ this.actionStack = data.actions.filter(action => actionsMapping[action.action]);
54
56
  if (this.actionStack.length > 0)
55
57
  this.emitCurrentActionEvent();
56
58
  });
@@ -48,7 +48,9 @@ const UserActions = class {
48
48
  return fetch(url.href)
49
49
  .then((response) => response.json())
50
50
  .then(data => {
51
- this.actionStack = data.actions;
51
+ // filtering necessary to prevent widget from throwing "cannot read properties of 'undefined'"
52
+ // when the actions received are not part of actionsMapping
53
+ this.actionStack = data.actions.filter(action => actionsMapping[action.action]);
52
54
  if (this.actionStack.length > 0)
53
55
  this.emitCurrentActionEvent();
54
56
  });
@@ -1 +1 @@
1
- import{r as i}from"./p-d8d5dc61.js";const t={"verification-popup":{emit:"openKycVerificationModal",listen:"closeKycVerificationModal"},"get-temporary-account-consents":{emit:"openTemporaryConsentsModal",listen:"closeTemporaryConsentsModal"},"limits-popup":{emit:"openLugasPopup",listen:"closeLugasPopup"},"video-verification-popup":{emit:"openKycVerificationModal",listen:"closeKycVerificationModal"},"unverified-phone-number":{emit:"openSmsVerificationModal",listen:"closeSmsVerificationModal"}},o=class{constructor(o){i(this,o),this.actionStack=[],this.emitCurrentActionEvent=()=>{window.postMessage({type:t[this.actionStack[0].action].emit})},this.shiftActionStack=()=>{this.actionStack=this.actionStack.slice(1)}}handleEvent(i){t[this.actionStack[0].action].listen===i.data.type&&(this.shiftActionStack(),this.actionStack.length>0&&this.emitCurrentActionEvent())}fetchUserActions(){const i=new URL(`${this.endpoint}/v1/player/${this.userid}/legislation/actions`);return fetch(i.href).then((i=>i.json())).then((i=>{this.actionStack=i.actions,this.actionStack.length>0&&this.emitCurrentActionEvent()}))}componentWillLoad(){return this.fetchUserActions()}render(){}};o.style=":host{display:block}";export{o as user_actions}
1
+ import{r as i}from"./p-d8d5dc61.js";const t={"verification-popup":{emit:"openKycVerificationModal",listen:"closeKycVerificationModal"},"get-temporary-account-consents":{emit:"openTemporaryConsentsModal",listen:"closeTemporaryConsentsModal"},"limits-popup":{emit:"openLugasPopup",listen:"closeLugasPopup"},"video-verification-popup":{emit:"openKycVerificationModal",listen:"closeKycVerificationModal"},"unverified-phone-number":{emit:"openSmsVerificationModal",listen:"closeSmsVerificationModal"}},o=class{constructor(o){i(this,o),this.actionStack=[],this.emitCurrentActionEvent=()=>{window.postMessage({type:t[this.actionStack[0].action].emit})},this.shiftActionStack=()=>{this.actionStack=this.actionStack.slice(1)}}handleEvent(i){t[this.actionStack[0].action].listen===i.data.type&&(this.shiftActionStack(),this.actionStack.length>0&&this.emitCurrentActionEvent())}fetchUserActions(){const i=new URL(`${this.endpoint}/v1/player/${this.userid}/legislation/actions`);return fetch(i.href).then((i=>i.json())).then((i=>{this.actionStack=i.actions.filter((i=>t[i.action])),this.actionStack.length>0&&this.emitCurrentActionEvent()}))}componentWillLoad(){return this.fetchUserActions()}render(){}};o.style=":host{display:block}";export{o as user_actions}
@@ -1 +1 @@
1
- import{p as e,b as n}from"./p-d8d5dc61.js";(()=>{const n=import.meta.url,s={};return""!==n&&(s.resourcesUrl=new URL(".",n).href),e(s)})().then((e=>n([["p-31fa2e47",[[1,"user-actions",{endpoint:[1],userid:[1],actionStack:[32]},[[8,"message","handleEvent"]]]]]],e)));
1
+ import{p as e,b as a}from"./p-d8d5dc61.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((e=>a([["p-121ae7fa",[[1,"user-actions",{endpoint:[1],userid:[1],actionStack:[32]},[[8,"message","handleEvent"]]]]]],e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-actions",
3
- "version": "1.42.0",
3
+ "version": "1.43.1",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",