@shopware-ag/admin-extension-sdk
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -1,1 +0,1 @@ | ||
var ae=Object.defineProperty;var R=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var v=(o,r,s)=>r in o?ae(o,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[r]=s,b=(o,r)=>{for(var s in r||(r={}))ce.call(r,s)&&v(o,s,r[s]);if(R)for(var s of R(r))de.call(r,s)&&v(o,s,r[s]);return o};(function(o,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis!="undefined"?globalThis:o||self,r(o.sw={}))})(this,function(o){var D;"use strict";function r(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function s(e,t){for(let i in e){const n=e[i];t.apply(this,[e,i,n]),y(n)&&s(n,t)}}function y(e){return e!==null&&typeof e=="object"}function w(){return new URLSearchParams(window.location.search).get("location-id")}function x(){const e=window.location;return new URL(e.pathname,e.origin).toString()}function E(e){P(e)}function H(e){T(e)}const m={};let M=!1;function j(){M||(M=!0,h("__function__",async({args:e,id:t})=>await Promise.resolve(m[t](...e))))}function P(e){s(e,(t,i,n)=>{if(typeof n=="function"){const a=r();m[a]=n,t[i]={__type__:"__function__",id:a},j()}})}function T(e){s(e,(t,i,n)=>{if(y(n)&&n.__type__&&n.__type__==="__function__"&&typeof n.id=="string"){const a=n.id;t[i]=(...d)=>_("__function__",{args:d,id:a})}})}const S=new Set;function _(e,t,i){const n=r(),a=t!=null?t:{},d={_type:e,_data:a,_callbackId:n};E(d);const u=JSON.stringify(d);let l=!1;const p=3e3;return new Promise((ie,se)=>{const I=function(O){if(typeof O.data!="string")return;let f;try{f=JSON.parse(O.data)}catch{return}!A(f)||f._callbackId===n&&(!f.hasOwnProperty("_response")||(window.removeEventListener("message",I),l||(l=!0,ie(f._response))))};window.addEventListener("message",I),window.parent.__Cypress__?i?i.postMessage(u,window.parent.origin):window.postMessage(u,window.parent.origin):i?i.postMessage(u,window.parent.origin):window.parent.postMessage(u,window.parent.origin),setTimeout(()=>{l||se("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},p)})}function h(e,t){const i=async function(n){var p;if(typeof n.data!="string")return;let a;try{a=JSON.parse(n.data)}catch{return}if(!N(a)||a._type!==e)return;H(a);const d=await Promise.resolve(t(a._data,{_event_:n})),u={_callbackId:a._callbackId,_type:a._type,_response:d!=null?d:null},l=JSON.stringify(u);n.source?n.source.postMessage(l,{targetOrigin:(p=n.source.origin)!=null?p:"*"}):window.postMessage(l,window.origin)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)}function k(e,t){return h(e,t)}function c(e,t){return i=>_(e,b(b({},t),i))}function L(e){return t=>k(e,t)}(async()=>{h("__registerWindow__",(e,t)=>{t._event_.source?S.add(t._event_.source):S.add(window)}),await _("__registerWindow__",{})})().catch(e=>console.error(e));function N(e){const t=e;return!!t._type&&!!t._data&&!!t._callbackId}function A(e){const t=e;return!!t._type&&!!t.hasOwnProperty("_response")&&!!t._callbackId}const C=c("windowRedirect"),U=c("windowReload",{});var J=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",redirect:C,reload:U});const $=c("notificationDispatch");var q=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",dispatch:$});const W=c("contextLanguage",{}),B=L("contextLanguage"),F=c("contextEnvironment",{}),G=c("contextLocale",{}),K=L("contextLocale"),Q=c("contextCurrency",{});var X=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getLanguage:W,subscribeLanguage:B,getEnvironment:F,getLocale:G,subscribeLocale:K,getCurrency:Q});const Y=c("uiComponentSectionRenderer",{src:(D=x())!=null?D:void 0});var Z=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",add:Y});const V=e=>w()===e,z=e=>{if(e)return _("locationUpdateHeight",{height:e,locationId:w()});const t=document.documentElement.offsetHeight;return _("locationUpdateHeight",{height:t,locationId:w()})};let g=null;const ee=()=>{g=new ResizeObserver(()=>{z()}),g.observe(document.body)},te=()=>{g&&(g.unobserve(document.body),g.disconnect())},ne="sw-main-hidden";var oe=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",is:V,updateHeight:z,startAutoResizer:ee,stopAutoResizer:te,MAIN_HIDDEN:ne});const re={componentSection:Z};o.context=X,o.location=oe,o.notification=q,o.ui=re,o.window=J,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); | ||
var ce=Object.defineProperty;var R=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var v=(o,r,s)=>r in o?ce(o,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[r]=s,b=(o,r)=>{for(var s in r||(r={}))de.call(r,s)&&v(o,s,r[s]);if(R)for(var s of R(r))ue.call(r,s)&&v(o,s,r[s]);return o};(function(o,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(o=typeof globalThis!="undefined"?globalThis:o||self,r(o.sw={}))})(this,function(o){var z;"use strict";function r(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function s(e,t){for(let i in e){const n=e[i];t.apply(this,[e,i,n]),y(n)&&s(n,t)}}function y(e){return e!==null&&typeof e=="object"}function w(){return new URLSearchParams(window.location.search).get("location-id")}function x(){const e=window.location;return new URL(e.pathname,e.origin).toString()}function E(e){P(e)}function H(e){T(e)}const m={};let M=!1;function j(){M||(M=!0,h("__function__",async({args:e,id:t})=>await Promise.resolve(m[t](...e))))}function P(e){s(e,(t,i,n)=>{if(typeof n=="function"){const a=r();m[a]=n,t[i]={__type__:"__function__",id:a},j()}})}function T(e){s(e,(t,i,n)=>{if(y(n)&&n.__type__&&n.__type__==="__function__"&&typeof n.id=="string"){const a=n.id;t[i]=(...d)=>_("__function__",{args:d,id:a})}})}const S=new Set;function _(e,t,i){const n=r(),a=t!=null?t:{},d={_type:e,_data:a,_callbackId:n};E(d);const u=JSON.stringify(d);let l=!1;const p=3e3;return new Promise((se,ae)=>{const D=function(O){if(typeof O.data!="string")return;let f;try{f=JSON.parse(O.data)}catch{return}!A(f)||f._callbackId===n&&(!f.hasOwnProperty("_response")||(window.removeEventListener("message",D),l||(l=!0,se(f._response))))};window.addEventListener("message",D),window.parent.__Cypress__?i?i.postMessage(u,window.parent.origin):window.postMessage(u,window.parent.origin):i?i.postMessage(u,window.parent.origin):window.parent.postMessage(u,window.parent.origin),setTimeout(()=>{l||ae("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},p)})}function h(e,t){const i=async function(n){var p;if(typeof n.data!="string")return;let a;try{a=JSON.parse(n.data)}catch{return}if(!N(a)||a._type!==e)return;H(a);const d=await Promise.resolve(t(a._data,{_event_:n})),u={_callbackId:a._callbackId,_type:a._type,_response:d!=null?d:null},l=JSON.stringify(u);n.source?n.source.postMessage(l,{targetOrigin:(p=n.source.origin)!=null?p:"*"}):window.postMessage(l,window.origin)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)}function k(e,t){return h(e,t)}function c(e,t){return i=>_(e,b(b({},t),i))}function L(e){return t=>k(e,t)}(async()=>{h("__registerWindow__",(e,t)=>{t._event_.source?S.add(t._event_.source):S.add(window)}),await _("__registerWindow__",{})})().catch(e=>console.error(e));function N(e){const t=e;return!!t._type&&!!t._data&&!!t._callbackId}function A(e){const t=e;return!!t._type&&!!t.hasOwnProperty("_response")&&!!t._callbackId}const C=c("windowRedirect"),U=c("windowReload",{});var J=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",redirect:C,reload:U});const $=c("notificationDispatch");var q=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",dispatch:$});const W=c("contextLanguage",{}),B=L("contextLanguage"),F=c("contextEnvironment",{}),G=c("contextLocale",{}),K=L("contextLocale"),Q=c("contextCurrency",{});var X=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getLanguage:W,subscribeLanguage:B,getEnvironment:F,getLocale:G,subscribeLocale:K,getCurrency:Q});const Y=c("uiComponentSectionRenderer",{src:(z=x())!=null?z:void 0});var Z=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",add:Y});const V=e=>w()===e,ee=()=>window!==window.parent,I=e=>{if(e)return _("locationUpdateHeight",{height:e,locationId:w()});const t=document.documentElement.offsetHeight;return _("locationUpdateHeight",{height:t,locationId:w()})};let g=null;const te=()=>{g=new ResizeObserver(()=>{I()}),g.observe(document.body)},ne=()=>{g&&(g.unobserve(document.body),g.disconnect())},oe="sw-main-hidden";var re=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",is:V,isIframe:ee,updateHeight:I,startAutoResizer:te,stopAutoResizer:ne,MAIN_HIDDEN:oe});const ie={componentSection:Z};o.context=X,o.location=re,o.notification=q,o.ui=ie,o.window=J,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); |
export declare const is: (location: string) => boolean; | ||
export declare const isIframe: () => boolean; | ||
export declare const updateHeight: (height?: number | undefined) => Promise<void | null>; | ||
@@ -3,0 +4,0 @@ export declare const startAutoResizer: () => void; |
@@ -7,2 +7,5 @@ import { send } from '../channel'; | ||
}; | ||
export const isIframe = () => { | ||
return window !== window.parent; | ||
}; | ||
export const updateHeight = (height) => { | ||
@@ -9,0 +12,0 @@ if (height) { |
{ | ||
"name": "@shopware-ag/admin-extension-sdk", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"repository": "git://github.com/shopware/admin-extension-sdk.git", | ||
@@ -5,0 +5,0 @@ "description": "The SDK for App iframes to communicate with the Shopware Adminstration", |
export declare const is: (location: string) => boolean; | ||
export declare const isIframe: () => boolean; | ||
export declare const updateHeight: (height?: number | undefined) => Promise<void | null>; | ||
@@ -3,0 +4,0 @@ export declare const startAutoResizer: () => void; |
@@ -12,3 +12,3 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MAIN_HIDDEN = exports.stopAutoResizer = exports.startAutoResizer = exports.updateHeight = exports.is = void 0; | ||
exports.MAIN_HIDDEN = exports.stopAutoResizer = exports.startAutoResizer = exports.updateHeight = exports.isIframe = exports.is = void 0; | ||
const channel_1 = require("../channel"); | ||
@@ -21,2 +21,6 @@ const utils_1 = require("../_internals/utils"); | ||
exports.is = is; | ||
const isIframe = () => { | ||
return window !== window.parent; | ||
}; | ||
exports.isIframe = isIframe; | ||
const updateHeight = (height) => { | ||
@@ -23,0 +27,0 @@ if (height) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
121410
1873