@seamly/web-ui 22.3.4 → 22.3.5-beta.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.
Files changed (34) hide show
  1. package/build/dist/lib/components.js +1484 -14
  2. package/build/dist/lib/components.js.map +1 -1
  3. package/build/dist/lib/components.min.js +1 -1
  4. package/build/dist/lib/components.min.js.map +1 -1
  5. package/build/dist/lib/hooks.js +1519 -9
  6. package/build/dist/lib/hooks.js.map +1 -1
  7. package/build/dist/lib/hooks.min.js +1 -1
  8. package/build/dist/lib/hooks.min.js.map +1 -1
  9. package/build/dist/lib/index.debug.js +15 -4
  10. package/build/dist/lib/index.debug.js.map +1 -1
  11. package/build/dist/lib/index.debug.min.js +1 -1
  12. package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -0
  13. package/build/dist/lib/index.debug.min.js.map +1 -1
  14. package/build/dist/lib/index.js +258 -244
  15. package/build/dist/lib/index.js.map +1 -1
  16. package/build/dist/lib/index.min.js +1 -1
  17. package/build/dist/lib/index.min.js.map +1 -1
  18. package/build/dist/lib/standalone.js +536 -245
  19. package/build/dist/lib/standalone.js.map +1 -1
  20. package/build/dist/lib/standalone.min.js +1 -1
  21. package/build/dist/lib/standalone.min.js.map +1 -1
  22. package/build/dist/lib/style-guide.js +265 -251
  23. package/build/dist/lib/style-guide.js.map +1 -1
  24. package/build/dist/lib/style-guide.min.js +1 -1
  25. package/build/dist/lib/style-guide.min.js.map +1 -1
  26. package/build/dist/lib/utils.js +8497 -8427
  27. package/build/dist/lib/utils.js.map +1 -1
  28. package/build/dist/lib/utils.min.js +1 -1
  29. package/build/dist/lib/utils.min.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/javascripts/api/conversation-connector.ts +48 -32
  32. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +197 -218
  33. package/src/javascripts/ui/hooks/seamly-hooks.js +5 -5
  34. package/src/javascripts/ui/hooks/use-seamly-conversation.ts +13 -0
@@ -1,10 +1,10 @@
1
1
  /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
