@subiz/widget-v4 4.1.87 → 4.1.89

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.
Files changed (35) hide show
  1. package/compiled_src/chatbox/Widget.js +2 -1
  2. package/compiled_src/lib.js +20 -1
  3. package/compiled_src/store/store.js +6 -1
  4. package/compiled_src/util/common.js +1 -0
  5. package/dist/190ba49045c.app.js +1 -0
  6. package/dist/{190815938a3.index.html → 190ba49045c.index.html} +1 -1
  7. package/dist/{190815938a3.library.html → 190ba49045c.library.html} +1 -1
  8. package/dist/190ba49045c.library.js +1 -0
  9. package/dist/{190815938a3.preview.html → 190ba49045c.preview.html} +1 -1
  10. package/dist/190ba49045c.preview.js +1 -0
  11. package/dist/190ba49045c.screenshoot.js +1 -0
  12. package/dist/190ba49045c.webview.js +1 -0
  13. package/dist/HASH +1 -1
  14. package/dist/screenshoot.html +1 -1
  15. package/dist/screenshoot.js +32 -6
  16. package/loader.js +4 -1
  17. package/package.json +6 -6
  18. package/src/chatbox/Widget.js +4 -3
  19. package/src/lib.js +21 -1
  20. package/src/store/store.js +7 -1
  21. package/src/util/common.js +1 -0
  22. package/dist/190815938a3.app.js +0 -1
  23. package/dist/190815938a3.library.js +0 -1
  24. package/dist/190815938a3.preview.js +0 -1
  25. package/dist/190815938a3.screenshoot.js +0 -1
  26. package/dist/190815938a3.webview.js +0 -1
  27. /package/dist/{190815938a3.127.js → 190ba49045c.127.js} +0 -0
  28. /package/dist/{190815938a3.132.js → 190ba49045c.132.js} +0 -0
  29. /package/dist/{190815938a3.185.js → 190ba49045c.185.js} +0 -0
  30. /package/dist/{190815938a3.27.js → 190ba49045c.27.js} +0 -0
  31. /package/dist/{190815938a3.278.js → 190ba49045c.278.js} +0 -0
  32. /package/dist/{190815938a3.459.js → 190ba49045c.459.js} +0 -0
  33. /package/dist/{190815938a3.490.js → 190ba49045c.490.js} +0 -0
  34. /package/dist/{190815938a3.74.js → 190ba49045c.74.js} +0 -0
  35. /package/dist/{190815938a3.997.js → 190ba49045c.997.js} +0 -0
@@ -286,7 +286,8 @@ class Widget extends _common.Com {
286
286
  value: _index.default.stringify(field.value)
287
287
  };
288
288
  });
289
- this.props.store.submitForm('chatbox_' + formName, formData, user);
289
+ await this.props.store.submitForm('chatbox_' + formName, formData, user);
290
+ await _index.default.sleep(500);
290
291
  if (_creating != this._creating) return;
291
292
  if (this.props.cid) {
292
293
  this.setState({
@@ -72,7 +72,7 @@ class Widget {
72
72
  param = param || {};
73
73
  let accid = param.account_id;
74
74
  let ref = param.ref;
75
- let user = await this.store.init(accid, undefined, ref);
75
+ let user = await this.store.init(accid, undefined, ref, param);
76
76
  _index.default.setTimeout(() => window.postMessage({
77
77
  type: 'widget_loaded',
78
78
  account_id: accid
@@ -87,6 +87,25 @@ class Widget {
87
87
  this.domGate.open();
88
88
  return user;
89
89
  }
90
+ async start(param, $container, mask, cb) {
91
+ param = param || {};
92
+ let id = param.account_id;
93
+ let outmask = await this.store.init(id, mask, param.ref, param);
94
+ _index.default.setTimeout(() => window.postMessage({
95
+ type: 'widget_loaded',
96
+ account_id: id
97
+ }, '*'), 0);
98
+ if (!$container) $container = document.body || document;
99
+ this.pluginMgr = new _plugin.default(this, $container);
100
+ let clean = _index.default.setInterval(() => {
101
+ if ($container && $container.isConnected) return;
102
+ this.pluginMgr.destroy();
103
+ _index.default.clearInterval(clean);
104
+ }, 1000);
105
+ this.domGate.open();
106
+ cb && cb(outmask);
107
+ return outmask;
108
+ }
90
109
  async setAccount(id, $container, mask, cb) {
91
110
  let outmask = await this.store.init(id, mask);
92
111
  _index.default.setTimeout(() => window.postMessage({
@@ -362,10 +362,15 @@ class Store {
362
362
  await this.readyGate.entry();
363
363
  if (!this.isInsync('account')) this.reconnect();
364
364
  }
365
- async init(accid, mask, userRef) {
365
+ async init(accid, mask, userRef, options) {
366
366
  this.readyGate.close();
367
367
  accid = (accid || '').trim();
368
368
  this.g_sync = {};
369
+ if (!options || !options.use_subdomain_cookie) {
370
+ if (window && window.location && window.location.hostname) {
371
+ cookie.defaults.domain = '.' + window.location.hostname;
372
+ }
373
+ }
369
374
  if (!userRef) {
370
375
  try {
371
376
  userRef = this.cookie.get('__sbref', '');
@@ -818,6 +818,7 @@ function checkRunConditions(freq, conds, lastrun, store) {
818
818
  }
819
819
  break;
820
820
  case 'user_attribute':
821
+ case 'user':
821
822
  let userprop;
822
823
  let attrs = op.get(store.matchUser(), 'attributes', []);
823
824
  let operator = op.get(cond, 'user.operator');