@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.
- package/build/dist/lib/components.js +1484 -14
- package/build/dist/lib/components.js.map +1 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/components.min.js.map +1 -1
- package/build/dist/lib/hooks.js +1519 -9
- package/build/dist/lib/hooks.js.map +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/hooks.min.js.map +1 -1
- package/build/dist/lib/index.debug.js +15 -4
- package/build/dist/lib/index.debug.js.map +1 -1
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -0
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +258 -244
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/standalone.js +536 -245
- package/build/dist/lib/standalone.js.map +1 -1
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +265 -251
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/utils.js +8497 -8427
- package/build/dist/lib/utils.js.map +1 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/lib/utils.min.js.map +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/conversation-connector.ts +48 -32
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +197 -218
- package/src/javascripts/ui/hooks/seamly-hooks.js +5 -5
- 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,9 +2642,1361 @@ F();
|
|
|
2642
2642
|
|
|
2643
2643
|
/***/ }),
|
|
2644
2644
|
|
|
2645
|
+
/***/ 1541:
|
|
2646
|
+
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
|
2647
|
+
|
|
2648
|
+
"use strict";
|
|
2649
|
+
|
|
2650
|
+
// UNUSED EXPORTS: default
|
|
2651
|
+
|
|
2652
|
+
;// CONCATENATED MODULE: ./node_modules/phoenix/priv/static/phoenix.mjs
|
|
2653
|
+
// js/phoenix/utils.js
|
|
2654
|
+
var closure = (value) => {
|
|
2655
|
+
if (typeof value === "function") {
|
|
2656
|
+
return value;
|
|
2657
|
+
} else {
|
|
2658
|
+
let closure2 = function() {
|
|
2659
|
+
return value;
|
|
2660
|
+
};
|
|
2661
|
+
return closure2;
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
|
|
2665
|
+
// js/phoenix/constants.js
|
|
2666
|
+
var globalSelf = typeof self !== "undefined" ? self : null;
|
|
2667
|
+
var phxWindow = typeof window !== "undefined" ? window : null;
|
|
2668
|
+
var global = (/* unused pure expression or super */ null && (globalSelf || phxWindow || global));
|
|
2669
|
+
var DEFAULT_VSN = "2.0.0";
|
|
2670
|
+
var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
|
|
2671
|
+
var DEFAULT_TIMEOUT = 1e4;
|
|
2672
|
+
var WS_CLOSE_NORMAL = 1e3;
|
|
2673
|
+
var CHANNEL_STATES = {
|
|
2674
|
+
closed: "closed",
|
|
2675
|
+
errored: "errored",
|
|
2676
|
+
joined: "joined",
|
|
2677
|
+
joining: "joining",
|
|
2678
|
+
leaving: "leaving"
|
|
2679
|
+
};
|
|
2680
|
+
var CHANNEL_EVENTS = {
|
|
2681
|
+
close: "phx_close",
|
|
2682
|
+
error: "phx_error",
|
|
2683
|
+
join: "phx_join",
|
|
2684
|
+
reply: "phx_reply",
|
|
2685
|
+
leave: "phx_leave"
|
|
2686
|
+
};
|
|
2687
|
+
var TRANSPORTS = {
|
|
2688
|
+
longpoll: "longpoll",
|
|
2689
|
+
websocket: "websocket"
|
|
2690
|
+
};
|
|
2691
|
+
var XHR_STATES = {
|
|
2692
|
+
complete: 4
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2695
|
+
// js/phoenix/push.js
|
|
2696
|
+
var Push = class {
|
|
2697
|
+
constructor(channel, event, payload, timeout) {
|
|
2698
|
+
this.channel = channel;
|
|
2699
|
+
this.event = event;
|
|
2700
|
+
this.payload = payload || function() {
|
|
2701
|
+
return {};
|
|
2702
|
+
};
|
|
2703
|
+
this.receivedResp = null;
|
|
2704
|
+
this.timeout = timeout;
|
|
2705
|
+
this.timeoutTimer = null;
|
|
2706
|
+
this.recHooks = [];
|
|
2707
|
+
this.sent = false;
|
|
2708
|
+
}
|
|
2709
|
+
resend(timeout) {
|
|
2710
|
+
this.timeout = timeout;
|
|
2711
|
+
this.reset();
|
|
2712
|
+
this.send();
|
|
2713
|
+
}
|
|
2714
|
+
send() {
|
|
2715
|
+
if (this.hasReceived("timeout")) {
|
|
2716
|
+
return;
|
|
2717
|
+
}
|
|
2718
|
+
this.startTimeout();
|
|
2719
|
+
this.sent = true;
|
|
2720
|
+
this.channel.socket.push({
|
|
2721
|
+
topic: this.channel.topic,
|
|
2722
|
+
event: this.event,
|
|
2723
|
+
payload: this.payload(),
|
|
2724
|
+
ref: this.ref,
|
|
2725
|
+
join_ref: this.channel.joinRef()
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
receive(status, callback) {
|
|
2729
|
+
if (this.hasReceived(status)) {
|
|
2730
|
+
callback(this.receivedResp.response);
|
|
2731
|
+
}
|
|
2732
|
+
this.recHooks.push({ status, callback });
|
|
2733
|
+
return this;
|
|
2734
|
+
}
|
|
2735
|
+
reset() {
|
|
2736
|
+
this.cancelRefEvent();
|
|
2737
|
+
this.ref = null;
|
|
2738
|
+
this.refEvent = null;
|
|
2739
|
+
this.receivedResp = null;
|
|
2740
|
+
this.sent = false;
|
|
2741
|
+
}
|
|
2742
|
+
matchReceive({ status, response, _ref }) {
|
|
2743
|
+
this.recHooks.filter((h) => h.status === status).forEach((h) => h.callback(response));
|
|
2744
|
+
}
|
|
2745
|
+
cancelRefEvent() {
|
|
2746
|
+
if (!this.refEvent) {
|
|
2747
|
+
return;
|
|
2748
|
+
}
|
|
2749
|
+
this.channel.off(this.refEvent);
|
|
2750
|
+
}
|
|
2751
|
+
cancelTimeout() {
|
|
2752
|
+
clearTimeout(this.timeoutTimer);
|
|
2753
|
+
this.timeoutTimer = null;
|
|
2754
|
+
}
|
|
2755
|
+
startTimeout() {
|
|
2756
|
+
if (this.timeoutTimer) {
|
|
2757
|
+
this.cancelTimeout();
|
|
2758
|
+
}
|
|
2759
|
+
this.ref = this.channel.socket.makeRef();
|
|
2760
|
+
this.refEvent = this.channel.replyEventName(this.ref);
|
|
2761
|
+
this.channel.on(this.refEvent, (payload) => {
|
|
2762
|
+
this.cancelRefEvent();
|
|
2763
|
+
this.cancelTimeout();
|
|
2764
|
+
this.receivedResp = payload;
|
|
2765
|
+
this.matchReceive(payload);
|
|
2766
|
+
});
|
|
2767
|
+
this.timeoutTimer = setTimeout(() => {
|
|
2768
|
+
this.trigger("timeout", {});
|
|
2769
|
+
}, this.timeout);
|
|
2770
|
+
}
|
|
2771
|
+
hasReceived(status) {
|
|
2772
|
+
return this.receivedResp && this.receivedResp.status === status;
|
|
2773
|
+
}
|
|
2774
|
+
trigger(status, response) {
|
|
2775
|
+
this.channel.trigger(this.refEvent, { status, response });
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2778
|
+
|
|
2779
|
+
// js/phoenix/timer.js
|
|
2780
|
+
var Timer = class {
|
|
2781
|
+
constructor(callback, timerCalc) {
|
|
2782
|
+
this.callback = callback;
|
|
2783
|
+
this.timerCalc = timerCalc;
|
|
2784
|
+
this.timer = null;
|
|
2785
|
+
this.tries = 0;
|
|
2786
|
+
}
|
|
2787
|
+
reset() {
|
|
2788
|
+
this.tries = 0;
|
|
2789
|
+
clearTimeout(this.timer);
|
|
2790
|
+
}
|
|
2791
|
+
scheduleTimeout() {
|
|
2792
|
+
clearTimeout(this.timer);
|
|
2793
|
+
this.timer = setTimeout(() => {
|
|
2794
|
+
this.tries = this.tries + 1;
|
|
2795
|
+
this.callback();
|
|
2796
|
+
}, this.timerCalc(this.tries + 1));
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
|
|
2800
|
+
// js/phoenix/channel.js
|
|
2801
|
+
var Channel = class {
|
|
2802
|
+
constructor(topic, params, socket) {
|
|
2803
|
+
this.state = CHANNEL_STATES.closed;
|
|
2804
|
+
this.topic = topic;
|
|
2805
|
+
this.params = closure(params || {});
|
|
2806
|
+
this.socket = socket;
|
|
2807
|
+
this.bindings = [];
|
|
2808
|
+
this.bindingRef = 0;
|
|
2809
|
+
this.timeout = this.socket.timeout;
|
|
2810
|
+
this.joinedOnce = false;
|
|
2811
|
+
this.joinPush = new Push(this, CHANNEL_EVENTS.join, this.params, this.timeout);
|
|
2812
|
+
this.pushBuffer = [];
|
|
2813
|
+
this.stateChangeRefs = [];
|
|
2814
|
+
this.rejoinTimer = new Timer(() => {
|
|
2815
|
+
if (this.socket.isConnected()) {
|
|
2816
|
+
this.rejoin();
|
|
2817
|
+
}
|
|
2818
|
+
}, this.socket.rejoinAfterMs);
|
|
2819
|
+
this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset()));
|
|
2820
|
+
this.stateChangeRefs.push(this.socket.onOpen(() => {
|
|
2821
|
+
this.rejoinTimer.reset();
|
|
2822
|
+
if (this.isErrored()) {
|
|
2823
|
+
this.rejoin();
|
|
2824
|
+
}
|
|
2825
|
+
}));
|
|
2826
|
+
this.joinPush.receive("ok", () => {
|
|
2827
|
+
this.state = CHANNEL_STATES.joined;
|
|
2828
|
+
this.rejoinTimer.reset();
|
|
2829
|
+
this.pushBuffer.forEach((pushEvent) => pushEvent.send());
|
|
2830
|
+
this.pushBuffer = [];
|
|
2831
|
+
});
|
|
2832
|
+
this.joinPush.receive("error", () => {
|
|
2833
|
+
this.state = CHANNEL_STATES.errored;
|
|
2834
|
+
if (this.socket.isConnected()) {
|
|
2835
|
+
this.rejoinTimer.scheduleTimeout();
|
|
2836
|
+
}
|
|
2837
|
+
});
|
|
2838
|
+
this.onClose(() => {
|
|
2839
|
+
this.rejoinTimer.reset();
|
|
2840
|
+
if (this.socket.hasLogger())
|
|
2841
|
+
this.socket.log("channel", `close ${this.topic} ${this.joinRef()}`);
|
|
2842
|
+
this.state = CHANNEL_STATES.closed;
|
|
2843
|
+
this.socket.remove(this);
|
|
2844
|
+
});
|
|
2845
|
+
this.onError((reason) => {
|
|
2846
|
+
if (this.socket.hasLogger())
|
|
2847
|
+
this.socket.log("channel", `error ${this.topic}`, reason);
|
|
2848
|
+
if (this.isJoining()) {
|
|
2849
|
+
this.joinPush.reset();
|
|
2850
|
+
}
|
|
2851
|
+
this.state = CHANNEL_STATES.errored;
|
|
2852
|
+
if (this.socket.isConnected()) {
|
|
2853
|
+
this.rejoinTimer.scheduleTimeout();
|
|
2854
|
+
}
|
|
2855
|
+
});
|
|
2856
|
+
this.joinPush.receive("timeout", () => {
|
|
2857
|
+
if (this.socket.hasLogger())
|
|
2858
|
+
this.socket.log("channel", `timeout ${this.topic} (${this.joinRef()})`, this.joinPush.timeout);
|
|
2859
|
+
let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), this.timeout);
|
|
2860
|
+
leavePush.send();
|
|
2861
|
+
this.state = CHANNEL_STATES.errored;
|
|
2862
|
+
this.joinPush.reset();
|
|
2863
|
+
if (this.socket.isConnected()) {
|
|
2864
|
+
this.rejoinTimer.scheduleTimeout();
|
|
2865
|
+
}
|
|
2866
|
+
});
|
|
2867
|
+
this.on(CHANNEL_EVENTS.reply, (payload, ref) => {
|
|
2868
|
+
this.trigger(this.replyEventName(ref), payload);
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
join(timeout = this.timeout) {
|
|
2872
|
+
if (this.joinedOnce) {
|
|
2873
|
+
throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");
|
|
2874
|
+
} else {
|
|
2875
|
+
this.timeout = timeout;
|
|
2876
|
+
this.joinedOnce = true;
|
|
2877
|
+
this.rejoin();
|
|
2878
|
+
return this.joinPush;
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
onClose(callback) {
|
|
2882
|
+
this.on(CHANNEL_EVENTS.close, callback);
|
|
2883
|
+
}
|
|
2884
|
+
onError(callback) {
|
|
2885
|
+
return this.on(CHANNEL_EVENTS.error, (reason) => callback(reason));
|
|
2886
|
+
}
|
|
2887
|
+
on(event, callback) {
|
|
2888
|
+
let ref = this.bindingRef++;
|
|
2889
|
+
this.bindings.push({ event, ref, callback });
|
|
2890
|
+
return ref;
|
|
2891
|
+
}
|
|
2892
|
+
off(event, ref) {
|
|
2893
|
+
this.bindings = this.bindings.filter((bind) => {
|
|
2894
|
+
return !(bind.event === event && (typeof ref === "undefined" || ref === bind.ref));
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
canPush() {
|
|
2898
|
+
return this.socket.isConnected() && this.isJoined();
|
|
2899
|
+
}
|
|
2900
|
+
push(event, payload, timeout = this.timeout) {
|
|
2901
|
+
payload = payload || {};
|
|
2902
|
+
if (!this.joinedOnce) {
|
|
2903
|
+
throw new Error(`tried to push '${event}' to '${this.topic}' before joining. Use channel.join() before pushing events`);
|
|
2904
|
+
}
|
|
2905
|
+
let pushEvent = new Push(this, event, function() {
|
|
2906
|
+
return payload;
|
|
2907
|
+
}, timeout);
|
|
2908
|
+
if (this.canPush()) {
|
|
2909
|
+
pushEvent.send();
|
|
2910
|
+
} else {
|
|
2911
|
+
pushEvent.startTimeout();
|
|
2912
|
+
this.pushBuffer.push(pushEvent);
|
|
2913
|
+
}
|
|
2914
|
+
return pushEvent;
|
|
2915
|
+
}
|
|
2916
|
+
leave(timeout = this.timeout) {
|
|
2917
|
+
this.rejoinTimer.reset();
|
|
2918
|
+
this.joinPush.cancelTimeout();
|
|
2919
|
+
this.state = CHANNEL_STATES.leaving;
|
|
2920
|
+
let onClose = () => {
|
|
2921
|
+
if (this.socket.hasLogger())
|
|
2922
|
+
this.socket.log("channel", `leave ${this.topic}`);
|
|
2923
|
+
this.trigger(CHANNEL_EVENTS.close, "leave");
|
|
2924
|
+
};
|
|
2925
|
+
let leavePush = new Push(this, CHANNEL_EVENTS.leave, closure({}), timeout);
|
|
2926
|
+
leavePush.receive("ok", () => onClose()).receive("timeout", () => onClose());
|
|
2927
|
+
leavePush.send();
|
|
2928
|
+
if (!this.canPush()) {
|
|
2929
|
+
leavePush.trigger("ok", {});
|
|
2930
|
+
}
|
|
2931
|
+
return leavePush;
|
|
2932
|
+
}
|
|
2933
|
+
onMessage(_event, payload, _ref) {
|
|
2934
|
+
return payload;
|
|
2935
|
+
}
|
|
2936
|
+
isMember(topic, event, payload, joinRef) {
|
|
2937
|
+
if (this.topic !== topic) {
|
|
2938
|
+
return false;
|
|
2939
|
+
}
|
|
2940
|
+
if (joinRef && joinRef !== this.joinRef()) {
|
|
2941
|
+
if (this.socket.hasLogger())
|
|
2942
|
+
this.socket.log("channel", "dropping outdated message", { topic, event, payload, joinRef });
|
|
2943
|
+
return false;
|
|
2944
|
+
} else {
|
|
2945
|
+
return true;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
joinRef() {
|
|
2949
|
+
return this.joinPush.ref;
|
|
2950
|
+
}
|
|
2951
|
+
rejoin(timeout = this.timeout) {
|
|
2952
|
+
if (this.isLeaving()) {
|
|
2953
|
+
return;
|
|
2954
|
+
}
|
|
2955
|
+
this.socket.leaveOpenTopic(this.topic);
|
|
2956
|
+
this.state = CHANNEL_STATES.joining;
|
|
2957
|
+
this.joinPush.resend(timeout);
|
|
2958
|
+
}
|
|
2959
|
+
trigger(event, payload, ref, joinRef) {
|
|
2960
|
+
let handledPayload = this.onMessage(event, payload, ref, joinRef);
|
|
2961
|
+
if (payload && !handledPayload) {
|
|
2962
|
+
throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");
|
|
2963
|
+
}
|
|
2964
|
+
let eventBindings = this.bindings.filter((bind) => bind.event === event);
|
|
2965
|
+
for (let i = 0; i < eventBindings.length; i++) {
|
|
2966
|
+
let bind = eventBindings[i];
|
|
2967
|
+
bind.callback(handledPayload, ref, joinRef || this.joinRef());
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
replyEventName(ref) {
|
|
2971
|
+
return `chan_reply_${ref}`;
|
|
2972
|
+
}
|
|
2973
|
+
isClosed() {
|
|
2974
|
+
return this.state === CHANNEL_STATES.closed;
|
|
2975
|
+
}
|
|
2976
|
+
isErrored() {
|
|
2977
|
+
return this.state === CHANNEL_STATES.errored;
|
|
2978
|
+
}
|
|
2979
|
+
isJoined() {
|
|
2980
|
+
return this.state === CHANNEL_STATES.joined;
|
|
2981
|
+
}
|
|
2982
|
+
isJoining() {
|
|
2983
|
+
return this.state === CHANNEL_STATES.joining;
|
|
2984
|
+
}
|
|
2985
|
+
isLeaving() {
|
|
2986
|
+
return this.state === CHANNEL_STATES.leaving;
|
|
2987
|
+
}
|
|
2988
|
+
};
|
|
2989
|
+
|
|
2990
|
+
// js/phoenix/ajax.js
|
|
2991
|
+
var Ajax = class {
|
|
2992
|
+
static request(method, endPoint, accept, body, timeout, ontimeout, callback) {
|
|
2993
|
+
if (global.XDomainRequest) {
|
|
2994
|
+
let req = new global.XDomainRequest();
|
|
2995
|
+
return this.xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback);
|
|
2996
|
+
} else {
|
|
2997
|
+
let req = new global.XMLHttpRequest();
|
|
2998
|
+
return this.xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback);
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
static xdomainRequest(req, method, endPoint, body, timeout, ontimeout, callback) {
|
|
3002
|
+
req.timeout = timeout;
|
|
3003
|
+
req.open(method, endPoint);
|
|
3004
|
+
req.onload = () => {
|
|
3005
|
+
let response = this.parseJSON(req.responseText);
|
|
3006
|
+
callback && callback(response);
|
|
3007
|
+
};
|
|
3008
|
+
if (ontimeout) {
|
|
3009
|
+
req.ontimeout = ontimeout;
|
|
3010
|
+
}
|
|
3011
|
+
req.onprogress = () => {
|
|
3012
|
+
};
|
|
3013
|
+
req.send(body);
|
|
3014
|
+
return req;
|
|
3015
|
+
}
|
|
3016
|
+
static xhrRequest(req, method, endPoint, accept, body, timeout, ontimeout, callback) {
|
|
3017
|
+
req.open(method, endPoint, true);
|
|
3018
|
+
req.timeout = timeout;
|
|
3019
|
+
req.setRequestHeader("Content-Type", accept);
|
|
3020
|
+
req.onerror = () => callback && callback(null);
|
|
3021
|
+
req.onreadystatechange = () => {
|
|
3022
|
+
if (req.readyState === XHR_STATES.complete && callback) {
|
|
3023
|
+
let response = this.parseJSON(req.responseText);
|
|
3024
|
+
callback(response);
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
if (ontimeout) {
|
|
3028
|
+
req.ontimeout = ontimeout;
|
|
3029
|
+
}
|
|
3030
|
+
req.send(body);
|
|
3031
|
+
return req;
|
|
3032
|
+
}
|
|
3033
|
+
static parseJSON(resp) {
|
|
3034
|
+
if (!resp || resp === "") {
|
|
3035
|
+
return null;
|
|
3036
|
+
}
|
|
3037
|
+
try {
|
|
3038
|
+
return JSON.parse(resp);
|
|
3039
|
+
} catch (e) {
|
|
3040
|
+
console && console.log("failed to parse JSON response", resp);
|
|
3041
|
+
return null;
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
static serialize(obj, parentKey) {
|
|
3045
|
+
let queryStr = [];
|
|
3046
|
+
for (var key in obj) {
|
|
3047
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
3048
|
+
continue;
|
|
3049
|
+
}
|
|
3050
|
+
let paramKey = parentKey ? `${parentKey}[${key}]` : key;
|
|
3051
|
+
let paramVal = obj[key];
|
|
3052
|
+
if (typeof paramVal === "object") {
|
|
3053
|
+
queryStr.push(this.serialize(paramVal, paramKey));
|
|
3054
|
+
} else {
|
|
3055
|
+
queryStr.push(encodeURIComponent(paramKey) + "=" + encodeURIComponent(paramVal));
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
return queryStr.join("&");
|
|
3059
|
+
}
|
|
3060
|
+
static appendParams(url, params) {
|
|
3061
|
+
if (Object.keys(params).length === 0) {
|
|
3062
|
+
return url;
|
|
3063
|
+
}
|
|
3064
|
+
let prefix = url.match(/\?/) ? "&" : "?";
|
|
3065
|
+
return `${url}${prefix}${this.serialize(params)}`;
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
|
|
3069
|
+
// js/phoenix/longpoll.js
|
|
3070
|
+
var LongPoll = class {
|
|
3071
|
+
constructor(endPoint) {
|
|
3072
|
+
this.endPoint = null;
|
|
3073
|
+
this.token = null;
|
|
3074
|
+
this.skipHeartbeat = true;
|
|
3075
|
+
this.reqs = /* @__PURE__ */ new Set();
|
|
3076
|
+
this.awaitingBatchAck = false;
|
|
3077
|
+
this.currentBatch = null;
|
|
3078
|
+
this.currentBatchTimer = null;
|
|
3079
|
+
this.batchBuffer = [];
|
|
3080
|
+
this.onopen = function() {
|
|
3081
|
+
};
|
|
3082
|
+
this.onerror = function() {
|
|
3083
|
+
};
|
|
3084
|
+
this.onmessage = function() {
|
|
3085
|
+
};
|
|
3086
|
+
this.onclose = function() {
|
|
3087
|
+
};
|
|
3088
|
+
this.pollEndpoint = this.normalizeEndpoint(endPoint);
|
|
3089
|
+
this.readyState = SOCKET_STATES.connecting;
|
|
3090
|
+
this.poll();
|
|
3091
|
+
}
|
|
3092
|
+
normalizeEndpoint(endPoint) {
|
|
3093
|
+
return endPoint.replace("ws://", "http://").replace("wss://", "https://").replace(new RegExp("(.*)/" + TRANSPORTS.websocket), "$1/" + TRANSPORTS.longpoll);
|
|
3094
|
+
}
|
|
3095
|
+
endpointURL() {
|
|
3096
|
+
return Ajax.appendParams(this.pollEndpoint, { token: this.token });
|
|
3097
|
+
}
|
|
3098
|
+
closeAndRetry(code, reason, wasClean) {
|
|
3099
|
+
this.close(code, reason, wasClean);
|
|
3100
|
+
this.readyState = SOCKET_STATES.connecting;
|
|
3101
|
+
}
|
|
3102
|
+
ontimeout() {
|
|
3103
|
+
this.onerror("timeout");
|
|
3104
|
+
this.closeAndRetry(1005, "timeout", false);
|
|
3105
|
+
}
|
|
3106
|
+
isActive() {
|
|
3107
|
+
return this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting;
|
|
3108
|
+
}
|
|
3109
|
+
poll() {
|
|
3110
|
+
this.ajax("GET", "application/json", null, () => this.ontimeout(), (resp) => {
|
|
3111
|
+
if (resp) {
|
|
3112
|
+
var { status, token, messages } = resp;
|
|
3113
|
+
this.token = token;
|
|
3114
|
+
} else {
|
|
3115
|
+
status = 0;
|
|
3116
|
+
}
|
|
3117
|
+
switch (status) {
|
|
3118
|
+
case 200:
|
|
3119
|
+
messages.forEach((msg) => {
|
|
3120
|
+
setTimeout(() => this.onmessage({ data: msg }), 0);
|
|
3121
|
+
});
|
|
3122
|
+
this.poll();
|
|
3123
|
+
break;
|
|
3124
|
+
case 204:
|
|
3125
|
+
this.poll();
|
|
3126
|
+
break;
|
|
3127
|
+
case 410:
|
|
3128
|
+
this.readyState = SOCKET_STATES.open;
|
|
3129
|
+
this.onopen({});
|
|
3130
|
+
this.poll();
|
|
3131
|
+
break;
|
|
3132
|
+
case 403:
|
|
3133
|
+
this.onerror(403);
|
|
3134
|
+
this.close(1008, "forbidden", false);
|
|
3135
|
+
break;
|
|
3136
|
+
case 0:
|
|
3137
|
+
case 500:
|
|
3138
|
+
this.onerror(500);
|
|
3139
|
+
this.closeAndRetry(1011, "internal server error", 500);
|
|
3140
|
+
break;
|
|
3141
|
+
default:
|
|
3142
|
+
throw new Error(`unhandled poll status ${status}`);
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
}
|
|
3146
|
+
send(body) {
|
|
3147
|
+
if (this.currentBatch) {
|
|
3148
|
+
this.currentBatch.push(body);
|
|
3149
|
+
} else if (this.awaitingBatchAck) {
|
|
3150
|
+
this.batchBuffer.push(body);
|
|
3151
|
+
} else {
|
|
3152
|
+
this.currentBatch = [body];
|
|
3153
|
+
this.currentBatchTimer = setTimeout(() => {
|
|
3154
|
+
this.batchSend(this.currentBatch);
|
|
3155
|
+
this.currentBatch = null;
|
|
3156
|
+
}, 0);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
batchSend(messages) {
|
|
3160
|
+
this.awaitingBatchAck = true;
|
|
3161
|
+
this.ajax("POST", "application/x-ndjson", messages.join("\n"), () => this.onerror("timeout"), (resp) => {
|
|
3162
|
+
this.awaitingBatchAck = false;
|
|
3163
|
+
if (!resp || resp.status !== 200) {
|
|
3164
|
+
this.onerror(resp && resp.status);
|
|
3165
|
+
this.closeAndRetry(1011, "internal server error", false);
|
|
3166
|
+
} else if (this.batchBuffer.length > 0) {
|
|
3167
|
+
this.batchSend(this.batchBuffer);
|
|
3168
|
+
this.batchBuffer = [];
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
close(code, reason, wasClean) {
|
|
3173
|
+
for (let req of this.reqs) {
|
|
3174
|
+
req.abort();
|
|
3175
|
+
}
|
|
3176
|
+
this.readyState = SOCKET_STATES.closed;
|
|
3177
|
+
let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
|
|
3178
|
+
this.batchBuffer = [];
|
|
3179
|
+
clearTimeout(this.currentBatchTimer);
|
|
3180
|
+
this.currentBatchTimer = null;
|
|
3181
|
+
if (typeof CloseEvent !== "undefined") {
|
|
3182
|
+
this.onclose(new CloseEvent("close", opts));
|
|
3183
|
+
} else {
|
|
3184
|
+
this.onclose(opts);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
ajax(method, contentType, body, onCallerTimeout, callback) {
|
|
3188
|
+
let req;
|
|
3189
|
+
let ontimeout = () => {
|
|
3190
|
+
this.reqs.delete(req);
|
|
3191
|
+
onCallerTimeout();
|
|
3192
|
+
};
|
|
3193
|
+
req = Ajax.request(method, this.endpointURL(), contentType, body, this.timeout, ontimeout, (resp) => {
|
|
3194
|
+
this.reqs.delete(req);
|
|
3195
|
+
if (this.isActive()) {
|
|
3196
|
+
callback(resp);
|
|
3197
|
+
}
|
|
3198
|
+
});
|
|
3199
|
+
this.reqs.add(req);
|
|
3200
|
+
}
|
|
3201
|
+
};
|
|
3202
|
+
|
|
3203
|
+
// js/phoenix/presence.js
|
|
3204
|
+
var Presence = class {
|
|
3205
|
+
constructor(channel, opts = {}) {
|
|
3206
|
+
let events = opts.events || { state: "presence_state", diff: "presence_diff" };
|
|
3207
|
+
this.state = {};
|
|
3208
|
+
this.pendingDiffs = [];
|
|
3209
|
+
this.channel = channel;
|
|
3210
|
+
this.joinRef = null;
|
|
3211
|
+
this.caller = {
|
|
3212
|
+
onJoin: function() {
|
|
3213
|
+
},
|
|
3214
|
+
onLeave: function() {
|
|
3215
|
+
},
|
|
3216
|
+
onSync: function() {
|
|
3217
|
+
}
|
|
3218
|
+
};
|
|
3219
|
+
this.channel.on(events.state, (newState) => {
|
|
3220
|
+
let { onJoin, onLeave, onSync } = this.caller;
|
|
3221
|
+
this.joinRef = this.channel.joinRef();
|
|
3222
|
+
this.state = Presence.syncState(this.state, newState, onJoin, onLeave);
|
|
3223
|
+
this.pendingDiffs.forEach((diff) => {
|
|
3224
|
+
this.state = Presence.syncDiff(this.state, diff, onJoin, onLeave);
|
|
3225
|
+
});
|
|
3226
|
+
this.pendingDiffs = [];
|
|
3227
|
+
onSync();
|
|
3228
|
+
});
|
|
3229
|
+
this.channel.on(events.diff, (diff) => {
|
|
3230
|
+
let { onJoin, onLeave, onSync } = this.caller;
|
|
3231
|
+
if (this.inPendingSyncState()) {
|
|
3232
|
+
this.pendingDiffs.push(diff);
|
|
3233
|
+
} else {
|
|
3234
|
+
this.state = Presence.syncDiff(this.state, diff, onJoin, onLeave);
|
|
3235
|
+
onSync();
|
|
3236
|
+
}
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
onJoin(callback) {
|
|
3240
|
+
this.caller.onJoin = callback;
|
|
3241
|
+
}
|
|
3242
|
+
onLeave(callback) {
|
|
3243
|
+
this.caller.onLeave = callback;
|
|
3244
|
+
}
|
|
3245
|
+
onSync(callback) {
|
|
3246
|
+
this.caller.onSync = callback;
|
|
3247
|
+
}
|
|
3248
|
+
list(by) {
|
|
3249
|
+
return Presence.list(this.state, by);
|
|
3250
|
+
}
|
|
3251
|
+
inPendingSyncState() {
|
|
3252
|
+
return !this.joinRef || this.joinRef !== this.channel.joinRef();
|
|
3253
|
+
}
|
|
3254
|
+
static syncState(currentState, newState, onJoin, onLeave) {
|
|
3255
|
+
let state = this.clone(currentState);
|
|
3256
|
+
let joins = {};
|
|
3257
|
+
let leaves = {};
|
|
3258
|
+
this.map(state, (key, presence) => {
|
|
3259
|
+
if (!newState[key]) {
|
|
3260
|
+
leaves[key] = presence;
|
|
3261
|
+
}
|
|
3262
|
+
});
|
|
3263
|
+
this.map(newState, (key, newPresence) => {
|
|
3264
|
+
let currentPresence = state[key];
|
|
3265
|
+
if (currentPresence) {
|
|
3266
|
+
let newRefs = newPresence.metas.map((m) => m.phx_ref);
|
|
3267
|
+
let curRefs = currentPresence.metas.map((m) => m.phx_ref);
|
|
3268
|
+
let joinedMetas = newPresence.metas.filter((m) => curRefs.indexOf(m.phx_ref) < 0);
|
|
3269
|
+
let leftMetas = currentPresence.metas.filter((m) => newRefs.indexOf(m.phx_ref) < 0);
|
|
3270
|
+
if (joinedMetas.length > 0) {
|
|
3271
|
+
joins[key] = newPresence;
|
|
3272
|
+
joins[key].metas = joinedMetas;
|
|
3273
|
+
}
|
|
3274
|
+
if (leftMetas.length > 0) {
|
|
3275
|
+
leaves[key] = this.clone(currentPresence);
|
|
3276
|
+
leaves[key].metas = leftMetas;
|
|
3277
|
+
}
|
|
3278
|
+
} else {
|
|
3279
|
+
joins[key] = newPresence;
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
return this.syncDiff(state, { joins, leaves }, onJoin, onLeave);
|
|
3283
|
+
}
|
|
3284
|
+
static syncDiff(state, diff, onJoin, onLeave) {
|
|
3285
|
+
let { joins, leaves } = this.clone(diff);
|
|
3286
|
+
if (!onJoin) {
|
|
3287
|
+
onJoin = function() {
|
|
3288
|
+
};
|
|
3289
|
+
}
|
|
3290
|
+
if (!onLeave) {
|
|
3291
|
+
onLeave = function() {
|
|
3292
|
+
};
|
|
3293
|
+
}
|
|
3294
|
+
this.map(joins, (key, newPresence) => {
|
|
3295
|
+
let currentPresence = state[key];
|
|
3296
|
+
state[key] = this.clone(newPresence);
|
|
3297
|
+
if (currentPresence) {
|
|
3298
|
+
let joinedRefs = state[key].metas.map((m) => m.phx_ref);
|
|
3299
|
+
let curMetas = currentPresence.metas.filter((m) => joinedRefs.indexOf(m.phx_ref) < 0);
|
|
3300
|
+
state[key].metas.unshift(...curMetas);
|
|
3301
|
+
}
|
|
3302
|
+
onJoin(key, currentPresence, newPresence);
|
|
3303
|
+
});
|
|
3304
|
+
this.map(leaves, (key, leftPresence) => {
|
|
3305
|
+
let currentPresence = state[key];
|
|
3306
|
+
if (!currentPresence) {
|
|
3307
|
+
return;
|
|
3308
|
+
}
|
|
3309
|
+
let refsToRemove = leftPresence.metas.map((m) => m.phx_ref);
|
|
3310
|
+
currentPresence.metas = currentPresence.metas.filter((p) => {
|
|
3311
|
+
return refsToRemove.indexOf(p.phx_ref) < 0;
|
|
3312
|
+
});
|
|
3313
|
+
onLeave(key, currentPresence, leftPresence);
|
|
3314
|
+
if (currentPresence.metas.length === 0) {
|
|
3315
|
+
delete state[key];
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3318
|
+
return state;
|
|
3319
|
+
}
|
|
3320
|
+
static list(presences, chooser) {
|
|
3321
|
+
if (!chooser) {
|
|
3322
|
+
chooser = function(key, pres) {
|
|
3323
|
+
return pres;
|
|
3324
|
+
};
|
|
3325
|
+
}
|
|
3326
|
+
return this.map(presences, (key, presence) => {
|
|
3327
|
+
return chooser(key, presence);
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
static map(obj, func) {
|
|
3331
|
+
return Object.getOwnPropertyNames(obj).map((key) => func(key, obj[key]));
|
|
3332
|
+
}
|
|
3333
|
+
static clone(obj) {
|
|
3334
|
+
return JSON.parse(JSON.stringify(obj));
|
|
3335
|
+
}
|
|
3336
|
+
};
|
|
3337
|
+
|
|
3338
|
+
// js/phoenix/serializer.js
|
|
3339
|
+
var serializer_default = {
|
|
3340
|
+
HEADER_LENGTH: 1,
|
|
3341
|
+
META_LENGTH: 4,
|
|
3342
|
+
KINDS: { push: 0, reply: 1, broadcast: 2 },
|
|
3343
|
+
encode(msg, callback) {
|
|
3344
|
+
if (msg.payload.constructor === ArrayBuffer) {
|
|
3345
|
+
return callback(this.binaryEncode(msg));
|
|
3346
|
+
} else {
|
|
3347
|
+
let payload = [msg.join_ref, msg.ref, msg.topic, msg.event, msg.payload];
|
|
3348
|
+
return callback(JSON.stringify(payload));
|
|
3349
|
+
}
|
|
3350
|
+
},
|
|
3351
|
+
decode(rawPayload, callback) {
|
|
3352
|
+
if (rawPayload.constructor === ArrayBuffer) {
|
|
3353
|
+
return callback(this.binaryDecode(rawPayload));
|
|
3354
|
+
} else {
|
|
3355
|
+
let [join_ref, ref, topic, event, payload] = JSON.parse(rawPayload);
|
|
3356
|
+
return callback({ join_ref, ref, topic, event, payload });
|
|
3357
|
+
}
|
|
3358
|
+
},
|
|
3359
|
+
binaryEncode(message) {
|
|
3360
|
+
let { join_ref, ref, event, topic, payload } = message;
|
|
3361
|
+
let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
|
|
3362
|
+
let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
|
|
3363
|
+
let view = new DataView(header);
|
|
3364
|
+
let offset = 0;
|
|
3365
|
+
view.setUint8(offset++, this.KINDS.push);
|
|
3366
|
+
view.setUint8(offset++, join_ref.length);
|
|
3367
|
+
view.setUint8(offset++, ref.length);
|
|
3368
|
+
view.setUint8(offset++, topic.length);
|
|
3369
|
+
view.setUint8(offset++, event.length);
|
|
3370
|
+
Array.from(join_ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
|
|
3371
|
+
Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
|
|
3372
|
+
Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
|
|
3373
|
+
Array.from(event, (char) => view.setUint8(offset++, char.charCodeAt(0)));
|
|
3374
|
+
var combined = new Uint8Array(header.byteLength + payload.byteLength);
|
|
3375
|
+
combined.set(new Uint8Array(header), 0);
|
|
3376
|
+
combined.set(new Uint8Array(payload), header.byteLength);
|
|
3377
|
+
return combined.buffer;
|
|
3378
|
+
},
|
|
3379
|
+
binaryDecode(buffer) {
|
|
3380
|
+
let view = new DataView(buffer);
|
|
3381
|
+
let kind = view.getUint8(0);
|
|
3382
|
+
let decoder = new TextDecoder();
|
|
3383
|
+
switch (kind) {
|
|
3384
|
+
case this.KINDS.push:
|
|
3385
|
+
return this.decodePush(buffer, view, decoder);
|
|
3386
|
+
case this.KINDS.reply:
|
|
3387
|
+
return this.decodeReply(buffer, view, decoder);
|
|
3388
|
+
case this.KINDS.broadcast:
|
|
3389
|
+
return this.decodeBroadcast(buffer, view, decoder);
|
|
3390
|
+
}
|
|
3391
|
+
},
|
|
3392
|
+
decodePush(buffer, view, decoder) {
|
|
3393
|
+
let joinRefSize = view.getUint8(1);
|
|
3394
|
+
let topicSize = view.getUint8(2);
|
|
3395
|
+
let eventSize = view.getUint8(3);
|
|
3396
|
+
let offset = this.HEADER_LENGTH + this.META_LENGTH - 1;
|
|
3397
|
+
let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
|
|
3398
|
+
offset = offset + joinRefSize;
|
|
3399
|
+
let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
|
|
3400
|
+
offset = offset + topicSize;
|
|
3401
|
+
let event = decoder.decode(buffer.slice(offset, offset + eventSize));
|
|
3402
|
+
offset = offset + eventSize;
|
|
3403
|
+
let data = buffer.slice(offset, buffer.byteLength);
|
|
3404
|
+
return { join_ref: joinRef, ref: null, topic, event, payload: data };
|
|
3405
|
+
},
|
|
3406
|
+
decodeReply(buffer, view, decoder) {
|
|
3407
|
+
let joinRefSize = view.getUint8(1);
|
|
3408
|
+
let refSize = view.getUint8(2);
|
|
3409
|
+
let topicSize = view.getUint8(3);
|
|
3410
|
+
let eventSize = view.getUint8(4);
|
|
3411
|
+
let offset = this.HEADER_LENGTH + this.META_LENGTH;
|
|
3412
|
+
let joinRef = decoder.decode(buffer.slice(offset, offset + joinRefSize));
|
|
3413
|
+
offset = offset + joinRefSize;
|
|
3414
|
+
let ref = decoder.decode(buffer.slice(offset, offset + refSize));
|
|
3415
|
+
offset = offset + refSize;
|
|
3416
|
+
let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
|
|
3417
|
+
offset = offset + topicSize;
|
|
3418
|
+
let event = decoder.decode(buffer.slice(offset, offset + eventSize));
|
|
3419
|
+
offset = offset + eventSize;
|
|
3420
|
+
let data = buffer.slice(offset, buffer.byteLength);
|
|
3421
|
+
let payload = { status: event, response: data };
|
|
3422
|
+
return { join_ref: joinRef, ref, topic, event: CHANNEL_EVENTS.reply, payload };
|
|
3423
|
+
},
|
|
3424
|
+
decodeBroadcast(buffer, view, decoder) {
|
|
3425
|
+
let topicSize = view.getUint8(1);
|
|
3426
|
+
let eventSize = view.getUint8(2);
|
|
3427
|
+
let offset = this.HEADER_LENGTH + 2;
|
|
3428
|
+
let topic = decoder.decode(buffer.slice(offset, offset + topicSize));
|
|
3429
|
+
offset = offset + topicSize;
|
|
3430
|
+
let event = decoder.decode(buffer.slice(offset, offset + eventSize));
|
|
3431
|
+
offset = offset + eventSize;
|
|
3432
|
+
let data = buffer.slice(offset, buffer.byteLength);
|
|
3433
|
+
return { join_ref: null, ref: null, topic, event, payload: data };
|
|
3434
|
+
}
|
|
3435
|
+
};
|
|
3436
|
+
|
|
3437
|
+
// js/phoenix/socket.js
|
|
3438
|
+
var phoenix_Socket = class {
|
|
3439
|
+
constructor(endPoint, opts = {}) {
|
|
3440
|
+
this.stateChangeCallbacks = { open: [], close: [], error: [], message: [] };
|
|
3441
|
+
this.channels = [];
|
|
3442
|
+
this.sendBuffer = [];
|
|
3443
|
+
this.ref = 0;
|
|
3444
|
+
this.timeout = opts.timeout || DEFAULT_TIMEOUT;
|
|
3445
|
+
this.transport = opts.transport || global.WebSocket || LongPoll;
|
|
3446
|
+
this.establishedConnections = 0;
|
|
3447
|
+
this.defaultEncoder = serializer_default.encode.bind(serializer_default);
|
|
3448
|
+
this.defaultDecoder = serializer_default.decode.bind(serializer_default);
|
|
3449
|
+
this.closeWasClean = false;
|
|
3450
|
+
this.binaryType = opts.binaryType || "arraybuffer";
|
|
3451
|
+
this.connectClock = 1;
|
|
3452
|
+
if (this.transport !== LongPoll) {
|
|
3453
|
+
this.encode = opts.encode || this.defaultEncoder;
|
|
3454
|
+
this.decode = opts.decode || this.defaultDecoder;
|
|
3455
|
+
} else {
|
|
3456
|
+
this.encode = this.defaultEncoder;
|
|
3457
|
+
this.decode = this.defaultDecoder;
|
|
3458
|
+
}
|
|
3459
|
+
let awaitingConnectionOnPageShow = null;
|
|
3460
|
+
if (phxWindow && phxWindow.addEventListener) {
|
|
3461
|
+
phxWindow.addEventListener("pagehide", (_e) => {
|
|
3462
|
+
if (this.conn) {
|
|
3463
|
+
this.disconnect();
|
|
3464
|
+
awaitingConnectionOnPageShow = this.connectClock;
|
|
3465
|
+
}
|
|
3466
|
+
});
|
|
3467
|
+
phxWindow.addEventListener("pageshow", (_e) => {
|
|
3468
|
+
if (awaitingConnectionOnPageShow === this.connectClock) {
|
|
3469
|
+
awaitingConnectionOnPageShow = null;
|
|
3470
|
+
this.connect();
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
this.heartbeatIntervalMs = opts.heartbeatIntervalMs || 3e4;
|
|
3475
|
+
this.rejoinAfterMs = (tries) => {
|
|
3476
|
+
if (opts.rejoinAfterMs) {
|
|
3477
|
+
return opts.rejoinAfterMs(tries);
|
|
3478
|
+
} else {
|
|
3479
|
+
return [1e3, 2e3, 5e3][tries - 1] || 1e4;
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
this.reconnectAfterMs = (tries) => {
|
|
3483
|
+
if (opts.reconnectAfterMs) {
|
|
3484
|
+
return opts.reconnectAfterMs(tries);
|
|
3485
|
+
} else {
|
|
3486
|
+
return [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][tries - 1] || 5e3;
|
|
3487
|
+
}
|
|
3488
|
+
};
|
|
3489
|
+
this.logger = opts.logger || null;
|
|
3490
|
+
this.longpollerTimeout = opts.longpollerTimeout || 2e4;
|
|
3491
|
+
this.params = closure(opts.params || {});
|
|
3492
|
+
this.endPoint = `${endPoint}/${TRANSPORTS.websocket}`;
|
|
3493
|
+
this.vsn = opts.vsn || DEFAULT_VSN;
|
|
3494
|
+
this.heartbeatTimeoutTimer = null;
|
|
3495
|
+
this.heartbeatTimer = null;
|
|
3496
|
+
this.pendingHeartbeatRef = null;
|
|
3497
|
+
this.reconnectTimer = new Timer(() => {
|
|
3498
|
+
this.teardown(() => this.connect());
|
|
3499
|
+
}, this.reconnectAfterMs);
|
|
3500
|
+
}
|
|
3501
|
+
getLongPollTransport() {
|
|
3502
|
+
return LongPoll;
|
|
3503
|
+
}
|
|
3504
|
+
replaceTransport(newTransport) {
|
|
3505
|
+
this.connectClock++;
|
|
3506
|
+
this.closeWasClean = true;
|
|
3507
|
+
this.reconnectTimer.reset();
|
|
3508
|
+
this.sendBuffer = [];
|
|
3509
|
+
if (this.conn) {
|
|
3510
|
+
this.conn.close();
|
|
3511
|
+
this.conn = null;
|
|
3512
|
+
}
|
|
3513
|
+
this.transport = newTransport;
|
|
3514
|
+
}
|
|
3515
|
+
protocol() {
|
|
3516
|
+
return location.protocol.match(/^https/) ? "wss" : "ws";
|
|
3517
|
+
}
|
|
3518
|
+
endPointURL() {
|
|
3519
|
+
let uri = Ajax.appendParams(Ajax.appendParams(this.endPoint, this.params()), { vsn: this.vsn });
|
|
3520
|
+
if (uri.charAt(0) !== "/") {
|
|
3521
|
+
return uri;
|
|
3522
|
+
}
|
|
3523
|
+
if (uri.charAt(1) === "/") {
|
|
3524
|
+
return `${this.protocol()}:${uri}`;
|
|
3525
|
+
}
|
|
3526
|
+
return `${this.protocol()}://${location.host}${uri}`;
|
|
3527
|
+
}
|
|
3528
|
+
disconnect(callback, code, reason) {
|
|
3529
|
+
this.connectClock++;
|
|
3530
|
+
this.closeWasClean = true;
|
|
3531
|
+
this.reconnectTimer.reset();
|
|
3532
|
+
this.teardown(callback, code, reason);
|
|
3533
|
+
}
|
|
3534
|
+
connect(params) {
|
|
3535
|
+
if (params) {
|
|
3536
|
+
console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor");
|
|
3537
|
+
this.params = closure(params);
|
|
3538
|
+
}
|
|
3539
|
+
if (this.conn) {
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
this.connectClock++;
|
|
3543
|
+
this.closeWasClean = false;
|
|
3544
|
+
this.conn = new this.transport(this.endPointURL());
|
|
3545
|
+
this.conn.binaryType = this.binaryType;
|
|
3546
|
+
this.conn.timeout = this.longpollerTimeout;
|
|
3547
|
+
this.conn.onopen = () => this.onConnOpen();
|
|
3548
|
+
this.conn.onerror = (error) => this.onConnError(error);
|
|
3549
|
+
this.conn.onmessage = (event) => this.onConnMessage(event);
|
|
3550
|
+
this.conn.onclose = (event) => this.onConnClose(event);
|
|
3551
|
+
}
|
|
3552
|
+
log(kind, msg, data) {
|
|
3553
|
+
this.logger(kind, msg, data);
|
|
3554
|
+
}
|
|
3555
|
+
hasLogger() {
|
|
3556
|
+
return this.logger !== null;
|
|
3557
|
+
}
|
|
3558
|
+
onOpen(callback) {
|
|
3559
|
+
let ref = this.makeRef();
|
|
3560
|
+
this.stateChangeCallbacks.open.push([ref, callback]);
|
|
3561
|
+
return ref;
|
|
3562
|
+
}
|
|
3563
|
+
onClose(callback) {
|
|
3564
|
+
let ref = this.makeRef();
|
|
3565
|
+
this.stateChangeCallbacks.close.push([ref, callback]);
|
|
3566
|
+
return ref;
|
|
3567
|
+
}
|
|
3568
|
+
onError(callback) {
|
|
3569
|
+
let ref = this.makeRef();
|
|
3570
|
+
this.stateChangeCallbacks.error.push([ref, callback]);
|
|
3571
|
+
return ref;
|
|
3572
|
+
}
|
|
3573
|
+
onMessage(callback) {
|
|
3574
|
+
let ref = this.makeRef();
|
|
3575
|
+
this.stateChangeCallbacks.message.push([ref, callback]);
|
|
3576
|
+
return ref;
|
|
3577
|
+
}
|
|
3578
|
+
ping(callback) {
|
|
3579
|
+
if (!this.isConnected()) {
|
|
3580
|
+
return false;
|
|
3581
|
+
}
|
|
3582
|
+
let ref = this.makeRef();
|
|
3583
|
+
let startTime = Date.now();
|
|
3584
|
+
this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref });
|
|
3585
|
+
let onMsgRef = this.onMessage((msg) => {
|
|
3586
|
+
if (msg.ref === ref) {
|
|
3587
|
+
this.off([onMsgRef]);
|
|
3588
|
+
callback(Date.now() - startTime);
|
|
3589
|
+
}
|
|
3590
|
+
});
|
|
3591
|
+
return true;
|
|
3592
|
+
}
|
|
3593
|
+
clearHeartbeats() {
|
|
3594
|
+
clearTimeout(this.heartbeatTimer);
|
|
3595
|
+
clearTimeout(this.heartbeatTimeoutTimer);
|
|
3596
|
+
}
|
|
3597
|
+
onConnOpen() {
|
|
3598
|
+
if (this.hasLogger())
|
|
3599
|
+
this.log("transport", `connected to ${this.endPointURL()}`);
|
|
3600
|
+
this.closeWasClean = false;
|
|
3601
|
+
this.establishedConnections++;
|
|
3602
|
+
this.flushSendBuffer();
|
|
3603
|
+
this.reconnectTimer.reset();
|
|
3604
|
+
this.resetHeartbeat();
|
|
3605
|
+
this.stateChangeCallbacks.open.forEach(([, callback]) => callback());
|
|
3606
|
+
}
|
|
3607
|
+
heartbeatTimeout() {
|
|
3608
|
+
if (this.pendingHeartbeatRef) {
|
|
3609
|
+
this.pendingHeartbeatRef = null;
|
|
3610
|
+
if (this.hasLogger()) {
|
|
3611
|
+
this.log("transport", "heartbeat timeout. Attempting to re-establish connection");
|
|
3612
|
+
}
|
|
3613
|
+
this.triggerChanError();
|
|
3614
|
+
this.closeWasClean = false;
|
|
3615
|
+
this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout");
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
resetHeartbeat() {
|
|
3619
|
+
if (this.conn && this.conn.skipHeartbeat) {
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
this.pendingHeartbeatRef = null;
|
|
3623
|
+
this.clearHeartbeats();
|
|
3624
|
+
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
|
|
3625
|
+
}
|
|
3626
|
+
teardown(callback, code, reason) {
|
|
3627
|
+
if (!this.conn) {
|
|
3628
|
+
return callback && callback();
|
|
3629
|
+
}
|
|
3630
|
+
this.waitForBufferDone(() => {
|
|
3631
|
+
if (this.conn) {
|
|
3632
|
+
if (code) {
|
|
3633
|
+
this.conn.close(code, reason || "");
|
|
3634
|
+
} else {
|
|
3635
|
+
this.conn.close();
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
this.waitForSocketClosed(() => {
|
|
3639
|
+
if (this.conn) {
|
|
3640
|
+
this.conn.onopen = function() {
|
|
3641
|
+
};
|
|
3642
|
+
this.conn.onerror = function() {
|
|
3643
|
+
};
|
|
3644
|
+
this.conn.onmessage = function() {
|
|
3645
|
+
};
|
|
3646
|
+
this.conn.onclose = function() {
|
|
3647
|
+
};
|
|
3648
|
+
this.conn = null;
|
|
3649
|
+
}
|
|
3650
|
+
callback && callback();
|
|
3651
|
+
});
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3654
|
+
waitForBufferDone(callback, tries = 1) {
|
|
3655
|
+
if (tries === 5 || !this.conn || !this.conn.bufferedAmount) {
|
|
3656
|
+
callback();
|
|
3657
|
+
return;
|
|
3658
|
+
}
|
|
3659
|
+
setTimeout(() => {
|
|
3660
|
+
this.waitForBufferDone(callback, tries + 1);
|
|
3661
|
+
}, 150 * tries);
|
|
3662
|
+
}
|
|
3663
|
+
waitForSocketClosed(callback, tries = 1) {
|
|
3664
|
+
if (tries === 5 || !this.conn || this.conn.readyState === SOCKET_STATES.closed) {
|
|
3665
|
+
callback();
|
|
3666
|
+
return;
|
|
3667
|
+
}
|
|
3668
|
+
setTimeout(() => {
|
|
3669
|
+
this.waitForSocketClosed(callback, tries + 1);
|
|
3670
|
+
}, 150 * tries);
|
|
3671
|
+
}
|
|
3672
|
+
onConnClose(event) {
|
|
3673
|
+
let closeCode = event && event.code;
|
|
3674
|
+
if (this.hasLogger())
|
|
3675
|
+
this.log("transport", "close", event);
|
|
3676
|
+
this.triggerChanError();
|
|
3677
|
+
this.clearHeartbeats();
|
|
3678
|
+
if (!this.closeWasClean && closeCode !== 1e3) {
|
|
3679
|
+
this.reconnectTimer.scheduleTimeout();
|
|
3680
|
+
}
|
|
3681
|
+
this.stateChangeCallbacks.close.forEach(([, callback]) => callback(event));
|
|
3682
|
+
}
|
|
3683
|
+
onConnError(error) {
|
|
3684
|
+
if (this.hasLogger())
|
|
3685
|
+
this.log("transport", error);
|
|
3686
|
+
let transportBefore = this.transport;
|
|
3687
|
+
let establishedBefore = this.establishedConnections;
|
|
3688
|
+
this.stateChangeCallbacks.error.forEach(([, callback]) => {
|
|
3689
|
+
callback(error, transportBefore, establishedBefore);
|
|
3690
|
+
});
|
|
3691
|
+
if (transportBefore === this.transport || establishedBefore > 0) {
|
|
3692
|
+
this.triggerChanError();
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
triggerChanError() {
|
|
3696
|
+
this.channels.forEach((channel) => {
|
|
3697
|
+
if (!(channel.isErrored() || channel.isLeaving() || channel.isClosed())) {
|
|
3698
|
+
channel.trigger(CHANNEL_EVENTS.error);
|
|
3699
|
+
}
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
connectionState() {
|
|
3703
|
+
switch (this.conn && this.conn.readyState) {
|
|
3704
|
+
case SOCKET_STATES.connecting:
|
|
3705
|
+
return "connecting";
|
|
3706
|
+
case SOCKET_STATES.open:
|
|
3707
|
+
return "open";
|
|
3708
|
+
case SOCKET_STATES.closing:
|
|
3709
|
+
return "closing";
|
|
3710
|
+
default:
|
|
3711
|
+
return "closed";
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
isConnected() {
|
|
3715
|
+
return this.connectionState() === "open";
|
|
3716
|
+
}
|
|
3717
|
+
remove(channel) {
|
|
3718
|
+
this.off(channel.stateChangeRefs);
|
|
3719
|
+
this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
|
|
3720
|
+
}
|
|
3721
|
+
off(refs) {
|
|
3722
|
+
for (let key in this.stateChangeCallbacks) {
|
|
3723
|
+
this.stateChangeCallbacks[key] = this.stateChangeCallbacks[key].filter(([ref]) => {
|
|
3724
|
+
return refs.indexOf(ref) === -1;
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
channel(topic, chanParams = {}) {
|
|
3729
|
+
let chan = new Channel(topic, chanParams, this);
|
|
3730
|
+
this.channels.push(chan);
|
|
3731
|
+
return chan;
|
|
3732
|
+
}
|
|
3733
|
+
push(data) {
|
|
3734
|
+
if (this.hasLogger()) {
|
|
3735
|
+
let { topic, event, payload, ref, join_ref } = data;
|
|
3736
|
+
this.log("push", `${topic} ${event} (${join_ref}, ${ref})`, payload);
|
|
3737
|
+
}
|
|
3738
|
+
if (this.isConnected()) {
|
|
3739
|
+
this.encode(data, (result) => this.conn.send(result));
|
|
3740
|
+
} else {
|
|
3741
|
+
this.sendBuffer.push(() => this.encode(data, (result) => this.conn.send(result)));
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
makeRef() {
|
|
3745
|
+
let newRef = this.ref + 1;
|
|
3746
|
+
if (newRef === this.ref) {
|
|
3747
|
+
this.ref = 0;
|
|
3748
|
+
} else {
|
|
3749
|
+
this.ref = newRef;
|
|
3750
|
+
}
|
|
3751
|
+
return this.ref.toString();
|
|
3752
|
+
}
|
|
3753
|
+
sendHeartbeat() {
|
|
3754
|
+
if (this.pendingHeartbeatRef && !this.isConnected()) {
|
|
3755
|
+
return;
|
|
3756
|
+
}
|
|
3757
|
+
this.pendingHeartbeatRef = this.makeRef();
|
|
3758
|
+
this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref: this.pendingHeartbeatRef });
|
|
3759
|
+
this.heartbeatTimeoutTimer = setTimeout(() => this.heartbeatTimeout(), this.heartbeatIntervalMs);
|
|
3760
|
+
}
|
|
3761
|
+
flushSendBuffer() {
|
|
3762
|
+
if (this.isConnected() && this.sendBuffer.length > 0) {
|
|
3763
|
+
this.sendBuffer.forEach((callback) => callback());
|
|
3764
|
+
this.sendBuffer = [];
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
onConnMessage(rawMessage) {
|
|
3768
|
+
this.decode(rawMessage.data, (msg) => {
|
|
3769
|
+
let { topic, event, payload, ref, join_ref } = msg;
|
|
3770
|
+
if (ref && ref === this.pendingHeartbeatRef) {
|
|
3771
|
+
this.clearHeartbeats();
|
|
3772
|
+
this.pendingHeartbeatRef = null;
|
|
3773
|
+
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
|
|
3774
|
+
}
|
|
3775
|
+
if (this.hasLogger())
|
|
3776
|
+
this.log("receive", `${payload.status || ""} ${topic} ${event} ${ref && "(" + ref + ")" || ""}`, payload);
|
|
3777
|
+
for (let i = 0; i < this.channels.length; i++) {
|
|
3778
|
+
const channel = this.channels[i];
|
|
3779
|
+
if (!channel.isMember(topic, event, payload, join_ref)) {
|
|
3780
|
+
continue;
|
|
3781
|
+
}
|
|
3782
|
+
channel.trigger(event, payload, ref, join_ref);
|
|
3783
|
+
}
|
|
3784
|
+
for (let i = 0; i < this.stateChangeCallbacks.message.length; i++) {
|
|
3785
|
+
let [, callback] = this.stateChangeCallbacks.message[i];
|
|
3786
|
+
callback(msg);
|
|
3787
|
+
}
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
leaveOpenTopic(topic) {
|
|
3791
|
+
let dupChannel = this.channels.find((c) => c.topic === topic && (c.isJoined() || c.isJoining()));
|
|
3792
|
+
if (dupChannel) {
|
|
3793
|
+
if (this.hasLogger())
|
|
3794
|
+
this.log("transport", `leaving duplicate topic "${topic}"`);
|
|
3795
|
+
dupChannel.leave();
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
};
|
|
3799
|
+
|
|
3800
|
+
//# sourceMappingURL=phoenix.mjs.map
|
|
3801
|
+
|
|
3802
|
+
// EXTERNAL MODULE: ./src/javascripts/config.ts
|
|
3803
|
+
var config = __webpack_require__(9787);
|
|
3804
|
+
// EXTERNAL MODULE: ./src/javascripts/lib/debug.js
|
|
3805
|
+
var debug = __webpack_require__(7008);
|
|
3806
|
+
var debug_default = /*#__PURE__*/__webpack_require__.n(debug);
|
|
3807
|
+
;// CONCATENATED MODULE: ./src/javascripts/api/conversation-connector.ts
|
|
3808
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
3809
|
+
function adopt(value) {
|
|
3810
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
3811
|
+
resolve(value);
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3815
|
+
function fulfilled(value) {
|
|
3816
|
+
try {
|
|
3817
|
+
step(generator.next(value));
|
|
3818
|
+
} catch (e) {
|
|
3819
|
+
reject(e);
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
function rejected(value) {
|
|
3823
|
+
try {
|
|
3824
|
+
step(generator["throw"](value));
|
|
3825
|
+
} catch (e) {
|
|
3826
|
+
reject(e);
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
function step(result) {
|
|
3830
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
3831
|
+
}
|
|
3832
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3833
|
+
});
|
|
3834
|
+
};
|
|
3835
|
+
var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
|
|
3836
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3837
|
+
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");
|
|
3838
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3839
|
+
};
|
|
3840
|
+
var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
|
|
3841
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3842
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3843
|
+
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");
|
|
3844
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3845
|
+
};
|
|
3846
|
+
var _ConversationConnector_instances, _ConversationConnector_connectionListeners, _ConversationConnector_listenTo, _ConversationConnector_emitConnectionState;
|
|
3847
|
+
|
|
3848
|
+
|
|
3849
|
+
|
|
3850
|
+
|
|
3851
|
+
const log = debug_default()('seamly');
|
|
3852
|
+
// Subscribers set which are used to subscribe to changes in the conversation.
|
|
3853
|
+
// Needs to be outside of the ConversationConnector class so its not recreated for each instance.
|
|
3854
|
+
const subscribers = new Set();
|
|
3855
|
+
// Syncs the lifecycle of the conversation with Preact. Each subscriber will fetch the latest value from the conversation if needed.
|
|
3856
|
+
const emitChange = () => {
|
|
3857
|
+
// Call the callback function for each subscriber
|
|
3858
|
+
subscribers.forEach(callback => callback());
|
|
3859
|
+
};
|
|
3860
|
+
class ConversationConnector {
|
|
3861
|
+
constructor() {
|
|
3862
|
+
_ConversationConnector_instances.add(this);
|
|
3863
|
+
_ConversationConnector_connectionListeners.set(this, []);
|
|
3864
|
+
}
|
|
3865
|
+
connect(url, channelName, channelTopic, accessToken) {
|
|
3866
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3867
|
+
this.url = url;
|
|
3868
|
+
this.accessToken = accessToken;
|
|
3869
|
+
this.channelName = channelName;
|
|
3870
|
+
this.channelTopic = channelTopic;
|
|
3871
|
+
const {
|
|
3872
|
+
url: splittedUrl,
|
|
3873
|
+
params
|
|
3874
|
+
} = splitUrlParams(this.url);
|
|
3875
|
+
this.socket = new Socket(splittedUrl, {
|
|
3876
|
+
params: Object.assign(Object.assign({}, params), {
|
|
3877
|
+
v: apiVersion
|
|
3878
|
+
}),
|
|
3879
|
+
reconnectAfterMs: tries => {
|
|
3880
|
+
// Calculate the backoff time based on the number of tries.
|
|
3881
|
+
const backoff = Math.pow(2, tries) * 250;
|
|
3882
|
+
// Limit the backoff time to 10 seconds.
|
|
3883
|
+
return Math.min(backoff, 10000);
|
|
3884
|
+
}
|
|
3885
|
+
});
|
|
3886
|
+
this.socket.onError(err => {
|
|
3887
|
+
log('[SOCKET][ERROR]', err);
|
|
3888
|
+
});
|
|
3889
|
+
this.socket.onOpen(() => {
|
|
3890
|
+
log('[SOCKET]OPEN');
|
|
3891
|
+
});
|
|
3892
|
+
this.socket.onClose(() => {
|
|
3893
|
+
log('[SOCKET]CLOSE');
|
|
3894
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3895
|
+
connected: false,
|
|
3896
|
+
ready: false,
|
|
3897
|
+
currentState: 'socket_closed'
|
|
3898
|
+
});
|
|
3899
|
+
});
|
|
3900
|
+
this.socket.connect();
|
|
3901
|
+
this.channel = this.socket.channel(this.channelTopic, {
|
|
3902
|
+
authorization: `Bearer ${this.accessToken}`,
|
|
3903
|
+
channelName: this.channelName
|
|
3904
|
+
});
|
|
3905
|
+
this.start();
|
|
3906
|
+
this.channel.on('system', msg => {
|
|
3907
|
+
switch (msg.type) {
|
|
3908
|
+
case 'attach_channel_succeeded':
|
|
3909
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3910
|
+
connected: true,
|
|
3911
|
+
ready: true,
|
|
3912
|
+
currentState: 'attach_channel_succeeded'
|
|
3913
|
+
});
|
|
3914
|
+
break;
|
|
3915
|
+
}
|
|
3916
|
+
});
|
|
3917
|
+
this.channel.onClose(() => {
|
|
3918
|
+
log('[CHANNEL]CLOSE');
|
|
3919
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3920
|
+
connected: false,
|
|
3921
|
+
ready: false,
|
|
3922
|
+
currentState: 'channel_closed'
|
|
3923
|
+
});
|
|
3924
|
+
});
|
|
3925
|
+
this.channel.onError(msg => {
|
|
3926
|
+
log('[CHANNEL][ERROR]', msg);
|
|
3927
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3928
|
+
connected: false,
|
|
3929
|
+
ready: false,
|
|
3930
|
+
currentState: 'channel_erred'
|
|
3931
|
+
});
|
|
3932
|
+
});
|
|
3933
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_listenTo).call(this, 'ack', 'ui', 'error', 'participant', 'message', 'service_data', 'system', 'info', 'sync');
|
|
3934
|
+
});
|
|
3935
|
+
}
|
|
3936
|
+
start() {
|
|
3937
|
+
this.channel.join().receive('ok', () => {
|
|
3938
|
+
log('[CHANNEL][JOIN] OK');
|
|
3939
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3940
|
+
connected: true,
|
|
3941
|
+
ready: false,
|
|
3942
|
+
currentState: 'join_channel_succeeded'
|
|
3943
|
+
});
|
|
3944
|
+
}).receive('error', err => {
|
|
3945
|
+
log('[CHANNEL][JOIN] ERROR', err);
|
|
3946
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
3947
|
+
connected: false,
|
|
3948
|
+
ready: false,
|
|
3949
|
+
currentState: 'join_channel_erred'
|
|
3950
|
+
});
|
|
3951
|
+
}).receive('timeout', () => {
|
|
3952
|
+
log('[CHANEL][JOIN] Networking issue. Still waiting...');
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
disconnect() {
|
|
3956
|
+
var _a;
|
|
3957
|
+
(_a = this.channel) === null || _a === void 0 ? void 0 : _a.leave().receive('ok', () => {
|
|
3958
|
+
var _a;
|
|
3959
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
3960
|
+
log('[CHANNEL][LEAVE] OK');
|
|
3961
|
+
__classPrivateFieldSet(this, _ConversationConnector_connectionListeners, [], "f");
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
onConnection(cb) {
|
|
3965
|
+
__classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").push(cb);
|
|
3966
|
+
}
|
|
3967
|
+
pushToChannel(command, payload, timeout = 10000) {
|
|
3968
|
+
this.channel.push(command, payload, timeout);
|
|
3969
|
+
}
|
|
3970
|
+
// Adds a callback function to the subscribers set and returns a method to unsubscribe from the store.
|
|
3971
|
+
// This method is used to sync the state with the lifecycle of Preact.
|
|
3972
|
+
static subscribe(callback) {
|
|
3973
|
+
subscribers.add(callback);
|
|
3974
|
+
// Returns a function that removes the callback from the subscribers set.
|
|
3975
|
+
return () => subscribers.delete(callback);
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3978
|
+
_ConversationConnector_connectionListeners = new WeakMap(), _ConversationConnector_instances = new WeakSet(), _ConversationConnector_listenTo = function _ConversationConnector_listenTo(...types) {
|
|
3979
|
+
types.forEach(type => {
|
|
3980
|
+
this.channel.on(type, msg => {
|
|
3981
|
+
log('[RECEIVE]', type, msg);
|
|
3982
|
+
});
|
|
3983
|
+
});
|
|
3984
|
+
}, _ConversationConnector_emitConnectionState = function _ConversationConnector_emitConnectionState(payload) {
|
|
3985
|
+
__classPrivateFieldSet(this, _ConversationConnector_connectionListeners, __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").filter(item => {
|
|
3986
|
+
const complete = item(payload);
|
|
3987
|
+
// If we only want to execute the callback once, remove it from the listener
|
|
3988
|
+
return !complete;
|
|
3989
|
+
}), "f");
|
|
3990
|
+
emitChange();
|
|
3991
|
+
};
|
|
3992
|
+
/* harmony default export */ const conversation_connector = ((/* unused pure expression or super */ null && (ConversationConnector)));
|
|
3993
|
+
|
|
3994
|
+
/***/ }),
|
|
3995
|
+
|
|
2645
3996
|
/***/ 9787:
|
|
2646
3997
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2647
3998
|
|
|
3999
|
+
"use strict";
|
|
2648
4000
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2649
4001
|
/* harmony export */ CP: () => (/* binding */ maxCharacterSrDebounceDelay),
|
|
2650
4002
|
/* harmony export */ IA: () => (/* binding */ maxCharacterWarningLimit),
|
|
@@ -2694,6 +4046,7 @@ const defaultConfig = {
|
|
|
2694
4046
|
/***/ 526:
|
|
2695
4047
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2696
4048
|
|
|
4049
|
+
"use strict";
|
|
2697
4050
|
|
|
2698
4051
|
// EXPORTS
|
|
2699
4052
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -2901,6 +4254,7 @@ const resetApp = create_debounced_async_thunk('resetApp', (_, {
|
|
|
2901
4254
|
/***/ 4062:
|
|
2902
4255
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2903
4256
|
|
|
4257
|
+
"use strict";
|
|
2904
4258
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2905
4259
|
/* harmony export */ t: () => (/* binding */ selectUserHasResponded)
|
|
2906
4260
|
/* harmony export */ });
|
|
@@ -2917,6 +4271,7 @@ const selectUserHasResponded = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
2917
4271
|
/***/ 1322:
|
|
2918
4272
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2919
4273
|
|
|
4274
|
+
"use strict";
|
|
2920
4275
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2921
4276
|
/* harmony export */ oT: () => (/* binding */ setHasResponded)
|
|
2922
4277
|
/* harmony export */ });
|
|
@@ -2959,6 +4314,7 @@ const {
|
|
|
2959
4314
|
/***/ 257:
|
|
2960
4315
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2961
4316
|
|
|
4317
|
+
"use strict";
|
|
2962
4318
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2963
4319
|
/* harmony export */ I: () => (/* binding */ resetConfig),
|
|
2964
4320
|
/* harmony export */ t: () => (/* binding */ initializeConfig)
|
|
@@ -3040,6 +4396,7 @@ const resetConfig = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .createAs
|
|
|
3040
4396
|
/***/ 6134:
|
|
3041
4397
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3042
4398
|
|
|
4399
|
+
"use strict";
|
|
3043
4400
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3044
4401
|
/* harmony export */ R4: () => (/* binding */ useStartChatIcon),
|
|
3045
4402
|
/* harmony export */ ZR: () => (/* binding */ useConfig)
|
|
@@ -3072,6 +4429,7 @@ function useStartChatIcon() {
|
|
|
3072
4429
|
/***/ 9052:
|
|
3073
4430
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3074
4431
|
|
|
4432
|
+
"use strict";
|
|
3075
4433
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3076
4434
|
/* harmony export */ $: () => (/* binding */ selectConfig)
|
|
3077
4435
|
/* harmony export */ });
|
|
@@ -3099,6 +4457,7 @@ const selectConfig = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_1__/* .createS
|
|
|
3099
4457
|
/***/ 3701:
|
|
3100
4458
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3101
4459
|
|
|
4460
|
+
"use strict";
|
|
3102
4461
|
/* unused harmony exports initialConfigState, configSlice, setConfig, updateConfig, setPreChatEvents */
|
|
3103
4462
|
/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9639);
|
|
3104
4463
|
/* harmony import */ var config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9787);
|
|
@@ -3208,6 +4567,7 @@ const {
|
|
|
3208
4567
|
/***/ 9792:
|
|
3209
4568
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3210
4569
|
|
|
4570
|
+
"use strict";
|
|
3211
4571
|
/* unused harmony exports catchError, createErrorsMiddleware */
|
|
3212
4572
|
/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9639);
|
|
3213
4573
|
/* harmony import */ var api_errors_seamly_configuration_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5863);
|
|
@@ -3293,6 +4653,7 @@ function createErrorsMiddleware({
|
|
|
3293
4653
|
/***/ 3939:
|
|
3294
4654
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3295
4655
|
|
|
4656
|
+
"use strict";
|
|
3296
4657
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3297
4658
|
/* harmony export */ SJ: () => (/* binding */ deregisterControl),
|
|
3298
4659
|
/* harmony export */ SL: () => (/* binding */ updateControlTouched),
|
|
@@ -3420,6 +4781,7 @@ const {
|
|
|
3420
4781
|
/***/ 5409:
|
|
3421
4782
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3422
4783
|
|
|
4784
|
+
"use strict";
|
|
3423
4785
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3424
4786
|
/* harmony export */ i: () => (/* binding */ setLocale)
|
|
3425
4787
|
/* harmony export */ });
|
|
@@ -3490,6 +4852,7 @@ const setLocale = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .createAsyn
|
|
|
3490
4852
|
/***/ 5962:
|
|
3491
4853
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3492
4854
|
|
|
4855
|
+
"use strict";
|
|
3493
4856
|
|
|
3494
4857
|
// EXPORTS
|
|
3495
4858
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -4197,6 +5560,7 @@ function useI18n() {
|
|
|
4197
5560
|
/***/ 3376:
|
|
4198
5561
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4199
5562
|
|
|
5563
|
+
"use strict";
|
|
4200
5564
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4201
5565
|
/* harmony export */ SS: () => (/* binding */ selectInitialLocale),
|
|
4202
5566
|
/* harmony export */ fN: () => (/* binding */ selectLocale),
|
|
@@ -4231,6 +5595,7 @@ const selectIsLoading = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .crea
|
|
|
4231
5595
|
/***/ 5889:
|
|
4232
5596
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4233
5597
|
|
|
5598
|
+
"use strict";
|
|
4234
5599
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4235
5600
|
/* harmony export */ i: () => (/* binding */ useInterrupt)
|
|
4236
5601
|
/* harmony export */ });
|
|
@@ -4291,6 +5656,7 @@ function useInterrupt() {
|
|
|
4291
5656
|
/***/ 542:
|
|
4292
5657
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4293
5658
|
|
|
5659
|
+
"use strict";
|
|
4294
5660
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4295
5661
|
/* harmony export */ A: () => (/* binding */ selectHasError),
|
|
4296
5662
|
/* harmony export */ z: () => (/* binding */ selectError)
|
|
@@ -4309,6 +5675,7 @@ const selectHasError = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .creat
|
|
|
4309
5675
|
/***/ 6160:
|
|
4310
5676
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4311
5677
|
|
|
5678
|
+
"use strict";
|
|
4312
5679
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4313
5680
|
/* harmony export */ uc: () => (/* binding */ setInterrupt)
|
|
4314
5681
|
/* harmony export */ });
|
|
@@ -4356,6 +5723,7 @@ const {
|
|
|
4356
5723
|
/***/ 2770:
|
|
4357
5724
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4358
5725
|
|
|
5726
|
+
"use strict";
|
|
4359
5727
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4360
5728
|
/* harmony export */ c: () => (/* binding */ getConversation)
|
|
4361
5729
|
/* harmony export */ });
|
|
@@ -4427,6 +5795,7 @@ const getConversation = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/* .crea
|
|
|
4427
5795
|
/***/ 7271:
|
|
4428
5796
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4429
5797
|
|
|
5798
|
+
"use strict";
|
|
4430
5799
|
|
|
4431
5800
|
// EXPORTS
|
|
4432
5801
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -4684,6 +6053,7 @@ const useAppDispatch = es/* useDispatch */.I0;
|
|
|
4684
6053
|
/***/ 8801:
|
|
4685
6054
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4686
6055
|
|
|
6056
|
+
"use strict";
|
|
4687
6057
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4688
6058
|
/* harmony export */ D3: () => (/* binding */ clearAbortTransaction),
|
|
4689
6059
|
/* harmony export */ Ed: () => (/* binding */ setSeamlyContainerElement),
|
|
@@ -5343,6 +6713,7 @@ const {
|
|
|
5343
6713
|
/***/ 4398:
|
|
5344
6714
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5345
6715
|
|
|
6716
|
+
"use strict";
|
|
5346
6717
|
|
|
5347
6718
|
// EXPORTS
|
|
5348
6719
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -5535,6 +6906,7 @@ const useTranslationProposal = () => {
|
|
|
5535
6906
|
/***/ 2659:
|
|
5536
6907
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5537
6908
|
|
|
6909
|
+
"use strict";
|
|
5538
6910
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5539
6911
|
/* harmony export */ CT: () => (/* binding */ enableEventsTranslation),
|
|
5540
6912
|
/* harmony export */ E8: () => (/* binding */ disableEventsTranslation),
|
|
@@ -5683,6 +7055,7 @@ const {
|
|
|
5683
7055
|
/***/ 9586:
|
|
5684
7056
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5685
7057
|
|
|
7058
|
+
"use strict";
|
|
5686
7059
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5687
7060
|
/* harmony export */ Z: () => (/* binding */ initializeVisibility),
|
|
5688
7061
|
/* harmony export */ i: () => (/* binding */ setVisibility)
|
|
@@ -5798,6 +7171,7 @@ const initializeVisibility = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_6__/*
|
|
|
5798
7171
|
/***/ 1878:
|
|
5799
7172
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5800
7173
|
|
|
7174
|
+
"use strict";
|
|
5801
7175
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5802
7176
|
/* harmony export */ K: () => (/* binding */ StoreKey),
|
|
5803
7177
|
/* harmony export */ T: () => (/* binding */ visibilityStates)
|
|
@@ -5815,6 +7189,7 @@ const visibilityStates = {
|
|
|
5815
7189
|
/***/ 6082:
|
|
5816
7190
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5817
7191
|
|
|
7192
|
+
"use strict";
|
|
5818
7193
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5819
7194
|
/* harmony export */ U5: () => (/* binding */ useIntersect),
|
|
5820
7195
|
/* harmony export */ g0: () => (/* binding */ useShowInlineView),
|
|
@@ -5923,6 +7298,7 @@ const useShowInlineView = () => {
|
|
|
5923
7298
|
/***/ 703:
|
|
5924
7299
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5925
7300
|
|
|
7301
|
+
"use strict";
|
|
5926
7302
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5927
7303
|
/* harmony export */ b: () => (/* binding */ selectShowInlineView),
|
|
5928
7304
|
/* harmony export */ q: () => (/* binding */ selectVisibility)
|
|
@@ -5941,6 +7317,7 @@ const selectShowInlineView = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
5941
7317
|
/***/ 3913:
|
|
5942
7318
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5943
7319
|
|
|
7320
|
+
"use strict";
|
|
5944
7321
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5945
7322
|
/* harmony export */ je: () => (/* binding */ setShowInlineView)
|
|
5946
7323
|
/* harmony export */ });
|
|
@@ -5992,6 +7369,7 @@ const {
|
|
|
5992
7369
|
/***/ 2871:
|
|
5993
7370
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5994
7371
|
|
|
7372
|
+
"use strict";
|
|
5995
7373
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5996
7374
|
/* harmony export */ T: () => (/* binding */ SeamlyEventBusContext),
|
|
5997
7375
|
/* harmony export */ a: () => (/* binding */ SeamlyApiContext)
|
|
@@ -6007,6 +7385,7 @@ const SeamlyEventBusContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createConte
|
|
|
6007
7385
|
/***/ 8048:
|
|
6008
7386
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6009
7387
|
|
|
7388
|
+
"use strict";
|
|
6010
7389
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6011
7390
|
/* harmony export */ eu: () => (/* binding */ useSeamlyObjectStore),
|
|
6012
7391
|
/* harmony export */ iW: () => (/* binding */ useSeamlyHasConversation),
|
|
@@ -6045,6 +7424,7 @@ const useSeamlyHasConversation = () => {
|
|
|
6045
7424
|
/***/ 2140:
|
|
6046
7425
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6047
7426
|
|
|
7427
|
+
"use strict";
|
|
6048
7428
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6049
7429
|
/* harmony export */ AR: () => (/* binding */ useSeamlyCurrentAgent),
|
|
6050
7430
|
/* harmony export */ FL: () => (/* binding */ useSeamlyIsLoading),
|
|
@@ -6189,6 +7569,7 @@ const useSeamlyLayoutMode = () => {
|
|
|
6189
7569
|
/***/ 497:
|
|
6190
7570
|
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
|
6191
7571
|
|
|
7572
|
+
"use strict";
|
|
6192
7573
|
|
|
6193
7574
|
// UNUSED EXPORTS: default
|
|
6194
7575
|
|
|
@@ -6373,9 +7754,30 @@ const useSeamlyChat = () => {
|
|
|
6373
7754
|
|
|
6374
7755
|
/***/ }),
|
|
6375
7756
|
|
|
7757
|
+
/***/ 1813:
|
|
7758
|
+
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
|
7759
|
+
|
|
7760
|
+
"use strict";
|
|
7761
|
+
/* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6546);
|
|
7762
|
+
/* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_0__);
|
|
7763
|
+
/* harmony import */ var api_conversation_connector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1541);
|
|
7764
|
+
/* harmony import */ var _seamly_api_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8048);
|
|
7765
|
+
|
|
7766
|
+
|
|
7767
|
+
|
|
7768
|
+
const useSeamlyConversation = () => {
|
|
7769
|
+
const api = useSeamlyApiContext();
|
|
7770
|
+
const getSnapshot = () => api.conversation;
|
|
7771
|
+
return useSyncExternalStore(ConversationConnector.subscribe, getSnapshot);
|
|
7772
|
+
};
|
|
7773
|
+
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (useSeamlyConversation)));
|
|
7774
|
+
|
|
7775
|
+
/***/ }),
|
|
7776
|
+
|
|
6376
7777
|
/***/ 1149:
|
|
6377
7778
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6378
7779
|
|
|
7780
|
+
"use strict";
|
|
6379
7781
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6380
7782
|
/* harmony export */ Hp: () => (/* binding */ actionTypes),
|
|
6381
7783
|
/* harmony export */ N$: () => (/* binding */ dismissTypes),
|
|
@@ -6467,6 +7869,7 @@ const cardTypes = {
|
|
|
6467
7869
|
/***/ 3866:
|
|
6468
7870
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6469
7871
|
|
|
7872
|
+
"use strict";
|
|
6470
7873
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6471
7874
|
/* harmony export */ Z: () => (/* binding */ SeamlyBaseError)
|
|
6472
7875
|
/* harmony export */ });
|
|
@@ -6507,6 +7910,7 @@ class SeamlyBaseError extends Error {
|
|
|
6507
7910
|
/***/ 5863:
|
|
6508
7911
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6509
7912
|
|
|
7913
|
+
"use strict";
|
|
6510
7914
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6511
7915
|
/* harmony export */ Z: () => (/* binding */ SeamlyConfigurationError)
|
|
6512
7916
|
/* harmony export */ });
|
|
@@ -6525,6 +7929,7 @@ class SeamlyConfigurationError extends _seamly_base_error__WEBPACK_IMPORTED_MODU
|
|
|
6525
7929
|
/***/ 5332:
|
|
6526
7930
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6527
7931
|
|
|
7932
|
+
"use strict";
|
|
6528
7933
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6529
7934
|
/* harmony export */ Z: () => (/* binding */ SeamlyGeneralError)
|
|
6530
7935
|
/* harmony export */ });
|
|
@@ -6544,6 +7949,7 @@ class SeamlyGeneralError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE_0__
|
|
|
6544
7949
|
/***/ 3243:
|
|
6545
7950
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6546
7951
|
|
|
7952
|
+
"use strict";
|
|
6547
7953
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6548
7954
|
/* harmony export */ Z: () => (/* binding */ SeamlyOfflineError)
|
|
6549
7955
|
/* harmony export */ });
|
|
@@ -6562,6 +7968,7 @@ class SeamlyOfflineError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE_0__
|
|
|
6562
7968
|
/***/ 6821:
|
|
6563
7969
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6564
7970
|
|
|
7971
|
+
"use strict";
|
|
6565
7972
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6566
7973
|
/* harmony export */ Z: () => (/* binding */ SeamlySessionExpiredError)
|
|
6567
7974
|
/* harmony export */ });
|
|
@@ -6580,6 +7987,7 @@ class SeamlySessionExpiredError extends _seamly_base_error__WEBPACK_IMPORTED_MOD
|
|
|
6580
7987
|
/***/ 2332:
|
|
6581
7988
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6582
7989
|
|
|
7990
|
+
"use strict";
|
|
6583
7991
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6584
7992
|
/* harmony export */ Z: () => (/* binding */ SeamlyUnauthorizedError)
|
|
6585
7993
|
/* harmony export */ });
|
|
@@ -6599,6 +8007,7 @@ class SeamlyUnauthorizedError extends _seamly_base_error__WEBPACK_IMPORTED_MODUL
|
|
|
6599
8007
|
/***/ 7265:
|
|
6600
8008
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6601
8009
|
|
|
8010
|
+
"use strict";
|
|
6602
8011
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6603
8012
|
/* harmony export */ Z: () => (/* binding */ SeamlyUnavailableError)
|
|
6604
8013
|
/* harmony export */ });
|
|
@@ -6623,6 +8032,7 @@ class SeamlyUnavailableError extends _seamly_base_error__WEBPACK_IMPORTED_MODULE
|
|
|
6623
8032
|
/***/ 3423:
|
|
6624
8033
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6625
8034
|
|
|
8035
|
+
"use strict";
|
|
6626
8036
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6627
8037
|
/* harmony export */ h: () => (/* binding */ useUserHasResponded)
|
|
6628
8038
|
/* harmony export */ });
|
|
@@ -6637,6 +8047,7 @@ const useUserHasResponded = () => (0,react_redux__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
6637
8047
|
/***/ 6989:
|
|
6638
8048
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6639
8049
|
|
|
8050
|
+
"use strict";
|
|
6640
8051
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6641
8052
|
/* harmony export */ F: () => (/* binding */ calculateVisibility)
|
|
6642
8053
|
/* harmony export */ });
|
|
@@ -6681,6 +8092,7 @@ const calculateVisibility = ({
|
|
|
6681
8092
|
/***/ 2:
|
|
6682
8093
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6683
8094
|
|
|
8095
|
+
"use strict";
|
|
6684
8096
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6685
8097
|
/* harmony export */ o: () => (/* binding */ className)
|
|
6686
8098
|
/* harmony export */ });
|
|
@@ -6709,9 +8121,20 @@ const className = (...classes) => classes.flat().map(c => {
|
|
|
6709
8121
|
|
|
6710
8122
|
/***/ }),
|
|
6711
8123
|
|
|
8124
|
+
/***/ 7008:
|
|
8125
|
+
/***/ ((module) => {
|
|
8126
|
+
|
|
8127
|
+
if (false) {} else {
|
|
8128
|
+
// eslint-disable-next-line react/display-name
|
|
8129
|
+
module.exports = () => () => null;
|
|
8130
|
+
}
|
|
8131
|
+
|
|
8132
|
+
/***/ }),
|
|
8133
|
+
|
|
6712
8134
|
/***/ 8527:
|
|
6713
8135
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6714
8136
|
|
|
8137
|
+
"use strict";
|
|
6715
8138
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6716
8139
|
/* harmony export */ k: () => (/* binding */ randomId)
|
|
6717
8140
|
/* harmony export */ });
|
|
@@ -6724,6 +8147,7 @@ function randomId() {
|
|
|
6724
8147
|
/***/ 2520:
|
|
6725
8148
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6726
8149
|
|
|
8150
|
+
"use strict";
|
|
6727
8151
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6728
8152
|
/* harmony export */ useTranslatedEventData: () => (/* reexport safe */ domains_translations_hooks__WEBPACK_IMPORTED_MODULE_7__.JL)
|
|
6729
8153
|
/* harmony export */ });
|
|
@@ -6750,6 +8174,7 @@ function randomId() {
|
|
|
6750
8174
|
/***/ 9404:
|
|
6751
8175
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6752
8176
|
|
|
8177
|
+
"use strict";
|
|
6753
8178
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6754
8179
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6755
8180
|
/* harmony export */ });
|
|
@@ -6916,6 +8341,7 @@ const ChoicePrompt = ({
|
|
|
6916
8341
|
/***/ 149:
|
|
6917
8342
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6918
8343
|
|
|
8344
|
+
"use strict";
|
|
6919
8345
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6920
8346
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6921
8347
|
/* harmony export */ });
|
|
@@ -6981,6 +8407,7 @@ const EventParticipant = ({
|
|
|
6981
8407
|
/***/ 2480:
|
|
6982
8408
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6983
8409
|
|
|
8410
|
+
"use strict";
|
|
6984
8411
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6985
8412
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6986
8413
|
/* harmony export */ });
|
|
@@ -7063,6 +8490,7 @@ function MessageContainer({
|
|
|
7063
8490
|
/***/ 7057:
|
|
7064
8491
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7065
8492
|
|
|
8493
|
+
"use strict";
|
|
7066
8494
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7067
8495
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7068
8496
|
/* harmony export */ });
|
|
@@ -7077,6 +8505,7 @@ const SeamlyActivityEventContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.create
|
|
|
7077
8505
|
/***/ 1884:
|
|
7078
8506
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7079
8507
|
|
|
8508
|
+
"use strict";
|
|
7080
8509
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7081
8510
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7082
8511
|
/* harmony export */ });
|
|
@@ -7091,6 +8520,7 @@ const SeamlyFileUploadContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createCon
|
|
|
7091
8520
|
/***/ 9761:
|
|
7092
8521
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7093
8522
|
|
|
8523
|
+
"use strict";
|
|
7094
8524
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7095
8525
|
/* harmony export */ _: () => (/* binding */ SeamlyLiveRegionContext)
|
|
7096
8526
|
/* harmony export */ });
|
|
@@ -7104,6 +8534,7 @@ const SeamlyLiveRegionContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createCon
|
|
|
7104
8534
|
/***/ 7054:
|
|
7105
8535
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7106
8536
|
|
|
8537
|
+
"use strict";
|
|
7107
8538
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7108
8539
|
/* harmony export */ P: () => (/* binding */ useSeamlyAppContainerClassNames),
|
|
7109
8540
|
/* harmony export */ j: () => (/* binding */ useSeamlyMessageContainerClassNames)
|
|
@@ -7133,6 +8564,7 @@ const useSeamlyMessageContainerClassNames = event => {
|
|
|
7133
8564
|
/***/ 764:
|
|
7134
8565
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7135
8566
|
|
|
8567
|
+
"use strict";
|
|
7136
8568
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7137
8569
|
/* harmony export */ MI: () => (/* binding */ useSkiplinkTargetFocusing),
|
|
7138
8570
|
/* harmony export */ Vs: () => (/* binding */ timeout),
|
|
@@ -7195,6 +8627,7 @@ const useFocusIfSeamlyContainedFocus = () => {
|
|
|
7195
8627
|
/***/ 5136:
|
|
7196
8628
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7197
8629
|
|
|
8630
|
+
"use strict";
|
|
7198
8631
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7199
8632
|
/* harmony export */ t: () => (/* binding */ useLiveRegion)
|
|
7200
8633
|
/* harmony export */ });
|
|
@@ -7234,6 +8667,7 @@ const useLiveRegion = () => {
|
|
|
7234
8667
|
/***/ 9470:
|
|
7235
8668
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7236
8669
|
|
|
8670
|
+
"use strict";
|
|
7237
8671
|
|
|
7238
8672
|
// EXPORTS
|
|
7239
8673
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -7268,8 +8702,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
7268
8702
|
|
|
7269
8703
|
// EXTERNAL MODULE: external "preact/hooks"
|
|
7270
8704
|
var hooks_ = __webpack_require__(9207);
|
|
7271
|
-
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-
|
|
7272
|
-
var
|
|
8705
|
+
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/use-seamly-conversation.ts
|
|
8706
|
+
var use_seamly_conversation = __webpack_require__(1813);
|
|
7273
8707
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/focus-helper-hooks.js
|
|
7274
8708
|
var focus_helper_hooks = __webpack_require__(764);
|
|
7275
8709
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/component-helper-hooks.js
|
|
@@ -7355,6 +8789,8 @@ const useFileUploads = () => {
|
|
|
7355
8789
|
};
|
|
7356
8790
|
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/live-region-hooks.js
|
|
7357
8791
|
var live_region_hooks = __webpack_require__(5136);
|
|
8792
|
+
// EXTERNAL MODULE: ./src/javascripts/ui/hooks/seamly-api-hooks.ts
|
|
8793
|
+
var seamly_api_hooks = __webpack_require__(8048);
|
|
7358
8794
|
// EXTERNAL MODULE: ./src/javascripts/domains/i18n/hooks.ts + 11 modules
|
|
7359
8795
|
var hooks = __webpack_require__(5962);
|
|
7360
8796
|
;// CONCATENATED MODULE: ./src/javascripts/ui/hooks/seamly-option-hooks.js
|
|
@@ -7490,12 +8926,12 @@ var utility_hooks = __webpack_require__(7750);
|
|
|
7490
8926
|
// and imported directly from this file
|
|
7491
8927
|
// Please do not remove
|
|
7492
8928
|
const useSeamlyEventStream = (nextFn, filterFn) => {
|
|
7493
|
-
const
|
|
8929
|
+
const conversation = useSeamlyConversation();
|
|
7494
8930
|
useEffect(() => {
|
|
7495
|
-
if (
|
|
8931
|
+
if (conversation.channel) {
|
|
7496
8932
|
const {
|
|
7497
8933
|
channel
|
|
7498
|
-
} =
|
|
8934
|
+
} = conversation;
|
|
7499
8935
|
channel.onMessage = (type, payload) => {
|
|
7500
8936
|
if (!filterFn || filterFn({
|
|
7501
8937
|
type,
|
|
@@ -7509,7 +8945,7 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
|
|
|
7509
8945
|
return payload;
|
|
7510
8946
|
};
|
|
7511
8947
|
}
|
|
7512
|
-
}, [nextFn, filterFn,
|
|
8948
|
+
}, [nextFn, filterFn, conversation]);
|
|
7513
8949
|
};
|
|
7514
8950
|
|
|
7515
8951
|
/***/ }),
|
|
@@ -7517,6 +8953,7 @@ const useSeamlyEventStream = (nextFn, filterFn) => {
|
|
|
7517
8953
|
/***/ 2477:
|
|
7518
8954
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7519
8955
|
|
|
8956
|
+
"use strict";
|
|
7520
8957
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7521
8958
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7522
8959
|
/* harmony export */ });
|
|
@@ -7533,6 +8970,7 @@ const useSeamlyActivityEventHandler = () => (0,preact_hooks__WEBPACK_IMPORTED_MO
|
|
|
7533
8970
|
/***/ 1181:
|
|
7534
8971
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7535
8972
|
|
|
8973
|
+
"use strict";
|
|
7536
8974
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7537
8975
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7538
8976
|
/* harmony export */ });
|
|
@@ -7748,6 +9186,7 @@ const useSeamlyCommands = () => {
|
|
|
7748
9186
|
/***/ 6532:
|
|
7749
9187
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7750
9188
|
|
|
9189
|
+
"use strict";
|
|
7751
9190
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7752
9191
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7753
9192
|
/* harmony export */ });
|
|
@@ -7890,6 +9329,7 @@ const useSeamlyIdleDetachCountdown = () => {
|
|
|
7890
9329
|
/***/ 960:
|
|
7891
9330
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7892
9331
|
|
|
9332
|
+
"use strict";
|
|
7893
9333
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7894
9334
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
7895
9335
|
/* harmony export */ });
|
|
@@ -7948,6 +9388,7 @@ const useSeamlyResumeConversationPrompt = () => {
|
|
|
7948
9388
|
/***/ 7750:
|
|
7949
9389
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7950
9390
|
|
|
9391
|
+
"use strict";
|
|
7951
9392
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7952
9393
|
/* harmony export */ I8: () => (/* binding */ useGeneratedId),
|
|
7953
9394
|
/* harmony export */ NW: () => (/* binding */ useForceUpdate),
|
|
@@ -7987,6 +9428,7 @@ const useStableCallback = callback => {
|
|
|
7987
9428
|
/***/ 822:
|
|
7988
9429
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7989
9430
|
|
|
9431
|
+
"use strict";
|
|
7990
9432
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7991
9433
|
/* harmony export */ C5: () => (/* binding */ focusElement),
|
|
7992
9434
|
/* harmony export */ DC: () => (/* binding */ getRelativeDate),
|
|
@@ -8155,6 +9597,7 @@ const omit = (obj, keys) => Object.keys(obj).reduce((accum, key) => {
|
|
|
8155
9597
|
/***/ 8679:
|
|
8156
9598
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
8157
9599
|
|
|
9600
|
+
"use strict";
|
|
8158
9601
|
|
|
8159
9602
|
|
|
8160
9603
|
var reactIs = __webpack_require__(9864);
|
|
@@ -8265,6 +9708,7 @@ module.exports = hoistNonReactStatics;
|
|
|
8265
9708
|
/***/ 8661:
|
|
8266
9709
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8267
9710
|
|
|
9711
|
+
"use strict";
|
|
8268
9712
|
__webpack_require__.r(__webpack_exports__);
|
|
8269
9713
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8270
9714
|
/* harmony export */ Children: () => (/* binding */ O),
|
|
@@ -8315,6 +9759,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
|
|
|
8315
9759
|
/***/ 9921:
|
|
8316
9760
|
/***/ ((__unused_webpack_module, exports) => {
|
|
8317
9761
|
|
|
9762
|
+
"use strict";
|
|
8318
9763
|
/** @license React v16.13.1
|
|
8319
9764
|
* react-is.production.min.js
|
|
8320
9765
|
*
|
|
@@ -8337,6 +9782,7 @@ exports.isValidElementType=function(a){return"string"===typeof a||"function"===t
|
|
|
8337
9782
|
/***/ 9864:
|
|
8338
9783
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
8339
9784
|
|
|
9785
|
+
"use strict";
|
|
8340
9786
|
|
|
8341
9787
|
|
|
8342
9788
|
if (true) {
|
|
@@ -8349,6 +9795,7 @@ if (true) {
|
|
|
8349
9795
|
/***/ 3556:
|
|
8350
9796
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8351
9797
|
|
|
9798
|
+
"use strict";
|
|
8352
9799
|
|
|
8353
9800
|
// EXPORTS
|
|
8354
9801
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -9228,6 +10675,7 @@ initializeConnect(shim.useSyncExternalStore); // Enable batched updates in our s
|
|
|
9228
10675
|
/***/ 9256:
|
|
9229
10676
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9230
10677
|
|
|
10678
|
+
"use strict";
|
|
9231
10679
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9232
10680
|
/* harmony export */ F: () => (/* binding */ setBatch)
|
|
9233
10681
|
/* harmony export */ });
|
|
@@ -9248,6 +10696,7 @@ const getBatch = () => batch;
|
|
|
9248
10696
|
/***/ 8359:
|
|
9249
10697
|
/***/ ((__unused_webpack_module, exports) => {
|
|
9250
10698
|
|
|
10699
|
+
"use strict";
|
|
9251
10700
|
var __webpack_unused_export__;
|
|
9252
10701
|
/**
|
|
9253
10702
|
* @license React
|
|
@@ -9270,6 +10719,7 @@ __webpack_unused_export__=function(a){return"string"===typeof a||"function"===ty
|
|
|
9270
10719
|
/***/ 2973:
|
|
9271
10720
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
9272
10721
|
|
|
10722
|
+
"use strict";
|
|
9273
10723
|
|
|
9274
10724
|
|
|
9275
10725
|
if (true) {
|
|
@@ -9282,6 +10732,7 @@ if (true) {
|
|
|
9282
10732
|
/***/ 573:
|
|
9283
10733
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9284
10734
|
|
|
10735
|
+
"use strict";
|
|
9285
10736
|
|
|
9286
10737
|
// EXPORTS
|
|
9287
10738
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -9575,6 +11026,7 @@ var createStructuredSelector = function createStructuredSelector(selectors, sele
|
|
|
9575
11026
|
/***/ 2398:
|
|
9576
11027
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9577
11028
|
|
|
11029
|
+
"use strict";
|
|
9578
11030
|
|
|
9579
11031
|
// EXPORTS
|
|
9580
11032
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -9727,6 +11179,7 @@ const Icon = ({ name, size = '32', className, alt }) => ((0,jsx_runtime_.jsxs)(j
|
|
|
9727
11179
|
/***/ 3250:
|
|
9728
11180
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9729
11181
|
|
|
11182
|
+
"use strict";
|
|
9730
11183
|
/**
|
|
9731
11184
|
* @license React
|
|
9732
11185
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -9745,6 +11198,7 @@ function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f)
|
|
|
9745
11198
|
/***/ 139:
|
|
9746
11199
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9747
11200
|
|
|
11201
|
+
"use strict";
|
|
9748
11202
|
/**
|
|
9749
11203
|
* @license React
|
|
9750
11204
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -9764,6 +11218,7 @@ u(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};
|
|
|
9764
11218
|
/***/ 1688:
|
|
9765
11219
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
9766
11220
|
|
|
11221
|
+
"use strict";
|
|
9767
11222
|
|
|
9768
11223
|
|
|
9769
11224
|
if (true) {
|
|
@@ -9776,6 +11231,7 @@ if (true) {
|
|
|
9776
11231
|
/***/ 2798:
|
|
9777
11232
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
9778
11233
|
|
|
11234
|
+
"use strict";
|
|
9779
11235
|
|
|
9780
11236
|
|
|
9781
11237
|
if (true) {
|
|
@@ -9788,13 +11244,23 @@ if (true) {
|
|
|
9788
11244
|
/***/ 7210:
|
|
9789
11245
|
/***/ ((module) => {
|
|
9790
11246
|
|
|
11247
|
+
"use strict";
|
|
9791
11248
|
module.exports = require("preact");
|
|
9792
11249
|
|
|
9793
11250
|
/***/ }),
|
|
9794
11251
|
|
|
11252
|
+
/***/ 6546:
|
|
11253
|
+
/***/ ((module) => {
|
|
11254
|
+
|
|
11255
|
+
"use strict";
|
|
11256
|
+
module.exports = require("preact/compat");
|
|
11257
|
+
|
|
11258
|
+
/***/ }),
|
|
11259
|
+
|
|
9795
11260
|
/***/ 9207:
|
|
9796
11261
|
/***/ ((module) => {
|
|
9797
11262
|
|
|
11263
|
+
"use strict";
|
|
9798
11264
|
module.exports = require("preact/hooks");
|
|
9799
11265
|
|
|
9800
11266
|
/***/ }),
|
|
@@ -9802,6 +11268,7 @@ module.exports = require("preact/hooks");
|
|
|
9802
11268
|
/***/ 7844:
|
|
9803
11269
|
/***/ ((module) => {
|
|
9804
11270
|
|
|
11271
|
+
"use strict";
|
|
9805
11272
|
module.exports = require("preact/jsx-runtime");
|
|
9806
11273
|
|
|
9807
11274
|
/***/ }),
|
|
@@ -9809,6 +11276,7 @@ module.exports = require("preact/jsx-runtime");
|
|
|
9809
11276
|
/***/ 4942:
|
|
9810
11277
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
9811
11278
|
|
|
11279
|
+
"use strict";
|
|
9812
11280
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9813
11281
|
/* harmony export */ Z: () => (/* binding */ _defineProperty)
|
|
9814
11282
|
/* harmony export */ });
|
|
@@ -9834,6 +11302,7 @@ function _defineProperty(obj, key, value) {
|
|
|
9834
11302
|
/***/ 2881:
|
|
9835
11303
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
9836
11304
|
|
|
11305
|
+
"use strict";
|
|
9837
11306
|
|
|
9838
11307
|
// EXPORTS
|
|
9839
11308
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -9976,8 +11445,9 @@ function _toPropertyKey(arg) {
|
|
|
9976
11445
|
/******/
|
|
9977
11446
|
/************************************************************************/
|
|
9978
11447
|
var __webpack_exports__ = {};
|
|
9979
|
-
// This entry need to be wrapped in an IIFE because it need to be
|
|
11448
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
9980
11449
|
(() => {
|
|
11450
|
+
"use strict";
|
|
9981
11451
|
// ESM COMPAT FLAG
|
|
9982
11452
|
__webpack_require__.r(__webpack_exports__);
|
|
9983
11453
|
|
|
@@ -13284,8 +14754,8 @@ const ComponentFilter = ({
|
|
|
13284
14754
|
});
|
|
13285
14755
|
};
|
|
13286
14756
|
/* harmony default export */ const component_filter = (ComponentFilter);
|
|
13287
|
-
|
|
13288
|
-
|
|
14757
|
+
// EXTERNAL MODULE: external "preact/compat"
|
|
14758
|
+
var compat_ = __webpack_require__(6546);
|
|
13289
14759
|
;// CONCATENATED MODULE: ./src/javascripts/ui/components/conversation/event/chat-scroll/chat-scroll-context.ts
|
|
13290
14760
|
|
|
13291
14761
|
const ChatScrollContext = (0,external_preact_.createContext)(null);
|
|
@@ -13324,7 +14794,7 @@ const useEventComponentMapping = event => {
|
|
|
13324
14794
|
|
|
13325
14795
|
|
|
13326
14796
|
const Event = ({ event, newParticipant }) => {
|
|
13327
|
-
const { eventRefs, unreadIds } = (0,
|
|
14797
|
+
const { eventRefs, unreadIds } = (0,compat_.useContext)(chat_scroll_context);
|
|
13328
14798
|
const { sendAction } = (0,seamly_hooks/* useSeamlyCommands */.bs)();
|
|
13329
14799
|
const ref = eventRefs[event.payload.id];
|
|
13330
14800
|
const { containerRef, isVisible } = (0,visibility_hooks/* useIntersect */.U5)({
|
|
@@ -13333,7 +14803,7 @@ const Event = ({ event, newParticipant }) => {
|
|
|
13333
14803
|
});
|
|
13334
14804
|
const dispatch = (0,es/* useDispatch */.I0)();
|
|
13335
14805
|
const [Component, SubComponent] = use_event_component_mapping(event);
|
|
13336
|
-
(0,
|
|
14806
|
+
(0,compat_.useEffect)(() => {
|
|
13337
14807
|
if (isVisible && (unreadIds === null || unreadIds === void 0 ? void 0 : unreadIds.includes(event.payload.id))) {
|
|
13338
14808
|
const readIds = unreadIds.reduce((arr, id) => (!arr.includes(event.payload.id) ? arr.concat(id) : arr), []);
|
|
13339
14809
|
dispatch((0,store_slice/* setEventsRead */.LK)(readIds));
|
|
@@ -14970,7 +16440,7 @@ var component_helper_hooks = __webpack_require__(7054);
|
|
|
14970
16440
|
|
|
14971
16441
|
|
|
14972
16442
|
|
|
14973
|
-
const Chat = (0,
|
|
16443
|
+
const Chat = (0,compat_.forwardRef)(({
|
|
14974
16444
|
children,
|
|
14975
16445
|
className: givenClassName = ''
|
|
14976
16446
|
}, forwardedRef) => {
|
|
@@ -15467,7 +16937,7 @@ const TranslationOptions = ({ onChange, describedById, }) => {
|
|
|
15467
16937
|
onChange();
|
|
15468
16938
|
focusContainer();
|
|
15469
16939
|
};
|
|
15470
|
-
const { primaryLanguages, remainingLanguages } = (0,
|
|
16940
|
+
const { primaryLanguages, remainingLanguages } = (0,compat_.useMemo)(() => languages.reduce((acc, language) => {
|
|
15471
16941
|
const isOriginal = language.locale === defaultLocale;
|
|
15472
16942
|
const checked = isChecked(language, currentLocale, isOriginal);
|
|
15473
16943
|
if (language.locale !== defaultLocale) {
|