2
  /******/ var __webpack_modules__ = ({
4
3
 
5
4
  /***/ 9639:
6
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7
6
 
7
+ "use strict";
8
8
 
9
9
  // EXPORTS
10
10
  __webpack_require__.d(__webpack_exports__, {
@@ -2642,15 +2642,1373 @@ F();
2642
2642
 
2643
2643
  /***/ }),
2644
2644
 
2645
+ /***/ 1541:
2646
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2647
+
2648
+ "use strict";
2649
+
2650
+ // EXPORTS
2651
+ __webpack_require__.d(__webpack_exports__, {
2652
+ Z: () => (/* binding */ conversation_connector)
2653
+ });
2654
+
2655
+ ;// CONCATENATED MODULE: ./node_modules/phoenix/priv/static/phoenix.mjs
2656
+ // js/phoenix/utils.js
2657
+ var closure = (value) => {
2658
+ if (typeof value === "function") {
2659
+ return value;
2660
+ } else {
2661
+ let closure2 = function() {
2662
+ return value;
2663
+ };
2664
+ return closure2;
2665
+ }
2666
+ };
2667
+
2668
+ // js/phoenix/constants.js
2669
+ var globalSelf = typeof self !== "undefined" ? self : null;
2670
+ var phxWindow = typeof window !== "undefined" ? window : null;
2671
+ var global = globalSelf || phxWindow || global;
2672
+ var DEFAULT_VSN = "2.0.0";
2673
+ var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
2674
+ var DEFAULT_TIMEOUT = 1e4;
2675
+ var WS_CLOSE_NORMAL = 1e3;
2676
+ var CHANNEL_STATES = {
2677
+ closed: "closed",
2678
+ errored: "errored",
2679
+ joined: "joined",
2680
+ joining: "joining",
2681
+ leaving: "leaving"
2682
+ };
2683
+ var CHANNEL_EVENTS = {
2684
+ close: "phx_close",
2685
+ error: "phx_error",
2686
+ join: "phx_join",
2687
+ reply: "phx_reply",
2688
+ leave: "phx_leave"
2689
+ };
2690
+ var TRANSPORTS = {
2691
+ longpoll: "longpoll",
2692
+ websocket: "websocket"
2693
+ };
2694
+ var XHR_STATES = {
2695
+ complete: 4
2696
+ };
2697
+
2698
+ // js/phoenix/push.js
2699
+ var Push = class {
2700
+ constructor(channel, event, payload, timeout) {
2701
+ this.channel = channel;
2702
+ this.event = event;
2703
+ this.payload = payload || function() {
2704
+ return {};
2705
+ };
2706
+ this.receivedResp = null;
2707
+ this.timeout = timeout;
2708
+ this.timeoutTimer = null;
2709
+ this.recHooks = [];
2710
+ this.sent = false;
2711
+ }
2712
+ resend(timeout) {
2713
+ this.timeout = timeout;
2714
+ this.reset();
2715
+ this.send();
2716
+ }
2717
+ send() {
2718
+ if (this.hasReceived("timeout")) {
2719
+ return;
2720
+ }
2721
+ this.startTimeout();
2722
+ this.sent = true;
2723
+ this.channel.socket.push({
2724
+ topic: this.channel.topic,
2725
+ event: this.event,
2726
+ payload: this.payload(),
2727
+ ref: this.ref,
2728
+ join_ref: this.channel.joinRef()
2729
+ });
2730
+ }
2731
+ receive(status, callback) {
2732
+ if (this.hasReceived(status)) {
2733
+ callback(this.receivedResp.response);
2734
+ }
2735
+ this.recHooks.push({ status, callback });
2736
+ return this;
2737
+ }
2738
+ reset() {
2739
+ this.cancelRefEvent();
2740
+ this.ref = null;
2741
+ this.refEvent = null;
2742
+ this.receivedResp = null;
2743
+ this.sent = false;
2744
+ }
2745
+ matchReceive({ status, response, _ref }) {
2746
+ this.recHooks.filter((h) => h.status === status).forEach((h) => h.callback(response));
2747
+ }
2748
+ cancelRefEvent() {
2749
+ if (!this.refEvent) {
2750
+ return;
2751
+ }
2752
+ this.channel.off(this.refEvent);
2753
+ }
2754
+ cancelTimeout() {
2755
+ clearTimeout(this.timeoutTimer);
2756
+ this.timeoutTimer = null;
2757
+ }
2758
+ startTimeout() {
2759
+ if (this.timeoutTimer) {
2760
+ this.cancelTimeout();
2761
+ }
2762
+ this.ref = this.channel.socket.makeRef();
2763
+ this.refEvent = this.channel.replyEventName(this.ref);
2764
+ this.channel.on(this.refEvent, (payload) => {
2765
+ this.cancelRefEvent();
2766
+ this.cancelTimeout();
2767
+ this.receivedResp = payload;
2768
+ this.matchReceive(payload);
2769
+ });
2770
+ this.timeoutTimer = setTimeout(() => {
2771
+ this.trigger("timeout", {});
2772
+ }, this.timeout);
2773
+ }
2774
+ hasReceived(status) {
2775
+ return this.receivedResp && this.receivedResp.status === status;
2776
+ }
2777
+ trigger(status, response) {
2778
+ this.channel.trigger(this.refEvent, { status, response });
2779
+ }
2780
+ };
2781
+
2782
+ // js/phoenix/timer.js
2783
+ var Timer = class {
2784
+ constructor(callback, timerCalc) {
2785
+ this.callback = callback;
2786
+ this.timerCalc = timerCalc;
2787
+ this.timer = null;
2788
+ this.tries = 0;
2789
+ }
2790
+ reset() {
2791
+ this.tries = 0;
2792
+ clearTimeout(this.timer);
2793
+ }
2794
+ scheduleTimeout() {
2795
+ clearTimeout(this.timer);
2796
+ this.timer = setTimeout(() => {
2797
+ this.tries = this.tries + 1;
2798
+ this.callback();
2799
+ }, this.timerCalc(this.tries + 1));
2800
+ }
2801
+ };
2802
+
2803
+ // js/phoenix/channel.js
2804
+ var Channel = class {
2805
+ constructor(topic, params, socket) {
2806
+ this.state = CHANNEL_STATES.closed;
2807
+ this.topic = topic;
2808
+ this.params = closure(params || {});
2809
+ this.socket = socket;
2810
+ this.bindings = [];
2811
+ this.bindingRef = 0;
2812
+ this.timeout = this.socket.timeout;
2813
+ this.joinedOnce = false;
2814
+ this.joinPush = new Push(this, CHANNEL_EVENTS.join, this.params, this.timeout);
2815
+ this.pushBuffer = [];
2816
+ this.stateChangeRefs = [];
2817
+ this.rejoinTimer = new Timer(() => {
2818
+ if (this.socket.isConnected()) {
2819
+ this.rejoin();
2820
+ }
2821
+ }, this.socket.rejoinAfterMs);
2822
+ this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset()));
2823
+ this.stateChangeRefs.push(this.socket.onOpen(() => {
2824
+ this.rejoinTimer.reset();
2825
+ if (this.isErrored()) {
2826
+ this.rejoin();
2827
+ }
2828
+ }));
2829
+ this.joinPush.receive("ok", () => {
2830
+ this.state = CHANNEL_STATES.joined;
2831
+ this.rejoinTimer.reset();
2832
+ this.pushBuffer.forEach((pushEvent) => pushEvent.send());
2833
+ this.pushBuffer = [];
2834
+ });
2835
+ this.joinPush.receive("error", () => {
2836
+ this.state = CHANNEL_STATES.errored;
2837
+ if (this.socket.isConnected()) {
2838
+ this.rejoinTimer.scheduleTimeout();
2839
+ }
2840
+ });
2841
+ this.onClose(() => {
2842
+ this.rejoinTimer.reset();
2843
+ if (this.socket.hasLogger())
2844
+ this.socket.log("channel", `close ${this.topic} ${this.joinRef()}`);
2845
+ this.state = CHANNEL_STATES.closed;
2846
+ this.socket.remove(this);
2847
+ });
2848
+ this.onError((reason) => {
2849
+ if (this.socket.hasLogger())
2850
+ this.socket.log("channel", `error ${this.topic}`, reason);
2851
+ if (this.isJoining()) {
2852
+ this.joinPush.reset();
2853
+ }
2854
+ this.state = CHANNEL_STATES.errored;
2855
+ if (this.socket.isConnected()) {
2856
+ this.rejoinTimer.scheduleTimeout();
2857
+ }
2858
+ });
2859
+ this.joinPush.receive("timeout", () => {
2860
+ if (this.socket.hasLogger())
2861
+ this.socket.log("channel", `timeout ${this.topic} (${this.joinRef()})`, this.joinPush.timeout);
2862
+ let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), this.timeout);
2863
+ leavePush.send();
2864
+ this.state = CHANNEL_STATES.errored;
2865
+ this.joinPush.reset();
2866
+ if (this.socket.isConnected()) {
2867
+ this.rejoinTimer.scheduleTimeout();
2868
+ }
2869
+ });
2870
+ this.on(CHANNEL_EVENTS.reply, (payload, ref) => {
2871
+ this.trigger(this.replyEventName(ref), payload);
2872
+ });
2873
+ }
2874
+ join(timeout = this.timeout) {
2875
+ if (this.joinedOnce) {
2876
+ throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");
2877
+ } else {
2878
+ this.timeout = timeout;
2879
+ this.joinedOnce = true;
2880
+ this.rejoin();
2881
+ return this.joinPush;
2882
+ }
2883
+ }
2884
+ onClose(callback) {
2885
+ this.on(CHANNEL_EVENTS.close, callback);
2886
+ }
2887
+ onError(callback) {
2888
+ return this.on(CHANNEL_EVENTS.error, (reason) => callback(reason));
2889
+ }
2890
+ on(event, callback) {
2891
+ let ref = this.bindingRef++;
2892
+ this.bindings.push({ event, ref, callback });
2893
+ return ref;
2894
+ }
2895
+ off(event, ref) {
2896
+ this.bindings = this.bindings.filter((bind) => {
2897
+ return !(bind.event === event && (typeof ref === "undefined" || ref === bind.ref));
2898
+ });
2899
+ }
2900
+ canPush() {
2901
+ return this.socket.isConnected() && this.isJoined();
2902
+ }
2903
+ push(event, payload, timeout = this.timeout) {
2904
+ payload = payload || {};
2905
+ if (!this.joinedOnce) {
2906
+ throw new Error(`tried to push '${event}' to '${this.topic}' before joining. Use channel.join() before pushing events`);
2907
+ }
2908
+ let pushEvent = new Push(this, event, function() {
2909
+ return payload;
2910
+ }, timeout);
2911
+ if (this.canPush()) {
2912
+ pushEvent.send();
2913
+ } else {
2914
+ pushEvent.startTimeout();
2915
+ this.pushBuffer.push(pushEvent);
2916
+ }
2917
+ return pushEvent;
2918
+ }
2919
+ leave(timeout = this.timeout) {
2920
+ this.rejoinTimer.reset();
2921
+ this.joinPush.cancelTimeout();
2922
+ this.state = CHANNEL_STATES.leaving;
2923
+ let onClose = () => {
2924
+ if (this.socket.hasLogger())
2925
+ this.socket.log("channel", `leave ${this.topic}`);
2926
+ this.trigger(CHANNEL_EVENTS.close, "leave");
2927
+ };
2928
+ let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), timeout);
2929
+ leavePush.receive("ok", () => onClose()).receive("timeout", () => onClose());
2930
+ leavePush.send();
2931
+ if (!this.canPush()) {
2932
+ leavePush.trigger("ok", {});
2933
+ }
2934
+ return leavePush;
2935
+ }
2936
+ onMessage(_event, payload, _ref) {
2937
+ return payload;
2938
+ }
2939
+ isMember(topic, event, payload, joinRef) {
2940
+ if (this.topic !== topic) {
2941
+ return false;
2942
+ }
2943
+ if (joinRef && joinRef !== this.joinRef()) {
2944
+ if (this.socket.hasLogger())
2945
+ this.socket.log("channel", "dropping outdated message", { topic, event, payload, joinRef });
2946
+ return false;
2947
+ } else {
2948
+ return true;
2949
+ }
2950
+ }
2951
+ joinRef() {
2952
+ return this.joinPush.ref;
2953
+ }
2954
+ rejoin(timeout = this.timeout) {
2955
+ if (this.isLeaving()) {
2956
+ return;
2957
+ }
2958
+ this.socket.leaveOpenTopic(this.topic);
2959
+ this.state = CHANNEL_STATES.joining;
2960
+ this.joinPush.resend(timeout);
2961
+ }
2962
+ trigger(event, payload, ref, joinRef) {
2963
+ let handledPayload = this.onMessage(event, payload, ref, joinRef);
2964
+ if (payload && !handledPayload) {
2965
+ throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");
2966
+ }
2967
+ let eventBindings = this.bindings.filter((bind) => bind.event === event);
2968
+ for (let i = 0; i < eventBindings.length; i++) {
2969
+ let bind = eventBindings[i];
2970
+ bind.callback(handledPayload, ref, joinRef || this.joinRef());
2971
+ }
2972
+ }
2973
+ replyEventName(ref) {
2974
+ return `chan_reply_${ref}`;
2975
+ }
2976
+ isClosed() {
2977
+ return this.state === CHANNEL_STATES.closed;
2978
+ }
2979
+ isErrored() {
2980
+ return this.state === CHANNEL_STATES.errored;
2981
+ }
2982
+ isJoined() {
2983
+ return this.state === CHANNEL_STATES.joined;
2984
+ }
2985
+ isJoining() {
2986
+ return this.state === CHANNEL_STATES.joining;
2987
+ }
2988
+ isLeaving() {
2989
+ return this.state === CHANNEL_STATES.leaving;
2990
+ }
2991
+ };
2992
+
2993
+ // js/phoenix/ajax.js
2994
+ var Ajax = class {
2995
+ static request(method, endPoint, accept, body, timeout, ontimeout, callback) {
2996
+ if (global.XDomainRequest) {
2997
+ let req = new global.XDomainRequest();
2998
+ return this.xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback);
2999
+ } else {
3000
+ let req = new global.XMLHttpRequest();
3001
+ return this.xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback);
3002
+ }
3003
+ }
3004
+ static xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback) {
3005
+ req.timeout = timeout;
3006
+ req.open(method, endPoint);
3007
+ req.onload = () => {
3008
+ let response = this.parseJSON(req.responseText);
3009
+ callback && callback(response);
3010
+ };
3011
+ if (ontimeout) {
3012
+ req.ontimeout = ontimeout;
3013
+ }
3014
+ req.onprogress = () => {
3015
+ };
3016
+ req.send(body);
3017
+ return req;
3018
+ }
3019
+ static xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback) {
3020
+ req.open(method, endPoint, true);
3021
+ req.timeout = timeout;
3022
+ req.setRequestHeader("Content-Type", accept);
3023
+ req.onerror = () => callback && callback(null);
3024
+ req.onreadystatechange = () => {
3025
+ if (req.readyState === XHR_STATES.complete && callback) {
3026
+ let response = this.parseJSON(req.responseText);
3027
+ callback(response);
3028
+ }
3029
+ };
3030
+ if (ontimeout) {
3031
+ req.ontimeout = ontimeout;
3032
+ }
3033
+ req.send(body);
3034
+ return req;
3035
+ }
3036
+ static parseJSON(resp) {
3037
+ if (!resp || resp === "") {
3038
+ return null;
3039
+ }
3040
+ try {
3041
+ return JSON.parse(resp);
3042
+ } catch (e) {
3043
+ console && console.log("failed to parse JSON response", resp);
3044
+ return null;
3045
+ }
3046
+ }
3047
+ static serialize(obj, parentKey) {
3048
+ let queryStr = [];
3049
+ for (var key in obj) {
3050
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
3051
+ continue;
3052
+ }
3053
+ let paramKey = parentKey ? `${parentKey}[${key}]` : key;
3054
+ let paramVal = obj[key];
3055
+ if (typeof paramVal === "object") {
3056
+ queryStr.push(this.serialize(paramVal, paramKey));
3057
+ } else {
3058
+ queryStr.push(encodeURIComponent(paramKey) + "=" + encodeURIComponent(paramVal));
3059
+ }
3060
+ }
3061
+ return queryStr.join("&");
3062
+ }
3063
+ static appendParams(url, params) {
3064
+ if (Object.keys(params).length === 0) {
3065
+ return url;
3066
+ }
3067
+ let prefix = url.match(/\?/) ? "&" : "?";
3068
+ return `${url}${prefix}${this.serialize(params)}`;
3069
+ }
3070
+ };
3071
+
3072
+ // js/phoenix/longpoll.js
3073
+ var LongPoll = class {
3074
+ constructor(endPoint) {
3075
+ this.endPoint = null;
3076
+ this.token = null;
3077
+ this.skipHeartbeat = true;
3078
+ this.reqs = /* @__PURE__ */ new Set();
3079
+ this.awaitingBatchAck = false;
3080
+ this.currentBatch = null;
3081
+ this.currentBatchTimer = null;
3082
+ this.batchBuffer = [];
3083
+ this.onopen = function() {
3084
+ };
3085
+ this.onerror = function() {
3086
+ };
3087
+ this.onmessage = function() {
3088
+ };
3089
+ this.onclose = function() {
3090
+ };
3091
+ this.pollEndpoint = this.normalizeEndpoint(endPoint);
3092
+ this.readyState = SOCKET_STATES.connecting;
3093
+ this.poll();
3094
+ }
3095
+ normalizeEndpoint(endPoint) {
3096
+ return endPoint.replace("ws://", "http://").replace("wss://", "https://").replace(new RegExp("(.*)/" + TRANSPORTS.websocket), "$1/" + TRANSPORTS.longpoll);
3097
+ }
3098
+ endpointURL() {
3099
+ return Ajax.appendParams(this.pollEndpoint, { token: this.token });
3100
+ }
3101
+ closeAndRetry(code, reason, wasClean) {
3102
+ this.close(code, reason, wasClean);
3103
+ this.readyState = SOCKET_STATES.connecting;
3104
+ }
3105
+ ontimeout() {
3106
+ this.onerror("timeout");
3107
+ this.closeAndRetry(1005, "timeout", false);
3108
+ }
3109
+ isActive() {
3110
+ return this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting;
3111
+ }
3112
+ poll() {
3113
+ this.ajax("GET", "application/json", null, () => this.ontimeout(), (resp) => {
3114
+ if (resp) {
3115
+ var { status, token, messages } = resp;
3116
+ this.token = token;
3117
+ } else {
3118
+ status = 0;
3119
+ }
3120
+ switch (status) {
3121
+ case 200:
3122
+ messages.forEach((msg) => {
3123
+ setTimeout(() => this.onmessage({ data: msg }), 0);
3124
+ });
3125
+ this.poll();
3126
+ break;
3127
+ case 204:
3128
+ this.poll();
3129
+ break;
3130
+ case 410:
3131
+ this.readyState = SOCKET_STATES.open;
3132
+ this.onopen({});
3133
+ this.poll();
3134
+ break;
3135
+ case 403:
3136
+ this.onerror(403);
3137
+ this.close(1008, "forbidden", false);
3138
+ break;
3139
+ case 0:
3140
+ case 500:
3141
+ this.onerror(500);
3142
+ this.closeAndRetry(1011, "internal server error", 500);
3143
+ break;
3144
+ default:
3145
+ throw new Error(`unhandled poll status ${status}`);
3146
+ }
3147
+ });
3148
+ }
3149
+ send(body) {
3150
+ if (this.currentBatch) {
3151
+ this.currentBatch.push(body);
3152
+ } else if (this.awaitingBatchAck) {
3153
+ this.batchBuffer.push(body);
3154
+ } else {
3155
+ this.currentBatch = [body];
3156
+ this.currentBatchTimer = setTimeout(() => {
3157
+ this.batchSend(this.currentBatch);
3158
+ this.currentBatch = null;
3159
+ }, 0);
3160
+ }
3161
+ }
3162
+ batchSend(messages) {
3163
+ this.awaitingBatchAck = true;
3164
+ this.ajax("POST", "application/x-ndjson", messages.join("\n"), () => this.onerror("timeout"), (resp) => {
3165
+ this.awaitingBatchAck = false;
3166
+ if (!resp || resp.status !== 200) {
3167
+ this.onerror(resp && resp.status);
3168
+ this.closeAndRetry(1011, "internal server error", false);
3169
+ } else if (this.batchBuffer.length > 0) {
3170
+ this.batchSend(this.batchBuffer);
3171
+ this.batchBuffer = [];
3172
+ }
3173
+ });
3174
+ }
3175
+ close(code, reason, wasClean) {
3176
+ for (let req of this.reqs) {
3177
+ req.abort();
3178
+ }
3179
+ this.readyState = SOCKET_STATES.closed;
3180
+ let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
3181
+ this.batchBuffer = [];
3182
+ clearTimeout(this.currentBatchTimer);
3183
+ this.currentBatchTimer = null;
3184
+ if (typeof CloseEvent !== "undefined") {
3185
+ this.onclose(new CloseEvent("close", opts));
3186
+ } else {
3187
+ this.onclose(opts);
3188
+ }
3189
+ }
3190
+ ajax(method, contentType, body, onCallerTimeout, callback) {
3191
+ let req;
3192
+ let ontimeout = () => {
3193
+ this.reqs.delete(req);
3194
+ onCallerTimeout();
3195
+ };
3196
+ req = Ajax.request(method, this.endpointURL(), contentType, body, this.timeout, ontimeout, (resp) => {
3197
+ this.reqs.delete(req);
3198
+ if (this.isActive()) {
3199
+ callback(resp);
3200
+ }
3201
+ });
3202
+ this.reqs.add(req);
3203
+ }
3204
+ };
3205
+
3206
+ // js/phoenix/presence.js
3207
+ var Presence = class {
3208
+ constructor(channel, opts = {}) {
3209
+ let events = opts.events || { state: "presence_state", diff: "presence_diff" };
3210
+ this.state = {};
3211
+ this.pendingDiffs = [];
3212
+ this.channel = channel;
3213
+ this.joinRef = null;
3214
+ this.caller = {
3215
+ onJoin: function() {
3216
+ },
3217
+ onLeave: function() {
3218
+ },
3219
+ onSync: function() {
3220
+ }
3221
+ };
3222
+ this.channel.on(events.state, (newState) => {
3223
+ let { onJoin, onLeave, onSync } = this.caller;
3224
+ this.joinRef = this.channel.joinRef();
3225
+ this.state = Presence.syncState(this.state, newState, onJoin, onLeave);
3226
+ this.pendingDiffs.forEach((diff) => {
3227
+ this.state = Presence.syncDiff(this.state, diff, onJoin, onLeave);
3228
+ });
3229
+ this.pendingDiffs = [];
3230
+ onSync();
3231
+ });
3232
+ this.channel.on(events.diff, (diff) => {
3233
+ let { onJoin, onLeave, onSync } = this.caller;
3234
+ if (this.inPendingSyncState()) {
3235
+ this.pendingDiffs.push(diff);
3236
+ } else {
3237
+ this.state = Presence.syncDiff(this.state, diff, onJoin, onLeave);
3238
+ onSync();
3239
+ }
3240
+ });
3241
+ }
3242
+ onJoin(callback) {
3243
+ this.caller.onJoin = callback;
3244
+ }
3245
+ onLeave(callback) {
3246
+ this.caller.onLeave = callback;
3247
+ }
3248
+ onSync(callback) {
3249
+ this.caller.onSync = callback;
3250
+ }
3251
+ list(by) {
3252
+ return Presence.list(this.state, by);
3253
+ }
3254
+ inPendingSyncState() {
3255
+ return !this.joinRef || this.joinRef !== this.channel.joinRef();
3256
+ }
3257
+ static syncState(currentState, newState, onJoin, onLeave) {
3258
+ let state = this.clone(currentState);
3259
+ let joins = {};
3260
+ let leaves = {};
3261
+ this.map(state, (key, presence) => {
3262
+ if (!newState[key]) {
3263
+ leaves[key] = presence;
3264
+ }
3265
+ });
3266
+ this.map(newState, (key, newPresence) => {
3267
+ let currentPresence = state[key];
3268
+ if (currentPresence) {
3269
+ let newRefs = newPresence.metas.map((m) => m.phx_ref);
3270
+ let curRefs = currentPresence.metas.map((m) => m.phx_ref);
3271
+ let joinedMetas = newPresence.metas.filter((m) => curRefs.indexOf(m.phx_ref) < 0);
3272
+ let leftMetas = currentPresence.metas.filter((m) => newRefs.indexOf(m.phx_ref) < 0);
3273
+ if (joinedMetas.length > 0) {
3274
+ joins[key] = newPresence;
3275
+ joins[key].metas = joinedMetas;
3276
+ }
3277
+ if (leftMetas.length > 0) {
3278
+ leaves[key] = this.clone(currentPresence);
3279
+ leaves[key].metas = leftMetas;
3280
+ }
3281
+ } else {
3282
+ joins[key] = newPresence;
3283
+ }
3284
+ });
3285
+ return this.syncDiff(state, { joins, leaves }, onJoin, onLeave);
3286
+ }
3287
+ static syncDiff(state, diff, onJoin, onLeave) {
3288
+ let { joins, leaves } = this.clone(diff);
3289
+ if (!onJoin) {
3290
+ onJoin = function() {
3291
+ };
3292
+ }
3293
+ if (!onLeave) {
3294
+ onLeave = function() {
3295
+ };
3296
+ }
3297
+ this.map(joins, (key, newPresence) => {
3298
+ let currentPresence = state[key];
3299
+ state[key] = this.clone(newPresence);
3300
+ if (currentPresence) {
3301
+ let joinedRefs = state[key].metas.map((m) => m.phx_ref);
3302
+ let curMetas = currentPresence.metas.filter((m) => joinedRefs.indexOf(m.phx_ref) < 0);
3303
+ state[key].metas.unshift(...curMetas);
3304
+ }
3305
+ onJoin(key, currentPresence, newPresence);
3306
+ });
3307
+ this.map(leaves, (key, leftPresence) => {
3308
+ let currentPresence = state[key];
3309
+ if (!currentPresence) {
3310
+ return;
3311
+ }
3312
+ let refsToRemove = leftPresence.metas.map((m) => m.phx_ref);
3313
+ currentPresence.metas = currentPresence.metas.filter((p) => {
3314
+ return refsToRemove.indexOf(p.phx_ref) < 0;
3315
+ });
3316
+ onLeave(key, currentPresence, leftPresence);
3317
+ if (currentPresence.metas.length === 0) {
3318
+ delete state[key];
3319
+ }
3320
+ });
3321
+ return state;
3322
+ }
3323
+ static list(presences, chooser) {
3324
+ if (!chooser) {
3325
+ chooser = function(key, pres) {
3326
+ return pres;
3327
+ };
3328
+ }
3329
+ return this.map(presences, (key, presence) => {
3330
+ return chooser(key, presence);
3331
+ });
3332
+ }
3333
+ static map(obj, func) {
3334
+ return Object.getOwnPropertyNames(obj).map((key) => func(key, obj[key]));
3335
+ }
3336
+ static clone(obj) {
3337
+ return JSON.parse(JSON.stringify(obj));
3338
+ }
3339
+ };
3340
+
3341
+ // js/phoenix/serializer.js
3342
+ var serializer_default = {
3343
+ HEADER_LENGTH: 1,
3344
+ META_LENGTH: 4,
3345
+ KINDS: { push: 0, reply: 1, broadcast: 2 },
3346
+ encode(msg, callback) {
3347
+ if (msg.payload.constructor === ArrayBuffer) {
3348
+ return callback(this.binaryEncode(msg));
3349
+ } else {
3350
+ let payload = [msg.join_ref, msg.ref, msg.topic, msg.event, msg.payload];
3351
+ return callback(JSON.stringify(payload));
3352
+ }
3353
+ },
3354
+ decode(rawPayload, callback) {
3355
+ if (rawPayload.constructor === ArrayBuffer) {
3356
+ return callback(this.binaryDecode(rawPayload));
3357
+ } else {
3358
+ let [join_ref, ref, topic, event, payload] = JSON.parse(rawPayload);
3359
+ return callback({ join_ref, ref, topic, event, payload });
3360
+ }
3361
+ },
3362
+ binaryEncode(message) {
3363
+ let { join_ref, ref, event, topic, payload } = message;
3364
+ let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
3365
+ let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
3366
+ let view = new DataView(header);
3367
+ let offset = 0;
3368
+ view.setUint8(offset++, this.KINDS.push);
3369
+ view.setUint8(offset++, join_ref.length);
3370
+ view.setUint8(offset++, ref.length);
3371
+ view.setUint8(offset++, topic.length);
3372
+ view.setUint8(offset++, event.length);
3373
+ Array.from(join_ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
3374
+ Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
3375
+ Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
3376
+ Array.from(event, (char) => view.setUint8(offset++, char.charCodeAt(0)));
3377
+ var combined = new Uint8Array(header.byteLength + payload.byteLength);
3378
+ combined.set(new Uint8Array(header), 0);
3379
+ combined.set(new Uint8Array(payload), header.byteLength);
3380
+ return combined.buffer;
3381
+ },
3382
+ binaryDecode(buffer) {
3383
+ let view = new DataView(buffer);
3384
+ let kind = view.getUint8(0);
3385
+ let decoder = new TextDecoder();
3386
+ switch (kind) {
3387
+ case this.KINDS.push:
3388
+ return this.decodePush(buffer, view, decoder);
3389
+ case this.KINDS.reply:
3390
+ return this.decodeReply(buffer, view, decoder);
3391
+ case this.KINDS.broadcast:
3392
+ return this.decodeBroadcast(buffer, view, decoder);
3393
+ }
3394
+ },
3395
+ decodePush(buffer, view, decoder) {
3396
+ let joinRefSize = view.getUint8(1);
3397
+ let topicSize = view.getUint8(2);
3398
+ let eventSize = view.getUint8(3);
3399
+ let offset = this.HEADER_LENGTH + this.META_LENGTH - 1;
3400
+ let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
3401
+ offset = offset + joinRefSize;
3402
+ let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
3403
+ offset = offset + topicSize;
3404
+ let event = decoder.decode(buffer.slice(offset, offset + eventSize));
3405
+ offset = offset + eventSize;
3406
+ let data = buffer.slice(offset, buffer.byteLength);
3407
+ return { join_ref: joinRef, ref: null, topic, event, payload: data };
3408
+ },
3409
+ decodeReply(buffer, view, decoder) {
3410
+ let joinRefSize = view.getUint8(1);
3411
+ let refSize = view.getUint8(2);
3412
+ let topicSize = view.getUint8(3);
3413
+ let eventSize = view.getUint8(4);
3414
+ let offset = this.HEADER_LENGTH + this.META_LENGTH;
3415
+ let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
3416
+ offset = offset + joinRefSize;
3417
+ let ref = decoder.decode(buffer.slice(offset, offset + refSize));
3418
+ offset = offset + refSize;
3419
+ let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
3420
+ offset = offset + topicSize;
3421
+ let event = decoder.decode(buffer.slice(offset, offset + eventSize));
3422
+ offset = offset + eventSize;
3423
+ let data = buffer.slice(offset, buffer.byteLength);
3424
+ let payload = { status: event, response: data };
3425
+ return { join_ref: joinRef, ref, topic, event: CHANNEL_EVENTS.reply, payload };
3426
+ },
3427
+ decodeBroadcast(buffer, view, decoder) {
3428
+ let topicSize = view.getUint8(1);
3429
+ let eventSize = view.getUint8(2);
3430
+ let offset = this.HEADER_LENGTH + 2;
3431
+ let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
3432
+ offset = offset + topicSize;
3433
+ let event = decoder.decode(buffer.slice(offset, offset + eventSize));
3434
+ offset = offset + eventSize;
3435
+ let data = buffer.slice(offset, buffer.byteLength);
3436
+ return { join_ref: null, ref: null, topic, event, payload: data };
3437
+ }
3438
+ };
3439
+
3440
+ // js/phoenix/socket.js
3441
+ var Socket = class {
3442
+ constructor(endPoint, opts = {}) {
3443
+ this.stateChangeCallbacks = { open: [], close: [], error: [], message: [] };
3444
+ this.channels = [];
3445
+ this.sendBuffer = [];
3446
+ this.ref = 0;
3447
+ this.timeout = opts.timeout || DEFAULT_TIMEOUT;
3448
+ this.transport = opts.transport || global.WebSocket || LongPoll;
3449
+ this.establishedConnections = 0;
3450
+ this.defaultEncoder = serializer_default.encode.bind(serializer_default);
3451
+ this.defaultDecoder = serializer_default.decode.bind(serializer_default);
3452
+ this.closeWasClean = false;
3453
+ this.binaryType = opts.binaryType || "arraybuffer";
3454
+ this.connectClock = 1;
3455
+ if (this.transport !== LongPoll) {
3456
+ this.encode = opts.encode || this.defaultEncoder;
3457
+ this.decode = opts.decode || this.defaultDecoder;
3458
+ } else {
3459
+ this.encode = this.defaultEncoder;
3460
+ this.decode = this.defaultDecoder;
3461
+ }
3462
+ let awaitingConnectionOnPageShow = null;
3463
+ if (phxWindow && phxWindow.addEventListener) {
3464
+ phxWindow.addEventListener("pagehide", (_e) => {
3465
+ if (this.conn) {
3466
+ this.disconnect();
3467
+ awaitingConnectionOnPageShow = this.connectClock;
3468
+ }
3469
+ });
3470
+ phxWindow.addEventListener("pageshow", (_e) => {
3471
+ if (awaitingConnectionOnPageShow === this.connectClock) {
3472
+ awaitingConnectionOnPageShow = null;
3473
+ this.connect();
3474
+ }
3475
+ });
3476
+ }
3477
+ this.heartbeatIntervalMs = opts.heartbeatIntervalMs || 3e4;
3478
+ this.rejoinAfterMs = (tries) => {
3479
+ if (opts.rejoinAfterMs) {
3480
+ return opts.rejoinAfterMs(tries);
3481
+ } else {
3482
+ return [1e3, 2e3, 5e3][tries - 1] || 1e4;
3483
+ }
3484
+ };
3485
+ this.reconnectAfterMs = (tries) => {
3486
+ if (opts.reconnectAfterMs) {
3487
+ return opts.reconnectAfterMs(tries);
3488
+ } else {
3489
+ return [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][tries - 1] || 5e3;
3490
+ }
3491
+ };
3492
+ this.logger = opts.logger || null;
3493
+ this.longpollerTimeout = opts.longpollerTimeout || 2e4;
3494
+ this.params = closure(opts.params || {});
3495
+ this.endPoint = `${endPoint}/${TRANSPORTS.websocket}`;
3496
+ this.vsn = opts.vsn || DEFAULT_VSN;
3497
+ this.heartbeatTimeoutTimer = null;
3498
+ this.heartbeatTimer = null;
3499
+ this.pendingHeartbeatRef = null;
3500
+ this.reconnectTimer = new Timer(() => {
3501
+ this.teardown(() => this.connect());
3502
+ }, this.reconnectAfterMs);
3503
+ }
3504
+ getLongPollTransport() {
3505
+ return LongPoll;
3506
+ }
3507
+ replaceTransport(newTransport) {
3508
+ this.connectClock++;
3509
+ this.closeWasClean = true;
3510
+ this.reconnectTimer.reset();
3511
+ this.sendBuffer = [];
3512
+ if (this.conn) {
3513
+ this.conn.close();
3514
+ this.conn = null;
3515
+ }
3516
+ this.transport = newTransport;
3517
+ }
3518
+ protocol() {
3519
+ return location.protocol.match(/^https/) ? "wss" : "ws";
3520
+ }
3521
+ endPointURL() {
3522
+ let uri = Ajax.appendParams(Ajax.appendParams(this.endPoint, this.params()), { vsn: this.vsn });
3523
+ if (uri.charAt(0) !== "/") {
3524
+ return uri;
3525
+ }
3526
+ if (uri.charAt(1) === "/") {
3527
+ return `${this.protocol()}:${uri}`;
3528
+ }
3529
+ return `${this.protocol()}://${location.host}${uri}`;
3530
+ }
3531
+ disconnect(callback, code, reason) {
3532
+ this.connectClock++;
3533
+ this.closeWasClean = true;
3534
+ this.reconnectTimer.reset();
3535
+ this.teardown(callback, code, reason);
3536
+ }
3537
+ connect(params) {
3538
+ if (params) {
3539
+ console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor");
3540
+ this.params = closure(params);
3541
+ }
3542
+ if (this.conn) {
3543
+ return;
3544
+ }
3545
+ this.connectClock++;
3546
+ this.closeWasClean = false;
3547
+ this.conn = new this.transport(this.endPointURL());
3548
+ this.conn.binaryType = this.binaryType;
3549
+ this.conn.timeout = this.longpollerTimeout;
3550
+ this.conn.onopen = () => this.onConnOpen();
3551
+ this.conn.onerror = (error) => this.onConnError(error);
3552
+ this.conn.onmessage = (event) => this.onConnMessage(event);
3553
+ this.conn.onclose = (event) => this.onConnClose(event);
3554
+ }
3555
+ log(kind, msg, data) {
3556
+ this.logger(kind, msg, data);
3557
+ }
3558
+ hasLogger() {
3559
+ return this.logger !== null;
3560
+ }
3561
+ onOpen(callback) {
3562
+ let ref = this.makeRef();
3563
+ this.stateChangeCallbacks.open.push([ref, callback]);
3564
+ return ref;
3565
+ }
3566
+ onClose(callback) {
3567
+ let ref = this.makeRef();
3568
+ this.stateChangeCallbacks.close.push([ref, callback]);
3569
+ return ref;
3570
+ }
3571
+ onError(callback) {
3572
+ let ref = this.makeRef();
3573
+ this.stateChangeCallbacks.error.push([ref, callback]);
3574
+ return ref;
3575
+ }
3576
+ onMessage(callback) {
3577
+ let ref = this.makeRef();
3578
+ this.stateChangeCallbacks.message.push([ref, callback]);
3579
+ return ref;
3580
+ }
3581
+ ping(callback) {
3582
+ if (!this.isConnected()) {
3583
+ return false;
3584
+ }
3585
+ let ref = this.makeRef();
3586
+ let startTime = Date.now();
3587
+ this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref });
3588
+ let onMsgRef = this.onMessage((msg) => {
3589
+ if (msg.ref === ref) {
3590
+ this.off([onMsgRef]);
3591
+ callback(Date.now() - startTime);
3592
+ }
3593
+ });
3594
+ return true;
3595
+ }
3596
+ clearHeartbeats() {
3597
+ clearTimeout(this.heartbeatTimer);
3598
+ clearTimeout(this.heartbeatTimeoutTimer);
3599
+ }
3600
+ onConnOpen() {
3601
+ if (this.hasLogger())
3602
+ this.log("transport", `connected to ${this.endPointURL()}`);
3603
+ this.closeWasClean = false;
3604
+ this.establishedConnections++;
3605
+ this.flushSendBuffer();
3606
+ this.reconnectTimer.reset();
3607
+ this.resetHeartbeat();
3608
+ this.stateChangeCallbacks.open.forEach(([, callback]) => callback());
3609
+ }
3610
+ heartbeatTimeout() {
3611
+ if (this.pendingHeartbeatRef) {
3612
+ this.pendingHeartbeatRef = null;
3613
+ if (this.hasLogger()) {
3614
+ this.log("transport", "heartbeat timeout. Attempting to re-establish connection");
3615
+ }
3616
+ this.triggerChanError();
3617
+ this.closeWasClean = false;
3618
+ this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout");
3619
+ }
3620
+ }
3621
+ resetHeartbeat() {
3622
+ if (this.conn && this.conn.skipHeartbeat) {
3623
+ return;
3624
+ }
3625
+ this.pendingHeartbeatRef = null;
3626
+ this.clearHeartbeats();
3627
+ this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
3628
+ }
3629
+ teardown(callback, code, reason) {
3630
+ if (!this.conn) {
3631
+ return callback && callback();
3632
+ }
3633
+ this.waitForBufferDone(() => {
3634
+ if (this.conn) {
3635
+ if (code) {
3636
+ this.conn.close(code, reason || "");
3637
+ } else {
3638
+ this.conn.close();
3639
+ }
3640
+ }
3641
+ this.waitForSocketClosed(() => {
3642
+ if (this.conn) {
3643
+ this.conn.onopen = function() {
3644
+ };
3645
+ this.conn.onerror = function() {
3646
+ };
3647
+ this.conn.onmessage = function() {
3648
+ };
3649
+ this.conn.onclose = function() {
3650
+ };
3651
+ this.conn = null;
3652
+ }
3653
+ callback && callback();
3654
+ });
3655
+ });
3656
+ }
3657
+ waitForBufferDone(callback, tries = 1) {
3658
+ if (tries === 5 || !this.conn || !this.conn.bufferedAmount) {
3659
+ callback();
3660
+ return;
3661
+ }
3662
+ setTimeout(() => {
3663
+ this.waitForBufferDone(callback, tries + 1);
3664
+ }, 150 * tries);
3665
+ }
3666
+ waitForSocketClosed(callback, tries = 1) {
3667
+ if (tries === 5 || !this.conn || this.conn.readyState === SOCKET_STATES.closed) {
3668
+ callback();
3669
+ return;
3670
+ }
3671
+ setTimeout(() => {
3672
+ this.waitForSocketClosed(callback, tries + 1);
3673
+ }, 150 * tries);
3674
+ }
3675
+ onConnClose(event) {
3676
+ let closeCode = event && event.code;
3677
+ if (this.hasLogger())
3678
+ this.log("transport", "close", event);
3679
+ this.triggerChanError();
3680
+ this.clearHeartbeats();
3681
+ if (!this.closeWasClean && closeCode !== 1e3) {
3682
+ this.reconnectTimer.scheduleTimeout();
3683
+ }
3684
+ this.stateChangeCallbacks.close.forEach(([, callback]) => callback(event));
3685
+ }
3686
+ onConnError(error) {
3687
+ if (this.hasLogger())
3688
+ this.log("transport", error);
3689
+ let transportBefore = this.transport;
3690
+ let establishedBefore = this.establishedConnections;
3691
+ this.stateChangeCallbacks.error.forEach(([, callback]) => {
3692
+ callback(error, transportBefore, establishedBefore);
3693
+ });
3694
+ if (transportBefore === this.transport || establishedBefore > 0) {
3695
+ this.triggerChanError();
3696
+ }
3697
+ }
3698
+ triggerChanError() {
3699
+ this.channels.forEach((channel) => {
3700
+ if (!(channel.isErrored() || channel.isLeaving() || channel.isClosed())) {
3701
+ channel.trigger(CHANNEL_EVENTS.error);
3702
+ }
3703
+ });
3704
+ }
3705
+ connectionState() {
3706
+ switch (this.conn && this.conn.readyState) {
3707
+ case SOCKET_STATES.connecting:
3708
+ return "connecting";
3709
+ case SOCKET_STATES.open:
3710
+ return "open";
3711
+ case SOCKET_STATES.closing:
3712
+ return "closing";
3713
+ default:
3714
+ return "closed";
3715
+ }
3716
+ }
3717
+ isConnected() {
3718
+ return this.connectionState() === "open";
3719
+ }
3720
+ remove(channel) {
3721
+ this.off(channel.stateChangeRefs);
3722
+ this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
3723
+ }
3724
+ off(refs) {
3725
+ for (let key in this.stateChangeCallbacks) {
3726
+ this.stateChangeCallbacks[key] = this.stateChangeCallbacks[key].filter(([ref]) => {
3727
+ return refs.indexOf(ref) === -1;
3728
+ });
3729
+ }
3730
+ }
3731
+ channel(topic, chanParams = {}) {
3732
+ let chan = new Channel(topic, chanParams, this);
3733
+ this.channels.push(chan);
3734
+ return chan;
3735
+ }
3736
+ push(data) {
3737
+ if (this.hasLogger()) {
3738
+ let { topic, event, payload, ref, join_ref } = data;
3739
+ this.log("push", `${topic} ${event} (${join_ref}, ${ref})`, payload);
3740
+ }
3741
+ if (this.isConnected()) {
3742
+ this.encode(data, (result) => this.conn.send(result));
3743
+ } else {
3744
+ this.sendBuffer.push(() => this.encode(data, (result) => this.conn.send(result)));
3745
+ }
3746
+ }
3747
+ makeRef() {
3748
+ let newRef = this.ref + 1;
3749
+ if (newRef === this.ref) {
3750
+ this.ref = 0;
3751
+ } else {
3752
+ this.ref = newRef;
3753
+ }
3754
+ return this.ref.toString();
3755
+ }
3756
+ sendHeartbeat() {
3757
+ if (this.pendingHeartbeatRef && !this.isConnected()) {
3758
+ return;
3759
+ }
3760
+ this.pendingHeartbeatRef = this.makeRef();
3761
+ this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref: this.pendingHeartbeatRef });
3762
+ this.heartbeatTimeoutTimer = setTimeout(() => this.heartbeatTimeout(), this.heartbeatIntervalMs);
3763
+ }
3764
+ flushSendBuffer() {
3765
+ if (this.isConnected() && this.sendBuffer.length > 0) {
3766
+ this.sendBuffer.forEach((callback) => callback());
3767
+ this.sendBuffer = [];
3768
+ }
3769
+ }
3770
+ onConnMessage(rawMessage) {
3771
+ this.decode(rawMessage.data, (msg) => {
3772
+ let { topic, event, payload, ref, join_ref } = msg;
3773
+ if (ref && ref === this.pendingHeartbeatRef) {
3774
+ this.clearHeartbeats();
3775
+ this.pendingHeartbeatRef = null;
3776
+ this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
3777
+ }
3778
+ if (this.hasLogger())
3779
+ this.log("receive", `${payload.status || ""} ${topic} ${event} ${ref && "(" + ref + ")" || ""}`, payload);
3780
+ for (let i = 0; i < this.channels.length; i++) {
3781
+ const channel = this.channels[i];
3782
+ if (!channel.isMember(topic, event, payload, join_ref)) {
3783
+ continue;
3784
+ }
3785
+ channel.trigger(event, payload, ref, join_ref);
3786
+ }
3787
+ for (let i = 0; i < this.stateChangeCallbacks.message.length; i++) {
3788
+ let [, callback] = this.stateChangeCallbacks.message[i];
3789
+ callback(msg);
3790
+ }
3791
+ });
3792
+ }
3793
+ leaveOpenTopic(topic) {
3794
+ let dupChannel = this.channels.find((c) => c.topic === topic && (c.isJoined() || c.isJoining()));
3795
+ if (dupChannel) {
3796
+ if (this.hasLogger())
3797
+ this.log("transport", `leaving duplicate topic "${topic}"`);
3798
+ dupChannel.leave();
3799
+ }
3800
+ }
3801
+ };
3802
+
3803
+ //# sourceMappingURL=phoenix.mjs.map
3804
+
3805
+ // EXTERNAL MODULE: ./src/javascripts/config.ts
3806
+ var config = __webpack_require__(9787);
3807
+ // EXTERNAL MODULE: ./src/javascripts/lib/debug.js
3808
+ var debug = __webpack_require__(7008);
3809
+ var debug_default = /*#__PURE__*/__webpack_require__.n(debug);
3810
+ // EXTERNAL MODULE: ./src/javascripts/lib/split-url-params.js
3811
+ var split_url_params = __webpack_require__(4864);
3812
+ ;// CONCATENATED MODULE: ./src/javascripts/api/conversation-connector.ts
3813
+ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
3814
+ function adopt(value) {
3815
+ return value instanceof P ? value : new P(function (resolve) {
3816
+ resolve(value);
3817
+ });
3818
+ }
3819
+ return new (P || (P = Promise))(function (resolve, reject) {
3820
+ function fulfilled(value) {
3821
+ try {
3822
+ step(generator.next(value));
3823
+ } catch (e) {
3824
+ reject(e);
3825
+ }
3826
+ }
3827
+ function rejected(value) {
3828
+ try {
3829
+ step(generator["throw"](value));
3830
+ } catch (e) {
3831
+ reject(e);
3832
+ }
3833
+ }
3834
+ function step(result) {
3835
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
3836
+ }
3837
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3838
+ });
3839
+ };
3840
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
3841
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3842
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3843
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3844
+ };
3845
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
3846
+ if (kind === "m") throw new TypeError("Private method is not writable");
3847
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3848
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3849
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
3850
+ };
3851
+ var _ConversationConnector_instances, _ConversationConnector_connectionListeners, _ConversationConnector_listenTo, _ConversationConnector_emitConnectionState;
3852
+
3853
+
3854
+
3855
+
3856
+ const log = debug_default()('seamly');
3857
+ // Subscribers set which are used to subscribe to changes in the conversation.
3858
+ // Needs to be outside of the ConversationConnector class so its not recreated for each instance.
3859
+ const subscribers = new Set();
3860
+ // Syncs the lifecycle of the conversation with Preact. Each subscriber will fetch the latest value from the conversation if needed.
3861
+ const emitChange = () => {
3862
+ // Call the callback function for each subscriber
3863
+ subscribers.forEach(callback => callback());
3864
+ };
3865
+ class ConversationConnector {
3866
+ constructor() {
3867
+ _ConversationConnector_instances.add(this);
3868
+ _ConversationConnector_connectionListeners.set(this, []);
3869
+ }
3870
+ connect(url, channelName, channelTopic, accessToken) {
3871
+ return __awaiter(this, void 0, void 0, function* () {
3872
+ this.url = url;
3873
+ this.accessToken = accessToken;
3874
+ this.channelName = channelName;
3875
+ this.channelTopic = channelTopic;
3876
+ const {
3877
+ url: splittedUrl,
3878
+ params
3879
+ } = (0,split_url_params/* default */.Z)(this.url);
3880
+ this.socket = new Socket(splittedUrl, {
3881
+ params: Object.assign(Object.assign({}, params), {
3882
+ v: config/* apiVersion */.tW
3883
+ }),
3884
+ reconnectAfterMs: tries => {
3885
+ // Calculate the backoff time based on the number of tries.
3886
+ const backoff = Math.pow(2, tries) * 250;
3887
+ // Limit the backoff time to 10 seconds.
3888
+ return Math.min(backoff, 10000);
3889
+ }
3890
+ });
3891
+ this.socket.onError(err => {
3892
+ log('[SOCKET][ERROR]', err);
3893
+ });
3894
+ this.socket.onOpen(() => {
3895
+ log('[SOCKET]OPEN');
3896
+ });
3897
+ this.socket.onClose(() => {
3898
+ log('[SOCKET]CLOSE');
3899
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3900
+ connected: false,
3901
+ ready: false,
3902
+ currentState: 'socket_closed'
3903
+ });
3904
+ });
3905
+ this.socket.connect();
3906
+ this.channel = this.socket.channel(this.channelTopic, {
3907
+ authorization: `Bearer ${this.accessToken}`,
3908
+ channelName: this.channelName
3909
+ });
3910
+ this.start();
3911
+ this.channel.on('system', msg => {
3912
+ switch (msg.type) {
3913
+ case 'attach_channel_succeeded':
3914
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3915
+ connected: true,
3916
+ ready: true,
3917
+ currentState: 'attach_channel_succeeded'
3918
+ });
3919
+ break;
3920
+ }
3921
+ });
3922
+ this.channel.onClose(() => {
3923
+ log('[CHANNEL]CLOSE');
3924
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3925
+ connected: false,
3926
+ ready: false,
3927
+ currentState: 'channel_closed'
3928
+ });
3929
+ });
3930
+ this.channel.onError(msg => {
3931
+ log('[CHANNEL][ERROR]', msg);
3932
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3933
+ connected: false,
3934
+ ready: false,
3935
+ currentState: 'channel_erred'
3936
+ });
3937
+ });
3938
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_listenTo).call(this, 'ack', 'ui', 'error', 'participant', 'message', 'service_data', 'system', 'info', 'sync');
3939
+ });
3940
+ }
3941
+ start() {
3942
+ this.channel.join().receive('ok', () => {
3943
+ log('[CHANNEL][JOIN] OK');
3944
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3945
+ connected: true,
3946
+ ready: false,
3947
+ currentState: 'join_channel_succeeded'
3948
+ });
3949
+ }).receive('error', err => {
3950
+ log('[CHANNEL][JOIN] ERROR', err);
3951
+ __classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
3952
+ connected: false,
3953
+ ready: false,
3954
+ currentState: 'join_channel_erred'
3955
+ });
3956
+ }).receive('timeout', () => {
3957
+ log('[CHANEL][JOIN] Networking issue. Still waiting...');
3958
+ });
3959
+ }
3960
+ disconnect() {
3961
+ var _a;
3962
+ (_a = this.channel) === null || _a === void 0 ? void 0 : _a.leave().receive('ok', () => {
3963
+ var _a;
3964
+ (_a = this.socket) === null || _a === void 0 ? void 0 : _a.disconnect();
3965
+ log('[CHANNEL][LEAVE] OK');
3966
+ __classPrivateFieldSet(this, _ConversationConnector_connectionListeners, [], "f");
3967
+ });
3968
+ }
3969
+ onConnection(cb) {
3970
+ __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").push(cb);
3971
+ }
3972
+ pushToChannel(command, payload, timeout = 10000) {
3973
+ this.channel.push(command, payload, timeout);
3974
+ }
3975
+ // Adds a callback function to the subscribers set and returns a method to unsubscribe from the store.
3976
+ // This method is used to sync the state with the lifecycle of Preact.
3977
+ static subscribe(callback) {
3978
+ subscribers.add(callback);
3979
+ // Returns a function that removes the callback from the subscribers set.
3980
+ return () => subscribers.delete(callback);
3981
+ }
3982
+ }
3983
+ _ConversationConnector_connectionListeners = new WeakMap(), _ConversationConnector_instances = new WeakSet(), _ConversationConnector_listenTo = function _ConversationConnector_listenTo(...types) {
3984
+ types.forEach(type => {
3985
+ this.channel.on(type, msg => {
3986
+ log('[RECEIVE]', type, msg);
3987
+ });
3988
+ });
3989
+ }, _ConversationConnector_emitConnectionState = function _ConversationConnector_emitConnectionState(payload) {
3990
+ __classPrivateFieldSet(this, _ConversationConnector_connectionListeners, __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").filter(item => {
3991
+ const complete = item(payload);
3992
+ // If we only want to execute the callback once, remove it from the listener
3993
+ return !complete;
3994
+ }), "f");
3995
+ emitChange();
3996
+ };
3997
+ /* harmony default export */ const conversation_connector = (ConversationConnector);
3998
+
3999
+ /***/ }),
4000
+
2645
4001
  /***/ 9787:
