@seamly/web-ui 21.0.2 → 21.0.3-beta.2

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.
@@ -14896,6 +14896,9 @@ function store(key) {
14896
14896
  }
14897
14897
  };
14898
14898
  }
14899
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js
14900
+ var splice = __webpack_require__(9940);
14901
+ var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
14899
14902
  ;// CONCATENATED MODULE: ./node_modules/phoenix/priv/static/phoenix.mjs
14900
14903
  // js/phoenix/utils.js
14901
14904
  var closure = (value) => {
@@ -16064,6 +16067,7 @@ const splitUrlParams = url => {
16064
16067
 
16065
16068
 
16066
16069
 
16070
+
16067
16071
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
16068
16072
  function adopt(value) {
16069
16073
  return value instanceof P ? value : new P(function (resolve) {
@@ -16143,21 +16147,37 @@ class ConversationConnector {
16143
16147
  this.channel.on('system', msg => {
16144
16148
  switch (msg.type) {
16145
16149
  case 'attach_channel_succeeded':
16146
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'attach_channel_succeeded');
16150
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16151
+ connected: true,
16152
+ ready: true,
16153
+ currentState: 'attach_channel_succeeded'
16154
+ });
16147
16155
  break;
16148
16156
  }
16149
16157
  });
16150
16158
  this.socket.onClose(() => {
16151
16159
  log('[SOCKET]CLOSE');
16152
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'socket_closed');
16160
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16161
+ connected: false,
16162
+ ready: false,
16163
+ currentState: 'socket_closed'
16164
+ });
16153
16165
  });
16154
16166
  this.channel.onClose(() => {
16155
16167
  log('[CHANNEL]CLOSE');
16156
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'channel_closed');
16168
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16169
+ connected: false,
16170
+ ready: false,
16171
+ currentState: 'channel_closed'
16172
+ });
16157
16173
  });
16158
16174
  this.channel.onError(msg => {
16159
16175
  log('[CHANNEL][ERROR]', msg);
16160
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'channel_erred');
16176
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16177
+ connected: false,
16178
+ ready: false,
16179
+ currentState: 'channel_erred'
16180
+ });
16161
16181
  });
16162
16182
  __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_listenTo).call(this, 'ack', 'ui', 'error', 'participant', 'message', 'service_data', 'system', 'info', 'sync');
16163
16183
  });
@@ -16165,10 +16185,18 @@ class ConversationConnector {
16165
16185
  start() {
16166
16186
  this.channel.join().receive('ok', () => {
16167
16187
  log('[CHANNEL][JOIN] OK');
16168
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'join_channel_succeeded');
16188
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16189
+ connected: true,
16190
+ ready: false,
16191
+ currentState: 'join_channel_succeeded'
16192
+ });
16169
16193
  }).receive('error', err => {
16170
16194
  log('[CHANNEL][JOIN] ERROR', err);
16171
- __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, 'join_channel_erred');
16195
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
16196
+ connected: false,
16197
+ ready: false,
16198
+ currentState: 'join_channel_erred'
16199
+ });
16172
16200
  // @ts-ignore
16173
16201
  this.channel.socket.disconnect();
16174
16202
  }).receive('timeout', () => {
@@ -16182,7 +16210,6 @@ class ConversationConnector {
16182
16210
  (_b = this.socket) === null || _b === void 0 ? void 0 : _b.remove(this.channel);
16183
16211
  (_c = this.socket) === null || _c === void 0 ? void 0 : _c.disconnect();
16184
16212
  }
16185
- // eslint-disable-next-line no-unused-vars
16186
16213
  onConnection(cb) {
16187
16214
  __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").push(cb);
16188
16215
  }
@@ -16201,8 +16228,16 @@ _ConversationConnector_connectionListeners = new (weak_map_default())(), _Conver
16201
16228
  });
16202
16229
  });
