commandbar 1.4.1 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/commandbar-js/src/index.js +1 -1
- package/build/commandbar-js/src/init.d.ts +1 -1
- package/build/internal/src/client/CommandBarClientSDK.d.ts +8 -3
- package/build/internal/src/client/CommandBarSDK.d.ts +4 -3
- package/build/internal/src/client/EventHandler.d.ts +26 -11
- package/build/internal/src/client/Reporting.d.ts +1 -1
- package/build/internal/src/client/symbols.d.ts +2 -1
- package/build/internal/src/middleware/CommandFromClientV.d.ts +50 -0
- package/build/internal/src/middleware/OrganizationV.d.ts +3 -1
- package/build/internal/src/middleware/ResourceSettingsV.d.ts +4 -2
- package/build/internal/src/middleware/helpers/rules.d.ts +78 -0
- package/package.json +5 -2
- package/src/init.ts +1 -1
- package/src/snippet.ts +23 -2
- package/webpack.config.js +1 -0
- package/yarn-error.log +0 -20216
@@ -1 +1 @@
|
|
1
|
-
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.commandbar=r():t.commandbar=r()}(self,(function(){return(()=>{var t={296:(t,r,e)=>{"use strict";var o=e(102),n=e(307),i=e(339),a=e(957),s=e(246),c=t.exports=function(t,r){var e,n,c,u,l;return arguments.length<2||"string"!=typeof t?(u=r,r=t,t=null):u=arguments[2],o(t)?(e=s.call(t,"c"),n=s.call(t,"e"),c=s.call(t,"w")):(e=c=!0,n=!1),l={value:r,configurable:e,enumerable:n,writable:c},u?i(a(u),l):l};c.gs=function(t,r,e){var c,u,l,p;return"string"!=typeof t?(l=e,e=r,r=t,t=null):l=arguments[3],o(r)?n(r)?o(e)?n(e)||(l=e,e=void 0):e=void 0:(l=r,r=e=void 0):r=void 0,o(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),p={get:r,set:e,configurable:c,enumerable:u},l?i(a(l),p):p}},817:t=>{"use strict";t.exports=function(){}},339:(t,r,e)=>{"use strict";t.exports=e(994)()?Object.assign:e(963)},994:t=>{"use strict";t.exports=function(){var t,r=Object.assign;return"function"==typeof r&&(r(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},963:(t,r,e)=>{"use strict";var o=e(450),n=e(836),i=Math.max;t.exports=function(t,r){var e,a,s,c=i(arguments.length,2);for(t=Object(n(t)),s=function(o){try{t[o]=r[o]}catch(t){e||(e=t)}},a=1;a<c;++a)o(r=arguments[a]).forEach(s);if(void 0!==e)throw e;return t}},349:(t,r,e)=>{"use strict";var o=e(817)();t.exports=function(t){return t!==o&&null!==t}},450:(t,r,e)=>{"use strict";t.exports=e(446)()?Object.keys:e(177)},446:t=>{"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},177:(t,r,e)=>{"use strict";var o=e(349),n=Object.keys;t.exports=function(t){return n(o(t)?Object(t):t)}},957:(t,r,e)=>{"use strict";var o=e(349),n=Array.prototype.forEach,i=Object.create,a=function(t,r){var e;for(e in t)r[e]=t[e]};t.exports=function(t){var r=i(null);return n.call(arguments,(function(t){o(t)&&a(Object(t),r)})),r}},836:(t,r,e)=>{"use strict";var o=e(349);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},246:(t,r,e)=>{"use strict";t.exports=e(711)()?String.prototype.contains:e(370)},711:t=>{"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&!0===r.contains("dwa")&&!1===r.contains("foo")}},370:t=>{"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1}},992:(t,r,e)=>{"use strict";e(98).polyfill()},98:t=>{"use strict";function r(t,r){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),o=1;o<arguments.length;o++){var n=arguments[o];if(null!=n)for(var i=Object.keys(Object(n)),a=0,s=i.length;a<s;a++){var c=i[a],u=Object.getOwnPropertyDescriptor(n,c);void 0!==u&&u.enumerable&&(e[c]=n[c])}}return e}t.exports={assign:r,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:r})}}},769:(t,r,e)=>{"use strict";e(614)()||Object.defineProperty(e(119),"Symbol",{value:e(798),configurable:!0,enumerable:!1,writable:!0})},614:(t,r,e)=>{"use strict";var o=e(119),n={object:!0,symbol:!0};t.exports=function(){var t,r=o.Symbol;if("function"!=typeof r)return!1;t=r("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof r.iterator]&&!!n[typeof r.toPrimitive]&&!!n[typeof r.toStringTag]}},64:t=>{"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},573:(t,r,e)=>{"use strict";var o=e(296),n=Object.create,i=Object.defineProperty,a=Object.prototype,s=n(null);t.exports=function(t){for(var r,e,n=0;s[t+(n||"")];)++n;return s[t+=n||""]=!0,i(a,r="@@"+t,o.gs(null,(function(t){e||(e=!0,i(this,r,o(t)),e=!1)}))),r}},572:(t,r,e)=>{"use strict";var o=e(296),n=e(119).Symbol;t.exports=function(t){return Object.defineProperties(t,{hasInstance:o("",n&&n.hasInstance||t("hasInstance")),isConcatSpreadable:o("",n&&n.isConcatSpreadable||t("isConcatSpreadable")),iterator:o("",n&&n.iterator||t("iterator")),match:o("",n&&n.match||t("match")),replace:o("",n&&n.replace||t("replace")),search:o("",n&&n.search||t("search")),species:o("",n&&n.species||t("species")),split:o("",n&&n.split||t("split")),toPrimitive:o("",n&&n.toPrimitive||t("toPrimitive")),toStringTag:o("",n&&n.toStringTag||t("toStringTag")),unscopables:o("",n&&n.unscopables||t("unscopables"))})}},781:(t,r,e)=>{"use strict";var o=e(296),n=e(11),i=Object.create(null);t.exports=function(t){return Object.defineProperties(t,{for:o((function(r){return i[r]?i[r]:i[r]=t(String(r))})),keyFor:o((function(t){var r;for(r in n(t),i)if(i[r]===t)return r}))})}},798:(t,r,e)=>{"use strict";var o,n,i,a=e(296),s=e(11),c=e(119).Symbol,u=e(573),l=e(572),p=e(781),f=Object.create,d=Object.defineProperties,y=Object.defineProperty;if("function"==typeof c)try{String(c()),i=!0}catch(t){}else c=null;n=function(t){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return o(t)},t.exports=o=function t(r){var e;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return i?c(r):(e=f(n.prototype),r=void 0===r?"":String(r),d(e,{__description__:a("",r),__name__:a("",u(r))}))},l(o),p(o),d(n.prototype,{constructor:a(o),toString:a("",(function(){return this.__name__}))}),d(o.prototype,{toString:a((function(){return"Symbol ("+s(this).__description__+")"})),valueOf:a((function(){return s(this)}))}),y(o.prototype,o.toPrimitive,a("",(function(){var t=s(this);return"symbol"==typeof t?t:t.toString()}))),y(o.prototype,o.toStringTag,a("c","Symbol")),y(n.prototype,o.toStringTag,a("c",o.prototype[o.toStringTag])),y(n.prototype,o.toPrimitive,a("c",o.prototype[o.toPrimitive]))},11:(t,r,e)=>{"use strict";var o=e(64);t.exports=function(t){if(!o(t))throw new TypeError(t+" is not a symbol");return t}},308:t=>{var r=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},119:(t,r,e)=>{"use strict";t.exports=e(801)()?globalThis:e(308)},801:t=>{"use strict";t.exports=function(){return"object"==typeof globalThis&&!!globalThis&&globalThis.Array===Array}},656:(t,r,e)=>{"use strict";var o;(o="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)||"undefined"!=typeof navigator&&"ReactNative"===navigator.product?e.g:self).Proxy||(o.Proxy=e(659)(),o.Proxy.revocable=o.Proxy.revocable)},659:t=>{t.exports=function(){let t,r=null;function e(t){return!!t&&("object"==typeof t||"function"==typeof t)}function o(t){if(null!==t&&!e(t))throw new TypeError("Object prototype may only be an Object or null: "+t)}const n=Object,i=Boolean(n.create)||!({__proto__:null}instanceof n),a=n.create||(i?function(t){return o(t),{__proto__:t}}:function(t){if(o(t),null===t)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var r=function(){};return r.prototype=t,new r}),s=function(){return null},c=n.getPrototypeOf||([].__proto__===Array.prototype?function(t){const r=t.__proto__;return e(r)?r:null}:s);return t=function(u,l){if(void 0===(this&&this instanceof t?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!e(u)||!e(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");let p=function(){};r=function(){u=null,p=function(t){throw new TypeError(`Cannot perform '${t}' on a proxy that has been revoked`)}},setTimeout((function(){r=null}),0);const f=l;l={get:null,set:null,apply:null,construct:null};for(let t in f){if(!(t in l))throw new TypeError(`Proxy polyfill does not support trap '${t}'`);l[t]=f[t]}"function"==typeof f&&(l.apply=f.apply.bind(f));const d=c(u);let y,m=!1,b=!1;"function"==typeof u?(y=function(){const t=this&&this.constructor===y,r=Array.prototype.slice.call(arguments);return p(t?"construct":"apply"),t&&l.construct?l.construct.call(this,u,r):!t&&l.apply?l.apply(u,this,r):t?(r.unshift(u),new(u.bind.apply(u,r))):u.apply(this,r)},m=!0):u instanceof Array?(y=[],b=!0):y=i||null!==d?a(d):{};const _=l.get?function(t){return p("get"),l.get(this,t,y)}:function(t){return p("get"),this[t]},v=l.set?function(t,r){p("set"),l.set(this,t,r,y)}:function(t,r){p("set"),this[t]=r},g=n.getOwnPropertyNames(u),h={};g.forEach((function(t){if((m||b)&&t in y)return;const r=n.getOwnPropertyDescriptor(u,t),e={enumerable:Boolean(r.enumerable),get:_.bind(u,t),set:v.bind(u,t)};n.defineProperty(y,t,e),h[t]=!0}));let w=!0;if(m||b){const t=n.setPrototypeOf||([].__proto__===Array.prototype?function(t,r){return o(r),t.__proto__=r,t}:s);d&&t(y,d)||(w=!1)}if(l.get||!w)for(let t in u)h[t]||n.defineProperty(y,t,{get:_.bind(u,t)});return n.seal(u),n.seal(y),y},t.revocable=function(e,o){return{proxy:new t(e,o),revoke:r}},t}},956:function(t,r,e){"use strict";var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t},o.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),e(656),e(992),e(769);var n=e(737),i=e(207),a=function(t){if("complete"===document.readyState){var r=function(t){var r="https://api.commandbar.com",e=[],o=localStorage.getItem("commandbar.lc");o&&o.includes("local")?r="http://localhost:8000":o||"10d7dc04"!==t||(r="https://api-cu.commandbar.com");var n=r+"/latest/"+t;return o&&e.push("lc="+o),e.push("version=2"),n+"?"+e.join("&")}(t),e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=r,document.head.appendChild(e)}else window.addEventListener("load",a.bind(null,t),{capture:!1,once:!0})},s={debug:!1};r.default=function(t,r){void 0===r&&(r=s);var e=o(o({},s),r);t?(e.debug&&console.log("CommandBar init..."),n.getProxySDK()[i._configuration]={uuid:t},a(t)):console.error("No org specified for CommandBar.init")}},890:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.snippet=void 0,r.snippet=function(t){var r=["Object.assign","Symbol","Symbol.for"].join("%2C"),e=window;function o(t,r){void 0===r&&(r=!1),"complete"!==document.readyState&&window.addEventListener("load",o.bind(null,t,r),{capture:!1,once:!0});var e=document.createElement("script");e.type="text/javascript",e.async=r,e.src=t,document.head.appendChild(e)}function n(){var r;if(void 0===e.CommandBar){delete e.__CommandBarBootstrap__;var n=Symbol.for("CommandBar::configuration"),i=Symbol.for("CommandBar::orgConfig"),a=Symbol.for("CommandBar::disposed"),s=Symbol.for("CommandBar::isProxy"),c=Symbol.for("CommandBar::queue"),u=Symbol.for("CommandBar::unwrap"),l=[],p=localStorage.getItem("commandbar.lc"),f=p&&p.includes("local")?"http://localhost:8000":"https://api.commandbar.com",d=Object.assign(((r={})[n]={uuid:t},r[i]={},r[a]=!1,r[s]=!0,r[c]=new Array,r[u]=function(){return d},r),e.CommandBar);e.CommandBar=new Proxy(d,{get:function(t,r){return r in d?d[r]:function(){var t=Array.prototype.slice.call(arguments);t.unshift(r),d[c].push(t)}}}),null!==p&&l.push("lc="+p),l.push("version=2"),o(f+"/latest/"+t+"?"+l.join("&"),!0)}}void 0===Object.assign||"undefined"==typeof Symbol||void 0===Symbol.for?(e.__CommandBarBootstrap__=n,o("https://polyfill.io/v3/polyfill.min.js?version=3.101.0&callback=__CommandBarBootstrap__&features="+r)):n()}},343:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},737:(t,r,e)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.initProxySDK=r.getProxySDK=void 0;var o=e(314),n=e(207);function i(){var t,r,e,o,i=window.CommandBar,a=window.CommandBar;Array.isArray(null==i?void 0:i.q)||"string"==typeof(null==i?void 0:i.uid)?(e=null==i?void 0:i.uid,o=null==i?void 0:i.q):(e=null===(r=null==a?void 0:a[n._configuration])||void 0===r?void 0:r.uuid,o=null==a?void 0:a[n._queue]);var s=((t={})[n._configuration]={uuid:"string"==typeof e?e:""},t[n._disposed]=!1,t[n._isProxy]=!0,t[n._queue]=Array.isArray(o)?o:[],t[n._unwrap]=function(){return s},t);window.CommandBar=new Proxy(s,{get:function(t,r){return function(t,r){return r in t}(s,r)?s[r]:function(){var t=Array.prototype.slice.call(arguments);t.unshift(r),s[n._queue].push(t)}}})}r.getProxySDK=function(){var t=window.CommandBar;return(o.isDisposed(t)||"boolean"!=typeof t[n._isProxy])&&i(),window.CommandBar[n._unwrap]()},r.initProxySDK=i},207:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r._user=r._unwrap=r._state=r._showMessage=r._showGuide=r._setTestMode=r._setPreviewMode=r._setDashboard=r._search=r._reporter=r._report=r._reloadOrganization=r._reloadCommands=r._queue=r._programmaticTheme=r._perf=r._orgConfig=r._loadEditor=r._isProxy=r._eventMeta=r._disposed=r._dispose=r._dispatch=r._configUser=r._configure=r._configuration=r._access=void 0,r._access=Symbol.for("CommandBar::access"),r._configuration=Symbol.for("CommandBar::configuration"),r._configure=Symbol.for("CommandBar::configure"),r._configUser=Symbol.for("CommandBar::configUser"),r._dispatch=Symbol.for("CommandBar::dispatch"),r._dispose=Symbol.for("CommandBar::dispose"),r._disposed=Symbol.for("CommandBar::disposed"),r._eventMeta=Symbol.for("CommandBar::eventMeta"),r._isProxy=Symbol.for("CommandBar::isProxy"),r._loadEditor=Symbol.for("CommandBar::loadEditor"),r._orgConfig=Symbol.for("CommandBar::orgConfig"),r._perf=Symbol.for("CommandBar::perf"),r._programmaticTheme=Symbol.for("CommandBar::programmaticTheme"),r._queue=Symbol.for("CommandBar::queue"),r._reloadCommands=Symbol.for("CommandBar::reloadCommands"),r._reloadOrganization=Symbol.for("CommandBar::reloadOrganization"),r._report=Symbol.for("CommandBar::report"),r._reporter=Symbol.for("CommandBar::reporter"),r._search=Symbol.for("CommandBar::search"),r._setDashboard=Symbol.for("CommandBar::setDashboard"),r._setPreviewMode=Symbol.for("CommandBar::setPreviewMode"),r._setTestMode=Symbol.for("CommandBar::setTestMode"),r._showGuide=Symbol.for("CommandBar::showGuide"),r._showMessage=Symbol.for("CommandBar::showMessage"),r._state=Symbol.for("CommandBar::state"),r._unwrap=Symbol.for("CommandBar::unwrap"),r._user=Symbol.for("CommandBar::user")},314:(t,r,e)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.dispose=r.isDisposed=r.isDisposable=void 0;var o=e(207),n=function(t){return void 0!==t&&void 0!==t.dispose},i=function(t){return void 0!==t&&void 0!==t[o._dispose]};r.isDisposable=function(t){return void 0===t||n(t)||i(t)},r.isDisposed=function(t){return void 0===t||n(t)&&!0===t._disposed||i(t)&&!0===t[o._disposed]},r.dispose=function(t){void 0!==t&&(i(t)?t[o._dispose]():t.dispose())}},111:(t,r,e)=>{"use strict";var o=e(666);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!o(t)}},617:(t,r,e)=>{"use strict";var o=e(102),n={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!o(t)&&hasOwnProperty.call(n,typeof t)}},307:(t,r,e)=>{"use strict";var o=e(111),n=/^\s*class[\s{/}]/,i=Function.prototype.toString;t.exports=function(t){return!!o(t)&&!n.test(i.call(t))}},666:(t,r,e)=>{"use strict";var o=e(617);t.exports=function(t){if(!o(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},102:t=>{"use strict";t.exports=function(t){return null!=t}}},r={};function e(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return t[o].call(i.exports,i,i.exports,e),i.exports}e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var o={};return(()=>{"use strict";var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.CommandBarClientSDK=void 0;var r=e(343);Object.defineProperty(t,"CommandBarClientSDK",{enumerable:!0,get:function(){return r.CommandBarClientSDK}});var n=e(956);Object.defineProperty(t,"init",{enumerable:!0,get:function(){return n.default}});var i=e(737);Object.defineProperty(t,"initProxy",{enumerable:!0,get:function(){return i.initProxySDK}});var a=e(890);Object.defineProperty(t,"snippet",{enumerable:!0,get:function(){return a.snippet}})})(),o})()}));
|
1
|
+
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.commandbar=r():t.commandbar=r()}(this,(function(){return(()=>{var t={296:(t,r,e)=>{"use strict";var o=e(102),n=e(307),i=e(339),a=e(957),s=e(246),c=t.exports=function(t,r){var e,n,c,u,l;return arguments.length<2||"string"!=typeof t?(u=r,r=t,t=null):u=arguments[2],o(t)?(e=s.call(t,"c"),n=s.call(t,"e"),c=s.call(t,"w")):(e=c=!0,n=!1),l={value:r,configurable:e,enumerable:n,writable:c},u?i(a(u),l):l};c.gs=function(t,r,e){var c,u,l,f;return"string"!=typeof t?(l=e,e=r,r=t,t=null):l=arguments[3],o(r)?n(r)?o(e)?n(e)||(l=e,e=void 0):e=void 0:(l=r,r=e=void 0):r=void 0,o(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),f={get:r,set:e,configurable:c,enumerable:u},l?i(a(l),f):f}},817:t=>{"use strict";t.exports=function(){}},339:(t,r,e)=>{"use strict";t.exports=e(994)()?Object.assign:e(963)},994:t=>{"use strict";t.exports=function(){var t,r=Object.assign;return"function"==typeof r&&(r(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},963:(t,r,e)=>{"use strict";var o=e(450),n=e(836),i=Math.max;t.exports=function(t,r){var e,a,s,c=i(arguments.length,2);for(t=Object(n(t)),s=function(o){try{t[o]=r[o]}catch(t){e||(e=t)}},a=1;a<c;++a)o(r=arguments[a]).forEach(s);if(void 0!==e)throw e;return t}},349:(t,r,e)=>{"use strict";var o=e(817)();t.exports=function(t){return t!==o&&null!==t}},450:(t,r,e)=>{"use strict";t.exports=e(446)()?Object.keys:e(177)},446:t=>{"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},177:(t,r,e)=>{"use strict";var o=e(349),n=Object.keys;t.exports=function(t){return n(o(t)?Object(t):t)}},957:(t,r,e)=>{"use strict";var o=e(349),n=Array.prototype.forEach,i=Object.create,a=function(t,r){var e;for(e in t)r[e]=t[e]};t.exports=function(t){var r=i(null);return n.call(arguments,(function(t){o(t)&&a(Object(t),r)})),r}},836:(t,r,e)=>{"use strict";var o=e(349);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},246:(t,r,e)=>{"use strict";t.exports=e(711)()?String.prototype.contains:e(370)},711:t=>{"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&!0===r.contains("dwa")&&!1===r.contains("foo")}},370:t=>{"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1}},992:(t,r,e)=>{"use strict";e(98).polyfill()},98:t=>{"use strict";function r(t,r){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),o=1;o<arguments.length;o++){var n=arguments[o];if(null!=n)for(var i=Object.keys(Object(n)),a=0,s=i.length;a<s;a++){var c=i[a],u=Object.getOwnPropertyDescriptor(n,c);void 0!==u&&u.enumerable&&(e[c]=n[c])}}return e}t.exports={assign:r,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:r})}}},769:(t,r,e)=>{"use strict";e(614)()||Object.defineProperty(e(119),"Symbol",{value:e(798),configurable:!0,enumerable:!1,writable:!0})},614:(t,r,e)=>{"use strict";var o=e(119),n={object:!0,symbol:!0};t.exports=function(){var t,r=o.Symbol;if("function"!=typeof r)return!1;t=r("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof r.iterator]&&!!n[typeof r.toPrimitive]&&!!n[typeof r.toStringTag]}},64:t=>{"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},573:(t,r,e)=>{"use strict";var o=e(296),n=Object.create,i=Object.defineProperty,a=Object.prototype,s=n(null);t.exports=function(t){for(var r,e,n=0;s[t+(n||"")];)++n;return s[t+=n||""]=!0,i(a,r="@@"+t,o.gs(null,(function(t){e||(e=!0,i(this,r,o(t)),e=!1)}))),r}},572:(t,r,e)=>{"use strict";var o=e(296),n=e(119).Symbol;t.exports=function(t){return Object.defineProperties(t,{hasInstance:o("",n&&n.hasInstance||t("hasInstance")),isConcatSpreadable:o("",n&&n.isConcatSpreadable||t("isConcatSpreadable")),iterator:o("",n&&n.iterator||t("iterator")),match:o("",n&&n.match||t("match")),replace:o("",n&&n.replace||t("replace")),search:o("",n&&n.search||t("search")),species:o("",n&&n.species||t("species")),split:o("",n&&n.split||t("split")),toPrimitive:o("",n&&n.toPrimitive||t("toPrimitive")),toStringTag:o("",n&&n.toStringTag||t("toStringTag")),unscopables:o("",n&&n.unscopables||t("unscopables"))})}},781:(t,r,e)=>{"use strict";var o=e(296),n=e(11),i=Object.create(null);t.exports=function(t){return Object.defineProperties(t,{for:o((function(r){return i[r]?i[r]:i[r]=t(String(r))})),keyFor:o((function(t){var r;for(r in n(t),i)if(i[r]===t)return r}))})}},798:(t,r,e)=>{"use strict";var o,n,i,a=e(296),s=e(11),c=e(119).Symbol,u=e(573),l=e(572),f=e(781),p=Object.create,d=Object.defineProperties,m=Object.defineProperty;if("function"==typeof c)try{String(c()),i=!0}catch(t){}else c=null;n=function(t){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return o(t)},t.exports=o=function t(r){var e;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return i?c(r):(e=p(n.prototype),r=void 0===r?"":String(r),d(e,{__description__:a("",r),__name__:a("",u(r))}))},l(o),f(o),d(n.prototype,{constructor:a(o),toString:a("",(function(){return this.__name__}))}),d(o.prototype,{toString:a((function(){return"Symbol ("+s(this).__description__+")"})),valueOf:a((function(){return s(this)}))}),m(o.prototype,o.toPrimitive,a("",(function(){var t=s(this);return"symbol"==typeof t?t:t.toString()}))),m(o.prototype,o.toStringTag,a("c","Symbol")),m(n.prototype,o.toStringTag,a("c",o.prototype[o.toStringTag])),m(n.prototype,o.toPrimitive,a("c",o.prototype[o.toPrimitive]))},11:(t,r,e)=>{"use strict";var o=e(64);t.exports=function(t){if(!o(t))throw new TypeError(t+" is not a symbol");return t}},308:t=>{var r=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},119:(t,r,e)=>{"use strict";t.exports=e(801)()?globalThis:e(308)},801:t=>{"use strict";t.exports=function(){return"object"==typeof globalThis&&!!globalThis&&globalThis.Array===Array}},656:(t,r,e)=>{"use strict";var o;(o="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)||"undefined"!=typeof navigator&&"ReactNative"===navigator.product?e.g:self).Proxy||(o.Proxy=e(659)(),o.Proxy.revocable=o.Proxy.revocable)},659:t=>{t.exports=function(){let t,r=null;function e(t){return!!t&&("object"==typeof t||"function"==typeof t)}function o(t){if(null!==t&&!e(t))throw new TypeError("Object prototype may only be an Object or null: "+t)}const n=Object,i=Boolean(n.create)||!({__proto__:null}instanceof n),a=n.create||(i?function(t){return o(t),{__proto__:t}}:function(t){if(o(t),null===t)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var r=function(){};return r.prototype=t,new r}),s=function(){return null},c=n.getPrototypeOf||([].__proto__===Array.prototype?function(t){const r=t.__proto__;return e(r)?r:null}:s);return t=function(u,l){if(void 0===(this&&this instanceof t?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!e(u)||!e(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");let f=function(){};r=function(){u=null,f=function(t){throw new TypeError(`Cannot perform '${t}' on a proxy that has been revoked`)}},setTimeout((function(){r=null}),0);const p=l;l={get:null,set:null,apply:null,construct:null};for(let t in p){if(!(t in l))throw new TypeError(`Proxy polyfill does not support trap '${t}'`);l[t]=p[t]}"function"==typeof p&&(l.apply=p.apply.bind(p));const d=c(u);let m,y=!1,b=!1;"function"==typeof u?(m=function(){const t=this&&this.constructor===m,r=Array.prototype.slice.call(arguments);return f(t?"construct":"apply"),t&&l.construct?l.construct.call(this,u,r):!t&&l.apply?l.apply(u,this,r):t?(r.unshift(u),new(u.bind.apply(u,r))):u.apply(this,r)},y=!0):u instanceof Array?(m=[],b=!0):m=i||null!==d?a(d):{};const _=l.get?function(t){return f("get"),l.get(this,t,m)}:function(t){return f("get"),this[t]},v=l.set?function(t,r){f("set"),l.set(this,t,r,m)}:function(t,r){f("set"),this[t]=r},g=n.getOwnPropertyNames(u),h={};g.forEach((function(t){if((y||b)&&t in m)return;const r=n.getOwnPropertyDescriptor(u,t),e={enumerable:Boolean(r.enumerable),get:_.bind(u,t),set:v.bind(u,t)};n.defineProperty(m,t,e),h[t]=!0}));let w=!0;if(y||b){const t=n.setPrototypeOf||([].__proto__===Array.prototype?function(t,r){return o(r),t.__proto__=r,t}:s);d&&t(m,d)||(w=!1)}if(l.get||!w)for(let t in u)h[t]||n.defineProperty(m,t,{get:_.bind(u,t)});return n.seal(u),n.seal(m),m},t.revocable=function(e,o){return{proxy:new t(e,o),revoke:r}},t}},956:function(t,r,e){"use strict";var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t},o.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),e(656),e(992),e(769);var n=e(737),i=e(207),a=function(t){if("complete"===document.readyState){var r=function(t){var r="https://api.commandbar.com",e=[],o=localStorage.getItem("commandbar.lc");o&&o.includes("local")?r="http://localhost:8000":o||"10d7dc04"!==t||(r="https://api-cu.commandbar.com");var n=r+"/latest/"+t;return o&&e.push("lc="+o),e.push("version=2"),n+"?"+e.join("&")}(t),e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=r,document.head.appendChild(e)}else window.addEventListener("load",a.bind(null,t),{capture:!1,once:!0})},s={debug:!1};r.default=function(t,r){void 0===r&&(r=s);var e=o(o({},s),r);t?(e.debug&&console.log("CommandBar init..."),n.getProxySDK()[i._configuration]={uuid:t},a(t)):console.error("No org specified for CommandBar.init")}},890:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.snippet=void 0,r.snippet=function(t){var r=["Object.assign","Symbol","Symbol.for"].join("%2C"),e=window;function o(t,r){void 0===r&&(r=!1),"complete"!==document.readyState&&window.addEventListener("load",o.bind(null,t,r),{capture:!1,once:!0});var e=document.createElement("script");e.type="text/javascript",e.async=r,e.src=t,document.head.appendChild(e)}function n(){var r;if(void 0===e.CommandBar){delete e.__CommandBarBootstrap__;var n=Symbol.for("CommandBar::configuration"),i=Symbol.for("CommandBar::orgConfig"),a=Symbol.for("CommandBar::disposed"),s=Symbol.for("CommandBar::isProxy"),c=Symbol.for("CommandBar::queue"),u=Symbol.for("CommandBar::unwrap"),l=[],f=localStorage.getItem("commandbar.lc"),p=f&&f.includes("local")?"http://localhost:8000":"https://api.commandbar.com",d=Object.assign(((r={})[n]={uuid:t},r[i]={},r[a]=!1,r[s]=!0,r[c]=new Array,r[u]=function(){return d},r),e.CommandBar),m=["addCommand","boot","getShortcuts"],y=d;Object.assign(d,{shareCallbacks:function(){return{}},shareContext:function(){return{}}}),e.CommandBar=new Proxy(d,{get:function(t,r){return r in y?d[r]:m.includes(r)?function(){var t=Array.prototype.slice.call(arguments);return new Promise((function(e,o){t.unshift(r,e,o),d[c].push(t)}))}:function(){var t=Array.prototype.slice.call(arguments);t.unshift(r),d[c].push(t)}}}),null!==f&&l.push("lc="+f),l.push("version=2"),o(p+"/latest/"+t+"?"+l.join("&"),!0)}}void 0===Object.assign||"undefined"==typeof Symbol||void 0===Symbol.for?(e.__CommandBarBootstrap__=n,o("https://polyfill.io/v3/polyfill.min.js?version=3.101.0&callback=__CommandBarBootstrap__&features="+r)):n()}},343:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ASYNC_METHODS=void 0,r.ASYNC_METHODS=["addCommand","boot","getShortcuts"]},737:(t,r,e)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.initProxySDK=r.getProxySDK=void 0;var o=e(314),n=e(343),i=e(207);function a(){var t,r,e,o,a=window.CommandBar,s=window.CommandBar;Array.isArray(null==a?void 0:a.q)||"string"==typeof(null==a?void 0:a.uid)?(e=null==a?void 0:a.uid,o=null==a?void 0:a.q):(e=null===(r=null==s?void 0:s[i._configuration])||void 0===r?void 0:r.uuid,o=null==s?void 0:s[i._queue]);var c=((t={})[i._configuration]={uuid:"string"==typeof e?e:""},t[i._disposed]=!1,t[i._isProxy]=!0,t[i._queue]=Array.isArray(o)?o:[],t[i._unwrap]=function(){return c},t),u=c;Object.assign(c,{shareCallbacks:function(){return{}},shareContext:function(){return{}}}),window.CommandBar=new Proxy(c,{get:function(t,r){return r in u?u[r]:n.ASYNC_METHODS.includes(r)?function(){var t=Array.prototype.slice.call(arguments);return new Promise((function(e,o){t.unshift(r,e,o),c[i._queue].push(t)}))}:function(){var t=Array.prototype.slice.call(arguments);t.unshift(r),c[i._queue].push(t)}}})}r.getProxySDK=function(){var t=window.CommandBar;return(o.isDisposed(t)||"boolean"!=typeof t[i._isProxy])&&a(),window.CommandBar[i._unwrap]()},r.initProxySDK=a},207:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r._userAttributes=r._user=r._unwrap=r._state=r._showMessage=r._showGuide=r._setTestMode=r._setPreviewMode=r._setDashboard=r._search=r._reporter=r._report=r._reloadOrganization=r._reloadCommands=r._queue=r._programmaticTheme=r._perf=r._orgConfig=r._loadEditor=r._isProxy=r._instanceAttributes=r._disposed=r._dispose=r._dispatch=r._configUser=r._configure=r._configuration=r._access=void 0,r._access=Symbol.for("CommandBar::access"),r._configuration=Symbol.for("CommandBar::configuration"),r._configure=Symbol.for("CommandBar::configure"),r._configUser=Symbol.for("CommandBar::configUser"),r._dispatch=Symbol.for("CommandBar::dispatch"),r._dispose=Symbol.for("CommandBar::dispose"),r._disposed=Symbol.for("CommandBar::disposed"),r._instanceAttributes=Symbol.for("CommandBar::instanceAttributes"),r._isProxy=Symbol.for("CommandBar::isProxy"),r._loadEditor=Symbol.for("CommandBar::loadEditor"),r._orgConfig=Symbol.for("CommandBar::orgConfig"),r._perf=Symbol.for("CommandBar::perf"),r._programmaticTheme=Symbol.for("CommandBar::programmaticTheme"),r._queue=Symbol.for("CommandBar::queue"),r._reloadCommands=Symbol.for("CommandBar::reloadCommands"),r._reloadOrganization=Symbol.for("CommandBar::reloadOrganization"),r._report=Symbol.for("CommandBar::report"),r._reporter=Symbol.for("CommandBar::reporter"),r._search=Symbol.for("CommandBar::search"),r._setDashboard=Symbol.for("CommandBar::setDashboard"),r._setPreviewMode=Symbol.for("CommandBar::setPreviewMode"),r._setTestMode=Symbol.for("CommandBar::setTestMode"),r._showGuide=Symbol.for("CommandBar::showGuide"),r._showMessage=Symbol.for("CommandBar::showMessage"),r._state=Symbol.for("CommandBar::state"),r._unwrap=Symbol.for("CommandBar::unwrap"),r._user=Symbol.for("CommandBar::user"),r._userAttributes=Symbol.for("CommandBar::userAttributes")},314:(t,r,e)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.dispose=r.isDisposed=r.isDisposable=void 0;var o=e(207),n=function(t){return void 0!==t&&void 0!==t.dispose},i=function(t){return void 0!==t&&void 0!==t[o._dispose]};r.isDisposable=function(t){return void 0===t||n(t)||i(t)},r.isDisposed=function(t){return void 0===t||n(t)&&!0===t._disposed||i(t)&&!0===t[o._disposed]},r.dispose=function(t){void 0!==t&&(i(t)?t[o._dispose]():t.dispose())}},111:(t,r,e)=>{"use strict";var o=e(666);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!o(t)}},617:(t,r,e)=>{"use strict";var o=e(102),n={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!o(t)&&hasOwnProperty.call(n,typeof t)}},307:(t,r,e)=>{"use strict";var o=e(111),n=/^\s*class[\s{/}]/,i=Function.prototype.toString;t.exports=function(t){return!!o(t)&&!n.test(i.call(t))}},666:(t,r,e)=>{"use strict";var o=e(617);t.exports=function(t){if(!o(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},102:t=>{"use strict";t.exports=function(t){return null!=t}}},r={};function e(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return t[o].call(i.exports,i,i.exports,e),i.exports}e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var o={};return(()=>{"use strict";var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.CommandBarClientSDK=void 0;var r=e(343);Object.defineProperty(t,"CommandBarClientSDK",{enumerable:!0,get:function(){return r.CommandBarClientSDK}});var n=e(956);Object.defineProperty(t,"init",{enumerable:!0,get:function(){return n.default}});var i=e(737);Object.defineProperty(t,"initProxy",{enumerable:!0,get:function(){return i.initProxySDK}});var a=e(890);Object.defineProperty(t,"snippet",{enumerable:!0,get:function(){return a.snippet}})})(),o})()}));
|
@@ -9,7 +9,7 @@ interface IInitOptions {
|
|
9
9
|
* this function it will be possible to access window.CommandBar and call the SDK methods, even if the scripts have not
|
10
10
|
* finished loading yet.
|
11
11
|
*
|
12
|
-
* @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#
|
12
|
+
* @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#step-1:-install-commandbar).
|
13
13
|
* @param {IInitOptions} [opts] Additional options to use for initialization: `debug` will enable additional logging
|
14
14
|
* output.
|
15
15
|
*/
|
@@ -2,10 +2,15 @@ import { AddContextOptions } from './AddContextOptions';
|
|
2
2
|
import { EventHandler } from './EventHandler';
|
3
3
|
import { ICommandFromClientType } from '../middleware/ICommandFromClientType';
|
4
4
|
import { IResourceSettings } from '../middleware/IResourceSettings';
|
5
|
-
export declare
|
5
|
+
export declare const ASYNC_METHODS: Array<keyof CommandBarClientSDK>;
|
6
|
+
export declare type BootOptions = string | (UserAttributes & {
|
6
7
|
id: string;
|
7
8
|
});
|
8
9
|
export declare type Metadata = Record<string, unknown>;
|
10
|
+
export declare type UserAttributes = Record<string, unknown>;
|
11
|
+
export declare type InstanceAttributes = {
|
12
|
+
canOpenEditor?: boolean;
|
13
|
+
};
|
9
14
|
export declare type CallbackFunction<T, U = Metadata> = (args: T, context: U) => void;
|
10
15
|
export declare type ContextLoader = (chosenValues?: undefined | Record<string, unknown[]>) => unknown;
|
11
16
|
export declare type CommandBarClientSDK = Readonly<{
|
@@ -96,7 +101,7 @@ export declare type CommandBarClientSDK = Readonly<{
|
|
96
101
|
* filter on these attributes from the analytics page in your dashboard. In addition, events passed to a supplied
|
97
102
|
* event handler will include metadata you provide via `boot`.
|
98
103
|
*/
|
99
|
-
boot(id: string,
|
104
|
+
boot(id: string, userAttributes?: UserAttributes, instanceAttributes?: InstanceAttributes): Promise<void>;
|
100
105
|
/**
|
101
106
|
* @deprecated Passing an object to boot will be deprecated in a future version of CommandBar.
|
102
107
|
*/
|
@@ -109,12 +114,12 @@ export declare type CommandBarClientSDK = Readonly<{
|
|
109
114
|
* @param id The command id to execute. For commands defined via the Editor, you can find this id in the Editor by selecting "Copy code" in the command's ellipsis menu. For commands defined via the SDK, this is the `name` field.
|
110
115
|
*/
|
111
116
|
execute(id: number | string): void;
|
117
|
+
getShortcuts(): Promise<unknown>;
|
112
118
|
/**
|
113
119
|
* Returns `true` if the Bar is currently open, `false` if it is not, or `undefined` if the CommandBar is not fully
|
114
120
|
* initialized yet.
|
115
121
|
*/
|
116
122
|
isOpen(): boolean | undefined;
|
117
|
-
onboard(): void;
|
118
123
|
/**
|
119
124
|
* Open the Bar. If an input is supplied, will prefill the search input with that value.
|
120
125
|
*
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { CommandBarClientSDK, Metadata } from './CommandBarClientSDK';
|
1
|
+
import { CommandBarClientSDK, InstanceAttributes, Metadata } from './CommandBarClientSDK';
|
2
2
|
import { EVENT_NAME } from './Reporting';
|
3
3
|
import { SentryReporter } from './SentryReporter';
|
4
|
-
import { _access, _configuration, _configure, _configUser, _dispatch, _dispose, _disposed,
|
4
|
+
import { _access, _configuration, _configure, _configUser, _dispatch, _dispose, _disposed, _userAttributes, _isProxy, _loadEditor, _orgConfig, _perf, _programmaticTheme, _reloadCommands, _reloadOrganization, _report, _reporter, _search, _setDashboard, _setPreviewMode, _setTestMode, _showGuide, _showMessage, _state, _user, _instanceAttributes } from './symbols';
|
5
5
|
import { SDKConfig } from './SDKConfig';
|
6
6
|
export interface OrgConfig {
|
7
7
|
name?: string;
|
@@ -11,13 +11,14 @@ export { SDKConfig } from './SDKConfig';
|
|
11
11
|
export interface CommandBarSDK<State = unknown, Dispatch = unknown> extends CommandBarClientSDK {
|
12
12
|
[_access]: string | undefined;
|
13
13
|
[_dispatch]: Dispatch;
|
14
|
-
[
|
14
|
+
[_instanceAttributes]: InstanceAttributes | undefined;
|
15
15
|
[_perf]: boolean;
|
16
16
|
[_programmaticTheme]: string | undefined;
|
17
17
|
[_reporter]: SentryReporter | undefined;
|
18
18
|
[_search]: string;
|
19
19
|
[_state]: State;
|
20
20
|
[_user]: string | undefined;
|
21
|
+
[_userAttributes]: Metadata | undefined;
|
21
22
|
/** @deprecated */
|
22
23
|
readonly [_configure]: (uuid: string) => void;
|
23
24
|
readonly [_configuration]: SDKConfig;
|
@@ -2,36 +2,46 @@ export interface AbandonedSearchEvent {
|
|
2
2
|
/** Event data passed for `abandoned_search` events (deadends). */
|
3
3
|
/** The id of the currently active command, if there is one. */
|
4
4
|
command?: number;
|
5
|
+
/** DEPRECATED. The text of the deadend. */
|
6
|
+
['inputText[*]']: string;
|
5
7
|
/** The text of the deadend. */
|
6
8
|
inputText: string;
|
7
9
|
/** The context key of the currently active resource, if there is one. */
|
8
10
|
resource?: string;
|
9
11
|
/** The trigger for the deadend. */
|
10
12
|
type: 'Backspaced' | 'Closed with text' | 'Resetting search';
|
13
|
+
/** The number of {CommandOptions, ParameterOptions}, if there are any. */
|
14
|
+
results?: {
|
15
|
+
numCommands: number;
|
16
|
+
numRecords: number;
|
17
|
+
};
|
11
18
|
}
|
12
19
|
export interface ClosedEvent {
|
13
20
|
/** Event data passed for `command_execution` events. */
|
14
21
|
/** The user's input text when the bar was closed. */
|
15
22
|
inputText: string;
|
23
|
+
/** True if this command was triggered by a shortcut. */
|
24
|
+
shortcut?: boolean;
|
16
25
|
}
|
17
26
|
export interface CommandExecutionEvent {
|
18
27
|
/** Event data passed for `command_execution` events. */
|
19
28
|
/** The category id of the command. Only provided if the command has a category. */
|
20
|
-
category?: number;
|
29
|
+
category?: number | null;
|
21
30
|
/**
|
22
31
|
* The unique id of the command. For commands defined via the Editor, the value will be a number. For programmatic
|
23
32
|
* commands, the `name` (string) provided will be used.
|
24
33
|
*/
|
25
|
-
command: number | string;
|
34
|
+
command: number | string | undefined;
|
26
35
|
/** The text of the command */
|
27
36
|
commandText: string;
|
28
|
-
/**
|
29
|
-
|
37
|
+
/** The source of the command. */
|
38
|
+
source: string;
|
39
|
+
/** DEPRECATED. The text input.*/
|
40
|
+
['inputText[*]']: string;
|
41
|
+
/** The text input. */
|
42
|
+
inputText: string;
|
30
43
|
}
|
31
44
|
export interface CommandSuggestionEvent {
|
32
|
-
/** Event data passed for `command_suggestion` events. */
|
33
|
-
/** The title of the suggestion. */
|
34
|
-
title: string;
|
35
45
|
/** The text of the suggestion. */
|
36
46
|
text: string;
|
37
47
|
}
|
@@ -45,10 +55,15 @@ export interface OpenedEvent {
|
|
45
55
|
* * `programmatic`: Call to `window.CommandBar.open()`. Clicks on the
|
46
56
|
* [commandbar-launcher](https://www.npmjs.com/package/commandbar-launcher) component register as programmatic
|
47
57
|
* opens.
|
48
|
-
* * `onboarding`: Completion of the onboarding tutorial, which opens the bar.
|
49
58
|
*/
|
50
|
-
trigger: 'launcher' | 'keyboard' | 'programmatic'
|
59
|
+
trigger: 'launcher' | 'keyboard' | 'programmatic';
|
60
|
+
}
|
61
|
+
export declare type OpenedEventTrigger = OpenedEvent['trigger'];
|
62
|
+
export interface NoResultsForQueryEvent {
|
63
|
+
/** Event data passed for `no_results_for_query` event */
|
64
|
+
/** The user's input text when the no results state was reached. */
|
65
|
+
inputText: string;
|
51
66
|
}
|
52
|
-
export declare type EventData = AbandonedSearchEvent | ClosedEvent | CommandExecutionEvent | CommandSuggestionEvent | OpenedEvent;
|
67
|
+
export declare type EventData = AbandonedSearchEvent | ClosedEvent | CommandExecutionEvent | CommandSuggestionEvent | OpenedEvent | NoResultsForQueryEvent;
|
53
68
|
export declare type EventHandler = (eventName: EventType, eventData: EventData) => void;
|
54
|
-
export declare type EventType = 'abandoned_search' | 'closed' | 'command_suggestion' | 'command_execution' | 'opened';
|
69
|
+
export declare type EventType = 'abandoned_search' | 'closed' | 'command_suggestion' | 'command_execution' | 'opened' | 'no_results_for_query';
|
@@ -1 +1 @@
|
|
1
|
-
export declare type EVENT_NAME = 'Identify' | 'New session' | 'End session' | 'Load Performance' | 'New search' | 'Exited' | 'Search input' | 'Onboarding tooltip shown' | 'Tooltip shown' | 'Onboarding started' | 'Onboarding exited' | 'Onboarding completed' | 'Abandoned search' | '
|
1
|
+
export declare type EVENT_NAME = 'Identify' | 'New session' | 'End session' | 'Load Performance' | 'New search' | 'Exited' | 'Search input' | 'Onboarding tooltip shown' | 'Tooltip shown' | 'Onboarding started' | 'Onboarding exited' | 'Onboarding completed' | 'Abandoned search' | 'No results for query' | 'Command suggestion' | 'Command execution' | 'Unavailable shortcut' | 'Clicked branding' | 'Survey response' | 'Client-Error' | 'Internal-Error';
|
@@ -5,7 +5,7 @@ export declare const _configUser: unique symbol;
|
|
5
5
|
export declare const _dispatch: unique symbol;
|
6
6
|
export declare const _dispose: unique symbol;
|
7
7
|
export declare const _disposed: unique symbol;
|
8
|
-
export declare const
|
8
|
+
export declare const _instanceAttributes: unique symbol;
|
9
9
|
export declare const _isProxy: unique symbol;
|
10
10
|
export declare const _loadEditor: unique symbol;
|
11
11
|
export declare const _orgConfig: unique symbol;
|
@@ -25,3 +25,4 @@ export declare const _showMessage: unique symbol;
|
|
25
25
|
export declare const _state: unique symbol;
|
26
26
|
export declare const _unwrap: unique symbol;
|
27
27
|
export declare const _user: unique symbol;
|
28
|
+
export declare const _userAttributes: unique symbol;
|
@@ -125,4 +125,54 @@ export declare const CommandFromClientV: t.IntersectionC<[t.TypeC<{
|
|
125
125
|
category: t.UnionC<[t.NumberC, t.NullC]>;
|
126
126
|
icon: t.UnionC<[t.StringC, t.NullC]>;
|
127
127
|
celebrate: t.UnionC<[t.RecordC<t.StringC, t.AnyC>, t.NullC]>;
|
128
|
+
availability_rules: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
129
|
+
type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">]>;
|
130
|
+
operator: t.KeyofC<{
|
131
|
+
includes: null;
|
132
|
+
endsWith: null;
|
133
|
+
startsWith: null;
|
134
|
+
is: null;
|
135
|
+
isNot: null;
|
136
|
+
isTrue: null;
|
137
|
+
isFalse: null;
|
138
|
+
isTruthy: null;
|
139
|
+
isFalsy: null;
|
140
|
+
doesNotInclude: null;
|
141
|
+
matchesRegex: null;
|
142
|
+
isGreaterThan: null;
|
143
|
+
isLessThan: null;
|
144
|
+
isDefined: null;
|
145
|
+
isNotDefined: null;
|
146
|
+
classnameOnPage: null;
|
147
|
+
idOnPage: null;
|
148
|
+
}>;
|
149
|
+
}>, t.PartialC<{
|
150
|
+
field: t.StringC;
|
151
|
+
value: t.StringC;
|
152
|
+
}>]>>;
|
153
|
+
recommend_rules: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
154
|
+
type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">, t.LiteralC<"always">]>;
|
155
|
+
}>, t.PartialC<{
|
156
|
+
operator: t.KeyofC<{
|
157
|
+
includes: null;
|
158
|
+
endsWith: null;
|
159
|
+
startsWith: null;
|
160
|
+
is: null;
|
161
|
+
isNot: null;
|
162
|
+
isTrue: null;
|
163
|
+
isFalse: null;
|
164
|
+
isTruthy: null;
|
165
|
+
isFalsy: null;
|
166
|
+
doesNotInclude: null;
|
167
|
+
matchesRegex: null;
|
168
|
+
isGreaterThan: null;
|
169
|
+
isLessThan: null;
|
170
|
+
isDefined: null;
|
171
|
+
isNotDefined: null;
|
172
|
+
classnameOnPage: null;
|
173
|
+
idOnPage: null;
|
174
|
+
}>;
|
175
|
+
field: t.StringC;
|
176
|
+
value: t.StringC;
|
177
|
+
}>]>>;
|
128
178
|
}>]>;
|
@@ -13,12 +13,12 @@ export declare const OrganizationV: t.IntersectionC<[t.TypeC<{
|
|
13
13
|
icon: t.StringC;
|
14
14
|
icon_suggest: t.StringC;
|
15
15
|
icon_tutorial: t.StringC;
|
16
|
+
icon_go_forward: t.StringC;
|
16
17
|
resource_options: t.RecordC<t.StringC, t.PartialC<{
|
17
18
|
name: t.StringC;
|
18
19
|
search: t.BooleanC;
|
19
20
|
label_field: t.StringC;
|
20
21
|
useCategory: t.BooleanC;
|
21
|
-
showResources: t.BooleanC;
|
22
22
|
search_fields: t.ArrayC<t.StringC>;
|
23
23
|
auto_execute: t.BooleanC;
|
24
24
|
unfurl: t.BooleanC;
|
@@ -28,6 +28,8 @@ export declare const OrganizationV: t.IntersectionC<[t.TypeC<{
|
|
28
28
|
max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
|
29
29
|
sortFunction: t.AnyC;
|
30
30
|
default_command_id: t.UnionC<[t.NumberC, t.UndefinedC]>;
|
31
|
+
showResources: t.BooleanC;
|
32
|
+
show_with_no_results: t.BooleanC;
|
31
33
|
}>>;
|
32
34
|
should_show_onboarding: t.BooleanC;
|
33
35
|
last_snippet_request: t.UnionC<[t.StringC, t.NullC]>;
|
@@ -4,7 +4,6 @@ export declare const ResourceSettingsV: t.PartialC<{
|
|
4
4
|
search: t.BooleanC;
|
5
5
|
label_field: t.StringC;
|
6
6
|
useCategory: t.BooleanC;
|
7
|
-
showResources: t.BooleanC;
|
8
7
|
search_fields: t.ArrayC<t.StringC>;
|
9
8
|
auto_execute: t.BooleanC;
|
10
9
|
unfurl: t.BooleanC;
|
@@ -14,13 +13,14 @@ export declare const ResourceSettingsV: t.PartialC<{
|
|
14
13
|
max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
|
15
14
|
sortFunction: t.AnyC;
|
16
15
|
default_command_id: t.UnionC<[t.NumberC, t.UndefinedC]>;
|
16
|
+
showResources: t.BooleanC;
|
17
|
+
show_with_no_results: t.BooleanC;
|
17
18
|
}>;
|
18
19
|
export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.PartialC<{
|
19
20
|
name: t.StringC;
|
20
21
|
search: t.BooleanC;
|
21
22
|
label_field: t.StringC;
|
22
23
|
useCategory: t.BooleanC;
|
23
|
-
showResources: t.BooleanC;
|
24
24
|
search_fields: t.ArrayC<t.StringC>;
|
25
25
|
auto_execute: t.BooleanC;
|
26
26
|
unfurl: t.BooleanC;
|
@@ -30,4 +30,6 @@ export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.Parti
|
|
30
30
|
max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
|
31
31
|
sortFunction: t.AnyC;
|
32
32
|
default_command_id: t.UnionC<[t.NumberC, t.UndefinedC]>;
|
33
|
+
showResources: t.BooleanC;
|
34
|
+
show_with_no_results: t.BooleanC;
|
33
35
|
}>>;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import * as t from 'io-ts';
|
2
|
+
export declare const operators: readonly ["is", "isNot", "isTrue", "isFalse", "isTruthy", "isFalsy", "startsWith", "endsWith", "includes", "doesNotInclude", "matchesRegex", "isGreaterThan", "isLessThan", "isDefined", "isNotDefined", "classnameOnPage", "idOnPage"];
|
3
|
+
declare const OperatorV: t.KeyofC<{
|
4
|
+
includes: null;
|
5
|
+
endsWith: null;
|
6
|
+
startsWith: null;
|
7
|
+
is: null;
|
8
|
+
isNot: null;
|
9
|
+
isTrue: null;
|
10
|
+
isFalse: null;
|
11
|
+
isTruthy: null;
|
12
|
+
isFalsy: null;
|
13
|
+
doesNotInclude: null;
|
14
|
+
matchesRegex: null;
|
15
|
+
isGreaterThan: null;
|
16
|
+
isLessThan: null;
|
17
|
+
isDefined: null;
|
18
|
+
isNotDefined: null;
|
19
|
+
classnameOnPage: null;
|
20
|
+
idOnPage: null;
|
21
|
+
}>;
|
22
|
+
export declare const AvailabilityRuleV: t.IntersectionC<[t.TypeC<{
|
23
|
+
type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">]>;
|
24
|
+
operator: t.KeyofC<{
|
25
|
+
includes: null;
|
26
|
+
endsWith: null;
|
27
|
+
startsWith: null;
|
28
|
+
is: null;
|
29
|
+
isNot: null;
|
30
|
+
isTrue: null;
|
31
|
+
isFalse: null;
|
32
|
+
isTruthy: null;
|
33
|
+
isFalsy: null;
|
34
|
+
doesNotInclude: null;
|
35
|
+
matchesRegex: null;
|
36
|
+
isGreaterThan: null;
|
37
|
+
isLessThan: null;
|
38
|
+
isDefined: null;
|
39
|
+
isNotDefined: null;
|
40
|
+
classnameOnPage: null;
|
41
|
+
idOnPage: null;
|
42
|
+
}>;
|
43
|
+
}>, t.PartialC<{
|
44
|
+
field: t.StringC;
|
45
|
+
value: t.StringC;
|
46
|
+
}>]>;
|
47
|
+
export declare const RecommendationRuleV: t.IntersectionC<[t.TypeC<{
|
48
|
+
type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">, t.LiteralC<"always">]>;
|
49
|
+
}>, t.PartialC<{
|
50
|
+
operator: t.KeyofC<{
|
51
|
+
includes: null;
|
52
|
+
endsWith: null;
|
53
|
+
startsWith: null;
|
54
|
+
is: null;
|
55
|
+
isNot: null;
|
56
|
+
isTrue: null;
|
57
|
+
isFalse: null;
|
58
|
+
isTruthy: null;
|
59
|
+
isFalsy: null;
|
60
|
+
doesNotInclude: null;
|
61
|
+
matchesRegex: null;
|
62
|
+
isGreaterThan: null;
|
63
|
+
isLessThan: null;
|
64
|
+
isDefined: null;
|
65
|
+
isNotDefined: null;
|
66
|
+
classnameOnPage: null;
|
67
|
+
idOnPage: null;
|
68
|
+
}>;
|
69
|
+
field: t.StringC;
|
70
|
+
value: t.StringC;
|
71
|
+
}>]>;
|
72
|
+
export declare type IRuleOperator = t.TypeOf<typeof OperatorV>;
|
73
|
+
export declare type IAvailabilityRule = t.TypeOf<typeof AvailabilityRuleV>;
|
74
|
+
export declare type IRecommendationRule = t.TypeOf<typeof RecommendationRuleV>;
|
75
|
+
export declare type IAvailabilityRuleType = IAvailabilityRule['type'];
|
76
|
+
export declare type IRecommendationRuleType = IRecommendationRule['type'];
|
77
|
+
export declare type IRule = IAvailabilityRule | IRecommendationRule;
|
78
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "commandbar",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.1",
|
4
4
|
"description": "Javascript Utility for CommandBar",
|
5
5
|
"main": "build/commandbar-js/src/index.js",
|
6
6
|
"types": "build/commandbar-js/src/index.d.ts",
|
@@ -21,5 +21,8 @@
|
|
21
21
|
"fp-ts": "2.10.5",
|
22
22
|
"io-ts": "2.2.13"
|
23
23
|
},
|
24
|
-
"devDependencies": {}
|
24
|
+
"devDependencies": {},
|
25
|
+
"peerDependencies": {
|
26
|
+
"@sentry/react": "6.12.0"
|
27
|
+
}
|
25
28
|
}
|
package/src/init.ts
CHANGED
@@ -56,7 +56,7 @@ const DEFAULT_OPTS = { debug: false };
|
|
56
56
|
* this function it will be possible to access window.CommandBar and call the SDK methods, even if the scripts have not
|
57
57
|
* finished loading yet.
|
58
58
|
*
|
59
|
-
* @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#
|
59
|
+
* @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#step-1:-install-commandbar).
|
60
60
|
* @param {IInitOptions} [opts] Additional options to use for initialization: `debug` will enable additional logging
|
61
61
|
* output.
|
62
62
|
*/
|
package/src/snippet.ts
CHANGED
@@ -41,10 +41,31 @@ export const snippet = (org: string) => {
|
|
41
41
|
},
|
42
42
|
w.CommandBar,
|
43
43
|
);
|
44
|
+
|
45
|
+
const ASYNC_METHODS = ['addCommand', 'boot', 'getShortcuts'];
|
46
|
+
|
47
|
+
const sdk = proxy;
|
48
|
+
|
49
|
+
Object.assign(proxy, {
|
50
|
+
shareCallbacks: () => ({}),
|
51
|
+
shareContext: () => ({}),
|
52
|
+
});
|
53
|
+
|
44
54
|
w.CommandBar = new Proxy(proxy, {
|
45
|
-
get: function (_, prop
|
46
|
-
if (prop in
|
55
|
+
get: function (_, prop) {
|
56
|
+
if (prop in sdk) return proxy[prop];
|
57
|
+
if (ASYNC_METHODS.includes(prop as string)) {
|
58
|
+
return function () {
|
59
|
+
// eslint-disable-next-line prefer-rest-params
|
60
|
+
const a = Array.prototype.slice.call(arguments);
|
61
|
+
return new Promise((resolve, reject) => {
|
62
|
+
a.unshift(prop, resolve, reject);
|
63
|
+
(proxy[_queue] as Array<unknown>).push(a);
|
64
|
+
});
|
65
|
+
};
|
66
|
+
}
|
47
67
|
return function () {
|
68
|
+
// eslint-disable-next-line prefer-rest-params
|
48
69
|
const a = Array.prototype.slice.call(arguments);
|
49
70
|
a.unshift(prop);
|
50
71
|
(proxy[_queue] as Array<unknown>).push(a);
|