๐Buy 1 Get 1 Free - (Each $9.99)โจ Super Stay Teddy Tint - For Plush, All-Day Lip Perfection
${function() {
const variantData = data.variant || {"id":"5282eb82-6cc7-4ddb-b036-eff6d885eedc","product_id":"beafea4f-90ee-4b3c-9543-02f6d44b3fcb","title":"01-01","weight_unit":"kg","inventory_quantity":0,"sku":"","barcode":"","position":1,"option1":"01","option2":"01","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/6802b151ef19fc0c84853bc3f3125f88.png","path":"6802b151ef19fc0c84853bc3f3125f88.png","width":600,"height":600,"alt":"\ud83d\udc8bBuy 1 Get 1 Free - (Each $9.99)\u2728 Super Stay Teddy Tint - For Plush, All-Day Lip Perfection","aspect_ratio":1},"wholesale_price":[{"price":18.99,"min_quantity":1}],"weight":"0","compare_at_price":"38.99","price":"18.99","retail_price":"38.99","available":true,"url":"\/products\/\ud83d\udc8bbuy-1-get-1-free-each-9-99\u2728-super-stay-teddy-tint-for-plush-all-day-lip-perfection?variant=5282eb82-6cc7-4ddb-b036-eff6d885eedc","available_quantity":999999999,"options":[{"name":"Choose Second Free Color\ud83d\udc84:","value":"01"},{"name":"\ud83d\udc8b Plush Color That Lasts All Day! \ud83d\udc8b:","value":"01"}],"off_ratio":"51","flashsale_info":{"variant_id":"5282eb82-6cc7-4ddb-b036-eff6d885eedc","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"18.99","compare_at_price":"","discount_price":"18.99","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"51","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":435};
const saveType = "percentage";
const productLabelDiscountOn = true;
return `
-
${saveType == 'percentage'
? `-${variantData.off_ratio}%`
: `-`
}
`;
}()}
visitors currently looking at this product
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${function(){
const tipText = "Please select a {{ name }}".replace(/\{\{\s+name\s+\}\}/g, data);
return `${tipText}
`
}()}
${(function () {
const automatic_discount_list = originData.automatic_discount_list;
// ๆพ็คบ็ฑปๅ
const DISPLAY_TYPE = {
DTE_FOLD: 'DTE_FOLD', // ๆๅ
DTE_TILE: 'DTE_TILE' // ๅนณ้บ
}
const DEFAULT_CONFIG = {
BG: 'rgba(235, 57, 27, 0.04)',
TEXT_COLOR: '#EB391B',
BORDER_COLOR: 'rgb(235, 57, 27)'
};
const isExist = automatic_discount_list?.length > 0 && automatic_discount_list.some(item => item.discount[0].product_enabled);
// ๅฆๆๆฒกๆไปปไฝ่ชๅจๆๆฃ๏ผๅ้่๏ผ้ฒๆญขgapๅ ไฝ
if (!isExist) {
return `
`;
} else {
return `
${(function () {
return automatic_discount_list.map((item) => {
// ๆจก็็ฑปๅ
const template_type = item.discount[0].template_type;
// ๆฏๅฆๆพ็คบ่ชๅจๆๆฃ
const is_show_automatic_discount = item.discount[0].product_enabled;
// ๆฏๅฆ่ทณ่ฝฌ่ฝๅฐ้กต
const is_redirection = item.discount[0].is_redirection;
// ๆๆฃๅพๆ
const discount_icon = item.discount_icon;
// ็ฌฌไธไธช่ชๅจๆๆฃ
const first_automatic_discount = item.discount[0];
// ๆพ็คบๆๅ ๅฑ็คบ
const isFold = (item.discount[0].display_type || DISPLAY_TYPE.DTE_FOLD) === DISPLAY_TYPE.DTE_FOLD;
// ๆๆฌๆฐ็ป
const text_arr = item.discount[0].config.texts;
// ่ฝๅฐ้กต้พๆฅ
const first_landing_url = `/promotions/discount-default/${first_automatic_discount.discount_id}`;
// ่ชๅจๆๆฃๆปๆฐ
const automatic_discount_total = item.discount.length;
// ๆฏๅฆๆพ็คบๆๆฃๅพๆ
const isHasDiscountIcon = discount_icon ? true : false;
// ๆฏๅฆๆพ็คบๆๆฃๅพๆ ไธๆจก็็ฑปๅไธไธบtag
const isHasDiscountIconWithNoTag = (template_type != 'tag' && isHasDiscountIcon)? true : false;
// ๆๆฌ้ข่ฒ
let text_color = DEFAULT_CONFIG.TEXT_COLOR;
// ่ๆฏ้ข่ฒ
const bgFn = (curBg) => template_type === "text" ? "transparent" : curBg;
let bg_color = bgFn(DEFAULT_CONFIG.BG);
// ่พนๆก้ข่ฒ
const borderFn = (curBorder) => template_type == "tag" ? curBorder : "initial";
let border_color = borderFn(DEFAULT_CONFIG.BORDER_COLOR);
// ๆจก็้
็ฝฎ
let template_config = first_automatic_discount.template_config;
// ๅ
ๅบๆนๆก
try {
if(template_config.length !== 0){
template_config = JSON.parse(template_config);
text_color= isHasDiscountIconWithNoTag ? template_config.color[template_type].icon_text_color : template_config.color[template_type].text_color;
bg_color = bgFn(template_config.color[template_type].background_color);
const arrayRgba = bg_color.split(",");
arrayRgba.splice(3, 1, " 1)");
border_color = borderFn(`${arrayRgba.join(",")}`);
}
} catch (error) {
console.error('template_config_error', error);
template_config = {
color: {
[template_type]: {
icon_text_color: DEFAULT_CONFIG.TEXT_COLOR,
text_color: DEFAULT_CONFIG.TEXT_COLOR,
background_color: DEFAULT_CONFIG.BG
}
}
};
}
// ๆ ็ญพ
const isTag = template_type == 'tag';
// ๆๅญๅๆจชๅน
const isTextAndBanner = template_type == 'text' || template_type == 'banner';
// ๆๅญๆ ทๅผ
const textStyle = `color: ${text_color}; background-color: transparent; border: none;`;
// ๆ ็ญพๆ ทๅผ
const labelStyle = `color: ${text_color};border: 1px solid ${border_color};background-color:${bg_color};padding: 4px;`;
// ๆจชๅน
ๆ ทๅผ
const bannerStyle = `color: ${text_color};border: none; background-color:${bg_color}`;
// ๅคๅฑๆ ทๅผๅจๆ ็ญพๆ ทๅผไธไธๅฑ็คบ้ข่ฒ้
็ฝฎ๏ผ้คๅผๆ ็ญพ็ฑปๅ๏ผ้ข่ฒ้ฝๅฏไปฅๅจๅคๅฑ่ฆ็
let outerStyle = '';
if (template_type == 'text') {
outerStyle = textStyle;
} else if (template_type == 'tag') {
outerStyle = "border: none;";
} else if (template_type == 'banner') {
outerStyle = bannerStyle;
}
/**
* 1. ๆ ็ญพไธๅฎๆฏๅ็ฌๆ ทๅผๅฑ็คบ็
* 2. ๆๅ ๏ผๆจชๅๅธๅฑ๏ผๆๅญๅๆจชๅน
๏ผๅๅนถๆไธ่กๆๆฌ๏ผ ๆ ็ญพ๏ผๅ็ฌๆ ทๅผๅค็
* 3. ๅนณ้บ๏ผ็บตๅๅธๅฑ๏ผๆๅญใๆจชๅน
ๅๆ ็ญพ๏ผ ๆ ็ญพ๏ผๅ็ฌๆ ทๅผๅค็
*/
let txtHtml = ``;
if (isFold) {
if(isTag) {
// ๆ ็ญพ
const spanText = text_arr.map((text) => {
return `
${text}`;
}).join('');
txtHtml = `
${spanText}
`;
} else {
// ๆๅญๅๆจชๅน
txtHtml = `
${first_automatic_discount.config.text}
`;
}
} else {
// ๆๅญๅๆจชๅน
, ไฝๆ ็ญพๆ่ชๅทฑ็ๆ ทๅผ
const spanText = text_arr.map((text) => {
return `
${text}`;
}).join('');
// ้ฝๆฏ็บตๅๅธๅฑ๏ผๆ ็ญพๆ้ด่ท
txtHtml = `
${spanText}
`;
}
/**
* ๆพ็คบๅพๆ ็ๅคๆญ
*/
const discount_type = item.discount_type;
const isShowRebateIcon = ["DT_REBATE_CTQ_OTP", "DT_REBATE_CTQ_OTR", "DT_REBATE_CTA_OTP", "DT_REBATE_CTA_OTR", "DT_M_N_DISCOUNT"].includes(discount_type) && isTextAndBanner
const isShowBxgyIcon = ["DT_BUY_ONE_GET_ONE", "DT_BUY_X_GET_Y"].includes(discount_type)
const isShowBundleIcon = ["DT_CLASSIC_BUNDLE","DT_MIX_MATCH_BUNDLE"].includes(discount_type);
/**
* ๆธฒๆไธๆๆกๆๆฝๅฑ็ๆๆฃๅ่กจ
*/
const discount_list_html = (curItem) => {
return `
${function() {
return curItem.discount.map(childItem => {
return `
`}).join('');
}()}
`;
}
return `
${discount_list_html(item)}
${function() {
return text_arr.map((text) => {
return `
${text}
`;
}).join('');
}()}
`;
}).join('');
})()}
`
}
})()}
const TAG = "spz-custom-product-automatic";
class SpzCustomProductAutomatic extends SPZ.BaseElement {
constructor(element) {
super(element);
this.variant_id = '5282eb82-6cc7-4ddb-b036-eff6d885eedc';
this.isRTL = SPZ.win.document.dir === 'rtl';
}
static deferredMount() {
return false;
}
buildCallback() {
this.action_ = SPZServices.actionServiceForDoc(this.element);
this.templates_ = SPZServices.templatesForDoc(this.element);
this.xhr_ = SPZServices.xhrFor(this.win);
this.setupAction_();
this.viewport_ = this.getViewport();
}
mountCallback() {
this.init();
// ็ๅฌไบไปถ
this.bindEvent_();
}
async init() {
this.handleFitTheme();
const data = await this.getDiscountList();
this.renderApiData_(data);
}
async getDiscountList() {
const productId = 'beafea4f-90ee-4b3c-9543-02f6d44b3fcb';
const variantId = this.variant_id;
const productType = 'default';
const reqBody = {
product_id: productId,
variant_id: variantId,
discount_method: "DM_AUTOMATIC",
customer: {
customer_id: window.C_SETTINGS.customer.customer_id,
email: window.C_SETTINGS.customer.customer_email
},
product_type: productType
}
const url = `/api/storefront/promotion/display_setting/text/list`;
const data = await this.xhr_.fetchJson(url, {
method: "post",
body: reqBody
}).then(res => {
return res;
}).catch(err => {
this.setContainerDisabled(false);
})
return data;
}
async renderDiscountList() {
this.setContainerDisabled(true);
const data = await this.getDiscountList();
this.setContainerDisabled(false);
// ้ๆฐๆธฒๆ ๆๅจ้ฎ้ขๅค็
this.renderApiData_(data);
}
clearDom() {
const children = this.element.querySelector('*:not(template)');
children && SPZCore.Dom.removeElement(children);
}
async renderApiData_(data) {
const parentDiv = document.querySelector('.automatic_discount_container');
const newTplDom = await this.getRenderTemplate(data);
if (parentDiv) {
parentDiv.innerHTML = '';
parentDiv.appendChild(newTplDom);
} else {
console.log('automatic_discount_container is null');
}
}
doRender_(data) {
const renderData = data || {};
return this.templates_
.findAndRenderTemplate(this.element, renderData)
.then((el) => {
this.clearDom();
this.element.appendChild(el);
});
}
async getRenderTemplate(data) {
const renderData = data || {};
return this.templates_
.findAndRenderTemplate(this.element, { ...renderData, isRTL: this.isRTL })
.then((el) => {
this.clearDom();
return el;
});
}
setContainerDisabled(isDisable) {
const automaticDiscountEl = document.querySelector('.automatic_discount_container_outer');
if(isDisable) {
automaticDiscountEl.setAttribute('disabled', '');
} else {
automaticDiscountEl.removeAttribute('disabled');
}
}
// ็ปๅฎไบไปถ
bindEvent_() {
window.addEventListener('click', (e) => {
let containerNodes = document.querySelectorAll(".automatic-container .panel");
let bool;
Array.from(containerNodes).forEach((node) => {
if(node.contains(e.target)){
bool = true;
}
})
// ๆฏๅฆpopover้ขๆฟ็นๅป่ๅด
if (bool) {
return;
}
if(e.target.classList.contains('drowdown-icon') || e.target.parentNode.classList.contains('drowdown-icon')){
return;
}
const nodes = document.querySelectorAll('.automatic-container');
Array.from(nodes).forEach((node) => {
node.classList.remove('open-dropdown');
})
// ๅ
ผๅฎนไธป้ข
this.toggleProductSticky(true);
})
// ็ๅฌๅไฝๅๅ
document.addEventListener('dj.variantChange', async(event) => {
// ้ๆฐๆธฒๆ
const variant = event.detail.selected;
if (variant.product_id == 'beafea4f-90ee-4b3c-9543-02f6d44b3fcb' && variant.id != this.variant_id) {
this.variant_id = variant.id;
this.renderDiscountList();
}
});
}
// ๅ
ผๅฎนไธป้ข
handleFitTheme() {
// top ๅฑๆงๅฝฑๅๆๅจ
let productInfoEl = null;
if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') {
productInfoEl = document.querySelector('.product-info-body .product-sticky-container');
} else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') {
productInfoEl = document.querySelector('.product__info-wrapper .properties-content');
}
if(productInfoEl){
productInfoEl.classList.add('force-top-auto');
}
}
// ๅ
ผๅฎน wind/flash /hero ไธป้ข (stickyๅฑๆงๅฝฑๅ popover ๅฑ็บงๅฑ็คบ, ไผ่ขซๅ
ถไปๅ
็ด ่ฆ็)
toggleProductSticky(isSticky) {
let productInfoEl = null;
if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') {
productInfoEl = document.querySelector('.product-info-body .product-sticky-container');
} else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') {
productInfoEl = document.querySelector('.product__info-wrapper .properties-content');
}
if(productInfoEl){
if(isSticky) {
// ่ฟๅ่ฏฅไธป้ขๅๆ็stickyๅฑๆงๅผ
productInfoEl.classList.remove('force-position-static');
return;
}
productInfoEl.classList.toggle('force-position-static');
}
}
setupAction_() {
this.registerAction('handleDropdown', (invocation) => {
const discount_id = invocation.args.discount_id;
const nodes = document.querySelectorAll('.automatic-container');
Array.from(nodes).forEach((node) => {
if(node.getAttribute('id') != `automatic-${discount_id}`) {
node.classList.remove('open-dropdown');
}
})
const $discount_item = document.querySelector(`#automatic-${discount_id}`);
$discount_item && $discount_item.classList.toggle('open-dropdown');
// ๅ
ผๅฎนไธป้ข
this.toggleProductSticky();
});
}
triggerEvent_(name, data) {
const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {});
this.action_.trigger(this.element, name, event);
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.CONTAINER;
}
}
SPZ.defineElement(TAG, SpzCustomProductAutomatic);
${function() {
const minInventory = parseInt('23');
const maxInventory = parseInt('24');
const randomInventory = Math.round(Math.random() * (maxInventory - minInventory)) + minInventory;
const customText = "Stock is limited. Our offer is valid while stock lasts".replace(/\{stock\}/g, '' + randomInventory + '');
const barWidth = (randomInventory / maxInventory) * 100 + '%';
return `
`;
}()}
Free Shipping On all orders over $89
Free returns and exchanges within 30 days
Secure payment via PayPal & Credit Card
Product was out of stock.
Product is unavailable.
const getPluginI18nMessages = (message, replaceObj = {}) => {
const lang = document.documentElement.lang || "en-US";
const [form, key] = message.split('.')
let text = window.payment_plugin_message['en-US'][form][key];
if (window.payment_plugin_message[lang][form].hasOwnProperty(key)) {
text = window.payment_plugin_message[lang][form][key];
}
Object.keys(replaceObj).forEach(key => {
text = text.replace(new RegExp(`\{${key}\}`, 'gi'), replaceObj[key]);
})
return text;
}
const zhCN = {
ec: {
not_active_channel: "่ฏทๅฐๆถๆฌพ่ฎพ็ฝฎไธญ{channelName}ๆๅจใๅฟซๆทๆฏไปๆ้ฎใ่ฎพ็ฝฎไธญ้ๆฉๅ
ถไป็ๆๅกๆไพๆน๏ผๅฆๅๆ้ฎๅฐๆ ๆณๅฑ็คบ",
not_support_theme: "ๅฝๅไธป้ขไธๆฏๆๆทปๅ ใๅฟซๆทๆฏไปๆ้ฎใ",
more_button: "ๆดๅคๆฏไปๆนๅผ",
skeleton_layer_tips_title: "ๅฟซๆทๆฏไปๆ้ฎ",
skeleton_layer_tips_content: "่ฏท็นๅปๅทฆไพงๅ่กจไธญ็ใๅฟซๆทๆฏไปๆ้ฎใ๏ผๅจ่ฎพ็ฝฎ้กต้ขๅผๅฏๆณ่ฆ็ๅฑ็คบ็ๆฏไปๆ้ฎ",
mock_tips: "ๅฟซๆทๆฏไปๆ้ฎๆฏๅฆๅฑ็คบ่ฟๅๅณไบไนฐๅฎถไฝฟ็จ็ๆต่งๅจไปฅๅๅๅ็่ดงๅธใ้้ข",
not_find_form_tips: "ๅฟซๆทๆฏไปๆ้ฎ็ปไปถไป
ๆฏๆ้
็ฝฎๅฐๅๅ่ฏฆๆ
ๅก็ๅ
",
}
};
const zhTW = {
ec: {
not_active_channel: "่ฏทๅฐๆถๆฌพ่ฎพ็ฝฎไธญ{channelName}ๆๅจใๅฟซๆทๆฏไปๆ้ฎใ่ฎพ็ฝฎไธญ้ๆฉๅ
ถไป็ๆๅกๆไพๆน๏ผๅฆๅๆ้ฎๅฐๆ ๆณๅฑ็คบ",
not_support_theme: "ๅฝๅไธป้ขไธๆฏๆๆทปๅ ใๅฟซๆทๆฏไปๆ้ฎใ",
more_button: "ๆดๅคไปๆฌพๆนๅผ",
}
};
const arSA = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "ุงูู
ุฒูุฏ ู
ู ุฎูุงุฑุงุช ุงูุฏูุน",
}
};
const deDE = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Weitere Bezahlmรถglichkeiten",
}
};
const esES = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Mรกs opciones de pago",
}
};
const frFR = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Plus d'options de paiement",
}
};
const idID = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Opsi pembayaran lainnya",
}
};
const itIT = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Altre opzioni di pagamento",
}
};
const jaJP = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "ใใฎไปใฎๆฏๆใใชใใทใงใณ",
}
};
const koKR = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "๋ ๋ง์ ๊ฒฐ์ ์ต์
",
}
};
const enUS = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "More payment options",
skeleton_layer_tips_title: "Express Checkout Button",
skeleton_layer_tips_content: "Please click theใExpress checkout buttonใon the block list๏ผthen you could enable the payment option you want to display in settings.",
mock_tips: "Whether the Express checkout button is displayed also depends on the browser used by the buyer and the currency and amount of the product.",
not_find_form_tips: "Express Checkout Button could only be added to Product details block.",
}
};
const nlNL = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Meer betalingsmogelijkheden",
}
};
const plPL = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Wiฤcej Opcji Pลatnoลci",
}
};
const ptPT = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "Mais opรงรตes de pagamento",
}
};
const ruRU = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "ะััะณะธะต ะฒะฐัะธะฐะฝัั ะพะฟะปะฐัั",
}
};
const thTH = {
ec: {
not_active_channel: "Please activate {channelName} on B Admin or select another provider in theใExpress checkout buttonใ settings, otherwise it will not display.",
not_support_theme: "This Theme doesn't support addingใExpress checkout buttonใ",
more_button: "เธเธฑเธงเนเธฅเธทเธญเธเธเธฒเธฃเธเธณเธฃเธฐเนเธเธดเธเนเธเธดเนเธกเนเธเธดเธก",
}
};
window.payment_plugin_message = {
getPluginI18nMessages,
"zh-CN": zhCN,
"zh-TW": zhTW,
"ar-SA": arSA,
"de-DE": deDE,
"es-ES": esES,
"fr-FR": frFR,
"id-ID": idID,
"it-IT": itIT,
"ja-JP": jaJP,
"ko-KR": koKR,
"en-US": enUS,
"nl-NL": nlNL,
"pl-PL": plPL,
"pt-PT": ptPT,
"ru-RU": ruRU,
"th-TH": thTH,
}
document.dispatchEvent(new CustomEvent('payment_plugin_message_reader'));
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
dom.i18n = window?.payment_plugin_message?.getPluginI18nMessages;
if (dom.i18n) {
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
i18n: true
}
}))
} else {
document.addEventListener('payment_plugin_message_reader', () => {
dom.i18n = window?.payment_plugin_message?.getPluginI18nMessages;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
i18n: true
}
}))
}, {once: true});
}
} catch (e) {
}
// ้็จๅทฅๅ
ทๆนๆณ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12')
const ROOT_URL = (C_SETTINGS && C_SETTINGS.routes && C_SETTINGS.routes.root) || '';
const eventListeners = {};
const commonUtils = function () {
return {
getProduct() {
const productJson = document.querySelector('#product-json');
if (productJson?.textContent) {
return JSON.parse(productJson.textContent);
}
if (window.jQuery) {
const $product = window.jQuery?.(document)?.data('djproduct');
const productData = JSON.parse(JSON.stringify($product || {}));
return productData || {};
}
return {};
},
isChrome() {
return navigator?.userAgent?.indexOf('Chrome') > -1 || navigator?.userAgent?.indexOf('CriOS') > -1;
},
isSafari() {
let userAgentString = navigator.userAgent;
let chromeAgent = userAgentString.indexOf('Chrome') > -1 || navigator?.userAgent?.indexOf('CriOS') > -1;
let safariAgent = userAgentString.indexOf('Safari') > -1;
if (chromeAgent && safariAgent) {
safariAgent = false;
}
return safariAgent;
},
isPreview() {
return !!window?.C_EDITING_SETTINGS?.oseid;
},
multiply(a, b) {
const precision = 2; // ไฟ็ไธคไฝๅฐๆฐ
return Number((a * b).toFixed(precision));
},
loadScript(fnReady, id, src, datasets, onError, attributeConfig = {}) {
const sdkDomId = id + '-sdk';
if (fnReady() || document.getElementById(sdkDomId)) {
return Promise.resolve({id: true});
}
return new Promise((resolve) => {
const s = document.createElement('script');
s.id = sdkDomId;
s.src = src;
s.defer = true;
if (datasets) {
Object.keys(datasets).map((item) => {
s.dataset[item] = datasets[item];
});
}
s.onload = function () {
window.dispatchEvent(new CustomEvent(`${id}-loaded`));
resolve({id: true});
};
s.onerror = function () {
resolve({id: false});
onError && onError();
};
Object.keys(attributeConfig).forEach((key) => {
s.setAttribute(key, attributeConfig[key]);
});
document.head.appendChild(s);
});
},
track(eventName, data) {
window.sa && window?.sa?.track('pm_' + eventName, JSON.parse(JSON.stringify(data)));
},
getExtUrl(name) {
const url = document.cookie.match(new RegExp('\\b' + name.replace(/_/g, '-') + '-(v[s0-9]+)'));
if (url && url[1]) {
return `${name}.${url[1]}.js`;
} else {
return window?.exts?.[name];
}
},
req: {
post: async (url, data = {}) => {
try {
const response = await fetch(req.ROOT_URL + url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
...data,
body: JSON.stringify(data.body),
});
return await response.json()
} catch (error) {
throw new Error('post request error' + error);
}
},
get: async (url, data = {}) => {
try {
const response = await fetch(ROOT_URL + url);
return await response.json()
} catch (error) {
throw new Error('get request error' + error);
}
}
},
debounce(fn, wait) {
let timeout = null;
return function () {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function () {
fn.apply(this, arguments);
}, wait);
}
},
delayCallback(cb) {
window.requestIdleCallback ? requestIdleCallback(cb, {timeout: 50}) : setTimeout(cb, 50);
},
loadFilly(tag, cb) {
if (!tag) {
return
}
const script = document.createElement('script');
script.type = 'text/javaScript';
script.src = `//static.staticdj.com/${tag}`;
script.onload = cb;
document.getElementsByTagName('head')[0].appendChild(script);
},
ecEvent: {
on: (eventName, listener, useCapture) => {
eventListeners[eventName] = listener;
window.addEventListener(eventName, listener, useCapture);
},
emit: (eventName, data) => window.dispatchEvent(new CustomEvent(eventName, {detail: data})),
}
}
}
dom.commonUtilsFn = commonUtils;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
commonUtils: true
}
}))
} catch (e) {
}
// ๆ ธๅฟๆฐๆฎ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
const coreData = function () {
const {getProduct} = dom.commonUtils;
let productDetail = getProduct();
let productPrice = productDetail?.selected?.price
|| 18.99;
const shopCurrencyCode = "USD";
const expressCheckoutList = {
sdkErrorList: [],
paymentChannelList: [],
disabledChannelList: [],
showChannelList: [],
blockChannelList: [],
extraChannelList: [],
};
const channelType = {
googlepay: ['shoplazzagoogle'],
applepay: ['shoplazzaapple'],
credit: ['paypal']
};
const ecGlobalVarEnums = {
paypal: 'pluginPaypalEC'
};
const providerEnums = {
SHOPLAZZA: 'shoplazza',
STRIPE: 'stripe',
PAYPAL: 'paypal'
};
const channelEnums = {
SHOPLAZZA_GOOGLE: 'shoplazzagoogle',
SHOPLAZZA_APPLE: 'shoplazzaapple',
STRIPE_GOOGLE: 'stripegoogle',
STRIPE_APPLE: 'stripeapple',
PAYPAL: 'paypal'
};
const channelThemeConfig = {
[channelEnums.PAYPAL]: {
default: {
url: 'oss/operation/f557c83808e1cd456411170286a1ea95.svg',
classList: ['paypal-card'],
},
},
[channelEnums.SHOPLAZZA_GOOGLE]: {
light: {
url: 'oss/operation/778afb93da43adf75bdc80b078e5d4fd.svg',
classList: ['googlepay-light'],
},
dark: {
url: 'oss/operation/e53180c224f0b0af44b44663775aa930.svg',
classList: ['googlepay-dark'],
},
},
[channelEnums.SHOPLAZZA_APPLE]: {
light: {
url: 'oss/operation/dadceb884044e0a9bbfe26c15192f542.svg',
classList: ['applepay-light'],
},
dark: {
url: 'oss/operation/6597f66eac8b0681ebfb75941e8f6f52.svg',
classList: ['applepay-dark'],
},
},
};
function getContainerDomId() {
const domIdObj = {};
Object.keys(providerEnums).forEach(key => {
domIdObj[providerEnums[key]] = FormatterContainerDomId(providerEnums[key])
})
return domIdObj;
}
function FormatterContainerDomId(provider) {
const domIDSuffix = '-express-button-container';
const prefix = 'pm-';
return `${prefix}${provider}${domIDSuffix}-1539149753700-12`
}
return {
ecGlobalVarEnums,
providerEnums,
channelEnums,
productPrice,
shopCurrencyCode,
getChannelThemeConfig(ecName) {
const themeType = window.PaymentEC?.settings?.express_theme_configs?.[ecName]?.theme_type?.toLowerCase() ||
'default';
return channelThemeConfig[ecName][themeType] || channelThemeConfig[ecName]['dark'];
},
getProductPrice() {
return productDetail?.selected?.price;
},
getProductDetail() {
return productDetail;
},
setProductDetail(data) {
productDetail = data;
},
isRequiresShipping() {
return productDetail?.product?.requires_shipping
},
getOpenChannelType() {
const {paymentChannelList, blockChannelList} = expressCheckoutList
const openList = paymentChannelList.filter(item => blockChannelList.includes(item)) || [];
return {
hasApplepay: openList.filter(item => channelType.applepay.includes(item))?.length > 0,
hasGooglepay: openList.filter(item => channelType.googlepay.includes(item))?.length > 0,
hasCredit: openList.filter(item => channelType.credit.includes(item))?.length > 0
}
},
containerDomId: getContainerDomId(),
channel2ProviderEnums: {
[channelEnums.PAYPAL]: providerEnums.PAYPAL,
[channelEnums.SHOPLAZZA_GOOGLE]: providerEnums.SHOPLAZZA,
[channelEnums.SHOPLAZZA_APPLE]: providerEnums.SHOPLAZZA,
[channelEnums.STRIPE_GOOGLE]: providerEnums.STRIPE,
[channelEnums.STRIPE_APPLE]: providerEnums.STRIPE,
},
getExpressCheckoutList() {
return expressCheckoutList;
},
setShowChannel(showChannelList = []) {
expressCheckoutList.showChannelList = showChannelList;
return expressCheckoutList;
},
setBlockChannel(blockChannelList = []) {
expressCheckoutList.blockChannelList = blockChannelList;
return expressCheckoutList;
},
setPaymentChannelList(paymentChannelList = []) {
expressCheckoutList.paymentChannelList = paymentChannelList;
return expressCheckoutList;
},
setSdkErrorList(paymentChannelList = []) {
expressCheckoutList.sdkErrorList = paymentChannelList;
return expressCheckoutList;
},
setExtraChannelList(extraChannelList = []) {
expressCheckoutList.extraChannelList = extraChannelList;
return expressCheckoutList;
},
setDisabledChannelList(disabledChannelList = []) {
expressCheckoutList.disabledChannelList = disabledChannelList;
return expressCheckoutList;
}
}
}
dom.coreDataFn = coreData;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
coreData: true
}
}))
} catch (e) {
console.log(e);
}
// ้็จไธๅกๆฐๆฎๅค็ๆนๆณ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12')
const businessUtils = function () {
const {track, isChrome, isSafari, req, isPreview, multiply} = dom.commonUtils;
const {getProductPrice, containerDomId, ecGlobalVarEnums} = dom.coreData;
const {
channelEnums,
shopCurrencyCode,
isRequiresShipping,
getProductDetail,
setShowChannel,
setBlockChannel,
setSdkErrorList,
setExtraChannelList,
setDisabledChannelList,
setPaymentChannelList,
getExpressCheckoutList
} = dom.coreData;
const _businessUtils = {
getECConfig: async () => {
if (window.PaymentEC?.settings) {
return window.PaymentEC?.settings;
}
const result = await req.get('/api/payment/settings');
const ecConfig = result?.settings?.express_checkout_config || {};
const {blockChannelList} = getExpressCheckoutList();
setPaymentChannelList(blockChannelList.filter(ecName =>
ecConfig?.express_channels?.includes(ecName)) || []);
window.PaymentEC.settings = {...ecConfig, currencyCode: shopCurrencyCode};
return window.PaymentEC.settings;
},
getAttributeConfig(channelInfo) {
const {ecGlobalVar, ecName} = channelInfo;
const config = {
paypal: {
'data-namespace': ecGlobalVar
}
};
return config[ecName] || {};
},
getThemeFormData() {
let themeFormData = {};
const formDOM = dom.closest("form");
if (formDOM) {
themeFormData = {
note: '',
product_id: '',
variant_id: '',
quantity: 1,
properties: {},
};
const formData = new FormData(formDOM);
const formDataKey = formData.keys();
for (const key of formDataKey) {
const value = formData.get(key);
const propertiesKey = key.match(/^properties(?:\.(\w+)$|\[(\w+)\]$)/);
if (!propertiesKey) {
themeFormData[key] = value;
continue;
}
const objKey = propertiesKey[1] || propertiesKey[2];
themeFormData['properties'] = {...themeFormData['properties'], [objKey]: value};
}
}
return themeFormData;
},
getProductFormData() {
const themeFormData = _businessUtils.getThemeFormData()
return [{
...themeFormData,
note: themeFormData?.note || "",
product_id: themeFormData?.product_id || "",
variant_id: themeFormData?.variant_id || "",
quantity: themeFormData?.quantity || 1,
// ไธไธป้ข็กฎ่ฎค๏ผๅชไปฅไธไธชไธบๅ๏ผ้ฒๆญขformไธๅญๅจ็ๆฐๆฎไป่ขซไผ ้
properties: themeFormData?.properties || {},
}]
},
getOrderFetchParams(data) {
if (!data) {
return {};
}
return {
line_items: data.map((item) => ({
...item,
note: item?.note || "",
quantity: item?.quantity || 1,
product_id: item?.product_id,
variant_id: item?.variant_id,
properties: item?.properties,
})),
refer_info: {
source: 'buy_now',
},
customer_note: '',
};
},
isAllowTheme() {
const allowThemeList = ['Nova 2023', 'Dropshiping', 'Geek', 'Hero', 'Eva'];
const currentTheme = window?.C_SETTINGS?.theme?.merchant_theme_name;
return allowThemeList.includes(currentTheme);
},
getSubscriptionIdInit() {
let defaultID;
const selectSubscriptionEnum = {
CLOSE: 1,
ACTIVE: 2,
}
const productDetail = getProductDetail();
const sellingPlan = "";
if (!sellingPlan || typeof sellingPlan !== "object") {
return null;
}
let sellingItems;
if (sellingPlan?.spu?.[productDetail?.product?.id]) {
sellingItems = sellingPlan.spu[productDetail?.product?.id]
}
if (sellingPlan?.sku?.[productDetail?.selected?.id]) {
sellingItems = sellingPlan.sku[productDetail?.product?.id]
}
if (sellingItems?.cycles === selectSubscriptionEnum.ACTIVE && sellingItems?.selected_selling_plan_option_id) {
defaultID = sellingItems?.selected_selling_plan_option_id
}
return defaultID ?? null
},
getSubscriptionId() {
const formData = _businessUtils.getThemeFormData();
const defaultID = _businessUtils.getSubscriptionIdInit();
console.log(`[paymentEC]่ฎข้
ไฟกๆฏ:form-${formData?.properties?._selling_plan_option_id},้ป่ฎค-${defaultID}`);
if (formData?.properties) {
return formData?.properties?._selling_plan_option_id
}
return defaultID ?? null;
},
isSubscription() {
return !!_businessUtils.getSubscriptionId();
},
isAllowSubscriptionPay(channel) {
if (!_businessUtils.isSubscription()) {
return true;
}
return [channelEnums.PAYPAL].includes(channel);
},
blockChannelHandler() {
const block_googlePay = false &&
"shoplazzagoogle";
const block_applePay = false &&
"shoplazzaapple";
const block_credit = true &&
"paypal";
const blockChannel = {
googlepay: (isPreview() || isChrome()) && block_googlePay,
applepay: (isPreview() || isSafari()) && block_applePay,
credit: block_credit
};
const sortList = ['credit', 'googlepay', 'applepay'];
const methodSort = Object.keys(blockChannel).filter(key => blockChannel[key] && key).sort((a, b) => {
const indexA = sortList.indexOf(a);
const indexB = sortList.indexOf(b);
return indexA - indexB;
}).map(key => blockChannel[key]);
const result = setBlockChannel(methodSort);
track('setBlockChannel', result);
return result;
},
showECButtonHandler() {
const {
paymentChannelList,
sdkErrorList,
disabledChannelList,
extraChannelList,
} = getExpressCheckoutList();
const showChannelList = paymentChannelList.filter((ecName) =>
!sdkErrorList.includes(ecName) && !disabledChannelList.includes(ecName) &&
!extraChannelList.includes(ecName)) || [];
const result = setShowChannel(showChannelList);
track('showECButton', result);
return result;
},
filterECButtonHandler({type}, cb) {
const {
paymentChannelList,
sdkErrorList,
disabledChannelList,
extraChannelList,
} = getExpressCheckoutList();
const showChannelList = paymentChannelList.filter((ecName) =>
!sdkErrorList.includes(ecName) && !disabledChannelList.includes(ecName) &&
!extraChannelList.includes(ecName)) || [];
const result = setShowChannel(showChannelList.filter((ecName) => ecName !== type) || []);
cb && cb();
track('filterECButton', result);
return result;
},
loadSDKErrorHandler(type) {
const {sdkErrorList} = getExpressCheckoutList();
const result = setSdkErrorList([...sdkErrorList, type]);
track('loadSDKError', result);
return result;
},
extraFilterShowHandler(channel) {
const {extraChannelList} = getExpressCheckoutList();
const result = setExtraChannelList(extraChannelList.filter(ecName => ecName !== channel));
track('extraFilterEvent_show', result);
return result;
},
extraFilterHideHandler(channel) {
const {extraChannelList} = getExpressCheckoutList();
const result = setExtraChannelList([...extraChannelList, channel]);
track('extraFilterEvent_hide', result);
return result;
},
disabledChannelListHandler(checkoutData = {}, cb) {
const {paymentChannelList} = getExpressCheckoutList();
const productDetail = getProductDetail();
const disabledChannelList = paymentChannelList.filter(ecName => {
let mustDisable = false;
if (!isRequiresShipping() && ecName !== channelEnums.PAYPAL) {
mustDisable = true;
}
if (!_businessUtils.isAllowSubscriptionPay(ecName)) {
mustDisable = true;
}
if (!productDetail?.selected?.available) {
mustDisable = true;
}
const {payment_due} = checkoutData?.prices;
const paymentDueNum = Number(payment_due || 0) * 100;
const showFlag = paymentDueNum > 0;
return mustDisable || !showFlag;
})
const result = setDisabledChannelList(disabledChannelList)
result?.disabledChannelList?.forEach(ecName => {
cb && cb(ecName);
})
track('disabledChannelListEvent', result);
},
async getCheckoutData() {
const formData = _businessUtils.getProductFormData();
const totalPrice = multiply(getProductPrice(), formData?.[0]?.quantity || 0);
return {
prices: {payment_due: totalPrice, subtotal_price: totalPrice},
orderParams: _businessUtils.getOrderFetchParams(_businessUtils.getProductFormData()),
containerDOMIdEnums: containerDomId,
ecGlobalVarEnums
}
},
}
return _businessUtils
}
dom.businessUtilsFn = businessUtils;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
businessUtils: true
}
}))
} catch (e) {
}
// ้็จๆธฒๆๆนๆณ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
const containerDOM = 'pm-payment-express-button-container-1539149753700-12';
const commonRenderUtils = function () {
return {
addChildrenDOM(id, allowShow, options = {}) {
if (!id) {
return;
}
const paymentEl = document.getElementById(containerDOM);
const childrenEL = document.getElementById(id);
if (paymentEl && childrenEL) {
childrenEL.style.display = allowShow ? 'block' : 'none';
return;
}
if (paymentEl && !childrenEL) {
const dom = document.createElement('div');
dom.id = id;
dom.style.display = allowShow ? 'block' : 'none';
if (options?.style) {
Object.keys(options?.style).forEach(key => {
dom.style[key] = options.style[key];
})
}
if (Array.isArray(options?.classList)) {
dom.classList.add(...options.classList)
}
paymentEl.appendChild(dom);
}
},
removeChildrenDOM(id) {
if (!id) {
return;
}
const paymentEl = document.getElementById(containerDOM);
const childrenEL = document.getElementById(id);
if (paymentEl && childrenEL) {
// childrenEL.remove();
childrenEL.style.display = 'none';
}
},
mockAddChildrenDOM(id, allowShow, options = {}) {
if (!id) {
return;
}
const paymentEl = document.getElementById(containerDOM);
const childrenEL = document.getElementById(id);
if (paymentEl && childrenEL) {
childrenEL.style.display = allowShow ? 'flex' : 'none';
return;
}
if (paymentEl && !childrenEL) {
const dom = document.createElement('div');
dom.id = id;
dom.style.display = allowShow ? 'flex' : 'none';
if (options?.style) {
Object.keys(options?.style).forEach(key => {
dom.style[key] = options.style[key];
})
}
if (Array.isArray(options?.classList)) {
dom.classList.add(...options.classList)
}
dom.classList.add('mock-img');
const img = document.createElement('img');
img.src = `//static.staticdj.com/${options?.url}`;
dom.appendChild(img);
paymentEl.appendChild(dom);
}
},
resetRenderDOM() {
const resetStyleList = [
"pm-payment-express-error-tips-1539149753700-12",
"pm-payment-express-more-button-1539149753700-12",
"pm-payment-express-mock-tips-1539149753700-12",
"pm-payment-express-skeletonLayer-1539149753700-12",
]
const resetHtmlList = [
"pm-payment-express-skeletonLayer-title-content-1539149753700-12",
"pm-payment-express-skeletonLayer-content-1539149753700-12",
"pm-payment-express-mock-tips-1539149753700-12",
"pm-payment-express-error-tips-1539149753700-12",
"pm-payment-express-button-container-1539149753700-12",
"pm-payment-express-more-button-1539149753700-12",
]
resetStyleList.forEach(domID => {
const content = document.getElementById(domID);
if (content) {
content.style.display = 'none';
}
})
resetHtmlList.forEach(domID => {
const content = document.getElementById(domID);
if (content) {
content.innerHTML = '';
}
})
}
}
}
dom.commonRenderUtilsFn = commonRenderUtils;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
commonRenderUtils: true
}
}))
} catch (e) {
}
// ้่ฏฏๆ็คบๆธฒๆ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
const renderTipsUtils = function () {
const {i18n} = dom;
const {isPreview} = dom.commonUtils;
const {channelEnums} = dom.coreData;
return {
showChannelNotOpenTips(channelList) {
const tipsDom = document.getElementById('pm-payment-express-error-tips-1539149753700-12');
if (!isPreview()) {
return;
}
if (!tipsDom) {
return;
}
tipsDom.style.display = channelList.length > 0 ? 'block' : 'none';
const channelName = {
[channelEnums.SHOPLAZZA_GOOGLE]: "ShoplazzaPayments - GooglePay",
[channelEnums.SHOPLAZZA_APPLE]: "ShoplazzaPayments - ApplePay",
[channelEnums.PAYPAL]: "PayPal",
}
channelList.forEach(ecName => {
const id = `pm-payment-express-error-tips-1539149753700-12-${ecName}`;
const hasDom = document.getElementById(id)
if (!hasDom) {
const dom = document.createElement('div');
dom.id = id;
dom.innerHTML = i18n('ec.not_active_channel', {channelName: channelName[ecName]});
tipsDom.appendChild(dom);
}
})
},
disabledThemTips() {
const tipsDom = document.getElementById('pm-payment-express-error-tips-1539149753700-12');
if (!isPreview()) {
return;
}
if (!tipsDom) {
return;
}
tipsDom.style.display = 'block';
const id = 'pm-payment-express-error-tips-1539149753700-12-theme';
const hasDom = document.getElementById(id);
if (!hasDom) {
const dom = document.createElement('div');
dom.id = id;
dom.innerHTML = i18n('ec.not_support_theme');
tipsDom.appendChild(dom);
}
},
notFindFormTips() {
const tipsDom = document.getElementById('pm-payment-express-error-tips-1539149753700-12');
if (!isPreview()) {
return;
}
if (!tipsDom) {
return;
}
tipsDom.style.display = 'block';
const id = 'pm-payment-express-error-tips-1539149753700-12-theme';
const hasDom = document.getElementById(id);
if (!hasDom) {
const dom = document.createElement('div');
dom.id = id;
dom.innerHTML = i18n('ec.not_find_form_tips');
tipsDom.appendChild(dom);
}
},
showSkeletonLayerTips() {
const skeletonLayerDOMId = 'pm-payment-express-skeletonLayer-1539149753700-12';
const skeletonLayerDOM = document.getElementById(skeletonLayerDOMId);
const titleDOM = document.getElementById('pm-payment-express-skeletonLayer-title-content-1539149753700-12');
const contentDOM = document.getElementById('pm-payment-express-skeletonLayer-content-1539149753700-12');
if (!skeletonLayerDOM || !titleDOM || !contentDOM) {
return;
}
skeletonLayerDOM.style.display = 'block';
titleDOM.innerHTML = i18n('ec.skeleton_layer_tips_title');
contentDOM.innerHTML = i18n('ec.skeleton_layer_tips_content');
},
showMockTips() {
const tipsDOM = document.getElementById('pm-payment-express-mock-tips-1539149753700-12');
if (!tipsDOM) {
return;
}
tipsDOM.style.display = 'block';
tipsDOM.innerHTML = i18n('ec.mock_tips');
}
}
}
dom.renderTipsUtilsFn = renderTipsUtils;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
renderTipsUtils: true
}
}))
} catch (e) {
}
// ๆดๅคไฟกๆฏๆธฒๆ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
const moreDOM = document.getElementById('pm-payment-express-more-button-1539149753700-12');
const moreButtonConfig = {
firstClick: true,
maxSize: isNaN(0) ? 1 : 0
};
const renderMoreUtils = function () {
const {i18n} = dom;
const {getExpressCheckoutList} = dom.coreData;
function moreButtonEvent(cb) {
if (!moreDOM) {
return;
}
moreDOM.style.display = 'none';
moreButtonConfig.firstClick = false;
cb && cb();
}
return {
getMoreButtonConfig() {
return moreButtonConfig
},
showMoreButton(cb) {
if (!moreDOM) {
return;
}
const {showChannelList} = getExpressCheckoutList();
const showLength = showChannelList.length;
const {firstClick, maxSize} = moreButtonConfig;
moreDOM.style.display = (firstClick && showLength > 0 && showLength > maxSize) ? 'block' : 'none';
moreDOM.innerHTML = i18n('ec.more_button');
moreDOM.onclick = () => moreButtonEvent(cb);
},
}
}
dom.renderMoreUtilsFn = renderMoreUtils;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
renderMoreUtils: true
}
}))
} catch (e) {
}
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
function start() {
const {
getExtUrl,
loadFilly,
delayCallback,
ecEvent,
track,
loadScript,
debounce
} = dom.commonUtils;
const {
blockChannelHandler,
getAttributeConfig,
showECButtonHandler,
filterECButtonHandler,
loadSDKErrorHandler,
extraFilterShowHandler,
extraFilterHideHandler,
disabledChannelListHandler,
getECConfig,
isAllowTheme,
getCheckoutData,
getThemeFormData
} = dom.businessUtils;
const {addChildrenDOM, removeChildrenDOM} = dom.commonRenderUtils;
const {getMoreButtonConfig, showMoreButton} = dom.renderMoreUtils;
const {
ecGlobalVarEnums,
getExpressCheckoutList,
getProductPrice,
getProductDetail,
setProductDetail,
containerDomId,
channel2ProviderEnums,
getChannelThemeConfig
} = dom.coreData;
function getFilly() {
const fillyTag = getExtUrl('filly');
if (fillyTag) {
loadFilly(fillyTag, init);
}
}
function extraFilterEvent(e) {
const {channel, domId, allowShow} = e?.detail || {};
if (channel && domId) {
if (allowShow) {
extraFilterShowHandler(channel);
} else {
extraFilterHideHandler(channel);
filterECButtonHandler({type: channel},
() => removeChildrenDOM(domId)
);
}
renderEC();
}
}
const renderEC = () => {
showECButtonHandler();
const {showChannelList} = getExpressCheckoutList();
const {firstClick, maxSize} = getMoreButtonConfig();
if (showChannelList.length === 0) {
showMoreButton(renderEC);
}
showChannelList.forEach((ecName, index) => {
const disableShow = firstClick && index >= maxSize;
addChildrenDOM(containerDomId[channel2ProviderEnums[ecName]], !disableShow, getChannelThemeConfig(ecName));
showMoreButton(renderEC);
});
}
const loadErrorEvent = (type) => {
const domID = containerDomId[type];
if (!domID) {
return;
}
loadSDKErrorHandler(type);
filterECButtonHandler({type},
() => removeChildrenDOM(domID)
);
showMoreButton(renderEC);
};
async function loadEC() {
const themeFormData = getThemeFormData?.() || {};
if (!themeFormData?.product_id || !themeFormData?.variant_id) {
console.log('[paymentEC]hide:ๆชๆพๅฐform่กจๅๆๅฟ
่ฆไฟกๆฏ')
return;
}
const ecConfig = await getECConfig();
const expressCheckoutList = getExpressCheckoutList();
track('loadEC', expressCheckoutList);
if (ecConfig) {
const checkoutData = await getCheckoutData();
disabledChannelListHandler(checkoutData, (ecName) => {
filterECButtonHandler({type: ecName},
() => removeChildrenDOM(containerDomId[channel2ProviderEnums[ecName]])
);
});
renderEC();
window.PaymentEC.handleEcPluginsLoad =
({
channelInfos = [],
loadedCbFn = () => {
}
}) => {
const expressCheckoutLoadList = [];
channelInfos.map((channelInfo) => {
const {ecGlobalVar, ecName = '', sdkPath = '', datasets} = channelInfo;
if (!document.getElementById(containerDomId[ecName])) {
return;
}
const attributeConfig = getAttributeConfig(channelInfo) || {};
expressCheckoutLoadList.push(
loadScript(() => window[ecGlobalVar], ecGlobalVar, sdkPath, datasets, () => {
loadErrorEvent(ecName);
}, attributeConfig)
);
});
Promise.all(expressCheckoutLoadList).then(() => {
loadedCbFn(checkoutData);
});
};
// ้็ฅๅค้จๆฐๆฎๅๆด
ecEvent.emit('tc_payment_ec_data_change', {
ecGlobalVarEnums,
containerDOMIdEnums: containerDomId
});
}
}
const loadECDebounce = debounce(loadEC, 300)
async function refreshEC(data = {}, sources) {
if (!sources) {
console.warn('[paymentEC]hide: sources is null');
return;
}
if (data?.detail?.selected?.price) {
setProductDetail(data?.detail)
}
loadECDebounce();
}
function init() {
ecEvent.on('shoplazza_express_channels_change', extraFilterEvent, false);
ecEvent.on('shoplazza_express_channels_change_ready', extraFilterEvent, false);
if (typeof window.PaymentEC === 'object') {
window.PaymentEC.getCheckoutData = getCheckoutData;
} else {
console.warn("[payment]window.PaymentEC is null");
}
document.addEventListener('dj.variantChange', (data) => refreshEC(data, 'variantChange'));
document.addEventListener('payment_ec_refresh', (data) => refreshEC(data, data?.detail?.sources));
refreshEC({}, 'init');
}
if (isAllowTheme()) {
blockChannelHandler();
if (document.readyState === 'complete') {
delayCallback(getFilly);
return;
}
window.addEventListener('load', () => delayCallback(getFilly), {once: true});
}
}
dom.startFn = start;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
start: true
}
}))
} catch (e) {
console.log(e);
}
// ้ข่งๆจกๅผ
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
function start() {
const {track} = dom.commonUtils;
const {showMoreButton, getMoreButtonConfig} = dom.renderMoreUtils;
const {
showECButtonHandler,
getECConfig,
blockChannelHandler,
isAllowTheme,
getThemeFormData
} = dom.businessUtils;
const {
disabledThemTips,
showChannelNotOpenTips,
showSkeletonLayerTips,
showMockTips,
notFindFormTips
} = dom.renderTipsUtils;
const {mockAddChildrenDOM, resetRenderDOM} = dom.commonRenderUtils;
const {
channelEnums,
getChannelThemeConfig,
getExpressCheckoutList,
getOpenChannelType
} = dom.coreData;
const mockDomId = {
[channelEnums.PAYPAL]: channelEnums.PAYPAL,
[channelEnums.SHOPLAZZA_GOOGLE]: channelEnums.SHOPLAZZA_GOOGLE,
[channelEnums.SHOPLAZZA_APPLE]: channelEnums.SHOPLAZZA_APPLE,
[channelEnums.STRIPE_GOOGLE]: channelEnums.STRIPE_GOOGLE,
[channelEnums.STRIPE_APPLE]: channelEnums.STRIPE_APPLE,
}
const renderNotOpenTips = () => {
const {blockChannelList, paymentChannelList} = getExpressCheckoutList();
const notOpenChannel = blockChannelList.filter(ecName => !paymentChannelList.includes(ecName));
showChannelNotOpenTips(notOpenChannel);
}
const renderMockTips = () => {
const {hasApplepay, hasGooglepay} = getOpenChannelType();
if (hasApplepay || hasGooglepay) {
showMockTips();
}
}
const renderEC = () => {
showECButtonHandler();
const {showChannelList} = getExpressCheckoutList();
const {firstClick, maxSize} = getMoreButtonConfig();
if (showChannelList.length === 0) {
showMoreButton(renderEC);
}
showChannelList.forEach((ecName, index) => {
const disableShow = firstClick && index >= maxSize;
mockAddChildrenDOM(mockDomId[ecName], !disableShow, getChannelThemeConfig(ecName));
showMoreButton(renderEC);
});
}
async function loadEC() {
const date = new Date().getTime();
dom.loadEC_timestamp = date
const ecConfig = await getECConfig();
if (date !== dom.loadEC_timestamp) {
return;
}
const expressCheckoutList = getExpressCheckoutList();
track('preview-loadEC', expressCheckoutList);
resetRenderDOM();
// ๅๅงๅๆถๆฒกๆไบไปถๆจ้
if (ecConfig) {
renderNotOpenTips();
renderEC();
renderMockTips();
}
}
const init = () => {
blockChannelHandler();
const {blockChannelList} = getExpressCheckoutList();
if (!isAllowTheme()) {
disabledThemTips()
return;
}
const themeFormData = getThemeFormData?.() || {};
if (!themeFormData?.product_id || !themeFormData?.variant_id) {
notFindFormTips();
return;
}
if (blockChannelList.length > 0) {
loadEC();
} else {
showSkeletonLayerTips()
}
}
init();
}
dom.mockStartFn = start;
document.dispatchEvent(new CustomEvent('payment_ec_core_ready', {
detail: {
start: true
}
}))
} catch (e) {
}
try {
const dom = document.getElementById('pm-payment-express-button-1539149753700-12');
window.PaymentEC = {}
const delayCallback = (cb) => {
window.requestIdleCallback ? requestIdleCallback(cb, {timeout: 50}) : setTimeout(cb, 50);
}
const checkReady = function (data) {
const {
i18n,
commonUtilsFn,
coreDataFn,
businessUtilsFn,
commonRenderUtilsFn,
renderTipsUtilsFn,
renderMoreUtilsFn,
startFn,
mockStartFn
} = dom
let readyData = {
commonUtils: !!(commonUtilsFn) || false,
coreData: !!(coreDataFn) || false,
businessUtils: !!(businessUtilsFn) || false,
commonRenderUtils: !!(commonRenderUtilsFn) || false,
renderTipsUtils: !!(renderTipsUtilsFn) || false,
renderMoreUtils: !!(renderMoreUtilsFn) || false,
start: !!(startFn) || false,
mockStart: !!(mockStartFn) || false,
i18n: !!(i18n) || false
}
if (data?.detail) {
Object.keys(data.detail).forEach(key => {
readyData[key] = data.detail[key]
})
}
let isReady = true;
Object.keys(readyData).forEach(key => {
if (!readyData[key]) {
isReady = false
}
})
return isReady
}
const readyFn = () => {
if (!checkReady()) {
return;
}
document.removeEventListener('payment_ec_core_ready', readyFn);
dom.commonUtils = dom.commonUtilsFn();
dom.coreData = dom.coreDataFn();
dom.businessUtils = dom.businessUtilsFn();
dom.commonRenderUtils = dom.commonRenderUtilsFn();
dom.renderTipsUtils = dom.renderTipsUtilsFn();
dom.renderMoreUtils = dom.renderMoreUtilsFn();
const productData = dom?.commonUtils?.getProduct?.() || {};
if (JSON.stringify(productData) === '{}') {
console.log('[paymentEC]hide: product data is {}')
return;
}
if (dom?.commonUtils?.isPreview()) {
dom.mockStartFn()
} else {
dom.startFn();
}
}
const init = () => {
if (checkReady()) {
readyFn();
} else {
document.addEventListener('payment_ec_core_ready', readyFn)
}
}
if (document.readyState === 'complete') {
delayCallback(init);
} else {
window.addEventListener('load', () => delayCallback(init), {once: true});
}
} catch (e) {
}
${function(){
const variantData = data.variant || {"id":"5282eb82-6cc7-4ddb-b036-eff6d885eedc","product_id":"beafea4f-90ee-4b3c-9543-02f6d44b3fcb","title":"01-01","weight_unit":"kg","inventory_quantity":0,"sku":"","barcode":"","position":1,"option1":"01","option2":"01","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/6802b151ef19fc0c84853bc3f3125f88.png","path":"6802b151ef19fc0c84853bc3f3125f88.png","width":600,"height":600,"alt":"\ud83d\udc8bBuy 1 Get 1 Free - (Each $9.99)\u2728 Super Stay Teddy Tint - For Plush, All-Day Lip Perfection","aspect_ratio":1},"wholesale_price":[{"price":18.99,"min_quantity":1}],"weight":"0","compare_at_price":"38.99","price":"18.99","retail_price":"38.99","available":true,"url":"\/products\/\ud83d\udc8bbuy-1-get-1-free-each-9-99\u2728-super-stay-teddy-tint-for-plush-all-day-lip-perfection?variant=5282eb82-6cc7-4ddb-b036-eff6d885eedc","available_quantity":999999999,"options":[{"name":"Choose Second Free Color\ud83d\udc84:","value":"01"},{"name":"\ud83d\udc8b Plush Color That Lasts All Day! \ud83d\udc8b:","value":"01"}],"off_ratio":"51","flashsale_info":{"variant_id":"5282eb82-6cc7-4ddb-b036-eff6d885eedc","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"18.99","compare_at_price":"","discount_price":"18.99","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"51","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":435};
return `
Sku : ${variantData && variantData.sku}
Weight : ${variantData && variantData.weight}${variantData && variantData.weight_unit}
Barcode : ${variantData && variantData.barcode}
`
}()}
๐ Super Stay Teddy Tint: All-Day Plush Perfection for Your Lips! ๐โจ
๐ Get Ready for 12 Hours of Plush, Teddy-Soft Wear! ๐
Say hello to Super Stay Teddy Tint—the lip tint that stays with you all day, delivering vivid color and a soft, plush finish that feels as lightweight as a feather. Whether you're heading to the office, out with friends, or on a date night, your lips will look flawless, without the constant need for touch-ups. No fuss. Just all-day perfection.
๐จ Effortless, Customizable Color for Every Mood
- From a sheer, blurred tint to a bold matte finish, the choice is yours! Thanks to its buildable formula, you can effortlessly create a look that suits any occasion. And with smudge-proof, kiss-proof, and waterproof features, you can trust that this tint will stay in place—whether you're enjoying a coffee or a night out. Your lips, locked in style, all day long.
๐งฝ Easy Removal for Endless Possibilities
- The best part? When you're ready to refresh your look, this tint removes easily with just a swipe of micellar water. No hassle, just clean, fresh skin and endless beauty possibilities. Pair it with all your favorite products to create the ultimate look, day or night!
๐ 6 Gorgeous Shades to Match Every Moment
- Whether you're in the mood for something subtle or bold, we have the perfect shade for you! Choose from 6 stunning shades, each designed to match your vibe. Plus, our vegan formula is not only gentle on your lips but also versatile enough to use on your cheeks for a fresh, radiant flush. Beauty without compromise—that’s the Teddy Tint promise. ๐
Pain Points Solved
-
Tired of constantly reapplying your lip color?
Super Stay Teddy Tint lasts for up to 12 hours, ensuring you stay flawless without the need for touch-ups. โฐ๐
-
Frustrated with lip colors that smudge or fade?
This tint is smudge-proof, kiss-proof, and waterproof, so your color stays in place no matter what. ๐ฆ
-
Need a versatile product that works for every occasion?
With its customizable color and ability to be used on both lips and cheeks, Super Stay Teddy Tint adapts to every look and every mood. ๐
-
Looking for cruelty-free and vegan beauty?
Our vegan formula is kind to both you and the planet, so you can feel good while looking great. ๐ฟ
Why Buy from Us?
- Quality You Can Trust: Super Stay Teddy Tint is crafted with care using only the best ingredients, ensuring your lips feel as good as they look.
- Exclusive Shades & Long-Lasting Wear: You won’t find these vibrant, long-lasting shades everywhere. Stay ahead of the trend!
- Guilt-Free Beauty: Our formula is vegan, cruelty-free, and designed to give you a flawless finish without compromise.
Unleash Your Lip Power Now! ๐
Ready to experience lips that look and feel perfect all day? Order now and discover why Super Stay Teddy Tint is a must-have in every beauty routine. Your lips deserve the best—give them the plush, long-lasting color they’ve been waiting for.
๐ Get your Super Stay Teddy Tint today and redefine your lip game! ๐โจ
OUR GUARANTEE
๐ฆ Insured Worldwide Shipping: Each order includes real-time tracking details and insurance coverage in the unlikely event that a package gets lost or stolen in transit.
โ๏ธ 24/7 Customer Support: We have a team of live reps ready to help and answer any questions you have within a 24-hour time frame, 7 days a week.
๐ Safe & Secure Checkouts: We use state-of-the-art SSL Secure encryption to keep your personal and financial information 100% protected.
๐ Worldwide Shipping โ
You may receive your items earlier. Tracking Numbers will ALWAYS be sent so you can track it every step of the way! Cool things are worth waiting for! ๐