Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion dist/FlamSaasSDK.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* flamsdk v1.0.10
* Author: bucharitesh
* Date: 2022-12-29
* Date: 2023-01-02
* License: MIT
*/

Expand Down Expand Up @@ -132,6 +132,18 @@
// https://v1.sdk.zingcam.tech
// http://localhost:3000

function assignHandler(data) {
try {
if (!data.handleSuccess && !data.handleFailure) {
throw 'Please assign success and failure handlers!';
}
window.handleSuccess = data.handleSuccess;
window.handleFailure = data.handleFailure;
} catch (err) {
console.log(err);
}
}

function placeOrder(data) {
try {
if ((!data.productId, !data.refId)) {
Expand Down Expand Up @@ -169,7 +181,75 @@
// return placeOrder;
}

function alphaNumericUUID() {
let mask = '';
const chars = '#A';
if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if (chars.indexOf('#') > -1) mask += '0123456789';
let result = 'FLM';
for (let i = 5; i > 0; --i)
result += mask[Math.round(Math.random() * (mask.length - 1))];
return result;
}

function loadButtons() {
const buttons = document.querySelectorAll('.zingcam-sdk-btn');

buttons.forEach(button => {
button.addEventListener('click', event => {
// Your event handler code goes here
console.log({ dataset: button.dataset });

const orderData = {
productId: button.dataset.productId,
varientId: button.dataset.variantId,
refId: button.dataset.refId || alphaNumericUUID(),
photo: {
changable: button.dataset.photoChange === 'true' || false,
url: button.dataset.photoFile || '',
allowCrop: button.dataset.photoCrop === 'true' || false,
maxSize: ''
},
video: {
changable: button.dataset.videoChange === 'true' || false,
url: button.dataset.videoFile || '',
allowTrim: button.dataset.videoTrim === 'true' || false,
allowPosAdjust: button.dataset.videoAdjust === 'true' || false,
maxSize: ''
},
prefill: {
name: '',
email: '',
contact: ''
},
color: button.dataset.color,
handleSuccess: window.handleSuccess,
handleFailure: window.handleFailure
};

console.log({ orderData });

placeOrder(orderData);
});
});
}

init.prototype.placeOrder = placeOrder;
init.prototype.assignHandler = assignHandler;
init.prototype.loadButtons = loadButtons;

// videoAdjust
// :
// "true"
// videoChange
// :
// "true"
// videoFile
// :
// "true"
// videoTrim
// :
// "true"

var version = { raw: '1.0.10' };
version.raw;
Expand Down
4 changes: 2 additions & 2 deletions dist/FlamSaasSDK.min.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/FlamSaasSDK.min.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/FlamSaasSDK.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/FlamSaasSDK.min.js.map

Large diffs are not rendered by default.

Loading