@saasquatch/mint-components 2.5.1-1 → 2.5.1-3
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/sqm-big-stat_47.cjs.entry.js +4 -0
- package/dist/cjs/sqm-pagination_3.cjs.entry.js +21 -13
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +44 -1
- package/dist/collection/components/sqm-pagination/sqm-pagination-view.js +8 -4
- package/dist/collection/components/sqm-referral-codes/ReferralCodes.stories.js +43 -0
- package/dist/collection/components/sqm-referral-codes/sqm-referral-codes-view.js +13 -2
- package/dist/collection/components/sqm-referral-codes/sqm-referral-codes.js +1 -12
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +6 -2
- package/dist/esm/sqm-big-stat_47.entry.js +4 -0
- package/dist/esm/sqm-pagination_3.entry.js +21 -13
- package/dist/esm/sqm-stencilbook.entry.js +44 -1
- package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
- package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-aad907a4.system.entry.js → p-1d66ac7a.system.entry.js} +1 -1
- package/dist/mint-components/{p-1fa0187d.entry.js → p-70a1e190.entry.js} +1 -1
- package/dist/mint-components/p-b1c91d24.system.entry.js +1 -0
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/{p-f8a006f8.entry.js → p-c21c2e8c.entry.js} +2 -2
- package/dist/mint-components/p-d1ee0c72.entry.js +13 -0
- package/dist/mint-components/{p-81e7d1b8.system.entry.js → p-e716fbad.system.entry.js} +1 -1
- package/dist/types/components/sqm-referral-codes/ReferralCodes.stories.d.ts +7 -0
- package/dist/types/components/sqm-referral-codes/sqm-referral-codes-view.d.ts +0 -1
- package/dist/types/components/sqm-widget-verification/useWidgetVerification.d.ts +4 -2
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/mint-components/p-4d3846cc.entry.js +0 -13
- package/dist/mint-components/p-6b8236b3.system.entry.js +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{h as t,F as e,r as a}from"./p-083180bf.js";import{i as s}from"./p-6f8a3436.js";import{n as o,k as n}from"./p-a7fc1e02.js";import{F as i,i as r,d as l,H as c,J as d,B as p,w as u,$ as g}from"./p-8a6531d2.js";import{c as m}from"./p-c1086930.js";import{g as h}from"./p-9ec99ced.js";import{c as f}from"./p-cef45012.js";import{R as v,a as x,S as y,u as b}from"./p-aa69a316.js";import"./p-49b20dae.js";import{C}from"./p-d276468c.js";const T=f({Container:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"var(--sl-spacing-small)",width:"100%"},SkeletonContainer:{width:"40px"},TextContainer:{display:"flex",gap:"var(--sl-spacing-xx-small)"}}),P=T.toString();function k(a){const{states:s,callbacks:o,text:n,buttonType:i}=a,{onNext:r,onPrev:l}=o,{currentPage:c,totalPages:d,loading:p}=s;return 1===d?t(e,null):t("span",{class:T.classes.Container,part:"sqm-base"},t("style",{type:"text/css"},P),t("sl-button",{exportparts:`base: ${i}button-base`,onClick:l,part:"sqm-pagination-button",circle:!0,disabled:1===c},t("sl-icon",{name:"chevron-left",label:"Previous Page"})),p?t("div",{class:T.classes.SkeletonContainer},t("sl-skeleton",{height:"16px",width:"50%"})):t(e,null,t("div",{class:T.classes.TextContainer},n.paginationText)),t("sl-button",{exportparts:`base: ${i}button-base`,onClick:r,part:"sqm-pagination-button",circle:!0,disabled:c===d},t("sl-icon",{name:"chevron-right",label:"Previous Page"})))}const j=class{constructor(t){a(this,t),this.ignored=!0,this.paginationText="{currentPage} of {totalPages}",this.buttonType="secondary",o(this)}disconnectedCallback(){}render(){const e=r()?function(t){const[e,a]=n(1);return m({states:{currentPage:e,totalPages:5,loading:!1},buttonType:t.buttonType,callbacks:{onNext:()=>a(e+1),onPrev:()=>a(e-1)},text:{paginationText:s.formatMessage({id:"paginationText",defaultMessage:t.paginationText||"{currentPage} of {totalPages}"},{currentPage:e,totalPages:5})}},t.demoData||{},{arrayMerge:(t,e)=>e})}(h(this)):function(t){var e;const a=i(v),o=a.states.currentPage+1,n=null===(e=a.states)||void 0===e?void 0:e.pageCount;return{states:{currentPage:o,totalPages:n,loading:a.states.loading},callbacks:{onNext:()=>{var t,e;return null===(t=a.callbacks)||void 0===t?void 0:t.setCurrentPage((null===(e=a.states)||void 0===e?void 0:e.currentPage)+1)},onPrev:()=>{var t,e;return null===(t=a.callbacks)||void 0===t?void 0:t.setCurrentPage((null===(e=a.states)||void 0===e?void 0:e.currentPage)-1)}},text:{paginationText:s.formatMessage({id:"paginationText",defaultMessage:t.paginationText},{currentPage:o,totalPages:n})}}}(h(this));return t(k,Object.assign({},e))}},w=l.gql`
|
|
2
|
+
query getReferralCode($programId: ID) {
|
|
3
|
+
user: viewer {
|
|
4
|
+
... on User {
|
|
5
|
+
referralCode(programId: $programId)
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,E=l.gql`
|
|
10
|
+
mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
|
|
11
|
+
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
12
|
+
}
|
|
13
|
+
`,I=class{constructor(t){a(this,t),this.tooltiptext="Copied to Clipboard",this.showNotificationText=!1,this.notificationText="You've copied this code before",this.tooltiplifespan=1e3,this.textAlign="left",this.copyButtonLabel="Copy Code",this.buttonStyle="icon",this.buttonType="primary",o(this)}disconnectedCallback(){}render(){const e=h(this),a=r()?function(t){const[e,a]=n(!1),s="REFERRALCODE001";return m({copyString:s,tooltiptext:t.tooltiptext,textAlign:t.textAlign,copyButtonLabel:t.copyButtonLabel,buttonStyle:t.buttonStyle,notificationText:t.notificationText,showNotificationText:t.showNotificationText,isCopied:t.showNotificationText,borderColor:t.borderColor,backgroundColor:t.backgroundColor,textColor:t.textColor,borderRadius:t.borderRadius,buttonType:t.buttonType,isUsed:!1,rewardStatus:"AVAILABLE",open:e,onClick:()=>{navigator.clipboard.writeText(s),a(!0),setTimeout((()=>a(!1)),t.tooltiplifespan)}},t.demoData||{},{arrayMerge:(t,e)=>e})}(e):function(t){var e,a;const{programId:s=c()}=t,o=d(),r=p(),l=i(x),{data:m}=u(w,{programId:s},!(null==o?void 0:o.jwt)||void 0!==(null==l?void 0:l.referralCode)),[h]=g(E),[f]=g(y),v=null!==(a=(null==l?void 0:l.referralCode)||(null===(e=null==m?void 0:m.user)||void 0===e?void 0:e.referralCode))&&void 0!==a?a:"...",[b,C]=n(!1);return{...t,onClick:async function(){l&&(await f({referralCode:l.referralCode}),l.refresh()),navigator.clipboard.writeText(v),C(!0),setTimeout((()=>C(!1)),t.tooltiplifespan),h({eventMeta:{programId:s,id:null==o?void 0:o.id,accountId:null==o?void 0:o.accountId,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:r,shareMedium:"DIRECT"}}})},open:b,copyString:v,isCopied:null==l?void 0:l.isCopied,showNotificationText:t.showNotificationText&&!!(null==l?void 0:l.singleUse)}}(e);return t(C,Object.assign({},a))}};function S(e){const{slots:a,titleText:s,states:o,textColor:n="var(--sqm-text-subdued)"}=e,i=f({Wrapper:{width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"center",flexDirection:"column",gap:"var(--sl-spacing-large)",color:n},HeaderContainer:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},ShareCodeContainer:{width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"center",flexDirection:"column"},ShareButtonContainer:{width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"center",flexDirection:"column"},SkeletonContainer:{display:"flex",flexDirection:"column",gap:"var(--sl-spacing-small)",width:"100%"},SkeletonOne:{height:"36px",width:"100%"},TitleText:{fontSize:"var(--sl-font-size-large)",margin:"0"}}),r=i.toString();return t("div",{class:i.classes.Wrapper,part:"sqm-base"},t("style",{type:"text/css"},"\n :host {\n display: block;\n }\n :host([hidden]): {\n display: none;\n }\n ",r),t("div",{class:i.classes.HeaderContainer},t("h2",{class:i.classes.TitleText},s),!o.noCodes&&a.pagination),(e=>e.noCodes?a.empty:e.loading?t("div",{class:i.classes.SkeletonContainer},t("sl-skeleton",{class:i.classes.SkeletonOne})):t("div",{class:i.classes.Wrapper},t("div",{class:i.classes.ShareCodeContainer},a.shareCodes),t("div",{class:i.classes.ShareButtonContainer},a.shareButtons)))(o))}const M=class{constructor(t){a(this,t),this.titleText="Start sharing",this.emptyStateHeaderText="Your new codes and links aren’t ready yet",this.emptyStateDescriptionText="Please contact our program support team to let them know you’re out of codes.",this.emptyStateImageUrl="https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_leaderboard2.png",o(this)}disconnectedCallback(){}render(){const e=h(this),a=r()?function(t){return m({titleText:t.titleText,textColor:t.textColor,states:{noCodes:!1,loading:!1}},t.demoData||{},{arrayMerge:(t,e)=>e})}(e):b(e),s={slots:{shareButtons:t("slot",{name:"shareButtons"}),shareCodes:t("slot",{name:"shareCodes"}),pagination:t("slot",{name:"pagination"}),empty:t(R,{headerText:this.emptyStateHeaderText,descriptionText:this.emptyStateDescriptionText,imageUrl:this.emptyStateImageUrl})},...a,loading:a.states.loading,noCodes:a.states.noCodes};return t(S,Object.assign({},s))}};function R({headerText:e,descriptionText:a,imageUrl:s}){return t("slot",{name:"empty"},t("sqm-empty",{emptyStateHeader:e,emptyStateText:a,emptyStateImage:s}))}export{j as sqm_pagination,I as sqm_referral_code,M as sqm_referral_codes}
|