2646
4002
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2647
4003
 
4004
+ "use strict";
2648
4005
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2649
4006
  /* harmony export */ Xv: () => (/* binding */ screenReaderDebounceDelaySeconds),
2650
4007
  /* harmony export */ ib: () => (/* binding */ userParticipantId),
4008
+ /* harmony export */ tW: () => (/* binding */ apiVersion),
2651
4009
  /* harmony export */ u_: () => (/* binding */ defaultConfig)
2652
4010
  /* harmony export */ });
2653
- /* unused harmony exports CSS_NAME, apiVersion, unreadScreenReaderWait, newMessageScreenReaderWait, activitySendDelay, maxCharacterWarningLimit, maxCharacterSrDebounceDelay, defaultTransitionTimeMs, typingTimeout */
4011
+ /* unused harmony exports CSS_NAME, unreadScreenReaderWait, newMessageScreenReaderWait, activitySendDelay, maxCharacterWarningLimit, maxCharacterSrDebounceDelay, defaultTransitionTimeMs, typingTimeout */
2654
4012
  const CSS_NAME = 'cvco';
2655
4013
  const apiVersion = '3';
2656
4014
  const userParticipantId = 'seamly-client-participant';
@@ -2689,6 +4047,7 @@ const defaultConfig = {
2689
4047
  /***/ 526:
2690
4048
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2691
4049
 
4050
+ "use strict";
2692
4051
 
2693
4052
  // EXPORTS
2694
4053
  __webpack_require__.d(__webpack_exports__, {
@@ -2896,6 +4255,7 @@ const resetApp = create_debounced_async_thunk('resetApp', (_, {
2896
4255
  /***/ 4062:
2897
4256
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2898
4257
 
4258
+ "use strict";
2899
4259
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2900
4260
  /* harmony export */ t: () => (/* binding */ selectUserHasResponded)
2901
4261
  /* harmony export */ });
@@ -2912,6 +4272,7 @@ const selectUserHasResponded = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/
2912
4272
  /***/ 1322:
2913
4273
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2914
4274
 
4275
+ "use strict";
2915
4276
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2916
4277
  /* harmony export */ oT: () => (/* binding */ setHasResponded)
2917
4278
  /* harmony export */ });
@@ -2954,6 +4315,7 @@ const {
2954
4315
  /***/ 257:
2955
4316
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2956
4317
 
4318
+ "use strict";
2957
4319
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2958
4320
  /* harmony export */ I: () => (/* binding */ resetConfig),
2959
4321
  /* harmony export */ t: () => (/* binding */ initializeConfig)
@@ -3035,6 +4397,7 @@ const resetConfig = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .createAs
3035
4397
  /***/ 6134:
3036
4398
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3037
4399
 
4400
+ "use strict";
3038
4401
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3039
4402
  /* harmony export */ ZR: () => (/* binding */ useConfig)
3040
4403
  /* harmony export */ });
@@ -3066,6 +4429,7 @@ function useStartChatIcon() {
3066
4429
  /***/ 9052:
3067
4430
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3068
4431
 
4432
+ "use strict";
3069
4433
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3070
4434
  /* harmony export */ $: () => (/* binding */ selectConfig)
3071
4435
  /* harmony export */ });
