This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {getFileUrl, sendMail} from 'backend/attachment/process'; | |
$w.onReady(function () { | |
}); | |
export function upload_click(event) { | |
$w("#upload").disable(); | |
let files = $w("#uploadButton1").value; | |
let fileName = files[0].name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
let options = { | |
"suppressAuth": true, | |
"suppressHooks": true | |
}; | |
export function validateEmail(email) { | |
var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
if(emailRegex.test(email)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); //remember to install the axios npm | |
var url = 'https://{SERVER}.api.mailchimp.com/3.0/lists/{LIST ID}/members'; | |
var api_key = '{API KEY HERE}'; | |
export function createSub(fname, lname, email) { | |
return axios({ | |
url: url, | |
method: 'post', | |
headers: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createSub} from 'backend/mailChimp'; | |
$w.onReady(function () { | |
}); | |
export function submit_click(event) { | |
if($w("#fName").valid && $w("#lName").valid && $w("#email").valid){ | |
$w("#error").hide(); | |
$w("#submit").disable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
$w.onReady(function () { | |
}); | |
export function repeater1_itemReady($item, itemData, index) { | |
$item("#price").text = itemData.price + ' ' + itemData.currency; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//stripe.jsw | |
import {fetch} from 'wix-fetch'; | |
export async function subscription(token, item) { | |
const cart = item; | |
const apiKey = "SECRET_API_KEY"; | |
const response = await fetch("https://api.stripe.com/v1/subscriptions", { | |
method: 'post', | |
headers: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//stripeAPI.js | |
import {fetch} from 'wix-fetch'; | |
export async function createToken(card) { | |
const apiKey = "PUBLIC_API_KEY"; | |
const response = await fetch("https://api.stripe.com/v1/tokens", { | |
method: 'post', | |
headers: { | |
"Content-Type": "application/x-www-form-urlencoded", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createToken, encodeCard} from "public/stripeAPI.js"; | |
import {subscription, createCustomer} from "backend/stripe"; | |
import wixLocation from 'wix-location'; | |
$w.onReady(function () { | |
}); | |
var items = []; //your plan ID will go here (plan_XXXXXXXXXXXXXX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wixData from 'wix-data'; | |
$w.onReady(function () { | |
}); | |
export function dataset1_ready() { | |
$w("#repeater1").onItemReady( ($item, itemData, index) => { | |
$item("#price").text = itemData.price + ' ' + itemData.currency; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function signUpMember(response, cus, lastFour, brand, sourceData, referrer, donationValue) { | |
let email = $w("#email").value.toLowerCase(); | |
let password = $w("#password").value; | |
let fname = $w("#fName").value; | |
let lname = $w("#lName").value; | |
registration(email, password, fname, lname) | |
.then( (res) => { | |
console.log(res); | |
if(res.status === 'Active') { | |
wixUsers.applySessionToken(res.sessionToken) |