@sunsama/splash
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -1,4 +0,1 @@ | ||
declare const SunsamaSplash: { | ||
splash: () => void; | ||
requestAccess: () => void; | ||
}; | ||
export {}; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ky_1 = __importDefault(require("ky")); | ||
const meteorCall = (methodName, params) => { | ||
const baseUrl = 'localhost:3000'; | ||
return ky_1.default.post(`${baseUrl}/api/v0/${methodName}`, { | ||
json: { | ||
name: methodName, | ||
params, | ||
}, | ||
}) | ||
.json(); | ||
}; | ||
const SunsamaSplash = { | ||
splash: () => console.log('splash'), | ||
requestAccess: () => { | ||
var _a, _b; | ||
const email = (_a = document.getElementById('email')) === null || _a === void 0 ? void 0 : _a.value; | ||
const name = (_b = document.getElementById('name')) === null || _b === void 0 ? void 0 : _b.value; | ||
requestAccess: () => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b, _c, _d; | ||
const email = (_b = (_a = document.getElementById('email')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toLowerCase(); | ||
const name = (_d = (_c = document.getElementById('name')) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.toLowerCase(); | ||
console.log({ email, name }); | ||
window.open('https://sunsama.com'); | ||
} | ||
// Request Access, get Waitlist Id, then return. | ||
const response = yield meteorCall('addToWaitlist', { | ||
name, | ||
email, | ||
}); | ||
const { waitlistId, status, inviteUrl } = response; | ||
console.log({ waitlistId, status, inviteUrl }); | ||
if (waitlistId) { | ||
window.open(`https://sunsama.com/start/waitlist?waitlistId=${waitlistId}`, '_self'); | ||
} | ||
}) | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"license": "MIT", | ||
@@ -30,3 +30,6 @@ "main": "dist/index.js", | ||
"typescript": "^4.0.3" | ||
}, | ||
"dependencies": { | ||
"ky": "^0.24.0" | ||
} | ||
} |
@@ -0,9 +1,46 @@ | ||
import ky from 'ky'; | ||
const meteorCall = (methodName: string, params: object) => { | ||
const baseUrl = 'localhost:3000'; | ||
return ky.post(`${baseUrl}/api/v0/${methodName}`, { | ||
json: { | ||
name: methodName, | ||
params, | ||
}, | ||
}) | ||
.json(); | ||
} | ||
type AddToWaitlistResponse = { | ||
waitlistId: string, | ||
status: string, | ||
inviteUrl: string, | ||
} | ||
const SunsamaSplash = { | ||
splash: () => console.log('splash'), | ||
requestAccess: () => { | ||
const email = (<HTMLInputElement>document.getElementById('email'))?.value; | ||
const name = (<HTMLInputElement>document.getElementById('name'))?.value; | ||
requestAccess: async () => { | ||
const email = (<HTMLInputElement>document.getElementById('email'))?.value?.toLowerCase(); | ||
const name = (<HTMLInputElement>document.getElementById('name'))?.value?.toLowerCase(); | ||
console.log({ email, name }); | ||
window.open('https://sunsama.com'); | ||
// Request Access, get Waitlist Id, then return. | ||
const response = <AddToWaitlistResponse> await meteorCall('addToWaitlist', { | ||
name, | ||
email, | ||
// splashRoute, | ||
// deviceId: window.amplitudeDeviceId, | ||
// referrerGroupEdgeId: referrerInfo && referrerInfo.id, | ||
// tracking: { | ||
// facebook: getFacebookCookies(), | ||
// }, | ||
}); | ||
const { waitlistId, status, inviteUrl } = response; | ||
console.log({ waitlistId, status, inviteUrl }); | ||
if (waitlistId) { | ||
window.open(`https://sunsama.com/start/waitlist?waitlistId=${waitlistId}`, '_self'); | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9849
84
1
+ Addedky@^0.24.0
+ Addedky@0.24.0(transitive)