@salla.sa/twilight-components 1.0.10 → 1.0.12
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/cjs/Helper-8852feaa.js +23 -0
- package/dist/cjs/index-23da2c6b.js +1601 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/multi-warehouse_4.cjs.entry.js +242 -0
- package/dist/cjs/salla-localization.cjs.entry.js +76 -0
- package/dist/cjs/salla-login-476fb312.js +14 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +78 -0
- package/dist/cjs/salla-rating.cjs.entry.js +299 -0
- package/dist/cjs/salla-search-f9e00be9.js +97 -0
- package/dist/cjs/salla-search.cjs.entry.js +10 -0
- package/dist/cjs/salla-verify.cjs.entry.js +96 -0
- package/dist/cjs/twilight-components.cjs.js +19 -0
- package/dist/collection/Helpers/Helper.js +19 -0
- package/dist/collection/collection-manifest.json +20 -0
- package/dist/collection/components/generate-summary.js +35 -0
- package/dist/collection/components/multi-warehouse/multi-warehouse.css +13 -0
- package/dist/collection/components/multi-warehouse/multi-warehouse.js +238 -0
- package/dist/collection/components/salla-button/salla-button.css +3 -0
- package/dist/collection/components/salla-button/salla-button.js +219 -0
- package/dist/collection/components/salla-localization/salla-localization.js +201 -0
- package/dist/collection/components/salla-login/salla-login.js +31 -0
- package/dist/collection/components/salla-modal/salla-modal.js +316 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +316 -0
- package/dist/collection/components/salla-rating/salla-rating.css +3 -0
- package/dist/collection/components/salla-rating/salla-rating.js +484 -0
- package/dist/collection/components/salla-search/salla-search.js +155 -0
- package/dist/collection/components/salla-verify/salla-verify.js +99 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/interfaces/colors.js +1 -0
- package/dist/collection/interfaces/index.js +2 -0
- package/dist/collection/interfaces/ratio.js +1 -0
- package/dist/collection/plugins/tailwind-theme/generator.js +53 -0
- package/dist/collection/plugins/tailwind-theme/index.js +26 -0
- package/dist/{twilight-components/Helper-23b2de40.js → esm/Helper-81ac9a8c.js} +3 -0
- package/dist/esm/index-643344dc.js +1573 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/multi-warehouse_4.entry.js +235 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/salla-localization.entry.js +72 -0
- package/dist/{twilight-components/salla-login-97e0a9ab.js → esm/salla-login-0e85b2d8.js} +1 -1
- package/dist/{twilight-components → esm}/salla-product-availability.entry.js +38 -19
- package/dist/esm/salla-rating.entry.js +295 -0
- package/dist/{twilight-components/salla-search-df1c9b54.js → esm/salla-search-615b8f94.js} +1 -1
- package/dist/esm/salla-search.entry.js +2 -0
- package/dist/{twilight-components → esm}/salla-verify.entry.js +2 -2
- package/dist/esm/twilight-components.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/twilight-components/index.esm.js +1 -3
- package/dist/twilight-components/p-2b8a5fa4.entry.js +1 -0
- package/dist/twilight-components/p-36c87e2e.js +1 -0
- package/dist/twilight-components/p-4e37a6cb.entry.js +1 -0
- package/dist/twilight-components/p-751643d8.entry.js +1 -0
- package/dist/twilight-components/p-8a2410e6.js +1 -0
- package/dist/twilight-components/p-94b18718.entry.js +1 -0
- package/dist/twilight-components/p-9bc28e0c.js +1 -0
- package/dist/twilight-components/p-bb503365.entry.js +1 -0
- package/dist/twilight-components/p-d1ef2268.js +1 -0
- package/dist/twilight-components/p-d34bbfc4.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -125
- package/dist/types/Helpers/Helper.d.ts +1 -0
- package/dist/types/components/salla-button/salla-button.d.ts +2 -1
- package/dist/types/components/salla-localization/salla-localization.d.ts +9 -2
- package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +6 -3
- package/dist/types/components/{order-rating/order-rating.d.ts → salla-rating/salla-rating.d.ts} +13 -4
- package/dist/types/components.d.ts +40 -24
- package/package.json +1 -1
- package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
- package/dist/twilight-components/css-shim-a64b8820.js +0 -4
- package/dist/twilight-components/dom-d08ba8aa.js +0 -73
- package/dist/twilight-components/index-8cf58712.js +0 -3010
- package/dist/twilight-components/multi-warehouse.entry.js +0 -86
- package/dist/twilight-components/order-rating.entry.js +0 -257
- package/dist/twilight-components/salla-button.entry.js +0 -57
- package/dist/twilight-components/salla-localization.entry.js +0 -48
- package/dist/twilight-components/salla-login.entry.js +0 -2
- package/dist/twilight-components/salla-modal.entry.js +0 -84
- package/dist/twilight-components/salla-search.entry.js +0 -2
- package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
2
|
-
import { H as Helper } from './Helper-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-643344dc.js';
|
|
2
|
+
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
3
|
|
|
4
4
|
const SallaVerify = class {
|
|
5
5
|
constructor(hostRef) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-643344dc.js';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
5
|
+
*/
|
|
6
|
+
const patchBrowser = () => {
|
|
7
|
+
const importMeta = import.meta.url;
|
|
8
|
+
const opts = {};
|
|
9
|
+
if (importMeta !== '') {
|
|
10
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
11
|
+
}
|
|
12
|
+
return promiseResolve(opts);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
patchBrowser().then(options => {
|
|
16
|
+
return bootstrapLazy([["multi-warehouse_4",[[4,"multi-warehouse",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}],[0,"salla-login"],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"isClosable":[1028,"is-closable"],"modalWidth":[513,"modal-width"],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1],"show":[64],"hide":[64],"setTitle":[64]}]]],["salla-localization",[[4,"salla-localization",{"languages":[1],"currencies":[1],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribe":[1],"cancel":[1],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribed":[1],"submit":[64]}]]],["salla-rating",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-verify",[[0,"salla-verify"]]],["salla-search",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './esm/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as l,g as i}from"./p-d1ef2268.js";import{H as a}from"./p-9bc28e0c.js";const e=class{constructor(t){s(this,t),this.isUser=a.isUser(),this.buttonText=salla.lang.get("pages.products.notify_availability"),this.countryCode=salla.config.country_code||"SA",this.subscribe=salla.lang.get("common.elements.submit"),this.cancel=salla.lang.get("common.elements.cancel"),this.subTitle=salla.lang.get("pages.products.notify_availability_subtitle"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.mobilePlaceholder=salla.lang.get("common.elements.mobile_placeholder"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.productId=salla.config.page.id,this.subscribed=salla.lang.get("pages.products.notify_availability_success"),this.isUser||(this.channelsWatcher(this.channels),this.title_=this.host.title||salla.lang.get("pages.products.notify_availability_title"),this.host.removeAttribute("title"))}channelsWatcher(s){this.channels_=s.split(",")}async submit(){if(this.isUser)return salla.api.product.availabilitySubscribe(this.productId).then((()=>{salla.success(this.subscribed)})).then((()=>this.host.remove()));let s={id:this.productId,country_code:this.countryCode};return""!==this.mobile.value&&(s.mobile=this.mobile.value),""!==this.email.value&&(s.email=this.email.value),this.btn.load().then((()=>this.btn.disable())).then((()=>salla.api.product.availabilitySubscribe(s))).then((()=>{salla.success(this.subscribed)})).then((()=>this.btn.stop())).then((()=>this.modal.hide())).then((()=>this.host.remove())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return t(l,null,t("slot",null,t("salla-button",{onClick:()=>this.isUser?this.submit():this.modal.show()},this.buttonText)),this.isUser?"":this.renderModal())}renderModal(){return t("salla-modal",{ref:s=>this.modal=s,id:"product-availability-modal",title:this.title_,subTitle:this.subTitle,icon:"sicon-bell-ring",modalWidth:"w-full"},t("div",{class:"s-product-availability-body"},this.channels_.includes("email")?[t("label",{class:"s-product-availability-label"},this.emailLabel),t("input",{class:"s-product-availability-input",placeholder:this.emailPlaceholder,ref:s=>this.email=s,type:"email"})]:"",this.channels_.includes("sms")?[t("label",{class:"s-product-availability-label"},this.mobileLabel),t("input",{class:"s-product-availability-input",placeholder:this.mobilePlaceholder,ref:s=>this.mobile=s,type:"text"}),t("input",{type:"hidden",value:this.countryCode})]:""),t("div",{slot:"footer",class:"common-anime flex justify-between space-s-4"},t("salla-button",{ref:s=>this.btn=s,class:"w-full",onClick:()=>this.submit()},this.subscribe),t("salla-button",{class:"w-full",color:"outline"},this.cancel)))}get host(){return i(this)}static get watchers(){return{channels:["channelsWatcher"]}}};export{e as salla_product_availability}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as s}from"./p-d1ef2268.js";const t=class{constructor(s){e(this,s)}render(){return s("salla-modal",{id:"salla-login",title:"سجل دخول إلى الموقع"},s("div",{id:"showLoginMethods"},s("p",{class:"text-sm text-gray-text mb-5"},"اختر الوسيلة المناسبة"),s("div",{id:"openEmailLogin",class:"mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},s("div",{class:"flex-shrink-0"},s("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},s("i",{class:"sicon-mail"}))),s("div",{class:"flex-1 min-w-0"},s("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},s("div",{class:"flex-1"},s("span",{class:"absolute inset-0","aria-hidden":"true"}),s("p",{class:"text-sm text-gray-text"},"سجل دخول"),s("h6",{class:"font-boldf"},"البريد الإلكتروني")),s("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"})))),s("div",{class:"box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},s("div",{class:"flex-shrink-0"},s("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},s("i",{class:"sicon-phone"}))),s("div",{class:"flex-1 min-w-0"},s("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},s("div",{class:"flex-1"},s("span",{class:"absolute inset-0","aria-hidden":"true"}),s("p",{class:"text-sm text-gray-text"},"سجل دخول"),s("h6",{class:"font-boldf"},"الهاتف")),s("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"}))))))}};export{t as S}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as i,g as e}from"./p-d1ef2268.js";import{H as t}from"./p-9bc28e0c.js";const l=class{constructor(i){s(this,i),t.setHost(this.host),salla.event.on("profile::verify.mobile",(s=>this.show(s)))}show({international_mobile:s,_country_iso2:i}){return this.mobile=s,this.country_code=i,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),t.onKeyUp(".s-verify-input",(s=>{var i,e,t,l;let r=s.keyCode||s.charCode;salla.helpers.digitsOnly(s.target),s.target.value?(null===(i=s.target.nextElementSibling)||void 0===i||i.focus(),null===(e=s.target.nextElementSibling)||void 0===e||e.select()):[8,46].includes(r)&&(null===(t=s.target.previousElementSibling)||void 0===t||t.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),t.on("paste",".s-verify-input",(s=>{let i=s.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,e)=>s.value=i[e]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((i=>i.value&&s.push(i.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){t.showElement(this.resendMessage).hideElement(this.resend);let s=30,i=setInterval((()=>{-1===s?(clearTimeout(i),t.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request("profile/verify-mobile",{mobile:this.mobile,country_code:this.country_code,code:this.code.value}))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend({phone:this.mobile,country_code:this.country_code}))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}render(){return i("salla-modal",{id:"s-verify",ref:s=>this.modal=s,title:salla.lang.get("pages.profile.verify_title")},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("label",{class:"s-verify-label"},salla.lang.get("pages.profile.verify_placeholder")),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>i("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))))}get host(){return e(this)}};export{l as salla_verify}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{S as salla_search}from"./p-8a2410e6.js";import"./p-d1ef2268.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as i,g as e}from"./p-d1ef2268.js";const r=class{constructor(t){s(this,t),this.fetchStatus="",this.showModal=!1,this.searchPlaceholder="Search here ...",this.noResultsText="There are no results at the moment",this.handleChange=s=>{this.searchTerm=s.target.value,this.fetchStatus="loading",this.showResult=!1,this.results=[],this.searchTerm.length>2&&window.salla.search.api.search(this.searchTerm).then((s=>s)).then((s=>{console.log("response",s),this.fetchStatus="idle",this.results=s.results,this.showResult=!0,this.results.length<1&&(this.fetchStatus="error")})).catch((s=>{this.showResult=!0,this.fetchStatus="error",console.log(s)}))},this.openSearch=()=>{this.searchTerm="",this.fetchStatus="",this.results=[],this.showModal=!0,window.scrollTo(0,0),document.getElementsByTagName("html")[0].style.position="fixed",document.getElementsByTagName("html")[0].style.overflowY="scroll"},this.closeSearch=()=>{this.searchTerm="",this.fetchStatus="",this.results=[],document.getElementsByTagName("html")[0].style.position="static",document.getElementsByTagName("html")[0].style.overflowY="auto",this.showModal=!1}}componentWillLoad(){this.hasSearchIconSlot=!!this.hostElement.querySelector('[slot="search-icon"]'),this.hasProductTemplateSlot=!!this.hostElement.querySelector('[slot="product-template"]'),this.hasProductTemplateSlot&&(this.productTemplateHtml=this.hostElement.querySelector('[slot="product-template"]').innerHTML)}getProduct(s){var i,e;if(this.hasProductTemplateSlot){let e=this.productTemplateHtml.replace("{title}",s.title).replace("{price}",null===(i=s.price)||void 0===i?void 0:i.after).replace("{url}",s.url).replace("{thumb}",s.thumb);return t("div",{class:"s-search-product",innerHTML:e})}return t("div",{class:"s-search-product"},t("a",{target:"_blank",href:s.url,class:"s-search-product-image-container"},t("img",{class:"s-search-product-image",src:s.thumb})),t("div",{class:"s-search-product-details"},t("div",{class:"s-search-product-title"},s.title),t("div",{class:"s-search-product-price"},null===(e=s.price)||void 0===e?void 0:e.after)))}render(){return t(i,{class:"s-search"},t("button",{type:"button",onClick:this.openSearch,class:"s-search-search-button-icon"},this.hasSearchIconSlot?t("slot",{name:"search-icon"}):t("i",{class:"sicon-search font-bold"})),this.showModal&&t("div",{class:"s-search-container",style:{backgroundColor:"rgba(0,0,0,0.5)"}},t("div",{class:"s-search-wrapper",onClick:this.closeSearch},t("div",{class:"s-search-inner",onClick:s=>{s.stopPropagation()}},t("div",{class:"s-search-search-box-container"},t("div",{class:this.showResult?"s-search-search-box-inner-open":"s-search-search-box-inner"},t("input",{class:"s-search-input",type:"text",placeholder:this.searchPlaceholder,value:this.searchTerm,onInput:s=>this.handleChange(s)}),"loading"!=this.fetchStatus?t("button",{class:"s-search-search-icon"},t("i",{class:"sicon-search"})):t("span",{class:"s-search-spinner"},t("span",{class:"s-search-spinner-loader"})))),t("div",{class:"s-search-search-results"},"error"===this.fetchStatus&&t("p",{class:"s-search-no-results error p-4 text-sm text-gray-text"},this.noResultsText),this.results&&this.results.map((s=>this.getProduct(s))))))))}get hostElement(){return e(this)}};export{r as S}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as e,H as a,g as s}from"./p-d1ef2268.js";import{H as i}from"./p-9bc28e0c.js";const r=class{constructor(e){t(this,e),this.stars=[1,2,3,4,5],this.order={shipping:{id:5622},products:[{title:"ميكروفون عالى الجودة",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"2314513454",getOptimusRouteKey:"7351233357"},{title:"ساعة ذكية بنظام اندرويد",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"679822376",getOptimusRouteKey:"73233357"}]},this.isProductsRating=!1,this.ratingChain=Promise.resolve(),this.stepsCount=0,i.setHost(this.host)}async show(){return this.modal.show()}async hide(){return this.modal.hide()}componentWillLoad(){this.stepsCount=[this.isStoreRating,this.isProductsRating,this.isShippingRating].filter((t=>t)).length,this.getData()}componentDidRender(){this.show(),this.initiateRating()}initiateRating(){this.highlightSelectedStars(),this.starsRating(),this.handleWizard();const t=this.host.querySelector(".step:first-child");this.setModalHeight(t),salla.event.on("submit::order-rating",(()=>this.sendRating().then((()=>{let t=10,e=setInterval((()=>{t--,this.host.querySelector(".close-time").innerHTML=`00:0${t}`,0==t&&(this.hide(),clearInterval(e))}),1e3);this.host.querySelector(".wizard-footer").classList.add("opacity-0","pointer-events-0"),this.host.querySelector(".s-order-rating-title").classList.add("opacity-0","pointer-events-0"),i.toggle(".step","hidden","block",(()=>!0)),i.toggle(".thankyou-view","is-opened","hidden",(()=>!0));const a=this.host.querySelector(".thankyou-view");this.setModalHeight(a),setTimeout((()=>{i.toggleElement(a,["opacity-1","translate-x-0"],["opacity-0","translate-x-3"],(()=>!0))}),200)}))))}handleWizard(){let t=0,e=document.querySelectorAll(".step"),a=document.querySelectorAll(".step-dot");i.toggleElement(e[0],["opacity-1","translate-x-0"],["opacity-0","translate-x-3","hidden"],(()=>!0)),console.log("🚀 ~ file: order-rating.tsx ~ line 129 ~ OrderRating ~ handleWizard ~ steps[0]",e[0]),i.onClick("#prev-btn",(()=>{t>0&&t--,this.showActiveStep(e,a,t),0==t&&i.toggle("#prev-btn",["pointer-events-none","opacity-0"],"block",(()=>!0))})),i.onClick("#next-btn",(()=>{this.ratingValidation(),t==this.stepsCount-1?salla.event.dispatch("submit::order-rating"):(t<this.stepsCount-1&&t++,this.showActiveStep(e,a,t),i.toggle("#prev-btn","block",["pointer-events-none","opacity-0"],(()=>!0)))}))}showActiveStep(t,e,a){i.toggle(".step-dot","bg-gray-200","bg-primay",(()=>!0)),i.toggleElement(e[a],"bg-primary","bg-gray-200",(()=>!0)),i.toggle(".step",["hidden","opacity-0","translate-x-3"],["active","opacity-1","translate-x-0"],(()=>!0)),i.toggleElement(t[a],"active","hidden",(()=>!0)),this.setModalHeight(t[a]),setTimeout((()=>{i.toggleElement(t[a],["opacity-1","translate-x-0"],["opacity-0","translate-x-3"],(()=>!0))}),200)}setModalHeight(t){const e=this.host.querySelector(".s-order-rating-steps-wrapper");setTimeout((()=>{null==e||e.setAttribute("style","height:"+(null==t?void 0:t.scrollHeight)+"px")}))}sendRating(){return i.all(".rating-section",(t=>{let e=t.dataset.type,a=[];t.querySelectorAll(".rating-outer-form").forEach((t=>{let s={};t.querySelectorAll("[name]").forEach((function(t){let e=salla.helpers.inputData(t.name,t.value,s);s[e.name]=e.value})),a=[],a.push(s),this.sendFeedback(e,a)}))})),this.ratingChain}sendFeedback(t,e){e&&0!=e.length&&(this.nextBtn.load(),salla.config.canLeave=!1,this.ratingChain=salla.feedback.api[t](e[0]).then((function(){salla.config.canLeave=!0})).catch((()=>salla.config.canLeave=!0)))}ratingValidation(){let t="";if(document.querySelectorAll(".rating-section.active").forEach((e=>{e.querySelectorAll(".rating-outer-form").forEach((e=>{let a=e.querySelector(".rating_hidden_input"),s=e.querySelector(".comment"),i=e.querySelector(".validation-message");if(a.value&&s.value&&s.value.length>3)return s.classList.remove("has-error"),void(i.innerHTML="");s.value&&s.value.length>3?s.classList.remove("has-error"):s.classList.add("has-error"),t=a.value?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+s.getAttribute("placeholder"):e.dataset.starsError||salla.lang.get("pages.rating.rate_store_stars"),i.innerHTML=t}))})),t){let e=document.querySelectorAll(".has-error");throw e.length&&window.scrollTo({top:e[0].offsetTop-80}),new Error(t)}}getData(){salla.api.order.endpointsMethods.details="get",console.log("🚀 ~ file",salla.order.api.details(this.orderId))}starsRating(){let t=["selected","text-theme-yellow"];salla.document.event.onSubmit(".rate-element",(function(e){e.preventDefault();var a=e.target.querySelectorAll(".btn--star.hovered"),s=a[a.length-1];if(s){var i=parseInt(s.dataset.star,10);e.target.querySelector(".rating_hidden_input").value=i,e.target.querySelectorAll(".btn--star").forEach((function(e,a){a<i?e.classList.add(...t):e.classList.remove(...t)}));var r=e.target.querySelector('.star[aria-pressed="true"]');r&&r.removeAttribute("aria-pressed"),s.setAttribute("aria-pressed",!0)}}))}highlightSelectedStars(){let t=["hovered","text-theme-yellow"];i.all(".rate-element",(e=>{let a=e.querySelectorAll(".btn--star");e.addEventListener("mouseout",(()=>e.querySelectorAll(".btn--star").forEach((e=>e.classList.remove(...t))))),a.forEach(((e,s)=>{e.addEventListener("mouseover",(()=>{if(e.classList.add(...t),s<=1)"BUTTON"===e.previousElementSibling.tagName&&e.previousElementSibling.classList.add(...t);else for(let e=0;e<s;e++)a[e].classList.add(...t)})),e.addEventListener("mouseout",(()=>{e.classList.contains(...t)&&e.classList.remove(...t)}))}))}))}render(){return e(a,null,e("salla-modal",{class:"hidden","modal-width":"w-[800px]",ref:t=>this.modal=t,title:salla.lang.get("pages.rating.rate_order")+' <span class="unicode">(#'+this.orderId+")</span>"},e("div",{class:"s-order-rating-steps-wrapper mt-12 mb-10 transition-all duration-300 ease-elastic"},this.isStoreRating&&this.renderStoreRating(),this.isProductsRating&&this.renderProductsRating(),this.isShippingRating&&this.renderShippingRating(),this.renderThanksView()),e("div",{class:"wizard-footer relative flex justify-between items-center"},e("button",{id:"prev-btn",class:"font-bold text-sm w-28 h-10 px-4 text-primary hover:text-primary-d opacity-0 pointer-events-none duration-300 transition-all"},"السابق"),this.stepsCount>1?e("ul",{class:"flex justify-center text-center space-s-1.5 flex-1"},[0,1,2].slice(0,this.stepsCount).map((t=>e("li",{class:(0==t?"bg-primary":"bg-gray-200")+" step-dot w-2.5 h-2.5 rounded-full transition-colors duration-300"})))):"",e("salla-button",{id:"next-btn",class:"w-28",ref:t=>this.nextBtn=t},"التالي"))))}renderStoreRating(){return e("section",{class:"step rating-section active transition-all duration-500","data-type":"store"},e("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_store_stars")},e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:"type",value:"store"}),e("div",{class:"flex flex-col items-center "},e("div",{class:"w-28 h-28 border border-gray-200 rounded-full flex items-center justify-center mb-4"},e("img",{src:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",alt:"store name",class:"w-12 object-contain"})),e("h2",{class:"section-title text-lg font-bold mb-4"},salla.lang.get("pages.rating.rate_the_store"))),e("div",{class:"rating-wrap flex items-center flex justify-center mb-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating())),e("textarea",{id:"storeReview",name:"comment",class:"form-input comment h-20",placeholder:salla.lang.get("pages.rating.write_store_rate")}),e("small",{class:"text-red-400 validation-message"})))}renderProductsRating(){return e("section",{class:"step rating-section products-section transition-all duration-500 opacity-0 translate-x-3 hidden","data-type":"product"},e("div",{class:"overflow-hidden"},this.order.products.map(((t,a)=>e("div",{class:"rating-outer-form mb-8 last:mb-0","data-stars-error":salla.lang.get("pages.rating.rate_product_stars",{item:t.title})},e("div",{class:"product-item"},e("div",{class:"flex space-s-5"},e("img",{src:t.image,alt:t.title,class:"w-18 h-14 object-cover rounded-md"}),e("div",{class:"flex-1"},e("h3",{class:"section-title leading-5 mb-1.5 font-bold md:text-sm"}," ",t.title),e("div",{class:"rw-product-entry__rate"},e("div",{class:"rating-wrap flex items-center space-s-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating())),e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:`products[${a}][product_id]`,value:t.getOptimusRouteKey}),e("input",{type:"hidden",name:"type",value:"products"}),e("textarea",{"data-product-id":t.id,name:`products[${a}][comment]`,id:`productReview_${t.id}`,class:"comment form-input h-20 product-review",placeholder:salla.lang.get("pages.rating.write_product_rate")}),e("small",{class:"text-red-400 validation-message"}))))))))))}renderShippingRating(){return e("section",{class:"step rating-section py-5 rounded-md transition-all duration-500 opacity-0 translate-x-3 hidden","data-type":"shipping"},e("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_shipping_stars")},e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.id}),e("input",{type:"hidden",name:"type",value:"shipping"}),e("div",{class:"flex flex-col items-center "},e("div",{class:"w-28 h-28 overflow-hidden border border-gray-200 rounded-full flex items-center justify-center mb-4"},e("img",{src:"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU",alt:"company name",class:"w-full h-full object-contain"})),e("h2",{class:"section-title text-lg font-bold mb-4"}," ",salla.lang.get("pages.rating.rate_shipping")," ارامكس")),e("div",{class:"rating-wrap flex flex justify-center mb-4"},e("form",{class:"rate-element ratFeedbackPresentere-element--has-label"},this.getStarsRating())),e("textarea",{id:"shippingReview",name:"comment",class:"form-input comment h-20 mb-2",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),e("small",{class:"text-red-400 validation-message"})))}renderThanksView(){return e("div",{class:"thankyou-view px-8 text-center transition-all duration-500 opacity-0 translate-x-3 hidden"},e("span",{class:"w-20 h-20 text-4xl inline-flex justify-center items-center bg-gray-50 rounded-full text-primary sicon-check-circle2"}),e("div",{class:"mt-4 mb-6"},e("h3",{class:"font-bold"},salla.lang.get("pages.rating.thanks")),e("div",{class:"text-gray-400 text-sm",innerHTML:this.thanksMsg})),e("a",{href:"#!",onClick:()=>this.hide(),class:"btn btn-primary h-10 flex-none px-8"},"عودة إلي تفاصيل الطلب"),e("time",{class:"close-time text-gray-400 block h-6 mt-3 text-sm"}))}getStarsRating(){return e("div",{class:"mb-1"},e("input",{type:"hidden",class:"rating_hidden_input",name:"rating",value:""}),this.stars.map((t=>e("button",{type:"submit",class:"btn btn--transparent px-1 text-2xl text-gray-400 btn--star","data-star":t},e("i",{class:"sicon-star2"})))))}get host(){return s(this)}};r.style=":host{display:block}";export{r as salla_rating}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t extends salla.AppHelpers{setHost(t){this.host=t}getElement(t){return this.host.querySelector(t)}getAttribute(t,e){var s;return null===(s=this.getElement(t))||void 0===s?void 0:s.getAttribute(e)}val(t){return this.getAttribute(t,"value")}isUser(){return!!salla.config.is_user}}const e=new t;export{e as H}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,h as s,g as a}from"./p-d1ef2268.js";import{H as i}from"./p-9bc28e0c.js";const t=class{constructor(s){var a,t;l(this,s),this.language=salla.config.language,this.currency=salla.config.currency,this.languages=salla.lang.get("common.titles.language"),this.currencies=salla.lang.get("common.titles.currency"),this.ok=salla.lang.get("common.elements.ok"),i.setHost(this.host),salla.event.on("localization::show",(()=>this.show())),this.languageSlot=(null===(a=i.getElement('[slot="language"]'))||void 0===a?void 0:a.innerHTML)||'<label class="s-localization-label" for"lang-{code}"><span>{name}</span><div class="s-localization-flag flag iti__flag iti__{country_code}"></div></label>',this.currencySlot=(null===(t=i.getElement('[slot="currency"]'))||void 0===t?void 0:t.innerHTML)||'<label class="s-localization-label" for="currency-{code}"><span>{name}</span><small class="s-localization-currency">{code}</small></label>'}async show(){return this.modal.show()}async hide(){return this.modal.hide()}async submit(){let l;this.btn.load().then((()=>{if(this.currency&&this.currency.code!==salla.config.currency.code)return l=window.location.href,salla.currency.api.change(this.currency.code)})).then((()=>{this.language&&this.language.code!==salla.config.language.code&&(l=this.language.url)})).then((()=>this.btn.stop())).then((()=>this.hide())).then((()=>l&&(window.location.href=l)))}render(){return s("salla-modal",{id:"salla-localization",class:"hidden",ref:l=>this.modal=l},s("slot",{name:"header"},s("div",{slot:"header"})),s("div",{class:"s-localization-inner"},salla.config.languages?s("div",{class:"s-localization-section"},s("label",{class:"s-localization-title"},this.languages),s("fieldset",{class:"s-localization-fieldset"},s("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_language")),s("div",{class:"s-localization-section-inner"},salla.config.languages.map((l=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",checked:this.language.code==l.code,onChange:()=>this.language=l,name:"language",id:"lang-"+l.code.toLowerCase(),value:l.code}),s("div",{id:"language-slot",innerHTML:this.languageSlot.replace(/\{name\}/g,l.name).replace(/\{code\}/g,l.code).replace(/\{country_code\}/g,l.country_code)}))))))):"",salla.config.currencies?s("div",{class:"s-localization-section"},s("label",{class:"s-localization-title"},this.currencies),s("fieldset",{class:"s-localization-fieldset"},s("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_currency")),s("div",{class:"s-localization-section-inner"},salla.config.currencies.map((l=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",name:"currency",checked:this.currency.code==l.code,onChange:()=>this.currency=l,id:"currency-"+l.code,value:l.code}),s("div",{id:"currency-slot",innerHTML:this.currencySlot.replace(/\{name\}/g,l.name).replace(/\{code\}/g,l.code).replace(/\{country_code\}/g,l.country_code)}))))))):""),s("p",{slot:"footer"},s("slot",{name:"footer"},s("salla-button",{ref:l=>this.btn=l,onClick:()=>this.submit(),class:"w-full"},this.ok))))}componentDidRender(){this.host.querySelectorAll("#currency-slot").forEach((l=>l.replaceWith(l.firstChild))),this.host.querySelectorAll("#language-slot").forEach((l=>l.replaceWith(l.firstChild)))}get host(){return a(this)}};export{t as salla_localization}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t,l=!1,n=!1,o=!1,s=!1;const i="undefined"!=typeof window?window:{},r=i.document||{head:{}},c={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},f=e=>Promise.resolve(e),a=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),u="http://www.w3.org/1999/xlink",$=new WeakMap,d=e=>"sc-"+e.o,y={},h=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...l)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!h(n))&&(n+=""),i&&r?c[c.length-1].i+=n:c.push(i?m(null,n):n),r=i)};if(f(l),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=m(e,null);return a.u=t,c.length>0&&(a.$=c),a.h=o,a.p=s,a},m=(e,t)=>({t:0,m:e,i:t,k:null,$:null,u:null,h:null,p:null}),b={},w=(e,t,l,n,o,s)=>{if(l!==n){let r=te(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,o=g(l),s=g(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("key"===t);else if("ref"===t)n&&n(e);else if(r||"o"!==t[0]||"n"!==t[1]){const i=h(n);if((r||i&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?r=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;f!==(f=f.replace(/^xlink\:?/,""))&&(t=f,c=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(u,t):e.removeAttribute(t)):(!r||4&s||o)&&!i&&(n=!0===n?"":n,c?e.setAttributeNS(u,t,n):e.setAttribute(t,n))}else t="-"===t[2]?t.slice(3):te(i,f)?f.slice(2):f[2]+t.slice(3),l&&c.rel(e,t,l,!1),n&&c.ael(e,t,n,!1)}},k=/\s/,g=e=>e?e.split(k):[],S=(e,t,l,n)=>{const o=11===t.k.nodeType&&t.k.host?t.k.host:t.k,s=e&&e.u||y,i=t.u||y;for(n in s)n in i||w(o,n,s[n],void 0,l,t.t);for(n in i)w(o,n,s[n],i[n],l,t.t)},j=(n,s,i)=>{let c,f,a,u=s.$[i],$=0;if(l||(o=!0,"slot"===u.m&&(u.t|=u.$?2:1)),null!==u.i)c=u.k=r.createTextNode(u.i);else if(1&u.t)c=u.k=r.createTextNode("");else if(c=u.k=r.createElement(2&u.t?"slot-fb":u.m),S(null,u,!1),u.$)for($=0;$<u.$.length;++$)f=j(n,u,$),f&&c.appendChild(f);return c["s-hn"]=t,3&u.t&&(c["s-sr"]=!0,c["s-cr"]=e,c["s-sn"]=u.p||"",a=n&&n.$&&n.$[i],a&&a.m===u.m&&n.k&&v(n.k,!1)),c},v=(e,l)=>{c.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const s=n[e];s["s-hn"]!==t&&s["s-ol"]&&(x(s).insertBefore(s,R(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),l&&v(s,l)}c.t&=-2},M=(e,t,l,n,o,s)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(;o<=s;++o)n[o]&&(i=j(null,l,o),i&&(n[o].k=i,r.insertBefore(i,R(t))))},O=(e,t,l,o,s)=>{for(;t<=l;++t)(o=e[t])&&(s=o.k,A(o),n=!0,s["s-ol"]?s["s-ol"].remove():v(s,!0),s.remove())},C=(e,t)=>e.m===t.m&&("slot"===e.m?e.p===t.p:e.h===t.h),R=e=>e&&e["s-ol"]||e,x=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,P=(e,t)=>{const l=t.k=e.k,n=e.$,o=t.$,s=t.i;let i;null===s?("slot"===t.m||S(e,t,!1),null!==n&&null!==o?((e,t,l,n)=>{let o,s,i=0,r=0,c=0,f=0,a=t.length-1,u=t[0],$=t[a],d=n.length-1,y=n[0],h=n[d];for(;i<=a&&r<=d;)if(null==u)u=t[++i];else if(null==$)$=t[--a];else if(null==y)y=n[++r];else if(null==h)h=n[--d];else if(C(u,y))P(u,y),u=t[++i],y=n[++r];else if(C($,h))P($,h),$=t[--a],h=n[--d];else if(C(u,h))"slot"!==u.m&&"slot"!==h.m||v(u.k.parentNode,!1),P(u,h),e.insertBefore(u.k,$.k.nextSibling),u=t[++i],h=n[--d];else if(C($,y))"slot"!==u.m&&"slot"!==h.m||v($.k.parentNode,!1),P($,y),e.insertBefore($.k,u.k),$=t[--a],y=n[++r];else{for(c=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].h&&t[f].h===y.h){c=f;break}c>=0?(s=t[c],s.m!==y.m?o=j(t&&t[r],l,c):(P(s,y),t[c]=void 0,o=s.k),y=n[++r]):(o=j(t&&t[r],l,r),y=n[++r]),o&&x(u.k).insertBefore(o,R(u.k))}i>a?M(e,null==n[d+1]?null:n[d+1].k,l,n,r,d):r>d&&O(t,i,a)})(l,n,t,o):null!==o?(null!==e.i&&(l.textContent=""),M(l,null,t,o,0,o.length-1)):null!==n&&O(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:e.i!==s&&(l.data=s)},T=e=>{let t,l,n,o,s,i,r=e.childNodes;for(l=0,n=r.length;l<n;l++)if(t=r[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}T(t)}},E=[],L=e=>{let t,l,o,s,i,r,c=0,f=e.childNodes,a=f.length;for(;c<a;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(o=l.parentNode.childNodes,s=t["s-sn"],r=o.length-1;r>=0;r--)l=o[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(W(l,s)?(i=E.find((e=>e.g===l)),n=!0,l["s-sn"]=l["s-sn"]||s,i?i.S=t:E.push({S:t,g:l}),l["s-sr"]&&E.map((e=>{W(e.g,l["s-sn"])&&(i=E.find((e=>e.g===l)),i&&!e.S&&(e.S=i.S))}))):E.some((e=>e.g===l))||E.push({g:l}));1===t.nodeType&&L(t)}},W=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,A=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(A)},F=e=>Y(e).j,H=(e,t,l)=>{const n=F(e);return{emit:e=>N(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},N=(e,t,l)=>{const n=c.ce(t,l);return e.dispatchEvent(n),n},U=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},q=(e,t)=>{if(e.t|=16,!(4&e.t))return U(e,e.M),$e((()=>D(e,t)));e.t|=512},D=(e,t)=>{const l=e.O;let n;return t&&(n=G(l,"componentWillLoad")),I(n,(()=>V(e,l,t)))},V=async(e,t,l)=>{const n=e.j,o=n["s-rc"];l&&(e=>{const t=e.C;((e,t)=>{let l=d(t),n=se.get(l);if(e=11===e.nodeType?e:r,n)if("string"==typeof n){let t,o=$.get(e=e.head||e);o||$.set(e,o=new Set),o.has(l)||(t=r.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n])})(e.j.getRootNode(),t)})(e);_(e,t),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>z(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},_=(s,i)=>{try{i=i.render(),s.t&=-17,s.t|=2,((s,i)=>{const f=s.j,a=s.C,u=s.R||m(null,null),$=(e=>e&&e.m===b)(i)?i:p(null,null,i);if(t=f.tagName,a.P&&($.u=$.u||{},a.P.map((([e,t])=>$.u[t]=f[e]))),$.m=null,$.t|=4,s.R=$,$.k=u.k=f,e=f["s-cr"],l=0!=(1&a.t),n=!1,P(u,$),c.t|=1,o){let e,t,l,n,o,s;L($.k);let i=0;for(;i<E.length;i++)e=E[i],t=e.g,t["s-ol"]||(l=r.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<E.length;i++)if(e=E[i],t=e.g,e.S){for(n=e.S.parentNode,o=e.S.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}n&&T($.k),c.t&=-2,E.length=0})(s,i)}catch(e){le(e,s.j)}return null},z=e=>{const t=e.j,l=e.M;G(e.O,"componentDidRender"),64&e.t||(e.t|=64,J(t),e.T(t),l||B()),e.L(t),e.v&&(e.v(),e.v=void 0),512&e.t&&ue((()=>q(e,!1))),e.t&=-517},B=()=>{J(r.documentElement),ue((()=>N(i,"appload",{detail:{namespace:"twilight-components"}})))},G=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){le(e)}},I=(e,t)=>e&&e.then?e.then(t):t(),J=e=>e.classList.add("hydrated"),K=(e,t,l)=>{if(t.W){e.watchers&&(t.A=e.watchers);const n=Object.entries(t.W),o=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(o,e,{get(){return((e,t)=>Y(this).F.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=Y(e),s=o.j,i=o.F.get(t),r=o.t,c=o.O;if(l=((e,t)=>null==e||h(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.W[t][0]),!(8&r&&void 0!==i||l===i)&&(o.F.set(t,l),c)){if(n.A&&128&r){const e=n.A[t];e&&e.map((e=>{try{c[e](l,i,t)}catch(e){le(e,s)}}))}2==(18&r)&&q(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(o,e,{value(...t){const l=Y(this);return l.H.then((()=>l.O[e](...t)))}})})),1&l){const l=new Map;o.attributeChangedCallback=function(e,t,n){c.jmp((()=>{const t=l.get(e);this.hasOwnProperty(t)&&(n=this[t],delete this[t]),this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const o=n[1]||e;return l.set(o,e),512&n[0]&&t.P.push([e,o]),o}))}}return e},Q=(e,t={})=>{const l=[],n=t.exclude||[],o=i.customElements,s=r.head,f=s.querySelector("meta[charset]"),u=r.createElement("style"),$=[];let y,h=!0;Object.assign(c,t),c.l=new URL(t.resourcesUrl||"./",r.baseURI).href,e.map((e=>e[1].map((t=>{const s={t:t[0],o:t[1],W:t[2],N:t[3]};s.W=t[2],s.P=[],s.A={};const i=s.o,f=class extends HTMLElement{constructor(e){super(e),ee(e=this,s)}connectedCallback(){y&&(clearTimeout(y),y=null),h?$.push(this):c.jmp((()=>(e=>{if(0==(1&c.t)){const t=Y(e),l=t.C,n=()=>{};if(!(1&t.t)){t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=r.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){U(t,t.M=l);break}}l.W&&Object.entries(l.W).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=oe(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.A=o.watchers,K(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){le(e)}t.t&=-9,t.t|=128,e()}if(o.style){let e=o.style;const t=d(l);if(!se.has(t)){const n=()=>{};((e,t,l)=>{let n=se.get(e);a&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,se.set(e,n)})(t,e,!!(1&l.t)),n()}}}const s=t.M,i=()=>q(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){c.jmp((()=>{}))}componentOnReady(){return Y(this).U}};s.q=e[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,K(f,s,1)))})))),u.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),s.insertBefore(u,f?f.nextSibling:s.firstChild),h=!1,$.length?$.map((e=>e.connectedCallback())):c.jmp((()=>y=setTimeout(B,30)))},X=new WeakMap,Y=e=>X.get(e),Z=(e,t)=>X.set(t.O=e,t),ee=(e,t)=>{const l={t:0,j:e,C:t,F:new Map};return l.H=new Promise((e=>l.L=e)),l.U=new Promise((e=>l.T=e)),e["s-p"]=[],e["s-rc"]=[],X.set(e,l)},te=(e,t)=>t in e,le=(e,t)=>(0,console.error)(e,t),ne=new Map,oe=e=>{const t=e.o.replace(/-/g,"_"),l=e.q,n=ne.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(ne.set(l,e),e[t])),le)},se=new Map,ie=[],re=[],ce=(e,t)=>l=>{e.push(l),s||(s=!0,t&&4&c.t?ue(ae):c.raf(ae))},fe=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){le(e)}e.length=0},ae=()=>{fe(ie),fe(re),(s=ie.length>0)&&c.raf(ae)},ue=e=>f().then(e),$e=ce(re,!0);export{b as H,Q as b,H as c,F as g,p as h,f as p,Z as r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,g as i,c as e,H as a}from"./p-d1ef2268.js";import{H as l}from"./p-9bc28e0c.js";export{S as salla_login}from"./p-36c87e2e.js";let o=require("store/src/store-engine"),h=require("store/storages/sessionStorage"),r=o.createStore(h);const n=class{constructor(t){s(this,t),this.open=!1,this.isOpenedBefore=r.get("multi-warehouse-opened-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"text-red-400":s.available?"text-green-500":"text-gray-400":this.currentBranch("limited")?"text-red-400":this.currentBranch("available")?"text-green-500":"text-gray-400",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show()))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){this.btn.load().then((()=>{setTimeout((()=>location.reload()),2e3)})),r.set("multi-warehouse-opened-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return t("salla-modal",{icon:"sicon-store-alt",title:"فرع الرياض","sub-title":"أنت الآن تتصفح المتجر من","is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,"modal-width":"w-116",id:"s-multi-warehouse-modal",class:"hidden"},t("div",{class:"text-right"},t("fieldset",{class:"mt-4"},t("h4",{class:"text-sm text-gray-600 mb-6"},this.formTitle()),t("legend",{class:"sr-only"},this.formTitle()),this.branches.length<=5?t("div",{class:"space-y-5"},this.branches.map((s=>t("div",{class:"flex items-center"},t("input",{id:this.position+"_branch_"+s.id,disabled:!s.open&&this.isChoiceable(),name:"lang",type:"radio",value:s.id,onChange:s=>this.handelChange(s),class:{"me-3 focus:ring-primary h-4 w-4 text-primary border-gray-300":!0,"opacity-50":!s.open,hidden:!this.isChoiceable()},checked:this.current==s.id}),t("label",{htmlFor:this.position+"_branch_"+s.id,class:{"flex items-center justify-between text-sm font-medium text-gray-700 flex-grow":!0,"cursor-pointer":this.isChoiceable()}},t("span",{class:{"opacity-50":!s.open}},s.name),this.isChoiceable()?t("small",{class:"text-red-400"},s.open?"":"مُغلق"):t("span",{class:this.statusColor(s)},s.tag)))))):t("select",{class:"w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary sm:text-sm border-gray-200 rounded-md appearance-none visibility_condition px-4",onInput:s=>this.handelChange(s)},this.branches.map((s=>t("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق")))))),this.isChoiceable()?t("div",{slot:"footer",class:"mt-6"},t("slot",{name:"footer"},t("salla-button",{"loader-position":"before",ref:s=>this.btn=s,onClick:()=>this.handleSubmit(),class:"w-full"},salla.lang.get("common.elements.ok")))):"")}componentDidRender(){this.isOpenedBefore||"popup"!=this.displayAs||this.show()}get host(){return i(this)}};n.style="#s-multi-warehouse-modal .s-modal-header{display:flex;flex-direction:column;margin-bottom:40px}#s-multi-warehouse-modal .s-modal-sub-title{margin:0}#s-multi-warehouse-modal .s-modal-title{order:10}";const d=class{constructor(t){s(this,t),this.btnStyle="primary",this.loading=!1,this.disabled=!1,this.loaderPosition="before",this.hostAttributes={};for(let s=0;s<this.host.attributes.length;s++)this.hostAttributes[this.host.attributes[s].name]=this.host.attributes[s].value;this.hostAttributes.type=this.hostAttributes.type||"button",this.hostAttributes.class=(this.hostAttributes.class||"")+" s-button-btn btn--has-loading btn-"+this.btnStyle+" loader-"+this.loaderPosition,this.hostAttributes.class+="before"==this.loaderPosition?" flex-row-reverse":"",delete this.hostAttributes["btn-style"],delete this.hostAttributes.id}async load(){return"center"==this.loaderPosition&&this.host.querySelector(".btn-text").classList.add("opacity-0"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host}async disable(){this.host.setAttribute("disabled","")}async enable(){this.host.removeAttribute("disabled")}handleVisible(s,t){this.btn.classList.remove("btn-"+t),this.btn.classList.add("btn-"+s)}handleLoading(s){l.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>s))}render(){return t("button",Object.assign({ref:s=>this.btn=s,disabled:this.disabled},this.hostAttributes),t("span",{class:"btn-text transition-opacity duration-300"},t("slot",null)),this.loading?t("span",{class:{"loader loader--small s-button-loader":!0,"absolute right-2":"start"===this.loaderPosition,"absolute left-2":"end"===this.loaderPosition,"absolute top-1/2 left-1/2 !-translate-x-1/2 !-translate-y-1/2 !m-0":"center"===this.loaderPosition}}):"")}get host(){return i(this)}static get watchers(){return{btnStyle:["handleVisible"],loading:["handleLoading"]}}};d.style=":host{display:block}";const c=class{constructor(t){s(this,t),this.ready=e(this,"ready",7),this.close=e(this,"close",7),this.error=!1,this.success=!1,this.isClosable=!0,this.modalWidth="w-96",this.visible=!1,this.subTitle="",this.icon="",salla.event.on("modal::open",(s=>s.dataset.target==this.host.id&&this.show())),salla.event.on("modal::close",(s=>s.dataset.target==this.host.id&&this.hide())),this.title=this.host.title,this.host.removeAttribute("title")}handleVisible(s){if(!s)return this.toggleModal(!1),void this.close.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.ready.emit()}async show(){return this.host.setAttribute("visible",""),this.host}async hide(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.title=s,this.host}toggleModal(s){l.toggleElement(this.host.querySelector(".s-modal-overlay"),"ease-out duration-300 opacity-100","opacity-0",(()=>s)).toggleElement(this.host.querySelector(".s-modal-body"),"ease-out duration-300 opacity-100 translate-y-0 sm:scale-100","opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",(()=>s)).toggleElement(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("hidden")),350)}closeModal(){this.isClosable&&this.host.removeAttribute("visible")}render(){return this.host.id=this.host.id||"salla-modal",t(a,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},""),t("div",{class:"s-modal-body "+this.modalWidth},t("div",{class:{"s-modal-header":!0,"text-center":""!=this.icon}},this.isClosable?t("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},t("span",{class:"sicon-cancel"})):"",this.error||this.success||this.icon?t("div",{class:{"s-modal-icon":!0,"s-modal-bg-error":this.error,"s-modal-bg-success":this.success,"s-modal-bg-normal":!this.error&&!this.success}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):"",t("div",{class:"s-modal-title",innerHTML:this.title}),t("p",{class:"s-modal-sub-title",innerHTML:this.subTitle})),t("slot",null),t("slot",{name:"footer"}))))}get host(){return i(this)}static get watchers(){return{visible:["handleVisible"]}}};export{n as multi_warehouse,d as salla_button,c as salla_modal}
|
|
@@ -1,125 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
6
|
-
*/
|
|
7
|
-
const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
|
8
|
-
const patchBrowser = () => {
|
|
9
|
-
// NOTE!! This fn cannot use async/await!
|
|
10
|
-
if (BUILD.isDev && !BUILD.isTesting) {
|
|
11
|
-
consoleDevInfo('Running in development mode.');
|
|
12
|
-
}
|
|
13
|
-
if (BUILD.cssVarShim) {
|
|
14
|
-
// shim css vars
|
|
15
|
-
plt.$cssShim$ = win.__cssshim;
|
|
16
|
-
}
|
|
17
|
-
if (BUILD.cloneNodeFix) {
|
|
18
|
-
// opted-in to polyfill cloneNode() for slot polyfilled components
|
|
19
|
-
patchCloneNodeFix(H.prototype);
|
|
20
|
-
}
|
|
21
|
-
if (BUILD.profile && !performance.mark) {
|
|
22
|
-
// not all browsers support performance.mark/measure (Safari 10)
|
|
23
|
-
performance.mark = performance.measure = () => {
|
|
24
|
-
/*noop*/
|
|
25
|
-
};
|
|
26
|
-
performance.getEntriesByName = () => [];
|
|
27
|
-
}
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
const scriptElm = BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
|
|
30
|
-
? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
|
|
31
|
-
s.getAttribute('data-stencil-namespace') === NAMESPACE)
|
|
32
|
-
: null;
|
|
33
|
-
const importMeta = import.meta.url;
|
|
34
|
-
const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
|
|
35
|
-
if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
|
|
36
|
-
// Safari < v11 support: This IF is true if it's Safari below v11.
|
|
37
|
-
// This fn cannot use async/await since Safari didn't support it until v11,
|
|
38
|
-
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
|
|
39
|
-
// so both the ESM file and nomodule file would get downloaded. Only Safari
|
|
40
|
-
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
|
|
41
|
-
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
|
|
42
|
-
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
|
|
43
|
-
return {
|
|
44
|
-
then() {
|
|
45
|
-
/* promise noop */
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (!BUILD.safari10 && importMeta !== '') {
|
|
50
|
-
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
51
|
-
}
|
|
52
|
-
else if (BUILD.dynamicImportShim || BUILD.safari10) {
|
|
53
|
-
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
|
|
54
|
-
if (BUILD.dynamicImportShim) {
|
|
55
|
-
patchDynamicImport(opts.resourcesUrl, scriptElm);
|
|
56
|
-
}
|
|
57
|
-
if (BUILD.dynamicImportShim && !win.customElements) {
|
|
58
|
-
// module support, but no custom elements support (Old Edge)
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
return import(/* webpackChunkName: "polyfills-dom" */ './dom-d08ba8aa.js').then(() => opts);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return promiseResolve(opts);
|
|
64
|
-
};
|
|
65
|
-
const patchDynamicImport = (base, orgScriptElm) => {
|
|
66
|
-
const importFunctionName = getDynamicImportFunction(NAMESPACE);
|
|
67
|
-
try {
|
|
68
|
-
// test if this browser supports dynamic imports
|
|
69
|
-
// There is a caching issue in V8, that breaks using import() in Function
|
|
70
|
-
// By generating a random string, we can workaround it
|
|
71
|
-
// Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
|
|
72
|
-
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
// this shim is specifically for browsers that do support "esm" imports
|
|
76
|
-
// however, they do NOT support "dynamic" imports
|
|
77
|
-
// basically this code is for old Edge, v18 and below
|
|
78
|
-
const moduleMap = new Map();
|
|
79
|
-
win[importFunctionName] = (src) => {
|
|
80
|
-
const url = new URL(src, base).href;
|
|
81
|
-
let mod = moduleMap.get(url);
|
|
82
|
-
if (!mod) {
|
|
83
|
-
const script = doc.createElement('script');
|
|
84
|
-
script.type = 'module';
|
|
85
|
-
script.crossOrigin = orgScriptElm.crossOrigin;
|
|
86
|
-
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
|
|
87
|
-
type: 'application/javascript',
|
|
88
|
-
}));
|
|
89
|
-
mod = new Promise((resolve) => {
|
|
90
|
-
script.onload = () => {
|
|
91
|
-
resolve(win[importFunctionName].m);
|
|
92
|
-
script.remove();
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
moduleMap.set(url, mod);
|
|
96
|
-
doc.head.appendChild(script);
|
|
97
|
-
}
|
|
98
|
-
return mod;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
103
|
-
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
104
|
-
HTMLElementPrototype.cloneNode = function (deep) {
|
|
105
|
-
if (this.nodeName === 'TEMPLATE') {
|
|
106
|
-
return nativeCloneNodeFn.call(this, deep);
|
|
107
|
-
}
|
|
108
|
-
const clonedNode = nativeCloneNodeFn.call(this, false);
|
|
109
|
-
const srcChildNodes = this.childNodes;
|
|
110
|
-
if (deep) {
|
|
111
|
-
for (let i = 0; i < srcChildNodes.length; i++) {
|
|
112
|
-
// Node.ATTRIBUTE_NODE === 2, and checking because IE11
|
|
113
|
-
if (srcChildNodes[i].nodeType !== 2) {
|
|
114
|
-
clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return clonedNode;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
patchBrowser().then(options => {
|
|
123
|
-
globalScripts();
|
|
124
|
-
return bootstrapLazy([["salla-button",[[4,"salla-button",{"color":[513],"loading":[516],"disabled":[516],"load":[64],"stop":[64],"disable":[64],"enable":[64]}]]],["salla-modal",[[4,"salla-modal",{"error":[4],"success":[4],"isClosable":[1028,"is-closable"],"modalWidth":[513,"modal-width"],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1],"show":[64],"hide":[64],"setTitle":[64]}]]],["multi-warehouse",[[4,"multi-warehouse",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization",[[4,"salla-localization",{"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability",[[4,"salla-product-availability",{"channels":[1],"hasButton":[4,"has-button"],"countryCode":[1,"country-code"],"title_":[1],"subscribe":[1],"cancel":[1],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"submit":[64]}]]],["salla-verify",[[0,"salla-verify"]]],["order-rating",[[4,"order-rating",{"order":[8],"show":[64],"hide":[64]}]]],["salla-login",[[0,"salla-login"]]],["salla-search",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
125
|
-
});
|
|
1
|
+
import{p as e,b as s}from"./p-d1ef2268.js";(()=>{const s=import.meta.url,l={};return""!==s&&(l.resourcesUrl=new URL(".",s).href),e(l)})().then((e=>s([["p-d34bbfc4",[[4,"multi-warehouse",{position:[1],displayAs:[1,"display-as"],browseProductsFrom:[1,"browse-products-from"],branches:[16],current:[1026],open:[32],selected:[32],isOpenedBefore:[32],show:[64],hide:[64]}],[0,"salla-login"],[4,"salla-button",{btnStyle:[513,"btn-style"],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],load:[64],stop:[64],disable:[64],enable:[64]}],[4,"salla-modal",{error:[4],success:[4],isClosable:[1028,"is-closable"],modalWidth:[513,"modal-width"],visible:[516],subTitle:[1,"sub-title"],icon:[1],show:[64],hide:[64],setTitle:[64]}]]],["p-bb503365",[[4,"salla-localization",{languages:[1],currencies:[1],ok:[1],show:[64],hide:[64],submit:[64]}]]],["p-2b8a5fa4",[[4,"salla-product-availability",{channels:[1],buttonText:[1,"button-text"],countryCode:[1,"country-code"],subscribe:[1],cancel:[1],subTitle:[1,"sub-title"],mobileLabel:[1,"mobile-label"],emailLabel:[1,"email-label"],mobilePlaceholder:[1,"mobile-placeholder"],emailPlaceholder:[1,"email-placeholder"],productId:[2,"product-id"],subscribed:[1],submit:[64]}]]],["p-94b18718",[[0,"salla-rating",{orderId:[2,"order-id"],thanksMsg:[1,"thanks-msg"],isStoreRating:[4,"is-store-rating"],isProductsRating:[4,"is-products-rating"],isShippingRating:[4,"is-shipping-rating"],show:[64],hide:[64]}]]],["p-4e37a6cb",[[0,"salla-verify"]]],["p-751643d8",[[4,"salla-search",{searchPlaceholder:[1,"search-placeholder"],noResultsText:[1,"no-results-text"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]]],e)));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export declare class SallaButton {
|
|
2
2
|
constructor();
|
|
3
3
|
host: HTMLElement;
|
|
4
|
-
|
|
4
|
+
btnStyle: string;
|
|
5
5
|
loading: boolean;
|
|
6
6
|
disabled: boolean;
|
|
7
|
+
loaderPosition: string;
|
|
7
8
|
load(): Promise<HTMLElement>;
|
|
8
9
|
stop(): Promise<HTMLElement>;
|
|
9
10
|
disable(): Promise<void>;
|
|
@@ -4,11 +4,18 @@ export declare class SallaLocalization {
|
|
|
4
4
|
private btn;
|
|
5
5
|
private language;
|
|
6
6
|
private currency;
|
|
7
|
+
private readonly languageSlot;
|
|
8
|
+
private readonly currencySlot;
|
|
9
|
+
languages: string;
|
|
10
|
+
currencies: string;
|
|
11
|
+
ok: string;
|
|
7
12
|
host: HTMLElement;
|
|
8
13
|
show(): Promise<HTMLElement>;
|
|
9
14
|
hide(): Promise<HTMLElement>;
|
|
10
|
-
private setCurrentLanguage;
|
|
11
|
-
private setCurrentCurrency;
|
|
12
15
|
submit(): Promise<void>;
|
|
13
16
|
render(): any;
|
|
17
|
+
/**
|
|
18
|
+
* to reduce dom levels we will move slot data into the parent dom
|
|
19
|
+
*/
|
|
20
|
+
componentDidRender(): void;
|
|
14
21
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare class SallaProductAvailability {
|
|
2
2
|
constructor();
|
|
3
|
+
private readonly title_;
|
|
4
|
+
private isUser;
|
|
3
5
|
private modal;
|
|
4
6
|
private channels_;
|
|
5
7
|
private email;
|
|
@@ -7,9 +9,8 @@ export declare class SallaProductAvailability {
|
|
|
7
9
|
private btn;
|
|
8
10
|
host: HTMLElement;
|
|
9
11
|
channels: string;
|
|
10
|
-
|
|
12
|
+
buttonText: string;
|
|
11
13
|
countryCode: string;
|
|
12
|
-
title_: string;
|
|
13
14
|
subscribe: string;
|
|
14
15
|
cancel: string;
|
|
15
16
|
subTitle: string;
|
|
@@ -18,7 +19,9 @@ export declare class SallaProductAvailability {
|
|
|
18
19
|
mobilePlaceholder: string;
|
|
19
20
|
emailPlaceholder: string;
|
|
20
21
|
productId: number;
|
|
22
|
+
subscribed: string;
|
|
21
23
|
channelsWatcher(newValue: any): void;
|
|
22
|
-
submit(): Promise<
|
|
24
|
+
submit(): Promise<any>;
|
|
23
25
|
render(): any;
|
|
26
|
+
private renderModal;
|
|
24
27
|
}
|
package/dist/types/components/{order-rating/order-rating.d.ts → salla-rating/salla-rating.d.ts}
RENAMED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class SallaRating {
|
|
2
|
+
nextBtn: HTMLSallaButtonElement;
|
|
3
|
+
constructor();
|
|
2
4
|
stars: Number[];
|
|
3
5
|
order: any;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
orderId: number;
|
|
7
|
+
thanksMsg: string;
|
|
8
|
+
isStoreRating: boolean;
|
|
9
|
+
isProductsRating: boolean;
|
|
10
|
+
isShippingRating: boolean;
|
|
11
|
+
private ratingChain;
|
|
12
|
+
private stepsCount;
|
|
6
13
|
private modal;
|
|
7
14
|
host: HTMLElement;
|
|
8
|
-
constructor();
|
|
9
15
|
show(): Promise<HTMLElement>;
|
|
10
16
|
hide(): Promise<HTMLElement>;
|
|
17
|
+
componentWillLoad(): void;
|
|
11
18
|
componentDidRender(): void;
|
|
12
19
|
initiateRating(): void;
|
|
13
20
|
private handleWizard;
|
|
14
21
|
private showActiveStep;
|
|
22
|
+
private setModalHeight;
|
|
15
23
|
private sendRating;
|
|
16
24
|
private sendFeedback;
|
|
17
25
|
private ratingValidation;
|
|
26
|
+
private getData;
|
|
18
27
|
private starsRating;
|
|
19
28
|
private highlightSelectedStars;
|
|
20
29
|
render(): any;
|
|
@@ -15,22 +15,21 @@ export namespace Components {
|
|
|
15
15
|
"position": string;
|
|
16
16
|
"show": () => Promise<HTMLElement>;
|
|
17
17
|
}
|
|
18
|
-
interface OrderRating {
|
|
19
|
-
"hide": () => Promise<HTMLElement>;
|
|
20
|
-
"order": any;
|
|
21
|
-
"show": () => Promise<HTMLElement>;
|
|
22
|
-
}
|
|
23
18
|
interface SallaButton {
|
|
24
|
-
"
|
|
19
|
+
"btnStyle": string;
|
|
25
20
|
"disable": () => Promise<void>;
|
|
26
21
|
"disabled": boolean;
|
|
27
22
|
"enable": () => Promise<void>;
|
|
28
23
|
"load": () => Promise<HTMLElement>;
|
|
24
|
+
"loaderPosition": string;
|
|
29
25
|
"loading": boolean;
|
|
30
26
|
"stop": () => Promise<HTMLElement>;
|
|
31
27
|
}
|
|
32
28
|
interface SallaLocalization {
|
|
29
|
+
"currencies": string;
|
|
33
30
|
"hide": () => Promise<HTMLElement>;
|
|
31
|
+
"languages": string;
|
|
32
|
+
"ok": string;
|
|
34
33
|
"show": () => Promise<HTMLElement>;
|
|
35
34
|
"submit": () => Promise<void>;
|
|
36
35
|
}
|
|
@@ -49,19 +48,28 @@ export namespace Components {
|
|
|
49
48
|
"visible": boolean;
|
|
50
49
|
}
|
|
51
50
|
interface SallaProductAvailability {
|
|
51
|
+
"buttonText": string;
|
|
52
52
|
"cancel": string;
|
|
53
53
|
"channels": string;
|
|
54
54
|
"countryCode": string;
|
|
55
55
|
"emailLabel": string;
|
|
56
56
|
"emailPlaceholder": string;
|
|
57
|
-
"hasButton": boolean;
|
|
58
57
|
"mobileLabel": string;
|
|
59
58
|
"mobilePlaceholder": string;
|
|
60
59
|
"productId": number;
|
|
61
60
|
"subTitle": string;
|
|
62
|
-
"submit": () => Promise<
|
|
61
|
+
"submit": () => Promise<any>;
|
|
63
62
|
"subscribe": string;
|
|
64
|
-
"
|
|
63
|
+
"subscribed": string;
|
|
64
|
+
}
|
|
65
|
+
interface SallaRating {
|
|
66
|
+
"hide": () => Promise<HTMLElement>;
|
|
67
|
+
"isProductsRating": boolean;
|
|
68
|
+
"isShippingRating": boolean;
|
|
69
|
+
"isStoreRating": boolean;
|
|
70
|
+
"orderId": number;
|
|
71
|
+
"show": () => Promise<HTMLElement>;
|
|
72
|
+
"thanksMsg": string;
|
|
65
73
|
}
|
|
66
74
|
interface SallaSearch {
|
|
67
75
|
/**
|
|
@@ -83,12 +91,6 @@ declare global {
|
|
|
83
91
|
prototype: HTMLMultiWarehouseElement;
|
|
84
92
|
new (): HTMLMultiWarehouseElement;
|
|
85
93
|
};
|
|
86
|
-
interface HTMLOrderRatingElement extends Components.OrderRating, HTMLStencilElement {
|
|
87
|
-
}
|
|
88
|
-
var HTMLOrderRatingElement: {
|
|
89
|
-
prototype: HTMLOrderRatingElement;
|
|
90
|
-
new (): HTMLOrderRatingElement;
|
|
91
|
-
};
|
|
92
94
|
interface HTMLSallaButtonElement extends Components.SallaButton, HTMLStencilElement {
|
|
93
95
|
}
|
|
94
96
|
var HTMLSallaButtonElement: {
|
|
@@ -119,6 +121,12 @@ declare global {
|
|
|
119
121
|
prototype: HTMLSallaProductAvailabilityElement;
|
|
120
122
|
new (): HTMLSallaProductAvailabilityElement;
|
|
121
123
|
};
|
|
124
|
+
interface HTMLSallaRatingElement extends Components.SallaRating, HTMLStencilElement {
|
|
125
|
+
}
|
|
126
|
+
var HTMLSallaRatingElement: {
|
|
127
|
+
prototype: HTMLSallaRatingElement;
|
|
128
|
+
new (): HTMLSallaRatingElement;
|
|
129
|
+
};
|
|
122
130
|
interface HTMLSallaSearchElement extends Components.SallaSearch, HTMLStencilElement {
|
|
123
131
|
}
|
|
124
132
|
var HTMLSallaSearchElement: {
|
|
@@ -133,12 +141,12 @@ declare global {
|
|
|
133
141
|
};
|
|
134
142
|
interface HTMLElementTagNameMap {
|
|
135
143
|
"multi-warehouse": HTMLMultiWarehouseElement;
|
|
136
|
-
"order-rating": HTMLOrderRatingElement;
|
|
137
144
|
"salla-button": HTMLSallaButtonElement;
|
|
138
145
|
"salla-localization": HTMLSallaLocalizationElement;
|
|
139
146
|
"salla-login": HTMLSallaLoginElement;
|
|
140
147
|
"salla-modal": HTMLSallaModalElement;
|
|
141
148
|
"salla-product-availability": HTMLSallaProductAvailabilityElement;
|
|
149
|
+
"salla-rating": HTMLSallaRatingElement;
|
|
142
150
|
"salla-search": HTMLSallaSearchElement;
|
|
143
151
|
"salla-verify": HTMLSallaVerifyElement;
|
|
144
152
|
}
|
|
@@ -151,15 +159,16 @@ declare namespace LocalJSX {
|
|
|
151
159
|
"displayAs"?: string;
|
|
152
160
|
"position"?: string;
|
|
153
161
|
}
|
|
154
|
-
interface OrderRating {
|
|
155
|
-
"order"?: any;
|
|
156
|
-
}
|
|
157
162
|
interface SallaButton {
|
|
158
|
-
"
|
|
163
|
+
"btnStyle"?: string;
|
|
159
164
|
"disabled"?: boolean;
|
|
165
|
+
"loaderPosition"?: string;
|
|
160
166
|
"loading"?: boolean;
|
|
161
167
|
}
|
|
162
168
|
interface SallaLocalization {
|
|
169
|
+
"currencies"?: string;
|
|
170
|
+
"languages"?: string;
|
|
171
|
+
"ok"?: string;
|
|
163
172
|
}
|
|
164
173
|
interface SallaLogin {
|
|
165
174
|
}
|
|
@@ -175,18 +184,25 @@ declare namespace LocalJSX {
|
|
|
175
184
|
"visible"?: boolean;
|
|
176
185
|
}
|
|
177
186
|
interface SallaProductAvailability {
|
|
187
|
+
"buttonText"?: string;
|
|
178
188
|
"cancel"?: string;
|
|
179
189
|
"channels"?: string;
|
|
180
190
|
"countryCode"?: string;
|
|
181
191
|
"emailLabel"?: string;
|
|
182
192
|
"emailPlaceholder"?: string;
|
|
183
|
-
"hasButton"?: boolean;
|
|
184
193
|
"mobileLabel"?: string;
|
|
185
194
|
"mobilePlaceholder"?: string;
|
|
186
195
|
"productId"?: number;
|
|
187
196
|
"subTitle"?: string;
|
|
188
197
|
"subscribe"?: string;
|
|
189
|
-
"
|
|
198
|
+
"subscribed"?: string;
|
|
199
|
+
}
|
|
200
|
+
interface SallaRating {
|
|
201
|
+
"isProductsRating"?: boolean;
|
|
202
|
+
"isShippingRating"?: boolean;
|
|
203
|
+
"isStoreRating"?: boolean;
|
|
204
|
+
"orderId"?: number;
|
|
205
|
+
"thanksMsg"?: string;
|
|
190
206
|
}
|
|
191
207
|
interface SallaSearch {
|
|
192
208
|
/**
|
|
@@ -202,12 +218,12 @@ declare namespace LocalJSX {
|
|
|
202
218
|
}
|
|
203
219
|
interface IntrinsicElements {
|
|
204
220
|
"multi-warehouse": MultiWarehouse;
|
|
205
|
-
"order-rating": OrderRating;
|
|
206
221
|
"salla-button": SallaButton;
|
|
207
222
|
"salla-localization": SallaLocalization;
|
|
208
223
|
"salla-login": SallaLogin;
|
|
209
224
|
"salla-modal": SallaModal;
|
|
210
225
|
"salla-product-availability": SallaProductAvailability;
|
|
226
|
+
"salla-rating": SallaRating;
|
|
211
227
|
"salla-search": SallaSearch;
|
|
212
228
|
"salla-verify": SallaVerify;
|
|
213
229
|
}
|
|
@@ -217,12 +233,12 @@ declare module "@stencil/core" {
|
|
|
217
233
|
export namespace JSX {
|
|
218
234
|
interface IntrinsicElements {
|
|
219
235
|
"multi-warehouse": LocalJSX.MultiWarehouse & JSXBase.HTMLAttributes<HTMLMultiWarehouseElement>;
|
|
220
|
-
"order-rating": LocalJSX.OrderRating & JSXBase.HTMLAttributes<HTMLOrderRatingElement>;
|
|
221
236
|
"salla-button": LocalJSX.SallaButton & JSXBase.HTMLAttributes<HTMLSallaButtonElement>;
|
|
222
237
|
"salla-localization": LocalJSX.SallaLocalization & JSXBase.HTMLAttributes<HTMLSallaLocalizationElement>;
|
|
223
238
|
"salla-login": LocalJSX.SallaLogin & JSXBase.HTMLAttributes<HTMLSallaLoginElement>;
|
|
224
239
|
"salla-modal": LocalJSX.SallaModal & JSXBase.HTMLAttributes<HTMLSallaModalElement>;
|
|
225
240
|
"salla-product-availability": LocalJSX.SallaProductAvailability & JSXBase.HTMLAttributes<HTMLSallaProductAvailabilityElement>;
|
|
241
|
+
"salla-rating": LocalJSX.SallaRating & JSXBase.HTMLAttributes<HTMLSallaRatingElement>;
|
|
226
242
|
"salla-search": LocalJSX.SallaSearch & JSXBase.HTMLAttributes<HTMLSallaSearchElement>;
|
|
227
243
|
"salla-verify": LocalJSX.SallaVerify & JSXBase.HTMLAttributes<HTMLSallaVerifyElement>;
|
|
228
244
|
}
|