@@ -3093,6 +4457,7 @@ const selectConfig = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_1__/* .createS
3093
4457
  /***/ 3701:
3094
4458
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3095
4459
 
4460
+ "use strict";
3096
4461
  /* unused harmony exports initialConfigState, configSlice, setConfig, updateConfig, setPreChatEvents */
3097
4462
  /* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9639);
3098
4463
  /* harmony import */ var config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9787);
@@ -3202,6 +4567,7 @@ const {
3202
4567
  /***/ 9792:
3203
4568
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3204
4569
 
4570
+ "use strict";
3205
4571
  /* unused harmony exports catchError, createErrorsMiddleware */
3206
4572
  /* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9639);
3207
4573
  /* harmony import */ var api_errors_seamly_configuration_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5863);
@@ -3287,6 +4653,7 @@ function createErrorsMiddleware({
3287
4653
  /***/ 3939:
3288
4654
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3289
4655
 
4656
+ "use strict";
3290
4657
  /* unused harmony exports formsSlice, registerForm, deregisterForm, registerControl, deregisterControl, updateControlValue, updateControlTouched */
3291
4658
  /* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9639);
3292
4659
  /* harmony import */ var domains_app_actions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(526);
@@ -3406,6 +4773,7 @@ const {
3406
4773
  /***/ 5409:
3407
4774
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3408
4775
 
4776
+ "use strict";
3409
4777
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3410
4778
  /* harmony export */ i: () => (/* binding */ setLocale)
3411
4779
  /* harmony export */ });
@@ -3476,6 +4844,7 @@ const setLocale = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .createAsyn
3476
4844
  /***/ 5962:
3477
4845
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3478
4846
 
4847
+ "use strict";
3479
4848
 
3480
4849
  // EXPORTS
3481
4850
  __webpack_require__.d(__webpack_exports__, {
@@ -4183,6 +5552,7 @@ function useI18n() {
4183
5552
  /***/ 3376:
4184
5553
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4185
5554
 
5555
+ "use strict";
4186
5556
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4187
5557
  /* harmony export */ SS: () => (/* binding */ selectInitialLocale),
4188
5558
  /* harmony export */ fN: () => (/* binding */ selectLocale),
@@ -4217,6 +5587,7 @@ const selectIsLoading = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .crea
4217
5587
  /***/ 5889:
4218
5588
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4219
5589
 
5590
+ "use strict";
4220
5591
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4221
5592
  /* harmony export */ i: () => (/* binding */ useInterrupt)
4222
5593
  /* harmony export */ });
@@ -4277,6 +5648,7 @@ function useInterrupt() {
4277
5648
  /***/ 542:
4278
5649
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4279
5650
 
5651
+ "use strict";
4280
5652
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4281
5653
  /* harmony export */ A: () => (/* binding */ selectHasError),
4282
5654
  /* harmony export */ z: () => (/* binding */ selectError)
@@ -4295,6 +5667,7 @@ const selectHasError = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .creat
4295
5667
  /***/ 6160:
4296
5668
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4297
5669
 
5670
+ "use strict";
4298
5671
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4299
5672
  /* harmony export */ uc: () => (/* binding */ setInterrupt)
4300
5673
  /* harmony export */ });
@@ -4342,6 +5715,7 @@ const {
4342
5715
  /***/ 2770:
4343
5716
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4344
5717
 
5718
+ "use strict";
4345
5719
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4346
5720
  /* harmony export */ c: () => (/* binding */ getConversation)
4347
5721
  /* harmony export */ });
