@shopware-ag/meteor-admin-sdk
Version:
The Meteor SDK for the Shopware Administration.
27 lines (26 loc) • 1.6 kB
TypeScript
import type { extension } from './privileges';
export declare function generateUniqueId(): string;
export declare function isObject(value: unknown): value is any;
export declare function getLocationId(): string | null;
export declare function getWindowSrc(): string;
export declare function hasType(type: string, obj: any): boolean;
export declare function hasOwnProperty(obj: any, path: string): boolean;
export declare function traverseObject(this: any, traversableObject: any, processor: (parentEntry: any, key: string, value: any, previousKey: string) => void, previousKey?: string): void;
export declare function isPrimitive(value: any): boolean;
/**
* Removes the root prefix from a path
*/
export declare function removeRoot(path: string | number): string | number;
export declare function findExtensionByBaseUrl(baseUrl?: string): extension | undefined;
/**
* Returns the technical name (registry key) of the extension matching the given base URL.
*
* For cross-origin extensions the lookup uses origin comparison. For same-origin extensions
* (e.g. plugins served from the same host as the Admin) the origin alone is not enough to
* distinguish the extension from the Admin itself. Pass the sender `Window` as `sourceWindow`
* to enable a fallback that matches the window's full href against the known `baseUrl` prefixes.
*
* Returns undefined when no matching extension is found or when the origin is the Admin's own
* origin and no `sourceWindow` is provided.
*/
export declare function findExtensionNameByBaseUrl(baseUrl?: string, sourceWindow?: Window): string | undefined;