@subiz/widget-v4 4.1.165 → 4.1.167

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 (38) hide show
  1. package/compiled_src/chatbox/Event.js +2 -0
  2. package/compiled_src/store/api.js +4 -1
  3. package/compiled_src/store/store.js +20 -32
  4. package/dist/198a3614cdc.app.js +1 -0
  5. package/dist/{198a3089a0c.chat.html → 198a3614cdc.chat.html} +1 -1
  6. package/dist/198a3614cdc.chat.js +1 -0
  7. package/dist/{198a3089a0c.form.html → 198a3614cdc.form.html} +1 -1
  8. package/dist/198a3614cdc.form.js +1 -0
  9. package/dist/{198a3089a0c.index.html → 198a3614cdc.index.html} +1 -1
  10. package/dist/{198a3089a0c.library.html → 198a3614cdc.library.html} +1 -1
  11. package/dist/198a3614cdc.library.js +1 -0
  12. package/dist/{198a3089a0c.preview.html → 198a3614cdc.preview.html} +1 -1
  13. package/dist/198a3614cdc.preview.js +1 -0
  14. package/dist/198a3614cdc.webview.js +1 -0
  15. package/dist/HASH +1 -1
  16. package/dist/screenshoot.js +39 -10
  17. package/inject.html +11 -2
  18. package/package.json +1 -1
  19. package/src/chatbox/Event.js +2 -1
  20. package/src/lib.js +0 -1
  21. package/src/store/api.js +4 -1
  22. package/src/store/store.js +24 -33
  23. package/dist/198a3089a0c.app.js +0 -1
  24. package/dist/198a3089a0c.chat.js +0 -1
  25. package/dist/198a3089a0c.form.js +0 -1
  26. package/dist/198a3089a0c.library.js +0 -1
  27. package/dist/198a3089a0c.preview.js +0 -1
  28. package/dist/198a3089a0c.webview.js +0 -1
  29. /package/dist/{198a3089a0c.127.js → 198a3614cdc.127.js} +0 -0
  30. /package/dist/{198a3089a0c.132.js → 198a3614cdc.132.js} +0 -0
  31. /package/dist/{198a3089a0c.185.js → 198a3614cdc.185.js} +0 -0
  32. /package/dist/{198a3089a0c.27.js → 198a3614cdc.27.js} +0 -0
  33. /package/dist/{198a3089a0c.278.js → 198a3614cdc.278.js} +0 -0
  34. /package/dist/{198a3089a0c.339.js → 198a3614cdc.339.js} +0 -0
  35. /package/dist/{198a3089a0c.459.js → 198a3614cdc.459.js} +0 -0
  36. /package/dist/{198a3089a0c.490.js → 198a3614cdc.490.js} +0 -0
  37. /package/dist/{198a3089a0c.74.js → 198a3614cdc.74.js} +0 -0
  38. /package/dist/{198a3089a0c.997.js → 198a3614cdc.997.js} +0 -0
@@ -462,6 +462,8 @@ class Event extends _common.Com {
462
462
  renderAIDevNote() {
463
463
  if (!this.props.isLast) return null;
464
464
  if (!this.props.store.isAIDevMode()) return null;
465
+ let cid = _index.default.get(this.props.event.ev, 'data.message.conversation_id', '');
466
+ if (cid.startsWith('cslight')) return null;
465
467
  let ev = _index.default.get(this.props.event, 'ev') || {};
466
468
  let pongs = _index.default.get(ev, 'data.message.pongs') || [];
467
469
  let hasLike = this.hasLike();
@@ -146,7 +146,10 @@ class _default {
146
146
  _defineProperty(this, "time", _ => ajax.setBaseUrl(this.ApiURL).withCredentials(true).setParser('json').get('/time'));
147
147
  _defineProperty(this, "updateUser", data => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}`, data));
148
148
  _defineProperty(this, "getUser", _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`));
149
- _defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
149
+ _defineProperty(this, "getAccountSetting", () => {
150
+ let href = _index.default.get(document, 'location.href');
151
+ return this.apireq.addQuery('url', href).get(`/accounts/${this.accid}/settings`);
152
+ });
150
153
  _defineProperty(this, "sendImpression", impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression));
151
154
  _defineProperty(this, "sendConversion", conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion));
