@pairbo/ui-kit 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pboBridge.js +1 -1
- package/dist/ui-kit.js +494 -188
- package/package.json +1 -1
- package/dist/assets/page-manager.component-Dzd6xKY5.js +0 -307
package/dist/pboBridge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
class w{constructor({getCards:e,getCategories:t,drawer:c,pageManager:l,giftOptions:f,selectionGroupBy:o="category",submitTypeForm:a,submitHandwrittenForm:g,getProcessedImg:h}){this._isLoading={isLoading:!1,isError:!1},this._cards=[],this._categories=[],this.setDrawer(c||null),this.setPageManager(l||null),this.setGiftOptions(f||null);const r=this.getDrawer(),s=this.getPageManager(),i=this.getGiftOptions();if(!s)throw new Error("Page manager element is required");if(r&&(console.log(r),document.addEventListener("pbo-open-drawer",n=>{console.log("pbo-open-drawer event triggered",n),r==null||r.show()})),r==null||r.addEventListener("pbo-after-drawer-closed",()=>{i==null||i.setPremiumEnabled(!1)}),s.onClose=()=>{r==null||r.hide()},o==="category"){if(!t)throw new Error("getCategories function is required when selectionGroupBy is 'category'");this.setIsLoading(!0),t().then(n=>{this.setCategories(n)}).catch(n=>{console.error("Failed to fetch categories:",n),this.setIsError(!0)}).finally(()=>{this.setIsLoading(!1)})}if(o==="none"){if(!e)throw new Error("getCards function is required when selectionGroupBy is 'none'");this.setIsLoading(!0),e().then(n=>{this.setCards(n)}).catch(n=>{console.error("Failed to fetch cards:",n),this.setIsError(!0)}).finally(()=>{this.setIsLoading(!1)})}a&&(s.submitTypeForm=a),g&&(s.submitHandwrittenForm=g),h&&(s.getProcessedImg=h)}setDrawer(e){if(this._drawer===null||this._drawer)throw new Error("Drawer can only be set during initialization");if(e===null){this._drawer=null;return}switch(typeof e){case"string":const t=document.querySelector(e);if(!t)throw new Error(`Drawer element with selector ${e} not found`);this._drawer=t;break;case"object":if(e instanceof PboDrawer){this._drawer=e;break}throw new Error("Drawer must be a string or an instance of PboDrawer");default:throw new Error("Drawer must be a string or an instance of PboDrawer")}}getDrawer(){return this._drawer}setGiftOptions(e){if(this._giftOptions===null||this._giftOptions)throw new Error("Gift options can only be set during initialization");if(e===null){this._giftOptions=null;return}switch(typeof e){case"string":const t=document.querySelector(e);if(!t)throw new Error(`Gift options element with selector "${e}" not found`);this._giftOptions=t;return;case"object":if(e instanceof PboDrawer){this._giftOptions=e;return}throw new Error("Gift options must be a string or an instance of PboDrawer");default:throw new Error("Gift options must be a string or an instance of PboDrawer")}}getGiftOptions(){return this._giftOptions}setPageManager(e){if(this._pageManager===null||this._pageManager)throw new Error("Page manager can only be set during initialization");if(e===null){this._pageManager=null;return}switch(typeof e){case"string":const t=document.querySelector(e);if(!t)throw new Error(`Page manager element with selector "${e}" not found`);this._pageManager=t;return;case"object":if(e instanceof PboPageManager){this._pageManager=e;return}throw new Error("Page manager must be a string or an instance of PboDrawer");default:throw new Error("Page manager must be a string or an instance of PboDrawer")}}getPageManager(){return this._pageManager}getCategories(){return this._categories}setCategories(e){this._categories=e,this._pageManager?this._pageManager.categories=e:console.warn("Page manager is not set, categories will not be updated")}getCards(){return this._cards}setCards(e){this._cards=e,this._pageManager||console.warn("Page manager is not set, cards will not be updated")}setIsLoading(e){this._isLoading.isLoading=e}setIsError(e){this._isLoading.isError=e}}export{w as PboBridge};
|