@saasquatch/component-boilerplate 1.6.7-1 → 1.6.7
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/hooks/graphql/useQuery.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -161,7 +161,7 @@ import{lazilyStartLocaleContext as e,LOCALE_CONTEXT_NAME as t,lazilyStartProgram
|
|
|
161
161
|
token
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
`));function it(){const e=H(),t=m(),[n,{loading:r,data:a,errors:o}]=Ee(st);return[async r=>{const a=await n(r);if(!(a instanceof Error)&&a.authenticateManagedIdentityWithInstantAccess){if("APPROVED"!==await async function(e,t){try{var n;const r=await fetch(`${u()}/api/v1/${c()}/graphql`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({query:"\n query checkReferralFraudStatus($programId: ID) {\n viewer {\n ... on User {\n id\n instantAccessRewards(filter: { programId_eq: $programId }) {\n data {\n id\n pendingReasons\n cancelledReason\n }\n }\n }\n }\n }\n",variables:{programId:e}})});if(!r.ok)throw new Error("Failed to fetch locale");const a=await r.json();if(a.errors)throw new Error(JSON.stringify(a.errors,null,2));const o=(null==(n=a.data.viewer.instantAccessRewards)?void 0:n.data)||[];return o.some(e=>"SUSPECTED_FRAUD"===e.cancelledReason)?"DENIED":o.some(e=>{var t;return null==(t=e.pendingReasons)?void 0:t.includes("SUSPECTED_FRAUD")})?"PENDING_REVIEW":"APPROVED"}catch(e){return void console.error(e)}}(e,a.authenticateManagedIdentityWithInstantAccess.token))throw{name:"fraud_error",message:"Referral flagged as fraud."};{const e=a.authenticateManagedIdentityWithInstantAccess.email;if(d({jwt:a.authenticateManagedIdentityWithInstantAccess.token,id:e,accountId:e}),"SquatchJS2"===t){const t=new CustomEvent("sq:user-registration",{bubbles:!0,detail:{userId:e,accountId:e}});document.dispatchEvent(t)}}}return a},{loading:r,data:a,errors:o}]}function dt(e,t){const n=F();return n.current&&R(t,n.current.key)||(n.current={key:t,value:e()}),n.current.value}function ct(){return C(e=>e+1,0)}function ut(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&ut(t)}return Object.freeze(e)}const lt={loading:!0,data:void 0,errors:void 0};function mt(e,t,n,r
|
|
164
|
+
`));function it(){const e=H(),t=m(),[n,{loading:r,data:a,errors:o}]=Ee(st);return[async r=>{const a=await n(r);if(!(a instanceof Error)&&a.authenticateManagedIdentityWithInstantAccess){if("APPROVED"!==await async function(e,t){try{var n;const r=await fetch(`${u()}/api/v1/${c()}/graphql`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({query:"\n query checkReferralFraudStatus($programId: ID) {\n viewer {\n ... on User {\n id\n instantAccessRewards(filter: { programId_eq: $programId }) {\n data {\n id\n pendingReasons\n cancelledReason\n }\n }\n }\n }\n }\n",variables:{programId:e}})});if(!r.ok)throw new Error("Failed to fetch locale");const a=await r.json();if(a.errors)throw new Error(JSON.stringify(a.errors,null,2));const o=(null==(n=a.data.viewer.instantAccessRewards)?void 0:n.data)||[];return o.some(e=>"SUSPECTED_FRAUD"===e.cancelledReason)?"DENIED":o.some(e=>{var t;return null==(t=e.pendingReasons)?void 0:t.includes("SUSPECTED_FRAUD")})?"PENDING_REVIEW":"APPROVED"}catch(e){return void console.error(e)}}(e,a.authenticateManagedIdentityWithInstantAccess.token))throw{name:"fraud_error",message:"Referral flagged as fraud."};{const e=a.authenticateManagedIdentityWithInstantAccess.email;if(d({jwt:a.authenticateManagedIdentityWithInstantAccess.token,id:e,accountId:e}),"SquatchJS2"===t){const t=new CustomEvent("sq:user-registration",{bubbles:!0,detail:{userId:e,accountId:e}});document.dispatchEvent(t)}}}return a},{loading:r,data:a,errors:o}]}function dt(e,t){const n=F();return n.current&&R(t,n.current.key)||(n.current={key:t,value:e()}),n.current.value}function ct(){return C(e=>e+1,0)}function ut(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&ut(t)}return Object.freeze(e)}const lt={loading:!0,data:void 0,errors:void 0};function mt(e,t,n,r){const[a,o]=be(e,lt,ie({batch:!0},r||{})),[s,i]=ct();return dt(()=>{!n&&o(t)},[e,t,o,s,n]),He({skip:n,update:o,variables:t}),ut(ie({},a,{refetch:i}))}function ft(e){const t=U(),[n,r]=p(t,yt(e.namespace),e.initialValue);return p(t,vt(e.namespace),[n,r]),[n,r]}function gt(e){const t=x(vt(e)),n=x(yt(e));return t?[n,t[1]]:[void 0,void 0]}function pt(e){const t=x(vt(e));if(t)return t[1]}function ht(e){return x(yt(e))}function yt(e){return e+"-value"}function vt(e){return e+"-state"}function Ct(e){const t=U(),n=mt(e.query,e.variables||{},e.skip,ie({batch:!0},e.options||{})),[r,a]=p(t,yt(e.namespace),n);return I(()=>{j(n,r)||a(n)},[n,r]),n}function wt(e){return x(yt(e))||{data:null,loading:!0,refetch:()=>console.warn("component still loading")}}function bt(){const[,e]=ct();return I(()=>f.listen(()=>{e()}),[]),f.location}const It=f;function Et(e){const[t,n]=b({limit:e.limit,offset:e.offset}),{offset:r,limit:a}=t,o=(e,t)=>e*t,s=(e,t)=>Math.ceil(e/t)||0;return{limit:a,setLimit:e=>{const a=s(r,e),i=o(e,a);n(ie({},t,{limit:e,offset:i}))},offset:r,setCurrentPage:e=>{let t=o(e,a);n(e=>ie({},e,{offset:t}))},calculatePagination:function(e,t){const n=s(r,a),o=((e,t)=>Math.ceil(e/t)||0)(t,a),i=0===e?"0":e>1?`${r+1}-${r+e}`:`${r+1}`;return{currentPage:n,pageCount:o,rangeOnPage:i,pageProgress:`${i} of ${t}`}}}}function Ft(e,t,n,r={},a=!1){var o;const{limit:s,offset:i,setLimit:d,setCurrentPage:c,calculatePagination:u}=Et(n),l=ie({limit:s,offset:i},r),{loading:m,errors:f,data:g,refetch:p}=mt(e,l,a),h=t(g),{currentPage:y,pageCount:v,pageProgress:C}=u((null==h||null==(o=h.data)?void 0:o.length)||0,(null==h?void 0:h.totalCount)||0);return{envelope:h,states:{errors:f,loading:m,limit:s,currentPage:y,pageCount:v,pageProgress:C},callbacks:{refetch:p,setLimit:d,setCurrentPage:c}}}function Pt(e,t){return e===t}function $t(e,t,n){const r=n&&n.equalityFn||Pt,[a,o]=b(e),s=Mt(w(e=>o(e),[]),t,n),i=F(e);return I(()=>{r(i.current,e)||(s.callback(e),i.current=e)},[e,s,r]),[a,{cancel:s.cancel,flush:s.flush}]}function Mt(e,t=0,n={leading:!1}){const r=E(()=>V(e,t,n.leading),[e,t,n.leading]),{flush:a,clear:o}=r;return{flush:a,cancel:o,callback:r}}let Dt;const St=D(Dt||(Dt=(e=>e)`
|
|
165
165
|
mutation ($eventMeta: UserAnalyticsEvent!) {
|
|
166
166
|
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
167
167
|
}
|