@veltdev/react 4.5.0-beta.57 → 4.5.0-beta.59

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/cjs/index.js CHANGED
@@ -144,17 +144,17 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain, integ
144
144
  }
145
145
  };
146
146
 
147
- var VELT_SDK_VERSION = '4.5.0-beta.57';
147
+ var VELT_SDK_VERSION = '4.5.0-beta.59';
148
148
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
149
149
  var VELT_TAB_ID = 'veltTabId';
150
150
  // integrity map for the Velt SDK
151
151
  // Note: generate integrity hashes with: https://www.srihash.org/
152
152
  var INTEGRITY_MAP = {
153
- '4.5.0-beta.57': 'sha384-FefkTKROm+/hGIe5Qqjj2lNd+YUyl5KaiiKQCN5zk1WpWhHy/gkpBdYZj9EhLN0K',
153
+ '4.5.0-beta.59': 'sha384-eWscGajF6BzcUBxoKHK7eISXUIe6nlmpsRIYa7F0GZz9jYMQGI5d4D7hgtfzgF4z',
154
154
  };
155
155
 
156
156
  var SnippylyProvider = function (props) {
157
- var apiKey = props.apiKey, user = props.user, config = props.config, documentId = props.documentId, language = props.language, translations = props.translations, autoTranslation = props.autoTranslation, userDataProvider = props.userDataProvider, dataProviders = props.dataProviders, onClientLoad = props.onClientLoad, children = props.children;
157
+ var apiKey = props.apiKey, user = props.user, config = props.config, documentId = props.documentId, language = props.language, translations = props.translations, autoTranslation = props.autoTranslation, userDataProvider = props.userDataProvider, dataProviders = props.dataProviders, authProvider = props.authProvider, onClientLoad = props.onClientLoad, children = props.children;
158
158
  var _a = React.useState(null), client = _a[0], setClient = _a[1];
159
159
  React.useEffect(function () {
160
160
  if (apiKey) {
@@ -162,7 +162,7 @@ var SnippylyProvider = function (props) {
162
162
  var develop = config === null || config === void 0 ? void 0 : config.develop;
163
163
  var version = (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION;
164
164
  var integrity = !!(config === null || config === void 0 ? void 0 : config.integrity);
165
- var integrityValue = '';
165
+ var integrityValue = "";
166
166
  if (integrity) {
167
167
  if (develop || staging) {
168
168
  if (config === null || config === void 0 ? void 0 : config.sriv) {
@@ -182,18 +182,23 @@ var SnippylyProvider = function (props) {
182
182
  }, []);
183
183
  React.useEffect(function () {
184
184
  if (client && userDataProvider) {
185
- if (typeof (client === null || client === void 0 ? void 0 : client.setUserDataProvider) === 'function') {
185
+ if (typeof (client === null || client === void 0 ? void 0 : client.setUserDataProvider) === "function") {
186
186
  client === null || client === void 0 ? void 0 : client.setUserDataProvider(userDataProvider);
187
187
  }
188
188
  }
189
189
  }, [client, userDataProvider]);
190
190
  React.useEffect(function () {
191
191
  if (client && dataProviders) {
192
- if (typeof (client === null || client === void 0 ? void 0 : client.setDataProviders) === 'function') {
192
+ if (typeof (client === null || client === void 0 ? void 0 : client.setDataProviders) === "function") {
193
193
  client === null || client === void 0 ? void 0 : client.setDataProviders(dataProviders);
194
194
  }
195
195
  }
196
196
  }, [client, dataProviders]);
197
+ React.useEffect(function () {
198
+ if (client && authProvider && authProvider.user) {
199
+ client.setVeltAuthProvider(authProvider);
200
+ }
201
+ }, [client, authProvider]);
197
202
  var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
198
203
  var velt, event;
199
204
  var _a, _b;
@@ -228,7 +233,7 @@ var SnippylyProvider = function (props) {
228
233
  }
229
234
  // Set translations
230
235
  if (translations && (velt === null || velt === void 0 ? void 0 : velt.setTranslations)) {
231
- if (typeof translations === 'object') {
236
+ if (typeof translations === "object") {
232
237
  Object.keys(translations).forEach(function (languageCode) {
233
238
  velt === null || velt === void 0 ? void 0 : velt.setTranslations(languageCode, translations[languageCode] || {});
234
239
  });
@@ -243,7 +248,7 @@ var SnippylyProvider = function (props) {
243
248
  }
244
249
  }
245
250
  if (velt === null || velt === void 0 ? void 0 : velt.st) {
246
- velt === null || velt === void 0 ? void 0 : velt.st('react');
251
+ velt === null || velt === void 0 ? void 0 : velt.st("react");
247
252
  }
248
253
  setClient(velt);
249
254
  if (onClientLoad) {
@@ -268,22 +273,6 @@ var SnippylyProvider = function (props) {
268
273
  React__default["default"].createElement(VeltContext.Provider, { value: { client: client } }, children)));
269
274
  };
270
275
 
271
- var VeltAuthProvider = function (props) {
272
- var children = props.children, user = props.user, options = props.options, retryConfig = props.retryConfig;
273
- var client = useVeltClient().client;
274
- React.useEffect(function () {
275
- if ((client === null || client === void 0 ? void 0 : client.setVeltAuthProvider) && user) {
276
- var authProviderConfig = {
277
- user: user,
278
- options: options,
279
- retryConfig: retryConfig
280
- };
281
- client.setVeltAuthProvider(authProviderConfig);
282
- }
283
- }, [client, user, options, retryConfig]);
284
- return (React__default["default"].createElement(React__default["default"].Fragment, null, children));
285
- };
286
-
287
276
  var SnippylyCommentBubble = function (props) {
288
277
  var targetCommentElementId = props.targetCommentElementId, targetElementId = props.targetElementId, avatar = props.avatar, showAvatar = props.showAvatar, commentBubbleTargetPinHover = props.commentBubbleTargetPinHover, children = props.children, shadowDom = props.shadowDom, variant = props.variant, darkMode = props.darkMode, commentCountType = props.commentCountType, context = props.context, contextOptions = props.contextOptions, annotationId = props.annotationId, documentId = props.documentId, folderId = props.folderId, locationId = props.locationId;
289
278
  return (React__default["default"].createElement("velt-comment-bubble", { "annotation-id": annotationId, "comment-count-type": commentCountType, "target-comment-element-id": targetCommentElementId, "target-element-id": targetElementId, context: JSON.stringify(context), "context-options": JSON.stringify(contextOptions), "location-id": locationId, "document-id": documentId, "folder-id": folderId, "show-avatar": [true, false].includes(showAvatar) ? (showAvatar ? 'true' : 'false') : undefined, avatar: [true, false].includes(avatar) ? (avatar ? 'true' : 'false') : undefined, "comment-bubble-target-pin-hover": commentBubbleTargetPinHover ? 'true' : undefined, "shadow-dom": [true, false].includes(shadowDom) ? (shadowDom ? 'true' : 'false') : undefined, "dark-mode": [true, false].includes(darkMode) ? (darkMode ? 'true' : 'false') : undefined, variant: variant }, children));
@@ -7704,7 +7693,6 @@ var logLiveState = function (action, liveStateDataId) {
7704
7693
 
7705
7694
  exports.VeltArrowTool = SnippylyArrowTool;
7706
7695
  exports.VeltArrows = SnippylyArrows;
7707
- exports.VeltAuthProvider = VeltAuthProvider;
7708
7696
  exports.VeltAutocomplete = VeltAutocomplete;
7709
7697
  exports.VeltAutocompleteChipTooltipWireframe = VeltAutocompleteChipTooltipWireframe;
7710
7698
  exports.VeltAutocompleteGroupOptionWireframe = VeltAutocompleteGroupOptionWireframe;