console.info("--- STORE -----------------------------------------------");
console.info($ == undefined);
console.info($);
store = {
debug: (window.location.origin == "http://bs" && true),
ok: function () {
var _ok = $("#store-" + this._conf._eventKey).length !== 0;
console.warn("##########################################################################################################");
console.warn("### EMBED STORE #store-" + this._conf._eventKey + " :: INIT-OK :: " + (_ok ? "OK" : "NOT OK "));
console.warn("##########################################################################################################");
return _ok;
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
init: function () {
console.warn("##########################################################################################################");
console.warn("### EMBED STORE :: INIT :: IN ############################################################################");
console.info("#store-" + this._conf._eventKey + " :: " + $("#store-" + this._conf._eventKey).length);
console.info(this._conf);
console.info(this._eventInfo);
this.initialize();
console.warn("### EMBED STORE :: INIT :: OUT ###########################################################################");
console.warn("##########################################################################################################");
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
initialize: function () {
console.info("--- initialize :: -------------------------------------------------------");
$("head").append("");
$.each(this, function (k, v) {
if (k.indexOf("_") == 0) {
v["_root"] = "$store";
v["_eventKey"] = $store._conf._eventKey;
}
});
this._form._css_prefix_ = "str-";
this.css();
this._store.init(this._eventInfo);
this._comm._initialize();
this.renderStore();
this.next(true)
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
if (this.debug) {
//this.renderCode();
var div = "
"
var html = "";
var completedCodes = {"P01": false};
html += JSON.stringify(this._eventInfo, null, 2);
$("#atbta-debug-atbta").html(html);
}
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
canNext: function (visible) {
switch (visible) {
case "tickets":
$store._store.update();
var ret = $store._store.hasQuantity();
if (!ret) {
this.renderError("Choose a quantity to purchase");
}
return ret;
case "info":
$store._store.update();
}
return true;
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
next: function (initial) {
console.info("--- next" + (initial ? " :: " + initial : ""));
this.renderError();
var visible = $(".str-section:visible");
if (this.canNext(visible.data("store-section"))) {
var show = null;
var title = "";
console.info("--- next :: -" + visible.data("store-section") + "- :: " + (visible.data("store-section") == "completed"));
if ((visible.data("store-section") + "") == "completed" && initial != true) {
return;
}
switch (visible.data("store-section")) {
case "tickets":
if ($store._store.infos() == null) {
show = "cart";
title = "Checkout";
this.renderCart();
} else {
show = "info";
title = "Provide Needed Info(s)";
this.renderInfo();
}
break;
case "info":
console.info("infos")
let _valid = this._form.validateUnique();
console.info(_valid);
if (_valid != "uniqueCheck") {
if (_valid == 1) {
show = "cart";
title = "Checkout";
this.renderCart();
} else {
show = "info";
title = "Provide Needed Info(s)";
console.info(typeof _valid);
this.renderError(typeof _valid == "string" ? _valid : "Provide all required information before continuing.");
}
} else {
return;
}
break;
case "cart":
title = "Thank You";
show = "completed";
this.renderCompleted();
break;
default:
show = "tickets";
title = $store._eventInfo.eventStoreButton;
break;
}
$("#str-navigation-title").html(title);
if ($(".str-section:visible").data("storeSection") != show) {
$(".str-section:visible").hide();
$("[data-store-section='" + show + "']").show();
if (initial !== true) {
this.scrollUp();
}
}
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
nextTo: function (show, title) {
$("#str-navigation-title").html(title);
if ($(".str-section:visible").data("storeSection") != show) {
$(".str-section:visible").hide();
$("[data-store-section='" + show + "']").show();
this.scrollUp();
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
back: function (from) {
console.info("back" + (from ? " :: " + from : ""));
this.renderError();
var visible = $(".str-section:visible");
var show = null;
var back = false;
var title = "";
var current = visible.data("store-section");
switch (from ? from : current) {
case "info":
case "code":
$store._store.update();
title = $store._eventInfo.eventStoreButton;
show = "tickets";
break;
case "cart":
if ($store._store.infos() == null) {
title = $store._eventInfo.eventStoreButton;
show = "tickets";
} else {
show = "info";
title = "Provide Needed Info(s)";
back = true;
}
break;
case "payment":
show = "cart";
title = "Cart";
back = true;
break;
case "completed":
show = "payment";
title = "Payment";
back = true;
break;
default:
break;
}
if (show == "tickets") {
$store.renderTickets();
}
$("#str-navigation-title").html(title);
console.info(current + " :: " + show);
$(".str-section:visible").hide();
$("[data-store-section='" + show + "']").show();
this.scrollUp();
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderStore: function () {
console.info("--- renderStore -------------------------------------------------------");
var html = "";
html += this.renderEvent();
html += this.renderNav();
html += this.renderTickets();
html += this.renderCode();
html += this.renderInfo();
html += this.renderCart();
html += this.renderCompleted();
this.content(html);
this.renderTickets();
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderEvent: function () {
return "" + this._eventInfo.event.name + " Store
" + this._eventInfo.event.startDate + "
";
},
renderNav: function () {
return "" + "
";
},
renderError: function (msg) {
$("#str-error").hide();
if (msg) {
console.info(msg);
$("#str-error").html(msg);
$("#str-error").show();
this.scrollUp();
}
},
scrollUp: function () {
$([document.documentElement, document.body]).animate({
scrollTop: $(".str-navigation").offset().top - 75
}, 500);
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderTickets: function () {
if ($("[data-store-section='tickets']").length == 0) {
return "
";
}
var isLocalhost = window.location.hostname == "localhost";
var innerHtml = "";
$.each(this._eventInfo.products, function (i, ticket) {
innerHtml += $store.renderStoreTicket(ticket, (isLocalhost ? 2 : 0));
});
var discountCodes = $store._store.codes();
$.each(discountCodes, function (key, discountCode) {
var code = undefined;
$.each($store._eventInfo.codes, function (i, c) {
if (c.code.toUpperCase() == key.toUpperCase()) {
code = c;
}
});
if (code) {
innerHtml += $store.renderStoreCode(discountCode);
} else {
delete discountCodes[key];
}
});
$store._store.codes(discountCodes);
html = "";
html += ($store._eventInfo.hasOwnProperty("codes") && $store._eventInfo.codes.length != 0 ? "
Have Promo Code? Click HERE.
" : "");
html += "
choose quantity for each ticket and press continue
";
html += "
" + innerHtml + "
";
html += "
continue
";
html += $store.renderFbPixel("PageView");
html += "
";
$("[data-store-section='tickets']").html(html);
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderStoreTicket: function (ticket, index) {
console.info("--- renderStoreTicket :: " + ticket.name + " -------------------------------------------------------");
var html = "";
var symbol = $store._eventInfo.currency.symbol;
var max = ticket.maxPurchaseQuantity;
var price = ticket.price;
if (price == undefined) {
var different = false;
$.each(ticket.variations, function (v, variation) {
if (price != undefined) {
different |= price != variation.price;
}
price = (price == undefined || parseFloat(price) > parseFloat(variation.price) ? variation.price : price);
if (variation.hasOwnProperty("maxPurchaseQuantity")) {
if (max == undefined || max > variation.maxPurchaseQuantity) {
max = variation.maxPurchaseQuantity;
}
}
});
price = (different ? "from " : "") + symbol + price;
} else {
price = symbol + price;
}
html += "";
html += " ";
html += " " + ticket.name + " ";
html += " " + price + " ";
html += " ";
html += " " + this._store.inputs.number(ticket.eventProductId, index + "", "str-item-quantity str-override", max) + " ";
html += " " + ticket.description + " ";
html += "
";
return html;
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderStoreCode: function (code) {
console.clear();
console.info("--- renderCode ----------------------------------------");
var symbol = $store._eventInfo.currency.symbol;
var html = "";
var price = 0.00;
var discount = 0.00;
$.each(code.groups, function (g, group) {
if (group.hasOwnProperty("count") && group.count > 0) {
if (group.hasOwnProperty("priceEach")) {
price += group.count * group.priceEach;
discount += group.count * group.discountAmountEach;
} else {
$.each(group.products, function (p, product) {
if (product.hasOwnProperty("count")) {
price += group.count * product.count * product.priceEach;
discount += group.count * product.count * product.discountAmountEach;
}
});
}
}
});
var discountedPrice = "";
if (!code.haveProducts) {
var isAmount = code.discountCodeAmountType == "AMOUNT";
discountedPrice = (isAmount ? symbol : "") + code.price + (!isAmount ? "%" : "") + " OFF";
} else {
discountedPrice = symbol + parseFloat(price - discount).toFixed(2);
}
html += "";
html += " ";
html += " PROMO CODE: " + code.code + (code.exclusive == "EXCLUSIVE" ? "( Exclusive promo code, cannot be used with any other offer )
" : "") + " ";
html += " ";
html += " " + (code.haveProducts ? symbol + parseFloat(price).toFixed(2) : "") + " " + discountedPrice;
html += " remove
";
html += " ";
html += " ";
html += " ";
html += "";
$.each(code.groups, function (g, group) {
if (group.count > 0) {
html += "";
$.each(group.products, function (p, product) {
if (product.count > 0) {
console.info(product);
$.each($store._eventInfo.products, function (j, eventProduct) {
if (eventProduct.eventProductId == product.eventProductId) {
html += "" + eventProduct.name + (product.hasOwnProperty("priceEach") ? "@ " + symbol + product.priceEach + " ea." : "") + " (count " + (product.count * group.count) + ") " + " ";
}
});
}
});
html += " ";
}
});
html += " ";
html += " ";
html += "
";
html += " ";
html += " ";
html += "
";
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
if (this.debug) {
html += "";
html += " " + code.exclusive + " :: ";
html += " " + code.discountCodeAmountType + " :: ";
html += " " + code.applyTo + " :: ";
html += " " + code.applyToType + " ";
html += "
";
html += "" + JSON.stringify(code, null, 2) + "
";
}
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
return html;
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderCode: function (code) {
var codeInput = (this.debug && true ? "SAMPLE" : "");
if ($("[data-store-section='code']").length == 0) {
return "
";
}
var html = "";
if (code) {
console.clear();
console.info("--- renderCode ----------------------------------------");
console.info(code);
code.price = parseFloat(code.price);
var symbol = $store._eventInfo.currency.symbol;
var isAmount = code.discountCodeAmountType == "AMOUNT";
var isPercentage = code.discountCodeAmountType == "PERCENTAGE";
var isExclusive = code.exclusive == "EXCLUSIVE";
var isEach = code.applyTo == "EACH";
var isCollection = code.applyTo == "COLLECTION";
var isDefault = code.applyToType == "DEFAULT";
var isGroups = code.applyToType == "GROUPS";
var discountCodes = $store._store.codes();
var haveCodes = false;
var haveExclusiveCode = false;
$.each(discountCodes, function (c, _code) {
haveCodes = true;
haveExclusiveCode |= _code.exclusive == "EXCLUSIVE"
});
var canAddDiscountCode = !haveCodes || (isExclusive && !haveExclusiveCode) || (!haveExclusiveCode && !isExclusive);
code["haveProducts"] = false;
$.each(code.groups, function (g, group) {
code.haveProducts |= group.products.length != 0;
});
var discount = parseFloat(code.price);
html += "";
html += (!canAddDiscountCode ? "
Promo code \"" + code.code + "\" cannot be used with other promo codes in the cart.
" : "")
html += "
";
html += " ";
html += " " + code.code.toUpperCase() + (code.exclusive == "EXCLUSIVE" ? "( Exclusive promo code, cannot be used with any other offer )
" : "") + " ";
html += " " + (isAmount ? symbol : "") + discount + (isPercentage ? "%" : "") + (!isExclusive ? "OFF EACH
" : " OFF") + " ";
html += " ";
html += " " + (code.description ? code.description : "") + " ";
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
if (code.haveProducts) {
html += " ";
$.each(code.groups, function (g, group) {
html += (g != 0 && isCollection ? "- OR -
" : "");
html += "";
var totalGroupPrice = 0.0;
$.each(group.products, function (p, product) {
$.each($store._eventInfo.products, function (j, eventProduct) {
if (eventProduct.eventProductId == product.eventProductId) {
totalGroupPrice += $store.productPrice(eventProduct) * product.quantity;
}
});
});
// ##########################################################################################################################
// ##########################################################################################################################
// ##########################################################################################################################
if (isGroups || isCollection) {
var discountAmount = (isPercentage ? totalGroupPrice * code.price / 100 : code.price);
var discountPrice = totalGroupPrice - discountAmount;
group["priceEach"] = totalGroupPrice;
group["discountAmountEach"] = discountAmount;
html += "
";
$.each(group.products, function (p, product) {
$.each($store._eventInfo.products, function (j, eventProduct) {
if (eventProduct.eventProductId == product.eventProductId) {
html += " ";
html += " " + eventProduct.name + " (" + product.quantity + " count) ";
if (p == 0) {
html += "";
html += "" + symbol + parseFloat(totalGroupPrice).toFixed(2) + " " + symbol + parseFloat(discountPrice).toFixed(2);
html += "";
html += (isExclusive && isGroups && canAddDiscountCode ? "select " : "");
html += $store._store.inputs.number("g-" + group.eventDiscountCodeGroupId, (isExclusive && isCollection ? 1 : 0) + "", "str-item-quantity str-override " + (isExclusive ? "str-hidden" : ""), (group.hasOwnProperty("maxQuantity") ? group.maxQuantity : undefined));
html += "
";
html += " ";
}
html += " ";
html += " " + eventProduct.description + " ";
}
});
});
html += "
";
}
// ##########################################################################################################################
// ##########################################################################################################################
// ##########################################################################################################################
else {
$.each(group.products, function (p, product) {
$.each($store._eventInfo.products, function (j, eventProduct) {
if (eventProduct.eventProductId == product.eventProductId) {
var price = parseFloat($store.productPrice(eventProduct));
var discountAmount = (isPercentage ? price * code.price / 100 : code.price);
var discountPrice = price - discountAmount;
product["priceEach"] = price;
product["discountAmountEach"] = discountAmount;
html += "
";
html += " ";
html += " " + eventProduct.name + " (" + (product.hasOwnProperty("maxQuantity") ? "up to " + product.maxQuantity : product.quantity + " count") + ") " + " ";
html += " ";
html += (!isCollection ? "" + symbol + parseFloat(price).toFixed(2) + " " + symbol + parseFloat(discountPrice).toFixed(2) : "");
html += " ";
html += $store._store.inputs.number("p-" + product.eventProductId, 0 + "", "str-item-quantity str-override", (product.hasOwnProperty("maxQuantity") ? product.maxQuantity : undefined));
html += "
";
html += " ";
html += " ";
html += " " + eventProduct.description + " ";
html += "
";
}
});
});
}
// ##########################################################################################################################
// ##########################################################################################################################
// ##########################################################################################################################
html += "
";
});
}
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
// ##############################################################################################################################
html += " ";
html += "
";
html += "
";
html += "";
html += "back ";
html += ((isExclusive && isGroups) || !canAddDiscountCode ? "" : "continue ");
html += "
";
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
if (this.debug) {
html += "";
html += " " + code.exclusive + " :: ";
html += " " + code.discountCodeAmountType + " :: ";
html += " " + code.applyTo + " :: ";
html += " " + code.applyToType + " ";
html += "
";
html += "HAVE CODES: " + haveCodes + " :: HAVE EXCLUSIVE CODES: " + haveExclusiveCode + " :: IS EXCLUSIVE: " + isExclusive + " :: CAN ADD DISCOUNT: " + canAddDiscountCode + "
";
html += "" + JSON.stringify(code, null, 2) + "
";
}
//------------------------------------------------------------
//--- DEBUG
//------------------------------------------------------------
$("#str-navigation-title").html("Promo Code - " + code.code.toUpperCase());
$("[data-store-section='code']").html(html);
} else {
html += "enter your promo code below and press continue
";
html += "
";
html += "back continue
";
$("#str-navigation-title").html("Promo Code");
$("[data-store-section='code']").html(html);
$(".str-section:visible").hide();
$("[data-store-section='code']").show();
$("#str-code").focus();
if (codeInput.length > 0) {
$store.processCode();
}
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
productPrice: function (product) {
var different = false;
var symbol = $store._eventInfo.currency.symbol;
var price = product.price;
if (price == undefined) {
$.each(product.variations, function (v, variation) {
if (price != undefined) {
different |= price != variation.price;
}
price = (price == undefined || parseFloat(price) > parseFloat(variation.price) ? variation.price : price);
});
}
return price;
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
processCode: function (_code, _groupid) {
this.renderError();
// ##########################################################################################################################
// ##########################################################################################################################
if (_code) {
console.clear();
console.info("--- processCode :: CODE ----------------------------------------");
console.info(_code);
console.info(_groupid);
$.each($store._eventInfo.codes, function (i, __code) {
if (__code.code == _code) {
var code = JSON.parse(JSON.stringify(__code));
var discountCodes = $store._store.codes();
console.info(discountCodes);
console.info(code);
var isAmount = code.discountCodeAmountType == "AMOUNT";
var isPercentage = code.discountCodeAmountType == "PERCENTAGE";
var isExclusive = code.exclusive == "EXCLUSIVE";
var isEach = code.applyTo == "EACH";
var isCollection = code.applyTo == "COLLECTION";
var isDefault = code.applyToType == "DEFAULT";
var isGroups = code.applyToType == "GROUPS";
discountCodes[_code] = code;
if (isExclusive) {
$.each(code.groups, function (g, group) {
if (_groupid == undefined || _groupid == group.eventDiscountCodeGroupId) {
group["count"] = 1;
$.each(group.products, function (p, product) {
product["count"] = product.quantity;
});
} else {
delete group["count"];
}
});
} else {
console.info(code.exclusive);
$.each(code.groups, function (g, group) {
console.info("--- GROUP " + g + "-----------------------");
var groupCount = $("[data-form-item-id='g-" + group.eventDiscountCodeGroupId + "']").val();
if (!isNaN(groupCount)) {
groupCount = parseInt(groupCount);
group["count"] = parseInt(groupCount);
}
var groupHasCount = group.hasOwnProperty("count");
$.each(group.products, function (p, product) {
console.info("--- PRODUCT " + product.eventProductId + "-----------------------");
if (groupHasCount) {
product["count"] = product.quantity;
} else {
var productCount = $("[data-form-item-id='p-" + product.eventProductId + "']").val();
if (!isNaN(productCount)) {
productCount = parseInt(productCount);
if (productCount > 0) {
product["count"] = (product.hasOwnProperty("maxQuantity") && product.maxQuantity < productCount ? product.maxQuantity : productCount);
}
}
}
if (product.hasOwnProperty("count") && !group.hasOwnProperty("count")) {
group["count"] = 1;
}
});
});
}
$store._store.codes(discountCodes);
}
});
$("[data-store-section='code']").html("");
$store.back("code");
}
// ##########################################################################################################################
// ##########################################################################################################################
else {
console.info("--- processCode :: INPUT ----------------------------------------");
var val = $("#str-code").val().toUpperCase();
var code = null;
$.each($store._eventInfo.codes, function (i, c) {
if (c.code.toUpperCase() == val) {
code = c;
}
});
if (code != null) {
$store.renderCode(code);
return;
}
this.renderError("The promo code you entered is not valid.");
}
// ##########################################################################################################################
// ##########################################################################################################################
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
clearCode: function (code) {
var codes = $store._store.codes();
delete codes[code];
$store._store.codes(codes);
$("[data-store-section='code']").html("");
$store.back("code");
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderInfo: function () {
if ($("[data-store-section='info']").length == 0) {
return "
";
}
console.info("--- renderInfo ----------------------------------------");
var symbol = $store._eventInfo.currency.symbol;
var accountInfos = this._storage.store("accountInfos");
var infos = this._store.infos();
var html = "specify information for each ticket below
";
html += "" + this._form.required() + "
";
html += "";
$.each(infos, function (ii, info) {
for (var i = 0; i < info.quantity; i++) {
var price = info.price;
var different = false;
var accountInfo = accountInfos[info.eventProductId];
accountInfo = (accountInfo && accountInfo.length > i ? accountInfo = accountInfo[i] : null);
if (info.variations) {
$.each(info.variations, function (v, variation) {
if (variation.price) {
if (price != undefined) {
different |= price != variation.price;
} else {
price = variation.price;
}
}
});
$.each(info.variations, function (v, variation) {
price = (price == undefined || price > variation.price ? variation.price : price);
});
}
price = (different ? "
from " : "") + symbol + price;
html += "
";
html += " ";
html += " " + info.name + (info.quantity > 1 ? " #" + (i + 1) : "") + (info.uniqueAccount ? "(one per email address) " : "") + " ";
html += " " + price + " ";
html += " ";
html += " ";
if (info.variations) {
var options = null;
var value = (accountInfo && accountInfo["variation"] ? accountInfo["variation"] : "");
$.each(info.variations, function (v, variation) {
options += "" + variation.name + (different ? " @ " + symbol + variation.price : "") + " ";
});
html += "" + (info.variationLabel ? info.variationLabel : "Choose a ticket").toLowerCase() + " ";
html += "" + $store._store.inputs.choice(info.eventProductId, i + 1, options) + " ";
}
if (info.form) {
$.each(info.form.parts, function (pi, part) {
part["product"] = info.name;
var datas = undefined;
if (info.uniqueAccount && part.key == "emailAddress") {
datas = {
"unique": "emailAddress"
};
}
html += "" + part.name.toLowerCase() + " ";
html += "" + $store._form.render(info.eventProductId, i + 1, part, (accountInfo && accountInfo[part.key] ? accountInfo[part.key] : ""), datas) + " ";
});
}
if (info.options) {
$.each(info.options, function (oi, eventProductOption) {
html += "" + (eventProductOption.variationLabel ? eventProductOption.variationLabel : eventProductOption.name).toLowerCase() + " ";
if (eventProductOption.productType == "Option") {
var price = eventProductOption.price;
var different = false;
$.each(eventProductOption.variations, function (v, variation) {
if (variation.price) {
if (price != undefined) {
different |= price != variation.price;
} else {
price = variation.price;
}
}
});
var value = (accountInfo && accountInfo[eventProductOption.eventProductId] ? accountInfo[eventProductOption.eventProductId] : "");
var options = null;
if (eventProductOption.requireResponse != true) {
options += " ";
}
$.each(eventProductOption.variations, function (v, variation) {
options += "" + variation.name + (different ? " @ " + symbol + variation.price : "") + " ";
});
html += "" + $store._store.inputs.choice(info.eventProductId, i + 1, options, undefined, eventProductOption.eventProductId) + " ";
}
});
}
if (i == 0 && info.quantity > 1) {
html += "copy to all \"" + info.name + "\" ";
}
html += "
";
}
html += "
"
});
html += "back continue
";
html += $store.renderFbPixel("AddToCart");
$("[data-store-section='info']").html(html);
setTimeout($store._form.validate, 500);
},
renderGGEvent: function (event, price, comment) {
if (event == "PurchaseComplete") {
if ($store._eventInfo.hasOwnProperty("attributes") && $store._eventInfo.attributes.hasOwnProperty("ggGTMPurchaseComplete")) {
var ggGTMPurchaseComplete = $store._eventInfo.attributes.ggGTMPurchaseComplete;
console.info("renderGGEvent :: " + event + " :: " + ggGTMPurchaseComplete);
/*************** GTM -- Google Tag Manager ***************/
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', ggGTMPurchaseComplete);
/*************** GTM -- Google Tag Manager ***************/
}
}
},
renderFbPixel: function (event, price, comment) {
if (comment == undefined) {
comment = "";
}
console.info("renderFbPixel :: " + event + " :: " + comment);
if (event != "AddToCart" || (event == "AddToCart" && comment != "")) {
$store._store.activity.record(event, comment);
}
if ($store._eventInfo.hasOwnProperty("attributes") && $store._eventInfo.attributes.hasOwnProperty("fbPixel")) {
var args = "&dl=" + encodeURIComponent(window.location.href);
if (event == "Purchase" && price != undefined) {
args = "&cd[currency]=" + encodeURIComponent($store._eventInfo.currency.code.toUpperCase()) + "&cd[value]=" + encodeURIComponent(price);
}
return " ";
}
return "";
},
copyInfos: function (id, quantity) {
$("[data-form-item-id='" + id + "'][data-form-item-index='1']").each(function () {
for (var index = 2; index < quantity + 1; index++) {
$("[data-form-item-id='" + id + "'][data-form-item-index='" + index + "'][data-form-item-name='" + $(this).data("formItemName") + "']").val($(this).val());
}
});
$store._form.validate();
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderCart: function () {
//console.clear();
console.info("--- renderCart ----------------------------------------");
if ($("[data-store-section='cart']").length == 0) {
return "
";
}
var cart = this._store.cart();
var codes = $store._store.codes();
var html = "";
var symbol = "$";
var subtotal = 0.0;
var discount = 0.0;
var fee = 0.0;
var tax = 0.0;
var total = 0.0;
var cartItemInfo = {};
var billingName = undefined;
var billingEmail = undefined;
var billingPhone = undefined;
html += "Cart
";
html += "";
$.each(cart, function (i, item) {
$store.renderFbPixel("AddToCart", undefined, item.name);
if (item.hasOwnProperty("accountInfo")) {
if (billingName == undefined && item.accountInfo.hasOwnProperty("name") && item.accountInfo.name != null && item.accountInfo.name.trim().length > 0) {
billingName = item.accountInfo.name;
}
if (billingEmail == undefined && item.accountInfo.hasOwnProperty("emailAddress") && item.accountInfo.emailAddress != null && item.accountInfo.emailAddress.trim().length > 0) {
billingEmail = item.accountInfo.emailAddress;
}
if (billingPhone == undefined && item.accountInfo.hasOwnProperty("phoneNumber") && item.accountInfo.phoneNumber != null && item.accountInfo.phoneNumber.trim().length > 0) {
billingPhone = item.accountInfo.phoneNumber;
}
}
if (!cartItemInfo.hasOwnProperty(item.eventProductId)) {
cartItemInfo[item.eventProductId] = {
quantity: 0,
price: 0.0
};
}
cartItemInfo[item.eventProductId].quantity++;
cartItemInfo[item.eventProductId].price += parseFloat(item.price);
cartItemInfo[item.eventProductId].unitPrice = parseFloat(item.price);
symbol = item.symbol;
subtotal += item.price;
fee += item.fee;
var eventProductOptionsHtml = "";
if (item.productOptionsInfos) {
eventProductOptionsHtml += "";
$.each(item.productOptionsInfos, function (j, productOptionsInfo) {
eventProductOptionsHtml += "
" + productOptionsInfo.label + "
";
});
eventProductOptionsHtml += "
"
}
html += "" + "" + item.name + eventProductOptionsHtml + " " + "" + symbol + " " + parseFloat(item.price).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " " + " ";
});
$.each($store._store.codes(), function (c, code) {
if (code.haveProducts) {
$.each(code.groups, function (g, group) {
if (group.hasOwnProperty("count") && group.count > 0) {
if (group.hasOwnProperty("priceEach")) {
discount += group.count * group.discountAmountEach;
} else {
$.each(group.products, function (p, product) {
if (product.hasOwnProperty("count")) {
discount += group.count * product.count * product.discountAmountEach;
}
});
}
}
});
} else {
discount += (code.discountCodeAmountType == "AMOUNT" ? code.price : subtotal * code.price / 100);
}
});
storeInfo = $store._storage.store("store-info");
var haveBalance = parseFloat(subtotal - discount) > 0.00;
subtotal = parseFloat(subtotal).toFixed(2);
discount = parseFloat(discount).toFixed(2);
fee = (haveBalance ? parseFloat(fee).toFixed(2) : "0.00");
tax = parseFloat((parseFloat(subtotal) - parseFloat(discount) + parseFloat(fee)) * (parseFloat(storeInfo.salesTax) / 100)).toFixed(2);
total = parseFloat(parseFloat(subtotal) - parseFloat(discount) + parseFloat(fee) + parseFloat(tax)).toFixed(2);
html += " ";
html += "SUBTOTAL " + symbol + " " + subtotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " ";
html += (discount > 0.0 ? "DISCOUNT " + symbol + " " + parseFloat(discount * -1).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " " : "");
html += (fee > 0.0 ? "CONVENIENCE FEE " + symbol + " " + fee.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " " : "");
html += (tax > 0.0 ? "TAX " + symbol + " " + tax.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " " : "");
html += " ";
html += "TOTAL " + symbol + " " + total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " ";
html += "
";
html += $store.renderFbPixel("InitiateCheckout");
$store._storage.store("store-totals", {
subtotal: subtotal,
discount: discount,
fee: fee,
tax: tax,
total: total
});
$("[data-store-section='cart']").html("" + html + "" + this.renderPayment(billingName, billingEmail, billingPhone) + "
");
if (haveBalance) {
$store._store.paymentService.populate();
}
setTimeout($store._form.validate, 500);
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
_paymentFields: [{
"ordering": 1,
"formPartType": "text",
"name": "Name on Credit Card",
"choices": [],
"required": true,
"key": "name"
}, {
"ordering": 2,
"formPartType": "email",
"name": "e-mail address",
"choices": [],
"required": true,
"key": "emailAddress"
}, {
"ordering": 3,
"formPartType": "phone",
"name": "cellphone number",
"choices": [],
"required": true,
"key": "phoneNumber"
}],
_purchaseFields: [{
"ordering": 1,
"formPartType": "text",
"name": "full name",
"choices": [],
"required": true,
"key": "name"
}, {
"ordering": 2,
"formPartType": "email",
"name": "e-mail address",
"choices": [],
"required": true,
"key": "emailAddress"
}, {
"ordering": 3,
"formPartType": "phone",
"name": "cellphone number",
"choices": [],
"required": true,
"key": "phoneNumber"
}],
renderPayment:
function (billingName, billingEmail, billingPhone) {
$store.processingPayment = false;
var html = "";
var haveBalance = parseFloat($store._storage.store("store-totals").total) > 0.00;
$.each((haveBalance ? this._paymentFields : this._purchaseFields), function (pi, part) {
var val = "";
switch (part.key) {
case "name":
val = (billingName != undefined ? billingName : "");
break;
case "emailAddress":
val = (billingEmail != undefined ? billingEmail : "");
break;
case "phoneNumber":
val = (billingPhone != undefined ? billingPhone : "");
break;
}
html += "" + part.name.toLowerCase() + " ";
html += "" + $store._form.render("paymentInfo-" + part.key, 0, part, val) + " ";
});
if (haveBalance) {
html += "credit card information ";
/*html += "
";*/
html += "" + $store._store.paymentService.render() + " ";
}
$store._store.processPurchase("-bob-");
return "" + (haveBalance ? "Payment Information" : "Purchase Information") + "
" + "" + this._form.required() + "
" + "" + "back complete purchase
" + "- processing purchase -
";
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
processPayment: function () {
if ($store._form.validate()) {
console.warn("--- processPayment :: IN -------------------------------------------------------");
var haveBalance = parseFloat($store._storage.store("store-totals").total) > 0.00;
$("#str-buttons-payment").hide();
$("#str-message-payment").show();
if (haveBalance) {
console.info(haveBalance);
$store._store.paymentService.token();
} else {
$store._store.processPurchase();
}
console.warn("--- processPayment :: OUT -------------------------------------------------------");
} else {
this.renderError("Provide all required payment information.");
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
renderCompleted: function () {
if ($("[data-store-section='cart']").length == 0) {
return "
";
}
var html = "";
html += "";
html += "
Thank you for your purchase!
";
html += "
Your order has been successfully processed.
";
html += "
Your order number is " + $store._eventInfo.receipt.id + " .
";
html += "
";
html += "
You should receive an email with your event check-in details and purchase receipt within the next 5 minutes. If you do not, please check your Spam folder! Mark the email as safe if it landed there so your check-in details are easily accessible in your inbox for the event.
";
html += "
";
html += "
We hope you enjoy the event!
";
html += "
";
html += "done
";
html += $store.renderFbPixel("Purchase", $store._storage.store("store-totals").total);
$("[data-store-section='completed']").html(html);
$store.renderGGEvent("PurchaseComplete");
$store._storage.store("store", {});
$store._storage.store("accountInfos", {});
$store._store.codes({});
},
formatDates: function (json, which, pre) {
if (json) {
var start = (json.hasOwnProperty("availableStartDate") && (which == null || which == "availableStartDate") && json.availableStartDate != null ? json.availableStartDate : (json.hasOwnProperty("startDate") && json.startDate != null ? json.startDate : null));
var end = (json.hasOwnProperty("availableEndDate") && (which == null || which == "availableStartDate") && json.availableEndDate != null ? json.availableEndDate : (json.hasOwnProperty("endDate") && json.endDate != null ? json.endDate : null));
if (start == null && which != undefined) {
start = json[which];
end = json[which];
}
if ((start != null && !start.hasOwnProperty("year")) || (end != null && !end.hasOwnProperty("year"))) {
return "";
}
if (start != null && end != null) {
if (start.year.name == end.year.name) {
if (start.month.id == end.month.id) {
if (start.day.id == end.day.id) {
return "" + start.month.short + " " + start.day.name + ", " + start.year.name + " ";
} else {
return "" + start.month.short + " " + start.day.name + "-" + end.day.name + ", " + start.year.name + " ";
}
} else {
return "" + start.month.short + " " + start.day.name + " - " + end.month.short + " " + end.day.name + ", " + end.year.name + " ";
}
} else {
return "" + start.month.short + " " + start.day.name + ", " + start.year.name + " - " + end.month.short + " " + end.day.name + ", " + end.year.name + " ";
}
} else if (start != null) {
return "" + (pre != undefined ? pre : "from") + " " + start.month.short + " " + start.day.name + ", " + start.year.name + " "
} else if (end != null) {
return "" + (pre != undefined ? pre : "until") + " " + end.month.short + " " + end.day.name + ", " + end.year.name + " "
}
return "no dates available ";
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
render: function (type) {
console.info("--- render :: " + type);
switch (type) {
//---------------------------------------------------------------------------------------------------
case "receipt":
this.next();
$("#str-message-payment").hide();
$("#str-buttons-payment").show();
break;
case "error":
this.renderError("Error occurred processing payment. " + $store._eventInfo.error.error);
$("#str-message-payment").hide();
$("#str-buttons-payment").show();
break;
case "uniqueCheck":
if ($store._eventInfo.uniqueCheck.status != "success") {
this.renderError($store._eventInfo.uniqueCheck.status);
} else {
$store.nextTo("cart", "Checkout");
$store.renderCart();
}
break;
}
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
content: function (html) {
$("#store-" + $store._conf._eventKey).html("" + html + "
");
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
data: function (type, data) {
console.info("--- data :: " + type);
console.info(data);
this._eventInfo[type] = data;
this.render(type);
},
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
// @formatter:off
style: {
".str": "max-width: 98%;width: 800px;margin:1% auto;border: 2px solid #aaa;border-radius: 7px;padding: 20px;background-color:#fff;color:#333;",
".str, .str *": "font:12pt Arial;",
".str a": "color:inherit !important;font-size:inherit !important;",
".str table": "border-spacing: 0px;border-collapse: separate;width:100%;",
".str table tr td": "border:0px;padding:2px;text-align:left;",
".str img": "max-width:98%;margin:1px 1%;border-radius:4px;",
".str .fa": "font-size:120%;margin-right:7px;width:15px;text-align:center;",
".str button": "text-align:center;color:inherit;border:1px solid #aaa;background-color:#eee;font-size:90%;border-radius:3px;padding:1px 10px;cursor:pointer;",
".str input, .str select": "padding:10px 2%;width:96% !important;border:1px solid #bbb;border-radius:3px;color:#333",
".str .str-hidden": "display:none;",
".str .str-buttons": "text-align:center;padding-top:10px;",
".str .str-buttons button,.str .str-buttons-button": "padding:10px 30px;margin:5px 3px;",
".str .str-buttons button.str-back": "border:1px solid #ccc;background-color:#fff;",
".str .str-buttons-remove button": "padding:10px 20px;margin:10px;color:#900;background-color:rgba(200,0,0,.08);",
".str .str-message": "display:none;text-align:center;padding:20px;font-style:italic;color:rgb(200,0,0);font-size:90%;",
".str .str-event-info": "text-align:center;background-color:#999;color:#fff;margin:auto;margin-top:-21px;margin-bottom:10px;max-width:85%;font-size:70%;padding:5px; border-radius:0 0 7px 7px;",
".str .str-event-info>div": "text-align:center;font-size:70%;font-style:italic;margin-top:3px;display:none;",
".str .str-navigation": "width:100%;border-bottom:1px solid #999;margin-bottom:10px;padding-bottom:5px;",
".str .str-navigation tr td": "text-align:center;padding:4px;",
".str .str-navigation tr td.str-title": "font-size:120%;",
".str .str-navigation tr td:first-child, .str .str-navigation tr td:last-child": "width:30px;",
".str .str-error": "text-align:center;border:1px solid rgba(200,0,0,.1);border-radius:5px;background-color:rgba(200,0,0,.05);color:rgb(200,0,0);padding:5px;font-style:italic;font-size:85%;margin-bottom:5px;display:none;",
".str .str-instructions": "font-size:75%;text-align:center;font-style:italic;color:#aaa;padding:5px;",
".str .str-item-exclusive": "color:#900;background-color:rgba(200,0,0,.08);margin:5px 15px;padding:5px 10px;font-style:italic;font-size:65%;display:inline-block;border-radius:5px;",
".str .str-item-exclusive.full": "font-size:90%;display:block;text-align:center;padding:10px;",
".str .str-section": "display:none",
".str .str-section-heading": "font-size:120%;margin:20px 2px 2px 2px;",
".str .str-section-heading:first-child": "margin-top:2px",
".str .str-tickets": "border:1px solid #ccc;border-radius:5px;",
".str .str-ticket": "border-width:0px;border-top:1px solid #ccc;width:98%;cursor:pointer;margin:5px;padding:5px;",
".str .str-ticket:first-child": "border-top:none;",
".str .str-ticket:hover": "background-color:#f8f8f8;",
".str .str-ticket-group": "border: 1px solid #ccc;padding: 5px;border-radius: 5px;margin:20px 0;",
".str .str-ticket .str-item-name": "font-size:130%;padding:10px;",
".str .str-ticket .str-item-count": "font-size:70%;padding-left:10px;opacity:.8;font-style:italic;",
".str .str-ticket .str-item-unique": "font-size:75%;margin-left:5px;font-style:italic;",
".str .str-ticket .str-item-price": "white-space:nowrap;text-align:right;font-size:130%;padding:10px;vertical-align:top;width:1%;",
".str .str-ticket .str-item-price span": "font-size:70%;color:#999;",
".str .str-ticket .str-item-price div": "font-size:70%;color:#555;",
".str .str-ticket .str-item-price-discount": "white-space:nowrap;text-align:right;font-size:150%;padding:10px;vertical-align:top;width:1%;",
".str .str-ticket .str-item-price-discount > *": "opacity:.7",
".str .str-ticket .str-item-description": "padding:5px 15px 0 15px;font-size:85%;font-style:italic;color:#777;",
".str .str-ticket .str-item-description *": "font-size:inherit;font-style:inherit;",
".str .str-ticket .str-item-description > *": "max-width:98%;",
".str .str-ticket .str-item-description .str-item-quantity": "text-align:center;max-width:80px;font-size:120%;",
".str .str-ticket .str-item-heading": "padding:5px 15px 0 15px;font-size:85%;font-style:italic;color:#777;",
".str .str-item-items": "padding:10px 0 10px 15px;",
".str .str-item-items>div": "font-weight:bold;",
".str .str-item-items>div>span": "font-weight:normal;font-size:70%;margin-left:10px;font-style:italic;",
".str .str-item-items>div>div": "font-weight:normal;color:#777",
".str .str-item-items>div>div>p": "margin:0px 10px;font-size:85%;",
".str .str-code-link": "text-align:right;cursor:pointer;",
".str .str-code": "padding:10px;text-align:center;",
".str .str-code input": "text-align:center;",
".str .str-item-label": "width:100%;font-size:85%;font-style:italic;padding:7px 7px 3px 7px;color:#999;",
".str .str-item-text": "width:100%;",
".str .str-item-full>*": "width:100%;",
".str .str-item-shaded": "background-color:#f0f0f0;",
".str .str-divider": "border-top:1px solid #aaa;padding:0px;",
".str .str-cart": "font-size:90%;font-weight:normal;border:1px solid #ccc;border-radius:5px;padding:10px;",
".str .str-sub-heading": "font-size:120%;border-bottom:1px solid #aaa;padding:5px;background-color:#eee;text-align:center;margin-top:15px;",
".str .str-sub-heading:first-child": "margin-top:0px;",
".str .str-cart .str-cart-item-first .str-cart-item": ";border-top:none;",
".str .str-cart .str-cart-item": "padding:3px;border-top:1px solid #ccc;",
".str .str-cart .str-cart-item-name": "",
".str .str-cart .str-cart-item-price": "text-align:right;white-space:nowrap;width:1%;padding-right:3px;",
".str .str-cart .str-cart-total": "white-space:nowrap;width:1%;font-size:90%;text-align:right;padding-right:5px;padding-left:25px;font-size:70%;color:#999;",
".str .str-completed div": "margin:10px 0;",
".str .str-completed .str-completed-thankyou": "font-size:120%;",
".str .str-completed .str-completed-order-number": "font-size:120%;font-weight:bolder;",
".str .str-completed .str-completed-receipt": "border:1px solid #aaa;padding:10px;display:inline-block;text-decoration: none;margin:15px;",
".str .str-completed .str-completed-instruction": "font-size:85%;",
".str .str-completed .str-completed-enjoy": "font-size:120%;font-weight:bold;color:#111;text-align:center;",
".str .str-form-item-required": "background-color:rgba(221, 119, 0, .05);border:1px solid #aaa;",
".str-card-elements > div": "border:1px solid #999;border-radius: 4px;background-color: white;box-shadow: none;width:15% !important;display:inline-block;margin:1px;",
"#pay-theory-credit-card-number": "width:50% !important;",
".str-card-elements > div .field-wrapper > iframe": "height:35px;",
".str .StripeElement ": "box-sizing: border-box;padding: 13px;border: 1px solid #999;border-radius: 4px;background-color: white;box-shadow: none;-webkit-transition: box-shadow 150ms ease;transition: box-shadow 150ms ease;",
".str .StripeElement--focus ": "box-shadow: none",
".str .StripeElement--invalid ": "border-color: #fa755a;",
".str .StripeElement--webkit-autofill ": " background-color: #fefde5 !important;",
},
css: function () {
var css = "";
$.each(this.style, function (k, v) {
css += k + "{" + v + "} ";
});
$("").appendTo("head");
},
// @formatter:on
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
// @formatter:off
_eventInfo: { "codes": [ { "applyTo": "EACH", "code": "JOURNEY", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1857 }, { "applyTo": "EACH", "code": "STYLE", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 998, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1859 }, { "applyTo": "EACH", "code": "KISSES", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1866 }, { "applyTo": "EACH", "code": "KISS", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1861 }, { "applyTo": "EACH", "code": "LOVE", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886}, {"eventProductId": 9151}, {"eventProductId": 9150} ] }], "isPackage": false, "maxUsageCounts": 998, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1856 }, { "applyTo": "EACH", "code": "THANKYOU50", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1865 }, { "applyTo": "EACH", "code": "VIP50", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1864 }, { "applyTo": "EACH", "code": "LUXURY", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1860 }, { "applyTo": "EACH", "code": "SOUTHERNBRIDE", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1862 }, { "applyTo": "EACH", "code": "WED", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1855 }, { "applyTo": "EACH", "code": "WEDDING", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1863 }, { "applyTo": "EACH", "code": "YOUNG", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1867 }, { "applyTo": "EACH", "code": "AWEVIP", "applyToType": "DEFAULT", "price": "100.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1858 }, { "applyTo": "EACH", "code": "XOXO", "applyToType": "DEFAULT", "price": "50.00", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6887}, {"eventProductId": 6890}, {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 1868 }, { "applyTo": "EACH", "code": "VIPGIFT", "applyToType": "DEFAULT", "price": "0.20", "discountCodeType": "MANUAL", "exclusive": "NON-EXCLUSIVE", "groups": [{ "maxQuantity": 1, "products": [ {"eventProductId": 6893}, {"eventProductId": 6886} ] }], "isPackage": false, "maxUsageCounts": 1000, "discountCodeAmountType": "PERCENTAGE", "eventDiscountCodeId": 2122 } ], "paymentService": { "uid": "acct_1C6OdlC2GbhVjm6P", "jsApiUrl": "https://js.stripe.com/v3/", "name": "Stripe", "active": false, "serviceInstanceId": 5, "publicKey": "pk_live_7nlSMNC5CczWf6uwLsZ6Khhs", "serviceId": 21 }, "currency": { "symbol": "$", "code": "usd", "dollarAmount": "0.00", "name": "USD ($)", "id": 1, "percentageAmount": "0.000" }, "attributes": { "mapsAllowed": "true", "fbPixel": "675046442627064", "makeWebhookId": "0-1", "makeAuthApiKey": "ma9hxdY9nB6KiZ)Aa0FRBcMTn14B1wU1lvke" }, "salesTax": "0.000", "storeProductOrdering": "priceAscendingNameAscending", "event": { "eventId": 1671, "name": "Atlanta Wedding Extravaganza 8_17_25", "producer": { "phone": "+1 (770) 744-5750", "name": "Atlanta Wedding Extravaganza", "email": "shelly@atlantapartyconnection.com" }, "startDate": "August 17, 2025 @ 4:00PM" }, "eventStoreFee": "Processing Fee", "enabled": true, "eventStoreButton": "buy tickets", "products": [ { "variationLabel": "Your Entry Time", "maxPurchaseQuantity": 1, "ordering": 1, "description": "Getting Married? Get your tickets here. Bringing guests? Get Guest tickets below.<\/strong><\/p>", "requireResponse": false, "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" }, "form": { "code": "dbd054aaa69ae", "stage": "", "parts": [ { "ordering": 1, "formPartType": "text", "name": "Full Name", "choices": [], "required": true, "key": "name" }, { "ordering": 2, "formPartType": "email", "name": "e-Mail Address", "choices": [], "required": true, "key": "emailAddress" }, { "ordering": 4, "formPartType": "phone", "name": "Phone Number", "choices": [], "required": true, "key": "phoneNumber" }, { "ordering": 6, "formPartType": "choice", "name": "Have Wedding Date?", "choices": [ { "aux1": "", "ordering": 1, "label": "Yes", "value": "true" }, { "aux1": "", "ordering": 2, "label": "No", "value": "false" } ], "required": true, "key": "weddingDateProvided" }, { "parentKey": "weddingDateProvided", "ordering": 7, "formPartType": "date", "name": "Wedding Date", "choices": [], "parentChoiceKey": "true", "required": true, "key": "weddingDate" } ], "formTypeId": 1, "name": "Store Default", "key": "storeAttendeeInfo" }, "variations": [{ "availableQuantity": 859, "eventProductVariationId": 99142, "ordering": 2, "price": "0.00", "name": "2:30PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "1.50", "dollarAmountOther": "0.00", "name": "Default Ticket", "percentageAmount": "0.000", "percentageAmountOtherType": "default" } }], "formName": "storeAttendeeInfo", "options": [], "eventProductId": 9150, "name": "General Admission ENGAGED Tickets", "productType": "Ticket" }, { "variationLabel": "Your Entry Time", "maxPurchaseQuantity": 0, "variations": [ { "availableQuantity": 221, "eventProductVariationId": 99143, "ordering": 0, "price": "0.00", "name": "2:00PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "1.50", "dollarAmountOther": "0.00", "name": "Default Ticket", "percentageAmount": "0.000", "percentageAmountOtherType": "default" } }, { "availableQuantity": 791, "eventProductVariationId": 99144, "ordering": 2, "price": "0.00", "name": "2:30PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "1.50", "dollarAmountOther": "0.00", "name": "Default Ticket", "percentageAmount": "0.000", "percentageAmountOtherType": "default" } } ], "ordering": 1, "options": [], "eventProductId": 9151, "name": "General Admission GUEST Tickets", "description": "Get a ticket for each guest here.<\/strong><\/p>", "requireResponse": false, "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "Your Entry Time", "maxPurchaseQuantity": 0, "variations": [ { "availableQuantity": 287, "eventProductVariationId": 70661, "ordering": 0, "price": "20.00", "name": "1:00PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "1.50", "dollarAmountOther": "0.00", "name": "Default Ticket", "percentageAmount": "0.000", "percentageAmountOtherType": "default" } }, { "availableQuantity": 300, "eventProductVariationId": 70660, "ordering": 2, "price": "20.00", "name": "1:30PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "1.50", "dollarAmountOther": "0.00", "name": "Default Ticket", "percentageAmount": "0.000", "percentageAmountOtherType": "default" } } ], "ordering": 1, "options": [], "eventProductId": 6886, "name": "VIP GUEST Tickets", "description": "Moms, Dads or Wedding Party? VIP Guests can enter early and enjoy a free glass of champagne! Limited quantities available.<\/strong><\/p>", "requireResponse": false, "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" }, "productType": "Ticket" }, { "variationLabel": "Your Entry Time", "maxPurchaseQuantity": 1, "ordering": 1, "description": "Brides or Grooms - <\/strong>Limited VIP tix available. <\/em>Enjoy early entry, VIP gifts and champagne! Are you bringing VIP Guests? Purchase VIP Guest Tickets below. <\/strong><\/p>", "requireResponse": false, "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" }, "form": { "code": "670cdc91cde7a", "stage": "", "parts": [ { "ordering": 1, "formPartType": "text", "name": "Full Name", "choices": [], "required": true, "key": "name" }, { "ordering": 2, "formPartType": "email", "name": "e-Mail Address", "choices": [], "required": true, "key": "emailAddress" }, { "ordering": 4, "formPartType": "phone", "name": "Phone Number", "choices": [], "required": true, "key": "phoneNumber" }, { "ordering": 5, "formPartType": "choice", "name": "Have Wedding Date?", "choices": [ { "aux1": "", "ordering": 1, "label": "Yes", "value": "true" }, { "aux1": "", "ordering": 2, "label": "No", "value": "false" } ], "required": true, "key": "weddingDateProvided" }, { "parentKey": "weddingDateProvided", "ordering": 6, "formPartType": "date", "name": "Wedding Date", "choices": [], "parentChoiceKey": "true", "required": true, "key": "weddingDate" }, { "ordering": 7, "formPartType": "text", "name": "Street 1", "choices": [], "required": false, "key": "streetAddress1" }, { "ordering": 8, "formPartType": "text", "name": "Street 2", "choices": [], "required": false, "key": "streetAddress2" }, { "ordering": 9, "formPartType": "text", "name": "City", "choices": [], "required": false, "key": "city" }, { "ordering": 10, "formPartType": "text", "name": "State", "choices": [], "required": false, "key": "state" }, { "ordering": 11, "formPartType": "text", "name": "Country", "choices": [], "required": false, "key": "country" }, { "ordering": 12, "formPartType": "text", "name": "Postal Code", "choices": [], "required": false, "key": "zip" } ], "formTypeId": 1, "name": "Store Default With Address", "key": "storeAttendeeWithAddressInfo" }, "variations": [ { "availableQuantity": 82, "eventProductVariationId": 70655, "ordering": 0, "price": "30.00", "name": "1:00PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" } }, { "availableQuantity": 95, "eventProductVariationId": 70654, "ordering": 2, "price": "30.00", "name": "1:30PM", "feeType": { "percentageAmountOther": "0.00", "percentageAmountType": "default", "dollarAmount": "2.00", "dollarAmountOther": "0.00", "name": "Default", "percentageAmount": "0.040", "percentageAmountOtherType": "default" } } ], "formName": "storeAttendeeWithAddressInfo", "options": [], "eventProductId": 6893, "name": "VIP ENGAGED Ticket", "productType": "Ticket" } ] },
_conf: { _uri:"https://www.bridescan.com", _authKey:"awe", _eventKey:"atlanta" },
_store: { init: function (storeInfo) { if (!this.initialized) { console.info("### STORE :: init :: --------------------------------------------------------------------------------------------------------------"); console.info(storeInfo); if (storeInfo.hasOwnProperty("paymentService")) { this["paymentService"] = (storeInfo.paymentService.name == "Stripe" ? this.stripe : this.paytheory); $("head").append(""); } $.each(storeInfo.products, function (i, p) { if (p.hasOwnProperty("variations") && p.variations.length == 0) { delete p.variations; } }); $store._storage.store("store-info", storeInfo); $store._storage.store("store", {}); this["initialized"] = true; if(this.hasOwnProperty("paymentService")) { setTimeout(this.paymentService.init, 2000); } } }, update: function () { console.warn("---------------------------------------------------------------------"); console.info("### STORE :: update :: " + this._eventKey); var store = $store._storage.store("store"); var codes = $store._store.codes(); $("[data-store='" + this._eventKey + "']").each(function () { var id = $(this).data("formItemId"); var index = $(this).data("formItemIndex"); var name = $(this).data("formItemName"); var type = $(this).data("formItemType"); var val = $(this).val(); console.info(id + " :: " + index + " :: " + name + " :: " + val); if (val != 0 && val.length == 0) val = null; if (!store.hasOwnProperty(id)) { store[id] = {id: id}; } if (index) { if (!store[id].hasOwnProperty("infos")) { store[id]["infos"] = {}; } if (!store[id].infos.hasOwnProperty(index)) { store[id].infos[index] = {}; } if (val) store[id].infos[index][name] = val; else delete store[id].infos[index][name]; } else { if (val) store[id][name] = (type == "number" ? parseInt(val) : val); else delete store[id][name]; } }); $.each(codes, function (c, code) { $.each(code.groups, function (c, group) { if (group.hasOwnProperty("count") && group.count > 0) { $.each(group.products, function (c, product) { if (product.hasOwnProperty("count")) { store[product.eventProductId].quantity += product.count * group.count; } }); } }); }); console.info("--- STORE -------------------------------"); console.info(store); console.info("--- STORE -------------------------------"); $store._storage.store("store", store); accountInfos = {}; $.each(store, function (i, item) { if (item.hasOwnProperty("infos")) { $.each(item.infos, function (i, info) { var accountInfo = JSON.parse(JSON.stringify(info)); if (!accountInfos.hasOwnProperty(item.id)) { accountInfos[item.id] = []; } accountInfos[item.id].push(accountInfo); }); } }); if (Object.keys(accountInfos).length > 0) { console.info("--- ACCOUNT INFOS -------------------------------"); console.info(accountInfos); console.info("--- ACCOUNT INFOS -------------------------------"); $store._storage.store("accountInfos", accountInfos); } console.warn("---------------------------------------------------------------------"); }, infos: function () { var products = []; var storeInfo = $store._storage.store("store-info"); var store = $store._storage.store("store"); $.each(store, function (id, item) { if (item.quantity > 0) { var product = null; $.each(storeInfo.products, function (ip, p) { if (p.eventProductId == id) product = p; }); if (product && (product.hasOwnProperty("form") || product.hasOwnProperty("variations"))) { console.info(product); var p = {eventProductId: product.eventProductId, variationLabel: product.variationLabel, name: product.name, price: product.price, quantity: item.quantity, form: product.form}; if (product.hasOwnProperty("variations")) { p["variations"] = product.variations; } if (product.hasOwnProperty("options")) { p["options"] = product.options; } if (product.hasOwnProperty("uniqueAccount")) { p["uniqueAccount"] = product.uniqueAccount; } products.push(p); } } }); return (products.length != 0 ? products : null) }, codes: function (codes) { if (codes) $store._storage.store("store-codes", codes); return $store._storage.store("store-codes"); }, cart: function () { console.warn("---------------------------------------------------------------------"); console.info("### STORE :: cart"); var cart = []; var storeInfo = $store._storage.store("store-info"); var store = $store._storage.store("store"); $.each(store, function (id, item) { var product = null; $.each(storeInfo.products, function (ip, p) { if (p.eventProductId == id) product = p; }); if (product) { console.info("-------------------------"); console.info(product); console.info(item); for (var i = 0; i < item.quantity; i++) { var variation = null; var info = null; var optionsTotal = 0.0; var productOptionsInfos = []; if (item.hasOwnProperty("infos") && item.infos.hasOwnProperty(i + 1)) { info = item.infos[i + 1]; if (product.variations) { $.each(product.variations, function (iv, v) { if (v.eventProductVariationId == info.variation) { variation = v; } }); } if (product.options) { var auxs = []; $.each(product.options, function (io, o) { if (info.hasOwnProperty(o.eventProductId)) { if (o.variations) { $.each(o.variations, function (iv, v) { if (v.eventProductVariationId == info[o.eventProductId] && v.hasOwnProperty("price")) { optionsTotal += parseFloat(v.price); productOptionsInfos.push({label: v.name, price: v.price}); auxs.push({"id": o.eventProductId, "value": info[o.eventProductId], "ordering": io}); } }); } else { productOptionsInfos.push({label: info[o.eventProductId]}); auxs.push({"id": o.eventProductId, "value": info[o.eventProductId], "ordering": io}); } } }); info["infos"] = [{auxs: auxs}]; } } var price = parseFloat(variation ? variation.price : product.price) + optionsTotal; var dollarAmount = parseFloat(product.feeType.dollarAmount); var cartItem = {id: "p" + id + "-" + i, eventProductId: id, name: product.name + (variation ? " - " + variation.name : ""), price: price, symbol: storeInfo.currency.symbol, quantity: 1, fee: (dollarAmount + ((price + (product.feeType.percentageAmountType == "onFeeAmount" ? dollarAmount : 0.00)) * parseFloat(product.feeType.percentageAmount))), productOptionsInfos: productOptionsInfos}; if (info) { var accountFields = ",name,companyName,contactName,emailAddress,phoneNumber,mobilePhoneNumber,streetAddress1,streetAddress2,city,state,country,zip,"; var attributes = {}; $.each(info, function (field, value) { if (accountFields.indexOf("," + field + ",") == -1 && field != "infos") { attributes[field] = value; } }); if (Object.keys(attributes).length != 0) { info["attributes"] = attributes; } cartItem["accountInfo"] = info; if (info.hasOwnProperty("variation")) { cartItem["eventProductVariationId"] = info.variation; var variationDollarAmount = parseFloat(variation.feeType ? variation.feeType.dollarAmount : product.feeType.dollarAmount); cartItem.fee = (variationDollarAmount + ((price + (product.feeType.percentageAmountType == "onFeeAmount" ? variationDollarAmount : 0.00)) * parseFloat(variation.feeType ? variation.feeType.percentageAmount : product.feeType.percentageAmount))); delete info.variation; } } cart.push(cartItem); } } }); console.info(cart); console.warn("---------------------------------------------------------------------"); return cart; }, processPurchase: function (token) { console.warn("---------------------------------------------------------------------"); console.warn("--- processPurchase"); console.info("### STORE :: processPurchase :: " + token); var subtotal = 0.0; var fee = 0.0; var cart = $store._store.cart(); var json = { eventId: $store._eventInfo.event.eventId, name: $("[data-form-item-id='paymentInfo-name']").val(), emailAddress: $("[data-form-item-id='paymentInfo-emailAddress']").val(), phoneNumber: $("[data-form-item-id='paymentInfo-phoneNumber']").val(), paymentType: 1, products: [], eventDiscountCodes: [] }; if (token) { json["paymentServiceToken"] = token; } $.each(cart, function (index, item) { var product = JSON.parse(JSON.stringify(item)); delete product.fee; delete product.id; delete product.name; delete product.price; delete product.symbol; json.products.push(product); subtotal += item.price; fee += item.fee; }); $.each($store._store.codes(), function (c, code) { var _code = { eventDiscountCodeId: code.eventDiscountCodeId, groups: [] }; $.each(code.groups, function (g, group) { if (group.hasOwnProperty("count") && group.count > 0) { var _group = {eventDiscountCodeGroupId: 0, count: group.count, products: []}; if (group.hasOwnProperty("eventDiscountCodeGroupId")) { _group["eventDiscountCodeGroupId"] = group.eventDiscountCodeGroupId; } $.each(group.products, function (p, product) { if (product.hasOwnProperty("count") && product.count > 0) { _group.products.push({eventProductId: product.eventProductId, count: product.count}); } }); _code.groups.push(_group); } }); json.eventDiscountCodes.push(_code); }); json["total"] = parseFloat($store._storage.store("store-totals").total).toFixed(2); console.info(json); if (token != "-bob-") { $store._comm._post("/api/embedPurchase", json); } console.warn("--- processPurchase"); console.warn("---------------------------------------------------------------------"); }, hasQuantity: function () { var store = $store._storage.store("store"); var ret = false; $.each(store, function (key, item) { ret |= item.quantity > 0; }); var codes = $store._store.codes(); $.each(codes, function (c, code) { $.each(code.groups, function (g, group) { ret |= group.hasOwnProperty("count") && group.count > 0; }); }); return ret; }, inputs: { number: function (id, val, cls, max) { return " "; }, choice: function (id, index, options, cls, key) { return "" + options + " "; } }, activity: { record: function (auxLogTypeAction, comment, record) { console.info("activity.record :: " + auxLogTypeAction + " :: " + comment); var json = {eventId: $store._eventInfo.event.eventId, auxLogTypeAction: auxLogTypeAction, comment: comment, uniqueId: $store._store.activity.getUniqueId()}; var params = new URLSearchParams(window.location.search); if (params.get("fbclid") != null) { json["fbclid"] = params.get("fbclid"); } if (record != undefined) { json["record"] = record; } $store._comm._postAction("/api/embedStoreActivity", json); }, getUniqueId: function () { var uniqueId = $store["_app_aux_log_id"]; if (uniqueId == null || uniqueId == undefined) { uniqueId = ""; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; for (var i = 0; i < 10; i++) { uniqueId += characters.charAt(Math.floor(Math.random() * charactersLength)); } $store["_app_aux_log_id"] = "EM_" + uniqueId + "-" + new Date().getTime(); } return $store["_app_aux_log_id"]; } }, paytheory: { init: function () { console.warn("### STORE :: PAYTHEORY :: INIT"); $store["paytheory"] = window.paytheory }, render: function () { console.info("### STORE :: PAYTHEORY :: RENDER"); return "" + "
" + "
" + "
" + "
" + "
"; }, populate: function () { console.warn("### STORE :: PAYTHEORY :: POPULATE"); $store.paytheory.payTheoryFields({ apiKey: $store._storage.store("store-info").paymentService.apiKey }); }, token: async function () { console.warn("### STORE :: PAYTHEORY :: TOKEN"); var name = $("[data-form-item-id='paymentInfo-name']").val(); var emailAddress = $("[data-form-item-id='paymentInfo-emailAddress']").val(); var phoneNumber = $("[data-form-item-id='paymentInfo-phoneNumber']").val(); console.info(name + " :: " + emailAddress + " :: " + phoneNumber); var firstName = name; var lastName = name; if (name.split(" ").length > 1) { firstName = name.split(' ').slice(0, -1).join(' '); lastName = name.split(' ').slice(-1).join(' '); } const TOKENIZE_PAYMENT_METHOD_PARAMETERS = { payorInfo: { "first_name": firstName, "last_name": lastName, "email": emailAddress, "phone": phoneNumber } }; let result = await $store.paytheory.tokenizePaymentMethod(TOKENIZE_PAYMENT_METHOD_PARAMETERS); console.info(result); if (result.type === "TOKENIZED") { $store._store.processPurchase(result.body.payment_method_id); } else if (result.type === "ERROR") { $("#str-message-payment").hide(); $("#str-buttons-payment").show(); $store.renderError("Processing of your payment did not succeed. Please verify your payment information and try again."); } } }, stripe: { init: function () { console.warn("### STORE :: STRIPE :: INIT"); var paymentService = $store._storage.store("store-info").paymentService; try { if (paymentService.hasOwnProperty("uid")) { $store["stripe"] = Stripe(paymentService.publicKey, {"stripeAccount": paymentService.uid}); } else { $store["stripe"] = Stripe(paymentService.publicKey); } } catch (e) { /*setTimeout(this.initStripe, 1000);*/ } }, render: function () { console.warn("### STORE :: STRIPE :: RENDER"); return "
"; }, populate: function () { console.warn("### STORE :: STRIPE :: POPULATE"); if ($store.stripe) { if ($store.stripe.elements()) { var style = {base: {color: '#32325d', fontFamily: '"Helvetica Neue", Helvetica, sans-serif', fontSmoothing: 'antialiased', fontSize: '14px', '::placeholder': {color: '#aab7c4'}}, invalid: {color: '#fa755a', iconColor: '#fa755a'}}; var elements = $store.stripe.elements(); $store["card"] = elements.create('card', {style: style}); $store.card.mount('#card-element'); $store.card.addEventListener('change', function (event) { if (event.error) { $store.renderError(event.error.message); } }); } } }, token: function () { console.warn("### STORE :: STRIPE :: TOKEN"); var name = $("[data-form-item-id='paymentInfo-name']").val(); var emailAddress = $("[data-form-item-id='paymentInfo-emailAddress']").val(); var phoneNumber = $("[data-form-item-id='paymentInfo-phoneNumber']").val(); $store.stripe.createPaymentMethod({type: "card", card: $store.card, billing_details: {name: name, email: emailAddress, phone: phoneNumber}}).then(function (result) { if (result.error) { $("#str-message-payment").hide(); $("#str-buttons-payment").show(); $store.renderError(result.error.message); } else { $store._store.processPurchase(result.paymentMethod.id); } }); } } },
_form: { _css_prefix_: "", render: function (id, index, field, value, datas) { return this[field.formPartType](id, index, field, value, datas); }, text: function (id, index, field, value, datas) { return " "; }, email: function (id, index, field, value, datas) { return " "; }, phone: function (id, index, field, value, datas) { return " "; }, hidden: function (id, index, field, value, datas) { return " "; }, date: function (id, index, field, value, datas) { return " "; }, choice: function (id, index, field, value, datas) { var choices = " "; $.each(field.choices, function (i, c) { choices += "" + c.label + " "; }); return "" + choices + " "; }, required: function () { return "required
"; }, datas: function (id, index, field, datas) { var additionalDatas = ""; if (datas) { $.each(datas, function (k, v) { additionalDatas += "data-" + k + "='" + v + "' "; }) } return additionalDatas + "data-store='" + this._eventKey + "' " + "data-form-item-id='" + id + "' " + "data-form-item-lbl-id='" + id + "-" + (index ? index + "-" : "") + field.key + "' " + (index ? "data-form-item-index='" + index + "' " : "") + "data-form-item-name='" + field.key + "' data-form-item-product='" + field.product + "' data-form-item-lbl='" + field.name + "' data-form-item-type='" + field.formPartType + "' " + "data-form-item-required='" + field.required + "' " + "data-form-item-required-css='" + this._css_prefix_ + "form-item-required' " + (field.parentKey ? "data-form-item-parent='" + field.parentKey + "' " : "") + (field.parentChoiceKey ? "data-form-item-parent-value='" + field.parentChoiceKey + "' " : "") + "onkeyup=\"" + this._root + "._form.validate('" + id + "')\" " + "onchange=\"" + this._root + "._form.validate('" + id + "')\""; }, lbldatas: function (id, index, field) { return " data-form-lbl-id='" + id + "-" + (index ? index + "-" : "") + field.key + "' "; }, validate: function (iid) { var _valid = true; $("[data-store='" + $store._form._eventKey + "']").each(function () { var parentKey = $(this).data("formItemParent"); var parentValue = $(this).data("formItemParentValue") + ""; var index = $(this).data("formItemIndex"); if (parentKey != null) { var parent = $("[data-store='" + $store._form._eventKey + "'][data-form-item-name='" + parentKey + "']" + (index ? "[data-form-item-index='" + index + "']" : "") + ":visible"); var value = parent.val() + ""; if (parent.length == 0 || value != parentValue) { $(this).hide(); $("[data-form-lbl-id='" + $(this).data("formItemLblId") + "']").hide(); } else { $(this).show(); $("[data-form-lbl-id='" + $(this).data("formItemLblId") + "']").show(); } } }); $("[data-store='" + $store._form._eventKey + "']:visible").each(function () { var id = $(this).data("formItemId"); var val = $(this).val(); var name = $(this).data("formItemName"); var type = $(this).data("formItemType"); var required = $(this).data("formItemRequired"); var requiredCss = $(this).data("formItemRequiredCss"); if (iid == undefined || (iid != undefined && (iid == id))) { $(this).removeClass(requiredCss); valid = true; if (id && required && !val) { valid = false; } if (val) { switch (type) { case "email": valid = $store._form.validateEmailAddress(val); break; case "phone": valid = $store._form.validatePhone(val); break; } switch (name) { case "state": valid = $store._form.validateState(val); break; case "zip": valid = $store._form.validateZip(val); break; } } _valid &= valid; if (!valid) $(this).addClass(requiredCss); } }); return _valid; }, validateUnique: function (iid) { var _valid = this.validate(); if (_valid) { var uniques = {}; var duplicates = false; $("[data-unique]").each(function () { console.info($(this).data()); if (!uniques.hasOwnProperty($(this).val())) { uniques[$(this).val()] = $(this).data("formItemId"); } else { duplicates = true; _valid = "Only one " + $(this).data("formItemProduct") + " per " + $(this).data("formItemLbl") + " can be purchased."; } }); if (!duplicates) { var emailsProducts = []; $.each(uniques, function (email, eventProductId) { emailsProducts.push({emailAddress: email, eventProductId: eventProductId}); }); if (emailsProducts.length != 0) { $store._comm._post("/api/purchasedProductCheck", emailsProducts); return "uniqueCheck"; } } } return _valid; }, validateEmailAddress: function (value) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value); }, validatePhone: function (value) { return /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im.test(value); }, validateState: function (value) { return /^(A[BLKSZRAEP]|BC|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ABDEHINOPST]|N[BCDEHJLMVSY]|O[NHKR]|P[AERW]|QC|RI|S[CDK]|T[NX]|UT|V[AIT]|W[AIVY])$/.test(value); }, validateZip: function (value) { return /^[0-9A-Z -]{1,10}$/.test(value); } },
_storage: { store: function (key, value) { if (window.localStorage) { if (key !== undefined) { if (value !== undefined) { if (value != null) { value = JSON.stringify(value); window.localStorage[this._eventKey + "-" + key] = value; if (window.localStorage[this._eventKey + "-" + key] != value) alert("SYSTEM ERROR: Unable to store local data!!!"); return window.localStorage[this._eventKey + "-" + key] == value; } else { delete window.localStorage[this._eventKey + "-" + key]; } } else { if (window.localStorage[this._eventKey + "-" + key]) { return JSON.parse(window.localStorage[this._eventKey + "-" + key]); } return {}; } } } } },
_comm: { _uri: "https://www.bridescan.com", _initialize: function () { $("body") .append("") .append("") .append("") .append("") .append(""); for (var i = 0; i < 20; i++) { $("body").append(""); } }, _get: function (url) { url = this._uri + (url.indexOf("/") == 0 ? "" : "/") + url; $("#comm-" + this._eventKey.toLowerCase() + "-form-get").attr("action", url); $("#comm-" + this._eventKey.toLowerCase() + "-form-get").submit(); }, _post: function (url, json) { console.info("------ _post :: "+url); url = this._uri + (url.indexOf("/") == 0 ? "" : "/") + url; var ljson = JSON.stringify(json); $("#comm-" + this._eventKey.toLowerCase() + "-form-post").attr("action", url); $("#comm-" + this._eventKey.toLowerCase() + "-form-post-json").val(ljson); $("#comm-" + this._eventKey.toLowerCase() + "-form-post").submit(); }, _postAction: function (url, json) { console.info("------ _postAction :: "+url); if (!$store.hasOwnProperty("_postActionIndex")) { $store["_postActionIndex"] = 0; } var index = $store["_postActionIndex"] % 20; url = this._uri + (url.indexOf("/") == 0 ? "" : "/") + url; var ljson = JSON.stringify(json); var eventKey = this._eventKey.toLowerCase(); $("#comm-" + eventKey + "-form-post-action-" + index).attr("action", url); $("#comm-" + eventKey + "-form-post-action-json-" + index).val(ljson); var f = function () { console.info("_postAction :: " + index + " :: " + url + " :: SUBMIT"); $("#comm-" + eventKey + "-form-post-action-" + index).submit(); }; setTimeout(f, index * 750); $store["_postActionIndex"]++; } },
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------
// @formatter:on
_xyz: {}
};
if ($ == undefined) {
$ = jQuery.noConflict();
}
$(function () {
if (store.ok()) {
eval("window.$store = store").init();
}
});
window.addEventListener("message", function (event) {
if (typeof event.data === "string") {
var parts = event.data.replace(/(<([^>]+)>)/ig, "").split("::");
if (parts.length == 2) {
var type = parts[0];
var data = JSON.parse(parts[1]);
$store.data(type, data);
}
}
});
console.info("--- STORE -----------------------------------------------");