View backend-process-sendgrid.js
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 {mediaManager} from 'wix-media-backend'; | |
import {bufferEncode} from './sendgrid'; | |
export function getFileUrl(fileId) { | |
return mediaManager.getFileUrl(fileId); | |
} | |
export function sendMail(url, email, subject, body, filename, filetype) { | |
return bufferEncode(url, email, subject, body, filename, filetype); | |
} |
View backend-sendgrid.js
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 {fetch} from 'wix-fetch'; | |
import sgMail from '@sendgrid/mail'; | |
var api_key = 'XXXXXX'; | |
export function bufferEncode(url, email, subject, body, filename, filetype) { | |
return createBuffer(url) | |
.then( (buf) => { | |
return sendEmail(buf, email, subject, body, filename, filetype); | |
}); |
View sendgrid-attachment-page.js
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; |
View dataValidation.js
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)){ |
View mailchimpbackend.js
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: { |
View page.js
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(); |
View wixStores.js
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; | |
} |
View backendFile.js
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: { |
View public.js
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", |
View stripePage.js
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) |
NewerOlder