@shopware-ag/admin-extension-sdk
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -1,1 +0,1 @@ | ||
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"}); | ||
var Y=Object.defineProperty;var D=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var x=(o,s,i)=>s in o?Y(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,w=(o,s)=>{for(var i in s||(s={}))Z.call(s,i)&&x(o,i,s[i]);if(D)for(var i of D(s))V.call(s,i)&&x(o,i,s[i]);return o};(function(o,s){typeof exports=="object"&&typeof module!="undefined"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis!="undefined"?globalThis:o||self,s(o.sw={}))})(this,function(o){"use strict";function s(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function i(e,t){for(let r in e){const n=e[r];t.apply(this,[e,r,n]),y(n)&&i(n,t)}}function y(e){return e!==null&&typeof e=="object"}function O(e){R(e)}function z(e){k(e)}const h={};let b=!1;function I(){b||(b=!0,p("__function__",async({args:e,id:t})=>await Promise.resolve(h[t](...e))))}function R(e){i(e,(t,r,n)=>{if(typeof n=="function"){const a=s();h[a]=n,t[r]={__type__:"__function__",id:a},I()}})}function k(e){i(e,(t,r,n)=>{if(y(n)&&n.__type__&&n.__type__==="__function__"&&typeof n.id=="string"){const a=n.id;t[r]=(...d)=>f("__function__",{args:d,id:a})}})}const m=new Set;function f(e,t,r){const n=s(),a=t!=null?t:{},d={_type:e,_data:a,_callbackId:n};O(d);const u=JSON.stringify(d);let _=!1;const g=3e3;return new Promise((Q,X)=>{const S=function(L){if(typeof L.data!="string")return;let l;try{l=JSON.parse(L.data)}catch{return}!T(l)||l._callbackId===n&&(!l.hasOwnProperty("_response")||(window.removeEventListener("message",S),_||(_=!0,Q(l._response))))};window.addEventListener("message",S),window.parent.__Cypress__?r?r.postMessage(u,window.parent.origin):window.postMessage(u,window.parent.origin):r?r.postMessage(u,window.parent.origin):window.parent.postMessage(u,window.parent.origin),setTimeout(()=>{_||X("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},g)})}function p(e,t){const r=async function(n){var g;if(typeof n.data!="string")return;let a;try{a=JSON.parse(n.data)}catch{return}if(!P(a)||a._type!==e)return;z(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:(g=n.source.origin)!=null?g:"*"}):window.postMessage(_,window.origin)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)}function E(e,t){return p(e,t)}function c(e,t){return r=>f(e,w(w({},t),r))}function M(e){return t=>E(e,t)}(async()=>{p("__registerWindow__",(e,t)=>{t._event_.source?m.add(t._event_.source):m.add(window)}),await f("__registerWindow__",{})})().catch(e=>console.error(e));function P(e){const t=e;return!!t._type&&!!t._data&&!!t._callbackId}function T(e){const t=e;return!!t._type&&!!t.hasOwnProperty("_response")&&!!t._callbackId}const j=c("windowRedirect"),v=c("windowReload",{});var C=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",redirect:j,reload:v});const J=c("notificationDispatch");var N=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",dispatch:J});const H=c("contextLanguage",{}),q=M("contextLanguage"),$=c("contextEnvironment",{}),U=c("contextLocale",{}),W=M("contextLocale"),A=c("contextCurrency",{});var B=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",getLanguage:H,subscribeLanguage:q,getEnvironment:$,getLocale:U,subscribeLocale:W,getCurrency:A});const F=c("uiComponentSectionRenderer");var G=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",add:F});const K={componentSection:G};o.context=B,o.notification=N,o.ui=K,o.window=C,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"}); |
import * as window from './window'; | ||
import * as notification from './notification'; | ||
import * as context from './context'; | ||
import * as component from './ui/component'; | ||
import * as componentSection from './ui/componentSection'; | ||
declare const ui: { | ||
component: typeof component; | ||
card: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
componentSection: typeof componentSection; | ||
}; | ||
@@ -12,0 +8,0 @@ /** |
import * as window from './window'; | ||
import * as notification from './notification'; | ||
import * as context from './context'; | ||
import * as component from './ui/component'; | ||
import card from './ui/card'; | ||
import * as componentSection from './ui/componentSection'; | ||
const ui = { | ||
component, | ||
card, | ||
componentSection, | ||
}; | ||
@@ -10,0 +8,0 @@ /** |
import { notificationDispatch } from './notification/index'; | ||
import { windowRedirect, windowReload } from './window/index'; | ||
import { contextLanguage, contextEnvironment, contextLocale, contextCurrency } from './context/index'; | ||
import { uiComponentRender } from './ui/component/index'; | ||
import { uiComponentSectionRenderer } from './ui/componentSection/index'; | ||
/** | ||
@@ -18,3 +18,3 @@ * Contains all shopware send types. | ||
getPageTitle: getPageTitle; | ||
uiComponentRender: uiComponentRender; | ||
uiComponentSectionRenderer: uiComponentSectionRenderer; | ||
__function__: __function__; | ||
@@ -21,0 +21,0 @@ __registerWindow__: __registerWindow__; |
{ | ||
"name": "@shopware-ag/admin-extension-sdk", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"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", |
@@ -51,9 +51,9 @@ # Warning: | ||
## Features | ||
- 🏗 **Works for Shopware 6 Apps and Plugins:** you can use the SDK for your plugins or apps. The API usage is identical. | ||
- 🎢 **Low learning curve:** you don't need to have knowledge about the internal of the Shopware 6 admin. The SDK hides the complicated stuff behind beautiful API. | ||
- 🧰 **Many extension capabilities:** from throwing notifications, accessing context information or extending the current UI. The feature set of the SDK will grow more and more. This gives you more possibilities and flexibility for your ideas and solutions. | ||
- 🪨 **Stable API with great backward compatibility:** don't fear Shopware updates. Breaking changes in this SDK are the exception. If you use it then your Apps and Plugins will stay stable for a long time. Without code maintenance. | ||
- 🧭 **Type safety:** the whole SDK is written in TypeScript. This provides you great autocompletion support and more safety for your Apps and Plugins. | ||
- 💙 **Developer experience:** get a great development experience from the beginning. And it will be improved more and more in the future. | ||
- 🪶 **Lightweight:** the whole library is completely tree-shakable, dependency-free and every functionality can be imported granularly so that your bundle stays small and fast. | ||
- 🏗 **Works with Shopware 6 Apps and Plugins:** you can use the SDK for your plugins or apps. API usage is identical. | ||
- 🎢 **Shallow learning curve:** you don't need to have extensive knowledge about the internals of the Shopware 6 Administration. Our SDK hides the complicated stuff behind a beautiful API. | ||
- 🧰 **Many extension capabilities:** from throwing notifications, accessing context information or extending the current UI. The feature set of the SDK will gradually be extended, providing more possibilities and flexibility for your ideas and solutions. | ||
- 🪨 **A stable API with great backwards compatibility:** don't fear Shopware updates anymore. Breaking changes in this SDK are an exception. If you use the SDK, your apps and plugins will stay stable for a longer time, without any need for code maintenance. | ||
- 🧭 **Type safety:** the whole SDK is written in TypeScript which provides great autocompletion support and more safety for your apps and plugins. | ||
- 💙 **Developer experience:** have a great development experience right from the start. And it will become better and better in the future. | ||
- 🪶 **Lightweight:** the whole library is completely tree-shakable and dependency-free. Every functionality can be imported granularly to keep your bundle as small and fast as possible. | ||
@@ -60,0 +60,0 @@ ## Examples |
import * as window from './window'; | ||
import * as notification from './notification'; | ||
import * as context from './context'; | ||
import * as component from './ui/component'; | ||
import * as componentSection from './ui/componentSection'; | ||
declare const ui: { | ||
component: typeof component; | ||
card: (positionId: string) => { | ||
addComponentBefore: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
addComponentAfter: (messageOptions: Omit<import("./channel").MessageDataType<"uiComponentRender">, "positionId">) => Promise<void>; | ||
}; | ||
componentSection: typeof componentSection; | ||
}; | ||
@@ -12,0 +8,0 @@ /** |
@@ -20,5 +20,2 @@ 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) { | ||
@@ -30,3 +27,3 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./window", "./notification", "./context", "./ui/component", "./ui/card"], factory); | ||
define(["require", "exports", "./window", "./notification", "./context", "./ui/componentSection"], factory); | ||
} | ||
@@ -43,7 +40,5 @@ })(function (require, exports) { | ||
exports.context = context; | ||
const component = __importStar(require("./ui/component")); | ||
const card_1 = __importDefault(require("./ui/card")); | ||
const componentSection = __importStar(require("./ui/componentSection")); | ||
const ui = { | ||
component, | ||
card: card_1.default, | ||
componentSection, | ||
}; | ||
@@ -50,0 +45,0 @@ exports.ui = ui; |
import { notificationDispatch } from './notification/index'; | ||
import { windowRedirect, windowReload } from './window/index'; | ||
import { contextLanguage, contextEnvironment, contextLocale, contextCurrency } from './context/index'; | ||
import { uiComponentRender } from './ui/component/index'; | ||
import { uiComponentSectionRenderer } from './ui/componentSection/index'; | ||
/** | ||
@@ -18,3 +18,3 @@ * Contains all shopware send types. | ||
getPageTitle: getPageTitle; | ||
uiComponentRender: uiComponentRender; | ||
uiComponentSectionRenderer: uiComponentSectionRenderer; | ||
__function__: __function__; | ||
@@ -21,0 +21,0 @@ __registerWindow__: __registerWindow__; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109857
63
1679