@veltdev/react 1.0.98 → 1.0.100
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 +35 -4
- package/cjs/index.js.map +1 -1
- package/cjs/types/components/Snippyly/Snippyly.d.ts +3 -1
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/LiveStateSyncElement.d.ts +5 -1
- package/cjs/types/hooks/index.d.ts +1 -1
- package/cjs/types/loadSnippyly.d.ts +1 -1
- package/esm/index.js +35 -5
- package/esm/index.js.map +1 -1
- package/esm/types/components/Snippyly/Snippyly.d.ts +3 -1
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/LiveStateSyncElement.d.ts +5 -1
- package/esm/types/hooks/index.d.ts +1 -1
- package/esm/types/loadSnippyly.d.ts +1 -1
- package/index.d.ts +9 -3
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -77,7 +77,7 @@ function useVeltClient() {
|
|
|
77
77
|
return React.useContext(VeltContext);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
var loadVelt = function (callback, version, staging, develop) {
|
|
80
|
+
var loadVelt = function (callback, version, staging, develop, proxyDomain) {
|
|
81
81
|
if (version === void 0) { version = 'latest'; }
|
|
82
82
|
if (staging === void 0) { staging = false; }
|
|
83
83
|
if (develop === void 0) { develop = false; }
|
|
@@ -91,7 +91,16 @@ var loadVelt = function (callback, version, staging, develop) {
|
|
|
91
91
|
script.src = "https://us-central1-snipply-sdk-staging.cloudfunctions.net/getPrivateNpmPackageFile?packageName=sdk-dev&packageVersion=".concat((!version || version === 'latest') ? '1.0.1' : version, "&filePath=velt.js&orgName=@veltdev");
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
|
|
94
|
+
if (proxyDomain) {
|
|
95
|
+
// remove trailing slash from proxy
|
|
96
|
+
if (proxyDomain[proxyDomain.length - 1] === '/') {
|
|
97
|
+
proxyDomain = proxyDomain.slice(0, -1);
|
|
98
|
+
}
|
|
99
|
+
script.src = "".concat(proxyDomain, "/lib/sdk@").concat(version, "/velt.js");
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
|
|
103
|
+
}
|
|
95
104
|
}
|
|
96
105
|
script.id = 'veltScript';
|
|
97
106
|
script.type = 'module';
|
|
@@ -109,7 +118,7 @@ var loadVelt = function (callback, version, staging, develop) {
|
|
|
109
118
|
}
|
|
110
119
|
};
|
|
111
120
|
|
|
112
|
-
var VELT_SDK_VERSION = '1.0.
|
|
121
|
+
var VELT_SDK_VERSION = '1.0.112';
|
|
113
122
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
114
123
|
|
|
115
124
|
var SnippylyProvider = function (props) {
|
|
@@ -119,7 +128,7 @@ var SnippylyProvider = function (props) {
|
|
|
119
128
|
if (apiKey) {
|
|
120
129
|
loadVelt(function () {
|
|
121
130
|
initVelt();
|
|
122
|
-
}, (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION, config === null || config === void 0 ? void 0 : config.staging, config === null || config === void 0 ? void 0 : config.develop);
|
|
131
|
+
}, (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION, config === null || config === void 0 ? void 0 : config.staging, config === null || config === void 0 ? void 0 : config.develop, config === null || config === void 0 ? void 0 : config.proxyDomain);
|
|
123
132
|
}
|
|
124
133
|
}, []);
|
|
125
134
|
var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -138,6 +147,9 @@ var SnippylyProvider = function (props) {
|
|
|
138
147
|
if (config.version) {
|
|
139
148
|
delete config.version;
|
|
140
149
|
}
|
|
150
|
+
if (config === null || config === void 0 ? void 0 : config.proxyDomain) {
|
|
151
|
+
delete config.proxyDomain;
|
|
152
|
+
}
|
|
141
153
|
return [4 /*yield*/, ((_a = window.Velt) === null || _a === void 0 ? void 0 : _a.init(apiKey, config))];
|
|
142
154
|
case 1:
|
|
143
155
|
velt = _c.sent();
|
|
@@ -852,6 +864,24 @@ function useEditor() {
|
|
|
852
864
|
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditor]);
|
|
853
865
|
return data;
|
|
854
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* @beta This hook is in beta
|
|
869
|
+
*/
|
|
870
|
+
function useEditorAccessTimer() {
|
|
871
|
+
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
872
|
+
var _a = React__default["default"].useState({ state: 'idle' }), data = _a[0], setData = _a[1];
|
|
873
|
+
React.useEffect(function () {
|
|
874
|
+
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer))
|
|
875
|
+
return;
|
|
876
|
+
var subscription = liveStateSyncElement.getEditorAccessTimer().subscribe(function (res) {
|
|
877
|
+
setData(res);
|
|
878
|
+
});
|
|
879
|
+
return function () {
|
|
880
|
+
subscription.unsubscribe();
|
|
881
|
+
};
|
|
882
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer]);
|
|
883
|
+
return data;
|
|
884
|
+
}
|
|
855
885
|
/**
|
|
856
886
|
* @beta This hook is in beta
|
|
857
887
|
*/
|
|
@@ -1261,6 +1291,7 @@ exports.useCursorUsers = useCursorUsers;
|
|
|
1261
1291
|
exports.useCursorUtils = useCursorUtils;
|
|
1262
1292
|
exports.useEditor = useEditor;
|
|
1263
1293
|
exports.useEditorAccessRequestHandler = useEditorAccessRequestHandler;
|
|
1294
|
+
exports.useEditorAccessTimer = useEditorAccessTimer;
|
|
1264
1295
|
exports.useHuddleUtils = useHuddleUtils;
|
|
1265
1296
|
exports.useIdentify = useIdentify;
|
|
1266
1297
|
exports.useLiveSelectionUtils = useLiveSelectionUtils;
|