Hi there, I am trying to add the 'Add Data' Widget from the dev edition of Experience Builder to my Enterprise 11.1 Experience Builder as a Custom Widget.
However, when adding the widget into Experience Builder GUI it throws a TypeError: e.hooks is undefined with the following line 258 in the dist/runtime/widget.js the culprit.
Note that other widgets from the experience builder dev edition do work such as the Image widget, ruling out any deployment issues.
Has anyone sucessfully deployed the DEV Edition Add Data widget to Enterprise 11.1 and can share their process? Or can a Esri member potentially attempt this workflow and please post the methodology?
"`}),[null===(a=t.focusedStyles)||void 0===a?void 0:a.offset])};class Fe{constructor(t){this.db=null,this.closed=!1,this.dbName=function(t){var a,o;return`exb-${(null===(a=window.jimuConfig)||void 0===a?void 0:a.isBuilder)?null===(o=(0,e.getAppStore)().getState().appStateInBuilder)||void 0===o?void 0:o.appId:(0,e.getAppStore)().getState().appId}-add-data-${t}-cache`}(t),this.storeName="added-data"}init(){return indexedDB?Promise.resolve().then((()=>{const e=indexedDB.open(this.dbName);return e.onupgradeneeded=()=>{const t=e.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName)},Pe(e)})).then((e=>{this.closed?e.close():this.db=e})):Promise.reject()}initialized(){return null!=this.db}close(){this.db&&(this.db.close(),this.db=null),this.closed=!0}put(e,t){return null==this.db?Promise.reject("indexedb:not-initialized"):Pe(this.db.transaction([this.storeName],"readwrite").objectStore(this.storeName).put(t,e)).then()}putAll(e){if(null==this.db)return Promise.reject("indexedb:not-initialized");const t=this.db.transaction([this.storeName],"readwrite");return e.forEach((e=>{t.objectStore(this.storeName).put(e.value,e.key)})),Je(t)}get(e){return null==this.db?Promise.reject("indexedb:not-initialized"):Pe(this.db.transaction([this.storeName],"readonly").objectStore(this.storeName).get(e))}getAll(){return null==this.db?Promise.reject("indexedb:not-initialized"):Pe(this.db.transaction([this.storeName],"readonly").objectStore(this.storeName).getAll())}delete(e){return null==this.db?Promise.reject("indexedb:not-initialized"):Pe(this.db.transaction([this.storeName],"readwrite").objectStore(this.storeName).delete(e))}deleteAll(e){if(null==this.db)return Promise.reject("indexedb:not-initialized");const t=this.db.transaction([this.storeName],"readwrite");return e.forEach((e=>{t.objectStore(this.storeName).delete(e)})),Je(t)}clear(){return null==this.db?Promise.reject("indexedb:not-initialized"):Pe(this.db.transaction([this.storeName],"readwrite").objectStore(this.storeName).clear())}destroy(){this.db&&this.db.deleteObjectStore(this.storeName),this.close()}}function Pe(e){return new Promise(((t,a)=>{"done"===e.readyState?null!=e.error?a(e.error):t(e.result):(e.onsuccess=()=>{t(e.result)},e.onerror=()=>{a(e.error)})}))}function Je(e){return new Promise(((t,a)=>{e.oncomplete=()=>{t()},e.onerror=()=>{a(e.error)},e.onabort=()=>{a(e.error)}}))}class We extends e.BaseVersionManager{constructor(){super(...arguments),this.versions=[{version:"1.12.0",description:"Allow to configure curated filter",upgrader:e=>e.disableAddBySearch||e.itemCategoriesInfo?e:e.set("itemCategoriesInfo",[{type:S.ItemCategory.MyContent,customLabel:"",enabled:!0,id:S.ItemCategory.MyContent},{type:S.ItemCategory.MyGroup,customLabel:"",enabled:!0,id:S.ItemCategory.MyGroup},{type:S.ItemCategory.MyOrganization,customLabel:"",enabled:!0,id:S.ItemCategory.MyOrganization},{type:S.ItemCategory.Public,customLabel:"",enabled:!0,id:S.ItemCategory.Public},{type:S.ItemCategory.LivingAtlas,customLabel:"",enabled:!0,id:S.ItemCategory.LivingAtlas}])}]}}const Re=new We;const{useState:Ve,useEffect:Qe,useMemo:Be,useRef:Ge,useCallback:Ze}=e.React,Ye=!window.jimuConfig.isInBuilder,He=a=>{const{portalUrl:o,id:n,enableDataAction:l=!0,config:c,mutableStateProps:m}=a,g=Be((()=>(null==m?void 0:m.multiDataOptions)||[]),[null==m?void 0:m.multiDataOptions]),M=Ze((t=>{e.MutableStoreManager.getInstance().updateStateValue(n,"multiDataOptions",t)}),[n]),x=e.hooks.useTranslation(t.defaultMessages,i),[v,y]=Ve(!1),h=Be((()=>{const e=[];return c.disableAddBySearch&&e.push("search"),c.disableAddByUrl&&e.push("url"),c.disableAddByFile&&e.push("file"),e}),[c.disableAddBySearch,c.disableAddByUrl,c.disableAddByFile]),S=Be((()=>g.length>0?Math.max(...g.map((e=>e.order)))+1:0),[g]),f=e.React.useRef(null),j=Ge(null);Qe((()=>(j.current=new Fe(n),Ye&&j.current.init().then((()=>{return e=void 0,t=void 0,o=function*(){const e=yield j.current.getAll();e.length>0&&(y(!0),u(e,n).catch((e=>{console.error("Failed to create data source",e)})).finally((()=>{y(!1)})),M(e.sort(((e,t)=>e.order-t.order))))},new((a=void 0)||(a=Promise))((function(r,i){function n(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(n,s)}l((o=o.apply(e,t||[])).next())}));var e,t,a,o})).catch((e=>{console.error("Failed to read cache.",e)})),()=>{j.current.close()})),[n,M]);const D=e=>{j.current.initialized()&&j.current.putAll(e.map((e=>({key:e.dataSourceJson.id,value:e})))),y(!0),u(e,n).catch((e=>{console.error("Failed to create data source",e)})).finally((()=>{y(!1)})),M(g.concat(e))},I=e.ReactRedux.useSelector((e=>{var t;const a=null==e?void 0:e.widgetsRuntimeInfo;return null===(t=null==a?void 0:a[n])||void 0===t?void 0:t.state})),N=Be((()=>I===e.WidgetState.Closed),[I]);return(0,e.jsx)("div",{className:"widget-add-data jimu-widget d-flex align-items-center justify-content-center surface-1 border-0",css:_e,ref:f},0===g.length&&(0,e.jsx)("div",{className:"no-data-placeholder w-100"},(0,e.jsx)("div",{className:"no-data-placeholder-icon"},(0,e.jsx)(r,{size:32,color:"var(--dark-500)"})),(0,e.jsx)("div",{className:"no-data-placeholder-text"},(0,e.jsx)("span",null,c.placeholderText||x("defaultPlaceholderText"))),(0,e.jsx)("div",{className:"no-data-placeholder-btn"},(0,e.jsx)(he,{buttonSize:"lg",portalUrl:o,widgetId:n,onFinish:D,hiddenTabs:h,popperReference:f,nextOrder:S,itemCategoriesInfo:c.itemCategoriesInfo,hidePopper:N}))),g.length>0&&(0,e.jsx)("div",{className:"w-100 h-100 p-3"},(0,e.jsx)(Ce,{multiDataOptions:g,enableDataAction:l,isLoading:v,widgetId:n,onRemoveData:e=>{j.current.initialized()&&j.current.deleteAll([e]),p([e],n).catch((e=>{console.error("Failed to remove data source",e)})),M(g.filter((t=>t.dataSourceJson.id!==e)))},onChangeData:t=>{j.current.initialized()&&j.current.put(t.dataSourceJson.id,t),y(!0),function(t,a){return s(this,void 0,void 0,(function*(){return t&&0!==t.length?Promise.resolve().then((()=>{t.forEach((t=>{const a=d(t.dataSourceJson.id);a&&e.DataSourceManager.getInstance().updateDataSourceByDataSourceJson(a,(0,e.Immutable)(t.dataSourceJson))}))})):Promise.resolve()}))}([t]).catch((e=>{console.error("Failed to update data source",e)})).finally((()=>{y(!1)})),M(g.map((e=>e.dataSourceJson.id===t.dataSourceJson.id?t:e)))}}),(0,e.jsx)("div",{className:"w-100 d-flex justify-content-end add-by-search-samll"},(0,e.jsx)(he,{buttonSize:"sm",portalUrl:o,widgetId:n,onFinish:D,hiddenTabs:h,popperReference:f,nextOrder:S,itemCategoriesInfo:c.itemCategoriesInfo,hidePopper:N}))))};He.versionManager=Re;const $e=He,_e=e.css`"
Solved! Go to Solution.
Looks like the Add Data widget will be released officailly for Enterprise 11.2 November 2023 so will wait until then, assume at this time 11.1 is missing some key libaries in experience builder react to be able to run this widget.. https://community.esri.com/t5/arcgis-experience-builder-blog/what-s-coming-in-arcgis-enterprise-11-2...
Looks like the Add Data widget will be released officailly for Enterprise 11.2 November 2023 so will wait until then, assume at this time 11.1 is missing some key libaries in experience builder react to be able to run this widget.. https://community.esri.com/t5/arcgis-experience-builder-blog/what-s-coming-in-arcgis-enterprise-11-2...