@ninetailed/experience.js-gatsby 3.0.0-beta.15 → 3.0.0-beta.17
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/Tracker.js +31 -0
- package/gatsby-browser.d.ts +3 -0
- package/gatsby-browser.js +53 -20
- package/gatsby-node.d.ts +8 -0
- package/gatsby-node.js +40 -47
- package/gatsby-ssr.d.ts +3 -0
- package/gatsby-ssr.js +18 -14
- package/index.d.ts +1 -0
- package/index.js +4 -5
- package/ninetailed-plugins.js +6289 -0
- package/package.json +7 -18
- package/plugin-options.d.ts +8 -0
- package/src/index.d.ts +2 -0
- package/src/lib/Tracker/Tracker.d.ts +1 -0
- package/src/lib/Tracker/index.d.ts +1 -0
- package/gatsby-browser.js.map +0 -1
- package/gatsby-node.js.map +0 -1
- package/gatsby-ssr.js.map +0 -1
- package/index.js.map +0 -1
- package/jest.config.js +0 -14
- package/jest.config.js.map +0 -1
- package/loaders/ninetailed-plugins.js +0 -27
- package/loaders/ninetailed-plugins.js.map +0 -1
- package/plugin-options.js +0 -3
- package/plugin-options.js.map +0 -1
- package/src/index.js +0 -9
- package/src/index.js.map +0 -1
- package/src/lib/Tracker/Tracker.js +0 -31
- package/src/lib/Tracker/Tracker.js.map +0 -1
- package/src/lib/Tracker/index.js +0 -5
- package/src/lib/Tracker/index.js.map +0 -1
package/Tracker.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Location } from '@reach/router';
|
|
3
|
+
import { useNinetailed } from '@ninetailed/experience.js-react';
|
|
4
|
+
|
|
5
|
+
const usePrevious = value => {
|
|
6
|
+
const ref = useRef();
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
});
|
|
10
|
+
return ref.current;
|
|
11
|
+
};
|
|
12
|
+
const Executor = ({
|
|
13
|
+
location
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
page
|
|
17
|
+
} = useNinetailed();
|
|
18
|
+
const previousPathname = usePrevious(location);
|
|
19
|
+
const pathname = location.pathname;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (pathname !== previousPathname) {
|
|
22
|
+
page();
|
|
23
|
+
}
|
|
24
|
+
}, [pathname, previousPathname, page]);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
const Tracker = () => {
|
|
28
|
+
return /*#__PURE__*/React.createElement(Location, null, location => /*#__PURE__*/React.createElement(Executor, Object.assign({}, location)));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { Tracker as T };
|
package/gatsby-browser.js
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NinetailedProvider } from '@ninetailed/experience.js-react';
|
|
3
|
+
import { T as Tracker } from './Tracker.js';
|
|
4
|
+
import { n as ninetailedPlugins } from './ninetailed-plugins.js';
|
|
5
|
+
import '@reach/router';
|
|
6
|
+
import 'path';
|
|
7
|
+
import 'crypto';
|
|
8
|
+
|
|
9
|
+
/******************************************************************************
|
|
10
|
+
Copyright (c) Microsoft Corporation.
|
|
11
|
+
|
|
12
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
+
purpose with or without fee is hereby granted.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
+
***************************************************************************** */
|
|
23
|
+
|
|
24
|
+
function __rest(s, e) {
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
27
|
+
t[p] = s[p];
|
|
28
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
29
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
30
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
31
|
+
t[p[i]] = s[p[i]];
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const WrapRootElement = _a => {
|
|
37
|
+
var {
|
|
38
|
+
children
|
|
39
|
+
} = _a,
|
|
40
|
+
options = __rest(_a, ["children"]);
|
|
41
|
+
const resolvedPlugins = ninetailedPlugins.plugins.map(({
|
|
42
|
+
plugin,
|
|
43
|
+
options
|
|
44
|
+
}) => plugin(options));
|
|
45
|
+
return /*#__PURE__*/React.createElement(NinetailedProvider, Object.assign({}, options, {
|
|
46
|
+
plugins: resolvedPlugins
|
|
47
|
+
}), /*#__PURE__*/React.createElement(Tracker, null), children);
|
|
17
48
|
};
|
|
18
49
|
const wrapRootElement = (args, options) => {
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
const {
|
|
51
|
+
element
|
|
52
|
+
} = args;
|
|
53
|
+
return /*#__PURE__*/React.createElement(WrapRootElement, Object.assign({}, options), element);
|
|
21
54
|
};
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
|
|
56
|
+
export { wrapRootElement };
|
package/gatsby-node.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PluginOptionsSchemaArgs, CreateWebpackConfigArgs } from 'gatsby';
|
|
2
|
+
import { ObjectSchema } from 'gatsby-plugin-utils';
|
|
3
|
+
import { PluginOptions } from './plugin-options';
|
|
4
|
+
export declare const pluginOptionsSchema: ({ Joi, }: PluginOptionsSchemaArgs) => ObjectSchema<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Add the webpack config for loading MDX files
|
|
7
|
+
*/
|
|
8
|
+
export declare const onCreateWebpackConfig: ({ loaders, actions }: CreateWebpackConfigArgs, pluginOptions: PluginOptions) => void;
|
package/gatsby-node.js
CHANGED
|
@@ -1,50 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}),
|
|
14
|
-
environment: Joi.string(),
|
|
15
|
-
ninetailedPlugins: Joi.array(),
|
|
16
|
-
});
|
|
1
|
+
import require$$0 from 'path';
|
|
2
|
+
|
|
3
|
+
const pluginOptionsSchema = ({
|
|
4
|
+
Joi
|
|
5
|
+
}) => {
|
|
6
|
+
return Joi.object({
|
|
7
|
+
clientId: Joi.string().required().description("Your organizations' client id.").messages({
|
|
8
|
+
'any.required': '"clientId" needs to be specified. Get your clientId from the dashboard.'
|
|
9
|
+
}),
|
|
10
|
+
environment: Joi.string(),
|
|
11
|
+
ninetailedPlugins: Joi.array()
|
|
12
|
+
});
|
|
17
13
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* Add the webpack config for loading MDX files
|
|
14
|
+
/**
|
|
15
|
+
* Add the webpack config for loading MDX files
|
|
21
16
|
*/
|
|
22
|
-
const onCreateWebpackConfig = ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
});
|
|
17
|
+
const onCreateWebpackConfig = ({
|
|
18
|
+
loaders,
|
|
19
|
+
actions
|
|
20
|
+
}, pluginOptions) => {
|
|
21
|
+
actions.setWebpackConfig({
|
|
22
|
+
resolve: {
|
|
23
|
+
fallback: {
|
|
24
|
+
path: false,
|
|
25
|
+
crypto: false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
module: {
|
|
29
|
+
rules: [{
|
|
30
|
+
test: /ninetailed-plugins\.js$/,
|
|
31
|
+
include: __dirname,
|
|
32
|
+
use: [loaders.js(), {
|
|
33
|
+
loader: require$$0.join(__dirname, `loaders`, `ninetailed-plugins`),
|
|
34
|
+
options: {
|
|
35
|
+
plugins: pluginOptions.ninetailedPlugins
|
|
36
|
+
}
|
|
37
|
+
}]
|
|
38
|
+
}]
|
|
39
|
+
}
|
|
40
|
+
});
|
|
48
41
|
};
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
|
|
43
|
+
export { onCreateWebpackConfig, pluginOptionsSchema };
|
package/gatsby-ssr.d.ts
ADDED
package/gatsby-ssr.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
const ninetailed_plugins_1 = require("./loaders/ninetailed-plugins");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NinetailedProvider } from '@ninetailed/experience.js-react';
|
|
3
|
+
import { n as ninetailedPlugins } from './ninetailed-plugins.js';
|
|
4
|
+
import 'path';
|
|
5
|
+
import 'crypto';
|
|
6
|
+
|
|
10
7
|
const wrapRootElement = (args, options) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const resolvedPlugins = ninetailedPlugins.plugins.map(({
|
|
9
|
+
plugin,
|
|
10
|
+
options
|
|
11
|
+
}) => plugin(options));
|
|
12
|
+
const {
|
|
13
|
+
element
|
|
14
|
+
} = args;
|
|
15
|
+
return /*#__PURE__*/React.createElement(NinetailedProvider, Object.assign({}, options, {
|
|
16
|
+
plugins: resolvedPlugins
|
|
17
|
+
}), element);
|
|
14
18
|
};
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
|
|
20
|
+
export { wrapRootElement };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { T as Tracker } from './Tracker.js';
|
|
2
|
+
export * from '@ninetailed/experience.js-react';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@reach/router';
|