@klauswuestefeld/jux-web 2024.2.7-2 → 2024.2.8

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/dist/jux-web.js CHANGED
@@ -160,15 +160,10 @@ var juxWeb = (function (exports) {
160
160
  };
161
161
  // TODO: use jux-events to call commands and queries inside jux-web library
162
162
  const handleJuxEvents = (ev) => {
163
- const { method, endpoint, onResult, params, onError } = ev;
163
+ const { endpoint, onResult, params, onError } = ev;
164
164
  const onJsonResponse = (res) => onResult ? onResult(res) : null;
165
165
  const onHelpMessage = (err) => onError ? onError(err) : null;
166
- if (method === 'GET') {
167
- backendGet(endpoint, params, onJsonResponse, onHelpMessage);
168
- }
169
- if (method === 'POST') {
170
- backendPost(endpoint, params, onJsonResponse, onHelpMessage);
171
- }
166
+ backendPost(endpoint, params, onJsonResponse, onHelpMessage);
172
167
  };
173
168
  let timeout;
174
169
  const maxRetries = 20;
@@ -268,7 +263,8 @@ var juxWeb = (function (exports) {
268
263
  req.send(params);
269
264
  };
270
265
  const backendPost = (endpoint, postContent, onJsonResponse, onHelpMessage) => {
271
- backendRequest('POST', getApiUrl() + endpoint, postContent, onJsonResponse, onHelpMessage);
266
+ const params = JSON.stringify(postContent);
267
+ backendRequest('POST', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
272
268
  };
273
269
  const backendGet = (endpoint, params, onJsonResponse, onHelpMessage) => {
274
270
  backendRequest('GET', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
@@ -14047,7 +14043,7 @@ var juxWeb = (function (exports) {
14047
14043
  <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
14048
14044
  token,
14049
14045
  };
14050
- backendPost('contact-us', JSON.stringify(inquiryPayload), (_res) => {
14046
+ backendPost('contact-us', inquiryPayload, (_res) => {
14051
14047
  var _a;
14052
14048
  // success(getTranslation('form-success'), Length.long);
14053
14049
  (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
@@ -14082,7 +14078,7 @@ var juxWeb = (function (exports) {
14082
14078
  if (subject !== 'email-not-sent') {
14083
14079
  // @ts-ignore
14084
14080
  const admin = ((_d = (_c = window.store) === null || _c === void 0 ? void 0 : _c.selectedTeam) === null || _d === void 0 ? void 0 : _d.admin) || window.store.currentUser.email;
14085
- backendGet(`credits-balance-for?admin=${admin}`, null, (res) => {
14081
+ backendGet('credits-balance-for', { admin }, (res) => {
14086
14082
  const balance = res;
14087
14083
  if (balance <= 0) {
14088
14084
  form.insertBefore(captcha, btn);
@@ -14571,7 +14567,7 @@ var juxWeb = (function (exports) {
14571
14567
  }
14572
14568
  }
14573
14569
  const query = (element, endpoint, onResult, params, onError) => {
14574
- element.dispatchEvent(new JuxEvent('GET', endpoint, onResult, params, onError));
14570
+ element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
14575
14571
  };
14576
14572
  const command = (element, endpoint, onResult, params, onError) => {
14577
14573
  element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
package/dist/main.esm.js CHANGED
@@ -159,15 +159,10 @@ const getMagicAuthReqUrl = () => {
159
159
  };
160
160
  // TODO: use jux-events to call commands and queries inside jux-web library
161
161
  const handleJuxEvents = (ev) => {
162
- const { method, endpoint, onResult, params, onError } = ev;
162
+ const { endpoint, onResult, params, onError } = ev;
163
163
  const onJsonResponse = (res) => onResult ? onResult(res) : null;
164
164
  const onHelpMessage = (err) => onError ? onError(err) : null;
165
- if (method === 'GET') {
166
- backendGet(endpoint, params, onJsonResponse, onHelpMessage);
167
- }
168
- if (method === 'POST') {
169
- backendPost(endpoint, params, onJsonResponse, onHelpMessage);
170
- }
165
+ backendPost(endpoint, params, onJsonResponse, onHelpMessage);
171
166
  };
172
167
  let timeout;
173
168
  const maxRetries = 20;
@@ -267,7 +262,8 @@ const backendRequest = (requestType, urlString, params, onJsonResponse, onHelpMe
267
262
  req.send(params);
268
263
  };
269
264
  const backendPost = (endpoint, postContent, onJsonResponse, onHelpMessage) => {
270
- backendRequest('POST', getApiUrl() + endpoint, postContent, onJsonResponse, onHelpMessage);
265
+ const params = JSON.stringify(postContent);
266
+ backendRequest('POST', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
271
267
  };
272
268
  const backendGet = (endpoint, params, onJsonResponse, onHelpMessage) => {
273
269
  backendRequest('GET', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
@@ -727,7 +723,7 @@ const sendInquiry = (name, email, msg, whatsapp, subject, token) => {
727
723
  <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
728
724
  token,
729
725
  };
730
- backendPost('contact-us', JSON.stringify(inquiryPayload), (_res) => {
726
+ backendPost('contact-us', inquiryPayload, (_res) => {
731
727
  var _a;
732
728
  // success(getTranslation('form-success'), Length.long);
733
729
  (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
@@ -762,7 +758,7 @@ const contactUsModal = (subject) => {
762
758
  if (subject !== 'email-not-sent') {
763
759
  // @ts-ignore
764
760
  const admin = ((_d = (_c = window.store) === null || _c === void 0 ? void 0 : _c.selectedTeam) === null || _d === void 0 ? void 0 : _d.admin) || window.store.currentUser.email;
765
- backendGet(`credits-balance-for?admin=${admin}`, null, (res) => {
761
+ backendGet('credits-balance-for', { admin }, (res) => {
766
762
  const balance = res;
767
763
  if (balance <= 0) {
768
764
  form.insertBefore(captcha, btn);
@@ -1251,7 +1247,7 @@ class JuxEvent extends Event {
1251
1247
  }
1252
1248
  }
1253
1249
  const query = (element, endpoint, onResult, params, onError) => {
1254
- element.dispatchEvent(new JuxEvent('GET', endpoint, onResult, params, onError));
1250
+ element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
1255
1251
  };
1256
1252
  const command = (element, endpoint, onResult, params, onError) => {
1257
1253
  element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
package/dist/main.js CHANGED
@@ -183,15 +183,10 @@ const getMagicAuthReqUrl = () => {
183
183
  };
184
184
  // TODO: use jux-events to call commands and queries inside jux-web library
185
185
  const handleJuxEvents = (ev) => {
186
- const { method, endpoint, onResult, params, onError } = ev;
186
+ const { endpoint, onResult, params, onError } = ev;
187
187
  const onJsonResponse = (res) => onResult ? onResult(res) : null;
188
188
  const onHelpMessage = (err) => onError ? onError(err) : null;
189
- if (method === 'GET') {
190
- backendGet(endpoint, params, onJsonResponse, onHelpMessage);
191
- }
192
- if (method === 'POST') {
193
- backendPost(endpoint, params, onJsonResponse, onHelpMessage);
194
- }
189
+ backendPost(endpoint, params, onJsonResponse, onHelpMessage);
195
190
  };
196
191
  let timeout;
197
192
  const maxRetries = 20;
@@ -291,7 +286,8 @@ const backendRequest = (requestType, urlString, params, onJsonResponse, onHelpMe
291
286
  req.send(params);
292
287
  };
293
288
  const backendPost = (endpoint, postContent, onJsonResponse, onHelpMessage) => {
294
- backendRequest('POST', getApiUrl() + endpoint, postContent, onJsonResponse, onHelpMessage);
289
+ const params = JSON.stringify(postContent);
290
+ backendRequest('POST', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
295
291
  };
296
292
  const backendGet = (endpoint, params, onJsonResponse, onHelpMessage) => {
297
293
  backendRequest('GET', getApiUrl() + endpoint, params, onJsonResponse, onHelpMessage);
@@ -751,7 +747,7 @@ const sendInquiry = (name, email, msg, whatsapp, subject, token) => {
751
747
  <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
752
748
  token,
753
749
  };
754
- backendPost('contact-us', JSON.stringify(inquiryPayload), (_res) => {
750
+ backendPost('contact-us', inquiryPayload, (_res) => {
755
751
  var _a;
756
752
  // success(getTranslation('form-success'), Length.long);
757
753
  (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
@@ -786,7 +782,7 @@ const contactUsModal = (subject) => {
786
782
  if (subject !== 'email-not-sent') {
787
783
  // @ts-ignore
788
784
  const admin = ((_d = (_c = window.store) === null || _c === void 0 ? void 0 : _c.selectedTeam) === null || _d === void 0 ? void 0 : _d.admin) || window.store.currentUser.email;
789
- backendGet(`credits-balance-for?admin=${admin}`, null, (res) => {
785
+ backendGet('credits-balance-for', { admin }, (res) => {
790
786
  const balance = res;
791
787
  if (balance <= 0) {
792
788
  form.insertBefore(captcha, btn);
@@ -1275,7 +1271,7 @@ class JuxEvent extends Event {
1275
1271
  }
1276
1272
  }
1277
1273
  const query = (element, endpoint, onResult, params, onError) => {
1278
- element.dispatchEvent(new JuxEvent('GET', endpoint, onResult, params, onError));
1274
+ element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
1279
1275
  };
1280
1276
  const command = (element, endpoint, onResult, params, onError) => {
1281
1277
  element.dispatchEvent(new JuxEvent('POST', endpoint, onResult, params, onError));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klauswuestefeld/jux-web",
3
- "version": "2024.2.7-2",
3
+ "version": "2024.2.8",
4
4
  "author": "Jux.House",
5
5
  "license": "Copyrighted",
6
6
  "description": "",