152
155
  _defineProperty(this, "lookupOrder", key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`));
@@ -283,6 +283,7 @@ class Store {
283
283
  });
284
284
  }
285
285
  }, 2000);
286
+ this.loopCheckConnectionStatus();
286
287
  }
287
288
  async loopCheckConnectionStatus() {
288
289
  while (true) {
@@ -441,8 +442,6 @@ class Store {
441
442
  if (!this.isInsync('account')) this.reconnect();
442
443
  }
443
444
  async init(accid, mask, userRef, options) {
444
- this.readyGate.close();
445
- accid = (accid || '').trim();
446
445
  this.g_sync = {};
447
446
  if (!options || !options.use_subdomain_cookie) {
448
447
  if (window && window.location && window.location.hostname) {
@@ -477,69 +476,58 @@ class Store {
477
476
  cleanMyLocalStorage();
478
477
  this.clearBrowserData();
479
478
  }
480
- this.lightConvos = {};
481
- this.cache = new _kv.default(new _lsdb.default('sbz2023', true), 'kv');
482
479
  this.api.setAuth({
483
480
  accid: accid
484
481
  });
485
482
  if (userRef) this.cookie.set('__sbref', userRef);
486
- let user = await this.api.setAuth({
483
+ return this._initResource(accid, {
487
484
  accid: accid,
488
485
  mask: mask,
489
486
  ref: userRef
487
+ }, {
488
+ account_id: accid,
489
+ user_ref: userRef,
490
+ user_mask: mask
490
491
  });
492
+ }
493
+ async _initResource(accid, auth, realtimep) {
494
+ this.g_sync = {};
495
+ let user = await this.api.setAuth(auth);
491
496
  if (user.error) {
492
497
  console.error(user);
493
498
  return user;
494
499
  }
500
+ this.readyGate.close();
501
+ accid = (accid || '').trim();
502
+ this.lightConvos = this.kv.match('light_convos') || {};
503
+ this.cache = new _kv.default(new _lsdb.default('sbz2023', true), 'kv');
495
504
  if (this.realtime) this.realtime.stop();
496
- if (this.fake) this.realtime = new _realtime_fake.default();else this.realtime = new Realtime(this.RealtimeURL, {
497
- account_id: accid,
498
- user_ref: userRef,
499
- user_mask: mask
500
- }, xhrsend);
505
+ if (this.fake) this.realtime = new _realtime_fake.default();else this.realtime = new Realtime(this.RealtimeURL, realtimep, xhrsend);
501
506
  this.realtime.onEvent(this.onWs.bind(this));
502
507
  this.realtime.onInterrupted(async () => {
503
508
  await this.reconnectWs(accid, user.id);
504
509
  this.reconnect();
505
510
  });
506
- this.lightConvos = this.kv.match('light_convos') || {};
507
511
  this.seenLoop();
508
512
  await this.reconnect({
509
513
  user: user
510
514
  });
511
515
  this.readyGate.open();
512
516
  this.reconnectWs(accid, user.id);
513
- this.loopCheckConnectionStatus();
514
517
  return user;
515
518
  }
516
519
  async login(accid, user_id, tokenGenerator) {
517
520
  if (this._die) return dieErr;
518
- let user = await this.api.setAuth({
521
+ cleanMyLocalStorage();
522
+ this.clearBrowserData();
523
+ this.new_visitor = false;
524
+ return this._initResource(accid, {
519
525
  accid: accid,
520
526
  profile_id: user_id,
521
527
  tokenGenerator: tokenGenerator
522
- });
523
- if (user.error) return user;
524
- this.clearBrowserData();
525
- this.readyGate.close();
526
- accid = (accid || '').trim();
527
- this.g_sync = {};
528
- this.new_visitor = false;
529
- if (this.realtime) this.realtime.stop();
530
- if (this.fake) this.realtime = new _realtime_fake.default();else this.realtime = new Realtime(this.RealtimeURL, {
528
+ }, {
531
529
  getAccessToken: () => this.api.token_generator()
532
530
  });
533
- this.realtime.onEvent(this.onWs.bind(this));
534
- this.realtime.onInterrupted(async () => {
535
- await this.reconnectWs(accid, user.id);
536
- this.reconnect();
537
- });
538
- this.seenLoop();
539
- await this.reconnect();
540
- this.readyGate.open();
541
- this.reconnectWs(accid, user.id);
542
- return user;
543
531
  }
544
532
  logout(userRef) {
545
533
  return this.api.setAuth({