@pitcher/js-api 1.21.0-beta.4 → 1.21.0-beta.5
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/js-api.esm.js +8 -4
- package/js-api.esm.js.map +1 -1
- package/js-api.umd.min.js +10 -10
- package/js-api.umd.min.js.map +1 -1
- package/lib/sdk/main.d.ts +1 -1
- package/package.json +1 -1
package/js-api.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { camelCase, snakeCase, cloneDeep } from 'lodash-es';
|
|
1
|
+
import { camelCase, snakeCase, cloneDeep, isEqual } from 'lodash-es';
|
|
2
2
|
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
for (var i = 0; i < m.length; i++) {
|
|
@@ -3400,8 +3400,12 @@ const dsr = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
3400
3400
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3401
3401
|
|
|
3402
3402
|
let highLevelApi;
|
|
3403
|
+
let prevOptions;
|
|
3403
3404
|
function usePitcherApi(options) {
|
|
3404
|
-
if (!highLevelApi
|
|
3405
|
+
if (!highLevelApi || !isEqual(options, prevOptions)) {
|
|
3406
|
+
highLevelApi = createHighLevelApi(options);
|
|
3407
|
+
prevOptions = options;
|
|
3408
|
+
}
|
|
3405
3409
|
return highLevelApi;
|
|
3406
3410
|
}
|
|
3407
3411
|
const uiApi = Object.entries(
|
|
@@ -3444,7 +3448,7 @@ function getAvailableApis() {
|
|
|
3444
3448
|
const location = window.parent.jsApiLocation;
|
|
3445
3449
|
return location === "ui" ? ["ui", "impact"] : [location ?? "impact"];
|
|
3446
3450
|
}
|
|
3447
|
-
function useApi() {
|
|
3451
|
+
function useApi(options) {
|
|
3448
3452
|
if (typeof window === "undefined") throw new Error("useApi: window is not defined");
|
|
3449
3453
|
const location = window.parent.jsApiLocation;
|
|
3450
3454
|
switch (location) {
|
|
@@ -3455,7 +3459,7 @@ function useApi() {
|
|
|
3455
3459
|
case "dsr":
|
|
3456
3460
|
return useDsr();
|
|
3457
3461
|
case "impact":
|
|
3458
|
-
return usePitcherApi();
|
|
3462
|
+
return usePitcherApi(options);
|
|
3459
3463
|
default:
|
|
3460
3464
|
throw new Error(`Unknown api for location: ${location}`);
|
|
3461
3465
|
}
|