@@ -4413,6 +5787,7 @@ const getConversation = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .crea
4413
5787
  /***/ 7271:
4414
5788
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4415
5789
 
5790
+ "use strict";
4416
5791
 
4417
5792
  // EXPORTS
4418
5793
  __webpack_require__.d(__webpack_exports__, {
@@ -4670,6 +6045,7 @@ const useAppDispatch = es/* useDispatch */.I0;
4670
6045
  /***/ 8801:
4671
6046
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4672
6047
 
6048
+ "use strict";
4673
6049
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4674
6050
  /* harmony export */ If: () => (/* binding */ hideOption),
4675
6051
  /* harmony export */ JB: () => (/* binding */ setHistory),
@@ -5319,6 +6695,7 @@ const {
5319
6695
  /***/ 4398:
5320
6696
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5321
6697
 
6698
+ "use strict";
5322
6699
 
5323
6700
  // EXPORTS
5324
6701
  __webpack_require__.d(__webpack_exports__, {
@@ -5511,6 +6888,7 @@ const useTranslationProposal = () => {
5511
6888
  /***/ 2659:
5512
6889
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5513
6890
 
6891
+ "use strict";
5514
6892
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5515
6893
  /* harmony export */ OU: () => (/* binding */ enableTranslation),
5516
6894
  /* harmony export */ i2: () => (/* binding */ disableTranslationProposalPrompt),
@@ -5657,6 +7035,7 @@ const {
5657
7035
  /***/ 9586:
5658
7036
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5659
7037
 
7038
+ "use strict";
5660
7039
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5661
7040
  /* harmony export */ Z: () => (/* binding */ initializeVisibility),
5662
7041
  /* harmony export */ i: () => (/* binding */ setVisibility)
@@ -5772,6 +7151,7 @@ const initializeVisibility = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_6__/*
5772
7151
  /***/ 1878:
5773
7152
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5774
7153
 
7154
+ "use strict";
5775
7155
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5776
7156
  /* harmony export */ K: () => (/* binding */ StoreKey),
5777
7157
  /* harmony export */ T: () => (/* binding */ visibilityStates)
@@ -5789,6 +7169,7 @@ const visibilityStates = {
5789
7169
  /***/ 6082:
5790
7170
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5791
7171
 
7172
+ "use strict";
5792
7173
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5793
7174
  /* harmony export */ iJ: () => (/* binding */ useVisibility)
5794
7175
  /* harmony export */ });
@@ -5896,6 +7277,7 @@ const useShowInlineView = () => {
5896
7277
  /***/ 703:
5897
7278
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5898
7279
 
7280
+ "use strict";
5899
7281
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5900
7282
  /* harmony export */ b: () => (/* binding */ selectShowInlineView),
5901
7283
  /* harmony export */ q: () => (/* binding */ selectVisibility)
@@ -5914,6 +7296,7 @@ const selectShowInlineView = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/*
5914
7296
  /***/ 3913:
5915
7297
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5916
7298
 
7299
+ "use strict";
5917
7300
  /* unused harmony exports visibilitySlice, setShowInlineView */
5918
7301
  /* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9639);
5919
7302
  /* harmony import */ var domains_config_actions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(257);
@@ -5962,6 +7345,7 @@ const {
5962
7345
  /***/ 2871:
5963
7346
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5964
7347
 
7348
+ "use strict";
5965
7349
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5966
7350
  /* harmony export */ T: () => (/* binding */ SeamlyEventBusContext),
5967
7351
  /* harmony export */ a: () => (/* binding */ SeamlyApiContext)
@@ -5977,6 +7361,7 @@ const SeamlyEventBusContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createConte
5977
7361
  /***/ 8048:
5978
7362
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5979
7363
 
7364
+ "use strict";
5980
7365
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5981
7366
  /* harmony export */ eu: () => (/* binding */ useSeamlyObjectStore),
5982
7367
  /* harmony export */ iW: () => (/* binding */ useSeamlyHasConversation),
@@ -6015,6 +7400,7 @@ const useSeamlyHasConversation = () => {
6015
7400
  /***/ 2140:
6016
7401
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6017
7402
 
7403
+ "use strict";
6018
7404
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6019
7405
  /* harmony export */ Pn: () => (/* binding */ useSeamlyServiceInfo),
6020
7406
  /* harmony export */ bz: () => (/* binding */ selectState),
@@ -6150,6 +7536,7 @@ const useSeamlyLayoutMode = () => {
6150
7536
  /***/ 497:
6151
7537
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6152
7538
 
7539
+ "use strict";
6153
7540
 
6154
7541
  // EXPORTS
6155
7542
  __webpack_require__.d(__webpack_exports__, {
@@ -6339,9 +7726,33 @@ const useSeamlyChat = () => {
6339
7726
 
6340
7727
  /***/ }),
6341
7728
 
7729
+ /***/ 1813:
7730
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7731
+
7732
+ "use strict";
7733
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7734
+ /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
7735
+ /* harmony export */ });
7736
+ /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6546);
7737
+ /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_0__);
7738
+ /* harmony import */ var api_conversation_connector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1541);
7739
+ /* harmony import */ var _seamly_api_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8048);
7740
+
7741
+
7742
+
7743
+ const useSeamlyConversation = () => {
7744
+ const api = (0,_seamly_api_hooks__WEBPACK_IMPORTED_MODULE_2__/* .useSeamlyApiContext */ .jM)();
7745
+ const getSnapshot = () => api.conversation;
7746
+ return (0,preact_compat__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalStore)(api_conversation_connector__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.subscribe, getSnapshot);
7747
+ };
7748
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useSeamlyConversation);
7749
+
7750
+ /***/ }),
7751
+
6342
7752
  /***/ 1149:
6343
7753
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6344
7754
 
7755
+ "use strict";
6345
7756
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6346
7757
  /* harmony export */ Hp: () => (/* binding */ actionTypes),
6347
7758
  /* harmony export */ RJ: () => (/* binding */ readStates),
@@ -6430,6 +7841,7 @@ const cardTypes = {
6430
7841
  /***/ 3866:
6431
7842
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6432
7843
 
7844
+ "use strict";
6433
7845
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6434
7846
  /* harmony export */ Z: () => (/* binding */ SeamlyBaseError)
6435
7847
  /* harmony export */ });
@@ -6470,6 +7882,7 @@ class SeamlyBaseError extends Error {
6470
7882
  /***/ 5863:
6471
7883
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6472
7884
 
7885
+ "use strict";
6473
7886
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6474
7887
  /* harmony export */ Z: () => (/* binding */ SeamlyConfigurationError)
6475
7888
  /* harmony export */ });
