@salla.sa/twilight-components 1.0.9 → 1.0.11

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.
Files changed (64) hide show
  1. package/dist/cjs/{Helper-8c75b6ac.js → Helper-8852feaa.js} +3 -0
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{multi-warehouse_3.cjs.entry.js → multi-warehouse_4.cjs.entry.js} +91 -10
  5. package/dist/cjs/salla-localization.cjs.entry.js +35 -11
  6. package/dist/cjs/salla-product-availability.cjs.entry.js +78 -0
  7. package/dist/cjs/salla-rating.cjs.entry.js +299 -0
  8. package/dist/cjs/{salla-search-b9403062.js → salla-search-f9e00be9.js} +1 -0
  9. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  10. package/dist/cjs/salla-verify.cjs.entry.js +5 -3
  11. package/dist/cjs/twilight-components.cjs.js +1 -1
  12. package/dist/collection/Helpers/Helper.js +3 -0
  13. package/dist/collection/collection-manifest.json +2 -1
  14. package/dist/collection/components/multi-warehouse/multi-warehouse.css +13 -0
  15. package/dist/collection/components/multi-warehouse/multi-warehouse.js +38 -39
  16. package/dist/collection/components/salla-button/salla-button.js +42 -9
  17. package/dist/collection/components/salla-localization/salla-localization.js +112 -20
  18. package/dist/collection/components/salla-modal/salla-modal.js +26 -19
  19. package/dist/collection/components/salla-product-availability/salla-product-availability.js +333 -0
  20. package/dist/collection/components/{order-rating/order-rating.css → salla-rating/salla-rating.css} +0 -0
  21. package/dist/collection/components/salla-rating/salla-rating.js +484 -0
  22. package/dist/collection/components/salla-search/salla-search.js +1 -0
  23. package/dist/collection/components/salla-verify/salla-verify.js +4 -2
  24. package/dist/esm/{Helper-23b2de40.js → Helper-81ac9a8c.js} +3 -0
  25. package/dist/esm/index.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/{multi-warehouse_3.entry.js → multi-warehouse_4.entry.js} +91 -11
  28. package/dist/esm/salla-localization.entry.js +35 -11
  29. package/dist/esm/salla-product-availability.entry.js +74 -0
  30. package/dist/esm/salla-rating.entry.js +295 -0
  31. package/dist/esm/{salla-search-5d4a6f1a.js → salla-search-615b8f94.js} +1 -0
  32. package/dist/esm/salla-search.entry.js +1 -1
  33. package/dist/esm/salla-verify.entry.js +5 -3
  34. package/dist/esm/twilight-components.js +1 -1
  35. package/dist/twilight-components/index.esm.js +1 -1
  36. package/dist/twilight-components/p-2b8a5fa4.entry.js +1 -0
  37. package/dist/twilight-components/p-4e37a6cb.entry.js +1 -0
  38. package/dist/twilight-components/p-751643d8.entry.js +1 -0
  39. package/dist/twilight-components/{p-4b137380.js → p-8a2410e6.js} +0 -0
  40. package/dist/twilight-components/p-94b18718.entry.js +1 -0
  41. package/dist/twilight-components/{p-520446eb.js → p-9bc28e0c.js} +1 -1
  42. package/dist/twilight-components/p-bb503365.entry.js +1 -0
  43. package/dist/twilight-components/p-d34bbfc4.entry.js +1 -0
  44. package/dist/twilight-components/twilight-components.esm.js +1 -1
  45. package/dist/types/Helpers/Helper.d.ts +1 -0
  46. package/dist/types/components/multi-warehouse/multi-warehouse.d.ts +1 -0
  47. package/dist/types/components/salla-button/salla-button.d.ts +2 -1
  48. package/dist/types/components/salla-localization/salla-localization.d.ts +10 -3
  49. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +27 -0
  50. package/dist/types/components/salla-rating/salla-rating.d.ts +35 -0
  51. package/dist/types/components.d.ts +76 -17
  52. package/package.json +1 -1
  53. package/dist/cjs/order-rating.cjs.entry.js +0 -252
  54. package/dist/cjs/salla-button.cjs.entry.js +0 -57
  55. package/dist/collection/components/order-rating/order-rating.js +0 -321
  56. package/dist/esm/order-rating.entry.js +0 -248
  57. package/dist/esm/salla-button.entry.js +0 -53
  58. package/dist/twilight-components/p-653bb9a8.entry.js +0 -1
  59. package/dist/twilight-components/p-a2395c9d.entry.js +0 -1
  60. package/dist/twilight-components/p-baeca520.entry.js +0 -1
  61. package/dist/twilight-components/p-bd10d8d5.entry.js +0 -1
  62. package/dist/twilight-components/p-ea986bca.entry.js +0 -1
  63. package/dist/twilight-components/p-f4340bd9.entry.js +0 -1
  64. package/dist/types/components/order-rating/order-rating.d.ts +0 -20
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-643344dc.js';
2
- import { H as Helper } from './Helper-23b2de40.js';
2
+ import { H as Helper } from './Helper-81ac9a8c.js';
3
3
 
