@veltdev/react 1.0.99 → 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 +15 -3
- package/cjs/index.js.map +1 -1
- package/cjs/types/components/Snippyly/Snippyly.d.ts +3 -1
- package/cjs/types/loadSnippyly.d.ts +1 -1
- package/esm/index.js +15 -3
- package/esm/index.js.map +1 -1
- package/esm/types/components/Snippyly/Snippyly.d.ts +3 -1
- package/esm/types/loadSnippyly.d.ts +1 -1
- package/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Config, Velt } from '@veltdev/types';
|
|
3
3
|
export interface IVeltProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
4
4
|
apiKey: string;
|
|
5
|
-
config?: Config
|
|
5
|
+
config?: Config & {
|
|
6
|
+
proxyDomain?: string;
|
|
7
|
+
};
|
|
6
8
|
user?: any;
|
|
7
9
|
documentId?: string;
|
|
8
10
|
language?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean) => void;
|
|
1
|
+
declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean, proxyDomain?: string) => void;
|
|
2
2
|
export default loadVelt;
|
package/esm/index.js
CHANGED
|
@@ -69,7 +69,7 @@ function useVeltClient() {
|
|
|
69
69
|
return useContext(VeltContext);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
var loadVelt = function (callback, version, staging, develop) {
|
|
72
|
+
var loadVelt = function (callback, version, staging, develop, proxyDomain) {
|
|
73
73
|
if (version === void 0) { version = 'latest'; }
|
|
74
74
|
if (staging === void 0) { staging = false; }
|
|
75
75
|
if (develop === void 0) { develop = false; }
|
|
@@ -83,7 +83,16 @@ var loadVelt = function (callback, version, staging, develop) {
|
|
|
83
83
|
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");
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
|
|
86
|
+
if (proxyDomain) {
|
|
87
|
+
// remove trailing slash from proxy
|
|
88
|
+
if (proxyDomain[proxyDomain.length - 1] === '/') {
|
|
89
|
+
proxyDomain = proxyDomain.slice(0, -1);
|
|
90
|
+
}
|
|
91
|
+
script.src = "".concat(proxyDomain, "/lib/sdk@").concat(version, "/velt.js");
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
script.id = 'veltScript';
|
|
89
98
|
script.type = 'module';
|
|
@@ -111,7 +120,7 @@ var SnippylyProvider = function (props) {
|
|
|
111
120
|
if (apiKey) {
|
|
112
121
|
loadVelt(function () {
|
|
113
122
|
initVelt();
|
|
114
|
-
}, (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);
|
|
123
|
+
}, (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);
|
|
115
124
|
}
|
|
116
125
|
}, []);
|
|
117
126
|
var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -130,6 +139,9 @@ var SnippylyProvider = function (props) {
|
|
|
130
139
|
if (config.version) {
|
|
131
140
|
delete config.version;
|
|
132
141
|
}
|
|
142
|
+
if (config === null || config === void 0 ? void 0 : config.proxyDomain) {
|
|
143
|
+
delete config.proxyDomain;
|
|
144
|
+
}
|
|
133
145
|
return [4 /*yield*/, ((_a = window.Velt) === null || _a === void 0 ? void 0 : _a.init(apiKey, config))];
|
|
134
146
|
case 1:
|
|
135
147
|
velt = _c.sent();
|