@sudobility/subscription-components 1.0.19 → 1.0.22
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +819 -698
- package/dist/index.umd.js +1 -1
- package/dist/subscription-layout.d.ts.map +1 -1
- package/dist/subscription-service.d.ts +125 -0
- package/dist/subscription-service.d.ts.map +1 -0
- package/dist/subscription-tile.d.ts +5 -1
- package/dist/subscription-tile.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(O,d){typeof exports=="object"&&typeof module<"u"?d(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"],d):(O=typeof globalThis<"u"?globalThis:O||self,d(O.SubscriptionComponents={},O.ReactJSXRuntime,O.SudobilityDesign,O.SudobilityComponents,O.React))})(this,(function(O,d,me,se,N){"use strict";function ye(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(r=ye(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function Ue(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=ye(e))&&(t&&(t+=" "),t+=o);return t}const qe=(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},Ke=(e,o)=>({classGroupId:e,validator:o}),ke=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),ne="-",ve=[],Ye="arbitrary..",Xe=e=>{const o=He(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Je(a);const f=a.split(ne),u=f[0]===""&&f.length>1?1:0;return Ce(f,u,o)},getConflictingClassGroupIds:(a,f)=>{if(f){const u=t[a],x=r[a];return u?x?qe(x,u):u:x||ve}return r[a]||ve}}},Ce=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],n=r.nextPart.get(s);if(n){const x=Ce(e,o+1,n);if(x)return x}const a=r.validators;if(a===null)return;const f=o===0?e.join(ne):e.slice(o).join(ne),u=a.length;for(let x=0;x<u;x++){const w=a[x];if(w.validator(f))return w.classGroupId}},Je=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?Ye+t:void 0})(),He=e=>{const{theme:o,classGroups:r}=e;return Qe(r,o)},Qe=(e,o)=>{const r=ke();for(const t in e){const s=e[t];fe(s,r,t,o)}return r},fe=(e,o,r,t)=>{const s=e.length;for(let n=0;n<s;n++){const a=e[n];Ze(a,o,r,t)}},Ze=(e,o,r,t)=>{if(typeof e=="string"){Re(e,o,r);return}if(typeof e=="function"){et(e,o,r,t);return}tt(e,o,r,t)},Re=(e,o,r)=>{const t=e===""?o:Se(o,e);t.classGroupId=r},et=(e,o,r,t)=>{if(rt(e)){fe(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(Ke(r,e))},tt=(e,o,r,t)=>{const s=Object.entries(e),n=s.length;for(let a=0;a<n;a++){const[f,u]=s[a];fe(u,Se(o,f),r,t)}},Se=(e,o)=>{let r=e;const t=o.split(ne),s=t.length;for(let n=0;n<s;n++){const a=t[n];let f=r.nextPart.get(a);f||(f=ke(),r.nextPart.set(a,f)),r=f}return r},rt=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ot=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(n,a)=>{r[n]=a,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(n){let a=r[n];if(a!==void 0)return a;if((a=t[n])!==void 0)return s(n,a),a},set(n,a){n in r?r[n]=a:s(n,a)}}},pe="!",Pe=":",st=[],ze=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),nt=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const n=[];let a=0,f=0,u=0,x;const w=s.length;for(let P=0;P<w;P++){const v=s[P];if(a===0&&f===0){if(v===Pe){n.push(s.slice(u,P)),u=P+1;continue}if(v==="/"){x=P;continue}}v==="["?a++:v==="]"?a--:v==="("?f++:v===")"&&f--}const I=n.length===0?s:s.slice(u);let y=I,k=!1;I.endsWith(pe)?(y=I.slice(0,-1),k=!0):I.startsWith(pe)&&(y=I.slice(1),k=!0);const L=x&&x>u?x-u:void 0;return ze(n,k,y,L)};if(o){const s=o+Pe,n=t;t=a=>a.startsWith(s)?n(a.slice(s.length)):ze(st,!1,a,void 0,!0)}if(r){const s=t;t=n=>r({className:n,parseClassName:s})}return t},at=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let n=0;n<r.length;n++){const a=r[n],f=a[0]==="[",u=o.has(a);f||u?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(a)):s.push(a)}return s.length>0&&(s.sort(),t.push(...s)),t}},it=e=>({cache:ot(e.cacheSize),parseClassName:nt(e),sortModifiers:at(e),...Xe(e)}),lt=/\s+/,ct=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:n}=o,a=[],f=e.trim().split(lt);let u="";for(let x=f.length-1;x>=0;x-=1){const w=f[x],{isExternal:I,modifiers:y,hasImportantModifier:k,baseClassName:L,maybePostfixModifierPosition:P}=r(w);if(I){u=w+(u.length>0?" "+u:u);continue}let v=!!P,j=t(v?L.substring(0,P):L);if(!j){if(!v){u=w+(u.length>0?" "+u:u);continue}if(j=t(L),!j){u=w+(u.length>0?" "+u:u);continue}v=!1}const $=y.length===0?"":y.length===1?y[0]:n(y).join(":"),E=k?$+pe:$,_=E+j;if(a.indexOf(_)>-1)continue;a.push(_);const z=s(j,v);for(let S=0;S<z.length;++S){const F=z[S];a.push(E+F)}u=w+(u.length>0?" "+u:u)}return u},dt=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=Ne(r))&&(s&&(s+=" "),s+=t);return s},Ne=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=Ne(e[t]))&&(r&&(r+=" "),r+=o);return r},ut=(e,...o)=>{let r,t,s,n;const a=u=>{const x=o.reduce((w,I)=>I(w),e());return r=it(x),t=r.cache.get,s=r.cache.set,n=f,f(u)},f=u=>{const x=t(u);if(x)return x;const w=ct(u,r);return s(u,w),w};return n=a,(...u)=>n(dt(...u))},mt=[],A=e=>{const o=r=>r[e]||mt;return o.isThemeGetter=!0,o},Ae=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ie=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ft=/^\d+\/\d+$/,pt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bt=/\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$/,gt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ht=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Q=e=>ft.test(e),b=e=>!!e&&!Number.isNaN(Number(e)),Y=e=>!!e&&Number.isInteger(Number(e)),be=e=>e.endsWith("%")&&b(e.slice(0,-1)),q=e=>pt.test(e),wt=()=>!0,yt=e=>bt.test(e)&&!gt.test(e),Me=()=>!1,kt=e=>ht.test(e),vt=e=>xt.test(e),Ct=e=>!i(e)&&!l(e),St=e=>Z(e,je,Me),i=e=>Ae.test(e),J=e=>Z(e,Ge,yt),ge=e=>Z(e,It,b),De=e=>Z(e,Ee,Me),Pt=e=>Z(e,Te,vt),ae=e=>Z(e,Le,kt),l=e=>Ie.test(e),re=e=>R(e,Ge),zt=e=>R(e,Mt),Oe=e=>R(e,Ee),Nt=e=>R(e,je),At=e=>R(e,Te),ie=e=>R(e,Le,!0),Z=(e,o,r)=>{const t=Ae.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},R=(e,o,r=!1)=>{const t=Ie.exec(e);return t?t[1]?o(t[1]):r:!1},Ee=e=>e==="position"||e==="percentage",Te=e=>e==="image"||e==="url",je=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",It=e=>e==="number",Mt=e=>e==="family-name",Le=e=>e==="shadow",Dt=ut(()=>{const e=A("color"),o=A("font"),r=A("text"),t=A("font-weight"),s=A("tracking"),n=A("leading"),a=A("breakpoint"),f=A("container"),u=A("spacing"),x=A("radius"),w=A("shadow"),I=A("inset-shadow"),y=A("text-shadow"),k=A("drop-shadow"),L=A("blur"),P=A("perspective"),v=A("aspect"),j=A("ease"),$=A("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[..._(),l,i],S=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],m=()=>[l,i,u],B=()=>[Q,"full","auto",...m()],ee=()=>[Y,"none","subgrid",l,i],te=()=>["auto",{span:["full",Y,l,i]},Y,l,i],M=()=>[Y,"auto",l,i],X=()=>["auto","min","max","fr",l,i],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],p=()=>["start","end","center","stretch","center-safe","end-safe"],h=()=>["auto",...m()],g=()=>[Q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...m()],c=()=>[e,l,i],G=()=>[..._(),Oe,De,{position:[l,i]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Nt,St,{size:[l,i]}],H=()=>[be,re,J],V=()=>["","none","full",x,l,i],W=()=>["",b,re,J],le=()=>["solid","dashed","dotted","double"],Be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>[b,be,Oe,De],We=()=>["","none",L,l,i],ce=()=>["none",b,l,i],de=()=>["none",b,l,i],we=()=>[b,l,i],ue=()=>[Q,"full",...m()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[wt],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[Ct],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",b],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Q,i,l,v]}],container:["container"],columns:[{columns:[b,i,l,f]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:z()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{start:B()}],end:[{end:B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[Y,"auto",l,i]}],basis:[{basis:[Q,"full","auto",f,...m()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[b,Q,"auto","initial","none",i]}],grow:[{grow:["",b,l,i]}],shrink:[{shrink:["",b,l,i]}],order:[{order:[Y,"first","last","none",l,i]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":X()}],"auto-rows":[{"auto-rows":X()}],gap:[{gap:m()}],"gap-x":[{"gap-x":m()}],"gap-y":[{"gap-y":m()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...p(),"normal"]}],"justify-self":[{"justify-self":["auto",...p()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...p(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...p(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...p(),"baseline"]}],"place-self":[{"place-self":["auto",...p()]}],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:h()}],mx:[{mx:h()}],my:[{my:h()}],ms:[{ms:h()}],me:[{me:h()}],mt:[{mt:h()}],mr:[{mr:h()}],mb:[{mb:h()}],ml:[{ml:h()}],"space-x":[{"space-x":m()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":m()}],"space-y-reverse":["space-y-reverse"],size:[{size:g()}],w:[{w:[f,"screen",...g()]}],"min-w":[{"min-w":[f,"screen","none",...g()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[a]},...g()]}],h:[{h:["screen","lh",...g()]}],"min-h":[{"min-h":["screen","lh","none",...g()]}],"max-h":[{"max-h":["screen","lh",...g()]}],"font-size":[{text:["base",r,re,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,l,ge]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",be,i]}],"font-family":[{font:[zt,i,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:[s,l,i]}],"line-clamp":[{"line-clamp":[b,"none",l,ge]}],leading:[{leading:[n,...m()]}],"list-image":[{"list-image":["none",l,i]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",l,i]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:c()}],"text-color":[{text:c()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[b,"from-font","auto",l,J]}],"text-decoration-color":[{decoration:c()}],"underline-offset":[{"underline-offset":[b,"auto",l,i]}],"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",l,i]}],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",l,i]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Y,l,i],radial:["",l,i],conic:[Y,l,i]},At,Pt]}],"bg-color":[{bg:c()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:c()}],"gradient-via":[{via:c()}],"gradient-to":[{to:c()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:c()}],"border-color-x":[{"border-x":c()}],"border-color-y":[{"border-y":c()}],"border-color-s":[{"border-s":c()}],"border-color-e":[{"border-e":c()}],"border-color-t":[{"border-t":c()}],"border-color-r":[{"border-r":c()}],"border-color-b":[{"border-b":c()}],"border-color-l":[{"border-l":c()}],"divide-color":[{divide:c()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[b,l,i]}],"outline-w":[{outline:["",b,re,J]}],"outline-color":[{outline:c()}],shadow:[{shadow:["","none",w,ie,ae]}],"shadow-color":[{shadow:c()}],"inset-shadow":[{"inset-shadow":["none",I,ie,ae]}],"inset-shadow-color":[{"inset-shadow":c()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:c()}],"ring-offset-w":[{"ring-offset":[b,J]}],"ring-offset-color":[{"ring-offset":c()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":c()}],"text-shadow":[{"text-shadow":["none",y,ie,ae]}],"text-shadow-color":[{"text-shadow":c()}],opacity:[{opacity:[b,l,i]}],"mix-blend":[{"mix-blend":[...Be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Be()}],"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":[b]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":c()}],"mask-image-linear-to-color":[{"mask-linear-to":c()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":c()}],"mask-image-t-to-color":[{"mask-t-to":c()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":c()}],"mask-image-r-to-color":[{"mask-r-to":c()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":c()}],"mask-image-b-to-color":[{"mask-b-to":c()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":c()}],"mask-image-l-to-color":[{"mask-l-to":c()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":c()}],"mask-image-x-to-color":[{"mask-x-to":c()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":c()}],"mask-image-y-to-color":[{"mask-y-to":c()}],"mask-image-radial":[{"mask-radial":[l,i]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":c()}],"mask-image-radial-to-color":[{"mask-radial-to":c()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[b]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":c()}],"mask-image-conic-to-color":[{"mask-conic-to":c()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",l,i]}],filter:[{filter:["","none",l,i]}],blur:[{blur:We()}],brightness:[{brightness:[b,l,i]}],contrast:[{contrast:[b,l,i]}],"drop-shadow":[{"drop-shadow":["","none",k,ie,ae]}],"drop-shadow-color":[{"drop-shadow":c()}],grayscale:[{grayscale:["",b,l,i]}],"hue-rotate":[{"hue-rotate":[b,l,i]}],invert:[{invert:["",b,l,i]}],saturate:[{saturate:[b,l,i]}],sepia:[{sepia:["",b,l,i]}],"backdrop-filter":[{"backdrop-filter":["","none",l,i]}],"backdrop-blur":[{"backdrop-blur":We()}],"backdrop-brightness":[{"backdrop-brightness":[b,l,i]}],"backdrop-contrast":[{"backdrop-contrast":[b,l,i]}],"backdrop-grayscale":[{"backdrop-grayscale":["",b,l,i]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b,l,i]}],"backdrop-invert":[{"backdrop-invert":["",b,l,i]}],"backdrop-opacity":[{"backdrop-opacity":[b,l,i]}],"backdrop-saturate":[{"backdrop-saturate":[b,l,i]}],"backdrop-sepia":[{"backdrop-sepia":["",b,l,i]}],"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",l,i]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[b,"initial",l,i]}],ease:[{ease:["linear","initial",j,l,i]}],delay:[{delay:[b,l,i]}],animate:[{animate:["none",$,l,i]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[P,l,i]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[l,i,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],accent:[{accent:c()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:c()}],"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",l,i]}],"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",l,i]}],fill:[{fill:["none",...c()]}],"stroke-w":[{stroke:[b,re,J,ge]}],stroke:[{stroke:["none",...c()]}],"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 C(...e){return Dt(Ue(e))}const Ot={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},_e=({id:e,title:o,price:r,periodLabel:t,features:s,isSelected:n,onSelect:a,topBadge:f,discountBadge:u,premiumCallout:x,bottomNote:w,introPriceNote:I,isBestValue:y=!1,ctaButton:k,className:L,children:P,disabled:v=!1,ariaLabel:j,onTrack:$,trackingLabel:E,componentName:_="SubscriptionTile",hideSelectionIndicator:z=!1})=>{const S=!!k,F=!z,m=n?"bg-blue-600 text-white ring-4 ring-blue-600 ring-offset-4 ring-offset-white dark:ring-offset-gray-900 border-transparent":"bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md",B=()=>{!v&&!S&&($?.({action:"select",trackingLabel:E,componentName:_}),a())},ee=M=>{!v&&!S&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),$?.({action:"select",trackingLabel:E,componentName:_}),a())},te=M=>{M.stopPropagation(),$?.({action:"cta_click",trackingLabel:E,componentName:_}),k?.onClick&&k.onClick()};return d.jsxs("div",{className:C("relative rounded-2xl p-6 transition-all flex flex-col h-full",v?"opacity-50 cursor-not-allowed":S?"cursor-default":"cursor-pointer",m,L),onClick:B,onKeyDown:ee,role:S?"article":"radio","aria-checked":S?void 0:n,"aria-label":j||`${o} - ${r}${t||""}`,"aria-disabled":v,tabIndex:S||v?-1:0,children:[f&&d.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:d.jsx("span",{className:C(Ot[f.color],"text-white px-4 py-1.5 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:f.text})}),d.jsxs("div",{className:"flex-1 flex flex-col",children:[d.jsxs("div",{className:C("text-center mb-6",f&&"mt-2"),children:[d.jsx("h3",{className:C(me.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),d.jsxs("div",{className:"mb-3",children:[d.jsx("span",{className:C("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:r}),t&&d.jsx("span",{className:C("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:t})]}),u&&d.jsx("div",{className:C("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:u.text})]}),P,s.length>0&&d.jsx("div",{className:"space-y-3 mb-6",children:s.map((M,X)=>d.jsxs("div",{className:"flex items-start",children:[d.jsx("svg",{className:C("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),d.jsx("span",{className:C("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:M.replace(/^✓\s*/,"")})]},X))}),x&&d.jsxs("div",{className:C("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[d.jsx("div",{className:"flex items-center mb-2",children:d.jsx("span",{className:C("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:x.title})}),d.jsx("ul",{className:C("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:x.features.map((M,X)=>d.jsxs("li",{children:["• ",M]},X))})]}),w&&d.jsx("div",{className:C("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:w}),I&&d.jsx("div",{className:C("p-3 rounded-lg",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:d.jsx("p",{className:C("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:I})})]}),d.jsxs("div",{className:"h-14 flex-shrink-0 flex items-end justify-center",children:[F&&S&&d.jsx("div",{className:"w-full",children:k.href?d.jsx("a",{href:k.href,className:C("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:M=>M.stopPropagation(),children:k.label}):d.jsx("button",{onClick:te,disabled:v,className:C("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",v&&"opacity-50 cursor-not-allowed"),children:k.label})}),F&&!S&&d.jsx("div",{className:C("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&d.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})]})]})},Et=({title:e,children:o,error:r,variant:t="selection",currentStatus:s,primaryAction:n,secondaryAction:a,minTileWidth:f=240,className:u,headerContent:x,aboveProducts:w,footerContent:I,currentStatusLabel:y="Current Status",freeTileConfig:k,onTrack:L,trackingLabel:P,componentName:v="SubscriptionLayout"})=>{const j=t==="selection"&&n,$=()=>{L?.({action:"primary_action",trackingLabel:P,componentName:v}),n?.onClick()},E=()=>{L?.({action:"secondary_action",trackingLabel:P,componentName:v}),a?.onClick()},_=t==="cta"&&k,z={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${f}px), 1fr))`,gap:"1.5rem"};return d.jsx(se.Card,{className:u,children:d.jsxs(se.CardContent,{className:"pt-6",children:[x,s&&d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:C(me.textVariants.heading.h3(),"mb-4"),children:y}),s.isActive?d.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:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((S,F)=>d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:S.label}),d.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:S.value})]},F))})]}):d.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:[d.jsxs("div",{className:"flex items-center mb-2",children:[d.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),d.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&d.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),d.jsx("h2",{className:C(me.textVariants.heading.h3(),"mb-4"),children:e}),w,d.jsxs("div",{style:z,children:[_&&d.jsx(_e,{id:"free",title:k.title,price:k.price,periodLabel:k.periodLabel,features:k.features,isSelected:!1,onSelect:()=>{},topBadge:k.topBadge,ctaButton:k.ctaButton}),o]}),I,r&&d.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:d.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),j&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[a&&d.jsx(se.Button,{onClick:E,disabled:a.disabled||a.loading,variant:"outline",className:"sm:flex-shrink-0",children:a.label}),d.jsx(se.Button,{onClick:$,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})})};function Tt({options:e,value:o,onChange:r,className:t,disabled:s=!1,size:n="md"}){const a={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return d.jsx("div",{className:C("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",t),role:"radiogroup",children:e.map(f=>{const u=o===f.value;return d.jsx("button",{type:"button",role:"radio","aria-checked":u,disabled:s,onClick:()=>!s&&r(f.value),className:C(a[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",u?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:f.label},f.value)})})}let he=null;const jt=async()=>(he||(he=await import("@revenuecat/purchases-js")),he);let T=null;const Fe=(e,o)=>{const r=e.rcBillingProduct,t=r?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:r?.identifier||void 0,price:r?.currentPrice?.amountMicros?(r.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:r?.currentPrice?.formattedPrice||"$0",title:r?.title||e.identifier,description:r?.description||"",period:r?.normalPeriodDuration||void 0,introPrice:t?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:t?.introPrice?.price?.amountMicros?(t.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:t?.introPrice?.periodDuration||void 0,introPriceCycles:t?.introPrice?.cycleCount||void 0,freeTrialPeriod:t?.trial?.periodDuration||void 0,entitlement:s}},xe=e=>{const o=Object.keys(e.entitlements.active);if(o.length>0){const r=o[0],t=e.entitlements.active[r];return{isActive:!0,expirationDate:t.expirationDate?new Date(t.expirationDate):void 0,purchaseDate:t.latestPurchaseDate?new Date(t.latestPurchaseDate):void 0,productIdentifier:t.productIdentifier,willRenew:t.willRenew,isSandbox:t.isSandbox,unsubscribeDetectedAt:t.unsubscribeDetectedAt?new Date(t.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:t.billingIssueDetectedAt?new Date(t.billingIssueDetectedAt):void 0,activeEntitlements:o}}return{isActive:!1}},Ve=N.createContext(void 0),Gt=({apiKey:e,userEmail:o,onError:r,onPurchaseSuccess:t,children:s})=>{const[n,a]=N.useState([]),[f,u]=N.useState(null),[x,w]=N.useState(!1),[I,y]=N.useState(null),[k,L]=N.useState(!1),[P,v]=N.useState(null),[j,$]=N.useState(null),[E,_]=N.useState(null),z=!e||e==="your_revenuecat_api_key_here",S=N.useCallback(()=>{a([]),u(null),$(null),_(null),y(null),L(!1),v(null),T=null},[]),F=N.useCallback(async()=>{if(T)try{const p=await T.getOfferings();p.current&&$(p.current);const h=p.all;if(h){_(h);const g=[];for(const c of Object.keys(h)){const G=h[c];if(G?.availablePackages){const K=G.metadata,U=G.availablePackages.map(H=>Fe(H,K));g.push(...U)}}a(g)}else if(p.current){const g=p.current.metadata,c=p.current.availablePackages.map(G=>Fe(G,g));a(c)}}catch(p){const h=p instanceof Error?p.message:"Failed to load offerings";y(h),r?.(p instanceof Error?p:new Error(h))}},[r]),m=N.useCallback(async()=>{if(T)try{const p=await T.getCustomerInfo(),h=xe(p);u(h.isActive?h:null)}catch(p){const h=p instanceof Error?p.message:"Failed to load subscription status";y(h),r?.(p instanceof Error?p:new Error(h))}},[r]),B=N.useCallback(async(p,h)=>{if(P&&P!==p&&S(),!(k&&P===p))try{if(w(!0),y(null),z)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),a([]),u(null);else{const g=await jt(),c={apiKey:e,appUserId:p};T=g.Purchases.configure(c);const G=h||o;if(G&&T)try{await T.setAttributes({email:G})}catch{}await Promise.all([F(),m()])}v(p),L(!0)}catch(g){const c=g instanceof Error?g.message:"Failed to initialize";y(c),u(null),a([]),r?.(g instanceof Error?g:new Error(c))}finally{w(!1)}},[P,k,z,e,o,F,m,r,S]),ee=N.useCallback(async(p,h)=>{try{if(w(!0),y(null),z){await new Promise(U=>setTimeout(U,2e3));const K={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:p,willRenew:!0};return u(K),t?.(p),!0}if(!T||!j&&!E)throw new Error("Subscription service not initialized");let g;if(E)for(const K of Object.keys(E)){const U=E[K];if(U?.availablePackages&&(g=U.availablePackages.find(H=>H.identifier===p),g))break}else j&&(g=j.availablePackages.find(U=>U.identifier===p));if(!g)throw new Error(`Package not found: ${p}`);const c=await T.purchase({rcPackage:g,...o?{customerEmail:o}:{}}),G=xe(c.customerInfo);return u(G.isActive?G:null),G.isActive&&t?.(p),G.isActive}catch(g){const c=g instanceof Error?g.message:"Purchase failed";return y(c),r?.(g instanceof Error?g:new Error(c)),!1}finally{w(!1)}},[z,j,E,o,t,r]),te=N.useCallback(async p=>{try{if(w(!0),y(null),z)return await new Promise(c=>setTimeout(c,1e3)),y("No previous purchases found"),!1;if(!T)throw new Error("Subscription service not initialized");const h=await T.getCustomerInfo(),g=xe(h);return u(g.isActive?g:null),g.isActive||y("No previous purchases found"),g.isActive}catch(h){const g=h instanceof Error?h.message:"Restore failed";return y(g),r?.(h instanceof Error?h:new Error(g)),!1}finally{w(!1)}},[z,r]),M=N.useCallback(async()=>{if(!z)try{y(null),await Promise.all([m(),F()])}catch(p){const h=p instanceof Error?p.message:"Refresh failed";y(h),r?.(p instanceof Error?p:new Error(h))}},[z,m,F,r]),X=N.useCallback(()=>{y(null)},[]);N.useEffect(()=>{if(!k||z||!T)return;const p=setInterval(()=>{m().catch(()=>{})},300*1e3);return()=>clearInterval(p)},[k,z,m]);const oe={products:n,currentSubscription:f,isLoading:x,error:I,initialize:B,purchase:ee,restore:te,refresh:M,clearError:X};return d.jsx(Ve.Provider,{value:oe,children:s})},Lt=()=>{const e=N.useContext(Ve);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{}},_t=()=>{try{T&&(T.close(),T=null),$e()}catch{}};O.SegmentedControl=Tt,O.SubscriptionLayout=Et,O.SubscriptionProvider=Gt,O.SubscriptionTile=_e,O.clearRevenueCatCheckoutSessions=$e,O.closeRevenueCatInstance=_t,O.cn=C,O.useSubscriptionContext=Lt,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(A,u){typeof exports=="object"&&typeof module<"u"?u(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"],u):(A=typeof globalThis<"u"?globalThis:A||self,u(A.SubscriptionComponents={},A.ReactJSXRuntime,A.SudobilityDesign,A.SudobilityComponents,A.React))})(this,(function(A,u,ue,ye,I){"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 s=e.length;for(o=0;o<s;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 qe(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=we(e))&&(t&&(t+=" "),t+=o);return t}const Ke=(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},Ye=(e,o)=>({classGroupId:e,validator:o}),ve=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),se="-",ke=[],Xe="arbitrary..",Je=e=>{const o=He(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Re(i);const p=i.split(se),c=p[0]===""&&p.length>1?1:0;return Ce(p,c,o)},getConflictingClassGroupIds:(i,p)=>{if(p){const c=t[i],x=r[i];return c?x?Ke(x,c):c:x||ke}return r[i]||ke}}},Ce=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],n=r.nextPart.get(s);if(n){const x=Ce(e,o+1,n);if(x)return x}const i=r.validators;if(i===null)return;const p=o===0?e.join(se):e.slice(o).join(se),c=i.length;for(let x=0;x<c;x++){const y=i[x];if(y.validator(p))return y.classGroupId}},Re=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?Xe+t:void 0})(),He=e=>{const{theme:o,classGroups:r}=e;return Qe(r,o)},Qe=(e,o)=>{const r=ve();for(const t in e){const s=e[t];fe(s,r,t,o)}return r},fe=(e,o,r,t)=>{const s=e.length;for(let n=0;n<s;n++){const i=e[n];Ze(i,o,r,t)}},Ze=(e,o,r,t)=>{if(typeof e=="string"){et(e,o,r);return}if(typeof e=="function"){tt(e,o,r,t);return}rt(e,o,r,t)},et=(e,o,r)=>{const t=e===""?o:Pe(o,e);t.classGroupId=r},tt=(e,o,r,t)=>{if(ot(e)){fe(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(Ye(r,e))},rt=(e,o,r,t)=>{const s=Object.entries(e),n=s.length;for(let i=0;i<n;i++){const[p,c]=s[i];fe(c,Pe(o,p),r,t)}},Pe=(e,o)=>{let r=e;const t=o.split(se),s=t.length;for(let n=0;n<s;n++){const i=t[n];let p=r.nextPart.get(i);p||(p=ve(),r.nextPart.set(i,p)),r=p}return r},ot=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,st=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(n,i)=>{r[n]=i,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(n){let i=r[n];if(i!==void 0)return i;if((i=t[n])!==void 0)return s(n,i),i},set(n,i){n in r?r[n]=i:s(n,i)}}},me="!",Se=":",nt=[],ze=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),it=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const n=[];let i=0,p=0,c=0,x;const y=s.length;for(let S=0;S<y;S++){const z=s[S];if(i===0&&p===0){if(z===Se){n.push(s.slice(c,S)),c=S+1;continue}if(z==="/"){x=S;continue}}z==="["?i++:z==="]"?i--:z==="("?p++:z===")"&&p--}const O=n.length===0?s:s.slice(c);let w=O,C=!1;O.endsWith(me)?(w=O.slice(0,-1),C=!0):O.startsWith(me)&&(w=O.slice(1),C=!0);const P=x&&x>c?x-c:void 0;return ze(n,C,w,P)};if(o){const s=o+Se,n=t;t=i=>i.startsWith(s)?n(i.slice(s.length)):ze(nt,!1,i,void 0,!0)}if(r){const s=t;t=n=>r({className:n,parseClassName:s})}return t},at=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let n=0;n<r.length;n++){const i=r[n],p=i[0]==="[",c=o.has(i);p||c?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(i)):s.push(i)}return s.length>0&&(s.sort(),t.push(...s)),t}},lt=e=>({cache:st(e.cacheSize),parseClassName:it(e),sortModifiers:at(e),...Je(e)}),ct=/\s+/,dt=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:n}=o,i=[],p=e.trim().split(ct);let c="";for(let x=p.length-1;x>=0;x-=1){const y=p[x],{isExternal:O,modifiers:w,hasImportantModifier:C,baseClassName:P,maybePostfixModifierPosition:S}=r(y);if(O){c=y+(c.length>0?" "+c:c);continue}let z=!!S,D=t(z?P.substring(0,S):P);if(!D){if(!z){c=y+(c.length>0?" "+c:c);continue}if(D=t(P),!D){c=y+(c.length>0?" "+c:c);continue}z=!1}const $=w.length===0?"":w.length===1?w[0]:n(w).join(":"),G=C?$+me:$,L=G+D;if(i.indexOf(L)>-1)continue;i.push(L);const k=s(D,z);for(let E=0;E<k.length;++E){const F=k[E];i.push(G+F)}c=y+(c.length>0?" "+c:c)}return c},ut=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=Ae(r))&&(s&&(s+=" "),s+=t);return s},Ae=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=Ae(e[t]))&&(r&&(r+=" "),r+=o);return r},ft=(e,...o)=>{let r,t,s,n;const i=c=>{const x=o.reduce((y,O)=>O(y),e());return r=lt(x),t=r.cache.get,s=r.cache.set,n=p,p(c)},p=c=>{const x=t(c);if(x)return x;const y=dt(c,r);return s(c,y),y};return n=i,(...c)=>n(ut(...c))},mt=[],N=e=>{const o=r=>r[e]||mt;return o.isThemeGetter=!0,o},Ie=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pt=/^\d+\/\d+$/,bt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gt=/\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$/,ht=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Q=e=>pt.test(e),g=e=>!!e&&!Number.isNaN(Number(e)),Y=e=>!!e&&Number.isInteger(Number(e)),pe=e=>e.endsWith("%")&&g(e.slice(0,-1)),q=e=>bt.test(e),wt=()=>!0,vt=e=>gt.test(e)&&!ht.test(e),De=()=>!1,kt=e=>xt.test(e),Ct=e=>yt.test(e),Pt=e=>!a(e)&&!l(e),St=e=>Z(e,je,De),a=e=>Ie.test(e),J=e=>Z(e,Ge,vt),be=e=>Z(e,Dt,g),Oe=e=>Z(e,Ee,De),zt=e=>Z(e,Te,Ct),ne=e=>Z(e,Le,kt),l=e=>Ne.test(e),oe=e=>ee(e,Ge),At=e=>ee(e,Ot),Me=e=>ee(e,Ee),It=e=>ee(e,je),Nt=e=>ee(e,Te),ie=e=>ee(e,Le,!0),Z=(e,o,r)=>{const t=Ie.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},ee=(e,o,r=!1)=>{const t=Ne.exec(e);return t?t[1]?o(t[1]):r:!1},Ee=e=>e==="position"||e==="percentage",Te=e=>e==="image"||e==="url",je=e=>e==="length"||e==="size"||e==="bg-size",Ge=e=>e==="length",Dt=e=>e==="number",Ot=e=>e==="family-name",Le=e=>e==="shadow",Mt=ft(()=>{const e=N("color"),o=N("font"),r=N("text"),t=N("font-weight"),s=N("tracking"),n=N("leading"),i=N("breakpoint"),p=N("container"),c=N("spacing"),x=N("radius"),y=N("shadow"),O=N("inset-shadow"),w=N("text-shadow"),C=N("drop-shadow"),P=N("blur"),S=N("perspective"),z=N("aspect"),D=N("ease"),$=N("animate"),G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...L(),l,a],E=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],f=()=>[l,a,c],V=()=>[Q,"full","auto",...f()],U=()=>[Y,"none","subgrid",l,a],te=()=>["auto",{span:["full",Y,l,a]},Y,l,a],X=()=>[Y,"auto",l,a],re=()=>["auto","min","max","fr",l,a],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],m=()=>["start","end","center","stretch","center-safe","end-safe"],b=()=>["auto",...f()],h=()=>[Q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...f()],d=()=>[e,l,a],j=()=>[...L(),Me,Oe,{position:[l,a]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",It,St,{size:[l,a]}],H=()=>[pe,oe,J],_=()=>["","none","full",x,l,a],B=()=>["",g,oe,J],ae=()=>["solid","dashed","dotted","double"],We=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[g,pe,Me,Oe],Ue=()=>["","none",P,l,a],le=()=>["none",g,l,a],ce=()=>["none",g,l,a],xe=()=>[g,l,a],de=()=>[Q,"full",...f()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[q],breakpoint:[q],color:[wt],container:[q],"drop-shadow":[q],ease:["in","out","in-out"],font:[Pt],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[q],shadow:[q],spacing:["px",g],text:[q],"text-shadow":[q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Q,a,l,z]}],container:["container"],columns:[{columns:[g,a,l,p]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"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:k()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],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:[Y,"auto",l,a]}],basis:[{basis:[Q,"full","auto",p,...f()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[g,Q,"auto","initial","none",a]}],grow:[{grow:["",g,l,a]}],shrink:[{shrink:["",g,l,a]}],order:[{order:[Y,"first","last","none",l,a]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:te()}],"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":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:f()}],"gap-x":[{"gap-x":f()}],"gap-y":[{"gap-y":f()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...m(),"normal"]}],"justify-self":[{"justify-self":["auto",...m()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...m(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...m(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...m(),"baseline"]}],"place-self":[{"place-self":["auto",...m()]}],p:[{p:f()}],px:[{px:f()}],py:[{py:f()}],ps:[{ps:f()}],pe:[{pe:f()}],pt:[{pt:f()}],pr:[{pr:f()}],pb:[{pb:f()}],pl:[{pl:f()}],m:[{m:b()}],mx:[{mx:b()}],my:[{my:b()}],ms:[{ms:b()}],me:[{me:b()}],mt:[{mt:b()}],mr:[{mr:b()}],mb:[{mb:b()}],ml:[{ml:b()}],"space-x":[{"space-x":f()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":f()}],"space-y-reverse":["space-y-reverse"],size:[{size:h()}],w:[{w:[p,"screen",...h()]}],"min-w":[{"min-w":[p,"screen","none",...h()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[i]},...h()]}],h:[{h:["screen","lh",...h()]}],"min-h":[{"min-h":["screen","lh","none",...h()]}],"max-h":[{"max-h":["screen","lh",...h()]}],"font-size":[{text:["base",r,oe,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,l,be]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pe,a]}],"font-family":[{font:[At,a,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:[s,l,a]}],"line-clamp":[{"line-clamp":[g,"none",l,be]}],leading:[{leading:[n,...f()]}],"list-image":[{"list-image":["none",l,a]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",l,a]}],"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",l,J]}],"text-decoration-color":[{decoration:d()}],"underline-offset":[{"underline-offset":[g,"auto",l,a]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:f()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",l,a]}],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",l,a]}],"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:K()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Y,l,a],radial:["",l,a],conic:[Y,l,a]},Nt,zt]}],"bg-color":[{bg:d()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:d()}],"gradient-via":[{via:d()}],"gradient-to":[{to:d()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"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,l,a]}],"outline-w":[{outline:["",g,oe,J]}],"outline-color":[{outline:d()}],shadow:[{shadow:["","none",y,ie,ne]}],"shadow-color":[{shadow:d()}],"inset-shadow":[{"inset-shadow":["none",O,ie,ne]}],"inset-shadow-color":[{"inset-shadow":d()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:d()}],"ring-offset-w":[{"ring-offset":[g,J]}],"ring-offset-color":[{"ring-offset":d()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":d()}],"text-shadow":[{"text-shadow":["none",w,ie,ne]}],"text-shadow-color":[{"text-shadow":d()}],opacity:[{opacity:[g,l,a]}],"mix-blend":[{"mix-blend":[...We(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":We()}],"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":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"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":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"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":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"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":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"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":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"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":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"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":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":d()}],"mask-image-y-to-color":[{"mask-y-to":d()}],"mask-image-radial":[{"mask-radial":[l,a]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[g]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"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:K()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",l,a]}],filter:[{filter:["","none",l,a]}],blur:[{blur:Ue()}],brightness:[{brightness:[g,l,a]}],contrast:[{contrast:[g,l,a]}],"drop-shadow":[{"drop-shadow":["","none",C,ie,ne]}],"drop-shadow-color":[{"drop-shadow":d()}],grayscale:[{grayscale:["",g,l,a]}],"hue-rotate":[{"hue-rotate":[g,l,a]}],invert:[{invert:["",g,l,a]}],saturate:[{saturate:[g,l,a]}],sepia:[{sepia:["",g,l,a]}],"backdrop-filter":[{"backdrop-filter":["","none",l,a]}],"backdrop-blur":[{"backdrop-blur":Ue()}],"backdrop-brightness":[{"backdrop-brightness":[g,l,a]}],"backdrop-contrast":[{"backdrop-contrast":[g,l,a]}],"backdrop-grayscale":[{"backdrop-grayscale":["",g,l,a]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g,l,a]}],"backdrop-invert":[{"backdrop-invert":["",g,l,a]}],"backdrop-opacity":[{"backdrop-opacity":[g,l,a]}],"backdrop-saturate":[{"backdrop-saturate":[g,l,a]}],"backdrop-sepia":[{"backdrop-sepia":["",g,l,a]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":f()}],"border-spacing-x":[{"border-spacing-x":f()}],"border-spacing-y":[{"border-spacing-y":f()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",l,a]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[g,"initial",l,a]}],ease:[{ease:["linear","initial",D,l,a]}],delay:[{delay:[g,l,a]}],animate:[{animate:["none",$,l,a]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,l,a]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[l,a,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"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",l,a]}],"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":f()}],"scroll-mx":[{"scroll-mx":f()}],"scroll-my":[{"scroll-my":f()}],"scroll-ms":[{"scroll-ms":f()}],"scroll-me":[{"scroll-me":f()}],"scroll-mt":[{"scroll-mt":f()}],"scroll-mr":[{"scroll-mr":f()}],"scroll-mb":[{"scroll-mb":f()}],"scroll-ml":[{"scroll-ml":f()}],"scroll-p":[{"scroll-p":f()}],"scroll-px":[{"scroll-px":f()}],"scroll-py":[{"scroll-py":f()}],"scroll-ps":[{"scroll-ps":f()}],"scroll-pe":[{"scroll-pe":f()}],"scroll-pt":[{"scroll-pt":f()}],"scroll-pr":[{"scroll-pr":f()}],"scroll-pb":[{"scroll-pb":f()}],"scroll-pl":[{"scroll-pl":f()}],"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",l,a]}],fill:[{fill:["none",...d()]}],"stroke-w":[{stroke:[g,oe,J,be]}],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 v(...e){return Mt(qe(e))}const Et={purple:"bg-purple-500",green:"bg-green-500",blue:"bg-blue-500",yellow:"bg-yellow-400 !text-yellow-900",red:"bg-red-500"},_e=({id:e,title:o,price:r,periodLabel:t,features:s,isSelected:n,onSelect:i,isCurrentPlan:p=!1,topBadge:c,discountBadge:x,premiumCallout:y,bottomNote:O,introPriceNote:w,isBestValue:C=!1,ctaButton:P,className:S,children:z,disabled:D=!1,enabled:$=!0,ariaLabel:G,onTrack:L,trackingLabel:k,componentName:E="SubscriptionTile",hideSelectionIndicator:F=!1})=>{const f=!!P,V=!F&&!p&&$,U=$&&!p&&!D,te=n?"bg-blue-600 text-white border-2 border-blue-600 shadow-md":p?"bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-400 shadow-md":$?"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 shadow-md hover:border-gray-300 dark:hover:border-gray-600":"bg-gray-100 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 opacity-50 shadow-md",X=()=>{U&&!f&&(L?.({action:"select",trackingLabel:k,componentName:E}),i())},re=m=>{U&&!f&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),L?.({action:"select",trackingLabel:k,componentName:E}),i())},R=m=>{m.stopPropagation(),L?.({action:"cta_click",trackingLabel:k,componentName:E}),P?.onClick&&P.onClick()};return u.jsxs("div",{className:v("relative rounded-2xl p-6 transition-all flex flex-col h-full",!U||f?"cursor-default":"cursor-pointer",D&&"cursor-not-allowed",te,S),onClick:X,onKeyDown:re,role:f?"article":"radio","aria-checked":f?void 0:n,"aria-label":G||`${o} - ${r}${t||""}`,"aria-disabled":!U,tabIndex:f||!U?-1:0,children:[c&&u.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:u.jsx("span",{className:v(Et[c.color],"text-white px-4 py-1.5 rounded-full text-sm font-semibold shadow-lg whitespace-nowrap"),children:c.text})}),u.jsxs("div",{className:"flex-1 flex flex-col",children:[u.jsxs("div",{className:v("text-center mb-6",c&&"mt-2"),children:[u.jsx("h3",{className:v(ue.textVariants.heading.h4(),"mb-2",n?"text-white":""),children:o}),u.jsxs("div",{className:"mb-3",children:[u.jsx("span",{className:v("text-4xl font-bold",n?"text-white":"text-gray-900 dark:text-gray-100"),children:r}),t&&u.jsx("span",{className:v("text-lg",n?"text-blue-100":"text-gray-500 dark:text-gray-400"),children:t})]}),x&&u.jsx("div",{className:v("inline-flex items-center px-2 py-1 rounded-full text-sm font-semibold",n?"bg-blue-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"),children:x.text})]}),z,s.length>0&&u.jsx("div",{className:"space-y-3 mb-6",children:s.map((m,b)=>u.jsxs("div",{className:"flex items-start",children:[u.jsx("svg",{className:v("w-5 h-5 mr-3 flex-shrink-0",n?"text-blue-200":"text-green-500"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),u.jsx("span",{className:v("text-sm text-left",n?"text-white":"text-gray-700 dark:text-gray-300"),children:m.replace(/^✓\s*/,"")})]},b))}),y&&u.jsxs("div",{className:v("rounded-lg p-4 mb-4",n?"bg-blue-500/30":"bg-gradient-to-r from-purple-50 to-blue-50 dark:from-purple-900/20 dark:to-blue-900/20"),children:[u.jsx("div",{className:"flex items-center mb-2",children:u.jsx("span",{className:v("font-semibold text-sm",n?"text-white":"text-purple-600 dark:text-purple-400"),children:y.title})}),u.jsx("ul",{className:v("text-xs space-y-1",n?"text-blue-100":"text-gray-600 dark:text-gray-400"),children:y.features.map((m,b)=>u.jsxs("li",{children:["• ",m]},b))})]}),O&&u.jsx("div",{className:v("text-center text-sm font-medium mb-4",n?"text-blue-100":"text-blue-600 dark:text-blue-400"),children:O}),w&&u.jsx("div",{className:v("p-3 rounded-lg",n?"bg-blue-500/30":"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800"),children:u.jsx("p",{className:v("text-sm font-semibold text-center",n?"text-white":"text-yellow-700 dark:text-yellow-300"),children:w})})]}),u.jsxs("div",{className:"h-14 flex-shrink-0 flex items-end justify-center",children:[V&&f&&u.jsx("div",{className:"w-full",children:P.href?u.jsx("a",{href:P.href,className:v("block w-full py-3 font-semibold rounded-lg text-center transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700"),onClick:m=>m.stopPropagation(),children:P.label}):u.jsx("button",{onClick:R,disabled:D,className:v("w-full py-3 font-semibold rounded-lg transition-colors",n?"bg-white text-blue-600 hover:bg-gray-100":"bg-blue-600 text-white hover:bg-blue-700",D&&"opacity-50 cursor-not-allowed"),children:P.label})}),V&&!f&&u.jsx("div",{className:v("w-5 h-5 rounded-full border-2 flex items-center justify-center",n?"border-white bg-white":"border-gray-300 dark:border-gray-600"),children:n&&u.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})})]})]})},Tt=({title:e,children:o,error:r,variant:t="selection",currentStatus:s,primaryAction:n,secondaryAction:i,minTileWidth:p=240,className:c,headerContent:x,aboveProducts:y,footerContent:O,currentStatusLabel:w="Current Status",freeTileConfig:C,onTrack:P,trackingLabel:S,componentName:z="SubscriptionLayout"})=>{const D=t==="selection"&&n,$=()=>{P?.({action:"primary_action",trackingLabel:S,componentName:z}),n?.onClick()},G=()=>{P?.({action:"secondary_action",trackingLabel:S,componentName:z}),i?.onClick()},L=t==="cta"&&C,k={display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${p}px), 1fr))`,gap:"1.5rem"};return u.jsxs("div",{className:c,children:[x,s&&u.jsxs(u.Fragment,{children:[u.jsx("h2",{className:v(ue.textVariants.heading.h3(),"mb-4"),children:w}),s.isActive?u.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:[u.jsxs("div",{className:"flex items-center mb-2",children:[u.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-3"}),u.jsx("span",{className:"font-semibold text-green-800 dark:text-green-300",children:s.activeContent?.title||"Active Subscription"})]}),s.activeContent?.fields&&s.activeContent.fields.length>0&&u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:s.activeContent.fields.map((E,F)=>u.jsxs("div",{children:[u.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:E.label}),u.jsx("p",{className:"font-semibold text-green-800 dark:text-green-300",children:E.value})]},F))})]}):u.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:[u.jsxs("div",{className:"flex items-center mb-2",children:[u.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full mr-3"}),u.jsx("span",{className:"font-semibold text-yellow-800 dark:text-yellow-300",children:s.inactiveContent?.title||"No Active Subscription"})]}),s.inactiveContent?.message&&u.jsx("p",{className:"text-yellow-700 dark:text-yellow-400",children:s.inactiveContent.message})]})]}),u.jsx("h2",{className:v(ue.textVariants.heading.h3(),"mb-4"),children:e}),y,u.jsxs("div",{style:k,children:[L&&u.jsx(_e,{id:"free",title:C.title,price:C.price,periodLabel:C.periodLabel,features:C.features,isSelected:!1,onSelect:()=>{},topBadge:C.topBadge,ctaButton:C.ctaButton}),o]}),O,r&&u.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:u.jsx("p",{className:"text-red-600 dark:text-red-400",children:r})}),D&&u.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[i&&u.jsx(ye.Button,{onClick:G,disabled:i.disabled||i.loading,variant:"outline",className:"sm:flex-shrink-0",children:i.label}),u.jsx(ye.Button,{onClick:$,disabled:n.disabled||n.loading,className:"flex-1",children:n.label})]})]})};function jt({options:e,value:o,onChange:r,className:t,disabled:s=!1,size:n="md"}){const i={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return u.jsx("div",{className:v("inline-flex rounded-lg bg-gray-100 dark:bg-gray-800 p-1",s&&"opacity-50",t),role:"radiogroup",children:e.map(p=>{const c=o===p.value;return u.jsx("button",{type:"button",role:"radio","aria-checked":c,disabled:s,onClick:()=>!s&&r(p.value),className:v(i[n],"font-medium rounded-md transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",c?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",s&&"cursor-not-allowed"),children:p.label},p.value)})})}let ge=null;const Gt=async()=>(ge||(ge=await import("@revenuecat/purchases-js")),ge);let T=null;const Fe=(e,o)=>{const r=e.rcBillingProduct,t=r?.defaultSubscriptionOption,s=typeof o?.entitlement=="string"?o.entitlement:void 0;return{identifier:e.identifier,productId:r?.identifier||void 0,price:r?.currentPrice?.amountMicros?(r.currentPrice.amountMicros/1e6).toFixed(2):"0",priceString:r?.currentPrice?.formattedPrice||"$0",title:r?.title||e.identifier,description:r?.description||"",period:r?.normalPeriodDuration||void 0,introPrice:t?.introPrice?.price?.formattedPrice||void 0,introPriceAmount:t?.introPrice?.price?.amountMicros?(t.introPrice.price.amountMicros/1e6).toFixed(2):void 0,introPricePeriod:t?.introPrice?.periodDuration||void 0,introPriceCycles:t?.introPrice?.cycleCount||void 0,freeTrialPeriod:t?.trial?.periodDuration||void 0,entitlement:s}},he=e=>{const o=Object.keys(e.entitlements.active);if(o.length>0){const r=o[0],t=e.entitlements.active[r];return{isActive:!0,expirationDate:t.expirationDate?new Date(t.expirationDate):void 0,purchaseDate:t.latestPurchaseDate?new Date(t.latestPurchaseDate):void 0,productIdentifier:t.productIdentifier,willRenew:t.willRenew,isSandbox:t.isSandbox,unsubscribeDetectedAt:t.unsubscribeDetectedAt?new Date(t.unsubscribeDetectedAt):void 0,billingIssueDetectedAt:t.billingIssueDetectedAt?new Date(t.billingIssueDetectedAt):void 0,activeEntitlements:o}}return{isActive:!1}},Ve=I.createContext(void 0),Lt=({apiKey:e,userEmail:o,onError:r,onPurchaseSuccess:t,children:s})=>{const[n,i]=I.useState([]),[p,c]=I.useState(null),[x,y]=I.useState(!1),[O,w]=I.useState(null),[C,P]=I.useState(!1),[S,z]=I.useState(null),[D,$]=I.useState(null),[G,L]=I.useState(null),k=!e||e==="your_revenuecat_api_key_here",E=I.useCallback(()=>{i([]),c(null),$(null),L(null),w(null),P(!1),z(null),T=null},[]),F=I.useCallback(async()=>{if(T)try{const m=await T.getOfferings();m.current&&$(m.current);const b=m.all;if(b){L(b);const h=[];for(const d of Object.keys(b)){const j=b[d];if(j?.availablePackages){const K=j.metadata,W=j.availablePackages.map(H=>Fe(H,K));h.push(...W)}}i(h)}else if(m.current){const h=m.current.metadata,d=m.current.availablePackages.map(j=>Fe(j,h));i(d)}}catch(m){const b=m instanceof Error?m.message:"Failed to load offerings";w(b),r?.(m instanceof Error?m:new Error(b))}},[r]),f=I.useCallback(async()=>{if(T)try{const m=await T.getCustomerInfo(),b=he(m);c(b.isActive?b:null)}catch(m){const b=m instanceof Error?m.message:"Failed to load subscription status";w(b),r?.(m instanceof Error?m:new Error(b))}},[r]),V=I.useCallback(async(m,b)=>{if(S&&S!==m&&E(),!(C&&S===m))try{if(y(!0),w(null),k)console.warn("[SubscriptionProvider] RevenueCat API key not configured"),i([]),c(null);else{const h=await Gt(),d={apiKey:e,appUserId:m};T=h.Purchases.configure(d);const j=b||o;if(j&&T)try{await T.setAttributes({email:j})}catch{}await Promise.all([F(),f()])}z(m),P(!0)}catch(h){const d=h instanceof Error?h.message:"Failed to initialize";w(d),c(null),i([]),r?.(h instanceof Error?h:new Error(d))}finally{y(!1)}},[S,C,k,e,o,F,f,r,E]),U=I.useCallback(async(m,b)=>{try{if(y(!0),w(null),k){await new Promise(W=>setTimeout(W,2e3));const K={isActive:!0,expirationDate:new Date(Date.now()+365*24*60*60*1e3),purchaseDate:new Date,productIdentifier:m,willRenew:!0};return c(K),t?.(m),!0}if(!T||!D&&!G)throw new Error("Subscription service not initialized");let h;if(G)for(const K of Object.keys(G)){const W=G[K];if(W?.availablePackages&&(h=W.availablePackages.find(H=>H.identifier===m),h))break}else D&&(h=D.availablePackages.find(W=>W.identifier===m));if(!h)throw new Error(`Package not found: ${m}`);const d=await T.purchase({rcPackage:h,...o?{customerEmail:o}:{}}),j=he(d.customerInfo);return c(j.isActive?j:null),j.isActive&&t?.(m),j.isActive}catch(h){const d=h instanceof Error?h.message:"Purchase failed";return w(d),r?.(h instanceof Error?h:new Error(d)),!1}finally{y(!1)}},[k,D,G,o,t,r]),te=I.useCallback(async m=>{try{if(y(!0),w(null),k)return await new Promise(d=>setTimeout(d,1e3)),w("No previous purchases found"),!1;if(!T)throw new Error("Subscription service not initialized");const b=await T.getCustomerInfo(),h=he(b);return c(h.isActive?h:null),h.isActive||w("No previous purchases found"),h.isActive}catch(b){const h=b instanceof Error?b.message:"Restore failed";return w(h),r?.(b instanceof Error?b:new Error(h)),!1}finally{y(!1)}},[k,r]),X=I.useCallback(async()=>{if(!k)try{w(null),await Promise.all([f(),F()])}catch(m){const b=m instanceof Error?m.message:"Refresh failed";w(b),r?.(m instanceof Error?m:new Error(b))}},[k,f,F,r]),re=I.useCallback(()=>{w(null)},[]);I.useEffect(()=>{if(!C||k||!T)return;const m=setInterval(()=>{f().catch(()=>{})},300*1e3);return()=>clearInterval(m)},[C,k,f]);const R={products:n,currentSubscription:p,isLoading:x,error:O,initialize:V,purchase:U,restore:te,refresh:X,clearError:re};return u.jsx(Ve.Provider,{value:R,children:s})},_t=()=>{const e=I.useContext(Ve);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{}},Ft=()=>{try{T&&(T.close(),T=null),$e()}catch{}};class Be{constructor(){this.offersCache=new Map,this.currentSubscription=null}loadOfferings(o){this.offersCache.clear();const r=o.all;if(r)for(const[t,s]of Object.entries(r)){const n=this.parseOffer(t,s);this.offersCache.set(t,n)}else if(o.current){const t=this.parseOffer("default",o.current);this.offersCache.set("default",t)}}loadCustomerInfo(o){const r=Object.keys(o.entitlements.active);if(r.length===0){this.currentSubscription={isActive:!1,entitlements:[]};return}const t=r.map(n=>({identifier:n})),s=o.entitlements.active[r[0]];this.currentSubscription={isActive:!0,entitlements:t,productId:s.productIdentifier,expirationDate:s.expirationDate?new Date(s.expirationDate):void 0,willRenew:s.willRenew}}getOffer(o){return this.offersCache.get(o)??null}getOfferIds(){return Array.from(this.offersCache.keys())}getCurrentSubscription(){return this.currentSubscription}parseOffer(o,r){const t=r,s=t.metadata,n=[];if(t.availablePackages)for(const i of t.availablePackages)n.push(this.parsePackage(i,s));return{offerId:o,metadata:s,packages:n}}parsePackage(o,r){const t=o.rcBillingProduct,s=t?.defaultSubscriptionOption,n=this.extractEntitlements(r),i={productId:t?.identifier??o.identifier,name:t?.title??o.identifier,description:t?.description??void 0,price:t?.currentPrice?.amountMicros?t.currentPrice.amountMicros/1e6:0,priceString:t?.currentPrice?.formattedPrice??"$0",currency:t?.currentPrice?.currency??void 0,billingCycle:t?.normalPeriodDuration??void 0,trialPeriod:s?.trial?.periodDuration??void 0,introPrice:s?.introPrice?.price?.formattedPrice??void 0,introPricePeriod:s?.introPrice?.periodDuration??void 0,introPriceCycles:s?.introPrice?.cycleCount??void 0};return{packageId:o.identifier,name:t?.title??o.identifier,product:i,entitlements:n}}extractEntitlements(o){const r=[];if(!o)return r;if(o.entitlement&&typeof o.entitlement=="string"&&r.push({identifier:o.entitlement}),Array.isArray(o.entitlements))for(const t of o.entitlements)typeof t=="string"?r.push({identifier:t}):typeof t=="object"&&t!==null&&typeof t.identifier=="string"&&r.push({identifier:t.identifier});return r}}function Vt(){return new Be}A.SegmentedControl=jt,A.SubscriptionLayout=Tt,A.SubscriptionProvider=Lt,A.SubscriptionService=Be,A.SubscriptionTile=_e,A.clearRevenueCatCheckoutSessions=$e,A.closeRevenueCatInstance=Ft,A.cn=v,A.createSubscriptionService=Vt,A.useSubscriptionContext=_t,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-layout.d.ts","sourceRoot":"","sources":["../src/subscription-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9E;;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;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,KAAK,CAAC;AAE5D,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;;;;;OAKG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC,gDAAgD;IAChD,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC,wFAAwF;IACxF,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC,6FAA6F;IAC7F,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,gFAAgF;IAChF,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;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,8BAA8B,KAAK,IAAI,CAAC;IACzD,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"subscription-layout.d.ts","sourceRoot":"","sources":["../src/subscription-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9E;;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;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,KAAK,CAAC;AAE5D,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;;;;;OAKG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC,gDAAgD;IAChD,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC,wFAAwF;IACxF,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC,6FAA6F;IAC7F,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,gFAAgF;IAChF,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;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,8BAA8B,KAAK,IAAI,CAAC;IACzD,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA0JhE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Offerings, CustomerInfo } from '@revenuecat/purchases-js';
|
|
2
|
+
/**
|
|
3
|
+
* Entitlement granted by a subscription
|
|
4
|
+
*/
|
|
5
|
+
export interface SubscriptionEntitlement {
|
|
6
|
+
/** Entitlement identifier (e.g., "bandwidth_pro") */
|
|
7
|
+
identifier: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Product pricing and billing information
|
|
11
|
+
*/
|
|
12
|
+
export interface SubscriptionProductInfo {
|
|
13
|
+
/** Product ID from the store */
|
|
14
|
+
productId: string;
|
|
15
|
+
/** Product display name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Product description */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Numeric price value */
|
|
20
|
+
price: number;
|
|
21
|
+
/** Formatted price string (e.g., "$9.99") */
|
|
22
|
+
priceString: string;
|
|
23
|
+
/** Currency code (e.g., "USD") */
|
|
24
|
+
currency?: string;
|
|
25
|
+
/** Billing cycle as ISO 8601 duration (e.g., "P1M" for monthly, "P1Y" for yearly) */
|
|
26
|
+
billingCycle?: string;
|
|
27
|
+
/** Trial period as ISO 8601 duration (e.g., "P7D" for 7 days) */
|
|
28
|
+
trialPeriod?: string;
|
|
29
|
+
/** Introductory price string */
|
|
30
|
+
introPrice?: string;
|
|
31
|
+
/** Introductory price period */
|
|
32
|
+
introPricePeriod?: string;
|
|
33
|
+
/** Number of intro price billing cycles */
|
|
34
|
+
introPriceCycles?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Package with product and entitlement information
|
|
38
|
+
*/
|
|
39
|
+
export interface SubscriptionPackage {
|
|
40
|
+
/** Package identifier (e.g., "pro_monthly") */
|
|
41
|
+
packageId: string;
|
|
42
|
+
/** Package display name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Product information */
|
|
45
|
+
product: SubscriptionProductInfo;
|
|
46
|
+
/** Entitlements granted by this package */
|
|
47
|
+
entitlements: SubscriptionEntitlement[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Offer containing packages (complete hierarchy)
|
|
51
|
+
*/
|
|
52
|
+
export interface SubscriptionOffer {
|
|
53
|
+
/** Offer identifier */
|
|
54
|
+
offerId: string;
|
|
55
|
+
/** Offer metadata from RevenueCat */
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
/** Packages in this offer (each with product and entitlements) */
|
|
58
|
+
packages: SubscriptionPackage[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Current subscription status with entitlements
|
|
62
|
+
*/
|
|
63
|
+
export interface CurrentSubscriptionInfo {
|
|
64
|
+
/** Whether subscription is active */
|
|
65
|
+
isActive: boolean;
|
|
66
|
+
/** Active entitlements */
|
|
67
|
+
entitlements: SubscriptionEntitlement[];
|
|
68
|
+
/** Product identifier of the subscription */
|
|
69
|
+
productId?: string;
|
|
70
|
+
/** Expiration date */
|
|
71
|
+
expirationDate?: Date;
|
|
72
|
+
/** Whether subscription will auto-renew */
|
|
73
|
+
willRenew?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Service for managing subscription data with clean abstractions.
|
|
77
|
+
* All data comes from RevenueCat.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const service = createSubscriptionService();
|
|
82
|
+
* service.loadOfferings(offerings);
|
|
83
|
+
* service.loadCustomerInfo(customerInfo);
|
|
84
|
+
*
|
|
85
|
+
* // Get complete offer hierarchy
|
|
86
|
+
* const offer = service.getOffer('default');
|
|
87
|
+
* // offer.packages[0].product.priceString
|
|
88
|
+
* // offer.packages[0].entitlements[0].identifier
|
|
89
|
+
*
|
|
90
|
+
* // Get current subscription
|
|
91
|
+
* const current = service.getCurrentSubscription();
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare class SubscriptionService {
|
|
95
|
+
private offersCache;
|
|
96
|
+
private currentSubscription;
|
|
97
|
+
/**
|
|
98
|
+
* Load offerings from RevenueCat response
|
|
99
|
+
*/
|
|
100
|
+
loadOfferings(offerings: Offerings): void;
|
|
101
|
+
/**
|
|
102
|
+
* Load customer info from RevenueCat response
|
|
103
|
+
*/
|
|
104
|
+
loadCustomerInfo(customerInfo: CustomerInfo): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get offer by ID with complete hierarchy (packages → product → entitlements)
|
|
107
|
+
*/
|
|
108
|
+
getOffer(offerId: string): SubscriptionOffer | null;
|
|
109
|
+
/**
|
|
110
|
+
* Get all offer IDs
|
|
111
|
+
*/
|
|
112
|
+
getOfferIds(): string[];
|
|
113
|
+
/**
|
|
114
|
+
* Get current subscription info
|
|
115
|
+
*/
|
|
116
|
+
getCurrentSubscription(): CurrentSubscriptionInfo | null;
|
|
117
|
+
private parseOffer;
|
|
118
|
+
private parsePackage;
|
|
119
|
+
private extractEntitlements;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a new SubscriptionService instance
|
|
123
|
+
*/
|
|
124
|
+
export declare function createSubscriptionService(): SubscriptionService;
|
|
125
|
+
//# sourceMappingURL=subscription-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-service.d.ts","sourceRoot":"","sources":["../src/subscription-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,SAAS,EAET,YAAY,EACb,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,uBAAuB,CAAC;IACjC,2CAA2C;IAC3C,YAAY,EAAE,uBAAuB,EAAE,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,kEAAkE;IAClE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,qCAAqC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,0BAA0B;IAC1B,YAAY,EAAE,uBAAuB,EAAE,CAAC;IACxC,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,mBAAmB,CAAwC;IAMnE;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAiBzC;;OAEG;IACH,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAiClD;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;IAInD;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAIvB;;OAEG;IACH,sBAAsB,IAAI,uBAAuB,GAAG,IAAI;IAQxD,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,YAAY;IAmCpB,OAAO,CAAC,mBAAmB;CAoC5B;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,CAE/D"}
|
|
@@ -15,6 +15,8 @@ export interface SubscriptionTileProps {
|
|
|
15
15
|
isSelected: boolean;
|
|
16
16
|
/** Selection callback */
|
|
17
17
|
onSelect: () => void;
|
|
18
|
+
/** Whether this is the user's current plan (shows persistent blue border) */
|
|
19
|
+
isCurrentPlan?: boolean;
|
|
18
20
|
/** Optional top badge (e.g., "Most Popular", "Free Trial") */
|
|
19
21
|
topBadge?: BadgeConfig;
|
|
20
22
|
/** Optional discount badge (e.g., "Save 40%") */
|
|
@@ -33,8 +35,10 @@ export interface SubscriptionTileProps {
|
|
|
33
35
|
className?: string;
|
|
34
36
|
/** Custom content to render in the content area */
|
|
35
37
|
children?: React.ReactNode;
|
|
36
|
-
/** Disabled state */
|
|
38
|
+
/** Disabled state (prevents interaction but keeps normal appearance) */
|
|
37
39
|
disabled?: boolean;
|
|
40
|
+
/** Whether this tile is enabled/selectable (false = grayed out, no indicator) */
|
|
41
|
+
enabled?: boolean;
|
|
38
42
|
/** Accessibility label */
|
|
39
43
|
ariaLabel?: string;
|
|
40
44
|
/** Optional tracking callback */
|
|
@@ -1 +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,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB,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;
|
|
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,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB,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;IACrB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,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,4FAA4F;IAC5F,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,4BAA4B,KAAK,IAAI,CAAC;IACvD,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAUD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA4T5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/subscription-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Subscription UI components for React with RevenueCat integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.umd.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@heroicons/react": "^2.2.0",
|
|
42
42
|
"@revenuecat/purchases-js": "^1.0.0",
|
|
43
|
-
"@sudobility/components": "
|
|
44
|
-
"@sudobility/design": "^1.1.
|
|
43
|
+
"@sudobility/components": "^4.0.156",
|
|
44
|
+
"@sudobility/design": "^1.1.18",
|
|
45
45
|
"react": "^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
47
47
|
},
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@eslint/js": "^9.38.0",
|
|
55
55
|
"@heroicons/react": "^2.2.0",
|
|
56
56
|
"@revenuecat/purchases-js": "^1.5.0",
|
|
57
|
-
"@sudobility/components": "
|
|
58
|
-
"@sudobility/design": "^1.1.
|
|
57
|
+
"@sudobility/components": "^4.0.156",
|
|
58
|
+
"@sudobility/design": "^1.1.18",
|
|
59
59
|
"@testing-library/dom": "^10.4.0",
|
|
60
60
|
"@testing-library/jest-dom": "^6.4.2",
|
|
61
61
|
"@testing-library/react": "^16.0.0",
|