@shopware-ag/admin-extension-sdk
Advanced tools
Comparing version 3.0.9 to 3.0.10
@@ -7,2 +7,5 @@ export declare const is: (location: string) => boolean; | ||
export declare const stopAutoResizer: () => void; | ||
export declare const updateUrl: (url: URL) => Promise<void | null>; | ||
export declare const startAutoUrlUpdater: () => void; | ||
export declare const stopAutoUrlUpdater: () => void; | ||
export declare const MAIN_HIDDEN = "sw-main-hidden"; | ||
@@ -20,1 +23,32 @@ export type locationUpdateHeight = { | ||
}; | ||
export type locationUpdateUrl = { | ||
responseType: void; | ||
/** | ||
* The hash of the url | ||
* | ||
* @example | ||
* #/sw/dashboard | ||
*/ | ||
hash: string; | ||
/** | ||
* The pathname of the url | ||
* | ||
* @example | ||
* / | ||
*/ | ||
pathname: string; | ||
/** | ||
* The searchParams of the url | ||
* | ||
* @example | ||
* [ | ||
* ['foo', 'bar'], | ||
* ['baz', 'qux'], | ||
* ] | ||
*/ | ||
searchParams: Array<[string, string]>; | ||
/** | ||
* The locationID of the current element | ||
*/ | ||
locationId: string | null; | ||
}; |
@@ -43,3 +43,30 @@ import { send } from '../channel'; | ||
}; | ||
export const updateUrl = (url) => { | ||
return send('locationUpdateUrl', { | ||
hash: url.hash, | ||
pathname: url.pathname, | ||
searchParams: [...url.searchParams.entries()], | ||
locationId: getLocationId(), | ||
}); | ||
}; | ||
let urlUpdateInterval = null; | ||
export const startAutoUrlUpdater = () => { | ||
let prevUrl = undefined; | ||
if (urlUpdateInterval) { | ||
clearInterval(urlUpdateInterval); | ||
} | ||
urlUpdateInterval = setInterval(() => { | ||
const currUrl = window.location.href; | ||
if (currUrl !== prevUrl) { | ||
prevUrl = currUrl; | ||
void updateUrl(new URL(currUrl)); | ||
} | ||
}, 50); | ||
}; | ||
export const stopAutoUrlUpdater = () => { | ||
if (urlUpdateInterval) { | ||
clearInterval(urlUpdateInterval); | ||
} | ||
}; | ||
export const MAIN_HIDDEN = 'sw-main-hidden'; | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ import type { notificationDispatch } from './notification/index'; | ||
import type { cmsRegisterElement } from './ui/cms'; | ||
import type { locationUpdateHeight } from './location/index'; | ||
import type { locationUpdateHeight, locationUpdateUrl } from './location/index'; | ||
import type { menuItemAdd } from './ui/menu'; | ||
@@ -45,2 +45,3 @@ import type { settingsItemAdd } from './ui/settings'; | ||
locationUpdateHeight: locationUpdateHeight; | ||
locationUpdateUrl: locationUpdateUrl; | ||
menuItemAdd: menuItemAdd; | ||
@@ -47,0 +48,0 @@ settingsItemAdd: settingsItemAdd; |
{ | ||
"name": "@shopware-ag/admin-extension-sdk", | ||
"license": "MIT", | ||
"version": "3.0.9", | ||
"version": "3.0.10", | ||
"repository": "git://github.com/shopware/admin-extension-sdk.git", | ||
@@ -6,0 +6,0 @@ "description": "The SDK for App iframes to communicate with the Shopware Administration", |
@@ -7,2 +7,5 @@ export declare const is: (location: string) => boolean; | ||
export declare const stopAutoResizer: () => void; | ||
export declare const updateUrl: (url: URL) => Promise<void | null>; | ||
export declare const startAutoUrlUpdater: () => void; | ||
export declare const stopAutoUrlUpdater: () => void; | ||
export declare const MAIN_HIDDEN = "sw-main-hidden"; | ||
@@ -20,1 +23,32 @@ export type locationUpdateHeight = { | ||
}; | ||
export type locationUpdateUrl = { | ||
responseType: void; | ||
/** | ||
* The hash of the url | ||
* | ||
* @example | ||
* #/sw/dashboard | ||
*/ | ||
hash: string; | ||
/** | ||
* The pathname of the url | ||
* | ||
* @example | ||
* / | ||
*/ | ||
pathname: string; | ||
/** | ||
* The searchParams of the url | ||
* | ||
* @example | ||
* [ | ||
* ['foo', 'bar'], | ||
* ['baz', 'qux'], | ||
* ] | ||
*/ | ||
searchParams: Array<[string, string]>; | ||
/** | ||
* The locationID of the current element | ||
*/ | ||
locationId: string | null; | ||
}; |
@@ -12,3 +12,3 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MAIN_HIDDEN = exports.stopAutoResizer = exports.startAutoResizer = exports.updateHeight = exports.isIframe = exports.get = exports.is = void 0; | ||
exports.MAIN_HIDDEN = exports.stopAutoUrlUpdater = exports.startAutoUrlUpdater = exports.updateUrl = exports.stopAutoResizer = exports.startAutoResizer = exports.updateHeight = exports.isIframe = exports.get = exports.is = void 0; | ||
const channel_1 = require("../channel"); | ||
@@ -62,4 +62,34 @@ const utils_1 = require("../_internals/utils"); | ||
exports.stopAutoResizer = stopAutoResizer; | ||
const updateUrl = (url) => { | ||
return (0, channel_1.send)('locationUpdateUrl', { | ||
hash: url.hash, | ||
pathname: url.pathname, | ||
searchParams: [...url.searchParams.entries()], | ||
locationId: (0, utils_1.getLocationId)(), | ||
}); | ||
}; | ||
exports.updateUrl = updateUrl; | ||
let urlUpdateInterval = null; | ||
const startAutoUrlUpdater = () => { | ||
let prevUrl = undefined; | ||
if (urlUpdateInterval) { | ||
clearInterval(urlUpdateInterval); | ||
} | ||
urlUpdateInterval = setInterval(() => { | ||
const currUrl = window.location.href; | ||
if (currUrl !== prevUrl) { | ||
prevUrl = currUrl; | ||
void (0, exports.updateUrl)(new URL(currUrl)); | ||
} | ||
}, 50); | ||
}; | ||
exports.startAutoUrlUpdater = startAutoUrlUpdater; | ||
const stopAutoUrlUpdater = () => { | ||
if (urlUpdateInterval) { | ||
clearInterval(urlUpdateInterval); | ||
} | ||
}; | ||
exports.stopAutoUrlUpdater = stopAutoUrlUpdater; | ||
exports.MAIN_HIDDEN = 'sw-main-hidden'; | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ import type { notificationDispatch } from './notification/index'; | ||
import type { cmsRegisterElement } from './ui/cms'; | ||
import type { locationUpdateHeight } from './location/index'; | ||
import type { locationUpdateHeight, locationUpdateUrl } from './location/index'; | ||
import type { menuItemAdd } from './ui/menu'; | ||
@@ -45,2 +45,3 @@ import type { settingsItemAdd } from './ui/settings'; | ||
locationUpdateHeight: locationUpdateHeight; | ||
locationUpdateUrl: locationUpdateUrl; | ||
menuItemAdd: menuItemAdd; | ||
@@ -47,0 +48,0 @@ settingsItemAdd: settingsItemAdd; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
773272
10672
2