16203
16230
  }, _ConversationConnector_emitConnectionState = function _ConversationConnector_emitConnectionState(payload) {
16204
- var _context;
16205
- for_each_default()(_context = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f")).call(_context, cb => cb(payload));
16231
+ // Loop in reverse order to enable splicing the array while iterating
16232
+ for (let i = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").length - 1; i >= 0; i--) {
16233
+ const callback = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f")[i];
16234
+ const complete = callback(payload);
16235
+ // If we only want to execute the callback once, remove it from the listener
16236
+ if (complete) {
16237
+ var _context;
16238
+ splice_default()(_context = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f")).call(_context, i, 1);
16239
+ }
16240
+ }
16206
16241
  };
16207
16242
  ;// CONCATENATED MODULE: ./src/javascripts/api/index.ts
16208
16243
 
@@ -16215,7 +16250,6 @@ _ConversationConnector_connectionListeners = new (weak_map_default())(), _Conver
16215
16250
 
16216
16251
 
16217
16252
 
16218
-
16219
16253
  var api_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
16220
16254
  function adopt(value) {
16221
16255
  return value instanceof P ? value : new P(function (resolve) {
@@ -16470,10 +16504,13 @@ class API {
16470
16504
  conversationInitialState = yield api_classPrivateFieldGet(this, _API_instances, "m", _API_createConversation).call(this);
16471
16505
  }
16472
16506
  this.conversation.connect(`${api_classPrivateFieldGet(this, _API_instances, "m", _API_getUrlPrefix).call(this, 'ws')}${this.URLS.socket}`, api_classPrivateFieldGet(this, _API_config, "f").context.channelName, api_classPrivateFieldGet(this, _API_instances, "m", _API_getChannelTopic).call(this), api_classPrivateFieldGet(this, _API_instances, "m", _API_getAccessToken).call(this));
16473
- this.conversation.onConnection(connectionState => {
16474
- var _context;
16475
- this.connected = includes_default()(_context = ['attach_channel_succeeded', 'join_channel_succeeded']).call(_context, connectionState);
16476
- api_classPrivateFieldSet(this, _API_ready, connectionState === 'attach_channel_succeeded', "f");
16507
+ this.conversation.onConnection(_ref4 => {
16508
+ let {
16509
+ connected,
16510
+ ready
16511
+ } = _ref4;
16512
+ this.connected = connected;
16513
+ api_classPrivateFieldSet(this, _API_ready, ready, "f");
16477
16514
  });
16478
16515
  // Send environment
16479
16516
  if (api_classPrivateFieldGet(this, _API_config, "f").sendEnvironment) {
@@ -16513,10 +16550,10 @@ class API {
16513
16550
  getConversationIntitialState() {
16514
16551
  return client_default().get(`${api_classPrivateFieldGet(this, _API_instances, "m", _API_getUrlPrefix).call(this, 'http')}${this.getConversationUrl()}`).set('Authorization', `Bearer ${api_classPrivateFieldGet(this, _API_instances, "m", _API_getAccessToken).call(this)}`).query({
16515
16552
  v: apiVersion
16516
- }).then(_ref4 => {
16553
+ }).then(_ref5 => {
16517
16554
  let {
16518
16555
  body
16519
- } = _ref4;
16556
+ } = _ref5;
16520
16557
  api_classPrivateFieldGet(this, _API_instances, "m", _API_updateUrls).call(this, body);
16521
16558
  this.userResponded = body.conversation.userResponded;
16522
16559
  return omit(body.conversation, ['accessToken', 'channelTopic']);
@@ -16558,12 +16595,18 @@ class API {
16558
16595
  var _a;
16559
16596
  if (!this.connected || waitForReady && !api_classPrivateFieldGet(this, _API_ready, "f")) {
16560
16597
  // Wait for connection to be made
16561
- (_a = this.conversation) === null || _a === void 0 ? void 0 : _a.onConnection(connectionState => {
16562
- const connected = connectionState === 'join_channel_succeeded';
16563
- const ready = connectionState === 'attach_channel_succeeded';
16564
- if (connected || ready) {
16598
+ (_a = this.conversation) === null || _a === void 0 ? void 0 : _a.onConnection(_ref6 => {
16599
+ let {
16600
+ connected,
16601
+ ready
16602
+ } = _ref6;
16603
+ this.connected = connected;
16604
+ api_classPrivateFieldSet(this, _API_ready, ready, "f");
16605
+ if (waitForReady ? ready : connected) {
16565
16606
  this.send(command, payload, waitForReady);
16607
+ return true;
16566
16608
  }
16609
+ return false;
16567
16610
  });
16568
16611
  return;
16569
16612
  }
@@ -16610,18 +16653,18 @@ _API_ready = new (weak_map_default())(), _API_externalId = new (weak_map_default
16610
16653
  }, _API_getUrlPrefix = function _API_getUrlPrefix(protocol) {
16611
16654
  const realProtocol = this.connectionInfo.secure ? `${protocol}s` : protocol;
16612
16655
  return `${realProtocol}://${this.connectionInfo.domain}`;
16613
- }, _API_updateUrls = function _API_updateUrls(_ref5) {
16614
- var _context2, _context3;
16656
+ }, _API_updateUrls = function _API_updateUrls(_ref7) {
16657
+ var _context, _context2;
16615
16658
  let {
16616
16659
  _links: responseLinks
16617
- } = _ref5;
16618
- this.URLS = reduce_default()(_context2 = filter_default()(_context3 = entries_default()(responseLinks)).call(_context3, _ref6 => {
16619
- let [key] = _ref6;
16660
+ } = _ref7;
16661
+ this.URLS = reduce_default()(_context = filter_default()(_context2 = entries_default()(responseLinks)).call(_context2, _ref8 => {
16662
+ let [key] = _ref8;
16620
16663
  return key !== 'self';
16621
- })).call(_context2, (urls, _ref7) => {
16664
+ })).call(_context, (urls, _ref9) => {
16622
16665
  let [key, {
16623
16666
  href
16624
- }] = _ref7;
16667
+ }] = _ref9;
16625
16668
  return assign_default()(assign_default()({}, urls), {
16626
16669
  [key]: href
16627
16670
  });
@@ -22288,9 +22331,6 @@ const selectIsLoading = es_createSelector(_ref7 => {
22288
22331
  } = _ref8;
22289
22332
  return isLoading;
22290
22333
  });
22291
- // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js
22292
- var splice = __webpack_require__(9940);
22293
- var splice_default = /*#__PURE__*/__webpack_require__.n(splice);
22294
22334
  ;// CONCATENATED MODULE: ./src/javascripts/domains/translations/slice.ts
22295
22335
 
22296
22336
 
@@ -27827,8 +27867,11 @@ const SeamlyEventSubscriber = () => {
27827
27867
  return () => {};
27828
27868
  }, [api, api.connectionInfo, api.conversation]);
27829
27869
  (0,hooks_module/* useEffect */.d4)(() => {
27830
- api.conversation.onConnection(connectionState => {
27831
- if (connectionState === 'join_channel_erred') {
27870
+ api.conversation.onConnection(_ref => {
27871
+ let {
27872
+ currentState
27873
+ } = _ref;
27874
+ if (currentState === 'join_channel_erred') {
27832
27875
  const seamlyGeneralError = new SeamlyGeneralError();
27833
27876
  dispatch(setInterrupt({
27834
27877
  name: seamlyGeneralError.name,
@@ -32845,7 +32888,6 @@ const DeprecatedAppFrame = _ref => {
32845
32888
 
32846
32889
 
32847
32890
 
32848
-
32849
32891
  const ShowInlineView = _ref => {
32850
32892
  let {
32851
32893
  children
@@ -32860,7 +32902,6 @@ const ShowInlineView = _ref => {
32860
32902
  });
32861
32903
  };
32862
32904
  const DeprecatedView = () => {
32863
- use_seamly_chat();
32864
32905
  const {
32865
32906
  isVisible,
32866
32907
  openChat,