You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constonmessage=figma.ui.onmessage// Keep a reference to the previous `figma.ui.onmessage`
17
24
returnnewPromise(function(
@@ -24,7 +31,7 @@ export async function validateGumroadLicenseKeyMainAsync(options: {
24
31
}
25
32
constvalidationTimestamp=newDate().toISOString()
26
33
// The script below is inserted via `scripts/interpolate-gumroad-script.ts`
27
-
const__html__=`<script>async function main(){async function n(){try{const t=await(await window.fetch("https://api.gumroad.com/v2/licenses/verify",{body:"increment_uses_count=${incrementUsesCount}&license_key="+encodeURIComponent("${trimmedLicenseKey}")+"&product_permalink="+encodeURIComponent("${productPermalink}"),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})).json(),{purchase:e,success:s}=t;return s===!1||e.chargebacked===!0||e.disputed===!0||e.refunded===!0?{result:"INVALID"}:{email:e.email,licenseKey:"${trimmedLicenseKey}",purchaseTimestamp:e.sale_timestamp,result:"VALID",validationTimestamp:"${validationTimestamp}"}}catch{return{result:"ENDPOINT_DOWN"}}}window.parent.postMessage({pluginMessage:await n()},"*")}main();</script>`
34
+
const__html__=`<script>async function main(){const n={email:null,licenseKey:null,purchaseTimestamp:null,validationTimestamp:null};async function t(){try{const s=await(await window.fetch("https://api.gumroad.com/v2/licenses/verify",{body:"increment_uses_count=${incrementUsesCount}&license_key="+encodeURIComponent("${trimmedLicenseKey}")+"&product_permalink="+encodeURIComponent("${productPermalink}"),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})).json(),{purchase:e,success:a}=s;return a===!1||e.chargebacked===!0||e.disputed===!0||e.refunded===!0?{...n,result:"INVALID"}:{email:e.email,licenseKey:"${trimmedLicenseKey}",purchaseTimestamp:e.sale_timestamp,result:"VALID",validationTimestamp:"${validationTimestamp}"}}catch{return{...n,result:"ENDPOINT_DOWN"}}}window.parent.postMessage({pluginMessage:await t()},"*")}main();</script>`
0 commit comments