@shopware-ag/admin-extension-sdk
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -1,1 +0,1 @@ | ||
var V=Object.defineProperty;var D=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var O=(o,r,i)=>r in o?V(o,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[r]=i,w=(o,r)=>{for(var i in r||(r={}))ee.call(r,i)&&O(o,i,r[i]);if(D)for(var i of D(r))te.call(r,i)&&O(o,i,r[i]);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){"use strict";function r(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function i(e,t){for(let s in e){const n=e[s];t.apply(this,[e,s,n]),y(n)&&i(n,t)}}function y(e){return e!==null&&typeof e=="object"}function x(e){z(e)}function C(e){I(e)}const b={};let h=!1;function R(){h||(h=!0,p("__function__",async({args:e,id:t})=>await Promise.resolve(b[t](...e))))}function z(e){i(e,(t,s,n)=>{if(typeof n=="function"){const a=r();b[a]=n,t[s]={__type__:"__function__",id:a},R()}})}function I(e){i(e,(t,s,n)=>{if(y(n)&&n.__type__&&n.__type__==="__function__"&&typeof n.id=="string"){const a=n.id;t[s]=(...d)=>g("__function__",{args:d,id:a})}})}const m=new Set;function g(e,t,s){const n=r(),a=t!=null?t:{},d={_type:e,_data:a,_callbackId:n};x(d);const u=JSON.stringify(d);let _=!1;const f=3e3;return new Promise((Y,Z)=>{const S=function(L){if(typeof L.data!="string")return;let l;try{l=JSON.parse(L.data)}catch{return}!k(l)||l._callbackId===n&&(!l.hasOwnProperty("_response")||(window.removeEventListener("message",S),_||(_=!0,Y(l._response))))};window.addEventListener("message",S),window.parent.__Cypress__?s?s.postMessage(u,window.parent.origin):window.postMessage(u,window.parent.origin):s?s.postMessage(u,window.parent.origin):window.parent.postMessage(u,window.parent.origin),setTimeout(()=>{_||Z("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},f)})}function p(e,t){const s=async function(n){var f;if(typeof n.data!="string")return;let a;try{a=JSON.parse(n.data)}catch{return}if(!j(a)||a._type!==e)return;C(a);const d=await Promise.resolve(t(a._data,{_event_:n})),u={_callbackId:a._callbackId,_type:a._type,_response:d!=null?d:null},_=JSON.stringify(u);n.source?n.source.postMessage(_,{targetOrigin:(f=n.source.origin)!=null?f:"*"}):window.postMessage(_,window.origin)};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)}function T(e,t){return p(e,t)}function c(e,t){return s=>g(e,w(w({},t),s))}function M(e){return t=>T(e,t)}(async()=>{p("__registerWindow__",(e,t)=>{t._event_.source?m.add(t._event_.source):m.add(window)}),await g("__registerWindow__",{})})().catch(e=>console.error(e));function j(e){const t=e;return!!t._type&&!!t._data&&!!t._callbackId}function k(e){const t=e;return!!t._type&&!!t.hasOwnProperty("_response")&&!!t._callbackId}const v=c("windowRedirect"),E=c("windowReload",{});var P=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",redirect:v,reload:E});const J=c("notificationDispatch");var N=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",dispatch:J});const H=c("contextLanguage",{}),q=M("contextLanguage"),$=c("contextEnvironment",{}),A=c("contextLocale",{}),B=M("contextLocale"),U=c("contextCurrency",{});var W=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getLanguage:H,subscribeLanguage:q,getEnvironment:$,getLocale:A,subscribeLocale:B,getCurrency:U});const F=c("uiComponentRender");var G=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",render:F});const K=e=>({addComponentBefore:c("uiComponentRender",{positionId:e+"__before"}),addComponentAfter:c("uiComponentRender",{positionId:e+"__after"})});var Q=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",uiCard:K});const X={component:G,card:Q};o.context=W,o.notification=N,o.ui=X,o.window=P,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); | ||
var Z=Object.defineProperty;var D=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var x=(o,r,i)=>r in o?Z(o,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[r]=i,w=(o,r)=>{for(var i in r||(r={}))V.call(r,i)&&x(o,i,r[i]);if(D)for(var i of D(r))ee.call(r,i)&&x(o,i,r[i]);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){"use strict";function r(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function i(e,t){for(let s in e){const n=e[s];t.apply(this,[e,s,n]),y(n)&&i(n,t)}}function y(e){return e!==null&&typeof e=="object"}function O(e){z(e)}function R(e){C(e)}const b={};let h=!1;function I(){h||(h=!0,p("__function__",async({args:e,id:t})=>await Promise.resolve(b[t](...e))))}function z(e){i(e,(t,s,n)=>{if(typeof n=="function"){const a=r();b[a]=n,t[s]={__type__:"__function__",id:a},I()}})}function C(e){i(e,(t,s,n)=>{if(y(n)&&n.__type__&&n.__type__==="__function__"&&typeof n.id=="string"){const a=n.id;t[s]=(...d)=>g("__function__",{args:d,id:a})}})}const m=new Set;function g(e,t,s){const n=r(),a=t!=null?t:{},d={_type:e,_data:a,_callbackId:n};O(d);const u=JSON.stringify(d);let _=!1;const l=3e3;return new Promise((X,Y)=>{const S=function(L){if(typeof L.data!="string")return;let f;try{f=JSON.parse(L.data)}catch{return}!E(f)||f._callbackId===n&&(!f.hasOwnProperty("_response")||(window.removeEventListener("message",S),_||(_=!0,X(f._response))))};window.addEventListener("message",S),window.parent.__Cypress__?s?s.postMessage(u,window.parent.origin):window.postMessage(u,window.parent.origin):s?s.postMessage(u,window.parent.origin):window.parent.postMessage(u,window.parent.origin),setTimeout(()=>{_||Y("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},l)})}function p(e,t){const s=async function(n){var l;if(typeof n.data!="string")return;let a;try{a=JSON.parse(n.data)}catch{return}if(!v(a)||a._type!==e)return;R(a);const d=await Promise.resolve(t(a._data,{_event_:n})),u={_callbackId:a._callbackId,_type:a._type,_response:d!=null?d:null},_=JSON.stringify(u);n.source?n.source.postMessage(_,{targetOrigin:(l=n.source.origin)!=null?l:"*"}):window.postMessage(_,window.origin)};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)}function k(e,t){return p(e,t)}function c(e,t){return s=>g(e,w(w({},t),s))}function M(e){return t=>k(e,t)}(async()=>{p("__registerWindow__",(e,t)=>{t._event_.source?m.add(t._event_.source):m.add(window)}),await g("__registerWindow__",{})})().catch(e=>console.error(e));function v(e){const t=e;return!!t._type&&!!t._data&&!!t._callbackId}function E(e){const t=e;return!!t._type&&!!t.hasOwnProperty("_response")&&!!t._callbackId}const P=c("windowRedirect"),T=c("windowReload",{});var j=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",redirect:P,reload:T});const J=c("notificationDispatch");var N=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",dispatch:J});const H=c("contextLanguage",{}),q=M("contextLanguage"),$=c("contextEnvironment",{}),A=c("contextLocale",{}),B=M("contextLocale"),U=c("contextCurrency",{});var W=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getLanguage:H,subscribeLanguage:q,getEnvironment:$,getLocale:A,subscribeLocale:B,getCurrency:U});const F=c("uiComponentRender");var G=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",render:F}),K=e=>({addComponentBefore:c("uiComponentRender",{positionId:e+"__before"}),addComponentAfter:c("uiComponentRender",{positionId:e+"__after"})});const Q={component:G,card:K};o.context=W,o.notification=N,o.ui=Q,o.window=j,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); |
@@ -5,6 +5,8 @@ import * as window from './window'; | ||
import * as component from './ui/component'; | ||
import * as card from './ui/card'; | ||
declare const ui: { | ||
component: typeof component; | ||
card: typeof card; | ||
card: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
}; | ||
@@ -11,0 +13,0 @@ /** |
@@ -5,3 +5,3 @@ import * as window from './window'; | ||
import * as component from './ui/component'; | ||
import * as card from './ui/card'; | ||
import card from './ui/card'; | ||
const ui = { | ||
@@ -8,0 +8,0 @@ component, |
@@ -1,4 +0,5 @@ | ||
export declare const uiCard: (positionId: string) => { | ||
declare const _default: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("../../channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("../../channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
export default _default; |
import { createSender } from '../../channel'; | ||
export const uiCard = (positionId) => ({ | ||
export default (positionId) => ({ | ||
addComponentBefore: createSender('uiComponentRender', { positionId: positionId + '__before' }), | ||
@@ -4,0 +4,0 @@ addComponentAfter: createSender('uiComponentRender', { positionId: positionId + '__after' }), |
{ | ||
"name": "@shopware-ag/admin-extension-sdk", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"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", |
@@ -5,6 +5,8 @@ import * as window from './window'; | ||
import * as component from './ui/component'; | ||
import * as card from './ui/card'; | ||
declare const ui: { | ||
component: typeof component; | ||
card: typeof card; | ||
card: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
}; | ||
@@ -11,0 +13,0 @@ /** |
@@ -20,2 +20,5 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
(function (factory) { | ||
@@ -40,6 +43,6 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
const component = __importStar(require("./ui/component")); | ||
const card = __importStar(require("./ui/card")); | ||
const card_1 = __importDefault(require("./ui/card")); | ||
const ui = { | ||
component, | ||
card, | ||
card: card_1.default, | ||
}; | ||
@@ -46,0 +49,0 @@ exports.ui = ui; |
@@ -1,4 +0,5 @@ | ||
export declare const uiCard: (positionId: string) => { | ||
declare const _default: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("../../channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("../../channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
export default _default; |
@@ -12,10 +12,8 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uiCard = void 0; | ||
const channel_1 = require("../../channel"); | ||
const uiCard = (positionId) => ({ | ||
exports.default = (positionId) => ({ | ||
addComponentBefore: (0, channel_1.createSender)('uiComponentRender', { positionId: positionId + '__before' }), | ||
addComponentAfter: (0, channel_1.createSender)('uiComponentRender', { positionId: positionId + '__after' }), | ||
}); | ||
exports.uiCard = uiCard; | ||
}); | ||
//# sourceMappingURL=index.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113283
1726