@@ -6488,6 +7901,7 @@ class SeamlyConfigurationError extends _seamly_base_error__WEBPACK_IMPORTED_MODU
6488
7901
  /***/ 5332:
6489
7902
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6490
7903
 
7904
+ "use strict";
6491
7905
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6492
7906
  /* harmony export */ Z: () => (/* binding */ SeamlyGeneralError)
6493
7907
  /* harmony export */ });
@@ -6507,6 +7921,7 @@ class SeamlyGeneralError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE_0__
6507
7921
  /***/ 3243:
6508
7922
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6509
7923
 
7924
+ "use strict";
6510
7925
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6511
7926
  /* harmony export */ Z: () => (/* binding */ SeamlyOfflineError)
6512
7927
  /* harmony export */ });
@@ -6525,6 +7940,7 @@ class SeamlyOfflineError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE_0__
6525
7940
  /***/ 6821:
6526
7941
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6527
7942
 
7943
+ "use strict";
6528
7944
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6529
7945
  /* harmony export */ Z: () => (/* binding */ SeamlySessionExpiredError)
6530
7946
  /* harmony export */ });
@@ -6543,6 +7959,7 @@ class SeamlySessionExpiredError extends _seamly_base_error__WEBPACK_IMPORTED_MOD
6543
7959
  /***/ 2332:
