View openai-events.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 {ask_gpt, initiate_gpt} from 'backend/openai.js'; | |
import wixChatBackend from 'wix-chat-backend'; | |
import wixData from 'wix-data'; | |
export function wixChat_onMessage(event) { | |
if(event.direction === 'VisitorToBusiness') { | |
console.log('Chat was commenced'); | |
commence(event); | |
} | |
} |
View openai.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'; | |
const key = ""; | |
export async function initiate_gpt(user) { | |
const parameters = { | |
model: 'text-davinci-003', | |
prompt: 'You are a customer support agent for an online store selling women apparel. Please respond to customers reaching out with queries.', | |
max_tokens: 100, | |
n: 1, |
View events.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 | |
}; | |
export function wixLoyalty_onAccountCreated(event) { | |
const contactId = event.entity.contactId; | |
let object = { | |
loyaltyId: event.entity._id, |
View twilio.jsw
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 accountSid = ''; | |
const authToken = ''; | |
const client = require('twilio')(accountSid, authToken); | |
import wixData from 'wix-data'; | |
import {award_points} from 'backend/member.js'; | |
let options = { | |
"suppressAuth": true | |
}; |
View member.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 {accounts} from 'wix-loyalty.v2'; | |
import * as wixAuth from 'wix-auth'; | |
export async function award_points(loyalty_id, options) { | |
try { | |
const elevated_earnpoints = wixAuth.elevate(accounts.earnPoints); | |
const account = await elevated_earnpoints(loyalty_id, options); | |
return account; | |
} catch (error) { | |
console.log(error); |
View mem-reg.jsw
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 {authentication} from 'wix-members-backend'; | |
export function register(object) { | |
return authentication.register(object.email, object.password, object.options) | |
.then( (registrationResult) => { | |
return registrationResult; | |
}) | |
.catch( (error) => { | |
return error; | |
}); |
View PN Verification Page Code
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 {verify, verify_code} from 'backend/twilio.jsw'; | |
import wixLocation from 'wix-location'; | |
import {currentMember} from 'wix-members'; | |
let me; | |
$w.onReady(function () { | |
currentMember.getMember() | |
.then( (member) => { | |
me = member._id; |
View Registration Page
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 {register} from 'backend/mem-reg.jsw'; | |
import {authentication} from 'wix-members'; | |
import wixLocation from 'wix-location'; | |
$w.onReady(function () { | |
}); | |
export function register_click(event) { | |
if($w("#fname").valid && $w("#lname").valid && $w("#email").valid && $w("#pwd").valid) { |
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); | |
}); |
NewerOlder