@salla.sa/twilight-components 1.0.15 → 1.0.17
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/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +5 -5
- package/dist/cjs/salla-button_4.cjs.entry.js +299 -0
- package/dist/cjs/salla-localization.cjs.entry.js +27 -24
- package/dist/cjs/salla-login-342876b9.js +118 -0
- package/dist/cjs/salla-offer.cjs.entry.js +25 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating.cjs.entry.js +155 -158
- package/dist/cjs/{salla-search-311c7053.js → salla-search-28da4616.js} +2 -2
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-branches/salla-branches.js +26 -28
- package/dist/collection/components/salla-button/salla-button.js +26 -23
- package/dist/collection/components/salla-localization/salla-localization.js +35 -29
- package/dist/collection/components/salla-login/salla-login.js +343 -26
- package/dist/collection/components/salla-modal/salla-modal.js +144 -45
- package/dist/collection/components/salla-offer/salla-offer.js +40 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-rating/salla-rating.css +4 -0
- package/dist/collection/components/salla-rating/salla-rating.js +206 -211
- package/dist/collection/components/salla-search/salla-search.js +3 -3
- package/dist/collection/components/salla-verify/salla-verify.js +160 -21
- package/dist/collection/plugins/tailwind-theme/generator.js +21 -12
- package/dist/collection/plugins/tailwind-theme/index.js +9 -9
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +5 -5
- package/dist/esm/salla-button_4.entry.js +292 -0
- package/dist/esm/salla-localization.entry.js +27 -24
- package/dist/esm/salla-login-32d25ffa.js +116 -0
- package/dist/esm/salla-offer.entry.js +21 -0
- package/dist/esm/salla-product-availability.entry.js +1 -1
- package/dist/esm/salla-rating.entry.js +155 -158
- package/dist/esm/{salla-search-add7bdb6.js → salla-search-f552c487.js} +2 -2
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/{p-d584d0c7.entry.js → p-33990e49.entry.js} +1 -1
- package/dist/twilight-components/p-36683152.js +1 -0
- package/dist/twilight-components/p-3cfede65.entry.js +1 -0
- package/dist/twilight-components/p-648661c8.entry.js +1 -0
- package/dist/twilight-components/p-93c3ac79.js +1 -0
- package/dist/twilight-components/p-a923a51e.entry.js +1 -0
- package/dist/twilight-components/p-bc278b0e.entry.js +1 -0
- package/dist/twilight-components/p-fa04c4b6.entry.js +1 -0
- package/dist/twilight-components/p-fa2f0e64.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-button/salla-button.d.ts +3 -2
- package/dist/types/components/salla-localization/salla-localization.d.ts +8 -0
- package/dist/types/components/salla-login/salla-login.d.ts +39 -0
- package/dist/types/components/salla-modal/salla-modal.d.ts +12 -4
- package/dist/types/components/salla-offer/salla-offer.d.ts +8 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +23 -9
- package/dist/types/components/salla-verify/salla-verify.d.ts +16 -6
- package/dist/types/components.d.ts +94 -8
- package/package.json +2 -1
- package/dist/cjs/salla-button.cjs.entry.js +0 -77
- package/dist/cjs/salla-login-6a54572d.js +0 -14
- package/dist/cjs/salla-login_2.cjs.entry.js +0 -97
- package/dist/cjs/salla-verify.cjs.entry.js +0 -96
- package/dist/esm/salla-button.entry.js +0 -73
- package/dist/esm/salla-login-c9c9fa57.js +0 -12
- package/dist/esm/salla-login_2.entry.js +0 -92
- package/dist/esm/salla-verify.entry.js +0 -92
- package/dist/twilight-components/p-010b8dfd.entry.js +0 -1
- package/dist/twilight-components/p-0ceecf63.js +0 -1
- package/dist/twilight-components/p-32d29245.entry.js +0 -1
- package/dist/twilight-components/p-50e70ad4.entry.js +0 -1
- package/dist/twilight-components/p-68c9f122.entry.js +0 -1
- package/dist/twilight-components/p-8126278e.entry.js +0 -1
- package/dist/twilight-components/p-9d327a79.entry.js +0 -1
- package/dist/twilight-components/p-b05450bc.entry.js +0 -1
- package/dist/twilight-components/p-bd5da080.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as i,g as e,c as l}from"./p-cb1c59a2.js";import{H as a}from"./p-9bc28e0c.js";export{S as salla_login}from"./p-93c3ac79.js";const h=class{constructor(t){s(this,t),this.btnStyle="primary",this.loading=!1,this.disabled=!1,this.loaderPosition="before",this.wide=!1,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+=" s-button-btn btn--has-loading s-button-"+this.btnStyle+(this.wide?" s-button-wide ":"")+" loader-"+this.loaderPosition+("before"==this.loaderPosition?" s-button-loader-after":""),delete this.hostAttributes["btn-style"],delete this.hostAttributes.id,this.wide&&this.host.classList.add("s-button-wide")}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),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){a.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>s))}render(){return t(i,{class:"s-button-host-tag"},t("button",Object.assign({ref:s=>this.btn=s,disabled:this.disabled},this.hostAttributes),t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:{"s-button-loader":!0,"s-button-loader-start":"start"===this.loaderPosition,"s-button-loader-end":"end"===this.loaderPosition,"s-button-loader-center":"center"===this.loaderPosition}}):""))}get host(){return e(this)}static get watchers(){return{btnStyle:["handleVisible"],loading:["handleLoading"]}}};h.style=":host{display:block}";const o=class{constructor(t){var i;s(this,t),this.modalOpened=l(this,"modalOpened",7),this.modalClosed=l(this,"modalClosed",7),this.error=!1,this.success=!1,this.primary=!1,this.isClosable=!0,this.width="md",this.visible=!1,this.isLoading=!1,this.subTitleFirst=!1,this.subTitle="",this.icon="",this.imageIcon="",a.setHost(this.host),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"),null===(i=a.getElement("[slot=body]"))||void 0===i||i.classList.add("s-modal-body","s-modal-"+this.width)}handleVisible(s){if(!s)return this.toggleModal(!1),void this.modalClosed.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.modalOpened.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}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}toggleModal(s){a.toggleElement(this.host.querySelector("[slot=body]")||this.host,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElement(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>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(i,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},""),t("slot",{name:"body"},t("div",{class:"s-modal-body s-modal-"+this.width,slot:"body"},this.isLoading?t("span",null,"Loading..."):[t("div",{class:{"s-modal-header":!0,"s-modal-is-center":""!=this.icon||""!=this.imageIcon}},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,"s-modal-bg-primary":this.primary}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):this.imageIcon?t("img",{class:"s-modal-header-img",src:this.imageIcon}):"",this.title||this.subTitle?t("div",{class:"s-modal-header-content"},t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.title}),t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle})):""),t("slot",null),t("slot",{name:"footer"})]))))}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}},r=class{constructor(t){s(this,t),this.verified=l(this,"verified",7),this.url="profile/verify-mobile",this.by="sms",this.autoReload=!0,a.setHost(this.host),this.withoutModal?this.modal={show:()=>"",hide:()=>""}:salla.event.on("profile::verify.mobile",(s=>this.show(s)))}async getCode(){return this.code.value}async show(s){return this.data=s,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),a.on("input",".s-verify-input",(s=>salla.helpers.digitsOnly(s.target))),a.onKeyUp(".s-verify-input",(s=>{var t,i,e,l;let a=s.keyCode||s.charCode;s.target.value?(null===(t=s.target.nextElementSibling)||void 0===t||t.focus(),null===(i=s.target.nextElementSibling)||void 0===i||i.select()):[8,46].includes(a)&&(null===(e=s.target.previousElementSibling)||void 0===e||e.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),a.on("paste",".s-verify-input",(s=>{let t=s.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,i)=>s.value=t[i]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){a.showElement(this.resendMessage).hideElement(this.resend);let s=30,t=setInterval((()=>{-1===s?(clearTimeout(t),a.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}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(Object.assign({resend_by:this.by},this.data)))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request(this.url,Object.assign({code:this.code.value},this.data)))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>this.autoReload&&window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return this.withoutModal?this.myBody():t("salla-modal",{id:"s-verify",ref:s=>this.modal=s,title:salla.lang.get("pages.profile.verify_title")},this.myBody())}myBody(){return[t("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),t("label",{class:"s-verify-label"},salla.lang.get("pages.profile.verify_placeholder")),t("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),t("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>t("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),t("div",{slot:"footer",class:"s-verify-footer"},t("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),t("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),t("b",{class:"s-verify-timer",ref:s=>this.timer=s})),t("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{h as salla_button,o as salla_modal,r as salla_verify}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as
|
|
1
|
+
import{p as e,b as l}from"./p-cb1c59a2.js";(()=>{const l=import.meta.url,s={};return""!==l&&(s.resourcesUrl=new URL(".",l).href),e(s)})().then((e=>l([["p-fa2f0e64",[[0,"salla-login",{loginTypeTitle:[1,"login-type-title"],loginText:[1,"login-text"],smsLabel:[1,"sms-label"],mobileLabel:[1,"mobile-label"],emailLabel:[1,"email-label"],enterText:[1,"enter-text"],bySMSText:[1,"by-s-m-s-text"],byEmailText:[1,"by-email-text"],backText:[1,"back-text"],show:[64]},[[0,"verified","onVerified"],[0,"modalClosed","onModalClose"]]],[0,"salla-verify",{withoutModal:[4,"without-modal"],url:[1],by:[1],autoReload:[4,"auto-reload"],getCode:[64],show:[64]}],[4,"salla-button",{btnStyle:[513,"btn-style"],loading:[516],disabled:[516],loaderPosition:[1,"loader-position"],wide:[4],load:[64],stop:[64],disable:[64],enable:[64]}],[4,"salla-modal",{error:[4],success:[4],primary:[4],isClosable:[1028,"is-closable"],width:[513],visible:[516],isLoading:[1540,"is-loading"],subTitleFirst:[4,"sub-title-first"],subTitle:[1,"sub-title"],icon:[1],imageIcon:[1,"image-icon"],title:[32],show:[64],hide:[64],setTitle:[64],loading:[64],stopLoading:[64]}]]],["p-fa04c4b6",[[4,"salla-branches",{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]}]]],["p-a923a51e",[[4,"salla-localization",{languagesTitle:[1,"languages-title"],currenciesTitle:[1,"currencies-title"],ok:[1],show:[64],hide:[64],submit:[64]}]]],["p-33990e49",[[4,"salla-product-availability",{channels:[1],buttonText:[1,"button-text"],countryCode:[1,"country-code"],subscribeText:[1,"subscribe-text"],cancelText:[1,"cancel-text"],subTitle:[1,"sub-title"],mobileLabel:[1,"mobile-label"],emailLabel:[1,"email-label"],mobilePlaceholder:[1,"mobile-placeholder"],emailPlaceholder:[1,"email-placeholder"],productId:[2,"product-id"],subscribedMessage:[1,"subscribed-message"],isSubscribed:[1028,"is-subscribed"],submit:[64]}]]],["p-3cfede65",[[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-648661c8",[[4,"salla-offer",{show:[64]}]]],["p-bc278b0e",[[0,"salla-search",{placeholder:[1],noResultsText:[1,"no-results-text"],results:[32]},[[0,"modalClosed","onModalClose"]]]]]],e)));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare class SallaButton {
|
|
2
2
|
constructor();
|
|
3
|
+
private text;
|
|
3
4
|
host: HTMLElement;
|
|
4
|
-
btnStyle:
|
|
5
|
+
btnStyle: 'primary' | 'outline' | 'outline-primary' | 'danger';
|
|
5
6
|
loading: boolean;
|
|
6
7
|
disabled: boolean;
|
|
7
|
-
loaderPosition:
|
|
8
|
+
loaderPosition: 'start' | 'end' | 'center' | 'before';
|
|
8
9
|
wide: boolean;
|
|
9
10
|
load(): Promise<HTMLElement>;
|
|
10
11
|
stop(): Promise<HTMLElement>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @slot header - The top of the modal.
|
|
3
|
+
* @slot footer - Replaces the bottom button.
|
|
4
|
+
* @slot language - Replaces language label, has replaceable props `{name}`, `{code}`, `{country_code}`.
|
|
5
|
+
* @slot currency - Replaces currency label, has replaceable props `{name}`, `{code}`, `{country_code}`.
|
|
6
|
+
*/
|
|
1
7
|
export declare class SallaLocalization {
|
|
2
8
|
constructor();
|
|
3
9
|
private modal;
|
|
@@ -12,6 +18,8 @@ export declare class SallaLocalization {
|
|
|
12
18
|
host: HTMLElement;
|
|
13
19
|
show(): Promise<HTMLElement>;
|
|
14
20
|
hide(): Promise<HTMLElement>;
|
|
21
|
+
private onChangeCurrency;
|
|
22
|
+
private onChangeLanguage;
|
|
15
23
|
submit(): Promise<void>;
|
|
16
24
|
render(): any;
|
|
17
25
|
/**
|
|
@@ -1,3 +1,42 @@
|
|
|
1
1
|
export declare class SallaLogin {
|
|
2
|
+
constructor();
|
|
3
|
+
private modal;
|
|
4
|
+
private tab1;
|
|
5
|
+
private tab2;
|
|
6
|
+
private tab3;
|
|
7
|
+
private tab4;
|
|
8
|
+
private tab5;
|
|
9
|
+
private regMobile;
|
|
10
|
+
private regEmail;
|
|
11
|
+
private regMobileBlock;
|
|
12
|
+
private regEmailBlock;
|
|
13
|
+
private mobile;
|
|
14
|
+
private email;
|
|
15
|
+
private firstName;
|
|
16
|
+
private lastName;
|
|
17
|
+
private regType;
|
|
18
|
+
private readonly title;
|
|
19
|
+
host: HTMLElement;
|
|
20
|
+
loginTypeTitle: string;
|
|
21
|
+
loginText: string;
|
|
22
|
+
smsLabel: string;
|
|
23
|
+
mobileLabel: string;
|
|
24
|
+
emailLabel: string;
|
|
25
|
+
enterText: string;
|
|
26
|
+
bySMSText: string;
|
|
27
|
+
byEmailText: string;
|
|
28
|
+
backText: string;
|
|
29
|
+
/**
|
|
30
|
+
* @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
|
|
31
|
+
*/
|
|
32
|
+
onVerified(event: any): any;
|
|
33
|
+
onModalClose(): void;
|
|
34
|
+
show(): Promise<HTMLElement>;
|
|
35
|
+
private showTab;
|
|
36
|
+
private loginByEmail;
|
|
37
|
+
private loginBySMS;
|
|
38
|
+
private typing;
|
|
39
|
+
private newUser;
|
|
2
40
|
render(): any;
|
|
41
|
+
componentDidRender(): void;
|
|
3
42
|
}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* @slot body - The content of modal
|
|
4
|
+
* @slot footer - The footer of modal
|
|
5
|
+
*/
|
|
2
6
|
export declare class SallaModal {
|
|
3
7
|
constructor();
|
|
4
8
|
error: boolean;
|
|
5
9
|
success: boolean;
|
|
10
|
+
primary: boolean;
|
|
6
11
|
isClosable: boolean;
|
|
7
|
-
|
|
12
|
+
width: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
8
13
|
visible: boolean;
|
|
14
|
+
isLoading: boolean;
|
|
9
15
|
subTitleFirst: boolean;
|
|
10
16
|
subTitle: string;
|
|
11
17
|
icon: string;
|
|
12
18
|
imageIcon: string;
|
|
13
|
-
|
|
19
|
+
title: string;
|
|
14
20
|
private overlay;
|
|
15
21
|
host: HTMLElement;
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
modalOpened: EventEmitter;
|
|
23
|
+
modalClosed: EventEmitter;
|
|
18
24
|
handleVisible(newValue: boolean): void;
|
|
19
25
|
show(): Promise<HTMLElement>;
|
|
20
26
|
hide(): Promise<HTMLElement>;
|
|
21
27
|
setTitle(title: any): Promise<HTMLElement>;
|
|
28
|
+
loading(): Promise<HTMLElement>;
|
|
29
|
+
stopLoading(): Promise<HTMLElement>;
|
|
22
30
|
private toggleModal;
|
|
23
31
|
private closeModal;
|
|
24
32
|
render(): any;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
export declare class SallaRating {
|
|
2
|
-
nextBtn: HTMLSallaButtonElement;
|
|
3
2
|
constructor();
|
|
4
|
-
stars: Number[];
|
|
5
3
|
order: any;
|
|
4
|
+
/**
|
|
5
|
+
* Ratted order Id
|
|
6
|
+
*/
|
|
6
7
|
orderId: number;
|
|
8
|
+
/**
|
|
9
|
+
* Display this message after sending user feedback
|
|
10
|
+
*/
|
|
7
11
|
thanksMsg: string;
|
|
12
|
+
/**
|
|
13
|
+
* Set to true to display store rating step
|
|
14
|
+
*/
|
|
8
15
|
isStoreRating: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Set to true to display products rating step
|
|
18
|
+
*/
|
|
9
19
|
isProductsRating: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Set to true to display shipping rating step
|
|
22
|
+
*/
|
|
10
23
|
isShippingRating: boolean;
|
|
11
|
-
ratingChain
|
|
12
|
-
stepsCount
|
|
24
|
+
private ratingChain;
|
|
25
|
+
private stepsCount;
|
|
26
|
+
private nextBtn;
|
|
13
27
|
private modal;
|
|
14
28
|
host: HTMLElement;
|
|
15
29
|
show(): Promise<HTMLElement>;
|
|
@@ -20,16 +34,16 @@ export declare class SallaRating {
|
|
|
20
34
|
private handleWizard;
|
|
21
35
|
private showActiveStep;
|
|
22
36
|
private setModalHeight;
|
|
37
|
+
private handleSubmitRating;
|
|
38
|
+
private starsRating;
|
|
39
|
+
private highlightSelectedStars;
|
|
23
40
|
private sendRating;
|
|
24
41
|
private sendFeedback;
|
|
25
42
|
private ratingValidation;
|
|
26
|
-
private getData;
|
|
27
|
-
private starsRating;
|
|
28
|
-
private highlightSelectedStars;
|
|
29
43
|
render(): any;
|
|
30
44
|
renderStoreRating(): any;
|
|
31
|
-
renderProductsRating(): any;
|
|
32
45
|
renderShippingRating(): any;
|
|
46
|
+
renderProductsRating(): any;
|
|
33
47
|
renderThanksView(): any;
|
|
34
|
-
getStarsRating(): any;
|
|
48
|
+
getStarsRating(size: any): any;
|
|
35
49
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
1
2
|
export declare class SallaVerify {
|
|
2
|
-
constructor();
|
|
3
|
-
host: HTMLElement;
|
|
4
3
|
private modal;
|
|
5
4
|
private code;
|
|
6
5
|
private btn;
|
|
@@ -8,12 +7,23 @@ export declare class SallaVerify {
|
|
|
8
7
|
private timer;
|
|
9
8
|
private resend;
|
|
10
9
|
private otpInputs;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
private data;
|
|
11
|
+
host: HTMLElement;
|
|
12
|
+
/**
|
|
13
|
+
* Should render component without modal
|
|
14
|
+
*/
|
|
15
|
+
withoutModal: boolean;
|
|
16
|
+
url: string;
|
|
17
|
+
by: string;
|
|
18
|
+
autoReload: boolean;
|
|
19
|
+
verified: EventEmitter;
|
|
20
|
+
constructor();
|
|
21
|
+
getCode(): Promise<string>;
|
|
22
|
+
show(data: any): Promise<any>;
|
|
14
23
|
private toggleOTPSubmit;
|
|
15
24
|
private resendTimer;
|
|
16
|
-
private submit;
|
|
17
25
|
private resendCode;
|
|
26
|
+
private submit;
|
|
18
27
|
render(): any;
|
|
28
|
+
private myBody;
|
|
19
29
|
}
|
|
@@ -16,12 +16,12 @@ export namespace Components {
|
|
|
16
16
|
"show": () => Promise<HTMLElement>;
|
|
17
17
|
}
|
|
18
18
|
interface SallaButton {
|
|
19
|
-
"btnStyle":
|
|
19
|
+
"btnStyle": 'primary' | 'outline' | 'outline-primary' | 'danger';
|
|
20
20
|
"disable": () => Promise<void>;
|
|
21
21
|
"disabled": boolean;
|
|
22
22
|
"enable": () => Promise<void>;
|
|
23
23
|
"load": () => Promise<HTMLElement>;
|
|
24
|
-
"loaderPosition":
|
|
24
|
+
"loaderPosition": 'start' | 'end' | 'center' | 'before';
|
|
25
25
|
"loading": boolean;
|
|
26
26
|
"stop": () => Promise<HTMLElement>;
|
|
27
27
|
"wide": boolean;
|
|
@@ -35,6 +35,16 @@ export namespace Components {
|
|
|
35
35
|
"submit": () => Promise<void>;
|
|
36
36
|
}
|
|
37
37
|
interface SallaLogin {
|
|
38
|
+
"backText": string;
|
|
39
|
+
"byEmailText": string;
|
|
40
|
+
"bySMSText": string;
|
|
41
|
+
"emailLabel": string;
|
|
42
|
+
"enterText": string;
|
|
43
|
+
"loginText": string;
|
|
44
|
+
"loginTypeTitle": string;
|
|
45
|
+
"mobileLabel": string;
|
|
46
|
+
"show": () => Promise<HTMLElement>;
|
|
47
|
+
"smsLabel": string;
|
|
38
48
|
}
|
|
39
49
|
interface SallaModal {
|
|
40
50
|
"error": boolean;
|
|
@@ -42,13 +52,20 @@ export namespace Components {
|
|
|
42
52
|
"icon": string;
|
|
43
53
|
"imageIcon": string;
|
|
44
54
|
"isClosable": boolean;
|
|
45
|
-
"
|
|
55
|
+
"isLoading": boolean;
|
|
56
|
+
"loading": () => Promise<HTMLElement>;
|
|
57
|
+
"primary": boolean;
|
|
46
58
|
"setTitle": (title: any) => Promise<HTMLElement>;
|
|
47
59
|
"show": () => Promise<HTMLElement>;
|
|
60
|
+
"stopLoading": () => Promise<HTMLElement>;
|
|
48
61
|
"subTitle": string;
|
|
49
62
|
"subTitleFirst": boolean;
|
|
50
63
|
"success": boolean;
|
|
51
64
|
"visible": boolean;
|
|
65
|
+
"width": 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
66
|
+
}
|
|
67
|
+
interface SallaOffer {
|
|
68
|
+
"show": (offerId: number) => Promise<void>;
|
|
52
69
|
}
|
|
53
70
|
interface SallaProductAvailability {
|
|
54
71
|
"buttonText": string;
|
|
@@ -68,11 +85,26 @@ export namespace Components {
|
|
|
68
85
|
}
|
|
69
86
|
interface SallaRating {
|
|
70
87
|
"hide": () => Promise<HTMLElement>;
|
|
88
|
+
/**
|
|
89
|
+
* Set to true to display products rating step
|
|
90
|
+
*/
|
|
71
91
|
"isProductsRating": boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Set to true to display shipping rating step
|
|
94
|
+
*/
|
|
72
95
|
"isShippingRating": boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Set to true to display store rating step
|
|
98
|
+
*/
|
|
73
99
|
"isStoreRating": boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Ratted order Id
|
|
102
|
+
*/
|
|
74
103
|
"orderId": number;
|
|
75
104
|
"show": () => Promise<HTMLElement>;
|
|
105
|
+
/**
|
|
106
|
+
* Display this message after sending user feedback
|
|
107
|
+
*/
|
|
76
108
|
"thanksMsg": string;
|
|
77
109
|
}
|
|
78
110
|
interface SallaSearch {
|
|
@@ -86,6 +118,15 @@ export namespace Components {
|
|
|
86
118
|
"placeholder": string;
|
|
87
119
|
}
|
|
88
120
|
interface SallaVerify {
|
|
121
|
+
"autoReload": boolean;
|
|
122
|
+
"by": string;
|
|
123
|
+
"getCode": () => Promise<string>;
|
|
124
|
+
"show": (data: any) => Promise<any>;
|
|
125
|
+
"url": string;
|
|
126
|
+
/**
|
|
127
|
+
* Should render component without modal
|
|
128
|
+
*/
|
|
129
|
+
"withoutModal": boolean;
|
|
89
130
|
}
|
|
90
131
|
}
|
|
91
132
|
declare global {
|
|
@@ -119,6 +160,12 @@ declare global {
|
|
|
119
160
|
prototype: HTMLSallaModalElement;
|
|
120
161
|
new (): HTMLSallaModalElement;
|
|
121
162
|
};
|
|
163
|
+
interface HTMLSallaOfferElement extends Components.SallaOffer, HTMLStencilElement {
|
|
164
|
+
}
|
|
165
|
+
var HTMLSallaOfferElement: {
|
|
166
|
+
prototype: HTMLSallaOfferElement;
|
|
167
|
+
new (): HTMLSallaOfferElement;
|
|
168
|
+
};
|
|
122
169
|
interface HTMLSallaProductAvailabilityElement extends Components.SallaProductAvailability, HTMLStencilElement {
|
|
123
170
|
}
|
|
124
171
|
var HTMLSallaProductAvailabilityElement: {
|
|
@@ -149,6 +196,7 @@ declare global {
|
|
|
149
196
|
"salla-localization": HTMLSallaLocalizationElement;
|
|
150
197
|
"salla-login": HTMLSallaLoginElement;
|
|
151
198
|
"salla-modal": HTMLSallaModalElement;
|
|
199
|
+
"salla-offer": HTMLSallaOfferElement;
|
|
152
200
|
"salla-product-availability": HTMLSallaProductAvailabilityElement;
|
|
153
201
|
"salla-rating": HTMLSallaRatingElement;
|
|
154
202
|
"salla-search": HTMLSallaSearchElement;
|
|
@@ -164,9 +212,9 @@ declare namespace LocalJSX {
|
|
|
164
212
|
"position"?: string;
|
|
165
213
|
}
|
|
166
214
|
interface SallaButton {
|
|
167
|
-
"btnStyle"?:
|
|
215
|
+
"btnStyle"?: 'primary' | 'outline' | 'outline-primary' | 'danger';
|
|
168
216
|
"disabled"?: boolean;
|
|
169
|
-
"loaderPosition"?:
|
|
217
|
+
"loaderPosition"?: 'start' | 'end' | 'center' | 'before';
|
|
170
218
|
"loading"?: boolean;
|
|
171
219
|
"wide"?: boolean;
|
|
172
220
|
}
|
|
@@ -176,19 +224,32 @@ declare namespace LocalJSX {
|
|
|
176
224
|
"ok"?: string;
|
|
177
225
|
}
|
|
178
226
|
interface SallaLogin {
|
|
227
|
+
"backText"?: string;
|
|
228
|
+
"byEmailText"?: string;
|
|
229
|
+
"bySMSText"?: string;
|
|
230
|
+
"emailLabel"?: string;
|
|
231
|
+
"enterText"?: string;
|
|
232
|
+
"loginText"?: string;
|
|
233
|
+
"loginTypeTitle"?: string;
|
|
234
|
+
"mobileLabel"?: string;
|
|
235
|
+
"smsLabel"?: string;
|
|
179
236
|
}
|
|
180
237
|
interface SallaModal {
|
|
181
238
|
"error"?: boolean;
|
|
182
239
|
"icon"?: string;
|
|
183
240
|
"imageIcon"?: string;
|
|
184
241
|
"isClosable"?: boolean;
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
242
|
+
"isLoading"?: boolean;
|
|
243
|
+
"onModalClosed"?: (event: CustomEvent<any>) => void;
|
|
244
|
+
"onModalOpened"?: (event: CustomEvent<any>) => void;
|
|
245
|
+
"primary"?: boolean;
|
|
188
246
|
"subTitle"?: string;
|
|
189
247
|
"subTitleFirst"?: boolean;
|
|
190
248
|
"success"?: boolean;
|
|
191
249
|
"visible"?: boolean;
|
|
250
|
+
"width"?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
251
|
+
}
|
|
252
|
+
interface SallaOffer {
|
|
192
253
|
}
|
|
193
254
|
interface SallaProductAvailability {
|
|
194
255
|
"buttonText"?: string;
|
|
@@ -206,10 +267,25 @@ declare namespace LocalJSX {
|
|
|
206
267
|
"subscribedMessage"?: string;
|
|
207
268
|
}
|
|
208
269
|
interface SallaRating {
|
|
270
|
+
/**
|
|
271
|
+
* Set to true to display products rating step
|
|
272
|
+
*/
|
|
209
273
|
"isProductsRating"?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Set to true to display shipping rating step
|
|
276
|
+
*/
|
|
210
277
|
"isShippingRating"?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Set to true to display store rating step
|
|
280
|
+
*/
|
|
211
281
|
"isStoreRating"?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Ratted order Id
|
|
284
|
+
*/
|
|
212
285
|
"orderId"?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Display this message after sending user feedback
|
|
288
|
+
*/
|
|
213
289
|
"thanksMsg"?: string;
|
|
214
290
|
}
|
|
215
291
|
interface SallaSearch {
|
|
@@ -223,6 +299,14 @@ declare namespace LocalJSX {
|
|
|
223
299
|
"placeholder"?: string;
|
|
224
300
|
}
|
|
225
301
|
interface SallaVerify {
|
|
302
|
+
"autoReload"?: boolean;
|
|
303
|
+
"by"?: string;
|
|
304
|
+
"onVerified"?: (event: CustomEvent<any>) => void;
|
|
305
|
+
"url"?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Should render component without modal
|
|
308
|
+
*/
|
|
309
|
+
"withoutModal"?: boolean;
|
|
226
310
|
}
|
|
227
311
|
interface IntrinsicElements {
|
|
228
312
|
"salla-branches": SallaBranches;
|
|
@@ -230,6 +314,7 @@ declare namespace LocalJSX {
|
|
|
230
314
|
"salla-localization": SallaLocalization;
|
|
231
315
|
"salla-login": SallaLogin;
|
|
232
316
|
"salla-modal": SallaModal;
|
|
317
|
+
"salla-offer": SallaOffer;
|
|
233
318
|
"salla-product-availability": SallaProductAvailability;
|
|
234
319
|
"salla-rating": SallaRating;
|
|
235
320
|
"salla-search": SallaSearch;
|
|
@@ -245,6 +330,7 @@ declare module "@stencil/core" {
|
|
|
245
330
|
"salla-localization": LocalJSX.SallaLocalization & JSXBase.HTMLAttributes<HTMLSallaLocalizationElement>;
|
|
246
331
|
"salla-login": LocalJSX.SallaLogin & JSXBase.HTMLAttributes<HTMLSallaLoginElement>;
|
|
247
332
|
"salla-modal": LocalJSX.SallaModal & JSXBase.HTMLAttributes<HTMLSallaModalElement>;
|
|
333
|
+
"salla-offer": LocalJSX.SallaOffer & JSXBase.HTMLAttributes<HTMLSallaOfferElement>;
|
|
248
334
|
"salla-product-availability": LocalJSX.SallaProductAvailability & JSXBase.HTMLAttributes<HTMLSallaProductAvailabilityElement>;
|
|
249
335
|
"salla-rating": LocalJSX.SallaRating & JSXBase.HTMLAttributes<HTMLSallaRatingElement>;
|
|
250
336
|
"salla-search": LocalJSX.SallaSearch & JSXBase.HTMLAttributes<HTMLSallaSearchElement>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twilight",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"typescript": "^4.4.3"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
+
"@salla.sa/twilight": "^2.0.36",
|
|
70
71
|
"store": "^2.0.12"
|
|
71
72
|
}
|
|
72
73
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-0b5b5867.js');
|
|
6
|
-
const Helper = require('./Helper-8852feaa.js');
|
|
7
|
-
|
|
8
|
-
const sallaButtonCss = ":host{display:block}";
|
|
9
|
-
|
|
10
|
-
const SallaButton = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.btnStyle = 'primary'; // outline, outline-primary ,danger
|
|
14
|
-
this.loading = false;
|
|
15
|
-
this.disabled = false;
|
|
16
|
-
this.loaderPosition = 'before';
|
|
17
|
-
this.wide = false;
|
|
18
|
-
this.hostAttributes = {};
|
|
19
|
-
//============= Initiate Button Attributes =============//
|
|
20
|
-
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
21
|
-
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
22
|
-
}
|
|
23
|
-
this.hostAttributes.type = this.hostAttributes.type || 'button';
|
|
24
|
-
this.hostAttributes.class += ' s-button-btn btn--has-loading '
|
|
25
|
-
+ 'btn-' + this.btnStyle
|
|
26
|
-
+ (this.wide ? ' s-button-wide ' : '')
|
|
27
|
-
+ 'loader-' + this.loaderPosition
|
|
28
|
-
+ (this.loaderPosition == 'before' ? ' flex-row-reverse' : '');
|
|
29
|
-
// if(this.hostAttributes.onclick){
|
|
30
|
-
// this.hostAttributes.onclick=eval(this.hostAttributes.onclick);
|
|
31
|
-
// }
|
|
32
|
-
delete this.hostAttributes['btn-style'];
|
|
33
|
-
delete this.hostAttributes['id'];
|
|
34
|
-
if (this.wide) {
|
|
35
|
-
this.host.classList.add('s-button-wide');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async load() {
|
|
39
|
-
if (this.loaderPosition == 'center')
|
|
40
|
-
this.host.querySelector('.btn-text').classList.add('opacity-0');
|
|
41
|
-
this.host.setAttribute('loading', '');
|
|
42
|
-
return this.host;
|
|
43
|
-
}
|
|
44
|
-
async stop() {
|
|
45
|
-
this.host.removeAttribute('loading');
|
|
46
|
-
return this.host;
|
|
47
|
-
}
|
|
48
|
-
async disable() {
|
|
49
|
-
this.host.setAttribute('disabled', '');
|
|
50
|
-
}
|
|
51
|
-
async enable() {
|
|
52
|
-
this.host.removeAttribute('disabled');
|
|
53
|
-
}
|
|
54
|
-
handleVisible(newKind, oldKind) {
|
|
55
|
-
this.btn.classList.remove('btn-' + oldKind);
|
|
56
|
-
this.btn.classList.add('btn-' + newKind);
|
|
57
|
-
}
|
|
58
|
-
handleLoading(newVal) {
|
|
59
|
-
Helper.Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
return (index.h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes), index.h("span", { class: "btn-text transition-opacity duration-300" }, index.h("slot", null)), this.loading ? index.h("span", { class: {
|
|
63
|
-
'loader loader--small s-button-loader': true,
|
|
64
|
-
'absolute right-2': this.loaderPosition === 'start',
|
|
65
|
-
'absolute left-2': this.loaderPosition === 'end',
|
|
66
|
-
'absolute top-1/2 left-1/2 !-translate-x-1/2 !-translate-y-1/2 !m-0': this.loaderPosition === 'center',
|
|
67
|
-
} }) : ''));
|
|
68
|
-
}
|
|
69
|
-
get host() { return index.getElement(this); }
|
|
70
|
-
static get watchers() { return {
|
|
71
|
-
"btnStyle": ["handleVisible"],
|
|
72
|
-
"loading": ["handleLoading"]
|
|
73
|
-
}; }
|
|
74
|
-
};
|
|
75
|
-
SallaButton.style = sallaButtonCss;
|
|
76
|
-
|
|
77
|
-
exports.salla_button = SallaButton;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-0b5b5867.js');
|
|
4
|
-
|
|
5
|
-
const SallaLogin = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
index.registerInstance(this, hostRef);
|
|
8
|
-
}
|
|
9
|
-
render() {
|
|
10
|
-
return (index.h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" }, index.h("div", { id: "showLoginMethods" }, index.h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"), index.h("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" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-mail" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))), index.h("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" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-phone" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))));
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.SallaLogin = SallaLogin;
|