@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 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
- script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
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';
@@ -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();