@stigg/react-sdk 8.2.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  @media (max-width: 1040px) {
9
9
  ${({$smallScreenAlign:t})=>t&&`align-self: ${t};`}
10
10
  }
11
- `;function l2({source:t,showWatermark:e,align:o,smallScreenAlign:n="center",style:s={}}){if(!e)return null;let a=()=>{let l=window.location.hostname.replace("www.","");window.open(`https://www.stigg.io/?utm_source=${l}&utm_medium=referral&utm_campaign=${t}`,"_blank");};return jsxRuntime.jsx(vt,{$alignSelf:o,$smallScreenAlign:n,className:yt,style:r({cursor:"pointer"},s),onClick:a,children:jsxRuntime.jsx(kt,{})})}var O=class{error(e,o,...n){console.error(e,o||{},n);}log(e,o){console.log(e,o||{});}debug(e,o){console.debug(e,o||{});}},m1=new O;var u1="8.2.0";var h1="@stigg/react-sdk";var _=Lt__default.default.createContext(null);_.displayName="StiggContext";var Tt="en-US",v2=({apiKey:t,baseUri:e,baseEdgeUri:o,enableEdge:n,customerId:s,customerToken:a,resourceId:l,theme:d,locale:g,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,entitlementsFallback:P,stiggClient:U,children:R,offline:W,clientName:Z=h1,clientVersion:ct=u1})=>{let o1=Lt.useRef(t),r1={apiKey:t,customerId:s,customerToken:a,resourceId:l,baseUri:e,baseEdgeUri:o,enableEdge:n,entitlementsFallback:P,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,clientName:Z,clientVersion:ct,offline:W},[M,G]=Lt.useState(()=>({stigg:U!=null?U:x1__default.default.initialize(i(r({},r1),{lazyLoad:true})),locale:g||Tt,isInitialized:false,theme:d,refreshData:()=>y(null,null,function*(){G(u=>i(r({},u),{customerPortalUpdatedAt:new Date})),yield M.stigg.refresh();})}));return Lt.useEffect(()=>{let u=true,N=f=>{u&&G(f);},$=()=>N(f=>i(r({},f),{updatedAt:new Date})),Ct=f=>N(b=>(b.stigg&&b.stigg.removeListener("entitlementsUpdated",$),f.addListener("entitlementsUpdated",$),i(r({},b),{stigg:f,isInitialized:true,updatedAt:new Date})));return y(null,null,function*(){let f=M.stigg;t!==o1.current&&(m1.log("Updating stigg client",{apiKey:t}),o1.current=t,f=x1__default.default.initialize(r({},r1)),N(b=>i(r({},b),{isInitialized:false,updatedAt:new Date}))),yield f.waitForInitialization(),Ct(f);}),()=>{u=false,M.stigg.removeListener("entitlementsUpdated",$),M.stigg.clearCustomer();}},[t]),Lt.useEffect(()=>{let u=M.stigg;s?u.setCustomerId(s,a,l):u.clearCustomer();},[s,a,l]),Lt.useEffect(()=>{G(u=>i(r({},u),{theme:d}));},[d]),jsxRuntime.jsx(_.Provider,{value:M,children:jsxRuntime.jsx(Je.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:R})})};function p(t){let{optional:e}=t||{},o=Lt.useContext(_);if(!o&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return o}var y1=({externalFontUrl:t})=>jsxRuntime.jsx(react.Global,{styles:react.css`
11
+ `;function l2({source:t,showWatermark:e,align:o,smallScreenAlign:n="center",style:s={}}){if(!e)return null;let a=()=>{let l=window.location.hostname.replace("www.","");window.open(`https://www.stigg.io/?utm_source=${l}&utm_medium=referral&utm_campaign=${t}`,"_blank");};return jsxRuntime.jsx(vt,{$alignSelf:o,$smallScreenAlign:n,className:yt,style:r({cursor:"pointer"},s),onClick:a,children:jsxRuntime.jsx(kt,{})})}var O=class{error(e,o,...n){console.error(e,o||{},n);}log(e,o){console.log(e,o||{});}debug(e,o){console.debug(e,o||{});}},m1=new O;var u1="8.3.0";var h1="@stigg/react-sdk";var _=Lt__default.default.createContext(null);_.displayName="StiggContext";var Tt="en-US",v2=({apiKey:t,baseUri:e,baseEdgeUri:o,enableEdge:n,customerId:s,customerToken:a,resourceId:l,theme:d,locale:g,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,entitlementsFallback:P,stiggClient:U,children:R,offline:W,clientName:Z=h1,clientVersion:ct=u1})=>{let o1=Lt.useRef(t),r1={apiKey:t,customerId:s,customerToken:a,resourceId:l,baseUri:e,baseEdgeUri:o,enableEdge:n,entitlementsFallback:P,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,clientName:Z,clientVersion:ct,offline:W},[M,G]=Lt.useState(()=>({stigg:U!=null?U:x1__default.default.initialize(i(r({},r1),{lazyLoad:true})),locale:g||Tt,isInitialized:false,theme:d,refreshData:()=>y(null,null,function*(){G(u=>i(r({},u),{customerPortalUpdatedAt:new Date})),yield M.stigg.refresh();})}));return Lt.useEffect(()=>{let u=true,N=f=>{u&&G(f);},$=()=>N(f=>i(r({},f),{updatedAt:new Date})),Ct=f=>N(b=>(b.stigg&&b.stigg.removeListener("entitlementsUpdated",$),f.addListener("entitlementsUpdated",$),i(r({},b),{stigg:f,isInitialized:true,updatedAt:new Date})));return y(null,null,function*(){let f=M.stigg;t!==o1.current&&(m1.log("Updating stigg client",{apiKey:t}),o1.current=t,f=x1__default.default.initialize(r({},r1)),N(b=>i(r({},b),{isInitialized:false,updatedAt:new Date}))),yield f.waitForInitialization(),Ct(f);}),()=>{u=false,M.stigg.removeListener("entitlementsUpdated",$),M.stigg.clearCustomer();}},[t]),Lt.useEffect(()=>{let u=M.stigg;s?u.setCustomerId(s,a,l):u.clearCustomer();},[s,a,l]),Lt.useEffect(()=>{G(u=>i(r({},u),{theme:d}));},[d]),jsxRuntime.jsx(_.Provider,{value:M,children:jsxRuntime.jsx(Je.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:R})})};function p(t){let{optional:e}=t||{},o=Lt.useContext(_);if(!o&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return o}var y1=({externalFontUrl:t})=>jsxRuntime.jsx(react.Global,{styles:react.css`
12
12
  ${t&&`
13
13
  @font-face {
14
14
  font-family: 'custom-font';
@@ -8,7 +8,7 @@ import d1 from'@emotion/styled';import Lt,{forwardRef,useRef,useState,useEffect,
8
8
  @media (max-width: 1040px) {
9
9
  ${({$smallScreenAlign:t})=>t&&`align-self: ${t};`}
10
10
  }
11
- `;function l2({source:t,showWatermark:e,align:o,smallScreenAlign:n="center",style:s={}}){if(!e)return null;let a=()=>{let l=window.location.hostname.replace("www.","");window.open(`https://www.stigg.io/?utm_source=${l}&utm_medium=referral&utm_campaign=${t}`,"_blank");};return jsx(vt,{$alignSelf:o,$smallScreenAlign:n,className:yt,style:r({cursor:"pointer"},s),onClick:a,children:jsx(kt,{})})}var O=class{error(e,o,...n){console.error(e,o||{},n);}log(e,o){console.log(e,o||{});}debug(e,o){console.debug(e,o||{});}},m1=new O;var u1="8.2.0";var h1="@stigg/react-sdk";var _=Lt.createContext(null);_.displayName="StiggContext";var Tt="en-US",v2=({apiKey:t,baseUri:e,baseEdgeUri:o,enableEdge:n,customerId:s,customerToken:a,resourceId:l,theme:d,locale:g,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,entitlementsFallback:P,stiggClient:U,children:R,offline:W,clientName:Z=h1,clientVersion:ct=u1})=>{let o1=useRef(t),r1={apiKey:t,customerId:s,customerToken:a,resourceId:l,baseUri:e,baseEdgeUri:o,enableEdge:n,entitlementsFallback:P,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,clientName:Z,clientVersion:ct,offline:W},[M,G]=useState(()=>({stigg:U!=null?U:x1.initialize(i(r({},r1),{lazyLoad:true})),locale:g||Tt,isInitialized:false,theme:d,refreshData:()=>y(null,null,function*(){G(u=>i(r({},u),{customerPortalUpdatedAt:new Date})),yield M.stigg.refresh();})}));return useEffect(()=>{let u=true,N=f=>{u&&G(f);},$=()=>N(f=>i(r({},f),{updatedAt:new Date})),Ct=f=>N(b=>(b.stigg&&b.stigg.removeListener("entitlementsUpdated",$),f.addListener("entitlementsUpdated",$),i(r({},b),{stigg:f,isInitialized:true,updatedAt:new Date})));return y(null,null,function*(){let f=M.stigg;t!==o1.current&&(m1.log("Updating stigg client",{apiKey:t}),o1.current=t,f=x1.initialize(r({},r1)),N(b=>i(r({},b),{isInitialized:false,updatedAt:new Date}))),yield f.waitForInitialization(),Ct(f);}),()=>{u=false,M.stigg.removeListener("entitlementsUpdated",$),M.stigg.clearCustomer();}},[t]),useEffect(()=>{let u=M.stigg;s?u.setCustomerId(s,a,l):u.clearCustomer();},[s,a,l]),useEffect(()=>{G(u=>i(r({},u),{theme:d}));},[d]),jsx(_.Provider,{value:M,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:R})})};function p(t){let{optional:e}=t||{},o=useContext(_);if(!o&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return o}var y1=({externalFontUrl:t})=>jsx(Global,{styles:css`
11
+ `;function l2({source:t,showWatermark:e,align:o,smallScreenAlign:n="center",style:s={}}){if(!e)return null;let a=()=>{let l=window.location.hostname.replace("www.","");window.open(`https://www.stigg.io/?utm_source=${l}&utm_medium=referral&utm_campaign=${t}`,"_blank");};return jsx(vt,{$alignSelf:o,$smallScreenAlign:n,className:yt,style:r({cursor:"pointer"},s),onClick:a,children:jsx(kt,{})})}var O=class{error(e,o,...n){console.error(e,o||{},n);}log(e,o){console.log(e,o||{});}debug(e,o){console.debug(e,o||{});}},m1=new O;var u1="8.3.0";var h1="@stigg/react-sdk";var _=Lt.createContext(null);_.displayName="StiggContext";var Tt="en-US",v2=({apiKey:t,baseUri:e,baseEdgeUri:o,enableEdge:n,customerId:s,customerToken:a,resourceId:l,theme:d,locale:g,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,entitlementsFallback:P,stiggClient:U,children:R,offline:W,clientName:Z=h1,clientVersion:ct=u1})=>{let o1=useRef(t),r1={apiKey:t,customerId:s,customerToken:a,resourceId:l,baseUri:e,baseEdgeUri:o,enableEdge:n,entitlementsFallback:P,cacheTtlMs:c,useEntitlementPolling:S,entitlementPollingInterval:E,clientName:Z,clientVersion:ct,offline:W},[M,G]=useState(()=>({stigg:U!=null?U:x1.initialize(i(r({},r1),{lazyLoad:true})),locale:g||Tt,isInitialized:false,theme:d,refreshData:()=>y(null,null,function*(){G(u=>i(r({},u),{customerPortalUpdatedAt:new Date})),yield M.stigg.refresh();})}));return useEffect(()=>{let u=true,N=f=>{u&&G(f);},$=()=>N(f=>i(r({},f),{updatedAt:new Date})),Ct=f=>N(b=>(b.stigg&&b.stigg.removeListener("entitlementsUpdated",$),f.addListener("entitlementsUpdated",$),i(r({},b),{stigg:f,isInitialized:true,updatedAt:new Date})));return y(null,null,function*(){let f=M.stigg;t!==o1.current&&(m1.log("Updating stigg client",{apiKey:t}),o1.current=t,f=x1.initialize(r({},r1)),N(b=>i(r({},b),{isInitialized:false,updatedAt:new Date}))),yield f.waitForInitialization(),Ct(f);}),()=>{u=false,M.stigg.removeListener("entitlementsUpdated",$),M.stigg.clearCustomer();}},[t]),useEffect(()=>{let u=M.stigg;s?u.setCustomerId(s,a,l):u.clearCustomer();},[s,a,l]),useEffect(()=>{G(u=>i(r({},u),{theme:d}));},[d]),jsx(_.Provider,{value:M,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:R})})};function p(t){let{optional:e}=t||{},o=useContext(_);if(!o&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return o}var y1=({externalFontUrl:t})=>jsx(Global,{styles:css`
12
12
  ${t&&`
13
13
  @font-face {
14
14
  font-family: 'custom-font';
package/dist/index.d.mts CHANGED
@@ -575,6 +575,7 @@ type CheckoutProviderProps = {
575
575
  onMockCheckoutState?: MockCheckoutStateCallback;
576
576
  skipCheckoutSteps?: CheckoutSteps[];
577
577
  onBeforeStepChange?: OnBeforeStepChangeCallback;
578
+ resetBillingPeriod?: boolean;
578
579
  };
579
580
 
580
581
  type CheckoutContainerProps = {
@@ -592,7 +593,7 @@ type CheckoutContainerProps = {
592
593
  };
593
594
 
594
595
  type CheckoutProps = CheckoutProviderProps & CheckoutContainerProps & CheckoutMockProps;
595
- declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, skipCheckoutSteps, onBeforeStepChange, ...containerProps }: CheckoutProps) => JSX.Element;
596
+ declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, skipCheckoutSteps, onBeforeStepChange, resetBillingPeriod, ...containerProps }: CheckoutProps) => JSX.Element;
596
597
 
597
598
  declare enum ProvisionStatus {
598
599
  IN_PROGRESS = "IN_PROGRESS",
package/dist/index.d.ts CHANGED
@@ -575,6 +575,7 @@ type CheckoutProviderProps = {
575
575
  onMockCheckoutState?: MockCheckoutStateCallback;
576
576
  skipCheckoutSteps?: CheckoutSteps[];
577
577
  onBeforeStepChange?: OnBeforeStepChangeCallback;
578
+ resetBillingPeriod?: boolean;
578
579
  };
579
580
 
580
581
  type CheckoutContainerProps = {
@@ -592,7 +593,7 @@ type CheckoutContainerProps = {
592
593
  };
593
594
 
594
595
  type CheckoutProps = CheckoutProviderProps & CheckoutContainerProps & CheckoutMockProps;
595
- declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, skipCheckoutSteps, onBeforeStepChange, ...containerProps }: CheckoutProps) => JSX.Element;
596
+ declare const Checkout: ({ textOverrides, theme, resourceId, planId, preferredBillingPeriod, billingCountryCode, billableFeatures, billingInformation, onMockCheckoutState, skipCheckoutSteps, onBeforeStepChange, resetBillingPeriod, ...containerProps }: CheckoutProps) => JSX.Element;
596
597
 
597
598
  declare enum ProvisionStatus {
598
599
  IN_PROGRESS = "IN_PROGRESS",