6544
7960
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6545
7961
 
7962
+ "use strict";
6546
7963
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6547
7964
  /* harmony export */ Z: () => (/* binding */ SeamlyUnauthorizedError)
6548
7965
  /* harmony export */ });
@@ -6562,6 +7979,7 @@ class SeamlyUnauthorizedError extends _seamly_base_error__WEBPACK_IMPORTED_MODUL
6562
7979
  /***/ 7265:
6563
7980
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6564
7981
 
7982
+ "use strict";
6565
7983
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6566
7984
  /* harmony export */ Z: () => (/* binding */ SeamlyUnavailableError)
6567
7985
  /* harmony export */ });
@@ -6586,6 +8004,7 @@ class SeamlyUnavailableError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE
6586
8004
  /***/ 3423:
6587
8005
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6588
8006
 
8007
+ "use strict";
6589
8008
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6590
8009
  /* harmony export */ h: () => (/* binding */ useUserHasResponded)
6591
8010
  /* harmony export */ });
@@ -6600,6 +8019,7 @@ const useUserHasResponded = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_0__/*
6600
8019
  /***/ 6989:
6601
8020
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6602
8021
 
8022
+ "use strict";
6603
8023
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6604
8024
  /* harmony export */ F: () => (/* binding */ calculateVisibility)
6605
8025
  /* harmony export */ });
@@ -6644,6 +8064,7 @@ const calculateVisibility = ({
6644
8064
  /***/ 2:
6645
8065
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6646
8066
 
8067
+ "use strict";
6647
8068
  /* unused harmony export className */
6648
8069
  /* harmony import */ var config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9787);
6649
8070
 
@@ -6670,9 +8091,20 @@ const className = (...classes) => classes.flat().map(c => {
6670
8091
 
6671
8092
  /***/ }),
6672
8093
 
8094
+ /***/ 7008:
8095
+ /***/ ((module) => {
8096
+
8097
+ if (false) {} else {
8098
+ // eslint-disable-next-line react/display-name
8099
+ module.exports = () => () => null;
8100
+ }
8101
+
8102
+ /***/ }),
8103
+
6673
8104
  /***/ 8527:
6674
8105
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6675
8106
 
8107
+ "use strict";
6676
8108
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6677
8109
  /* harmony export */ k: () => (/* binding */ randomId)
6678
8110
  /* harmony export */ });
@@ -6682,9 +8114,42 @@ function randomId() {
6682
8114
 
6683
8115
  /***/ }),
6684
8116
 
8117
+ /***/ 4864:
8118
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8119
+
8120
+ "use strict";
8121
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8122
+ /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
8123
+ /* harmony export */ });
8124
+ const splitUrlParams = url => {
8125
+ const searchIndex = url.indexOf('?');
8126
+ if (searchIndex < 0) {
8127
+ return {
8128
+ url,
8129
+ params: {}
8130
+ };
8131
+ }
8132
+ const urlBase = url.slice(0, searchIndex);
8133
+ const params = url.slice(searchIndex + 1).split('&').reduce(function (acc, hash) {
8134
+ const [key, val] = hash.split('=');
8135
+ return {
8136
+ ...acc,
8137
+ [key]: decodeURIComponent(val)
8138
+ };
8139
+ }, {});
8140
+ return {
8141
+ url: urlBase,
8142
+ params
8143
+ };
8144
+ };
8145
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (splitUrlParams);
8146
+
8147
+ /***/ }),
8148
+
6685
8149
  /***/ 9404:
6686
8150
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6687
8151
 
8152
+ "use strict";
6688
8153
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6689
8154
  /* harmony export */ F: () => (/* binding */ useChoicePrompt)
6690
8155
  /* harmony export */ });
@@ -6850,6 +8315,7 @@ const ChoicePrompt = ({
6850
8315
  /***/ 149:
6851
8316
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
6852
8317
 
8318
+ "use strict";
6853
8319
  /* harmony import */ var ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9470);
6854
8320
  /* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6134);
6855
8321
  /* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5962);
@@ -6912,6 +8378,7 @@ const EventParticipant = ({
6912
8378
  /***/ 2480:
6913
8379
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
6914
8380
 
8381
+ "use strict";
6915
8382
  /* harmony import */ var ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7054);
6916
8383
  /* harmony import */ var domains_translations_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4398);
6917
8384
  /* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
@@ -6991,6 +8458,7 @@ function MessageContainer({
6991
8458
  /***/ 7057:
6992
8459
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
6993
8460
 
8461
+ "use strict";
6994
8462
  /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7210);
6995
8463
  /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact__WEBPACK_IMPORTED_MODULE_0__);
6996
8464
 
@@ -7002,6 +8470,7 @@ const SeamlyActivityEventContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.create
7002
8470
  /***/ 1884:
7003
8471
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
7004
8472
 
8473
+ "use strict";
7005
8474
  /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7210);
7006
8475
  /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact__WEBPACK_IMPORTED_MODULE_0__);
7007
8476
 
@@ -7013,6 +8482,7 @@ const SeamlyFileUploadContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createCon
7013
8482
  /***/ 9761:
7014
8483
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7015
8484
 
8485
+ "use strict";
7016
8486
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7017
8487
  /* harmony export */ _: () => (/* binding */ SeamlyLiveRegionContext)
7018
8488
  /* harmony export */ });
@@ -7026,6 +8496,7 @@ const SeamlyLiveRegionContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createCon
7026
8496
  /***/ 7054:
7027
8497
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7028
8498
 
8499
+ "use strict";
7029
8500
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7030
8501
  /* harmony export */ j: () => (/* binding */ useSeamlyMessageContainerClassNames)
7031
8502
  /* harmony export */ });
@@ -7055,6 +8526,7 @@ const useSeamlyMessageContainerClassNames = event => {
7055
8526
  /***/ 764:
7056
8527
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7057
8528
 
8529
+ "use strict";
7058
8530
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7059
8531
  /* harmony export */ aJ: () => (/* binding */ useElementFocusingById)
7060
8532
  /* harmony export */ });
@@ -7114,6 +8586,7 @@ const useFocusIfSeamlyContainedFocus = () => {
7114
8586
  /***/ 5136:
7115
8587
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7116
8588
 
8589
+ "use strict";
7117
8590
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7118
8591
  /* harmony export */ t: () => (/* binding */ useLiveRegion)
7119
8592
  /* harmony export */ });
