This file contains hidden or 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); | |
| } | |
| } |
This file contains hidden or 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, |
This file contains hidden or 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, |
This file contains hidden or 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 | |
| }; |
This file contains hidden or 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); |
This file contains hidden or 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; | |
| }); |
This file contains hidden or 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; |
This file contains hidden or 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) { |
This file contains hidden or 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); | |
| } |
This file contains hidden or 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