4
4
  const SallaVerify = class {
5
5
  constructor(hostRef) {
@@ -14,14 +14,16 @@ const SallaVerify = class {
14
14
  this.otpInputs = document.querySelectorAll('.s-verify-input');
15
15
  this.otpInputs[0].focus();
16
16
  Helper.onKeyUp('.s-verify-input', event => {
17
- var _a, _b;
17
+ var _a, _b, _c, _d;
18
18
  let key = event.keyCode || event.charCode;
19
19
  salla.helpers.digitsOnly(event.target);
20
20
  if (event.target.value) {
21
21
  (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
22
+ (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
22
23
  }
23
24
  else if ([8, 46].includes(key)) {
24
- (_b = event.target.previousElementSibling) === null || _b === void 0 ? void 0 : _b.focus();
25
+ (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
26
+ (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
25
27
  }
26
28
  this.toggleOTPSubmit();
27
29
  });
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["salla-localization",[[4,"salla-localization",{"show":[64],"hide":[64]}]]],["salla-verify",[[0,"salla-verify"]]],["order-rating",[[0,"order-rating",{"order":[8]}]]],["salla-search",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]],["salla-button",[[4,"salla-button",{"kind":[513],"loading":[516],"disabled":[516],"load":[64],"stop":[64],"disable":[64],"enable":[64]}]]],["multi-warehouse_3",[[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-modal",{"error":[4],"success":[4],"isClosable":[1028,"is-closable"],"modalWidth":[1,"modal-width"],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1],"show":[64],"hide":[64],"setTitle":[64]}]]]], 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"],"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"],"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
17
  });
@@ -1 +1 @@
1
- export{S as SallaLogin}from"./p-36c87e2e.js";export{S as SallaSearch}from"./p-4b137380.js";import"./p-d1ef2268.js";
1
+ export{S as SallaLogin}from"./p-36c87e2e.js";export{S as SallaSearch}from"./p-8a2410e6.js";import"./p-d1ef2268.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 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 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}
@@ -1 +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")}}const e=new t;export{e as H}
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
+ 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 +1 @@
1
- import{p as e,b as s}from"./p-d1ef2268.js";(()=>{const s=import.meta.url,a={};return""!==s&&(a.resourcesUrl=new URL(".",s).href),e(a)})().then((e=>s([["p-f4340bd9",[[4,"salla-localization",{show:[64],hide:[64]}]]],["p-a2395c9d",[[0,"salla-verify"]]],["p-bd10d8d5",[[0,"order-rating",{order:[8]}]]],["p-baeca520",[[4,"salla-search",{searchPlaceholder:[1,"search-placeholder"],noResultsText:[1,"no-results-text"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]],["p-653bb9a8",[[4,"salla-button",{kind:[513],loading:[516],disabled:[516],load:[64],stop:[64],disable:[64],enable:[64]}]]],["p-ea986bca",[[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-modal",{error:[4],success:[4],isClosable:[1028,"is-closable"],modalWidth:[1,"modal-width"],visible:[516],subTitle:[1,"sub-title"],icon:[1],show:[64],hide:[64],setTitle:[64]}]]]],e)));
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"],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"],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)));
@@ -3,6 +3,7 @@ declare class Helper extends salla.AppHelpers {
3
3
  getElement(selector: any): any;
4
4
  getAttribute(selector: any, attribute: any): any;
5
5
  val(selector: any): any;
6
+ isUser(): boolean;
6
7
  }
7
8
  declare const _default: Helper;
8
9
  export default _default;
@@ -7,6 +7,7 @@ export declare class MultiWarehouse {
7
7
  browseProductsFrom: string;
8
8
  branches: any[];
9
9
  current: number;
10
+ private btn;
10
11
  private modal;
11
12
  host: HTMLElement;
12
13
  constructor();
@@ -1,9 +1,10 @@
1
1
  export declare class SallaButton {
2
2
  constructor();
3
3
  host: HTMLElement;
4
- kind: string;
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
- private setCurrentLanguage;
9
- private setCurrentCurrency;
10
13
  show(): Promise<HTMLElement>;
11
14
  hide(): Promise<HTMLElement>;
12
- private submit;
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
  }
@@ -0,0 +1,27 @@
1
+ export declare class SallaProductAvailability {
2
+ constructor();
3
+ private isUser;
4
+ private modal;
5
+ private channels_;
6
+ private email;
7
+ private mobile;
8
+ private btn;
9
+ host: HTMLElement;
10
+ channels: string;
11
+ buttonText: string;
12
+ countryCode: string;
13
+ title_: string;
14
+ subscribe: string;
15
+ cancel: string;
16
+ subTitle: string;
17
+ mobileLabel: string;
18
+ emailLabel: string;
19
+ mobilePlaceholder: string;
20
+ emailPlaceholder: string;
21
+ productId: number;
22
+ subscribed: string;
23
+ channelsWatcher(newValue: any): void;
24
+ submit(): Promise<any>;
25
+ render(): any;
26
+ private renderModal;
27
+ }
@@ -0,0 +1,35 @@
1
+ export declare class SallaRating {
2
+ nextBtn: HTMLSallaButtonElement;
3
+ constructor();
4
+ stars: Number[];
5
+ order: any;
6
+ orderId: number;
7
+ thanksMsg: string;
8
+ isStoreRating: boolean;
9
+ isProductsRating: boolean;
10
+ isShippingRating: boolean;
11
+ private ratingChain;
12
+ private stepsCount;
13
+ private modal;
14
+ host: HTMLElement;
15
+ show(): Promise<HTMLElement>;
16
+ hide(): Promise<HTMLElement>;
17
+ componentWillLoad(): void;
18
+ componentDidRender(): void;
19
+ initiateRating(): void;
20
+ private handleWizard;
21
+ private showActiveStep;
22
+ private setModalHeight;
23
+ private sendRating;
24
+ private sendFeedback;
25
+ private ratingValidation;
26
+ private getData;
27
+ private starsRating;
28
+ private highlightSelectedStars;
29
+ render(): any;
30
+ renderStoreRating(): any;
31
+ renderProductsRating(): any;
32
+ renderShippingRating(): any;
33
+ renderThanksView(): any;
34
+ getStarsRating(): any;
35
+ }
@@ -15,21 +15,23 @@ export namespace Components {
15
15
  "position": string;
16
16
  "show": () => Promise<HTMLElement>;
17
17
  }
18
- interface OrderRating {
19
- "order": any;
20
- }
21
18
  interface SallaButton {
19
+ "btnStyle": string;
22
20
  "disable": () => Promise<void>;
23
21
  "disabled": boolean;
24
22
  "enable": () => Promise<void>;
25
- "kind": string;
26
23
  "load": () => Promise<HTMLElement>;
24
+ "loaderPosition": string;
27
25
  "loading": boolean;
28
26
  "stop": () => Promise<HTMLElement>;
29
27
  }
30
28
  interface SallaLocalization {
29
+ "currencies": string;
31
30
  "hide": () => Promise<HTMLElement>;
31
+ "languages": string;
32
+ "ok": string;
32
33
  "show": () => Promise<HTMLElement>;
34
+ "submit": () => Promise<void>;
33
35
  }
34
36
  interface SallaLogin {
35
37
  }
@@ -45,6 +47,31 @@ export namespace Components {
45
47
  "success": boolean;
46
48
  "visible": boolean;
47
49
  }
50
+ interface SallaProductAvailability {
51
+ "buttonText": string;
52
+ "cancel": string;
53
+ "channels": string;
54
+ "countryCode": string;
55
+ "emailLabel": string;
56
+ "emailPlaceholder": string;
57
+ "mobileLabel": string;
58
+ "mobilePlaceholder": string;
59
+ "productId": number;
60
+ "subTitle": string;
61
+ "submit": () => Promise<any>;
62
+ "subscribe": string;
63
+ "subscribed": string;
64
+ "title_": string;
65
+ }
66
+ interface SallaRating {
67
+ "hide": () => Promise<HTMLElement>;
68
+ "isProductsRating": boolean;
69
+ "isShippingRating": boolean;
70
+ "isStoreRating": boolean;
71
+ "orderId": number;
72
+ "show": () => Promise<HTMLElement>;
73
+ "thanksMsg": string;
74
+ }
48
75
  interface SallaSearch {
49
76
  /**
50
77
  * The text to overwrite no results text.
@@ -65,12 +92,6 @@ declare global {
65
92
  prototype: HTMLMultiWarehouseElement;
66
93
  new (): HTMLMultiWarehouseElement;
67
94
  };
68
- interface HTMLOrderRatingElement extends Components.OrderRating, HTMLStencilElement {
69
- }
70
- var HTMLOrderRatingElement: {
71
- prototype: HTMLOrderRatingElement;
72
- new (): HTMLOrderRatingElement;
73
- };
74
95
  interface HTMLSallaButtonElement extends Components.SallaButton, HTMLStencilElement {
75
96
  }
76
97
  var HTMLSallaButtonElement: {
@@ -95,6 +116,18 @@ declare global {
95
116
  prototype: HTMLSallaModalElement;
96
117
  new (): HTMLSallaModalElement;
97
118
  };
119
+ interface HTMLSallaProductAvailabilityElement extends Components.SallaProductAvailability, HTMLStencilElement {
120
+ }
121
+ var HTMLSallaProductAvailabilityElement: {
122
+ prototype: HTMLSallaProductAvailabilityElement;
123
+ new (): HTMLSallaProductAvailabilityElement;
124
+ };
125
+ interface HTMLSallaRatingElement extends Components.SallaRating, HTMLStencilElement {
126
+ }
127
+ var HTMLSallaRatingElement: {
128
+ prototype: HTMLSallaRatingElement;
129
+ new (): HTMLSallaRatingElement;
130
+ };
98
131
  interface HTMLSallaSearchElement extends Components.SallaSearch, HTMLStencilElement {
99
132
  }
100
133
  var HTMLSallaSearchElement: {
@@ -109,11 +142,12 @@ declare global {
109
142
  };
110
143
  interface HTMLElementTagNameMap {
111
144
  "multi-warehouse": HTMLMultiWarehouseElement;
112
- "order-rating": HTMLOrderRatingElement;
113
145
  "salla-button": HTMLSallaButtonElement;
114
146
  "salla-localization": HTMLSallaLocalizationElement;
115
147
  "salla-login": HTMLSallaLoginElement;
116
148
  "salla-modal": HTMLSallaModalElement;
149
+ "salla-product-availability": HTMLSallaProductAvailabilityElement;
150
+ "salla-rating": HTMLSallaRatingElement;
117
151
  "salla-search": HTMLSallaSearchElement;
118
152
  "salla-verify": HTMLSallaVerifyElement;
119
153
  }
@@ -126,15 +160,16 @@ declare namespace LocalJSX {
126
160
  "displayAs"?: string;
127
161
  "position"?: string;
128
162
  }
129
- interface OrderRating {
130
- "order"?: any;
131
- }
132
163
  interface SallaButton {
164
+ "btnStyle"?: string;
133
165
  "disabled"?: boolean;
134
- "kind"?: string;
166
+ "loaderPosition"?: string;
135
167
  "loading"?: boolean;
136
168
  }
137
169
  interface SallaLocalization {
170
+ "currencies"?: string;
171
+ "languages"?: string;
172
+ "ok"?: string;
138
173
  }
139
174
  interface SallaLogin {
140
175
  }
@@ -149,6 +184,28 @@ declare namespace LocalJSX {
149
184
  "success"?: boolean;
150
185
  "visible"?: boolean;
151
186
  }
187
+ interface SallaProductAvailability {
188
+ "buttonText"?: string;
189
+ "cancel"?: string;
190
+ "channels"?: string;
191
+ "countryCode"?: string;
192
+ "emailLabel"?: string;
193
+ "emailPlaceholder"?: string;
194
+ "mobileLabel"?: string;
195
+ "mobilePlaceholder"?: string;
196
+ "productId"?: number;
197
+ "subTitle"?: string;
198
+ "subscribe"?: string;
199
+ "subscribed"?: string;
200
+ "title_"?: string;
201
+ }
202
+ interface SallaRating {
203
+ "isProductsRating"?: boolean;
204
+ "isShippingRating"?: boolean;
205
+ "isStoreRating"?: boolean;
206
+ "orderId"?: number;
207
+ "thanksMsg"?: string;
208
+ }
152
209
  interface SallaSearch {
153
210
  /**
154
211
  * The text to overwrite no results text.
@@ -163,11 +220,12 @@ declare namespace LocalJSX {
163
220
  }
164
221
  interface IntrinsicElements {
165
222
  "multi-warehouse": MultiWarehouse;
166
- "order-rating": OrderRating;
167
223
  "salla-button": SallaButton;
168
224
  "salla-localization": SallaLocalization;
169
225
  "salla-login": SallaLogin;
170
226
  "salla-modal": SallaModal;
227
+ "salla-product-availability": SallaProductAvailability;
228
+ "salla-rating": SallaRating;
171
229
  "salla-search": SallaSearch;
172
230
  "salla-verify": SallaVerify;
173
231
  }
@@ -177,11 +235,12 @@ declare module "@stencil/core" {
177
235
  export namespace JSX {
178
236
  interface IntrinsicElements {
179
237
  "multi-warehouse": LocalJSX.MultiWarehouse & JSXBase.HTMLAttributes<HTMLMultiWarehouseElement>;
180
- "order-rating": LocalJSX.OrderRating & JSXBase.HTMLAttributes<HTMLOrderRatingElement>;
181
238
  "salla-button": LocalJSX.SallaButton & JSXBase.HTMLAttributes<HTMLSallaButtonElement>;
182
239
  "salla-localization": LocalJSX.SallaLocalization & JSXBase.HTMLAttributes<HTMLSallaLocalizationElement>;
183
240
  "salla-login": LocalJSX.SallaLogin & JSXBase.HTMLAttributes<HTMLSallaLoginElement>;
184
241
  "salla-modal": LocalJSX.SallaModal & JSXBase.HTMLAttributes<HTMLSallaModalElement>;
242
+ "salla-product-availability": LocalJSX.SallaProductAvailability & JSXBase.HTMLAttributes<HTMLSallaProductAvailabilityElement>;
243
+ "salla-rating": LocalJSX.SallaRating & JSXBase.HTMLAttributes<HTMLSallaRatingElement>;
185
244
  "salla-search": LocalJSX.SallaSearch & JSXBase.HTMLAttributes<HTMLSallaSearchElement>;
186
245
  "salla-verify": LocalJSX.SallaVerify & JSXBase.HTMLAttributes<HTMLSallaVerifyElement>;
187
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "twilight",