@looker/extension-sdk-react 22.20.2-alpha.1650 → 23.0.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +0 -14
  3. package/lib/components/ErrorMessage/ErrorMessage.js +0 -4
  4. package/lib/components/ErrorMessage/ErrorMessage.js.map +1 -1
  5. package/lib/components/ErrorMessage/index.js +0 -4
  6. package/lib/components/ErrorMessage/index.js.map +1 -1
  7. package/lib/components/ErrorMessage/types.js +1 -1
  8. package/lib/components/ErrorMessage/types.js.map +1 -1
  9. package/lib/components/ExtensionConnector/ExtensionConnector.js +14 -49
  10. package/lib/components/ExtensionConnector/ExtensionConnector.js.map +1 -1
  11. package/lib/components/ExtensionConnector/index.js +0 -4
  12. package/lib/components/ExtensionConnector/index.js.map +1 -1
  13. package/lib/components/ExtensionConnector/types.d.ts +2 -7
  14. package/lib/components/ExtensionConnector/types.js +1 -1
  15. package/lib/components/ExtensionConnector/types.js.map +1 -1
  16. package/lib/components/ExtensionProvider/ExtensionProvider.js +11 -48
  17. package/lib/components/ExtensionProvider/ExtensionProvider.js.map +1 -1
  18. package/lib/components/ExtensionProvider/index.js +0 -4
  19. package/lib/components/ExtensionProvider/index.js.map +1 -1
  20. package/lib/components/ExtensionProvider/types.js +1 -1
  21. package/lib/components/ExtensionProvider/types.js.map +1 -1
  22. package/lib/components/ExtensionProvider2/ExtensionProvider2.js +13 -49
  23. package/lib/components/ExtensionProvider2/ExtensionProvider2.js.map +1 -1
  24. package/lib/components/ExtensionProvider2/index.js +0 -2
  25. package/lib/components/ExtensionProvider2/index.js.map +1 -1
  26. package/lib/components/ExtensionProvider40/ExtensionProvider40.js +12 -46
  27. package/lib/components/ExtensionProvider40/ExtensionProvider40.js.map +1 -1
  28. package/lib/components/ExtensionProvider40/index.js +0 -2
  29. package/lib/components/ExtensionProvider40/index.js.map +1 -1
  30. package/lib/components/ExtensionProviderBase/ExtensionProviderBase.js +12 -44
  31. package/lib/components/ExtensionProviderBase/ExtensionProviderBase.js.map +1 -1
  32. package/lib/components/ExtensionProviderBase/index.js +0 -2
  33. package/lib/components/ExtensionProviderBase/index.js.map +1 -1
  34. package/lib/components/RouteChangeListener/RouteChangeListener.js +0 -10
  35. package/lib/components/RouteChangeListener/RouteChangeListener.js.map +1 -1
  36. package/lib/components/RouteChangeListener/index.js +0 -4
  37. package/lib/components/RouteChangeListener/index.js.map +1 -1
  38. package/lib/components/RouteChangeListener/types.js +1 -1
  39. package/lib/components/RouteChangeListener/types.js.map +1 -1
  40. package/lib/components/utils/get_initial_route_entries.js +5 -13
  41. package/lib/components/utils/get_initial_route_entries.js.map +1 -1
  42. package/lib/components/utils/setup_close_popovers.js +0 -5
  43. package/lib/components/utils/setup_close_popovers.js.map +1 -1
  44. package/lib/esm/components/ErrorMessage/ErrorMessage.js +11 -3
  45. package/lib/esm/components/ErrorMessage/ErrorMessage.js.map +1 -1
  46. package/lib/esm/components/ErrorMessage/index.js +27 -2
  47. package/lib/esm/components/ErrorMessage/index.js.map +1 -1
  48. package/lib/esm/components/ErrorMessage/types.js.map +1 -1
  49. package/lib/esm/components/ExtensionConnector/ExtensionConnector.js +45 -57
  50. package/lib/esm/components/ExtensionConnector/ExtensionConnector.js.map +1 -1
  51. package/lib/esm/components/ExtensionConnector/index.js +27 -2
  52. package/lib/esm/components/ExtensionConnector/index.js.map +1 -1
  53. package/lib/esm/components/ExtensionConnector/types.js.map +1 -1
  54. package/lib/esm/components/ExtensionProvider/ExtensionProvider.js +36 -50
  55. package/lib/esm/components/ExtensionProvider/ExtensionProvider.js.map +1 -1
  56. package/lib/esm/components/ExtensionProvider/index.js +27 -2
  57. package/lib/esm/components/ExtensionProvider/index.js.map +1 -1
  58. package/lib/esm/components/ExtensionProvider/types.js.map +1 -1
  59. package/lib/esm/components/ExtensionProvider2/ExtensionProvider2.js +34 -50
  60. package/lib/esm/components/ExtensionProvider2/ExtensionProvider2.js.map +1 -1
  61. package/lib/esm/components/ExtensionProvider2/index.js +16 -1
  62. package/lib/esm/components/ExtensionProvider2/index.js.map +1 -1
  63. package/lib/esm/components/ExtensionProvider40/ExtensionProvider40.js +33 -47
  64. package/lib/esm/components/ExtensionProvider40/ExtensionProvider40.js.map +1 -1
  65. package/lib/esm/components/ExtensionProvider40/index.js +16 -1
  66. package/lib/esm/components/ExtensionProvider40/index.js.map +1 -1
  67. package/lib/esm/components/ExtensionProviderBase/ExtensionProviderBase.js +29 -43
  68. package/lib/esm/components/ExtensionProviderBase/ExtensionProviderBase.js.map +1 -1
  69. package/lib/esm/components/ExtensionProviderBase/index.js +16 -1
  70. package/lib/esm/components/ExtensionProviderBase/index.js.map +1 -1
  71. package/lib/esm/components/RouteChangeListener/RouteChangeListener.js +20 -12
  72. package/lib/esm/components/RouteChangeListener/RouteChangeListener.js.map +1 -1
  73. package/lib/esm/components/RouteChangeListener/index.js +27 -2
  74. package/lib/esm/components/RouteChangeListener/index.js.map +1 -1
  75. package/lib/esm/components/RouteChangeListener/types.js.map +1 -1
  76. package/lib/esm/components/utils/get_initial_route_entries.js +15 -9
  77. package/lib/esm/components/utils/get_initial_route_entries.js.map +1 -1
  78. package/lib/esm/components/utils/setup_close_popovers.js +8 -4
  79. package/lib/esm/components/utils/setup_close_popovers.js.map +1 -1
  80. package/lib/esm/index.js +115 -10
  81. package/lib/esm/index.js.map +1 -1
  82. package/lib/esm/sdk/core_sdk.js +13 -4
  83. package/lib/esm/sdk/core_sdk.js.map +1 -1
  84. package/lib/esm/sdk/core_sdk2.js +11 -7
  85. package/lib/esm/sdk/core_sdk2.js.map +1 -1
  86. package/lib/esm/sdk/core_sdk_31.js +12 -6
  87. package/lib/esm/sdk/core_sdk_31.js.map +1 -1
  88. package/lib/esm/sdk/core_sdk_40.js +12 -6
  89. package/lib/esm/sdk/core_sdk_40.js.map +1 -1
  90. package/lib/index.d.ts +1 -1
  91. package/lib/index.js +2 -22
  92. package/lib/index.js.map +1 -1
  93. package/lib/sdk/core_sdk.js +1 -3
  94. package/lib/sdk/core_sdk.js.map +1 -1
  95. package/lib/sdk/core_sdk2.js +1 -7
  96. package/lib/sdk/core_sdk2.js.map +1 -1
  97. package/lib/sdk/core_sdk_31.js +1 -10
  98. package/lib/sdk/core_sdk_31.js.map +1 -1
  99. package/lib/sdk/core_sdk_40.js +1 -10
  100. package/lib/sdk/core_sdk_40.js.map +1 -1
  101. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [23.0.0](https://github.com/looker-open-source/sdk-codegen/compare/extension-sdk-react-v22.20.1...extension-sdk-react-v23.0.0) (2023-02-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * keep all body parameters toggle in API Explorer requests ([#1245](https://github.com/looker-open-source/sdk-codegen/issues/1245)) ([043ed3f](https://github.com/looker-open-source/sdk-codegen/commit/043ed3ff12cba4f821604b5b668d7301ed4aa6d1))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @looker/extension-sdk bumped from ^22.20.1 to ^23.0.0
21
+ * @looker/sdk bumped from ^22.20.1 to ^23.0.0
22
+ * @looker/sdk-rtl bumped from ^21.5.0 to ^21.6.0
23
+
8
24
  ### [22.20.1](https://www.github.com/looker-open-source/sdk-codegen/compare/extension-sdk-react-v22.20.0...extension-sdk-react-v22.20.1) (2022-12-09)
9
25
 
10
26
 
package/README.md CHANGED
@@ -138,20 +138,6 @@ export function* sagaCallbacks() {
138
138
  }
139
139
  ```
140
140
 
141
- ### Tile Extension Context Data
142
-
143
- ```ts
144
- import { ExtensionContext40 } from '@looker/extension-sdk-react'
145
-
146
- export const MyExtension: React.FC = () => {
147
- const {
148
- extensionSDK,
149
- tileSDK,
150
- tileHostData: { dashboardFilters },
151
- } = useContext(ExtensionContext40)
152
-
153
- ```
154
-
155
141
  ## Related Projects
156
142
 
157
143
  - [Looker extension examples](https://github.com/looker-open-source/extension-examples).
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ErrorMessage = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  var ErrorMessage = _ref => {
13
10
  var {
14
11
  errorMessage
@@ -27,6 +24,5 @@ var ErrorMessage = _ref => {
27
24
  }
28
25
  }, errorMessage);
29
26
  };
30
-
31
27
  exports.ErrorMessage = ErrorMessage;
32
28
  //# sourceMappingURL=ErrorMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ErrorMessage/ErrorMessage.tsx"],"names":["ErrorMessage","errorMessage","width","margin","padding","background","borderRadius","font"],"mappings":";;;;;;;AA0BA;;;;AAGO,IAAMA,YAAyC,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,SACvD;AACE,IAAA,EAAE,EAAC,gCADL;AAEE,iBAAU,QAFZ;AAGE,IAAA,IAAI,EAAC,QAHP;AAIE,IAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,MADF;AAELC,MAAAA,MAAM,EAAE,MAFH;AAGLC,MAAAA,OAAO,EAAE,WAHJ;AAILC,MAAAA,UAAU,EAAE,SAJP;AAKLC,MAAAA,YAAY,EAAE,KALT;AAMLC,MAAAA,IAAI,EAAE;AAND;AAJT,KAaGN,YAbH,CADuD;AAAA,CAAlD","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 React from 'react'\nimport type { ErrorMessageProps } from './types'\n\nexport const ErrorMessage: React.FC<ErrorMessageProps> = ({ errorMessage }) => (\n <div\n id=\"extension-initialization-error\"\n aria-live=\"polite\"\n role=\"status\"\n style={{\n width: '100%',\n margin: '-8px',\n padding: '12px 16px',\n background: '#FFE5E9',\n borderRadius: '4px',\n font: '0.875rem \"Helvetica\", san-serif',\n }}\n >\n {errorMessage}\n </div>\n)\n"],"file":"ErrorMessage.js"}
1
+ {"version":3,"file":"ErrorMessage.js","names":["ErrorMessage","errorMessage","width","margin","padding","background","borderRadius","font"],"sources":["../../../src/components/ErrorMessage/ErrorMessage.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 React from 'react'\nimport type { ErrorMessageProps } from './types'\n\nexport const ErrorMessage: React.FC<ErrorMessageProps> = ({ errorMessage }) => (\n <div\n id=\"extension-initialization-error\"\n aria-live=\"polite\"\n role=\"status\"\n style={{\n width: '100%',\n margin: '-8px',\n padding: '12px 16px',\n background: '#FFE5E9',\n borderRadius: '4px',\n font: '0.875rem \"Helvetica\", san-serif',\n }}\n >\n {errorMessage}\n </div>\n)\n"],"mappings":";;;;;;AA0BA;AAAyB;AAGlB,IAAMA,YAAyC,GAAG;EAAA,IAAC;IAAEC;EAAa,CAAC;EAAA,OACxE;IACE,EAAE,EAAC,gCAAgC;IACnC,aAAU,QAAQ;IAClB,IAAI,EAAC,QAAQ;IACb,KAAK,EAAE;MACLC,KAAK,EAAE,MAAM;MACbC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,WAAW;MACpBC,UAAU,EAAE,SAAS;MACrBC,YAAY,EAAE,KAAK;MACnBC,IAAI,EAAE;IACR;EAAE,GAEDN,YAAY,CACT;AAAA,CACP;AAAA"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _types = require("./types");
8
-
9
7
  Object.keys(_types).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _types[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_types).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _ErrorMessage = require("./ErrorMessage");
21
-
22
18
  Object.keys(_ErrorMessage).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _ErrorMessage[key]) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ErrorMessage/index.ts"],"names":[],"mappings":";;;;;;AA0BA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './types'\nexport * from './ErrorMessage'\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ErrorMessage/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './types'\nexport * from './ErrorMessage'\n"],"mappings":";;;;;AA0BA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";
1
+
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/ErrorMessage/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport interface ErrorMessageProps {\n errorMessage: string\n}\n"],"mappings":""}
@@ -4,33 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExtensionConnector = void 0;
7
-
8
7
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _reactRouterDom = require("react-router-dom");
13
-
14
10
  var _extensionSdk = require("@looker/extension-sdk");
15
-
16
11
  var _ErrorMessage = require("../ErrorMessage");
17
-
18
12
  var _RouteChangeListener = require("../RouteChangeListener");
19
-
20
13
  var _get_initial_route_entries = require("../utils/get_initial_route_entries");
21
-
22
14
  var _setup_close_popovers = require("../utils/setup_close_popovers");
23
-
24
15
  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); }
25
-
26
16
  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; }
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
18
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
31
-
32
19
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
-
20
+ 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; }
21
+ 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; }
22
+ 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; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24
+ 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); }
34
25
  var ExtensionConnector = _ref => {
35
26
  var {
36
27
  contextData,
@@ -45,55 +36,34 @@ var ExtensionConnector = _ref => {
45
36
  chattyTimeout,
46
37
  children
47
38
  } = _ref;
48
- var contextDataRef = (0, _react.useRef)(contextData);
49
39
  var [initialRouteData, setInitialRouteData] = (0, _react.useState)();
50
40
  var [hostRouteData, setHostRouteData] = (0, _react.useState)({
51
41
  route: ''
52
42
  });
53
43
  var [initializing, setInitializing] = (0, _react.useState)(true);
54
44
  var [initializeError, setInitializeError] = (0, _react.useState)();
55
- (0, _react.useEffect)(() => {
56
- contextDataRef.current = contextData;
57
- }, [contextData]);
58
- var setInitialRouteAndRouteState = (0, _react.useCallback)((route, routeState) => {
45
+ var setInitialRouteAndRouteState = (route, routeState) => {
59
46
  if (hostTracksRoute) {
60
47
  setInitialRouteData({
61
48
  route,
62
49
  routeState
63
50
  });
64
51
  }
65
- }, [hostTracksRoute, setInitialRouteData]);
66
- var hostChangedRoute = (0, _react.useCallback)((_route, routeState) => {
52
+ };
53
+ var hostChangedRoute = (_route, routeState) => {
67
54
  var route = _route.startsWith('/') ? _route : '/' + _route;
68
-
69
55
  if (route !== hostRouteData.route || !(0, _isEqual.default)(routeState, hostRouteData.routeState)) {
70
56
  setHostRouteData({
71
57
  route,
72
58
  routeState
73
59
  });
74
- updateContextData({
60
+ updateContextData(_objectSpread(_objectSpread({}, contextData), {}, {
75
61
  route,
76
62
  routeState
77
- });
63
+ }));
78
64
  }
79
- }, [setHostRouteData, updateContextData]);
80
- var visualizationDataReceivedCallback = (0, _react.useCallback)(visualizationData => {
81
- updateContextData({
82
- visualizationData
83
- });
84
- }, [updateContextData]);
85
- var tileHostDataChangedCallback = (0, _react.useCallback)(partialHostData => {
86
- if (contextDataRef.current.tileSDK) {
87
- var {
88
- tileSDK
89
- } = contextDataRef.current;
90
- tileSDK.tileHostDataChanged(partialHostData);
91
- updateContextData({
92
- tileHostData: tileSDK.tileHostData
93
- });
94
- }
95
- }, [updateContextData]);
96
- (0, _react.useEffect)(() => {
65
+ };
66
+ _react.default.useEffect(() => {
97
67
  var initialize = function () {
98
68
  var _ref2 = _asyncToGenerator(function* () {
99
69
  try {
@@ -101,9 +71,7 @@ var ExtensionConnector = _ref => {
101
71
  setInitialRoute: setInitialRouteAndRouteState,
102
72
  requiredLookerVersion,
103
73
  hostChangedRoute,
104
- chattyTimeout,
105
- visualizationDataReceivedCallback,
106
- tileHostDataChangedCallback
74
+ chattyTimeout
107
75
  });
108
76
  connectedCallback(extensionHost);
109
77
  setInitializing(false);
@@ -113,18 +81,16 @@ var ExtensionConnector = _ref => {
113
81
  setInitializing(false);
114
82
  }
115
83
  });
116
-
117
84
  return function initialize() {
118
85
  return _ref2.apply(this, arguments);
119
86
  };
120
87
  }();
121
-
122
88
  initialize();
123
89
  return () => {
124
90
  unloadedCallback();
125
91
  };
126
92
  }, []);
127
- (0, _react.useEffect)(() => {
93
+ _react.default.useEffect(() => {
128
94
  return initializing ? undefined : (0, _setup_close_popovers.setupClosePopoversListener)(contextData.extensionSDK);
129
95
  }, [initializing]);
130
96
  return _react.default.createElement(_react.default.Fragment, null, initializing ? loadingComponent : _react.default.createElement(_react.default.Fragment, null, initializeError ? _react.default.createElement(_ErrorMessage.ErrorMessage, {
@@ -139,6 +105,5 @@ var ExtensionConnector = _ref => {
139
105
  hostRouteState: hostRouteData.routeState
140
106
  }), children) : _react.default.createElement(_react.default.Fragment, null, children))));
141
107
  };
142
-
143
108
  exports.ExtensionConnector = ExtensionConnector;
144
109
  //# sourceMappingURL=ExtensionConnector.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExtensionConnector/ExtensionConnector.tsx"],"names":["ExtensionConnector","contextData","updateContextData","connectedCallback","unloadedCallback","onPathnameChange","onRouteChange","hostTracksRoute","loadingComponent","requiredLookerVersion","chattyTimeout","children","contextDataRef","initialRouteData","setInitialRouteData","hostRouteData","setHostRouteData","route","initializing","setInitializing","initializeError","setInitializeError","current","setInitialRouteAndRouteState","routeState","hostChangedRoute","_route","startsWith","visualizationDataReceivedCallback","visualizationData","tileHostDataChangedCallback","partialHostData","tileSDK","tileHostDataChanged","tileHostData","initialize","extensionHost","setInitialRoute","error","console","message","undefined","extensionSDK"],"mappings":"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","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 isEqual from 'lodash/isEqual'\nimport React, { useEffect, useState, useCallback, useRef } from 'react'\nimport { MemoryRouter } from 'react-router-dom'\nimport type { RawVisualizationData, TileHostData } from '@looker/extension-sdk'\nimport { connectExtensionHost } from '@looker/extension-sdk'\nimport { ErrorMessage } from '../ErrorMessage'\nimport { RouteChangeListener } from '../RouteChangeListener'\nimport { getInitialRouteEntries } from '../utils/get_initial_route_entries'\nimport { setupClosePopoversListener } from '../utils/setup_close_popovers'\nimport type { ExtensionConnectorProps, RouteData } from './types'\n\n/**\n * ExtensionConnector component. Provides access to the extension API and SDK (use\n * ExtensionContext) and react routing services.\n */\nexport const ExtensionConnector: React.FC<ExtensionConnectorProps> = ({\n contextData,\n updateContextData,\n connectedCallback,\n unloadedCallback,\n onPathnameChange,\n onRouteChange,\n hostTracksRoute = true,\n loadingComponent,\n requiredLookerVersion,\n chattyTimeout,\n children,\n}) => {\n const contextDataRef = useRef(contextData)\n const [initialRouteData, setInitialRouteData] = useState<RouteData>()\n const [hostRouteData, setHostRouteData] = useState<RouteData>({ route: '' })\n const [initializing, setInitializing] = useState(true)\n const [initializeError, setInitializeError] = useState<string>()\n\n useEffect(() => {\n contextDataRef.current = contextData\n }, [contextData])\n\n const setInitialRouteAndRouteState = useCallback(\n (route: string, routeState?: any) => {\n if (hostTracksRoute) {\n setInitialRouteData({ route, routeState })\n }\n },\n [hostTracksRoute, setInitialRouteData]\n )\n\n const hostChangedRoute = useCallback(\n (_route: string, routeState?: any) => {\n const route = _route.startsWith('/') ? _route : '/' + _route\n if (\n route !== hostRouteData.route ||\n !isEqual(routeState, hostRouteData.routeState)\n ) {\n setHostRouteData({ route, routeState })\n updateContextData({\n route,\n routeState,\n })\n }\n },\n [setHostRouteData, updateContextData]\n )\n\n const visualizationDataReceivedCallback = useCallback(\n (visualizationData: RawVisualizationData) => {\n updateContextData({\n visualizationData,\n })\n },\n [updateContextData]\n )\n\n const tileHostDataChangedCallback = useCallback(\n (partialHostData: Partial<TileHostData>) => {\n if (contextDataRef.current.tileSDK) {\n const { tileSDK } = contextDataRef.current\n tileSDK.tileHostDataChanged(partialHostData)\n updateContextData({\n tileHostData: tileSDK.tileHostData,\n })\n }\n },\n [updateContextData]\n )\n\n useEffect(() => {\n const initialize = async () => {\n try {\n const extensionHost = await connectExtensionHost({\n setInitialRoute: setInitialRouteAndRouteState,\n requiredLookerVersion,\n hostChangedRoute,\n chattyTimeout,\n visualizationDataReceivedCallback,\n tileHostDataChangedCallback,\n })\n connectedCallback(extensionHost)\n setInitializing(false)\n } catch (error: any) {\n // eslint-disable-next-line no-console\n console.error(error)\n setInitializeError(error.message || 'Extension failed to initialize.')\n setInitializing(false)\n }\n }\n initialize()\n return () => {\n unloadedCallback()\n }\n }, [])\n\n useEffect(() => {\n return initializing\n ? undefined\n : setupClosePopoversListener(contextData.extensionSDK)\n }, [initializing])\n\n return (\n <>\n {initializing ? (\n loadingComponent\n ) : (\n <>\n {initializeError ? (\n <ErrorMessage errorMessage={initializeError} />\n ) : (\n <>\n {hostTracksRoute ? (\n <MemoryRouter\n initialEntries={getInitialRouteEntries(initialRouteData)}\n >\n <RouteChangeListener\n onRouteChange={onRouteChange}\n onPathnameChange={onPathnameChange}\n extensionHost={contextData!.extensionSDK}\n hostRoute={hostRouteData.route}\n hostRouteState={hostRouteData.routeState}\n />\n {children}\n </MemoryRouter>\n ) : (\n <>{children}</>\n )}\n </>\n )}\n </>\n )}\n </>\n )\n}\n"],"file":"ExtensionConnector.js"}
1
+ {"version":3,"file":"ExtensionConnector.js","names":["ExtensionConnector","contextData","updateContextData","connectedCallback","unloadedCallback","onPathnameChange","onRouteChange","hostTracksRoute","loadingComponent","requiredLookerVersion","chattyTimeout","children","initialRouteData","setInitialRouteData","useState","hostRouteData","setHostRouteData","route","initializing","setInitializing","initializeError","setInitializeError","setInitialRouteAndRouteState","routeState","hostChangedRoute","_route","startsWith","isEqual","React","useEffect","initialize","extensionHost","connectExtensionHost","setInitialRoute","error","console","message","undefined","setupClosePopoversListener","extensionSDK","getInitialRouteEntries"],"sources":["../../../src/components/ExtensionConnector/ExtensionConnector.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 isEqual from 'lodash/isEqual'\nimport React, { useState } from 'react'\nimport { MemoryRouter } from 'react-router-dom'\nimport { connectExtensionHost } from '@looker/extension-sdk'\nimport { ErrorMessage } from '../ErrorMessage'\nimport { RouteChangeListener } from '../RouteChangeListener'\nimport { getInitialRouteEntries } from '../utils/get_initial_route_entries'\nimport { setupClosePopoversListener } from '../utils/setup_close_popovers'\nimport type { ExtensionConnectorProps, RouteData } from './types'\n\n/**\n * ExtensionConnector component. Provides access to the extension API and SDK (use\n * ExtensionContext) and react routing services.\n */\nexport const ExtensionConnector: React.FC<ExtensionConnectorProps> = ({\n contextData,\n updateContextData,\n connectedCallback,\n unloadedCallback,\n onPathnameChange,\n onRouteChange,\n hostTracksRoute = true,\n loadingComponent,\n requiredLookerVersion,\n chattyTimeout,\n children,\n}) => {\n const [initialRouteData, setInitialRouteData] = useState<RouteData>()\n const [hostRouteData, setHostRouteData] = useState<RouteData>({ route: '' })\n const [initializing, setInitializing] = useState(true)\n const [initializeError, setInitializeError] = useState<string>()\n\n const setInitialRouteAndRouteState = (route: string, routeState?: any) => {\n if (hostTracksRoute) {\n setInitialRouteData({ route, routeState })\n }\n }\n\n const hostChangedRoute = (_route: string, routeState?: any) => {\n const route = _route.startsWith('/') ? _route : '/' + _route\n if (\n route !== hostRouteData.route ||\n !isEqual(routeState, hostRouteData.routeState)\n ) {\n setHostRouteData({ route, routeState })\n updateContextData({\n ...contextData,\n route,\n routeState,\n })\n }\n }\n\n React.useEffect(() => {\n const initialize = async () => {\n try {\n const extensionHost = await connectExtensionHost({\n setInitialRoute: setInitialRouteAndRouteState,\n requiredLookerVersion,\n hostChangedRoute,\n chattyTimeout,\n })\n connectedCallback(extensionHost)\n setInitializing(false)\n } catch (error: any) {\n // eslint-disable-next-line no-console\n console.error(error)\n setInitializeError(error.message || 'Extension failed to initialize.')\n setInitializing(false)\n }\n }\n initialize()\n return () => {\n unloadedCallback()\n }\n }, [])\n\n React.useEffect(() => {\n return initializing\n ? undefined\n : setupClosePopoversListener(contextData.extensionSDK)\n }, [initializing])\n\n return (\n <>\n {initializing ? (\n loadingComponent\n ) : (\n <>\n {initializeError ? (\n <ErrorMessage errorMessage={initializeError} />\n ) : (\n <>\n {hostTracksRoute ? (\n <MemoryRouter\n initialEntries={getInitialRouteEntries(initialRouteData)}\n >\n <RouteChangeListener\n onRouteChange={onRouteChange}\n onPathnameChange={onPathnameChange}\n extensionHost={contextData!.extensionSDK}\n hostRoute={hostRouteData.route}\n hostRouteState={hostRouteData.routeState}\n />\n {children}\n </MemoryRouter>\n ) : (\n <>{children}</>\n )}\n </>\n )}\n </>\n )}\n </>\n )\n}\n"],"mappings":"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"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _types = require("./types");
8
-
9
7
  Object.keys(_types).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _types[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_types).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _ExtensionConnector = require("./ExtensionConnector");
21
-
22
18
  Object.keys(_ExtensionConnector).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _ExtensionConnector[key]) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExtensionConnector/index.ts"],"names":[],"mappings":";;;;;;AA0BA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './types'\nexport * from './ExtensionConnector'\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ExtensionConnector/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './types'\nexport * from './ExtensionConnector'\n"],"mappings":";;;;;AA0BA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,15 +1,10 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { ExtensionHostApi, ExtensionSDK, RawVisualizationData, TileHostData, TileSDK, VisualizationSDK, LookerHostData } from '@looker/extension-sdk';
2
+ import type { ExtensionHostApi, ExtensionSDK } from '@looker/extension-sdk';
3
3
  export interface BaseExtensionContextData {
4
4
  extensionSDK: ExtensionSDK;
5
- lookerHostData?: Readonly<LookerHostData>;
6
5
  initializeError?: string;
7
6
  route: string;
8
7
  routeState?: any;
9
- visualizationData?: Readonly<RawVisualizationData>;
10
- visualizationSDK: VisualizationSDK;
11
- tileHostData: Readonly<TileHostData>;
12
- tileSDK: TileSDK;
13
8
  }
14
9
  export interface RouteData {
15
10
  route: string;
@@ -27,6 +22,6 @@ export interface ExtensionProviderProps {
27
22
  export interface ExtensionConnectorProps extends ExtensionProviderProps {
28
23
  contextData: BaseExtensionContextData;
29
24
  connectedCallback: (extensionSDK: ExtensionHostApi) => void;
30
- updateContextData: (contextData: Partial<BaseExtensionContextData>) => void;
25
+ updateContextData: (contextData: BaseExtensionContextData) => void;
31
26
  unloadedCallback: () => void;
32
27
  }
@@ -1,2 +1,2 @@
1
- "use strict";
1
+
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/ExtensionConnector/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 type { ReactNode } from 'react'\nimport type { ExtensionHostApi, ExtensionSDK } from '@looker/extension-sdk'\n\n/**\n * Base extension context\n */\nexport interface BaseExtensionContextData {\n /**\n * Extension SDK.\n */\n extensionSDK: ExtensionSDK\n /**\n * Error message will be set in an initialization error occurs.\n * @deprecated if an initialization error occurs the extension\n * component is no longer rendered. initializeError will ALWAYS\n * be undefined\n */\n initializeError?: string\n /**\n * Current route\n */\n route: string\n /**\n * Current route state\n */\n routeState?: any\n}\n\nexport interface RouteData {\n route: string\n routeState?: any\n}\n\nexport interface ExtensionProviderProps {\n /**\n * When true, a react router MemoryRouter will be created and changes to the\n * extension route will be propagated to the host. The host will then track\n * the clients route by appending it to the host route.\n * Note that this is only supported where the extension is mounted\n * in the main extension view. If the extension is mounted as a component of a\n * looker composite component (dashboard for example), hostTracksRoute will be\n * ignored.\n */\n hostTracksRoute?: boolean\n /**\n * Pathname change callback. Use when extension components need to modify their\n * state based upon the current route.\n */\n onPathnameChange?: (pathname: string) => void\n /**\n * Route change callback. Use when extension components need to modify their\n * state based upon the current route. Alternate to onPathname change and\n * provides more details\n */\n onRouteChange?: (route: string, routeState?: any) => void\n /**\n * Loading component to display while the provider is\n * establishing communication with the Looker host\n */\n loadingComponent?: JSX.Element\n /**\n * Required looker version. An error will be thrown if the host\n * Looker is not at the version specified.\n */\n requiredLookerVersion?: string\n /**\n * Timeout for messages sent via chatty. Defaults to 30000 milliseconds.\n * Set to -1 for no timeout.\n */\n chattyTimeout?: number\n /**\n * Children\n */\n children?: ReactNode\n}\n\nexport interface ExtensionConnectorProps extends ExtensionProviderProps {\n contextData: BaseExtensionContextData\n connectedCallback: (extensionSDK: ExtensionHostApi) => void\n updateContextData: (contextData: BaseExtensionContextData) => void\n unloadedCallback: () => void\n}\n"],"mappings":""}
@@ -4,89 +4,53 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExtensionProvider = exports.ExtensionContext = void 0;
7
-
8
7
  var _react = _interopRequireWildcard(require("react"));
9
-
10
8
  var _extensionSdk = require("@looker/extension-sdk");
11
-
12
9
  var _ExtensionConnector = require("../ExtensionConnector");
13
-
14
10
  var _core_sdk_ = require("../../sdk/core_sdk_31");
15
-
16
11
  var _core_sdk_2 = require("../../sdk/core_sdk_40");
17
-
12
+ var _excluded = ["children"];
18
13
  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); }
19
-
20
14
  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; }
21
-
22
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
-
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25
-
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
-
28
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
-
15
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
+ 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; }
17
+ 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; }
18
+ 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; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
+ 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); }
30
21
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
-
32
22
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
33
-
34
23
  var ExtensionContext = _react.default.createContext(undefined);
35
-
36
24
  exports.ExtensionContext = ExtensionContext;
37
-
38
25
  var ExtensionProvider = _ref => {
39
26
  var {
40
- children
41
- } = _ref,
42
- props = _objectWithoutProperties(_ref, ["children"]);
43
-
27
+ children
28
+ } = _ref,
29
+ props = _objectWithoutProperties(_ref, _excluded);
44
30
  var [extensionData, setExtensionData] = (0, _react.useState)({});
45
-
46
31
  var connectedCallback = extensionHost => {
47
32
  var core31SDK = _extensionSdk.LookerExtensionSDK.create31Client(extensionHost);
48
-
49
33
  var core40SDK = _extensionSdk.LookerExtensionSDK.create40Client(extensionHost);
50
-
51
34
  (0, _core_sdk_.registerCore31SDK)(core31SDK);
52
35
  (0, _core_sdk_2.registerCore40SDK)(core40SDK);
53
- var {
54
- visualizationSDK,
55
- tileSDK,
56
- lookerHostData
57
- } = extensionHost;
58
- var {
59
- visualizationData
60
- } = visualizationSDK;
61
- var {
62
- tileHostData
63
- } = tileSDK;
64
36
  setExtensionData(previousState => {
65
37
  return _objectSpread(_objectSpread({}, previousState), {}, {
66
38
  extensionSDK: extensionHost,
67
39
  coreSDK: core31SDK,
68
40
  core31SDK,
69
- core40SDK,
70
- visualizationSDK,
71
- tileSDK,
72
- visualizationData,
73
- tileHostData,
74
- lookerHostData
41
+ core40SDK
75
42
  });
76
43
  });
77
44
  };
78
-
79
45
  var unloadedCallback = () => {
80
46
  (0, _core_sdk_.unregisterCore31SDK)();
81
47
  (0, _core_sdk_2.unregisterCore40SDK)();
82
48
  };
83
-
84
49
  var updateContextData = updatedContextData => {
85
50
  setExtensionData(previousState => {
86
51
  return _objectSpread(_objectSpread({}, previousState), updatedContextData);
87
52
  });
88
53
  };
89
-
90
54
  return _react.default.createElement(ExtensionContext.Provider, {
91
55
  value: extensionData
92
56
  }, _react.default.createElement(_ExtensionConnector.ExtensionConnector, _extends({}, props, {
@@ -96,6 +60,5 @@ var ExtensionProvider = _ref => {
96
60
  unloadedCallback: unloadedCallback
97
61
  }), children));
98
62
  };
99
-
100
63
  exports.ExtensionProvider = ExtensionProvider;
101
64
  //# sourceMappingURL=ExtensionProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExtensionProvider/ExtensionProvider.tsx"],"names":["ExtensionContext","React","createContext","undefined","ExtensionProvider","children","props","extensionData","setExtensionData","connectedCallback","extensionHost","core31SDK","LookerExtensionSDK","create31Client","core40SDK","create40Client","visualizationSDK","tileSDK","lookerHostData","visualizationData","tileHostData","previousState","extensionSDK","coreSDK","unloadedCallback","updateContextData","updatedContextData"],"mappings":";;;;;;;AA0BA;;AAEA;;AAMA;;AACA;;AACA;;;;;;;;;;;;;;;;;;AAMO,IAAMA,gBAAgB,GAAGC,eAAMC,aAAN,CAC9BC,SAD8B,CAAzB;;;;AASA,IAAMC,iBAAmD,GAAG,QAG7D;AAAA,MAH8D;AAClEC,IAAAA;AADkE,GAG9D;AAAA,MADDC,KACC;;AACJ,MAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoC,qBACxC,EADwC,CAA1C;;AAGA,MAAMC,iBAAiB,GAAIC,aAAD,IAAqC;AAC7D,QAAMC,SAAsB,GAC1BC,iCAAmBC,cAAnB,CAAkCH,aAAlC,CADF;;AAEA,QAAMI,SAAsB,GAC1BF,iCAAmBG,cAAnB,CAAkCL,aAAlC,CADF;;AAGA,sCAAkBC,SAAlB;AACA,uCAAkBG,SAAlB;AACA,QAAM;AAAEE,MAAAA,gBAAF;AAAoBC,MAAAA,OAApB;AAA6BC,MAAAA;AAA7B,QAAgDR,aAAtD;AACA,QAAM;AAAES,MAAAA;AAAF,QAAwBH,gBAA9B;AACA,QAAM;AAAEI,MAAAA;AAAF,QAAmBH,OAAzB;AACAT,IAAAA,gBAAgB,CAAEa,aAAD,IAAyC;AACxD,6CACKA,aADL;AAEEC,QAAAA,YAAY,EAAEZ,aAFhB;AAGEa,QAAAA,OAAO,EAAEZ,SAHX;AAIEA,QAAAA,SAJF;AAKEG,QAAAA,SALF;AAMEE,QAAAA,gBANF;AAOEC,QAAAA,OAPF;AAQEE,QAAAA,iBARF;AASEC,QAAAA,YATF;AAUEF,QAAAA;AAVF;AAYD,KAbe,CAAhB;AAcD,GAzBD;;AA2BA,MAAMM,gBAAgB,GAAG,MAAM;AAC7B;AACA;AACD,GAHD;;AAKA,MAAMC,iBAAiB,GACrBC,kBADwB,IAErB;AACHlB,IAAAA,gBAAgB,CAAEa,aAAD,IAAyC;AACxD,6CACKA,aADL,GAEKK,kBAFL;AAID,KALe,CAAhB;AAMD,GATD;;AAWA,SACE,6BAAC,gBAAD,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAEnB;AAAlC,KACE,6BAAC,sCAAD,eACMD,KADN;AAEE,IAAA,WAAW,EAAEC,aAFf;AAGE,IAAA,iBAAiB,EAAEE,iBAHrB;AAIE,IAAA,iBAAiB,EAAEgB,iBAJrB;AAKE,IAAA,gBAAgB,EAAED;AALpB,MAOGnB,QAPH,CADF,CADF;AAaD,CA/DM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 React, { useState } from 'react'\nimport type { ExtensionHostApi } from '@looker/extension-sdk'\nimport { LookerExtensionSDK } from '@looker/extension-sdk'\nimport type { Looker31SDK, Looker40SDK } from '@looker/sdk'\nimport type {\n BaseExtensionContextData,\n ExtensionProviderProps,\n} from '../ExtensionConnector'\nimport { ExtensionConnector } from '../ExtensionConnector'\nimport { registerCore31SDK, unregisterCore31SDK } from '../../sdk/core_sdk_31'\nimport { registerCore40SDK, unregisterCore40SDK } from '../../sdk/core_sdk_40'\nimport type { ExtensionContextData } from './types'\n\n/**\n * React context provider for extension API and SDK\n */\nexport const ExtensionContext = React.createContext<ExtensionContextData>(\n undefined as any // no one will ever see this undefined!\n)\n\n/**\n * ExtensionProvider component. Provides access to the extension API and SDK (use\n * ExtensionContext) and react routing services.\n * @deprecated use ExtensionProvider40\n */\nexport const ExtensionProvider: React.FC<ExtensionProviderProps> = ({\n children,\n ...props\n}) => {\n const [extensionData, setExtensionData] = useState<ExtensionContextData>(\n {} as ExtensionContextData\n )\n const connectedCallback = (extensionHost: ExtensionHostApi) => {\n const core31SDK: Looker31SDK =\n LookerExtensionSDK.create31Client(extensionHost)\n const core40SDK: Looker40SDK =\n LookerExtensionSDK.create40Client(extensionHost)\n // Provide global access for use by redux if needed\n registerCore31SDK(core31SDK)\n registerCore40SDK(core40SDK)\n const { visualizationSDK, tileSDK, lookerHostData } = extensionHost\n const { visualizationData } = visualizationSDK\n const { tileHostData } = tileSDK\n setExtensionData((previousState: ExtensionContextData) => {\n return {\n ...previousState,\n extensionSDK: extensionHost,\n coreSDK: core31SDK,\n core31SDK,\n core40SDK,\n visualizationSDK,\n tileSDK,\n visualizationData,\n tileHostData,\n lookerHostData,\n }\n })\n }\n\n const unloadedCallback = () => {\n unregisterCore31SDK()\n unregisterCore40SDK()\n }\n\n const updateContextData = (\n updatedContextData: Partial<BaseExtensionContextData>\n ) => {\n setExtensionData((previousState: ExtensionContextData) => {\n return {\n ...previousState,\n ...updatedContextData,\n }\n })\n }\n\n return (\n <ExtensionContext.Provider value={extensionData}>\n <ExtensionConnector\n {...props}\n contextData={extensionData}\n connectedCallback={connectedCallback}\n updateContextData={updateContextData}\n unloadedCallback={unloadedCallback}\n >\n {children}\n </ExtensionConnector>\n </ExtensionContext.Provider>\n )\n}\n"],"file":"ExtensionProvider.js"}
1
+ {"version":3,"file":"ExtensionProvider.js","names":["ExtensionContext","React","createContext","undefined","ExtensionProvider","children","props","extensionData","setExtensionData","useState","connectedCallback","extensionHost","core31SDK","LookerExtensionSDK","create31Client","core40SDK","create40Client","registerCore31SDK","registerCore40SDK","previousState","extensionSDK","coreSDK","unloadedCallback","unregisterCore31SDK","unregisterCore40SDK","updateContextData","updatedContextData"],"sources":["../../../src/components/ExtensionProvider/ExtensionProvider.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 React, { useState } from 'react'\nimport type { ExtensionHostApi } from '@looker/extension-sdk'\nimport { LookerExtensionSDK } from '@looker/extension-sdk'\nimport type { Looker31SDK, Looker40SDK } from '@looker/sdk'\nimport type {\n BaseExtensionContextData,\n ExtensionProviderProps,\n} from '../ExtensionConnector'\nimport { ExtensionConnector } from '../ExtensionConnector'\nimport { registerCore31SDK, unregisterCore31SDK } from '../../sdk/core_sdk_31'\nimport { registerCore40SDK, unregisterCore40SDK } from '../../sdk/core_sdk_40'\nimport type { ExtensionContextData } from './types'\n\n/**\n * React context provider for extension API and SDK\n */\nexport const ExtensionContext = React.createContext<ExtensionContextData>(\n undefined as any // no one will ever see this undefined!\n)\n\n/**\n * ExtensionProvider component. Provides access to the extension API and SDK (use\n * ExtensionContext) and react routing services.\n */\nexport const ExtensionProvider: React.FC<ExtensionProviderProps> = ({\n children,\n ...props\n}) => {\n const [extensionData, setExtensionData] = useState<ExtensionContextData>(\n {} as ExtensionContextData\n )\n const connectedCallback = (extensionHost: ExtensionHostApi) => {\n const core31SDK: Looker31SDK =\n LookerExtensionSDK.create31Client(extensionHost)\n const core40SDK: Looker40SDK =\n LookerExtensionSDK.create40Client(extensionHost)\n // Provide global access for use by redux if needed\n registerCore31SDK(core31SDK)\n registerCore40SDK(core40SDK)\n setExtensionData((previousState: ExtensionContextData) => {\n return {\n ...previousState,\n extensionSDK: extensionHost,\n coreSDK: core31SDK,\n core31SDK,\n core40SDK,\n }\n })\n }\n\n const unloadedCallback = () => {\n unregisterCore31SDK()\n unregisterCore40SDK()\n }\n\n const updateContextData = (updatedContextData: BaseExtensionContextData) => {\n setExtensionData((previousState: ExtensionContextData) => {\n return {\n ...previousState,\n ...updatedContextData,\n }\n })\n }\n\n return (\n <ExtensionContext.Provider value={extensionData!}>\n <ExtensionConnector\n {...props}\n contextData={extensionData}\n connectedCallback={connectedCallback}\n updateContextData={updateContextData}\n unloadedCallback={unloadedCallback}\n >\n {children}\n </ExtensionConnector>\n </ExtensionContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA0BA;AAEA;AAMA;AACA;AACA;AAA8E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,IAAMA,gBAAgB,GAAGC,cAAK,CAACC,aAAa,CACjDC,SAAS,CACV;AAAA;AAMM,IAAMC,iBAAmD,GAAG,QAG7D;EAAA,IAH8D;MAClEC;IAEF,CAAC;IADIC,KAAK;EAER,IAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAC,eAAQ,EAChD,CAAC,CAAC,CACH;EACD,IAAMC,iBAAiB,GAAIC,aAA+B,IAAK;IAC7D,IAAMC,SAAsB,GAC1BC,gCAAkB,CAACC,cAAc,CAACH,aAAa,CAAC;IAClD,IAAMI,SAAsB,GAC1BF,gCAAkB,CAACG,cAAc,CAACL,aAAa,CAAC;IAElD,IAAAM,4BAAiB,EAACL,SAAS,CAAC;IAC5B,IAAAM,6BAAiB,EAACH,SAAS,CAAC;IAC5BP,gBAAgB,CAAEW,aAAmC,IAAK;MACxD,uCACKA,aAAa;QAChBC,YAAY,EAAET,aAAa;QAC3BU,OAAO,EAAET,SAAS;QAClBA,SAAS;QACTG;MAAS;IAEb,CAAC,CAAC;EACJ,CAAC;EAED,IAAMO,gBAAgB,GAAG,MAAM;IAC7B,IAAAC,8BAAmB,GAAE;IACrB,IAAAC,+BAAmB,GAAE;EACvB,CAAC;EAED,IAAMC,iBAAiB,GAAIC,kBAA4C,IAAK;IAC1ElB,gBAAgB,CAAEW,aAAmC,IAAK;MACxD,uCACKA,aAAa,GACbO,kBAAkB;IAEzB,CAAC,CAAC;EACJ,CAAC;EAED,OACE,6BAAC,gBAAgB,CAAC,QAAQ;IAAC,KAAK,EAAEnB;EAAe,GAC/C,6BAAC,sCAAkB,eACbD,KAAK;IACT,WAAW,EAAEC,aAAc;IAC3B,iBAAiB,EAAEG,iBAAkB;IACrC,iBAAiB,EAAEe,iBAAkB;IACrC,gBAAgB,EAAEH;EAAiB,IAElCjB,QAAQ,CACU,CACK;AAEhC,CAAC;AAAA"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _ExtensionProvider = require("./ExtensionProvider");
8
-
9
7
  Object.keys(_ExtensionProvider).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _ExtensionProvider[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_ExtensionProvider).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _types = require("./types");
21
-
22
18
  Object.keys(_types).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _types[key]) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExtensionProvider/index.ts"],"names":[],"mappings":";;;;;;AA0BA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './ExtensionProvider'\nexport * from './types'\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ExtensionProvider/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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\nexport * from './ExtensionProvider'\nexport * from './types'\n"],"mappings":";;;;;AA0BA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";
1
+
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/ExtensionProvider/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 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 type { Looker31SDK, Looker40SDK } from '@looker/sdk'\nimport type { BaseExtensionContextData } from '../ExtensionConnector'\n\n/**\n * Extension context\n */\nexport interface ExtensionContextData extends BaseExtensionContextData {\n /**\n * Looker 3.1 SDK. Note that SDK calls are made by the extension host.\n * @deprecated use core31SDK - coreSDK === core31SDK\n */\n coreSDK: Looker31SDK\n /**\n * Looker 31. SDK. Note that SDK calls are made by the extension host.\n */\n core31SDK: Looker31SDK\n /**\n * Looker 4.0 SDK. Note that SDK calls are made by the extension host.\n */\n core40SDK: Looker40SDK\n}\n"],"mappings":""}