@veltdev/react 1.0.99 → 1.0.101

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.
@@ -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,4 +1,3 @@
1
- import React from 'react';
2
- declare const _default: ComponentMeta<React.FC<import("./Snippyly").IVeltProps>>;
1
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-bf5e6555").R, import("./Snippyly").IVeltProps>;
3
2
  export default _default;
4
- export declare const Snippyly1: any;
3
+ export declare const Snippyly1: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, import("./Snippyly").IVeltProps>;
@@ -1,4 +1,4 @@
1
- import { Location, User, UserOptions } from "@veltdev/types";
1
+ import { Location, User, Options } from "@veltdev/types";
2
2
  /**
3
3
  * @beta This hook is in beta
4
4
  */
@@ -6,7 +6,7 @@ export declare function useClient(): any;
6
6
  /**
7
7
  * @beta This hook is in beta
8
8
  */
9
- export declare function useIdentify(user: User, userOptions?: UserOptions): void;
9
+ export declare function useIdentify(user: User, userOptions?: Options): void;
10
10
  /**
11
11
  * @beta This hook is in beta
12
12
  */
@@ -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
- script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
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();