Bee Venom Soothing Treatment Cream

$23.99
$47.98
Save 50%
3156 sold
๐Ÿ”ฅ92.8% Of Customers Buy 2 Or More : Buy 1
Quantity
/** @private {string} */ class SpzCustomAnchorScroll extends SPZ.BaseElement { static deferredMount() { return false; } constructor(element) { super(element); /** @private {Element} */ this.scrollableContainer_ = null; } isLayoutSupported(layout) { return layout == SPZCore.Layout.LOGIC; } buildCallback() { this.viewport_ = this.getViewport(); this.initActions_(); } setTarget(containerId, targetId) { this.containerId = '#' + containerId; this.targetId = '#' + targetId; } scrollToTarget() { const container = document.querySelector(this.containerId); const target = container.querySelector(this.targetId); const {scrollTop} = container; const eleOffsetTop = this.getOffsetTop_(target, container); this.viewport_ .interpolateScrollIntoView_( container, scrollTop, scrollTop + eleOffsetTop ); } initActions_() { this.registerAction( 'scrollToTarget', (invocation) => this.scrollToTarget(invocation?.caller) ); this.registerAction( 'setTarget', (invocation) => this.setTarget(invocation?.args?.containerId, invocation?.args?.targetId) ); } /** * @param {Element} element * @param {Element} container * @return {number} * @private */ getOffsetTop_(element, container) { if (!element./*OK*/ getClientRects().length) { return 0; } const rect = element./*OK*/ getBoundingClientRect(); if (rect.width || rect.height) { return rect.top - container./*OK*/ getBoundingClientRect().top; } return rect.top; } } SPZ.defineElement('spz-custom-anchor-scroll', SpzCustomAnchorScroll); const STRENGTHEN_TRUST_URL = "/api/strengthen_trust/settings"; class SpzCustomStrengthenTrust extends SPZ.BaseElement { constructor(element) { super(element); this.renderElement_ = null; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { this.xhr_ = SPZServices.xhrFor(this.win); const renderId = this.element.getAttribute('render-id'); SPZCore.Dom.waitForChild( document.body, () => !!document.getElementById(renderId), () => { this.renderElement_ = SPZCore.Dom.scopedQuerySelector( document.body, `#${renderId}` ); if (this.renderElement_) { this.render_(); } this.registerAction('track', (invocation) => { this.track_(invocation.args); }); } ); } render_() { this.fetchData_().then((data) => { if (!data) { return; } SPZ.whenApiDefined(this.renderElement_).then((apis) => { apis?.render(data); document.querySelector('#strengthen-trust-render-1539149753700').addEventListener('click',(event)=>{ if(event.target.nodeName == 'A'){ this.track_({type: 'trust_content_click'}); } }) }); }); } track_(data = {}) { const track = window.sa && window.sa.track; if (!track) { return; } track('trust_enhancement_event', data); } parseJSON_(string) { let result = {}; try { result = JSON.parse(string); } catch (e) {} return result; } fetchData_() { return this.xhr_ .fetchJson(STRENGTHEN_TRUST_URL) .then((responseData) => { if (!responseData || !responseData.data) { return null; } const data = responseData.data; const moduleSettings = (data.module_settings || []).reduce((result, moduleSetting) => { return result.concat(Object.assign(moduleSetting, { logos: (moduleSetting.logos || []).map((item) => { return moduleSetting.logos_type == 'custom' ? this.parseJSON_(item) : item; }) })); }, []); return Object.assign(data, { module_settings: moduleSettings, isEditor: window.self !== window.top, }); }); } } SPZ.defineElement('spz-custom-strengthen-trust', SpzCustomStrengthenTrust);
Description

๐Ÿ’ŸOur goods are authentic, with genuine patents; counterfeits must be investigated! Customer, please identify our products!

The fastest 1-2 weeks can eliminate your eczema, psoriasis, keratosis pilaris, vitiligo, acneand other skin problems!

Our clinical trial recruited 1,542 participants, and the results showed that 95% of them successfully removed warts and moles within 1-2 weeks, with no side effects or recurrences.  This outcome demonstrates the effectiveness and safety of our product, providing a reliable choice for a wide range of users.

Take A Look At Our Satisfied Customers

“I've been battling acne for years, but I still have a lot of acne and scars on my face that won't go away, and which many have compared to the surface of the moon. After discovering ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ, I  purchased it without hesitation. Surprisingly, after only less than a week of use, my skin felt refreshed - acne was visibly reduced, pimple marks faded, and pimples began to smooth out. After three weeks of use, I was completely free of the “moon face” that had plagued me for years, and I am truly grateful to TLOPA®!” -Emily, 33, Los Angeles โญโญโญโญโญ

"I am 71 years old, I retired long ago, and one of the things I like to do every day during the days when I don't have to work is to be outdoors and enjoy nature's gifts, however, years of cumulative sun exposure have caused gradual changes in my skin - actinic keratosis pilaris has started to leave blotchy marks on my face and the backs of my hands. These small, rough patches not only affected my appearance but also made me worry about my health. I had tried many kinds of traditional treatments, including topical creams and regular dermatological checkups, but the results were always unsatisfactory and prone to recurring. Just last month, my friend Robert Garcia recommended this ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ to me, and with a few hopeful moments and a bit of research on Bee Venom Therapy. I started to apply the cream carefully on the affected area every night after cleansing my skin, this product has a cool feeling on my skin, slowly the small spots started to fade and my skin was smoother, after 14 days of use, my skin became normal and did not recur, it's a good product and I highly recommend it to everyone" -Harry Jones, 71, Washington, D.Cโญโญโญโญโญ

"I had really bad plantar warts, and this natural bee venom treatment cream was the only product that worked! In the first week, I was pleasantly surprised to find that the warts were slowly falling off and new skin had grown over, my itching and pain had slowly decreased, and I was able to run normally in sneakers. After 4 weeks, I was delighted to find that my stubborn plantar warts had disappeared, replaced by smooth soles! And since I stopped using it, the warts haven't reappeared in nearly 4 months!" - John Smith, 27, New York.

"I have always been embarrassed by skin warts near my eyes, even caused vision problems. Despite trying expensive treatments, it was difficult to get rid of it, and the skin flap persisted. Thankfully, someone suggested ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ, and I decided to give it a shot. Shocking, those troublesome warts vanished completely, without leaving a single trace behind. I couldn't be happier with the results!" - Ethan Baker, 39, Chicagoโญโญโญโญโญ

"Keratosis pilaris has always made me self-conscious, especially during the summer months. I tried numerous treatments with little success. Then I found the bee venom treatment cream, and it has made a world of difference. Just a few uses and the bumps are almost completely gone. My skin feels smooth and looks great. I'm beyond impressed with this product and will continue to use it regularly." -Luca Thomas, 42, Chicago. age

"The results are amazing. For some reason, I suddenly developed a lot of skin tags in three months, all on my neck. This made me feel very sick, and the doctor recommended surgery to remove it, but the chance of recurrence is high. Luckily, my friend recommended Bee Venom Treatment Cream to me. Her mother had the same symptoms and was cured with this product, so I ordered 4 bottles to give it a try. If it doesn't work, I can go to the hospital for surgery to remove it. After 16 days of using the treatment, these skin tags of mine disappeared completely, and it doesn't hurt at all! But it is worth noting that persistence is very important. I used it every day for about half a month. In the end, it will slowly turn black and fall off. Now the skin around it looks great after healing! No need for a second treatment. It works the first time! Recommend." - Jaden Barnes โญโญโญโญโญ

What are Skin Tags and Warts? What causes skin tags and warts?

Understanding Skin Tags: Benign Growths on Skin

Skin tags, also known as acrochordons, are small, soft, benign growths that protrude from the skin. They typically appear as tiny, flesh-colored or slightly darker skin flaps, often attached to the skin by a thin stalk or peduncle. Skin tags are common; factors such as friction, hormonal changes, genetics, obesity, and insulin resistance may contribute to their formation.

Skin tags and warts are common growths of skin cells. Skin tags occur when extra cells grow on the surface of the skin and are commonly found on the breasts, underarms, neck creases (where clothing or jewelry rubs against the neck), groin, eyelids, abdomen, and back. Warts, on the other hand, are caused by viral infections of the skin. They usually have a rough, bumpy surface and may be round or oval in shape.

How does ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ work on various skin imperfections?

TLOPA® ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ offers a solution by leveraging the powerful attributes of bee venom to specifically address diverse skin irregularities like skin tags, moles, warts, and blemishes. Enriched with active components derived from bee venom, this advanced formulation works to dissolve and delicately eliminate undesirable growths.

Harnessing The Potency Of Bee Venom For Skin Tag Removal

Bee venom comprises multiple bioactive elements like melittin, apamin, and adolapin, which have been scientifically demonstrated to effectively combat skin tags or warts. Notably, among its enzymatic components, phospholipase A2 shines for its capacity to degrade abnormal tissue, streamlining the process of removing skin tags or warts.

Enhance Tissue Healing, Accelerate Regeneration

An additional notable benefit of bee venom lies in its capacity to boost blood circulation. By stimulating blood flow in the targeted region, it supports the elimination of skin tags or warts while fostering tissue regeneration and expediting the healing process. This aids in the restoration and revitalization of impaired tissues.

Furthermore, laboratory studies have shown that the constituents of bee venom exhibit antiviral properties. This implies that bee venom may hinder the replication of viruses that might cause skin infections, potentially aiding in infection prevention during the removal of skin tags or warts. Research has demonstrated that bee venom induces apoptosis, or programmed cell death, in abnormal skin cells, resulting in the eradication of skin tags or warts. Its active ingredient destroys wart tissue, encouraging it to loosen and fall off. Apply this wart remover to the face or body to dry and reduce the lesions until they naturally fall off the surface of the skin.

Ava Shamban

As a dermatobiologist, I am well aware of the problems and challenges that warts of all types pose to patients. In my 15 years of clinical career, I have seen countless patients who have suffered greatly from the torture and pain associated with the condition. Based on a research article published in the International Journal of Dermatology in 2023, I made a remarkable discovery about the effects of bee venom on the human body.

The active biological proteins found in bee venom, called bee venom peptides, were found to be effective in inhibiting the proliferation of keratinocytes within warts, and to rapidly kill the skin cells that have formed within the warts, causing them to gradually discolor, darken, and then fall off within 1 to 2 weeks. And make this the key treatment option for complete wart removal. June 2023 After more than 1 month of intensive research and extraction, I discovered that the bee venom produced by New Zealand bees rapidly fuses with human skin tissue. By activating and facilitating this process, it effectively inhibits the proliferation of keratinocytes within the wart and rapidly kills the skin cells that have already formed within the wart.

I have combined a variety of botanical ingredients that have long been shown to be beneficial in removing warts to create the ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ. Experimental evidence has shown this ๐ถ๐‘Ÿ๐‘’๐‘Ž๐‘š to be the best choice for treating warts. The blend of these ingredients, along with the powerful properties of bee venom, provides a breakthrough solution to treat warts completely from the root cause.

I am very excited about the potential of this ๐ถ๐‘Ÿ๐‘’๐‘Ž๐‘š to bring relief and hope to patients suffering from warts all over the world. Its unique formula can restore skin health and improve the quality of life for those suffering from this challenging condition. As a dermatologist, I feel confident in recommending ๐‘ฉ๐’†๐’† ๐‘ฝ๐’†๐’๐’๐’Ž ๐‘ด๐’๐’๐’† ๐’‚๐’๐’… ๐‘พ๐’‚๐’“๐’• ๐‘ป๐’“๐’†๐’‚๐’•๐’Ž๐’†๐’๐’• ๐˜พ๐™ง๐™š๐™–๐™ข as the ultimate solution.

All ingredients are derived from natural plants and bee venom, cruelty-free

Bee venom: Bee venom is the venom from New Zealand honeybees. It is a method of stimulating bees to excrete bee venom through ether anesthesia. This natural substance is not life-threatening and is recognized for its potential benefits in treating various warts as well as a variety of skin conditions. It can regulate the immune response and inhibit pro-inflammatory cytokines. At the same time, bee venom is a relatively safe immune modulator with anti-viral properties. Therefore, it can also effectively treat viral contagious warts and effectively kill the skin cells in the warts, allowing them to gradually change color, darken, nd then fall off over 1 to 2 weeks. Melittin, which our team discovered, also has potent anti-inflammatory properties, helping to reduce inflammation associated with warts 

5% Salicylic acid: As an anti-inflammatory, salicylic acid reduces inflammation and helps control wart growth. By reducing the redness and inflammatory response of the skin, salicylic acid relieves discomfort in the wart lesion area. Additionally, it has exfoliating properties that help remove aged cells and keratin from the surface of warted skin, allowing new skin cells to be exposed. By promoting skin cell growth and repair, salicylic acid helps to quickly form new, healthy skin tissue after the wart tissue is shed. Additionally, salicylic acid has antimicrobial properties that control bacterial infections around the skin.

Melaleuca Alternifolia (Tea Tree Oil: dehydrates skin tags, causing them to dry up and fall off.

Arborvitae Leaf Extract: This herb helps promote clear, healthy-looking skin when applied topically.

Borneol: This organic compound possesses anti-coagulant or blood-thinning properties. In addition, several studies have revealed that borneol is also effective in treating inflammation, relieving pain, and eliminating odors. The wound-healing property of borneol is among its most beneficial uses.

 WHAT MAKES Bee Venom Treatment Cream YOUR TOP CHOICE?

โœ” Eliminates skin tags, warts, and moles
โœ” Promote repair and regeneration of new skin
โœ”Speeds up the healing process without leaving scars
โœ”Warts and skin tags fall off naturally and painlessly
โœ”Fast results, visible results, no side effects
โœ”Prevent infection after removal
โœ”Developed and manufactured in the USA in an NIH-registered laboratory
โœ” Suitable for all skin types
โœ”Minimises friction and irritation caused by skin tags
โœ”Prevents skin tags and blemishes from developing into lesions
โœ”Contains no harmful ingredients and is residue-free
โœ”Proven effective in clinical medical research centres
โœ”Use 3-4 times a day
โœ”Instructions for long-term guaranteed use
โœ”Safe and hygienic, dermatologist recommended

Does our bee venom filtrate come from killing or harming bees?

It doesn't look like they're being killed or harmed because we're using new technology to get bee venom without harming the bees. Ether is used to anesthetize the nerves of bees. After the bees inhale enough ether vapor, it will cause the bees to spit honey and expel poison. After the ether disappears, the bees will fly away. This process is considered humane and will not hurt. After decades of cultivation and breeding in New Zealand, the high quality of bee venom can be guaranteed. Bees are farmed 100% naturally, hypoallergenic, and dermatologist-tested.

Bee Venom Treatment Cream
Guarantee #1:Suitable for All Skin Issues

Among our nearly 20,000 users, 99.57% have experienced perfect resolution

of their skin issues. No matter what your skin condition isYouou can benefit from this product.

No more enduring skin itching or pain,

No more caring about others' opinions,

And no more searching for the next cream or ๐ถ๐‘Ÿ๐‘’๐‘Ž๐‘š.

When you start using this product, all these issues will be resolved.

Your skin problems will be solved, and you will be rejuvenated.

Guarantee #2: Fast and Lasting Results

Although you'll quickly see the effects of this natural antibacterial and anti-inflammatory detoxification...

...around two weeks to see noticeable results...

This means that this time you'll finally be able to have healthy skin.

We have over half of the users resolving their skin issues and successfully maintaining them for nearly 5 years.

And all they had to do was use this Cream, and it looks really good.

Just imagine!

Imagine yourself on the beach or by the sea, wearing a bikini and enjoying the admiring looks of people.

Guarantee #3: Absolute Best Customer Service

When you join this family, you'll never be alone.

My team and I will always be here for you, ready to assist you at any time.

If you have specific questions about the program, we'll be here to guide you...

If you're not getting the results you want, let us know, and we'll do everything we can to help you...

If you're feeling confused or frustrated, don't be a stranger. Reach out to us immediately because we're here to support you.

You're part of the team now, and we'll do everything we can to ensure your success.

Here are some of our happy customers:

"I am a teacher and have to stand for long hours every day, which has taken a toll on my body, especially my varicose veins. The swelling and discomfort were out of control. But then I tried these ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ, which is smooth, easily absorbed, and deeply moisturizes my skin with every use. After a week, I noticed that the swelling and discomfort of my varicose veins were significantly reduced, and my leg skin regained its former radiance. This is by far the most comfortable product I have ever purchased. After 2 weeks, my varicose veins were completely gon, and the pain in my legs was gone! I love them!" - Victor Stevenโญโญโญโญโญ

"When I was burned and left with horrible scars, I felt insecure and embarrassed. I tried several ways to get rid of them, but none of them worked. It was only when I used TLOPA® Bee Venom Skin Cream online that I saw my first results. I use it three times a day, and my scars are almost gone! I wish more people realized this and got rid of their burns and scars. Currently four weeks in, my wounds are almost invisible! "-Lucy Taylorโญโญโญโญโญ

"The light makes me very uncomfortable. I wanted to go to a dermatologist to get them removed, but I was hesitant to go to a clinic for treatment due to my low tolerance for pain. I stumbled across ๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ and read some reviews from friends who had similar experiences, but since I didn't have much, I thought I might have a better chance of success.

After the first week of us, the skin around the warts was a little itchy, but I could see the warts starting to darken and dry out. After another 7 days, the skin around the warts started to peel off, and the skin around the warts started to peel off. The warts fell off, and the skin slowly healed from the medication. It was used 4 times a day for a fortnight, and then they were eliminated without having to worry about infecting anyone else because they had been eliminated. Only a few weeks have passed since they came off, and I am very happy with the results! Not only did it effectively remove my warts, but it didn't cause any discomfort or pain. I am very grateful for this cream as it has restored my confidence and freed me from the fear of painful treatments." - Brianna Roseโญโญโญโญโญ

SPECIFICATION

๐—•๐—ฒ๐—ฒ ๐—ฉ๐—ฒ๐—ป๐—ผ๐—บ ๐—ฆ๐—ธ๐—ถ๐—ป ๐—ง๐—ฟ๐—ฒ๐—ฎ๐˜๐—บ๐—ฒ๐—ป๐˜ ๐—–๐—ฟ๐—ฒ๐—ฎ๐—บ (1/2/4/6/8 Jars)
Origin: New York, USA

Shelf life: 3 years

We support Global Delivery

 For each piece of our product purchased, we donate a portion of our profit to support the Cruelty-Free International organization, which helps to promote the protection of animals and end animal cruelty around the globe. By purchasing our product, you are supporting our cause to provide a more animal-friendly beauty culture. Don't hesitate to contribute your passion for that. 

๐ŸŽDAILY: The first 100 customers to place an order will receive double the product as a gift!!!!!

class SpzSmartBlockComponent extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; this.container_ = null; this.i18n_ = {}; this.config_ = {}; this.show_type_ = 3; this.product_resource_id_ = ''; this.collection_resource_id_ = ''; this.cart_items_ = []; this.customer_id_ = ''; this.order_id_ = ''; } static deferredMount() { return false; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { const template_type = window.SHOPLAZZA.meta.page.template_type; if (template_type === 1) { this.show_type_ = 3; this.product_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 2) { this.show_type_ = 4; this.collection_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 15){ this.show_type_ = 5; } else if (template_type === 13){ this.show_type_ = 6; } else if (template_type === 20){ this.show_type_ = 7; this.customer_id_ = window.SHOPLAZZA.customer.customer_id; } else if (template_type === 35){ this.show_type_ = 8; this.order_id_ = window.location.pathname.split('/').pop(); } this.templates_ = SPZServices.templatesForDoc(this.element); this.setAction_(); } mountCallback() { console.log('appzebu smart mounted'); const that = this; const themeName = window.SHOPLAZZA.theme.merchant_theme_name; const isGeek = /Geek/.test(themeName); this.fetchRules().then((res) => { if (res && res.rules && res.rules.length) { const blockEl = document.getElementById('smart_recommend_block'); SPZ.whenApiDefined(blockEl).then((api) => { api.render({data: res}, true).then(() => { if (isGeek && that.show_type_ === 6) { blockEl.querySelector('.plugin_container_wrpper').style.padding = '30px 0'; } const recommendStyle = document.createElement('style'); recommendStyle.innerHTML = ` .plugin__recommend_container,.app-recommend-card { display: none !important; } `; document.head.appendChild(recommendStyle); const fetchList = []; res.rules.forEach((rule) => { fetchList.push(this.fetchRuleProductList(rule.id)); }); const fetchAll = Promise.all(fetchList); fetchAll.then((p_res) => { res.rules.forEach((rule, index) => { rule.products = p_res[index] && p_res[index].products; const ruleEl = document.getElementById('smart_recommend_rule_' + rule.id); SPZ.whenApiDefined(ruleEl).then((api) => { api.render({data: rule}, true).then(() => { that.impressListen(`#smart_recommend_rule_ul_${rule.id}`, function(){ that.trackRuleImpress(rule); }); const btnElList = document.querySelectorAll(`#smart_recommend_rule_ul_${rule.id} button`); btnElList.forEach((btnEl) => { if (btnEl && rule.config && rule.config.quick_shop_button_bg_color && rule.config.quick_shop_button_text_color) { btnEl.style.backgroundColor = rule.config.quick_shop_button_bg_color; btnEl.style.color = rule.config.quick_shop_button_text_color; } }) }); }); }); }); }) }) } else { if (window.top !== window.self) { const template_type = window.SHOPLAZZA.meta.page.template_type; const holderEl = document.getElementById('smart_recommend_preview_no_data_placeholder'); SPZ.whenApiDefined(holderEl).then((api) => { api.render({data: { isCart: template_type === 13, isCollection: template_type === 2, isProduct: template_type === 1, isIndex: template_type === 15 }}, true); }); } } }); } setAction_() { this.registerAction('quickShop', (data) => { const that = this; const product_id = data.args.product_id; const productIndex = data.args.productIndex; const rule_id = data.args.rule_id; const ssp = data.args.ssp; const scm = data.args.scm; const cfb = data.args.cfb; const ifb = data.args.ifb; const modalRender = document.getElementById('smart_recommend_product_modal_render'); if (product_id) { this.fetchProductData(product_id).then((res) => { const product = res.products && res.products.length && res.products[0] || {}; product.cfb = cfb; product.ifb = ifb; SPZ.whenApiDefined(modalRender).then((api) => { api.render({product: product, productIndex: productIndex, rule_id: rule_id, ssp: ssp, scm: scm, show_type: that.show_type_}, true).then(() => { const modalEl = document.getElementById('smart_recommend_product_modal'); SPZ.whenApiDefined(modalEl).then((modal) => { that.impressListen('#smart_recommend_product_modal', function(){ that.trackQuickShop({ rule_id: rule_id, product_id: product_id }); }); modal.open(); }); const formEl = document.getElementById('smart_recommend_product_form'); SPZ.whenApiDefined(formEl).then((form) => { form.setProduct(product); }); const variantEl = document.getElementById('smart_recommend_product_variants'); SPZ.whenApiDefined(variantEl).then((variant) => { variant.handleRender(product); }); }); }) }); } }); this.registerAction('handleScroll', (data) => { this.directTo(data.args.rule_id, data.args.direction); }); this.registerAction('handleProductChange', (data) => { const variant = data.args.data.variant; const product = data.args.data.product; const imageRenderEl = document.getElementById('smart_recommend_product_image'); SPZ.whenApiDefined(imageRenderEl).then((api) => { api.render({ variant: variant, product: product }); }); }); this.registerAction('handleAtcSuccess', (detail) => { const data = detail.args; data.data.product = data.data.product || {}; data.data.variant = data.data.variant || {}; const product_id = data.data.product.id; const product_title = data.data.product.title; const variant_id = data.data.variant.id; const price = data.data.variant.price; const rule_id = data.rule_id; const aid = `smart_recommend.${this.show_type_}.${rule_id}`; const ifb = data.data.product.ifb; const cfb = data.data.product.cfb; const ssp = data.ssp; const scm = data.scm; const spm = `smart_recommend_${this.show_type_}.${data.spmIndex}`; const params = { id: product_id, product_id: product_id, number: 1, name: product_title, variant_id: variant_id, childrenId: variant_id, item_price: price, source: 'add_to_cart', _extra: { aid: aid, ifb: ifb, cfb: cfb, scm: scm, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, ssp: ssp, } }; this.tranckAddToCart(params); }); this.registerAction('addATCHook', (data) => { const params = data.args; const spm = `smart_recommend_${this.show_type_}.${params.spmIndex}`; this.myInterceptor_ = window.djInterceptors && window.djInterceptors.track.use({ event: 'dj.addToCart', params: { aid: `smart_recommend.${this.show_type_}.` + params.rule_id, ssp: params.ssp, scm: params.scm, cfb: params.cfb, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, }, once: true }); }); } tranckAddToCart(detail) { if (window.$) { window.$(document.body).trigger('dj.addToCart', detail); } } fetchRules() { const payload = { show_type: this.show_type_, }; let that = this; if (this.show_type_ === 6) { let line_items = []; return this.fetchCart().then((res) => { if (res && res.cart && res.cart.line_items) { line_items = res.cart.line_items.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity, price: item.price } }); } payload.line_items = line_items; that.cart_items_ = line_items; return that.fetchRulesRequest(payload); }); } else { if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return this.fetchRulesRequest(payload); } } fetchRulesRequest(payload) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_query", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }); } fetchCart() { return fetch(`/api/cart/cart-select?r=${Math.random().toString(36).slice(-4)}`) .then((res) => { if (res.ok) { return res.json(); } }); } fetchRuleProductList(rule_id) { const payload = { page: 1, limit: 100, fields: ["title", "url", "image", "min_price_variant.price", "min_price_variant.compare_at_price"], rule_id: rule_id, }; if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 6) { payload.line_items = this.cart_items_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); }); } fetchProductData(product_id) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_ids: [product_id], fields: [ "images", "options", "min_price_variant", "variants"] }) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); const loadingEl = document.getElementById('smart_recommend_loading'); if (loadingEl) { loadingEl.style.display = 'none'; } }); } getStyle(ele, style) { if (!ele) return; if (window.getComputedStyle) { return window.getComputedStyle(ele)[style]; } return ele.currentStyle[style]; } directTo(id, direction) { const scrollElement = document.getElementById(`smart_recommend_rule_ul_${id}`); const blockWidth = parseInt(this.getStyle(scrollElement, 'width')); const scrollLength = (blockWidth * 0.19 - 12) * 5; const scrollPoint = scrollElement.scrollWidth - scrollElement.clientWidth; if (!scrollElement) return; if (direction === 'left') { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft - scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: Math.max(scrollElement.scrollLeft - scrollLength, 0), behavior: 'smooth' }); } else { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint + 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: scrollElement.scrollLeft >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); } } trackRuleImpress(rule) { if (window.sa && window.sa.track) { window.sa.track("plugin_common", { plugin_name: "upsell", event_type: "impressions", rule_id: rule.id, ssp: rule.ssp, scm: rule.scm, show_type: this.show_type_, support_app_block: window.SHOPLAZZA.theme.support_app_block }); window.sa.track("module_impressions", { aid: `smart_recommend.${this.show_type_}.${rule.id}`, support_app_block: window.SHOPLAZZA.theme.support_app_block }); } } trackQuickShop(data) { window.sa && sa.track && sa.track("plugin_common", { plugin_name: "upsell", event_type: "quick_shop", rule_id: data.rule_id, product_id: data.product_id, show_type: this.show_type_, }); } impressListen(selector, cb) { const el = document.querySelector(selector); const onImpress = (e) => { if (e) { e.stopPropagation(); } cb(); }; if (el && !el.getAttribute('imprsd')) { el.addEventListener('impress', onImpress) } else if (el) { onImpress(); } } } SPZ.defineElement('spz-custom-smart-block', SpzSmartBlockComponent);
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-1700997626969-'); 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-1700997626969-') 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-1700997626969-'); const coreData = function () { const {getProduct} = dom.commonUtils; let productDetail = getProduct(); let productPrice = productDetail?.selected?.price || 23.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}-1700997626969-` } 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-1700997626969-') 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 = true && "shoplazzagoogle"; const block_applePay = false && "shoplazzaapple"; const block_credit = false && "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-1700997626969-'); const containerDOM = 'pm-payment-express-button-container-1700997626969-'; 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-1700997626969-", "pm-payment-express-more-button-1700997626969-", "pm-payment-express-mock-tips-1700997626969-", "pm-payment-express-skeletonLayer-1700997626969-", ] const resetHtmlList = [ "pm-payment-express-skeletonLayer-title-content-1700997626969-", "pm-payment-express-skeletonLayer-content-1700997626969-", "pm-payment-express-mock-tips-1700997626969-", "pm-payment-express-error-tips-1700997626969-", "pm-payment-express-button-container-1700997626969-", "pm-payment-express-more-button-1700997626969-", ] 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-1700997626969-'); 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-1700997626969-'); 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-1700997626969--${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-1700997626969-'); if (!isPreview()) { return; } if (!tipsDom) { return; } tipsDom.style.display = 'block'; const id = 'pm-payment-express-error-tips-1700997626969--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-1700997626969-'); if (!isPreview()) { return; } if (!tipsDom) { return; } tipsDom.style.display = 'block'; const id = 'pm-payment-express-error-tips-1700997626969--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-1700997626969-'; const skeletonLayerDOM = document.getElementById(skeletonLayerDOMId); const titleDOM = document.getElementById('pm-payment-express-skeletonLayer-title-content-1700997626969-'); const contentDOM = document.getElementById('pm-payment-express-skeletonLayer-content-1700997626969-'); 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-1700997626969-'); 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-1700997626969-'); const moreDOM = document.getElementById('pm-payment-express-more-button-1700997626969-'); const moreButtonConfig = { firstClick: true, maxSize: isNaN(1) ? 1 : 1 }; 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-1700997626969-'); 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-1700997626969-'); 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-1700997626969-'); 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) { }
Customer Reviews
Here are what our customers say.
Write a Review
Customer Reviews
Wow you reached the bottom
Newest
Most liked
Highest ratings
Lowest ratings
×
class SpzCustomFileUpload extends SPZ.BaseElement { constructor(element) { super(element); this.uploadCount_ = 0; this.fileList_ = []; } buildCallback() { this.action = SPZServices.actionServiceForDoc(this.element); this.registerAction('upload', (data) => { this.handleFileUpload_(data.event?.detail?.data || []); }); this.registerAction('delete', (data) => { this.handleFileDelete_(data?.args?.data); }); this.registerAction('preview', (data) => { this.handleFilePreview_(data?.args?.data); }); this.registerAction('limit', (data) => { this.handleFileLimit_(); }); this.registerAction('sizeLimit', (data) => { this.handleFileSizeLimit_(); }); } isLayoutSupported(layout) { return layout == SPZCore.Layout.LOGIC; } setData_(count, file) { this.uploadCount_ = count; this.fileList_ = file; } handleFileUpload_(data) { data.forEach(i => { if(this.fileList_.some(j => j.url === i.url)) return; this.fileList_.push(i); }) this.uploadCount_++; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleFileUpload", { count: this.uploadCount_, files: this.fileList_}); if(this.fileList_.length >= 5){ document.querySelector('#review_upload').style.display = 'none'; } if(this.fileList_.length > 0){ document.querySelector('.apps-reviews-write-anonymous-box').style.marginTop = '8px'; } } handleFileDelete_(index) { this.fileList_.splice(index, 1); this.uploadCount_--; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleFileDelete", { count: this.uploadCount_, files: this.fileList_}); document.querySelector('#review_upload').style.display = 'block'; if(this.fileList_?.length === 0){ document.querySelector('.apps-reviews-write-anonymous-box').style.marginTop = '132px'; } } handleFilePreview_(index) { const finalPreviewData = this.fileList_[index]; const filePreviewModal = document.getElementById('filePreviewModal'); const fullScreenVideo = document.getElementById('fullScreenVideo'); const fullScreenImage = document.getElementById('fullScreenImage'); const previewModalClose = document.getElementById('previewModalClose'); const previewLoading = document.getElementById('previewLoading'); filePreviewModal.style.display = 'block'; previewLoading.style.display = 'flex'; if(finalPreviewData?.type === 'video'){ const media = this.mediaParse_(this.fileList_[index]?.url); fullScreenVideo.addEventListener('canplaythrough', function() { previewLoading.style.display = 'none'; }); fullScreenImage.src = ''; fullScreenImage.style.display = 'none'; fullScreenVideo.style.display = 'block'; fullScreenVideo.src = media.mp4 || ''; } else { fullScreenImage.onload = function() { previewLoading.style.display = 'none'; }; fullScreenVideo.src = ''; fullScreenVideo.style.display = 'none'; fullScreenImage.style.display = 'block'; fullScreenImage.src = finalPreviewData.url; } previewModalClose.addEventListener('click', function() { filePreviewModal.style.display = 'none'; }); } handleFileLimit_() { alert(window.AppReviewsLocale.comment_file_limit || 'please do not upload files more than 5'); this.triggerEvent_("handleFileLimit"); } handleFileSizeLimit_() { alert(window.AppReviewsLocale.comment_file_size_limit || 'File size does not exceed 10M'); } clear(){ this.fileList_ = []; this.uploadCount_ = 0; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleClear", { count: this.uploadCount_, files: this.fileList_}); document.querySelector('#review_upload').style.display = 'block'; } mediaParse_(url) { var result = {}; try { url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) { try { result[key] = decodeURIComponent(value); } catch (e) { result[key] = value; } }); result.preview_image = url.split('?')[0]; } catch (e) {}; return result; } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, name, data); this.action.trigger(this.element, name, event); } } SPZ.defineElement('spz-custom-file-upload', SpzCustomFileUpload);
The review would not show in product details on storefront since it does not support to.