@looker/embed-components 23.16.0 → 23.20.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/CHANGELOG.md +34 -0
- package/lib/GlobalStore/sagas.js.map +1 -1
- package/lib/QuickEmbed/QuickEmbed.js.map +1 -1
- package/lib/Theme/SelectTheme.js.map +1 -1
- package/lib/Theme/state/sagas.js.map +1 -1
- package/lib/esm/GlobalStore/index.js +2 -27
- package/lib/esm/GlobalStore/index.js.map +1 -1
- package/lib/esm/GlobalStore/sagas.js +10 -16
- package/lib/esm/GlobalStore/sagas.js.map +1 -1
- package/lib/esm/GlobalStore/slice.js +9 -21
- package/lib/esm/GlobalStore/slice.js.map +1 -1
- package/lib/esm/GlobalStore/store.js +8 -15
- package/lib/esm/GlobalStore/store.js.map +1 -1
- package/lib/esm/QuickEmbed/QuickEmbed.js +27 -36
- package/lib/esm/QuickEmbed/QuickEmbed.js.map +1 -1
- package/lib/esm/QuickEmbed/index.js +1 -16
- package/lib/esm/QuickEmbed/index.js.map +1 -1
- package/lib/esm/Theme/SelectTheme.js +13 -22
- package/lib/esm/Theme/SelectTheme.js.map +1 -1
- package/lib/esm/Theme/index.js +2 -27
- package/lib/esm/Theme/index.js.map +1 -1
- package/lib/esm/Theme/state/index.js +1 -16
- package/lib/esm/Theme/state/index.js.map +1 -1
- package/lib/esm/Theme/state/sagas.js +23 -29
- package/lib/esm/Theme/state/sagas.js.map +1 -1
- package/lib/esm/Theme/state/slice.js +9 -21
- package/lib/esm/Theme/state/slice.js.map +1 -1
- package/lib/esm/index.js +3 -38
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/test-utils/index.js +2 -27
- package/lib/esm/test-utils/index.js.map +1 -1
- package/lib/esm/test-utils/store.js +8 -15
- package/lib/esm/test-utils/store.js.map +1 -1
- package/lib/esm/test-utils/utils.js +11 -25
- package/lib/esm/test-utils/utils.js.map +1 -1
- package/lib/test-utils/utils.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,37 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.SelectTheme = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _components = require("@looker/components");
|
|
9
|
-
var _state = require("./state");
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
var SelectTheme = () => {
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Select, SpaceVertical, ValidationMessage } from '@looker/components';
|
|
3
|
+
import { useThemeActions, useThemesStoreState } from './state';
|
|
4
|
+
export var SelectTheme = () => {
|
|
13
5
|
var {
|
|
14
6
|
initialized,
|
|
15
7
|
themes,
|
|
16
8
|
selectedTheme,
|
|
17
9
|
error,
|
|
18
10
|
working
|
|
19
|
-
} =
|
|
11
|
+
} = useThemesStoreState();
|
|
20
12
|
var {
|
|
21
13
|
initAction,
|
|
22
14
|
loadThemeDataAction,
|
|
23
15
|
selectThemeAction
|
|
24
|
-
} =
|
|
25
|
-
var [options, setOptions] =
|
|
26
|
-
|
|
16
|
+
} = useThemeActions();
|
|
17
|
+
var [options, setOptions] = useState([]);
|
|
18
|
+
useEffect(() => {
|
|
27
19
|
initAction();
|
|
28
20
|
}, []);
|
|
29
|
-
|
|
21
|
+
useEffect(() => {
|
|
30
22
|
if (initialized) {
|
|
31
23
|
loadThemeDataAction();
|
|
32
24
|
}
|
|
33
25
|
}, [initialized]);
|
|
34
|
-
|
|
26
|
+
useEffect(() => {
|
|
35
27
|
var themeOptions = themes.map(theme => ({
|
|
36
28
|
value: theme.id,
|
|
37
29
|
label: theme.name
|
|
@@ -43,19 +35,18 @@ var SelectTheme = () => {
|
|
|
43
35
|
key
|
|
44
36
|
});
|
|
45
37
|
};
|
|
46
|
-
return
|
|
38
|
+
return React.createElement(SpaceVertical, {
|
|
47
39
|
gap: "xxxsmall"
|
|
48
|
-
},
|
|
40
|
+
}, React.createElement(Select, {
|
|
49
41
|
disabled: themes.length <= 1,
|
|
50
42
|
isLoading: !initialized || working,
|
|
51
43
|
validationType: error ? 'error' : undefined,
|
|
52
44
|
value: selectedTheme.name,
|
|
53
45
|
options: options,
|
|
54
46
|
onChange: handleChange
|
|
55
|
-
}), error &&
|
|
47
|
+
}), error && React.createElement(ValidationMessage, {
|
|
56
48
|
type: "error",
|
|
57
49
|
message: error
|
|
58
50
|
}));
|
|
59
51
|
};
|
|
60
|
-
exports.SelectTheme = SelectTheme;
|
|
61
52
|
//# sourceMappingURL=SelectTheme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTheme.js","names":["
|
|
1
|
+
{"version":3,"file":"SelectTheme.js","names":["React","useState","useEffect","Select","SpaceVertical","ValidationMessage","useThemeActions","useThemesStoreState","SelectTheme","initialized","themes","selectedTheme","error","working","initAction","loadThemeDataAction","selectThemeAction","options","setOptions","themeOptions","map","theme","value","id","label","name","sort","x","y","localeCompare","handleChange","key","createElement","gap","disabled","length","isLoading","validationType","undefined","onChange","type","message"],"sources":["../../../src/Theme/SelectTheme.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport React, { useState, useEffect } from 'react'\nimport { Select, SpaceVertical, ValidationMessage } from '@looker/components'\nimport type { SelectOptionObject } from '@looker/components'\nimport { useThemeActions, useThemesStoreState } from './state'\n\nexport const SelectTheme = () => {\n const { initialized, themes, selectedTheme, error, working } =\n useThemesStoreState()\n const { initAction, loadThemeDataAction, selectThemeAction } =\n useThemeActions()\n const [options, setOptions] = useState<SelectOptionObject[]>([])\n\n useEffect(() => {\n /** initialize theme service */\n initAction()\n }, [])\n\n useEffect(() => {\n if (initialized) {\n /** If theme service is initialized, load all theme data */\n loadThemeDataAction()\n }\n }, [initialized])\n\n useEffect(() => {\n const themeOptions: SelectOptionObject[] = themes\n .map((theme) => ({\n value: theme.id!,\n label: theme.name,\n }))\n .sort((x, y) => x.label!.localeCompare(y.label!))\n setOptions(themeOptions)\n }, [themes])\n\n const handleChange = (key: string) => {\n selectThemeAction({ key })\n }\n\n return (\n <SpaceVertical gap=\"xxxsmall\">\n <Select\n disabled={themes.length <= 1}\n isLoading={!initialized || working}\n validationType={error ? 'error' : undefined}\n value={selectedTheme.name}\n options={options}\n onChange={handleChange}\n />\n {error && <ValidationMessage type=\"error\" message={error} />}\n </SpaceVertical>\n )\n}\n"],"mappings":"AAyBA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SAASC,MAAM,EAAEC,aAAa,EAAEC,iBAAiB,QAAQ,oBAAoB;AAE7E,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,SAAS;AAE9D,OAAO,IAAMC,WAAW,GAAGA,CAAA,KAAM;EAC/B,IAAM;IAAEC,WAAW;IAAEC,MAAM;IAAEC,aAAa;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAC1DN,mBAAmB,CAAC,CAAC;EACvB,IAAM;IAAEO,UAAU;IAAEC,mBAAmB;IAAEC;EAAkB,CAAC,GAC1DV,eAAe,CAAC,CAAC;EACnB,IAAM,CAACW,OAAO,EAAEC,UAAU,CAAC,GAAGjB,QAAQ,CAAuB,EAAE,CAAC;EAEhEC,SAAS,CAAC,MAAM;IAEdY,UAAU,CAAC,CAAC;EACd,CAAC,EAAE,EAAE,CAAC;EAENZ,SAAS,CAAC,MAAM;IACd,IAAIO,WAAW,EAAE;MAEfM,mBAAmB,CAAC,CAAC;IACvB;EACF,CAAC,EAAE,CAACN,WAAW,CAAC,CAAC;EAEjBP,SAAS,CAAC,MAAM;IACd,IAAMiB,YAAkC,GAAGT,MAAM,CAC9CU,GAAG,CAAEC,KAAK,KAAM;MACfC,KAAK,EAAED,KAAK,CAACE,EAAG;MAChBC,KAAK,EAAEH,KAAK,CAACI;IACf,CAAC,CAAC,CAAC,CACFC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACH,KAAK,CAAEK,aAAa,CAACD,CAAC,CAACJ,KAAM,CAAC,CAAC;IACnDN,UAAU,CAACC,YAAY,CAAC;EAC1B,CAAC,EAAE,CAACT,MAAM,CAAC,CAAC;EAEZ,IAAMoB,YAAY,GAAIC,GAAW,IAAK;IACpCf,iBAAiB,CAAC;MAAEe;IAAI,CAAC,CAAC;EAC5B,CAAC;EAED,OACE/B,KAAA,CAAAgC,aAAA,CAAC5B,aAAa;IAAC6B,GAAG,EAAC;EAAU,GAC3BjC,KAAA,CAAAgC,aAAA,CAAC7B,MAAM;IACL+B,QAAQ,EAAExB,MAAM,CAACyB,MAAM,IAAI,CAAE;IAC7BC,SAAS,EAAE,CAAC3B,WAAW,IAAII,OAAQ;IACnCwB,cAAc,EAAEzB,KAAK,GAAG,OAAO,GAAG0B,SAAU;IAC5ChB,KAAK,EAAEX,aAAa,CAACc,IAAK;IAC1BR,OAAO,EAAEA,OAAQ;IACjBsB,QAAQ,EAAET;EAAa,CACxB,CAAC,EACDlB,KAAK,IAAIZ,KAAA,CAAAgC,aAAA,CAAC3B,iBAAiB;IAACmC,IAAI,EAAC,OAAO;IAACC,OAAO,EAAE7B;EAAM,CAAE,CAC9C,CAAC;AAEpB,CAAC"}
|
package/lib/esm/Theme/index.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
SelectTheme: true
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "SelectTheme", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _SelectTheme.SelectTheme;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
var _SelectTheme = require("./SelectTheme");
|
|
16
|
-
var _state = require("./state");
|
|
17
|
-
Object.keys(_state).forEach(function (key) {
|
|
18
|
-
if (key === "default" || key === "__esModule") return;
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
-
if (key in exports && exports[key] === _state[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _state[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
export { SelectTheme } from './SelectTheme';
|
|
2
|
+
export * from './state';
|
|
28
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["SelectTheme"],"sources":["../../../src/Theme/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { SelectTheme } from './SelectTheme'\nexport * from './state'\n"],"mappings":"AAyBA,SAASA,WAAW,QAAQ,eAAe;AAC3C,cAAc,SAAS"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _slice = require("./slice");
|
|
7
|
-
Object.keys(_slice).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _slice[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _slice[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
export * from './slice';
|
|
17
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/Theme/state/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './slice'\n"],"mappings":"AAyBA,cAAc,SAAS"}
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.saga = saga;
|
|
7
|
-
var _typedReduxSaga = require("typed-redux-saga");
|
|
8
|
-
var _embedServices = require("@looker/embed-services");
|
|
9
|
-
var _slice = require("./slice");
|
|
1
|
+
import { takeEvery, put, call } from 'typed-redux-saga';
|
|
2
|
+
import { registerThemeService, getThemeService, EmbedUrl } from '@looker/embed-services';
|
|
3
|
+
import { themeActions } from './slice';
|
|
10
4
|
function* initSaga() {
|
|
11
5
|
var {
|
|
12
6
|
initSuccessAction,
|
|
13
7
|
setFailureAction
|
|
14
|
-
} =
|
|
8
|
+
} = themeActions;
|
|
15
9
|
try {
|
|
16
|
-
|
|
17
|
-
yield*
|
|
10
|
+
registerThemeService();
|
|
11
|
+
yield* put(initSuccessAction());
|
|
18
12
|
} catch (error) {
|
|
19
|
-
yield*
|
|
13
|
+
yield* put(setFailureAction({
|
|
20
14
|
error: error.message
|
|
21
15
|
}));
|
|
22
16
|
}
|
|
@@ -25,24 +19,24 @@ function* loadThemeDataSaga() {
|
|
|
25
19
|
var {
|
|
26
20
|
loadThemeDataSuccessAction,
|
|
27
21
|
setFailureAction
|
|
28
|
-
} =
|
|
22
|
+
} = themeActions;
|
|
29
23
|
try {
|
|
30
24
|
var _urlTheme;
|
|
31
|
-
var service =
|
|
32
|
-
yield*
|
|
33
|
-
var searchParams = new
|
|
25
|
+
var service = getThemeService();
|
|
26
|
+
yield* call([service, 'load']);
|
|
27
|
+
var searchParams = new EmbedUrl().searchParams;
|
|
34
28
|
var urlThemeName = searchParams.theme;
|
|
35
29
|
var urlTheme;
|
|
36
30
|
if (urlThemeName) {
|
|
37
31
|
urlTheme = service.find('name', urlThemeName);
|
|
38
32
|
}
|
|
39
|
-
yield*
|
|
33
|
+
yield* put(loadThemeDataSuccessAction({
|
|
40
34
|
themes: service.items,
|
|
41
35
|
defaultTheme: service.defaultTheme,
|
|
42
36
|
selectedTheme: (_urlTheme = urlTheme) !== null && _urlTheme !== void 0 ? _urlTheme : service.defaultTheme
|
|
43
37
|
}));
|
|
44
38
|
} catch (error) {
|
|
45
|
-
yield*
|
|
39
|
+
yield* put(setFailureAction({
|
|
46
40
|
error: error.message
|
|
47
41
|
}));
|
|
48
42
|
}
|
|
@@ -51,33 +45,33 @@ function* selectThemeSaga(action) {
|
|
|
51
45
|
var {
|
|
52
46
|
selectThemeSuccessAction,
|
|
53
47
|
setFailureAction
|
|
54
|
-
} =
|
|
48
|
+
} = themeActions;
|
|
55
49
|
try {
|
|
56
50
|
var _item;
|
|
57
|
-
var service =
|
|
58
|
-
yield*
|
|
51
|
+
var service = getThemeService();
|
|
52
|
+
yield* call([service, 'getAll']);
|
|
59
53
|
var key = action.payload.key;
|
|
60
54
|
var item = service.indexedItems[key];
|
|
61
55
|
if (!item) {
|
|
62
56
|
item = service.find(['id', 'name'], "^".concat(key, "$"));
|
|
63
57
|
}
|
|
64
|
-
yield*
|
|
58
|
+
yield* put(selectThemeSuccessAction({
|
|
65
59
|
selectedTheme: (_item = item) !== null && _item !== void 0 ? _item : service.defaultTheme
|
|
66
60
|
}));
|
|
67
61
|
} catch (error) {
|
|
68
|
-
yield*
|
|
62
|
+
yield* put(setFailureAction({
|
|
69
63
|
error: error.message
|
|
70
64
|
}));
|
|
71
65
|
}
|
|
72
66
|
}
|
|
73
|
-
function* saga() {
|
|
67
|
+
export function* saga() {
|
|
74
68
|
var {
|
|
75
69
|
initAction,
|
|
76
70
|
loadThemeDataAction,
|
|
77
71
|
selectThemeAction
|
|
78
|
-
} =
|
|
79
|
-
yield*
|
|
80
|
-
yield*
|
|
81
|
-
yield*
|
|
72
|
+
} = themeActions;
|
|
73
|
+
yield* takeEvery(initAction, initSaga);
|
|
74
|
+
yield* takeEvery(loadThemeDataAction, loadThemeDataSaga);
|
|
75
|
+
yield* takeEvery(selectThemeAction, selectThemeSaga);
|
|
82
76
|
}
|
|
83
77
|
//# sourceMappingURL=sagas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sagas.js","names":["
|
|
1
|
+
{"version":3,"file":"sagas.js","names":["takeEvery","put","call","registerThemeService","getThemeService","EmbedUrl","themeActions","initSaga","initSuccessAction","setFailureAction","error","message","loadThemeDataSaga","loadThemeDataSuccessAction","_urlTheme","service","searchParams","urlThemeName","theme","urlTheme","find","themes","items","defaultTheme","selectedTheme","selectThemeSaga","action","selectThemeSuccessAction","_item","key","payload","item","indexedItems","concat","saga","initAction","loadThemeDataAction","selectThemeAction"],"sources":["../../../../src/Theme/state/sagas.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { takeEvery, put, call } from 'typed-redux-saga'\nimport type { PayloadAction } from '@reduxjs/toolkit'\nimport type { ITheme } from '@looker/sdk'\nimport {\n registerThemeService,\n getThemeService,\n EmbedUrl,\n} from '@looker/embed-services'\nimport { themeActions } from './slice'\nimport type { SelectThemeAction } from './slice'\n\n/**\n * Registers theme service with factory\n */\nfunction* initSaga() {\n const { initSuccessAction, setFailureAction } = themeActions\n try {\n registerThemeService()\n yield* put(initSuccessAction())\n } catch (error: any) {\n yield* put(setFailureAction({ error: error.message }))\n }\n}\n\n/**\n * Gets all themes, default and url themes, and sets the selected theme\n */\nfunction* loadThemeDataSaga() {\n const { loadThemeDataSuccessAction, setFailureAction } = themeActions\n try {\n const service = getThemeService()\n yield* call([service, 'load'])\n const searchParams = new EmbedUrl().searchParams\n const urlThemeName = searchParams.theme\n let urlTheme: ITheme | undefined\n if (urlThemeName) {\n urlTheme = service.find('name', urlThemeName)\n }\n yield* put(\n loadThemeDataSuccessAction({\n themes: service.items,\n defaultTheme: service.defaultTheme!,\n selectedTheme: (urlTheme ?? service.defaultTheme!)!,\n })\n )\n } catch (error: any) {\n yield* put(setFailureAction({ error: error.message }))\n }\n}\n\n/**\n * Sets the selected theme by id or name\n * @param action containing id or name of theme to select\n */\nfunction* selectThemeSaga(action: PayloadAction<SelectThemeAction>) {\n const { selectThemeSuccessAction, setFailureAction } = themeActions\n try {\n const service = getThemeService()\n yield* call([service, 'getAll'])\n const key = action.payload.key\n let item: ITheme | undefined = service.indexedItems[key]\n if (!item) {\n item = service.find(['id', 'name'], `^${key}$`)\n }\n yield* put(\n selectThemeSuccessAction({ selectedTheme: item ?? service.defaultTheme! })\n )\n } catch (error: any) {\n yield* put(\n setFailureAction({\n error: error.message,\n })\n )\n }\n}\n\nexport function* saga() {\n const { initAction, loadThemeDataAction, selectThemeAction } = themeActions\n yield* takeEvery(initAction, initSaga)\n yield* takeEvery(loadThemeDataAction, loadThemeDataSaga)\n yield* takeEvery(selectThemeAction, selectThemeSaga)\n}\n"],"mappings":"AAyBA,SAASA,SAAS,EAAEC,GAAG,EAAEC,IAAI,QAAQ,kBAAkB;AAGvD,SACEC,oBAAoB,EACpBC,eAAe,EACfC,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ice = exports.themeActions = exports.defaultThemesState = exports.THEMES_SLICE_NAME = void 0;
|
|
7
|
-
var _toolkit = require("@reduxjs/toolkit");
|
|
8
|
-
var _redux = require("@looker/redux");
|
|
9
|
-
var _sagas = require("./sagas");
|
|
10
|
-
var defaultThemesState = {
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { createSliceHooks } from '@looker/redux';
|
|
3
|
+
import { saga } from './sagas';
|
|
4
|
+
export var defaultThemesState = {
|
|
11
5
|
initialized: false,
|
|
12
6
|
defaultTheme: {},
|
|
13
7
|
selectedTheme: {},
|
|
14
8
|
themes: [],
|
|
15
9
|
working: false
|
|
16
10
|
};
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
exports.THEMES_SLICE_NAME = THEMES_SLICE_NAME;
|
|
20
|
-
var themesSlice = (0, _toolkit.createSlice)({
|
|
11
|
+
export var THEMES_SLICE_NAME = 'themes';
|
|
12
|
+
export var themesSlice = createSlice({
|
|
21
13
|
name: THEMES_SLICE_NAME,
|
|
22
14
|
initialState: defaultThemesState,
|
|
23
15
|
reducers: {
|
|
@@ -47,13 +39,9 @@ var themesSlice = (0, _toolkit.createSlice)({
|
|
|
47
39
|
}
|
|
48
40
|
}
|
|
49
41
|
});
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
exports.themeActions = themeActions;
|
|
53
|
-
var {
|
|
42
|
+
export var themeActions = themesSlice.actions;
|
|
43
|
+
export var {
|
|
54
44
|
useActions: useThemeActions,
|
|
55
45
|
useStoreState: useThemesStoreState
|
|
56
|
-
} =
|
|
57
|
-
exports.useThemesStoreState = useThemesStoreState;
|
|
58
|
-
exports.useThemeActions = useThemeActions;
|
|
46
|
+
} = createSliceHooks(themesSlice, saga);
|
|
59
47
|
//# sourceMappingURL=slice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice.js","names":["
|
|
1
|
+
{"version":3,"file":"slice.js","names":["createSlice","createSliceHooks","saga","defaultThemesState","initialized","defaultTheme","selectedTheme","themes","working","THEMES_SLICE_NAME","themesSlice","name","initialState","reducers","initAction","initSuccessAction","state","loadThemeDataAction","loadThemeDataSuccessAction","action","payload","selectThemeAction","_action","selectThemeSuccessAction","setFailureAction","error","themeActions","actions","useActions","useThemeActions","useStoreState","useThemesStoreState"],"sources":["../../../../src/Theme/state/slice.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport { createSlice } from '@reduxjs/toolkit'\nimport type { PayloadAction } from '@reduxjs/toolkit'\nimport { createSliceHooks } from '@looker/redux'\nimport type { ITheme } from '@looker/sdk'\nimport { saga } from './sagas'\n\nexport interface ThemesState {\n defaultTheme: ITheme\n themes: ITheme[]\n selectedTheme: ITheme\n initialized: boolean\n error?: string\n working: boolean\n}\n\nexport const defaultThemesState: ThemesState = {\n initialized: false,\n defaultTheme: {} as ITheme,\n selectedTheme: {} as ITheme,\n themes: [],\n working: false,\n}\n\nexport type SelectThemeAction = Record<'key', string>\n\ntype SelectThemeSuccessAction = Pick<ThemesState, 'selectedTheme'>\n\ntype SetFailureAction = Record<'error', string>\n\ntype LoadThemeDataSuccessAction = Pick<\n ThemesState,\n 'defaultTheme' | 'themes' | 'selectedTheme'\n>\n\nexport const THEMES_SLICE_NAME = 'themes'\n\nexport const themesSlice = createSlice({\n name: THEMES_SLICE_NAME,\n initialState: defaultThemesState,\n reducers: {\n initAction() {\n // noop\n },\n initSuccessAction(state) {\n state.initialized = true\n },\n loadThemeDataAction(state) {\n state.working = true\n },\n loadThemeDataSuccessAction(\n state,\n action: PayloadAction<LoadThemeDataSuccessAction>\n ) {\n state.themes = action.payload.themes\n state.defaultTheme = action.payload.defaultTheme\n state.selectedTheme = action.payload.selectedTheme\n state.working = false\n },\n selectThemeAction(state, _action: PayloadAction<SelectThemeAction>) {\n state.working = true\n },\n selectThemeSuccessAction(\n state,\n action: PayloadAction<SelectThemeSuccessAction>\n ) {\n state.selectedTheme = action.payload.selectedTheme\n state.working = false\n },\n setFailureAction(state, action: PayloadAction<SetFailureAction>) {\n state.error = action.payload.error\n state.working = false\n },\n },\n})\n\nexport const themeActions = themesSlice.actions\nexport const {\n useActions: useThemeActions,\n useStoreState: useThemesStoreState,\n} = createSliceHooks(themesSlice, saga)\n"],"mappings":"AA0BA,SAASA,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,SAASC,IAAI,QAAQ,SAAS;AAW9B,OAAO,IAAMC,kBAA+B,GAAG;EAC7CC,WAAW,EAAE,KAAK;EAClBC,YAAY,EAAE,CAAC,CAAW;EAC1BC,aAAa,EAAE,CAAC,CAAW;EAC3BC,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE;AACX,CAAC;AAaD,OAAO,IAAMC,iBAAiB,GAAG,QAAQ;AAEzC,OAAO,IAAMC,WAAW,GAAGV,WAAW,CAAC;EACrCW,IAAI,EAAEF,iBAAiB;EACvBG,YAAY,EAAET,k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: true
|
|
5
|
-
});
|
|
6
|
-
var _GlobalStore = require("./GlobalStore");
|
|
7
|
-
Object.keys(_GlobalStore).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _GlobalStore[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _GlobalStore[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _Theme = require("./Theme");
|
|
18
|
-
Object.keys(_Theme).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _Theme[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _Theme[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _QuickEmbed = require("./QuickEmbed");
|
|
29
|
-
Object.keys(_QuickEmbed).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _QuickEmbed[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _QuickEmbed[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
export * from './GlobalStore';
|
|
2
|
+
export * from './Theme';
|
|
3
|
+
export * from './QuickEmbed';
|
|
39
4
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './GlobalStore'\nexport * from './Theme'\nexport * from './QuickEmbed'\n"],"mappings":"AAyBA,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,cAAc"}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _utils = require("./utils");
|
|
7
|
-
Object.keys(_utils).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _utils[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _store = require("./store");
|
|
18
|
-
Object.keys(_store).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _store[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _store[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
export * from './utils';
|
|
2
|
+
export * from './store';
|
|
28
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/test-utils/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './utils'\nexport * from './store'\n"],"mappings":"AAyBA,cAAc,SAAS;AACvB,cAAc,SAAS"}
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createTestStore = void 0;
|
|
7
|
-
var _redux = require("@looker/redux");
|
|
8
|
-
var _GlobalStore = require("../GlobalStore");
|
|
9
|
-
var _Theme = require("../Theme");
|
|
10
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
|
|
6
|
+
import { createStore } from '@looker/redux';
|
|
7
|
+
import { factorySlice, defaultFactoryState } from '../GlobalStore';
|
|
8
|
+
import { themesSlice, defaultThemesState } from '../Theme';
|
|
9
|
+
export var createTestStore = overrides => createStore({
|
|
16
10
|
preloadedState: {
|
|
17
|
-
factory: _objectSpread(_objectSpread({},
|
|
18
|
-
themes: _objectSpread(_objectSpread({},
|
|
11
|
+
factory: _objectSpread(_objectSpread({}, defaultFactoryState), overrides === null || overrides === void 0 ? void 0 : overrides.factory),
|
|
12
|
+
themes: _objectSpread(_objectSpread({}, defaultThemesState), overrides === null || overrides === void 0 ? void 0 : overrides.themes)
|
|
19
13
|
},
|
|
20
14
|
reducer: {
|
|
21
|
-
factory:
|
|
22
|
-
themes:
|
|
15
|
+
factory: factorySlice.reducer,
|
|
16
|
+
themes: themesSlice.reducer
|
|
23
17
|
}
|
|
24
18
|
});
|
|
25
|
-
exports.createTestStore = createTestStore;
|
|
26
19
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["
|
|
1
|
+
{"version":3,"file":"store.js","names":["createStore","factorySlice","defaultFactoryState","themesSlice","defaultThemesState","createTestStore","overrides","preloadedState","factory","_objectSpread","themes","reducer"],"sources":["../../../src/test-utils/store.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { createStore } from '@looker/redux'\nimport { factorySlice, defaultFactoryState } from '../GlobalStore'\nimport type { RootState, FactoryState } from '../GlobalStore'\nimport { themesSlice, defaultThemesState } from '../Theme'\nimport type { ThemesState } from '../Theme'\n\ntype DeepPartial<T> = {\n [P in keyof T]?: DeepPartial<T[P]>\n}\n\nexport const createTestStore = (overrides?: DeepPartial<RootState>) =>\n createStore({\n preloadedState: {\n factory: {\n ...defaultFactoryState,\n ...overrides?.factory,\n } as FactoryState,\n themes: { ...defaultThemesState, ...overrides?.themes } as ThemesState,\n },\n reducer: {\n factory: factorySlice.reducer,\n themes: themesSlice.reducer,\n },\n })\n"],"mappings":";;;;;AAyBA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,gBAAgB;AAElE,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,UAAU;AAO1D,OAAO,IAAMC,eAAe,GAAIC,SAAkC,IAChEN,WAAW,CAAC;EACVO,cAAc,EAAE;IACdC,OAAO,EAAAC,aAAA,CAAAA,aAAA,KACFP,mBAAmB,GACnBI,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEE,OAAO,CACN;IACjBE,MAAM,EAAAD,aAAA,CAAAA,aAAA,KAAOL,kBAAkB,GAAKE,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEI,MAAM;EACvD,CAAC;EACDC,OAAO,EAAE;IACPH,OAAO,EAAEP,YAAY,CAACU,OAAO;IAC7BD,MAAM,EAAEP,WAAW,CAACQ;EACtB;AACF,CAAC,CAAC"}
|
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.timeout = exports.session = exports.rootFile = exports.getRootPath = exports.TestConfig = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var fs = _interopRequireWildcard(require("fs"));
|
|
9
|
-
var _sdk = require("@looker/sdk");
|
|
10
|
-
var _sdkNode = require("@looker/sdk-node");
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import { environmentPrefix } from '@looker/sdk';
|
|
4
|
+
import { NodeSession, NodeSettingsIniFile } from '@looker/sdk-node';
|
|
14
5
|
var homeToRoost = '../../../../';
|
|
15
|
-
var getRootPath = () =>
|
|
16
|
-
|
|
17
|
-
var rootFile = function rootFile() {
|
|
6
|
+
export var getRootPath = () => path.join(__dirname, homeToRoost);
|
|
7
|
+
export var rootFile = function rootFile() {
|
|
18
8
|
var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
19
|
-
return
|
|
9
|
+
return path.join(getRootPath(), fileName);
|
|
20
10
|
};
|
|
21
|
-
exports.rootFile = rootFile;
|
|
22
11
|
var localIni = process.env.LOOKERSDK_INI || rootFile('looker.ini');
|
|
23
|
-
var settings = new
|
|
24
|
-
var session = new
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
exports.timeout = timeout;
|
|
28
|
-
var TestConfig = () => {
|
|
12
|
+
var settings = new NodeSettingsIniFile(environmentPrefix, localIni, 'Looker');
|
|
13
|
+
export var session = new NodeSession(settings);
|
|
14
|
+
export var timeout = 3600000;
|
|
15
|
+
export var TestConfig = () => {
|
|
29
16
|
var testFile = 'data.yml.json';
|
|
30
17
|
var testPath = rootFile('test/');
|
|
31
18
|
var dataFile = "".concat(testPath).concat(testFile);
|
|
@@ -34,5 +21,4 @@ var TestConfig = () => {
|
|
|
34
21
|
testData
|
|
35
22
|
};
|
|
36
23
|
};
|
|
37
|
-
exports.TestConfig = TestConfig;
|
|
38
24
|
//# sourceMappingURL=utils.js.map
|