@sudobility/subscription-components 1.0.0
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/README.md +122 -0
- package/dist/__tests__/setup.d.ts +1 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3191 -0
- package/dist/index.umd.js +1 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/subscription-layout.d.ts +105 -0
- package/dist/subscription-layout.d.ts.map +1 -0
- package/dist/subscription-provider.d.ts +40 -0
- package/dist/subscription-provider.d.ts.map +1 -0
- package/dist/subscription-tile.d.ts +61 -0
- package/dist/subscription-tile.d.ts.map +1 -0
- package/dist/types.d.ts +119 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(I,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("@sudobility/design"),require("@sudobility/components"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@sudobility/design","@sudobility/components","react"],l):(I=typeof globalThis<"u"?globalThis:I||self,l(I.SubscriptionComponents={},I.ReactJSXRuntime,I.SudobilityDesign,I.SudobilityComponents,I.React))})(this,(function(I,l,de,Q,N){"use strict";function we(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(o=0;o<a;o++)e[o]&&(r=we(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function We(){for(var e,o,r=0,t="",a=arguments.length;r<a;r++)(e=arguments[r])&&(o=we(e))&&(t&&(t+=" "),t+=o);return t}const Ue=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},Be=(e,o)=>({classGroupId:e,validator:o}),ke=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),Z="-",ye=[],qe="arbitrary..",Re=e=>{const o=Ke(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Ye(i);const f=i.split(Z),u=f[0]===""&&f.length>1?1:0;return ve(f,u,o)},getConflictingClassGroupIds:(i,f)=>{if(f){const u=t[i],b=r[i];return u?b?Ue(b,u):u:b||ye}return r[i]||ye}}},ve=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const a=e[o],c=r.nextPart.get(a);if(c){const b=ve(e,o+1,c);if(b)return b}const i=r.validators;if(i===null)return;const f=o===0?e.join(Z):e.slice(o).join(Z),u=i.length;for(let b=0;b<u;b++){const k=i[b];if(k.validator(f))return k.classGroupId}},Ye=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?qe+t:void 0})(),Ke=e=>{const{theme:o,classGroups:r}=e;return Xe(r,o)},Xe=(e,o)=>{const r=ke();for(const t in e){const a=e[t];ue(a,r,t,o)}return r},ue=(e,o,r,t)=>{const a=e.length;for(let c=0;c<a;c++){const i=e[c];Je(i,o,r,t)}},Je=(e,o,r,t)=>{if(typeof e=="string"){He(e,o,r);return}if(typeof e=="function"){Qe(e,o,r,t);return}Ze(e,o,r,t)},He=(e,o,r)=>{const t=e===""?o:Ce(o,e);t.classGroupId=r},Qe=(e,o,r,t)=>{if(er(e)){ue(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(Be(r,e))},Ze=(e,o,r,t)=>{const a=Object.entries(e),c=a.length;for(let i=0;i<c;i++){const[f,u]=a[i];ue(u,Ce(o,f),r,t)}},Ce=(e,o)=>{let r=e;const t=o.split(Z),a=t.length;for(let c=0;c<a;c++){const i=t[c];let f=r.nextPart.get(i);f||(f=ke(),r.nextPart.set(i,f)),r=f}return r},er=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,rr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const a=(c,i)=>{r[c]=i,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(c){let i=r[c];if(i!==void 0)return i;if((i=t[c])!==void 0)return a(c,i),i},set(c,i){c in r?r[c]=i:a(c,i)}}},me="!",Se=":",tr=[],Pe=(e,o,r,t,a)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:a}),or=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=a=>{const c=[];let i=0,f=0,u=0,b;const k=a.length;for(let S=0;S<k;S++){const P=a[S];if(i===0&&f===0){if(P===Se){c.push(a.slice(u,S)),u=S+1;continue}if(P==="/"){b=S;continue}}P==="["?i++:P==="]"?i--:P==="("?f++:P===")"&&f--}const v=c.length===0?a:a.slice(u);let C=v,x=!1;v.endsWith(me)?(C=v.slice(0,-1),x=!0):v.startsWith(me)&&(C=v.slice(1),x=!0);const D=b&&b>u?b-u:void 0;return Pe(c,x,C,D)};if(o){const a=o+Se,c=t;t=i=>i.startsWith(a)?c(i.slice(a.length)):Pe(tr,!1,i,void 0,!0)}if(r){const a=t;t=c=>r({className:c,parseClassName:a})}return t},sr=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let a=[];for(let c=0;c<r.length;c++){const i=r[c],f=i[0]==="[",u=o.has(i);f||u?(a.length>0&&(a.sort(),t.push(...a),a=[]),t.push(i)):a.push(i)}return a.length>0&&(a.sort(),t.push(...a)),t}},nr=e=>({cache:rr(e.cacheSize),parseClassName:or(e),sortModifiers:sr(e),...Re(e)}),ar=/\s+/,ir=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:a,sortModifiers:c}=o,i=[],f=e.trim().split(ar);let u="";for(let b=f.length-1;b>=0;b-=1){const k=f[b],{isExternal:v,modifiers:C,hasImportantModifier:x,baseClassName:D,maybePostfixModifierPosition:S}=r(k);if(v){u=k+(u.length>0?" "+u:u);continue}let P=!!S,j=t(P?D.substring(0,S):D);if(!j){if(!P){u=k+(u.length>0?" "+u:u);continue}if(j=t(D),!j){u=k+(u.length>0?" "+u:u);continue}P=!1}const $=C.length===0?"":C.length===1?C[0]:c(C).join(":"),W=x?$+me:$,w=W+j;if(i.indexOf(w)>-1)continue;i.push(w);const O=a(j,P);for(let L=0;L<O.length;++L){const _=O[L];i.push(W+_)}u=k+(u.length>0?" "+u:u)}return u},lr=(...e)=>{let o=0,r,t,a="";for(;o<e.length;)(r=e[o++])&&(t=ze(r))&&(a&&(a+=" "),a+=t);return a},ze=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=ze(e[t]))&&(r&&(r+=" "),r+=o);return r},cr=(e,...o)=>{let r,t,a,c;const i=u=>{const b=o.reduce((k,v)=>v(k),e());return r=nr(b),t=r.cache.get,a=r.cache.set,c=f,f(u)},f=u=>{const b=t(u);if(b)return b;const k=ir(u,r);return a(u,k),k};return c=i,(...u)=>c(lr(...u))},dr=[],z=e=>{const o=r=>r[e]||dr;return o.isThemeGetter=!0,o},Ne=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ae=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ur=/^\d+\/\d+$/,mr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,br=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,R=e=>ur.test(e),g=e=>!!e&&!Number.isNaN(Number(e)),B=e=>!!e&&Number.isInteger(Number(e)),pe=e=>e.endsWith("%")&&g(e.slice(0,-1)),U=e=>mr.test(e),hr=()=>!0,xr=e=>pr.test(e)&&!fr.test(e),Ie=()=>!1,wr=e=>br.test(e),kr=e=>gr.test(e),yr=e=>!s(e)&&!n(e),vr=e=>Y(e,Oe,Ie),s=e=>Ne.test(e),q=e=>Y(e,Ge,xr),fe=e=>Y(e,Nr,g),Me=e=>Y(e,De,Ie),Cr=e=>Y(e,Ee,kr),ee=e=>Y(e,je,wr),n=e=>Ae.test(e),H=e=>K(e,Ge),Sr=e=>K(e,Ar),Te=e=>K(e,De),Pr=e=>K(e,Oe),zr=e=>K(e,Ee),re=e=>K(e,je,!0),Y=(e,o,r)=>{const t=Ne.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},K=(e,o,r=!1)=>{const t=Ae.exec(e);return t?t[1]?o(t[1]):r:!1},De=e=>e==="position"||e==="percentage",Ee=e=>e==="image"||e==="url",Oe=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",Nr=e=>e==="number",Ar=e=>e==="family-name",je=e=>e==="shadow",Ir=cr(()=>{const e=z("color"),o=z("font"),r=z("text"),t=z("font-weight"),a=z("tracking"),c=z("leading"),i=z("breakpoint"),f=z("container"),u=z("spacing"),b=z("radius"),k=z("shadow"),v=z("inset-shadow"),C=z("text-shadow"),x=z("drop-shadow"),D=z("blur"),S=z("perspective"),P=z("aspect"),j=z("ease"),$=z("animate"),W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...w(),n,s],L=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],m=()=>[n,s,u],V=()=>[R,"full","auto",...m()],te=()=>[B,"none","subgrid",n,s],oe=()=>["auto",{span:["full",B,n,s]},B,n,s],X=()=>[B,"auto",n,s],se=()=>["auto","min","max","fr",n,s],p=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],h=()=>["start","end","center","stretch","center-safe","end-safe"],y=()=>["auto",...m()],E=()=>[R,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...m()],d=()=>[e,n,s],J=()=>[...w(),Te,Me,{position:[n,s]}],ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Fe=()=>["auto","cover","contain",Pr,vr,{size:[n,s]}],he=()=>[pe,H,q],T=()=>["","none","full",b,n,s],G=()=>["",g,H,q],ae=()=>["solid","dashed","dotted","double"],Ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>[g,pe,Te,Me],$e=()=>["","none",D,n,s],ie=()=>["none",g,n,s],le=()=>["none",g,n,s],xe=()=>[g,n,s],ce=()=>[R,"full",...m()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[U],breakpoint:[U],color:[hr],container:[U],"drop-shadow":[U],ease:["in","out","in-out"],font:[yr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[U],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[U],shadow:[U],spacing:["px",g],text:[U],"text-shadow":[U],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",R,s,n,P]}],container:["container"],columns:[{columns:[g,s,n,f]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",n,s]}],basis:[{basis:[R,"full","auto",f,...m()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[g,R,"auto","initial","none",s]}],grow:[{grow:["",g,n,s]}],shrink:[{shrink:["",g,n,s]}],order:[{order:[B,"first","last","none",n,s]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:oe()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:oe()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:m()}],"gap-x":[{"gap-x":m()}],"gap-y":[{"gap-y":m()}],"justify-content":[{justify:[...p(),"normal"]}],"justify-items":[{"justify-items":[...h(),"normal"]}],"justify-self":[{"justify-self":["auto",...h()]}],"align-content":[{content:["normal",...p()]}],"align-items":[{items:[...h(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...h(),{baseline:["","last"]}]}],"place-content":[{"place-content":p()}],"place-items":[{"place-items":[...h(),"baseline"]}],"place-self":[{"place-self":["auto",...h()]}],p:[{p:m()}],px:[{px:m()}],py:[{py:m()}],ps:[{ps:m()}],pe:[{pe:m()}],pt:[{pt:m()}],pr:[{pr:m()}],pb:[{pb:m()}],pl:[{pl:m()}],m:[{m:y()}],mx:[{mx:y()}],my:[{my:y()}],ms:[{ms:y()}],me:[{me:y()}],mt:[{mt:y()}],mr:[{mr:y()}],mb:[{mb:y()}],ml:[{ml:y()}],"space-x":[{"space-x":m()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":m()}],"space-y-reverse":["space-y-reverse"],size:[{size:E()}],w:[{w:[f,"screen",...E()]}],"min-w":[{"min-w":[f,"screen","none",...E()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[i]},...E()]}],h:[{h:["screen","lh",...E()]}],"min-h":[{"min-h":["screen","lh","none",...E()]}],"max-h":[{"max-h":["screen","lh",...E()]}],"font-size":[{text:["base",r,H,q]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,n,fe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pe,s]}],"font-family":[{font:[Sr,s,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,n,s]}],"line-clamp":[{"line-clamp":[g,"none",n,fe]}],leading:[{leading:[c,...m()]}],"list-image":[{"list-image":["none",n,s]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",n,s]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:d()}],"text-color":[{text:d()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[g,"from-font","auto",n,q]}],"text-decoration-color":[{decoration:d()}],"underline-offset":[{"underline-offset":[g,"auto",n,s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:m()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",n,s]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",n,s]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:Fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,n,s],radial:["",n,s],conic:[B,n,s]},zr,Cr]}],"bg-color":[{bg:d()}],"gradient-from-pos":[{from:he()}],"gradient-via-pos":[{via:he()}],"gradient-to-pos":[{to:he()}],"gradient-from":[{from:d()}],"gradient-via":[{via:d()}],"gradient-to":[{to:d()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:d()}],"border-color-x":[{"border-x":d()}],"border-color-y":[{"border-y":d()}],"border-color-s":[{"border-s":d()}],"border-color-e":[{"border-e":d()}],"border-color-t":[{"border-t":d()}],"border-color-r":[{"border-r":d()}],"border-color-b":[{"border-b":d()}],"border-color-l":[{"border-l":d()}],"divide-color":[{divide:d()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[g,n,s]}],"outline-w":[{outline:["",g,H,q]}],"outline-color":[{outline:d()}],shadow:[{shadow:["","none",k,re,ee]}],"shadow-color":[{shadow:d()}],"inset-shadow":[{"inset-shadow":["none",v,re,ee]}],"inset-shadow-color":[{"inset-shadow":d()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:d()}],"ring-offset-w":[{"ring-offset":[g,q]}],"ring-offset-color":[{"ring-offset":d()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":d()}],"text-shadow":[{"text-shadow":["none",C,re,ee]}],"text-shadow-color":[{"text-shadow":d()}],opacity:[{opacity:[g,n,s]}],"mix-blend":[{"mix-blend":[...Ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[g]}],"mask-image-linear-from-pos":[{"mask-linear-from":A()}],"mask-image-linear-to-pos":[{"mask-linear-to":A()}],"mask-image-linear-from-color":[{"mask-linear-from":d()}],"mask-image-linear-to-color":[{"mask-linear-to":d()}],"mask-image-t-from-pos":[{"mask-t-from":A()}],"mask-image-t-to-pos":[{"mask-t-to":A()}],"mask-image-t-from-color":[{"mask-t-from":d()}],"mask-image-t-to-color":[{"mask-t-to":d()}],"mask-image-r-from-pos":[{"mask-r-from":A()}],"mask-image-r-to-pos":[{"mask-r-to":A()}],"mask-image-r-from-color":[{"mask-r-from":d()}],"mask-image-r-to-color":[{"mask-r-to":d()}],"mask-image-b-from-pos":[{"mask-b-from":A()}],"mask-image-b-to-pos":[{"mask-b-to":A()}],"mask-image-b-from-color":[{"mask-b-from":d()}],"mask-image-b-to-color":[{"mask-b-to":d()}],"mask-image-l-from-pos":[{"mask-l-from":A()}],"mask-image-l-to-pos":[{"mask-l-to":A()}],"mask-image-l-from-color":[{"mask-l-from":d()}],"mask-image-l-to-color":[{"mask-l-to":d()}],"mask-image-x-from-pos":[{"mask-x-from":A()}],"mask-image-x-to-pos":[{"mask-x-to":A()}],"mask-image-x-from-color":[{"mask-x-from":d()}],"mask-image-x-to-color":[{"mask-x-to":d()}],"mask-image-y-from-pos":[{"mask-y-from":A()}],"mask-image-y-to-pos":[{"mask-y-to":A()}],"mask-image-y-from-color":[{"mask-y-from":d()}],"mask-image-y-to-color":[{"mask-y-to":d()}],"mask-image-radial":[{"mask-radial":[n,s]}],"mask-image-radial-from-pos":[{"mask-radial-from":A()}],"mask-image-radial-to-pos":[{"mask-radial-to":A()}],"mask-image-radial-from-color":[{"mask-radial-from":d()}],"mask-image-radial-to-color":[{"mask-radial-to":d()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[g]}],"mask-image-conic-from-pos":[{"mask-conic-from":A()}],"mask-image-conic-to-pos":[{"mask-conic-to":A()}],"mask-image-conic-from-color":[{"mask-conic-from":d()}],"mask-image-conic-to-color":[{"mask-conic-to":d()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:Fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",n,s]}],filter:[{filter:["","none",n,s]}],blur:[{blur:$e()}],brightness:[{brightness:[g,n,s]}],contrast:[{contrast:[g,n,s]}],"drop-shadow":[{"drop-shadow":["","none",x,re,ee]}],"drop-shadow-color":[{"drop-shadow":d()}],grayscale:[{grayscale:["",g,n,s]}],"hue-rotate":[{"hue-rotate":[g,n,s]}],invert:[{invert:["",g,n,s]}],saturate:[{saturate:[g,n,s]}],sepia:[{sepia:["",g,n,s]}],"backdrop-filter":[{"backdrop-filter":["","none",n,s]}],"backdrop-blur":[{"backdrop-blur":$e()}],"backdrop-brightness":[{"backdrop-brightness":[g,n,s]}],"backdrop-contrast":[{"backdrop-contrast":[g,n,s]}],"backdrop-grayscale":[{"backdrop-grayscale":["",g,n,s]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g,n,s]}],"backdrop-invert":[{"backdrop-invert":["",g,n,s]}],"backdrop-opacity":[{"backdrop-opacity":[g,n,s]}],"backdrop-saturate":[{"backdrop-saturate":[g,n,s]}],"backdrop-sepia":[{"backdrop-sepia":["",g,n,s]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":m()}],"border-spacing-x":[{"border-spacing-x":m()}],"border-spacing-y":[{"border-spacing-y":m()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",n,s]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[g,"initial",n,s]}],ease:[{ease:["linear","initial",j,n,s]}],delay:[{delay:[g,n,s]}],animate:[{animate:["none",$,n,s]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,n,s]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[n,s,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:d()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:d()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",n,s]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":m()}],"scroll-mx":[{"scroll-mx":m()}],"scroll-my":[{"scroll-my":m()}],"scroll-ms":[{"scroll-ms":m()}],"scroll-me":[{"scroll-me":m()}],"scroll-mt":[{"scroll-mt":m()}],"scroll-mr":[{"scroll-mr":m()}],"scroll-mb":[{"scroll-mb":m()}],"scroll-ml":[{"scroll-ml":m()}],"scroll-p":[{"scroll-p":m()}],"scroll-px":[{"scroll-px":m()}],"scroll-py":[{"scroll-py":m()}],"scroll-ps":[{"scroll-ps":m()}],"scroll-pe":[{"scroll-pe":m()}],"scroll-pt":[{"scroll-pt":m()}],"scroll-pr":[{"scroll-pr":m()}],"scroll-pb":[{"scroll-pb":m()}],"scroll-pl":[{"scroll-pl":m()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",n,s]}],fill:[{fill:["none",...d()]}],"stroke-w":[{stroke:[g,H,q,fe]}],stroke:[{stroke:["none",...d()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function F(...e){return Ir(We(e))}const Mr={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-500",red:"bg-red-500"},Tr=({id:e,title:o,price:r,periodLabel:t,features:a,isSelected:c,onSelect:i,topBadge:f,discountBadge:u,premiumCallout:b,bottomNote:k,introPriceNote:v,isBestValue:C=!1,className:x,children:D,disabled:S=!1,ariaLabel:P})=>{const j=c?C?"border-purple-500 bg-purple-50 dark:bg-purple-900/20 shadow-lg":"border-blue-500 bg-blue-50 dark:bg-blue-900/20 shadow-lg":"border-gray-200 dark:border-gray-700 hover:border-gray-300 hover:shadow-md",$=()=>{S||i()},W=w=>{!S&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),i())};return l.jsxs("div",{className:F("relative border-2 rounded-xl p-6 transition-all flex flex-col",S?"opacity-50 cursor-not-allowed":"cursor-pointer",j,x),onClick:$,onKeyDown:W,role:"radio","aria-checked":c,"aria-label":P||`${o} - ${r}${t||""}`,"aria-disabled":S,tabIndex:S?-1:0,children:[f&&l.jsx("div",{className:"absolute -top-3 left-1/2 transform -translate-x-1/2",children:l.jsx("span",{className:F(Mr[f.color],"text-white px-3 py-1 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:f.text})}),l.jsxs("div",{className:"flex flex-col flex-grow",children:[l.jsxs("div",{className:"text-center mb-6",children:[l.jsx("h3",{className:F(de.textVariants.heading.h4(),"mb-2"),children:o}),l.jsxs("div",{className:"mb-3",children:[l.jsx("span",{className:F("text-4xl font-bold",C?"text-purple-600 dark:text-purple-400":"text-blue-600 dark:text-blue-400"),children:r}),t&&l.jsx("span",{className:"text-gray-500 dark:text-gray-400 text-lg",children:t})]}),u&&l.jsx("div",{className:F("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",u.isBestValue?"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:u.text})]}),D,a.length>0&&l.jsx("div",{className:"space-y-3 mb-6 flex-grow",children:a.map((w,O)=>l.jsxs("div",{className:"flex items-start",children:[l.jsx("span",{className:F("text-lg mr-3 flex-shrink-0",C?"text-purple-500":"text-green-500"),children:"✓"}),l.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 text-left",children:w.replace(/^✓\s*/,"")})]},O))}),b&&l.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20 rounded-lg p-4 mb-4",children:[l.jsx("div",{className:"flex items-center mb-2",children:l.jsx("span",{className:"text-purple-600 dark:text-purple-400 font-semibold text-sm",children:b.title})}),l.jsx("ul",{className:"text-xs text-gray-600 dark:text-gray-400 space-y-1",children:b.features.map((w,O)=>l.jsxs("li",{children:["• ",w]},O))})]}),k&&l.jsx("div",{className:F("text-center text-sm font-medium mb-4",C?"text-purple-600 dark:text-purple-400":"text-blue-600 dark:text-blue-400"),children:k})]}),l.jsxs("div",{className:"mt-auto space-y-4",children:[v&&l.jsx("div",{className:"p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:l.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 font-semibold text-center",children:v})}),l.jsx("div",{className:"flex justify-center",children:l.jsx("div",{className:F("w-5 h-5 rounded-full border-2 flex items-center justify-center",c?C?"border-purple-600 bg-purple-600":"border-blue-600 bg-blue-600":"border-gray-300 dark:border-gray-600"),children:c&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-white"})})})]})]})},Dr=({title:e,children:o,error:r,currentStatus:t,primaryAction:a,secondaryAction:c,minTileWidth:i=240,className:f,headerContent:u,footerContent:b,currentStatusLabel:k="Current Status"})=>{const v={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${i}px), 1fr))`,gap:"1.5rem"};return l.jsx(Q.Card,{className:f,children:l.jsxs(Q.CardContent,{className:"pt-6",children:[u,t&&l.jsxs(l.Fragment,{children:[l.jsx("h2",{className:F(de.textVariants.heading.h3(),"mb-4"),children:k}),t.isActive?l.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6",children:[l.jsxs("div",{className:"flex items-center mb-2",children:[l.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),l.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:t.activeContent?.title||"Active Subscription"})]}),t.activeContent?.fields&&t.activeContent.fields.length>0&&l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:t.activeContent.fields.map((C,x)=>l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:C.label}),l.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:C.value})]},x))})]}):l.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:[l.jsxs("div",{className:"flex items-center mb-2",children:[l.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),l.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:t.inactiveContent?.title||"No Active Subscription"})]}),t.inactiveContent?.message&&l.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:t.inactiveContent.message})]})]}),l.jsx("h2",{className:F(de.textVariants.heading.h3(),"mb-4"),children:e}),l.jsx("div",{style:v,children:o}),b,r&&l.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mt-6",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[c&&l.jsx(Q.Button,{onClick:c.onClick,disabled:c.disabled||c.loading,variant:"outline",className:"sm:flex-shrink-0",children:c.label}),l.jsx(Q.Button,{onClick:a.onClick,disabled:a.disabled||a.loading,className:"flex-1",children:a.label})]})]})})};let be=null;const Er=async()=>(be||(be=await import("@revenuecat/purchases-js")),be);let M=null;const Or=e=>{const o=e.rcBillingProduct,r=o?.defaultSubscriptionOption;return{identifier:e.identifier,productId:o?.identifier||void 0,price:o?.currentPrice?.amountMicros?(o.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:o?.currentPrice?.formattedPrice||"$0",title:o?.title||e.identifier,description:o?.description||"",period:o?.normalPeriodDuration||void 0,introPrice:r?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:r?.introPrice?.price?.amountMicros?(r.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:r?.introPrice?.periodDuration||void 0,introPriceCycles:r?.introPrice?.cycleCount||void 0,freeTrialPeriod:r?.trial?.periodDuration||void 0}},ge=(e,o)=>{const r=e.entitlements.active[o];return r?{isActive:!0,expirationDate:r.expirationDate?new Date(r.expirationDate):void 0,purchaseDate:r.latestPurchaseDate?new Date(r.latestPurchaseDate):void 0,productIdentifier:r.productIdentifier,willRenew:r.willRenew,isSandbox:r.isSandbox,unsubscribeDetectedAt:r.unsubscribeDetectedAt?new Date(r.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:r.billingIssueDetectedAt?new Date(r.billingIssueDetectedAt):void 0}:{isActive:!1}},Le=N.createContext(void 0),Gr=({apiKey:e,entitlementId:o,userEmail:r,onError:t,onPurchaseSuccess:a,children:c})=>{const[i,f]=N.useState([]),[u,b]=N.useState(null),[k,v]=N.useState(!1),[C,x]=N.useState(null),[D,S]=N.useState(!1),[P,j]=N.useState(null),[$,W]=N.useState(null),w=!e||e==="your_revenuecat_api_key_here",O=N.useCallback(()=>{f([]),b(null),W(null),x(null),S(!1),j(null),M=null},[]),L=N.useCallback(async()=>{if(M)try{const p=await M.getOfferings();if(p.current){W(p.current);const h=p.current.availablePackages.map(Or);f(h)}}catch(p){const h=p instanceof Error?p.message:"Failed to load offerings";x(h),t?.(p instanceof Error?p:new Error(h))}},[t]),_=N.useCallback(async()=>{if(M)try{const p=await M.getCustomerInfo(),h=ge(p,o);b(h.isActive?h:null)}catch(p){const h=p instanceof Error?p.message:"Failed to load subscription status";x(h),t?.(p instanceof Error?p:new Error(h))}},[o,t]),m=N.useCallback(async(p,h)=>{if(P&&P!==p&&O(),!(D&&P===p))try{if(v(!0),x(null),w)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),f([]),b(null);else{const y=await Er(),E={apiKey:e,appUserId:p};M=y.Purchases.configure(E);const d=h||r;if(d&&M)try{await M.setAttributes({email:d})}catch{}await Promise.all([L(),_()])}j(p),S(!0)}catch(y){const E=y instanceof Error?y.message:"Failed to initialize";x(E),b(null),f([]),t?.(y instanceof Error?y:new Error(E))}finally{v(!1)}},[P,D,w,e,r,L,_,t,O]),V=N.useCallback(async p=>{try{if(v(!0),x(null),w){await new Promise(ne=>setTimeout(ne,2e3));const J={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:p,willRenew:!0};return b(J),a?.(p),!0}if(!M||!$)throw new Error("Subscription service not initialized");const y=$.availablePackages.find(J=>J.identifier===p);if(!y)throw new Error(`Package not found: ${p}`);const E=await M.purchase({rcPackage:y,...r?{customerEmail:r}:{}}),d=ge(E.customerInfo,o);return b(d.isActive?d:null),d.isActive&&a?.(p),d.isActive}catch(h){const y=h instanceof Error?h.message:"Purchase failed";return x(y),t?.(h instanceof Error?h:new Error(y)),!1}finally{v(!1)}},[w,$,r,o,a,t]),te=N.useCallback(async()=>{try{if(v(!0),x(null),w)return await new Promise(y=>setTimeout(y,1e3)),x("No previous purchases found"),!1;if(!M)throw new Error("Subscription service not initialized");const p=await M.getCustomerInfo(),h=ge(p,o);return b(h.isActive?h:null),h.isActive||x("No previous purchases found"),h.isActive}catch(p){const h=p instanceof Error?p.message:"Restore failed";return x(h),t?.(p instanceof Error?p:new Error(h)),!1}finally{v(!1)}},[w,o,t]),oe=N.useCallback(async()=>{if(!w)try{x(null),await Promise.all([_(),L()])}catch(p){const h=p instanceof Error?p.message:"Refresh failed";x(h),t?.(p instanceof Error?p:new Error(h))}},[w,_,L,t]),X=N.useCallback(()=>{x(null)},[]);N.useEffect(()=>{if(!D||w||!M)return;const p=setInterval(()=>{_().catch(()=>{})},300*1e3);return()=>clearInterval(p)},[D,w,_]);const se={products:i,currentSubscription:u,isLoading:k,error:C,initialize:m,purchase:V,restore:te,refresh:oe,clearError:X};return l.jsx(Le.Provider,{value:se,children:c})},jr=()=>{const e=N.useContext(Le);if(!e)throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");return e},_e=()=>{try{const e=[];for(let r=0;r<localStorage.length;r++){const t=localStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&e.push(t)}e.forEach(r=>localStorage.removeItem(r));const o=[];for(let r=0;r<sessionStorage.length;r++){const t=sessionStorage.key(r);t&&(t.includes("revenuecat")||t.includes("rcb")||t.includes("rc_"))&&o.push(t)}o.forEach(r=>sessionStorage.removeItem(r))}catch{}},Lr=()=>{try{M&&(M.close(),M=null),_e()}catch{}};I.SubscriptionLayout=Dr,I.SubscriptionProvider=Gr,I.SubscriptionTile=Tr,I.clearRevenueCatCheckoutSessions=_e,I.closeRevenueCatInstance=Lr,I.cn=F,I.useSubscriptionContext=jr,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/lib/cn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Current subscription status display configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface SubscriptionStatusConfig {
|
|
6
|
+
/** Whether user has an active subscription */
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
/** Content to display when subscription is active */
|
|
9
|
+
activeContent?: {
|
|
10
|
+
/** Status title (e.g., "Active Subscription") */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Status fields to display */
|
|
13
|
+
fields?: Array<{
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
/** Content to display when no active subscription */
|
|
19
|
+
inactiveContent?: {
|
|
20
|
+
/** Status title (e.g., "No Active Subscription") */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Description message */
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Action button configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface ActionButtonConfig {
|
|
30
|
+
/** Button label */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Click handler */
|
|
33
|
+
onClick: () => void;
|
|
34
|
+
/** Whether button is disabled */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Whether button is in loading state */
|
|
37
|
+
loading?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface SubscriptionLayoutProps {
|
|
40
|
+
/** Section title */
|
|
41
|
+
title: string;
|
|
42
|
+
/** Subscription tiles to render */
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
/** Error message to display */
|
|
45
|
+
error?: string | null;
|
|
46
|
+
/** Current subscription status configuration */
|
|
47
|
+
currentStatus?: SubscriptionStatusConfig;
|
|
48
|
+
/** Primary action button (e.g., "Subscribe Now") */
|
|
49
|
+
primaryAction: ActionButtonConfig;
|
|
50
|
+
/** Secondary action button (e.g., "Restore Purchase") */
|
|
51
|
+
secondaryAction?: ActionButtonConfig;
|
|
52
|
+
/** Minimum tile width in pixels (default: 240) */
|
|
53
|
+
minTileWidth?: number;
|
|
54
|
+
/** Additional CSS classes */
|
|
55
|
+
className?: string;
|
|
56
|
+
/** Custom header content */
|
|
57
|
+
headerContent?: React.ReactNode;
|
|
58
|
+
/** Custom footer content (rendered above action buttons) */
|
|
59
|
+
footerContent?: React.ReactNode;
|
|
60
|
+
/** Label for "Current Status" section - for localization */
|
|
61
|
+
currentStatusLabel?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* SubscriptionLayout - Container component for subscription selection UI
|
|
65
|
+
*
|
|
66
|
+
* Provides a consistent layout with:
|
|
67
|
+
* - Optional current status display
|
|
68
|
+
* - Title heading
|
|
69
|
+
* - Responsive grid of subscription tiles (auto-wrapping)
|
|
70
|
+
* - Error message display
|
|
71
|
+
* - Primary and optional secondary action buttons
|
|
72
|
+
*
|
|
73
|
+
* All labels are passed by the consumer for full localization control.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* <SubscriptionLayout
|
|
78
|
+
* title={t('selectPlan')}
|
|
79
|
+
* currentStatus={{
|
|
80
|
+
* isActive: hasSubscription,
|
|
81
|
+
* activeContent: {
|
|
82
|
+
* title: t('status.active'),
|
|
83
|
+
* fields: [
|
|
84
|
+
* { label: t('plan'), value: planName },
|
|
85
|
+
* { label: t('expires'), value: expirationDate },
|
|
86
|
+
* ],
|
|
87
|
+
* },
|
|
88
|
+
* }}
|
|
89
|
+
* primaryAction={{
|
|
90
|
+
* label: t('buttons.subscribe'),
|
|
91
|
+
* onClick: handleSubscribe,
|
|
92
|
+
* }}
|
|
93
|
+
* secondaryAction={{
|
|
94
|
+
* label: t('buttons.restore'),
|
|
95
|
+
* onClick: handleRestore,
|
|
96
|
+
* }}
|
|
97
|
+
* error={error}
|
|
98
|
+
* >
|
|
99
|
+
* {plans.map(plan => <SubscriptionTile key={plan.id} {...plan} />)}
|
|
100
|
+
* </SubscriptionLayout>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const SubscriptionLayout: React.FC<SubscriptionLayoutProps>;
|
|
104
|
+
export default SubscriptionLayout;
|
|
105
|
+
//# sourceMappingURL=subscription-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-layout.d.ts","sourceRoot":"","sources":["../src/subscription-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,qDAAqD;IACrD,aAAa,CAAC,EAAE;QACd,iDAAiD;QACjD,KAAK,EAAE,MAAM,CAAC;QACd,+BAA+B;QAC/B,MAAM,CAAC,EAAE,KAAK,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ,CAAC;IACF,qDAAqD;IACrD,eAAe,CAAC,EAAE;QAChB,oDAAoD;QACpD,KAAK,EAAE,MAAM,CAAC;QACd,0BAA0B;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC,oDAAoD;IACpD,aAAa,EAAE,kBAAkB,CAAC;IAElC,yDAAyD;IACzD,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAErC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,4BAA4B;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC,4DAA4D;IAC5D,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC,4DAA4D;IAC5D,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA+GhE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { SubscriptionContextValue, SubscriptionProviderConfig } from './types';
|
|
3
|
+
export interface SubscriptionProviderProps extends SubscriptionProviderConfig {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* SubscriptionProvider - Context provider for RevenueCat subscription management
|
|
8
|
+
*
|
|
9
|
+
* Provides subscription state and actions to all child components.
|
|
10
|
+
* Handles RevenueCat SDK initialization, product fetching, and purchase flow.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <SubscriptionProvider
|
|
15
|
+
* apiKey="your_revenuecat_api_key"
|
|
16
|
+
* entitlementId="premium"
|
|
17
|
+
* onError={(error) => console.error(error)}
|
|
18
|
+
* onPurchaseSuccess={(productId) => analytics.track('purchase', { productId })}
|
|
19
|
+
* >
|
|
20
|
+
* <App />
|
|
21
|
+
* </SubscriptionProvider>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const SubscriptionProvider: React.FC<SubscriptionProviderProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Hook to access subscription context
|
|
27
|
+
*
|
|
28
|
+
* @throws Error if used outside of SubscriptionProvider
|
|
29
|
+
*/
|
|
30
|
+
export declare const useSubscriptionContext: () => SubscriptionContextValue;
|
|
31
|
+
/**
|
|
32
|
+
* Clear RevenueCat checkout sessions from browser storage
|
|
33
|
+
*/
|
|
34
|
+
export declare const clearRevenueCatCheckoutSessions: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Close RevenueCat instance and clear sessions
|
|
37
|
+
*/
|
|
38
|
+
export declare const closeRevenueCatInstance: () => void;
|
|
39
|
+
export default SubscriptionProvider;
|
|
40
|
+
//# sourceMappingURL=subscription-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-provider.d.ts","sourceRoot":"","sources":["../src/subscription-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAGV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAmFjB,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA4RpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,wBAMzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,QAAO,IAsBlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,IAU1C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BadgeConfig, DiscountBadgeConfig, PremiumCalloutConfig } from './types';
|
|
3
|
+
export interface SubscriptionTileProps {
|
|
4
|
+
/** Unique identifier for the subscription */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Plan title */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Formatted price string (e.g., "$9.99") */
|
|
9
|
+
price: string;
|
|
10
|
+
/** Period label (e.g., "/month", "/year") - passed by consumer for localization */
|
|
11
|
+
periodLabel?: string;
|
|
12
|
+
/** List of features/benefits */
|
|
13
|
+
features: string[];
|
|
14
|
+
/** Whether this tile is currently selected */
|
|
15
|
+
isSelected: boolean;
|
|
16
|
+
/** Selection callback */
|
|
17
|
+
onSelect: () => void;
|
|
18
|
+
/** Optional top badge (e.g., "Most Popular", "Free Trial") */
|
|
19
|
+
topBadge?: BadgeConfig;
|
|
20
|
+
/** Optional discount badge (e.g., "Save 40%") */
|
|
21
|
+
discountBadge?: DiscountBadgeConfig;
|
|
22
|
+
/** Optional premium callout section */
|
|
23
|
+
premiumCallout?: PremiumCalloutConfig;
|
|
24
|
+
/** Optional bottom note (e.g., new expiration date) */
|
|
25
|
+
bottomNote?: string;
|
|
26
|
+
/** Optional intro price note */
|
|
27
|
+
introPriceNote?: string;
|
|
28
|
+
/** Whether this is the best value option (affects styling) */
|
|
29
|
+
isBestValue?: boolean;
|
|
30
|
+
/** Additional CSS classes */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Custom content to render in the content area */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
/** Disabled state */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Accessibility label */
|
|
37
|
+
ariaLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SubscriptionTile - A reusable subscription plan display component
|
|
41
|
+
*
|
|
42
|
+
* Displays a subscription plan with pricing, features, badges, and selection state.
|
|
43
|
+
* All text is passed by the consumer for full localization control.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <SubscriptionTile
|
|
48
|
+
* id="yearly"
|
|
49
|
+
* title={t('plans.yearly.title')}
|
|
50
|
+
* price="$99.99"
|
|
51
|
+
* periodLabel={t('periods.year')}
|
|
52
|
+
* features={[t('feature1'), t('feature2')]}
|
|
53
|
+
* isSelected={selected === 'yearly'}
|
|
54
|
+
* onSelect={() => setSelected('yearly')}
|
|
55
|
+
* topBadge={{ text: t('badges.bestValue'), color: 'purple' }}
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const SubscriptionTile: React.FC<SubscriptionTileProps>;
|
|
60
|
+
export default SubscriptionTile;
|
|
61
|
+
//# sourceMappingURL=subscription-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-tile.d.ts","sourceRoot":"","sources":["../src/subscription-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEtF,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8CAA8C;IAC9C,UAAU,EAAE,OAAO,CAAC;IACpB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,iDAAiD;IACjD,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,uCAAuC;IACvC,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA4L5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for subscription components
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Product information from RevenueCat or custom backend
|
|
6
|
+
*/
|
|
7
|
+
export interface SubscriptionProduct {
|
|
8
|
+
/** Unique identifier for the product/package */
|
|
9
|
+
identifier: string;
|
|
10
|
+
/** Underlying product ID (e.g., from app store) */
|
|
11
|
+
productId?: string;
|
|
12
|
+
/** Numeric price value */
|
|
13
|
+
price: string;
|
|
14
|
+
/** Formatted price string (e.g., "$9.99") */
|
|
15
|
+
priceString: string;
|
|
16
|
+
/** Product title */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Product description */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** ISO 8601 duration (e.g., "P1M", "P1Y") */
|
|
21
|
+
period?: string;
|
|
22
|
+
/** Formatted introductory price */
|
|
23
|
+
introPrice?: string;
|
|
24
|
+
/** Raw intro price amount */
|
|
25
|
+
introPriceAmount?: string;
|
|
26
|
+
/** Intro price period (ISO 8601) */
|
|
27
|
+
introPricePeriod?: string;
|
|
28
|
+
/** Number of billing cycles for intro price */
|
|
29
|
+
introPriceCycles?: number;
|
|
30
|
+
/** Free trial period (ISO 8601, e.g., "P7D") */
|
|
31
|
+
freeTrialPeriod?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Active subscription status
|
|
35
|
+
*/
|
|
36
|
+
export interface SubscriptionStatus {
|
|
37
|
+
/** Whether the user has an active subscription */
|
|
38
|
+
isActive: boolean;
|
|
39
|
+
/** Expiration date of the subscription */
|
|
40
|
+
expirationDate?: Date;
|
|
41
|
+
/** Date when subscription was purchased */
|
|
42
|
+
purchaseDate?: Date;
|
|
43
|
+
/** Product identifier of the current subscription */
|
|
44
|
+
productIdentifier?: string;
|
|
45
|
+
/** Whether subscription will auto-renew */
|
|
46
|
+
willRenew?: boolean;
|
|
47
|
+
/** Whether this is a sandbox/test subscription */
|
|
48
|
+
isSandbox?: boolean;
|
|
49
|
+
/** Date when unsubscription was detected */
|
|
50
|
+
unsubscribeDetectedAt?: Date;
|
|
51
|
+
/** Date when billing issue was detected */
|
|
52
|
+
billingIssueDetectedAt?: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Badge display configuration
|
|
56
|
+
*/
|
|
57
|
+
export interface BadgeConfig {
|
|
58
|
+
/** Badge text */
|
|
59
|
+
text: string;
|
|
60
|
+
/** Badge color variant */
|
|
61
|
+
color: 'purple' | 'green' | 'blue' | 'yellow' | 'red';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Discount badge configuration
|
|
65
|
+
*/
|
|
66
|
+
export interface DiscountBadgeConfig {
|
|
67
|
+
/** Discount text (e.g., "Save 40%") */
|
|
68
|
+
text: string;
|
|
69
|
+
/** Whether this is the best value option */
|
|
70
|
+
isBestValue?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Premium callout section configuration
|
|
74
|
+
*/
|
|
75
|
+
export interface PremiumCalloutConfig {
|
|
76
|
+
/** Callout title */
|
|
77
|
+
title: string;
|
|
78
|
+
/** List of premium features */
|
|
79
|
+
features: string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Subscription context value
|
|
83
|
+
*/
|
|
84
|
+
export interface SubscriptionContextValue {
|
|
85
|
+
/** Available products */
|
|
86
|
+
products: SubscriptionProduct[];
|
|
87
|
+
/** Current subscription status */
|
|
88
|
+
currentSubscription: SubscriptionStatus | null;
|
|
89
|
+
/** Whether data is loading */
|
|
90
|
+
isLoading: boolean;
|
|
91
|
+
/** Error message if any */
|
|
92
|
+
error: string | null;
|
|
93
|
+
/** Initialize the subscription service */
|
|
94
|
+
initialize: (userId: string, email?: string) => Promise<void>;
|
|
95
|
+
/** Purchase a subscription */
|
|
96
|
+
purchase: (productIdentifier: string) => Promise<boolean>;
|
|
97
|
+
/** Restore previous purchases */
|
|
98
|
+
restore: () => Promise<boolean>;
|
|
99
|
+
/** Refresh subscription status */
|
|
100
|
+
refresh: () => Promise<void>;
|
|
101
|
+
/** Clear error state */
|
|
102
|
+
clearError: () => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Provider configuration
|
|
106
|
+
*/
|
|
107
|
+
export interface SubscriptionProviderConfig {
|
|
108
|
+
/** RevenueCat API key */
|
|
109
|
+
apiKey: string;
|
|
110
|
+
/** Entitlement identifier to check for active subscription */
|
|
111
|
+
entitlementId: string;
|
|
112
|
+
/** Optional user email for RevenueCat */
|
|
113
|
+
userEmail?: string;
|
|
114
|
+
/** Error callback */
|
|
115
|
+
onError?: (error: Error) => void;
|
|
116
|
+
/** Success callback after purchase */
|
|
117
|
+
onPurchaseSuccess?: (productId: string) => void;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,qBAAqB,CAAC,EAAE,IAAI,CAAC;IAC7B,2CAA2C;IAC3C,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yBAAyB;IACzB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,kCAAkC;IAClC,mBAAmB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC/C,8BAA8B;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,0CAA0C;IAC1C,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,8BAA8B;IAC9B,QAAQ,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,iCAAiC;IACjC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,kCAAkC;IAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,wBAAwB;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sudobility/subscription-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Subscription UI components for React with RevenueCat integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.umd.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.esm.js",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc && vite build",
|
|
22
|
+
"dev": "vite build --watch",
|
|
23
|
+
"type-check": "tsc --noEmit",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"react",
|
|
29
|
+
"components",
|
|
30
|
+
"subscription",
|
|
31
|
+
"revenuecat",
|
|
32
|
+
"payment",
|
|
33
|
+
"billing",
|
|
34
|
+
"saas",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"author": "John Q Huang",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@heroicons/react": "^2.2.0",
|
|
41
|
+
"@revenuecat/purchases-js": "^1.0.0",
|
|
42
|
+
"@sudobility/components": "^4.0.36",
|
|
43
|
+
"@sudobility/design": "^1.1.14",
|
|
44
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
45
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@revenuecat/purchases-js": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@eslint/js": "^9.38.0",
|
|
54
|
+
"@heroicons/react": "^2.2.0",
|
|
55
|
+
"@revenuecat/purchases-js": "^1.5.0",
|
|
56
|
+
"@sudobility/components": "^4.0.36",
|
|
57
|
+
"@sudobility/design": "^1.1.14",
|
|
58
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
59
|
+
"@testing-library/react": "^14.2.1",
|
|
60
|
+
"@types/node": "^24.7.1",
|
|
61
|
+
"@types/react": "^19.2.2",
|
|
62
|
+
"@types/react-dom": "^19.2.2",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
64
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
65
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
66
|
+
"ajv": "^8.17.1",
|
|
67
|
+
"class-variance-authority": "^0.7.1",
|
|
68
|
+
"clsx": "^2.1.1",
|
|
69
|
+
"eslint": "^9.38.0",
|
|
70
|
+
"eslint-config-prettier": "^10.1.8",
|
|
71
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
72
|
+
"eslint-plugin-react-hooks": "^7.0.0",
|
|
73
|
+
"eslint-plugin-react-refresh": "^0.4.0",
|
|
74
|
+
"jsdom": "^24.0.0",
|
|
75
|
+
"prettier": "^3.6.2",
|
|
76
|
+
"react": "^19.2.0",
|
|
77
|
+
"react-dom": "^19.2.0",
|
|
78
|
+
"tailwind-merge": "^3.3.1",
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
|
+
"vite": "^7.1.12",
|
|
81
|
+
"vite-plugin-dts": "^4.5.4",
|
|
82
|
+
"vitest": "^1.3.1"
|
|
83
|
+
},
|
|
84
|
+
"publishConfig": {
|
|
85
|
+
"access": "public"
|
|
86
|
+
},
|
|
87
|
+
"optionalDependencies": {
|
|
88
|
+
"@rollup/rollup-linux-x64-gnu": "4.52.5",
|
|
89
|
+
"@rollup/rollup-linux-x64-musl": "4.52.5"
|
|
90
|
+
}
|
|
91
|
+
}
|