@jitsu/jitsu-react 1.1.0-canary.211.20230220170436 → 1.1.0-canary.212.20230220173912
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/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var React = require('react');
|
|
2
2
|
var js = require('@jitsu/js');
|
|
3
|
-
var src = require('@jitsu/js/compiled/src');
|
|
4
3
|
|
|
5
4
|
var JitsuContext = React.createContext(null);
|
|
6
5
|
|
|
@@ -10,7 +9,6 @@ var JitsuProvider = function JitsuProvider(props) {
|
|
|
10
9
|
instance = {
|
|
11
10
|
analytics: js.emptyAnalytics
|
|
12
11
|
};
|
|
13
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
14
12
|
} else if (!props.options.host) {
|
|
15
13
|
var msg = "<JitsuProvider />. Jitsu host is not defined. Jitsu will not be initialized";
|
|
16
14
|
console.error("%c" + msg, "color: red; font-weight: bold;");
|
|
@@ -31,7 +29,7 @@ function useJitsu(opts) {
|
|
|
31
29
|
var jitsuInstance = React.useContext(JitsuContext);
|
|
32
30
|
if (opts !== null && opts !== void 0 && opts.disabled) {
|
|
33
31
|
return {
|
|
34
|
-
analytics:
|
|
32
|
+
analytics: js.emptyAnalytics
|
|
35
33
|
};
|
|
36
34
|
}
|
|
37
35
|
if (!jitsuInstance) {
|
|
@@ -43,7 +41,7 @@ function useJitsu(opts) {
|
|
|
43
41
|
var msg = "Before calling useJitsu() hook, please wrap your component into <JitsuProvider />. Read more in http://jitsu.com/docs/sending-data/js-sdk/react";
|
|
44
42
|
console.error("%c" + msg, "color: red; font-weight: bold;");
|
|
45
43
|
return {
|
|
46
|
-
analytics:
|
|
44
|
+
analytics: js.emptyAnalytics
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
47
|
} else if (opts !== null && opts !== void 0 && opts.host || opts !== null && opts !== void 0 && opts.echoEvents) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/JitsuContext.tsx","../src/JitsuProvider.tsx","../src/useJitsu.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport { AnalyticsInterface } from \"@jitsu/js\";\n\nexport type JitsuInstance = { analytics: AnalyticsInterface };\n\nconst JitsuContext = createContext<JitsuInstance | null>(null);\n\nexport default JitsuContext;\n","import * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\nimport JitsuContext, { JitsuInstance } from \"./JitsuContext\";\nimport { emptyAnalytics, jitsuAnalytics } from \"@jitsu/js\";\nimport { ExtendedJitsuOptions } from \"./useJitsu\";\n\nconst JitsuProvider: React.FC<PropsWithChildren<{ options: ExtendedJitsuOptions }>> = props => {\n let instance: JitsuInstance;\n if (props.options.disabled) {\n instance = { analytics: emptyAnalytics };\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/JitsuContext.tsx","../src/JitsuProvider.tsx","../src/useJitsu.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport { AnalyticsInterface } from \"@jitsu/js\";\n\nexport type JitsuInstance = { analytics: AnalyticsInterface };\n\nconst JitsuContext = createContext<JitsuInstance | null>(null);\n\nexport default JitsuContext;\n","import * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\nimport JitsuContext, { JitsuInstance } from \"./JitsuContext\";\nimport { emptyAnalytics, jitsuAnalytics } from \"@jitsu/js\";\nimport { ExtendedJitsuOptions } from \"./useJitsu\";\n\nconst JitsuProvider: React.FC<PropsWithChildren<{ options: ExtendedJitsuOptions }>> = props => {\n let instance: JitsuInstance;\n if (props.options.disabled) {\n instance = { analytics: emptyAnalytics };\n } else if (!props.options.host) {\n const msg = \"<JitsuProvider />. Jitsu host is not defined. Jitsu will not be initialized\";\n console.error(`%c${msg}`, \"color: red; font-weight: bold;\");\n instance = { analytics: emptyAnalytics };\n } else {\n instance = { analytics: jitsuAnalytics(props.options) };\n }\n return <JitsuContext.Provider value={instance}>{props.children}</JitsuContext.Provider>;\n};\n\nexport default JitsuProvider;\n","import { useContext } from \"react\";\nimport JitsuContext from \"./JitsuContext\";\n\nimport { AnalyticsInterface, jitsuAnalytics, JitsuOptions, emptyAnalytics } from \"@jitsu/js\";\n\nexport interface BeforeEffect {\n effect: (analytics: AnalyticsInterface) => any;\n deps: any[];\n}\n\nexport type ExtendedJitsuOptions =\n | (Omit<JitsuOptions, \"host\"> & { host: string } & {\n disabled?: false | undefined;\n echoEvents?: boolean;\n })\n | { disabled: true };\n\n/**\n * See for details http://jitsu.com/docs/sending-data/js-sdk/react\n */\nfunction useJitsu(opts?: ExtendedJitsuOptions): { analytics: AnalyticsInterface } {\n let jitsuInstance = useContext(JitsuContext);\n if (opts?.disabled) {\n return { analytics: emptyAnalytics };\n }\n if (!jitsuInstance) {\n if (opts?.host || opts?.echoEvents) {\n return { analytics: jitsuAnalytics(opts) };\n } else {\n const msg =\n \"Before calling useJitsu() hook, please wrap your component into <JitsuProvider />. Read more in http://jitsu.com/docs/sending-data/js-sdk/react\";\n console.error(`%c${msg}`, \"color: red; font-weight: bold;\");\n return { analytics: emptyAnalytics };\n }\n } else if (opts?.host || opts?.echoEvents) {\n throw new Error(\n \"Jitsu client already set up with <JitsuProvider /> and cannot be overridden. Read more in http://jitsu.com/docs/sending-data/js-sdk/react\"\n );\n //Jitsu analytics is initialized inside provider\n } else if (jitsuInstance.analytics) {\n return { analytics: jitsuInstance.analytics };\n } else {\n throw new Error(`<JitsuProvider /> is not initialized with undefined analytics instance`);\n }\n}\n\nexport default useJitsu;\nexport { AnalyticsInterface, JitsuOptions };\n"],"names":["JitsuContext","createContext","JitsuProvider","props","instance","options","disabled","analytics","emptyAnalytics","host","msg","console","error","jitsuAnalytics","React","Provider","value","children","useJitsu","opts","jitsuInstance","useContext","echoEvents","Error"],"mappings":";;;AAKA,IAAMA,YAAY,GA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IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEG,UAAU,EAAE;IACzC,MAAM,IAAIC,KAAK,CACb,2IAA2I,CAC5I;GAEF,MAAM,IAAIH,aAAa,CAACb,SAAS,EAAE;IAClC,OAAO;MAAEA,SAAS,EAAEa,aAAa,CAACb;KAAW;GAC9C,MAAM;IACL,MAAM,IAAIgB,KAAK,0EAA0E;;AAE7F;;;;;;"}
|
package/dist/index.modern.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createContext, createElement,
|
|
1
|
+
import { createContext, createElement, useContext } from 'react';
|
|
2
2
|
import { jitsuAnalytics, emptyAnalytics } from '@jitsu/js';
|
|
3
|
-
import { emptyAnalytics as emptyAnalytics$1 } from '@jitsu/js/compiled/src';
|
|
4
3
|
|
|
5
4
|
var JitsuContext = createContext(null);
|
|
6
5
|
|
|
@@ -10,7 +9,6 @@ var JitsuProvider = function JitsuProvider(props) {
|
|
|
10
9
|
instance = {
|
|
11
10
|
analytics: emptyAnalytics
|
|
12
11
|
};
|
|
13
|
-
return createElement(Fragment, null, props.children);
|
|
14
12
|
} else if (!props.options.host) {
|
|
15
13
|
var msg = "<JitsuProvider />. Jitsu host is not defined. Jitsu will not be initialized";
|
|
16
14
|
console.error("%c" + msg, "color: red; font-weight: bold;");
|
|
@@ -31,7 +29,7 @@ function useJitsu(opts) {
|
|
|
31
29
|
var jitsuInstance = useContext(JitsuContext);
|
|
32
30
|
if (opts !== null && opts !== void 0 && opts.disabled) {
|
|
33
31
|
return {
|
|
34
|
-
analytics: emptyAnalytics
|
|
32
|
+
analytics: emptyAnalytics
|
|
35
33
|
};
|
|
36
34
|
}
|
|
37
35
|
if (!jitsuInstance) {
|
|
@@ -43,7 +41,7 @@ function useJitsu(opts) {
|
|
|
43
41
|
var msg = "Before calling useJitsu() hook, please wrap your component into <JitsuProvider />. Read more in http://jitsu.com/docs/sending-data/js-sdk/react";
|
|
44
42
|
console.error("%c" + msg, "color: red; font-weight: bold;");
|
|
45
43
|
return {
|
|
46
|
-
analytics: emptyAnalytics
|
|
44
|
+
analytics: emptyAnalytics
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
47
|
} else if (opts !== null && opts !== void 0 && opts.host || opts !== null && opts !== void 0 && opts.echoEvents) {
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/JitsuContext.tsx","../src/JitsuProvider.tsx","../src/useJitsu.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport { AnalyticsInterface } from \"@jitsu/js\";\n\nexport type JitsuInstance = { analytics: AnalyticsInterface };\n\nconst JitsuContext = createContext<JitsuInstance | null>(null);\n\nexport default JitsuContext;\n","import * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\nimport JitsuContext, { JitsuInstance } from \"./JitsuContext\";\nimport { emptyAnalytics, jitsuAnalytics } from \"@jitsu/js\";\nimport { ExtendedJitsuOptions } from \"./useJitsu\";\n\nconst JitsuProvider: React.FC<PropsWithChildren<{ options: ExtendedJitsuOptions }>> = props => {\n let instance: JitsuInstance;\n if (props.options.disabled) {\n instance = { analytics: emptyAnalytics };\n
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/JitsuContext.tsx","../src/JitsuProvider.tsx","../src/useJitsu.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport { AnalyticsInterface } from \"@jitsu/js\";\n\nexport type JitsuInstance = { analytics: AnalyticsInterface };\n\nconst JitsuContext = createContext<JitsuInstance | null>(null);\n\nexport default JitsuContext;\n","import * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\nimport JitsuContext, { JitsuInstance } from \"./JitsuContext\";\nimport { emptyAnalytics, jitsuAnalytics } from \"@jitsu/js\";\nimport { ExtendedJitsuOptions } from \"./useJitsu\";\n\nconst JitsuProvider: React.FC<PropsWithChildren<{ options: ExtendedJitsuOptions }>> = props => {\n let instance: JitsuInstance;\n if (props.options.disabled) {\n instance = { analytics: emptyAnalytics };\n } else if (!props.options.host) {\n const msg = \"<JitsuProvider />. Jitsu host is not defined. Jitsu will not be initialized\";\n console.error(`%c${msg}`, \"color: red; font-weight: bold;\");\n instance = { analytics: emptyAnalytics };\n } else {\n instance = { analytics: jitsuAnalytics(props.options) };\n }\n return <JitsuContext.Provider value={instance}>{props.children}</JitsuContext.Provider>;\n};\n\nexport default JitsuProvider;\n","import { useContext } from \"react\";\nimport JitsuContext from \"./JitsuContext\";\n\nimport { AnalyticsInterface, jitsuAnalytics, JitsuOptions, emptyAnalytics } from \"@jitsu/js\";\n\nexport interface BeforeEffect {\n effect: (analytics: AnalyticsInterface) => any;\n deps: any[];\n}\n\nexport type ExtendedJitsuOptions =\n | (Omit<JitsuOptions, \"host\"> & { host: string } & {\n disabled?: false | undefined;\n echoEvents?: boolean;\n })\n | { disabled: true };\n\n/**\n * See for details http://jitsu.com/docs/sending-data/js-sdk/react\n */\nfunction useJitsu(opts?: ExtendedJitsuOptions): { analytics: AnalyticsInterface } {\n let jitsuInstance = useContext(JitsuContext);\n if (opts?.disabled) {\n return { analytics: emptyAnalytics };\n }\n if (!jitsuInstance) {\n if (opts?.host || opts?.echoEvents) {\n return { analytics: jitsuAnalytics(opts) };\n } else {\n const msg =\n \"Before calling useJitsu() hook, please wrap your component into <JitsuProvider />. Read more in http://jitsu.com/docs/sending-data/js-sdk/react\";\n console.error(`%c${msg}`, \"color: red; font-weight: bold;\");\n return { analytics: emptyAnalytics };\n }\n } else if (opts?.host || opts?.echoEvents) {\n throw new Error(\n \"Jitsu client already set up with <JitsuProvider /> and cannot be overridden. Read more in http://jitsu.com/docs/sending-data/js-sdk/react\"\n );\n //Jitsu analytics is initialized inside provider\n } else if (jitsuInstance.analytics) {\n return { analytics: jitsuInstance.analytics };\n } else {\n throw new Error(`<JitsuProvider /> is not initialized with undefined analytics instance`);\n }\n}\n\nexport default useJitsu;\nexport { AnalyticsInterface, JitsuOptions };\n"],"names":["JitsuContext","createContext","JitsuProvider","props","instance","options","disabled","analytics","emptyAnalytics","host","msg","console","error","jitsuAnalytics","React","Provider","value","children","useJitsu","opts","jitsuInstance","useContext","echoEvents","Error"],"mappings":";;;AAKA,IAAMA,YAAY,GAAGC,aAAa,CAAuB,IAAI,CAAC;;ACC9D,IAAMC,aAAa,GAAmE,SAAhFA,aAAa,CAAmEC,KAAK;EACzF,IAAIC,QAAuB;EAC3B,IAAID,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAE;IAC1BF,QAAQ,GAAG;MAAEG,SAAS,EAAEC;KAAgB;GACzC,MAAM,IAAI,CAACL,KAAK,CAACE,OAAO,CAACI,IAAI,EAAE;IAC9B,IAAMC,GAAG,GAAG,6EAA6E;IACzFC,OAAO,CAACC,KAAK,QAAMF,GAAG,EAAI,gCAAgC,CAAC;IAC3DN,QAAQ,GAAG;MAAEG,SAAS,EAAEC;KAAgB;GACzC,MAAM;IACLJ,QAAQ,GAAG;MAAEG,SAAS,EAAEM,cAAc,CAACV,KAAK,CAACE,OAAO;KAAG;;EAEzD,OAAOS,cAACd,YAAY,CAACe,QAAQ;IAACC,KAAK,EAAEZ;KAAWD,KAAK,CAACc,QAAQ,CAAyB;AACzF,CAAC;;ACED,SAASC,QAAQ,CAACC,IAA2B;EAC3C,IAAIC,aAAa,GAAGC,UAAU,CAACrB,YAAY,CAAC;EAC5C,IAAImB,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEb,QAAQ,EAAE;IAClB,OAAO;MAAEC,SAAS,EAAEC;KAAgB;;EAEtC,IAAI,CAACY,aAAa,EAAE;IAClB,IAAID,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEV,IAAI,IAAIU,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEG,UAAU,EAAE;MAClC,OAAO;QAAEf,SAAS,EAAEM,cAAc,CAACM,IAAI;OAAG;KAC3C,MAAM;MACL,IAAMT,GAAG,GACP,iJAAiJ;MACnJC,OAAO,CAACC,KAAK,QAAMF,GAAG,EAAI,gCAAgC,CAAC;MAC3D,OAAO;QAAEH,SAAS,EAAEC;OAAgB;;GAEvC,MAAM,IAAIW,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEV,IAAI,IAAIU,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEG,UAAU,EAAE;IACzC,MAAM,IAAIC,KAAK,CACb,2IAA2I,CAC5I;GAEF,MAAM,IAAIH,aAAa,CAACb,SAAS,EAAE;IAClC,OAAO;MAAEA,SAAS,EAAEa,aAAa,CAACb;KAAW;GAC9C,MAAM;IACL,MAAM,IAAIgB,KAAK,0EAA0E;;AAE7F;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jitsu/jitsu-react",
|
|
3
|
-
"version": "1.1.0-canary.
|
|
3
|
+
"version": "1.1.0-canary.212.20230220173912",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"node": ">=10"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@jitsu/js": "1.1.0-canary.
|
|
14
|
+
"@jitsu/js": "1.1.0-canary.212.20230220173912"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "15.x || 16.x || 17.x || 18.x",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/node": "^18.11.9",
|
|
37
37
|
"microbundle-crl": "^0.13.11",
|
|
38
38
|
"typescript": "^4.9.3",
|
|
39
|
-
"@jitsu/js": "1.1.0-canary.
|
|
39
|
+
"@jitsu/js": "1.1.0-canary.212.20230220173912"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist"
|