blixify-ui-web 1.2.69 → 1.2.71

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.
@@ -7,14 +7,42 @@ interface Props extends ChatProps {
7
7
  greetingCard?: boolean;
8
8
  openIcon?: React.ReactNode | string;
9
9
  closeIcon?: React.ReactNode | string;
10
+ draggable?: boolean;
11
+ positionStorageKey?: string;
12
+ }
13
+ interface AnchorPosition {
14
+ right: number;
15
+ bottom: number;
10
16
  }
11
17
  export declare class ChatAnchor extends Component<Props> {
12
18
  state: {
13
19
  isMobileWidth: boolean;
14
20
  chatCard: boolean;
21
+ position: AnchorPosition | null;
15
22
  };
23
+ anchorRef: React.RefObject<HTMLDivElement | null>;
24
+ buttonRef: React.RefObject<HTMLDivElement | null>;
25
+ dragRef: {
26
+ pointerX: number;
27
+ pointerY: number;
28
+ right: number;
29
+ bottom: number;
30
+ moved: boolean;
31
+ latest: AnchorPosition | null;
32
+ } | null;
33
+ suppressClick: boolean;
16
34
  componentDidMount(): void;
17
35
  componentWillUnmount(): void;
36
+ handleStorageKey: () => string;
37
+ handleClampPosition: (position: AnchorPosition) => AnchorPosition;
38
+ handleRestorePosition: () => void;
39
+ handlePersistPosition: (position: AnchorPosition) => void;
40
+ handleDragStart: (event: React.PointerEvent<HTMLDivElement>) => void;
41
+ handleDragMove: (event: PointerEvent) => void;
42
+ handleDragEnd: () => void;
43
+ handleRemoveDragListeners: () => void;
44
+ handleAnchorClick: () => void;
45
+ handleIsDraggable: () => boolean;
18
46
  componentDidUpdate: (prevProps: Props) => void;
19
47
  handleResize: () => void;
20
48
  renderChatAnchorIcon: () => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chatAnchor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EAAY,KAAK,IAAI,SAAS,EA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,KAAK,CAAC;IAC9C,KAAK,EAAE;QACL,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;KACjC,CAIC;IAEF,SAAS,yCAAqC;IAC9C,SAAS,yCAAqC;IAC9C,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,OAAO,CAAC;QAIf,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;KAC/B,GAAG,IAAI,CAAQ;IAChB,aAAa,UAAS;IAEtB,iBAAiB;IAQjB,oBAAoB;IAKpB,gBAAgB,eACgD;IAOhE,mBAAmB,aAAc,cAAc,KAAG,cAAc,CAgB9D;IAEF,qBAAqB,aAkBnB;IAEF,qBAAqB,aAAc,cAAc,UAS/C;IAKF,eAAe,UAAW,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,UAoB1D;IAEF,cAAc,UAAW,YAAY,UAiBnC;IAEF,aAAa,aASX;IAEF,yBAAyB,aAIvB;IAEF,iBAAiB,aAMf;IAIF,iBAAiB,gBAEgC;IAEjD,kBAAkB,cAAe,KAAK,UAMpC;IACF,YAAY,aAOV;IAEF,oBAAoB,0BAoBlB;IAEF,MAAM;CAuEP"}
@@ -54,6 +54,10 @@ var react_1 = require("@headlessui/react");
54
54
  var solid_1 = require("@heroicons/react/20/solid");
55
55
  var react_2 = __importStar(require("react"));
56
56
  var chatBase_1 = require("../chatBase");
57
+ var DEFAULT_POSITION_STORAGE_KEY = "blixify-chat-anchor-position";
58
+ // INFO: a drag shorter than this is a click — a tap on a touch screen always
59
+ // travels a pixel or two, and it must still open the chat
60
+ var DRAG_THRESHOLD = 4;
57
61
  var ChatAnchor = /** @class */ (function (_super) {
58
62
  __extends(ChatAnchor, _super);
59
63
  function ChatAnchor() {
@@ -61,6 +65,138 @@ var ChatAnchor = /** @class */ (function (_super) {
61
65
  _this.state = {
62
66
  isMobileWidth: false,
63
67
  chatCard: true,
68
+ position: null,
69
+ };
70
+ _this.anchorRef = react_2.default.createRef();
71
+ _this.buttonRef = react_2.default.createRef();
72
+ _this.dragRef = null;
73
+ _this.suppressClick = false;
74
+ _this.handleStorageKey = function () { var _a; return (_a = _this.props.positionStorageKey) !== null && _a !== void 0 ? _a : DEFAULT_POSITION_STORAGE_KEY; };
75
+ // INFO: keeps the anchor on screen when a position saved on a wide window is
76
+ // restored on a narrow one, and when the window is resized under it.
77
+ // The bounds are the button's, not the container's — the container also holds
78
+ // the greeting card, and clamping on its full width pins the button against
79
+ // the edge on a phone.
80
+ _this.handleClampPosition = function (position) {
81
+ var _a, _b;
82
+ var container = (_a = _this.anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
83
+ var button = (_b = _this.buttonRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
84
+ if (!container || !button)
85
+ return position;
86
+ // INFO: the offsets are the container's, so shift the button's bounds by
87
+ // the gap between the two — the greeting card sits to the button's right
88
+ var gapRight = container.right - button.right;
89
+ var gapBottom = container.bottom - button.bottom;
90
+ var minRight = -gapRight;
91
+ var maxRight = window.innerWidth - button.width - gapRight;
92
+ var minBottom = -gapBottom;
93
+ var maxBottom = window.innerHeight - button.height - gapBottom;
94
+ return {
95
+ right: Math.min(Math.max(minRight, position.right), maxRight),
96
+ bottom: Math.min(Math.max(minBottom, position.bottom), maxBottom),
97
+ };
98
+ };
99
+ _this.handleRestorePosition = function () {
100
+ if (_this.props.draggable === false)
101
+ return;
102
+ try {
103
+ var stored = window.localStorage.getItem(_this.handleStorageKey());
104
+ if (!stored)
105
+ return;
106
+ var parsed = JSON.parse(stored);
107
+ if (typeof (parsed === null || parsed === void 0 ? void 0 : parsed.right) !== "number" ||
108
+ typeof (parsed === null || parsed === void 0 ? void 0 : parsed.bottom) !== "number" ||
109
+ Number.isNaN(parsed.right) ||
110
+ Number.isNaN(parsed.bottom))
111
+ return;
112
+ _this.setState({ position: _this.handleClampPosition(parsed) });
113
+ }
114
+ catch (_a) {
115
+ // INFO: private browsing and blocked site data both throw on read — the
116
+ // anchor just stays at its default offset
117
+ }
118
+ };
119
+ _this.handlePersistPosition = function (position) {
120
+ try {
121
+ window.localStorage.setItem(_this.handleStorageKey(), JSON.stringify(position));
122
+ }
123
+ catch (_a) {
124
+ // INFO: the position is still applied for this session, just not kept
125
+ }
126
+ };
127
+ // INFO: the listeners go on the window, not the button. The button moves out
128
+ // from under the pointer as it is dragged, and pointer capture on a moving
129
+ // element drops most of the move events.
130
+ _this.handleDragStart = function (event) {
131
+ var _a;
132
+ if (!_this.handleIsDraggable())
133
+ return;
134
+ var size = (_a = _this.anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
135
+ if (!size)
136
+ return;
137
+ // INFO: a drag that ends without a click — the pointer was cancelled by a
138
+ // system gesture, say — would otherwise leave the flag set and swallow the
139
+ // next real tap
140
+ _this.suppressClick = false;
141
+ event.preventDefault();
142
+ _this.dragRef = {
143
+ pointerX: event.clientX,
144
+ pointerY: event.clientY,
145
+ right: window.innerWidth - size.right,
146
+ bottom: window.innerHeight - size.bottom,
147
+ moved: false,
148
+ latest: null,
149
+ };
150
+ window.addEventListener("pointermove", _this.handleDragMove);
151
+ window.addEventListener("pointerup", _this.handleDragEnd);
152
+ window.addEventListener("pointercancel", _this.handleDragEnd);
153
+ };
154
+ _this.handleDragMove = function (event) {
155
+ var drag = _this.dragRef;
156
+ if (!drag)
157
+ return;
158
+ var deltaX = event.clientX - drag.pointerX;
159
+ var deltaY = event.clientY - drag.pointerY;
160
+ if (!drag.moved &&
161
+ Math.abs(deltaX) < DRAG_THRESHOLD &&
162
+ Math.abs(deltaY) < DRAG_THRESHOLD)
163
+ return;
164
+ drag.moved = true;
165
+ drag.latest = _this.handleClampPosition({
166
+ right: drag.right - deltaX,
167
+ bottom: drag.bottom - deltaY,
168
+ });
169
+ _this.setState({ position: drag.latest });
170
+ };
171
+ _this.handleDragEnd = function () {
172
+ var drag = _this.dragRef;
173
+ _this.dragRef = null;
174
+ _this.handleRemoveDragListeners();
175
+ if (!(drag === null || drag === void 0 ? void 0 : drag.moved))
176
+ return;
177
+ // INFO: the pointer comes up over the button, so a click follows the drag —
178
+ // this stops the chat opening every time the anchor is moved
179
+ _this.suppressClick = true;
180
+ if (drag.latest)
181
+ _this.handlePersistPosition(drag.latest);
182
+ };
183
+ _this.handleRemoveDragListeners = function () {
184
+ window.removeEventListener("pointermove", _this.handleDragMove);
185
+ window.removeEventListener("pointerup", _this.handleDragEnd);
186
+ window.removeEventListener("pointercancel", _this.handleDragEnd);
187
+ };
188
+ _this.handleAnchorClick = function () {
189
+ if (_this.suppressClick) {
190
+ _this.suppressClick = false;
191
+ return;
192
+ }
193
+ _this.props.onClick();
194
+ };
195
+ // INFO: no dragging while the panel is full screen on mobile — there is no
196
+ // free-floating button to move at that point
197
+ _this.handleIsDraggable = function () {
198
+ return _this.props.draggable !== false &&
199
+ !(_this.props.open && _this.state.isMobileWidth);
64
200
  };
65
201
  _this.componentDidUpdate = function (prevProps) {
66
202
  if (_this.props.open !== prevProps.open && _this.props.open) {
@@ -70,9 +206,12 @@ var ChatAnchor = /** @class */ (function (_super) {
70
206
  }
71
207
  };
72
208
  _this.handleResize = function () {
73
- _this.setState({
209
+ _this.setState(function (previous) { return ({
74
210
  isMobileWidth: window.innerWidth < 640,
75
- });
211
+ position: previous.position
212
+ ? _this.handleClampPosition(previous.position)
213
+ : null,
214
+ }); });
76
215
  };
77
216
  _this.renderChatAnchorIcon = function () {
78
217
  var _a = _this.props, open = _a.open, openIcon = _a.openIcon, closeIcon = _a.closeIcon;
@@ -89,26 +228,37 @@ var ChatAnchor = /** @class */ (function (_super) {
89
228
  }
90
229
  ChatAnchor.prototype.componentDidMount = function () {
91
230
  this.handleResize();
231
+ // INFO: read after mount, never in the constructor — the server has no
232
+ // localStorage and a restored position would not match the first paint
233
+ this.handleRestorePosition();
92
234
  window.addEventListener("resize", this.handleResize);
93
235
  };
94
236
  ChatAnchor.prototype.componentWillUnmount = function () {
95
237
  window.removeEventListener("resize", this.handleResize);
238
+ this.handleRemoveDragListeners();
96
239
  };
97
240
  ChatAnchor.prototype.render = function () {
98
241
  var _this = this;
99
242
  var _a;
100
243
  var useAbsolutePosition = this.props.open && this.state.isMobileWidth;
244
+ // INFO: a dragged position is an inline style — Tailwind only emits the
245
+ // classes it can see at build time, so a runtime bottom-[Npx] never exists
246
+ var draggedPosition = !useAbsolutePosition && this.state.position ? this.state.position : null;
101
247
  var positionOffset = useAbsolutePosition
102
248
  ? "h-[calc(100dvh)] w-screen top-0 left-0 overflow-auto"
103
- : (_a = this.props.positionOffset) !== null && _a !== void 0 ? _a : "bottom-8 right-8";
249
+ : draggedPosition
250
+ ? ""
251
+ : ((_a = this.props.positionOffset) !== null && _a !== void 0 ? _a : "bottom-8 right-8");
104
252
  var chatAnchorVisible = this.props.open ? "hidden sm:block" : "block";
105
253
  var icon = this.props.open ? this.props.closeIcon : this.props.openIcon;
106
- return (react_2.default.createElement("div", { className: "z-40 flex flex-col items-end space-y-4 fixed ".concat(positionOffset) },
254
+ return (react_2.default.createElement("div", { ref: this.anchorRef, className: "z-40 flex flex-col items-end space-y-4 fixed ".concat(positionOffset), style: draggedPosition !== null && draggedPosition !== void 0 ? draggedPosition : undefined },
107
255
  react_2.default.createElement(react_1.Transition, { show: this.props.open, as: react_2.Fragment, enter: "transform transition duration-[400ms]", enterFrom: "opacity-0 scale-50", leave: "transform duration-200 transition ease-in-out", leaveTo: "opacity-0 scale-95 " },
108
256
  react_2.default.createElement("div", { className: "w-full h-full" },
109
257
  react_2.default.createElement(chatBase_1.ChatBase, __assign({}, this.props)))),
110
258
  react_2.default.createElement("div", { className: "flex flex-row" },
111
- react_2.default.createElement("div", { onClick: this.props.onClick, className: "".concat(chatAnchorVisible, " ").concat(icon ? "" : "p-4", " rounded-full select-none h-fit w-fit bg-primary-500 shadow-lg hover:cursor-pointer hover:bg-primary-600") }, this.renderChatAnchorIcon()),
259
+ react_2.default.createElement("div", { ref: this.buttonRef, onClick: this.handleAnchorClick, onPointerDown: this.handleDragStart, className: "".concat(chatAnchorVisible, " ").concat(icon ? "" : "p-4", " ").concat(this.handleIsDraggable()
260
+ ? "touch-none cursor-grab active:cursor-grabbing"
261
+ : "hover:cursor-pointer", " rounded-full select-none h-fit w-fit bg-primary-500 shadow-lg hover:bg-primary-600") }, this.renderChatAnchorIcon()),
112
262
  this.props.greetingCard && this.state.chatCard && (react_2.default.createElement("div", { className: "bg-white flex items-center ml-2 my-2 shadow-lg rounded-lg" },
113
263
  react_2.default.createElement("div", { className: "cursor-pointer absolute bottom-12 right-0 bg-primary-500 hover:bg-primary-600 rounded-full", onClick: function () {
114
264
  return _this.setState({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/chat/chatAnchor/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+C;AAC/C,mDAA8E;AAC9E,6CAAmD;AACnD,wCAA2D;AAW3D;IAAgC,8BAAgB;IAAhD;;QACE,WAAK,GAAG;YACN,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;QAWF,wBAAkB,GAAG,UAAC,SAAgB;YACpC,IAAI,KAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,IAAI,KAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBAC1D,KAAI,CAAC,QAAQ,CAAC;oBACZ,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QACF,kBAAY,GAAG;YACb,KAAI,CAAC,QAAQ,CAAC;gBACZ,aAAa,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG;aACvC,CAAC,CAAC;QACL,C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/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,KASN,MAAM,OAAO,CAAC;AAwFf,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAwD1B,eAAO,MAAM,YAAY,mFAklYvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,KASN,MAAM,OAAO,CAAC;AAwFf,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAwD1B,eAAO,MAAM,YAAY,mFAqlYvB,CAAC"}
@@ -1030,6 +1030,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1030
1030
  props.collectionId,
1031
1031
  props.devSettings.sseEndpoint,
1032
1032
  props.devSettings.dbAPIToken,
1033
+ // INFO: the ID token rotates hourly and is baked into the URL at construction,
1034
+ // so without this every reconnect after a rotation presents an expired token.
1035
+ props.devSettings.dbUserToken,
1033
1036
  ]);
1034
1037
  /* eslint-enable */
1035
1038
  // INFO: track real network connectivity independently of SSE so