@@ -7153,6 +8626,7 @@ const useLiveRegion = () => {
7153
8626
  /***/ 9470:
7154
8627
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7155
8628
 
8629
+ "use strict";
7156
8630
 
7157
8631
  // EXPORTS
7158
8632
  __webpack_require__.d(__webpack_exports__, {
@@ -7170,8 +8644,8 @@ __webpack_require__.d(__webpack_exports__, {
7170
8644
 
7171
8645
  // EXTERNAL MODULE: external "preact/hooks"
7172
8646
  var hooks_ = __webpack_require__(9207);
7173
- // EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.ts
7174
- var seamly_api_hooks = __webpack_require__(8048);
8647
+ // EXTERNAL MODULE: ./src/javascripts/ui/hooks/use-seamly-conversation.ts
8648
+ var use_seamly_conversation = __webpack_require__(1813);
7175
8649
  // EXTERNAL MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
7176
8650
  var focus_helper_hooks = __webpack_require__(764);
7177
8651
  // EXTERNAL MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
@@ -7257,6 +8731,8 @@ const useFileUploads = () => {
7257
8731
  };
7258
8732
  // EXTERNAL MODULE: ./src/javascripts/ui/hooks/live-region-hooks.js
7259
8733
  var live_region_hooks = __webpack_require__(5136);
8734
+ // EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.ts
8735
+ var seamly_api_hooks = __webpack_require__(8048);
7260
8736
  // EXTERNAL MODULE: ./src/javascripts/domains/i18n/hooks.ts + 11 modules
7261
8737
  var hooks = __webpack_require__(5962);
7262
8738
  ;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
@@ -7392,12 +8868,12 @@ var utility_hooks = __webpack_require__(7750);
7392
8868
  // and imported directly from this file
7393
8869
  // Please do not remove
7394
8870
  const useSeamlyEventStream = (nextFn, filterFn) => {
7395
- const api = (0,seamly_api_hooks/* useSeamlyApiContext */.jM)();
8871
+ const conversation = (0,use_seamly_conversation/* default */.Z)();
7396
8872
  (0,hooks_.useEffect)(() => {
7397
- if (api.connectionInfo && api.conversation?.channel) {
8873
+ if (conversation.channel) {
7398
8874
  const {
7399
8875
  channel
7400
- } = api.conversation;
8876
+ } = conversation;
7401
8877
  channel.onMessage = (type, payload) => {
7402
8878
  if (!filterFn || filterFn({
7403
8879
  type,
@@ -7411,7 +8887,7 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
7411
8887
  return payload;
7412
8888
  };
7413
8889
  }
7414
- }, [nextFn, filterFn, api.connectionInfo, api.conversation]);
8890
+ }, [nextFn, filterFn, conversation]);
7415
8891
  };
7416
8892
 
7417
8893
  /***/ }),
@@ -7419,6 +8895,7 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
7419
8895
  /***/ 2477:
7420
8896
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
7421
8897
 
8898
+ "use strict";
7422
8899
  /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9207);
7423
8900
  /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact_hooks__WEBPACK_IMPORTED_MODULE_0__);
7424
8901
  /* harmony import */ var ui_components_core_seamly_activity_event_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7057);
@@ -7432,6 +8909,7 @@ const useSeamlyActivityEventHandler = () => useContext(SeamlyActivityEventContex
7432
8909
  /***/ 1181:
7433
8910
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7434
8911
 
8912
+ "use strict";
7435
8913
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7436
8914
  /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
7437
8915
  /* harmony export */ });
@@ -7647,6 +9125,7 @@ const useSeamlyCommands = () => {
7647
9125
  /***/ 6532:
7648
9126
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7649
9127
 
9128
+ "use strict";
7650
9129
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7651
9130
  /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
7652
9131
  /* harmony export */ });
@@ -7789,6 +9268,7 @@ const useSeamlyIdleDetachCountdown = () => {
7789
9268
  /***/ 960:
7790
9269
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
7791
9270
 
9271
+ "use strict";
7792
9272
  /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3556);
7793
9273
  /* harmony import */ var ui_utils_seamly_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1149);
7794
9274
  /* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5962);
@@ -7844,6 +9324,7 @@ const useSeamlyResumeConversationPrompt = () => {
7844
9324
  /***/ 7750:
7845
9325
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7846
9326
 
9327
+ "use strict";
7847
9328
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7848
9329
  /* harmony export */ I8: () => (/* binding */ useGeneratedId)
7849
9330
  /* harmony export */ });
@@ -7882,6 +9363,7 @@ const useStableCallback = callback => {
7882
9363
  /***/ 822:
7883
9364
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7884
9365
 
9366
+ "use strict";
7885
9367
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7886
9368
  /* harmony export */ C5: () => (/* binding */ focusElement),
7887
9369
  /* harmony export */ I6: () => (/* binding */ microsecondsToMilliseconds),
@@ -8043,6 +9525,7 @@ const omit = (obj, keys) => Object.keys(obj).reduce((accum, key) => {
8043
9525
  /***/ 8679:
8044
9526
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
8045
9527
 
9528
+ "use strict";
8046
9529
 
8047
9530
 
8048
9531
  var reactIs = __webpack_require__(9864);
@@ -8153,6 +9636,7 @@ module.exports = hoistNonReactStatics;
8153
9636
  /***/ 8661:
8154
9637
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8155
9638
 
9639
+ "use strict";
8156
9640
  __webpack_require__.r(__webpack_exports__);
8157
9641
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8158
9642
  /* harmony export */ Children: () => (/* binding */ O),
@@ -8203,6 +9687,7 @@ function g(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n
8203
9687
  /***/ 9921:
8204
9688
  /***/ ((__unused_webpack_module, exports) => {
8205
9689
 
9690
+ "use strict";
8206
9691
  /** @license React v16.13.1
8207
9692
  * react-is.production.min.js
8208
9693
  *
@@ -8225,6 +9710,7 @@ exports.isValidElementType=function(a){return"string"===typeof a||"function"===t
8225
9710
  /***/ 9864:
8226
9711
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
8227
9712
 
9713
+ "use strict";
8228
9714
 
8229
9715
 
8230
9716
  if (true) {
@@ -8237,6 +9723,7 @@ if (true) {
8237
9723
  /***/ 3556:
8238
9724
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8239
9725
 
9726
+ "use strict";
8240
9727
 
8241
9728
  // EXPORTS
8242
9729
  __webpack_require__.d(__webpack_exports__, {
@@ -9116,6 +10603,7 @@ initializeConnect(shim.useSyncExternalStore); // Enable batched updates in our s
9116
10603
  /***/ 9256:
9117
10604
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9118
10605
 
10606
+ "use strict";
9119
10607
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9120
10608
  /* harmony export */ F: () => (/* binding */ setBatch)
9121
10609
  /* harmony export */ });
@@ -9136,6 +10624,7 @@ const getBatch = () => batch;
9136
10624
  /***/ 8359:
9137
10625
  /***/ ((__unused_webpack_module, exports) => {
9138
10626
 
10627
+ "use strict";
9139
10628
  var __webpack_unused_export__;
9140
10629
  /**
9141
10630
  * @license React
@@ -9158,6 +10647,7 @@ __webpack_unused_export__=function(a){return"string"===typeof a||"function"===ty
9158
10647
  /***/ 2973:
9159
10648
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9160
10649
 
10650
+ "use strict";
9161
10651
 
9162
10652
 
9163
10653
  if (true) {
@@ -9170,6 +10660,7 @@ if (true) {
9170
10660
  /***/ 573:
9171
10661
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9172
10662
 
10663
+ "use strict";
9173
10664
 
9174
10665
  // EXPORTS
9175
10666
  __webpack_require__.d(__webpack_exports__, {
@@ -9463,6 +10954,7 @@ var createStructuredSelector = function createStructuredSelector(selectors, sele
9463
10954
  /***/ 2398:
9464
10955
  /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
9465
10956
 
10957
+ "use strict";
9466
10958
 
9467
10959
  // UNUSED EXPORTS: ICONS, default
9468
10960
 
@@ -9610,6 +11102,7 @@ const Icon = ({ name, size = '32', className, alt }) => (_jsxs(_Fragment, { chil
9610
11102
  /***/ 3250:
9611
11103
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9612
11104
 
11105
+ "use strict";
9613
11106
  /**
9614
11107
  * @license React
9615
11108
  * use-sync-external-store-shim.production.min.js
@@ -9628,6 +11121,7 @@ function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f)
9628
11121
  /***/ 139:
9629
11122
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9630
11123
 
11124
+ "use strict";
9631
11125
  /**
9632
11126
  * @license React
9633
11127
  * use-sync-external-store-shim/with-selector.production.min.js
@@ -9647,6 +11141,7 @@ u(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};
9647
11141
  /***/ 1688:
9648
11142
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9649
11143
 
11144
+ "use strict";
9650
11145
 
9651
11146
 
9652
11147
  if (true) {
@@ -9659,6 +11154,7 @@ if (true) {
9659
11154
  /***/ 2798:
9660
11155
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
9661
11156
 
11157
+ "use strict";
9662
11158
 
9663
11159
 
9664
11160
  if (true) {
@@ -9671,13 +11167,23 @@ if (true) {
9671
11167
  /***/ 7210:
9672
11168
  /***/ ((module) => {
9673
11169
 
11170
+ "use strict";
9674
11171
  module.exports = require("preact");
9675
11172
 
9676
11173
  /***/ }),
9677
11174
 
11175
+ /***/ 6546:
11176
+ /***/ ((module) => {
11177
+
11178
+ "use strict";
11179
+ module.exports = require("preact/compat");
11180
+
11181
+ /***/ }),
11182
+
9678
11183
  /***/ 9207:
9679
11184
  /***/ ((module) => {
9680
11185
 
11186
+ "use strict";
9681
11187
  module.exports = require("preact/hooks");
9682
11188
 
9683
11189
  /***/ }),
@@ -9685,6 +11191,7 @@ module.exports = require("preact/hooks");
9685
11191
  /***/ 7844:
9686
11192
  /***/ ((module) => {
9687
11193
 
11194
+ "use strict";
9688
11195
  module.exports = require("preact/jsx-runtime");
9689
11196
 
9690
11197
  /***/ }),
@@ -9692,6 +11199,7 @@ module.exports = require("preact/jsx-runtime");
9692
11199
  /***/ 4942:
9693
11200
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
9694
11201
 
11202
+ "use strict";
9695
11203
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9696
11204
  /* harmony export */ Z: () => (/* binding */ _defineProperty)
9697
11205
  /* harmony export */ });
@@ -9717,6 +11225,7 @@ function _defineProperty(obj, key, value) {
9717
11225
  /***/ 2881:
9718
11226
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
9719
11227
 
11228
+ "use strict";
9720
11229
 
9721
11230
  // EXPORTS
9722
11231
  __webpack_require__.d(__webpack_exports__, {
@@ -9836,8 +11345,9 @@ function _toPropertyKey(arg) {
9836
11345
  /******/
9837
11346
  /************************************************************************/
9838
11347
  var __webpack_exports__ = {};
9839
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
11348
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
9840
11349
  (() => {
11350
+ "use strict";
9841
11351
  __webpack_require__.r(__webpack_exports__);
9842
11352
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9843
11353
  /* harmony export */ useChoicePrompt: () => (/* reexport safe */ ui_components_conversation_event_choice_prompt__WEBPACK_IMPORTED_MODULE_0__.F),