@remkoj/optimizely-one-nextjs 4.0.0 → 4.1.0
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/api/content-recs.js.map +1 -1
- package/dist/api/experimentation-api.js +4 -6
- package/dist/api/experimentation-api.js.map +1 -1
- package/dist/api/graph-info-service.js +3 -3
- package/dist/api/graph-info-service.js.map +1 -1
- package/dist/api/profile-api-service.js +10 -9
- package/dist/api/profile-api-service.js.map +1 -1
- package/dist/client-types.d.ts +13 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/optimizely-one-gadget/_notice.d.ts +7 -0
- package/dist/components/optimizely-one-gadget/_notice.js +9 -0
- package/dist/components/optimizely-one-gadget/_notice.js.map +1 -0
- package/dist/components/optimizely-one-gadget/_types.d.ts +24 -0
- package/dist/components/optimizely-one-gadget/_types.js +2 -0
- package/dist/components/optimizely-one-gadget/_types.js.map +1 -0
- package/dist/components/optimizely-one-gadget/audiences-panel.js +7 -6
- package/dist/components/optimizely-one-gadget/audiences-panel.js.map +1 -1
- package/dist/components/optimizely-one-gadget/gadget.d.ts +13 -0
- package/dist/components/optimizely-one-gadget/gadget.js +119 -0
- package/dist/components/optimizely-one-gadget/gadget.js.map +1 -0
- package/dist/components/optimizely-one-gadget/goals-panel.js +6 -5
- package/dist/components/optimizely-one-gadget/goals-panel.js.map +1 -1
- package/dist/components/optimizely-one-gadget/graph-panel.js +4 -3
- package/dist/components/optimizely-one-gadget/graph-panel.js.map +1 -1
- package/dist/components/optimizely-one-gadget/ids-panel.js +8 -3
- package/dist/components/optimizely-one-gadget/ids-panel.js.map +1 -1
- package/dist/components/optimizely-one-gadget/index.d.ts +3 -32
- package/dist/components/optimizely-one-gadget/index.js +15 -66
- package/dist/components/optimizely-one-gadget/index.js.map +1 -1
- package/dist/components/optimizely-one-gadget/interests-panel.js +6 -5
- package/dist/components/optimizely-one-gadget/interests-panel.js.map +1 -1
- package/dist/components/optimizely-one-gadget/profile-panel.js +4 -3
- package/dist/components/optimizely-one-gadget/profile-panel.js.map +1 -1
- package/dist/components/rsc.d.ts +2 -0
- package/dist/components/rsc.js +3 -0
- package/dist/components/rsc.js.map +1 -0
- package/dist/config.d.ts +22 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/env-vars.js.map +1 -1
- package/dist/products/content-recs/api.js +8 -7
- package/dist/products/content-recs/api.js.map +1 -1
- package/dist/products/data-platform/api.js +14 -16
- package/dist/products/data-platform/api.js.map +1 -1
- package/dist/products/data-platform/helpers.d.ts +2 -1
- package/dist/products/data-platform/helpers.js +3 -5
- package/dist/products/data-platform/helpers.js.map +1 -1
- package/dist/products/data-platform/snippet.d.ts +1 -1
- package/dist/products/data-platform/snippet.js +2 -0
- package/dist/products/data-platform/snippet.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/server.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/session.d.ts +2 -2
- package/dist/utils/session.js +4 -7
- package/dist/utils/session.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* The API Route at which the companion API has been installed in your
|
|
6
|
-
* Next.JS Application.
|
|
7
|
-
*
|
|
8
|
-
* If not set, defaults to "/api/me"
|
|
9
|
-
*/
|
|
10
|
-
servicePrefix?: string;
|
|
11
|
-
/**
|
|
12
|
-
* The interval, in milliseconds, between refreshes of the content in the
|
|
13
|
-
* debug panels.
|
|
14
|
-
*
|
|
15
|
-
* If not set, defaults to 0 (no auto refresh)
|
|
16
|
-
*/
|
|
17
|
-
refreshInterval?: number;
|
|
18
|
-
/**
|
|
19
|
-
* If set, bypasses the enabled/disabled detection allowing the application
|
|
20
|
-
* to take control of the visibility of the gadget.
|
|
21
|
-
*/
|
|
22
|
-
show?: boolean;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Add an Optimizely One Debug helper to the page, which can be triggered by
|
|
26
|
-
* the "test cookie" feature of the Optimizely Web Experimentation browser
|
|
27
|
-
* extension.
|
|
28
|
-
*
|
|
29
|
-
* @param param0 The component properties
|
|
30
|
-
* @returns The component JSX
|
|
31
|
-
*/
|
|
32
|
-
export declare const OptimizelyOneGadget: FunctionComponent<OptimizelyOneGadgetProps>;
|
|
1
|
+
import type { OptimizelyOneGadgetProps } from './_types';
|
|
2
|
+
import 'server-only';
|
|
3
|
+
export declare const OptimizelyOneGadget: ({ refreshInterval, servicePrefix, show }: OptimizelyOneGadgetProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
4
|
export default OptimizelyOneGadget;
|
|
@@ -1,70 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { Fragment, useLayoutEffect, useCallback } from 'react';
|
|
4
|
-
import useCookie from '../use-cookie';
|
|
5
|
-
import { Popover, PopoverButton, PopoverPanel, Tab, TabGroup, TabList, TabPanels, TabPanel } from '@headlessui/react';
|
|
6
|
-
import { ChevronUpIcon, UserGroupIcon, TagIcon, RocketLaunchIcon, IdentificationIcon, Square3Stack3DIcon, TrophyIcon, FingerPrintIcon } from '@heroicons/react/20/solid';
|
|
7
|
-
import OptiLogo from './logo';
|
|
8
|
-
import { useIsInTestMode } from '../use-test-mode';
|
|
9
|
-
import { useSearchParams, usePathname } from 'next/navigation';
|
|
10
|
-
// Import the Panel CSS
|
|
11
|
-
import '../../styles.css';
|
|
12
|
-
// Prepare panel imports
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import getConfig, { checkProductStatus } from '../../config';
|
|
13
3
|
import dynamic from 'next/dynamic';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
* @param param0 The component properties
|
|
29
|
-
* @returns The component JSX
|
|
30
|
-
*/
|
|
31
|
-
export const OptimizelyOneGadget = ({ servicePrefix = "/api/me", refreshInterval = 0, show = undefined }) => {
|
|
32
|
-
const inTestMode = useIsInTestMode();
|
|
33
|
-
const searchParams = useSearchParams();
|
|
34
|
-
const pathname = usePathname();
|
|
35
|
-
const wxProjectIdParam = searchParams.get('pid');
|
|
36
|
-
const [projectIdCookie, setProjectIdCookie, removeProjectIdCookie] = useCookie('wx.projectid');
|
|
37
|
-
const removeQueryParam = useCallback((paramName) => {
|
|
38
|
-
const newParams = new URLSearchParams(searchParams.toString());
|
|
39
|
-
if (newParams.has(paramName))
|
|
40
|
-
newParams.delete(paramName);
|
|
41
|
-
const newSearch = newParams.toString();
|
|
42
|
-
const newPath = pathname + (newSearch.length > 0 ? '?' + newParams.toString() : '');
|
|
43
|
-
try {
|
|
44
|
-
window.location.href = newPath;
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
console.log("🛑 Refreshing the page to apply the new Web Experimenation project failed, please refresh manually.");
|
|
48
|
-
}
|
|
49
|
-
}, [pathname, searchParams]);
|
|
50
|
-
useLayoutEffect(() => {
|
|
51
|
-
if (wxProjectIdParam != null && wxProjectIdParam != projectIdCookie) {
|
|
52
|
-
if (wxProjectIdParam == "")
|
|
53
|
-
removeProjectIdCookie();
|
|
54
|
-
else
|
|
55
|
-
setProjectIdCookie(wxProjectIdParam);
|
|
56
|
-
removeQueryParam('pid');
|
|
57
|
-
}
|
|
58
|
-
}, [wxProjectIdParam, projectIdCookie, removeQueryParam, removeProjectIdCookie, setProjectIdCookie]);
|
|
59
|
-
const forceHidden = show != undefined && show == false;
|
|
60
|
-
const forceShown = show != undefined && show == true;
|
|
61
|
-
if (forceHidden || (!forceShown && !inTestMode))
|
|
62
|
-
return _jsx(_Fragment, {});
|
|
63
|
-
console.groupCollapsed(`🔎 [Optimizely One Gadget] Initializing Optimizely Demo Gadget`);
|
|
64
|
-
console.log(`Optimizely One Demo API: ${servicePrefix}`);
|
|
65
|
-
console.log(`Refresh interval: ${refreshInterval == 0 ? 'DISABLED' : refreshInterval + 'ms'}`);
|
|
66
|
-
console.groupEnd();
|
|
67
|
-
return _jsxs(Popover, { className: "oo-gadget md:oo-fixed md:oo-bottom-0 oo-z-[500]", children: [_jsxs(PopoverButton, { className: 'oo-fixed oo-bottom-0 oo-right-0 oo-w-full oo-h-[50px] oo-flex oo-flex-row oo-justify-between oo-p-2 oo-border-t oo-border-slate-500 oo-bg-slate-100 oo-text-slate-800 md:oo-w-[350px] md:oo-right-4 md:oo-rounded-t-md md:oo-border-x oo-z-[500] oo-p-[10px] dark:oo-text-slate-800', children: [_jsx(OptiLogo, { className: 'oo-w-auto oo-h-full' }), _jsx(ChevronUpIcon, { className: "oo-ui-open:oo-rotate-180 oo-ui-open:oo-transform oo-h-full oo-w-auto oo-inline-block" })] }), _jsxs(PopoverPanel, { className: "oo-fixed oo-bottom-[50px] oo-right-0 oo-w-full oo-top-0 md:oo-border md:oo-border-slate-300 oo-bg-white md:oo-right-4 md:oo-bottom-[55px] md:oo-w-[675px] oo-z-[501] oo-max-w-full oo-flex oo-flex-col oo-justify-stretch md:oo-h-[350px] md:oo-top-auto md:oo-rounded-md md:oo-shadow-xl md:oo-overflow-hidden oo-text-slate-800 dark:oo-text-slate-800", children: [_jsxs("div", { className: "oo-border-b oo-border-slate-300 oo-bg-slate-100 oo-text-slate-800 oo-text-[18px] oo-font-bold oo-p-1 oo-flex-none md:oo-p-2", children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[24px] oo-w-[24px] oo-mr-2 oo-text-blue-500' }), "My Profile"] }), _jsxs(TabGroup, { as: Fragment, children: [_jsxs(TabList, { className: "oo-flex-none oo-flex oo-justify-between md:oo-justify-start oo-gap-2 oo-p-1 md:oo-p-2 oo-pb-0 md:oo-pb-0 oo-border-b oo-border-slate-300 oo-text-[14px]", children: [_jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Profile"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(TagIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Interests"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(TrophyIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Goals"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(UserGroupIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Audiences"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(RocketLaunchIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Experiments"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(FingerPrintIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Identifiers"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(Square3Stack3DIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Graph"] })] }), _jsxs(TabPanels, { className: "oo-flex-1 md:oo-h-24 oo-overscroll-contain oo-overflow-y-auto", children: [_jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Profile, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Interests, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Goals, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Audiences, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Experiments, {}) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Ids, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Graph, { servicePrefix: servicePrefix }) })] })] })] })] });
|
|
4
|
+
import { Suspense } from 'react';
|
|
5
|
+
import 'server-only';
|
|
6
|
+
const OptimizelyOneClientGadget = dynamic(() => import('./gadget'), { ssr: false });
|
|
7
|
+
export const OptimizelyOneGadget = ({ refreshInterval = 0, servicePrefix = '/api/me', show }) => {
|
|
8
|
+
const optiOneConfig = getConfig();
|
|
9
|
+
const { HelperEnabled, OptimizelyDebug } = optiOneConfig;
|
|
10
|
+
const productStatus = checkProductStatus(optiOneConfig);
|
|
11
|
+
if (show || (show === undefined && HelperEnabled)) {
|
|
12
|
+
return _jsx(Suspense, { fallback: null, children: _jsx(OptimizelyOneClientGadget, { refreshInterval: refreshInterval, servicePrefix: servicePrefix, show: show, showContentRecs: productStatus.contentRecsApi, showDataPlatform: productStatus.dataPlatform, showWebEx: productStatus.webExperimentation }) });
|
|
13
|
+
}
|
|
14
|
+
if (OptimizelyDebug)
|
|
15
|
+
console.log(`🚀 [OptimizelyOne Gadget] Gadget disabled by ${show === undefined ? 'configuration' : 'parameter'}`);
|
|
16
|
+
return null;
|
|
68
17
|
};
|
|
69
18
|
export default OptimizelyOneGadget;
|
|
70
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/index.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,EAAE,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,aAAa,CAAA;AAEpB,MAAM,yBAAyB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;AAEnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,eAAe,GAAG,CAAC,EACnB,aAAa,GAAG,SAAS,EACzB,IAAI,EACmB,EAAE,EAAE;IAE3B,MAAM,aAAa,GAAG,SAAS,EAAE,CAAA;IACjC,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,aAAa,CAAA;IACxD,MAAM,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAA;IAEvD,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,aAAa,CAAC,EACjD,CAAC;QACG,OAAO,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YAC3B,KAAC,yBAAyB,IAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAG,aAAa,CAAC,cAAc,EAAG,gBAAgB,EAAG,aAAa,CAAC,YAAY,EAAG,SAAS,EAAG,aAAa,CAAC,kBAAkB,GAAK,GAClP,CAAA;IACf,CAAC;IAED,IAAI,eAAe;QACf,OAAO,CAAC,GAAG,CAAC,gDAAiD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAA;IACtH,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { TagIcon
|
|
2
|
+
import { TagIcon } from '@heroicons/react/20/solid';
|
|
3
3
|
import useSWR from 'swr';
|
|
4
|
+
import Notice from './_notice';
|
|
4
5
|
export const InterestsPanel = ({ servicePrefix = '/api/me', refreshInterval = 2000 }) => {
|
|
5
6
|
const topics = `${servicePrefix}?scope=topics`;
|
|
6
7
|
const { data: profile, isLoading, isValidating, error } = useSWR(topics, {
|
|
@@ -13,11 +14,11 @@ export const InterestsPanel = ({ servicePrefix = '/api/me', refreshInterval = 20
|
|
|
13
14
|
refreshInterval
|
|
14
15
|
});
|
|
15
16
|
if (error)
|
|
16
|
-
return _jsx(
|
|
17
|
-
const contentTopics = (profile?.contentTopics ?? []).map(t => _jsxs("li", { className: 'oo-
|
|
17
|
+
return _jsx(Notice, { children: "There was an error loading your profile information" });
|
|
18
|
+
const contentTopics = (profile?.contentTopics ?? []).map(t => _jsxs("li", { className: 'oo-list-item', children: [_jsx(TagIcon, { className: 'oo-list-item-icon' }), t] }, "topic-" + t));
|
|
18
19
|
if (contentTopics.length == 0)
|
|
19
|
-
contentTopics.push(_jsx("li", { className: 'oo-
|
|
20
|
-
return _jsxs(_Fragment, { children: [_jsx("ul", { className: 'oo-
|
|
20
|
+
contentTopics.push(_jsx("li", { className: 'oo-list-item', children: _jsx(Notice, { children: "No topics inferred from behaviour" }) }, "no-topics"));
|
|
21
|
+
return _jsxs(_Fragment, { children: [_jsx("ul", { className: 'oo-list', children: contentTopics }), _jsx("p", { className: 'oo-small', children: "Powered by: Optimizely Content Recommendations" }), (isValidating && !isLoading) && _jsx(Notice, { isLoading: true, children: " Refreshing interests" }), isLoading && _jsx(Notice, { isLoading: true, children: " Loading interests" })] });
|
|
21
22
|
};
|
|
22
23
|
export default InterestsPanel;
|
|
23
24
|
//# sourceMappingURL=interests-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interests-panel.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/interests-panel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interests-panel.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/interests-panel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,MAAM,MAAM,KAAK,CAAA;AAExB,OAAO,MAAM,MAAM,WAAW,CAAA;AAQ9B,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,EAAE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e,cAAc,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { UserCircleIcon } from '@heroicons/react/20/solid';
|
|
3
3
|
import useSWR from 'swr';
|
|
4
|
+
import Notice from './_notice';
|
|
4
5
|
export const ProfilePanel = ({ servicePrefix = '/api/me', refreshInterval = 2000 }) => {
|
|
5
6
|
const topics = `${servicePrefix}?scope=profile`;
|
|
6
7
|
const { data: profile, isLoading, isValidating, error } = useSWR(topics, {
|
|
@@ -13,8 +14,8 @@ export const ProfilePanel = ({ servicePrefix = '/api/me', refreshInterval = 2000
|
|
|
13
14
|
refreshInterval
|
|
14
15
|
});
|
|
15
16
|
if (error)
|
|
16
|
-
return _jsx(
|
|
17
|
-
return _jsxs(_Fragment, { children: [profile && !profile.profile && _jsx(
|
|
17
|
+
return _jsx(Notice, { message: 'There was an error loading your profile information' });
|
|
18
|
+
return _jsxs(_Fragment, { children: [profile && !profile.profile && _jsx(Notice, { message: 'Anonymous session' }), profile && profile.profile && _jsxs("div", { className: 'oo-w-full oo-flex oo-flex-row oo-gap-4 oo-mb-2', children: [_jsx("div", { className: 'oo-flex-none oo-w-[100px]', children: profile.profile.image_url ? _jsx("img", { src: profile.profile.image_url, alt: profile.profile.name ?? '', className: 'oo-w-full oo-aspect-square oo-rounded-[15px]' }) : _jsx(UserCircleIcon, { className: 'oo-w-full oo-aspect-square oo-rounded-[15px]' }) }), _jsxs("div", { className: 'oo-flex-grow', children: [_jsxs("dl", { className: 'oo-grid oo-grid-cols-3 oo-gap-x-4 oo-gap-y-1', children: [_jsx("dt", { className: 'oo-definitions-term', children: "Name:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.name ? profile.profile.name : `${profile.profile.first_name ?? ''} ${profile.profile.last_name}`.trim() }), _jsx("dt", { className: 'oo-definitions-term', children: "City:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.city ?? '' }), _jsx("dt", { className: 'oo-definitions-term', children: "E-Mail:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.email ?? '' }), _jsx("dt", { className: 'oo-definitions-term', children: "Phone:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.phone ?? '' }), _jsx("dt", { className: 'oo-definitions-term', children: "Age:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.observations.computed_age_years ?? 'n/a' }), _jsx("dt", { className: 'oo-definitions-term', children: "Number of visits:" }), _jsx("dd", { className: 'oo-definitions-data', children: profile.profile.observations.session_count }), _jsx("dt", { className: 'oo-definitions-term', children: "Likelyhood of still alive:" }), _jsx("dd", { className: 'oo-definitions-data', children: `${(profile.profile.insights.probability_alive ?? 0) * 100}%` })] }), _jsx("pre", { className: 'oo-hidden', children: JSON.stringify(profile.profile, undefined, 4) })] })] }), _jsx("p", { className: 'oo-small', children: "Powered by: Optimizely Data Platform" }), isLoading && _jsx(Notice, { isLoading: true, message: 'Loading profile' })] });
|
|
18
19
|
};
|
|
19
20
|
export default ProfilePanel;
|
|
20
21
|
//# sourceMappingURL=profile-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-panel.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/profile-panel.tsx"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"profile-panel.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/profile-panel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAiB,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,MAAM,MAAM,KAAK,CAAA;AAExB,OAAO,MAAM,MAAM,WAAW,CAAA;AAQ9B,MAAM,CAAC,MAAM,YAAY,GAA0C,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,EAAE,EAAE;IAEzH,MAAM,MAAM,GAAG,GAAI,aAAc,gBAAgB,CAAA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AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../src/components/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function readConfigFromEnv(): {
|
|
2
|
+
RuntimeEnv: string;
|
|
3
|
+
OdpApiKey: string | undefined;
|
|
4
|
+
OdpService: string;
|
|
5
|
+
OdpAudienceBatchSize: number;
|
|
6
|
+
HelperEnabled: boolean;
|
|
7
|
+
ContentRecsClient: string | undefined;
|
|
8
|
+
ContentRecsDelivery: number;
|
|
9
|
+
ContentRecsDeliveryKey: string | undefined;
|
|
10
|
+
ContentRecsHost: string;
|
|
11
|
+
FrontendCookie: string;
|
|
12
|
+
WebExperimentationProject: string | undefined;
|
|
13
|
+
OptimizelyDebug: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function checkProductStatus(config?: Partial<OptiOneConfig>): {
|
|
16
|
+
dataPlatform: boolean;
|
|
17
|
+
contentRecsClient: boolean;
|
|
18
|
+
contentRecsApi: boolean;
|
|
19
|
+
webExperimentation: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type OptiOneConfig = ReturnType<typeof readConfigFromEnv>;
|
|
22
|
+
export default readConfigFromEnv;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readValue, readValueAsBoolean, readValueAsInt } from "./utils/env";
|
|
2
|
+
import EnvVars from "./env-vars";
|
|
3
|
+
export function readConfigFromEnv() {
|
|
4
|
+
return {
|
|
5
|
+
RuntimeEnv: readValue('NODE_ENV', 'production'),
|
|
6
|
+
OdpApiKey: readValue(EnvVars.OdpApiKey),
|
|
7
|
+
OdpService: readValue(EnvVars.OdpService, "https://api.zaius.com/"),
|
|
8
|
+
OdpAudienceBatchSize: readValueAsInt(EnvVars.OdpAudienceBatchSize, 25),
|
|
9
|
+
HelperEnabled: readValueAsBoolean(EnvVars.HelperEnabled, false),
|
|
10
|
+
ContentRecsClient: readValue(EnvVars.ContentRecsClient),
|
|
11
|
+
ContentRecsDelivery: readValueAsInt(EnvVars.ContentRecsDelivery, 0),
|
|
12
|
+
ContentRecsDeliveryKey: readValue(EnvVars.ContentRecsDeliveryKey),
|
|
13
|
+
ContentRecsHost: readValue(EnvVars.ContentRecsHost, "idio.co"),
|
|
14
|
+
FrontendCookie: readValue(EnvVars.FrontendCookie, "visitorId"),
|
|
15
|
+
WebExperimentationProject: readValue(EnvVars.WebExperimentationProject),
|
|
16
|
+
OptimizelyDebug: readValueAsBoolean(EnvVars.OptimizelyDebug, false)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function checkProductStatus(config) {
|
|
20
|
+
const appConfig = config ?? readConfigFromEnv();
|
|
21
|
+
return {
|
|
22
|
+
dataPlatform: typeof (appConfig.OdpApiKey) == 'string' && appConfig.OdpApiKey.length > 8,
|
|
23
|
+
contentRecsClient: appConfig.ContentRecsClient && appConfig.ContentRecsDelivery ? true : false,
|
|
24
|
+
contentRecsApi: appConfig.ContentRecsClient && appConfig.ContentRecsDeliveryKey ? true : false,
|
|
25
|
+
webExperimentation: typeof (appConfig.WebExperimentationProject) == 'string' && appConfig.WebExperimentationProject.length > 5
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export default readConfigFromEnv;
|
|
29
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,OAAO,MAAM,YAAY,CAAA;AAEhC,MAAM,UAAU,iBAAiB;IAE7B,OAAO;QACH,UAAU,EAAE,SAAS,CAA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B,EAAE,OAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,yBAAyB,CAAC,MAAM,GAAG,CAAC;KAChI,CAAA;AACL,CAAC;AAID,eAAe,iBAAiB,CAAA"}
|
package/dist/env-vars.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-vars.js","sourceRoot":"","sources":["../src/env-vars.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAkB,OAYjB;AAZD,WAAkB,OAAO;IACrB,mDAAwC,CAAA;IACxC,0DAA+C,CAAA;IAC/C,sEAA2D,CAAA;IAC3D,kDAAuC,CAAA;IACvC,8DAAmD,CAAA;IACnD,kEAAuD,CAAA;IACvD,yEAA8D,CAAA;IAC9D,4DAAiD,CAAA;IACjD,wDAA6C,CAAA;IAC7C,+EAAoE,CAAA;IACpE,+CAAoC,CAAA;AACxC,CAAC,EAZiB,OAAO,KAAP,OAAO,QAYxB;
|
|
1
|
+
{"version":3,"file":"env-vars.js","sourceRoot":"","sources":["../src/env-vars.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAkB,OAYjB;AAZD,WAAkB,OAAO;IACrB,mDAAwC,CAAA;IACxC,0DAA+C,CAAA;IAC/C,sEAA2D,CAAA;IAC3D,kDAAuC,CAAA;IACvC,8DAAmD,CAAA;IACnD,kEAAuD,CAAA;IACvD,yEAA8D,CAAA;IAC9D,4DAAiD,CAAA;IACjD,wDAA6C,CAAA;IAC7C,+EAAoE,CAAA;IACpE,+CAAoC,CAAA;AACxC,CAAC,EAZiB,OAAO,KAAP,OAAO,QAYxB;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import EnvVars from '../../env-vars';
|
|
1
|
+
import getConfig from '../../config';
|
|
3
2
|
export class ContentRecsClient {
|
|
4
3
|
_config;
|
|
5
4
|
get defaultConfig() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const config = getConfig();
|
|
6
|
+
const crConfig = {
|
|
7
|
+
clientId: config.ContentRecsClient ?? '',
|
|
8
|
+
deliveryId: config.ContentRecsDelivery,
|
|
9
|
+
deliveryKey: config.ContentRecsDeliveryKey ?? '',
|
|
10
|
+
host: config.ContentRecsHost
|
|
11
11
|
};
|
|
12
|
+
return crConfig;
|
|
12
13
|
}
|
|
13
14
|
get client() {
|
|
14
15
|
return this._config.clientId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/products/content-recs/api.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/products/content-recs/api.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAA;AASpC,MAAM,OAAO,iBAAiB;IAET,OAAO,CAA+B;IAEvD,IAAc,aAAa;QAEvB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAC1B,MAAM,QAAQ,GAAG;YACb,QAAQ,EAAE,MAAM,CAAC,iBAAiB,IAAI,EAAE;YACxC,UAAU,EAAE,MAAM,CAAC,mBAAmB;YACtC,WAAW,EAAE,MAAM,CAAC,sBAAsB,IAAI,EAAE;YAChD,IAAI,EAAE,MAAM,CAAC,eAAe;SAC/B,CAAA;QACD,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,IAAW,MAAM;QAEb,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IAChC,CAAC;IAED,IAAW,QAAQ;QAEf,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAA;IAClC,CAAC;IAED,YAAmB,OAAqC;QAEpD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,OAAO,EAAE,CAAA;QACpD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,IAAI,IA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CAAC,WAAW,CAAC,CAAA;QAC5D,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC7C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,UAAU,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;QACxH,IAAI,CAAC,IAAI;YACL,OAAO,EAAE,CAAA;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC,CAA+E,CAAA;QACjK,OAAO,KAAK,CAAC,WAAW,CAAA;IAC5B,CAAC;CACJ;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB,UAAU,CAAoB;IAC9B,QAAQ,CAAoB;IAE5C,YAAoB,OAAgB,EAAE,QAAiB,EAAE,UAAmB,EAAE,OAAsB;QAEhG,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;CACJ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as EnvTools from '../../utils/env';
|
|
2
1
|
import * as Helpers from './helpers';
|
|
3
|
-
import
|
|
2
|
+
import getConfig from '../../config';
|
|
4
3
|
/**
|
|
5
4
|
* A high level client for the Optimizely Data Platform, providing direct
|
|
6
5
|
* access to some of it's functionality. For advanced capabilities please
|
|
@@ -17,17 +16,14 @@ export class DataPlatformClient {
|
|
|
17
16
|
return this._publicKey;
|
|
18
17
|
}
|
|
19
18
|
constructor(options) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
privateApiKey: EnvTools.readValue(EnvVars.OdpApiKey, ""),
|
|
23
|
-
membershipTestChunkSize: 25
|
|
24
|
-
};
|
|
19
|
+
const { OdpService: endpoint, OdpApiKey: privateApiKey, OdpAudienceBatchSize: membershipTestChunkSize, OptimizelyDebug: debug } = getConfig();
|
|
20
|
+
const defaults = { endpoint, privateApiKey: privateApiKey || "", membershipTestChunkSize };
|
|
25
21
|
this.config = { ...defaults, ...options };
|
|
26
22
|
[this._publicKey, this._privateKey] = Helpers.parseApiKey(this.config.privateApiKey);
|
|
27
23
|
if (!this._publicKey)
|
|
28
24
|
throw new DataPlatformError("The Optimizely Data Platform configuration doesn't contain a tracker id", this.trackerId);
|
|
29
|
-
if (!this._privateKey)
|
|
30
|
-
|
|
25
|
+
if (!this._privateKey && debug)
|
|
26
|
+
console.warn('[Optimizely Data Platform]: No Private Key provided, authorized queries are not available');
|
|
31
27
|
}
|
|
32
28
|
/**
|
|
33
29
|
* Retrieve a list of all audiences available within the ODP Instance
|
|
@@ -39,8 +35,8 @@ export class DataPlatformClient {
|
|
|
39
35
|
*/
|
|
40
36
|
async getAllAudiences(throwOnError = false) {
|
|
41
37
|
const listAudiencesQuery = 'query GetAllAudiences { audiences { edges { node { name, description } } } }';
|
|
42
|
-
const listResponse = await this.privateQuery(listAudiencesQuery);
|
|
43
|
-
if (!listResponse
|
|
38
|
+
const listResponse = await this.privateQuery(listAudiencesQuery).catch(() => undefined);
|
|
39
|
+
if (!listResponse?.ok) {
|
|
44
40
|
if (throwOnError)
|
|
45
41
|
throw new DataPlatformError("Error listing all audiences within ODP", this.trackerId);
|
|
46
42
|
console.error("Error listing all audiences within ODP");
|
|
@@ -55,11 +51,11 @@ export class DataPlatformClient {
|
|
|
55
51
|
vuid,
|
|
56
52
|
audiences
|
|
57
53
|
};
|
|
58
|
-
const response = await this.privateQuery(query, variables);
|
|
59
|
-
if (response
|
|
54
|
+
const response = await this.privateQuery(query, variables).catch(() => undefined);
|
|
55
|
+
if (response?.ok)
|
|
60
56
|
return response.json()
|
|
61
57
|
.then(ds => (ds?.data?.customer?.audiences?.edges ?? []).map(e => e.node.name));
|
|
62
|
-
throw new DataPlatformError(`Error response from Optimizely Data Platform: ${response
|
|
58
|
+
throw new DataPlatformError(`Error response from Optimizely Data Platform: ${response?.status}: ${response?.statusText}`, this.trackerId);
|
|
63
59
|
}
|
|
64
60
|
async getLastSearchTerms(vuid) {
|
|
65
61
|
const query = `query LastSearchTerms ($vuid:String!) {
|
|
@@ -72,7 +68,7 @@ export class DataPlatformClient {
|
|
|
72
68
|
}
|
|
73
69
|
}`;
|
|
74
70
|
const variables = { vuid };
|
|
75
|
-
const responseData = await
|
|
71
|
+
const responseData = await this.privateQuery(query, variables).then(response => response.json()).catch(() => { return { errors: [{ message: "Uncaught error" }] }; });
|
|
76
72
|
if (responseData.errors) {
|
|
77
73
|
console.error("Error while fetching latest search terms, please check your keys");
|
|
78
74
|
console.error(responseData.errors.map((e) => e.message).join('; '));
|
|
@@ -124,7 +120,7 @@ export class DataPlatformClient {
|
|
|
124
120
|
}
|
|
125
121
|
}`;
|
|
126
122
|
const variables = { filter: `vuid='${vuid}'` };
|
|
127
|
-
const responseData = await
|
|
123
|
+
const responseData = await this.privateQuery(query, variables).then(response => response.json()).catch(() => { return { errors: [{ message: "Uncaught error" }] }; });
|
|
128
124
|
if (responseData.errors) {
|
|
129
125
|
console.error("Error while fetching latest search terms, please check your keys");
|
|
130
126
|
console.error(responseData.errors.map((e) => e.message).join('; '));
|
|
@@ -136,6 +132,8 @@ export class DataPlatformClient {
|
|
|
136
132
|
return undefined;
|
|
137
133
|
}
|
|
138
134
|
async privateQuery(graphQuery, variables) {
|
|
135
|
+
if (!this.privateKey)
|
|
136
|
+
throw new Error("Private key not set");
|
|
139
137
|
return fetch(new URL('/v3/graphql', this.config.endpoint), {
|
|
140
138
|
method: "POST",
|
|
141
139
|
body: JSON.stringify({ query: graphQuery, variables }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/products/data-platform/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/products/data-platform/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,SAAS,MAAM,cAAc,CAAA;AAUpC;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAER,MAAM,CAAsC;IAC9C,WAAW,CAAgB;IAC3B,UAAU,CAAS;IAEpC,IAAc,UAAU;QAEpB,OAAO,IAAI,CAAC,WAAW,IAAI,EAAE,CAAA;IACjC,CAAC;IAED,IAAW,SAAS;QAEhB,OAAO,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAED,YAAmB,OAA4C;QAE3D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,CAAA;QAC7I,MAAM,QAAQ,GAA+B,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,IAAI,EAAE,EAAE,uBAAuB,EAAE,CAAA;QACtH,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;QAC1C,CAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QACtF,IAAI,CAAC,IAAI,CAAC,UAAU;YAChB,MAAM,IAAI,iBAAiB,CAAC,yEAAyE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1H,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK;YAC1B,OAAO,CA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AO,KAAK,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;YACtD,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,IAAI,CAAC,UAAU;aAC/B;SACJ,CAAC,CAAA;IACN,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,UAAkB,EAAE,SAA8B;QAEjE,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;YACtD,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,IAAI,CAAC,SAAS;aAC9B;SACJ,CAAC,CAAA;IACN,CAAC;CACJ;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAEhC,UAAU,CAAU;IAE5B,IAAW,SAAS;QAEhB,OAAO,IAAI,CAAC,UAAU,IAAI,EAAE,CAAA;IAChC,CAAC;IAED,YAAmB,OAAgB,EAAE,SAAkB,EAAE,OAAsB;QAE3E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC/B,CAAC;CACJ;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReadonlyRequestCookies } from '../types';
|
|
2
|
+
import { type OptiOneConfig } from "../../config";
|
|
2
3
|
/**
|
|
3
4
|
* Process the provided API key
|
|
4
5
|
*
|
|
@@ -14,7 +15,7 @@ export declare function parseApiKey(configuredKey: string): [string, string | nu
|
|
|
14
15
|
* @returns The identifier, or undefined if not known
|
|
15
16
|
*/
|
|
16
17
|
export declare function getVisitorID(cookies: ReadonlyRequestCookies): string | undefined;
|
|
17
|
-
export declare function isEnabled(): boolean;
|
|
18
|
+
export declare function isEnabled(config?: OptiOneConfig): boolean;
|
|
18
19
|
declare const _default: {
|
|
19
20
|
getVisitorID: typeof getVisitorID;
|
|
20
21
|
parseApiKey: typeof parseApiKey;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import EnvVars from '../../env-vars';
|
|
1
|
+
import { checkProductStatus } from "../../config";
|
|
3
2
|
/**
|
|
4
3
|
* Process the provided API key
|
|
5
4
|
*
|
|
@@ -20,9 +19,8 @@ export function parseApiKey(configuredKey) {
|
|
|
20
19
|
export function getVisitorID(cookies) {
|
|
21
20
|
return cookies.get('vuid')?.value?.split("|")?.shift()?.replaceAll('-', '');
|
|
22
21
|
}
|
|
23
|
-
export function isEnabled() {
|
|
24
|
-
|
|
25
|
-
return apiKey.length > 8;
|
|
22
|
+
export function isEnabled(config) {
|
|
23
|
+
return checkProductStatus(config).dataPlatform;
|
|
26
24
|
}
|
|
27
25
|
export default {
|
|
28
26
|
getVisitorID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/products/data-platform/helpers.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/products/data-platform/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,cAAc,CAAA;AAErE;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,aAAqB;IAE7C,MAAM,CAAE,SAAS,EAAE,UAAU,CAAE,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAE,CAAA;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAA+B;IAExD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,GAAG,EAAC,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAsB;IAE5C,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,YAAY,CAAA;AAClD,CAAC;AAED,eAAe;IACX,YAAY;IACZ,WAAW;CACd,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type OptimizelyDataPlatformProps = {
|
|
2
2
|
trackerId: string;
|
|
3
3
|
};
|
|
4
|
-
export declare const OptimizelyDataPlatformScript: (props: OptimizelyDataPlatformProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const OptimizelyDataPlatformScript: (props: OptimizelyDataPlatformProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
export default OptimizelyDataPlatformScript;
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import Script from 'next/script';
|
|
4
4
|
export const OptimizelyDataPlatformScript = (props) => {
|
|
5
5
|
const odp_id = props.trackerId.split('.').shift() ?? '';
|
|
6
|
+
if (odp_id == '')
|
|
7
|
+
return null;
|
|
6
8
|
return _jsx(Script, { id: 'data-platform-script', strategy: 'beforeInteractive', children: `
|
|
7
9
|
var zaius = window['zaius'] || (window['zaius'] = []);
|
|
8
10
|
zaius.methods = ['initialize', 'onload', 'customer', 'entity', 'event', 'subscribe', 'unsubscribe', 'consent', 'identify', 'anonymize', 'dispatch'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../../src/products/data-platform/snippet.tsx"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,OAAO,MAAM,MAAM,aAAa,CAAA;AAMhC,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC/E,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;IACvD,OAAO,KAAC,MAAM,IAAC,EAAE,EAAC,sBAAsB,EAAC,QAAQ,EAAC,mBAAmB,YAAE;;;;;;;;;;;;;;;;;;;;;;;;gIAwBsD,MAAO;;;;CAIvI,GACQ,CAAA;AACT,CAAC,CAAA;AAED,eAAe,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../../src/products/data-platform/snippet.tsx"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,OAAO,MAAM,MAAM,aAAa,CAAA;AAMhC,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC/E,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;IACvD,IAAI,MAAM,IAAI,EAAE;QACZ,OAAO,IAAI,CAAA;IACf,OAAO,KAAC,MAAM,IAAC,EAAE,EAAC,sBAAsB,EAAC,QAAQ,EAAC,mBAAmB,YAAE;;;;;;;;;;;;;;;;;;;;;;;;gIAwBsD,MAAO;;;;CAIvI,GACQ,CAAA;AACT,CAAC,CAAA;AAED,eAAe,4BAA4B,CAAA"}
|
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAElC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AAEvC,MAAM,UAAU,sBAAsB;IAElC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;AACpE,CAAC;AAED,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAElC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AAEvC,MAAM,UAAU,sBAAsB;IAElC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;AACpE,CAAC;AAED,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|