@foxy.io/elements 1.45.0-beta.1 → 1.45.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-f00cd094.js → shared-05e997ae.js} +1 -1
- package/dist/cdn/{shared-d0c1664e.js → shared-0abec247.js} +1 -1
- package/dist/cdn/{shared-9b599205.js → shared-0b3dbac6.js} +1 -1
- package/dist/cdn/{shared-15a7e329.js → shared-1b04321a.js} +1 -1
- package/dist/cdn/{shared-cee1c6f1.js → shared-4e279e77.js} +1 -1
- package/dist/cdn/{shared-e6559d84.js → shared-4e4766ee.js} +1 -1
- package/dist/cdn/{shared-d525b69b.js → shared-4f36f302.js} +1 -1
- package/dist/cdn/{shared-c4df3a2a.js → shared-52053d0d.js} +1 -1
- package/dist/cdn/{shared-57b7386e.js → shared-6783fe5e.js} +1 -1
- package/dist/cdn/{shared-da95bb48.js → shared-69074dae.js} +1 -1
- package/dist/cdn/{shared-da4f539a.js → shared-7933d898.js} +1 -1
- package/dist/cdn/{shared-8f2da12b.js → shared-7f4e3256.js} +1 -1
- package/dist/cdn/{shared-8a83a6eb.js → shared-8ba28691.js} +1 -1
- package/dist/cdn/{shared-b56949d3.js → shared-8ba4b5bf.js} +1 -1
- package/dist/cdn/{shared-b4a3d776.js → shared-8bda01cf.js} +1 -1
- package/dist/cdn/{shared-6c2a7d2f.js → shared-92c211bd.js} +1 -1
- package/dist/cdn/shared-9585cf5b.js +1 -0
- package/dist/cdn/{shared-64c855e5.js → shared-ada2d315.js} +1 -1
- package/dist/cdn/{shared-5b93d193.js → shared-adfed461.js} +1 -1
- package/dist/cdn/{shared-438e41ab.js → shared-b148b310.js} +1 -1
- package/dist/cdn/{shared-090ee4eb.js → shared-b7401886.js} +1 -1
- package/dist/cdn/{shared-264fb8a2.js → shared-ba0d1f31.js} +1 -1
- package/dist/cdn/{shared-a1f181bf.js → shared-bc89d3fb.js} +1 -1
- package/dist/cdn/{shared-8ee6bff5.js → shared-c84bb30e.js} +1 -1
- package/dist/cdn/{shared-af39ffd8.js → shared-d674d2ce.js} +1 -1
- package/dist/cdn/{shared-597fffaa.js → shared-df92d411.js} +1 -1
- package/dist/cdn/{shared-73c199ae.js → shared-f58068b0.js} +1 -1
- package/dist/cdn/translations/experimental-add-to-cart-builder/en.json +13 -5
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js +174 -149
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js.map +1 -1
- package/dist/elements/public/NucleonElement/NucleonElement.js +11 -6
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js +0 -2
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-02dd05dd.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-1d03ea56.js";import"./shared-ac44a3a5.js";import{I as e}from"./shared-
|
|
1
|
+
import"./shared-1d03ea56.js";import"./shared-ac44a3a5.js";import{I as e}from"./shared-92c211bd.js";import{x as t}from"./shared-387d7254.js";import{c as r,h as a,s as o}from"./shared-ba5c42c7.js";import{_ as l}from"./shared-7fec42f2.js";import{i as s}from"./shared-53e42a77.js";import{c as i}from"./shared-4e709717.js";let n;function m(e){var t,r,a;const o=null!==(t=null==e?void 0:e.separator)&&void 0!==t?t:"-",l=null!==(r=null==e?void 0:e.charset)&&void 0!==r?r:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=null!==(a=null==e?void 0:e.length)&&void 0!==a?a:18;let i="";for(let e=0;e<s;e++)o&&e>0&&e%6==0&&(i+=o),i+=l[Math.floor(Math.random()*l.length)];return i}t("vaadin-password-field",r(n||(n=(e=>e)`:host([theme~=summary-item])::before{display:none}:host([theme~=summary-item]) .vaadin-text-field-container{display:grid;grid-template-columns:auto auto;grid-template-rows:repeat(3,min-content);gap:0 var(--lumo-space-m)}:host([theme~=summary-item]) [part=label]{font:normal var(--lumo-font-size-m) var(--lumo-font-family);color:var(--lumo-body-text-color)!important;grid-row:1;-webkit-text-fill-color:var(--lumo-body-text-color)!important}:host([theme~=summary-item]) [part=helper-text]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-secondary-text-color)!important;grid-row:2}:host([theme~=summary-item]) [part=helper-text]::before{display:none}:host([theme~=summary-item]) [part=error-message]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-error-text-color);grid-row:3}:host([theme~=summary-item]) [part=error-message],:host([theme~=summary-item]) [part=helper-text],:host([theme~=summary-item]) [part=label]{line-height:var(--lumo-line-height-xs);grid-column:1;padding:0}:host([theme~=summary-item]) [part=input-field]{grid-column:2;grid-row:1;padding:0;background:0 0;align-self:start;height:1em;--lumo-icon-size-m:1rem}:host([theme~=summary-item]) [part=input-field]::after,:host([theme~=summary-item][readonly]) [part=input-field] slot[name=suffix]{display:none}:host([theme~=summary-item]) [part=value]{line-height:var(--lumo-line-height-xs);text-align:right;min-height:auto;padding:0;margin-right:var(--lumo-space-xs);-webkit-mask-image:none}:host([theme~=summary-item][readonly]) [part=value]{margin-right:0}`)));let d,h,u,p=e=>e;customElements.define("foxy-internal-password-control",class extends e{constructor(){super(...arguments),this.generatorOptions=null,this.showGenerator=!1,this.layout=null}static get properties(){return l(l({},super.properties),{},{generatorOptions:{type:Object,attribute:"generator-options"},showGenerator:{type:Boolean,attribute:"show-generator"},layout:{}})}renderControl(){var e;return a(d||(d=p` <vaadin-password-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" theme="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> ${0} </vaadin-password-field> `),s(this._errorMessage),this.helperText,this.placeholder,this.label,s(null!==(e=this.layout)&&void 0!==e?e:void 0),this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}),this.showGenerator?this.__renderGenerator():"")}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}__renderGenerator(){return a(h||(h=p` <div data-testid="generator" class="${0}" slot="suffix" @click="${0}"> ${0} </div> `),i({"w-s h-s flex items-center justify-center cursor-default transition-colors":!0,"text-contrast-60 hover-text-contrast-80":!this.disabled&&!this.readonly,"text-contrast-20":this.disabled||this.readonly}),(()=>{var e,t,r,a;let o,l=!1,s=0;do{o=m(null!==(e=this.generatorOptions)&&void 0!==e?e:void 0),l=null===(a=null===(r=null===(t=this.generatorOptions)||void 0===t?void 0:t.checkStrength)||void 0===r?void 0:r.call(t,o))||void 0===a||a,s++}while(!l&&s<100);if(!l)throw new Error("Failed to generate a strong password.");this._value=o;const i=this.renderRoot.querySelector("vaadin-password-field");null==i||i._setPasswordVisible(!0)}),o(u||(u=p`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.15em; height: 1.15em"><path d="M15.98 1.804a1 1 0 00-1.96 0l-.24 1.192a1 1 0 01-.784.785l-1.192.238a1 1 0 000 1.962l1.192.238a1 1 0 01.785.785l.238 1.192a1 1 0 001.962 0l.238-1.192a1 1 0 01.785-.785l1.192-.238a1 1 0 000-1.962l-1.192-.238a1 1 0 01-.785-.785l-.238-1.192zM6.949 5.684a1 1 0 00-1.898 0l-.683 2.051a1 1 0 01-.633.633l-2.051.683a1 1 0 000 1.898l2.051.684a1 1 0 01.633.632l.683 2.051a1 1 0 001.898 0l.683-2.051a1 1 0 01.633-.633l2.051-.683a1 1 0 000-1.898l-2.051-.683a1 1 0 01-.633-.633L6.95 5.684zM13.949 13.684a1 1 0 00-1.898 0l-.184.551a1 1 0 01-.632.633l-.551.183a1 1 0 000 1.898l.551.183a1 1 0 01.633.633l.183.551a1 1 0 001.898 0l.184-.551a1 1 0 01.632-.633l.551-.183a1 1 0 000-1.898l-.551-.184a1 1 0 01-.633-.632l-.183-.551z" /></svg>`)))}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-a6cf5b1f.js";import{h as t,P as e}from"./shared-3bc9eaf7.js";import{F as i,t as o}from"./shared-3db3f3c3.js";import{T as n,a,E as s}from"./shared-46efbc40.js";import"./shared-297155d9.js";import{O as r}from"./shared-1abfcf87.js";import"./shared-24998349.js";import"./shared-
|
|
1
|
+
import"./shared-a6cf5b1f.js";import{h as t,P as e}from"./shared-3bc9eaf7.js";import{F as i,t as o}from"./shared-3db3f3c3.js";import{T as n,a,E as s}from"./shared-46efbc40.js";import"./shared-297155d9.js";import{O as r}from"./shared-1abfcf87.js";import"./shared-24998349.js";import"./shared-b148b310.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-64210e53.js";import{I as l}from"./shared-92c211bd.js";import"./shared-25a9d87d.js";import{x as d}from"./shared-387d7254.js";import{c,h,r as m}from"./shared-ba5c42c7.js";import{_ as u}from"./shared-7fec42f2.js";import{i as p}from"./shared-53e42a77.js";import{c as _}from"./shared-4e709717.js";const f=t`<dom-module id="lumo-notification-card" theme-for="vaadin-notification-card">
|
|
2
2
|
<template>
|
|
3
3
|
<style>
|
|
4
4
|
:host {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./shared-7fec42f2.js";import{h as t}from"./shared-ba5c42c7.js";import{C as l}from"./shared-c782b9fa.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-387d7254.js";import{c as r}from"./shared-4e709717.js";import{N as d}from"./shared-
|
|
1
|
+
import{_ as e}from"./shared-7fec42f2.js";import{h as t}from"./shared-ba5c42c7.js";import{C as l}from"./shared-c782b9fa.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-387d7254.js";import{c as r}from"./shared-4e709717.js";import{N as d}from"./shared-69074dae.js";let n,o,h,c,m,u=e=>e;const b=l(s(a(i(d))));class p extends b{constructor(){super(...arguments),this.columns=[]}static get properties(){return e(e({},super.properties),{},{columns:{attribute:!1}})}render(){var e,l;const s=this.columns.some((e=>!!e.header));return t(n||(n=u` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative font-lumo text-m"> <table class="table-fixed w-full" data-testid="table"> <thead class="${0}"> <tr> ${0} </tr> </thead> <tbody class="divide-y divide-contrast-10"> ${0} </tbody> </table> ${0} </div> ${0} `),this.in("busy"),s?"border-b border-contrast-10":"sr-only",this.columns.map(((e,l)=>{var s;return t(o||(o=u` <th class="${0}"> ${0} </th> `),r({"truncate h-l text-tertiary text-m text-left font-medium":!0,"text-right":l===this.columns.length-1,"hidden sm-table-cell":"sm"===e.hideBelow,"hidden md-table-cell":"md"===e.hideBelow,"hidden lg-table-cell":"lg"===e.hideBelow,"hidden xl-table-cell":"xl"===e.hideBelow}),null===(s=e.header)||void 0===s?void 0:s.call(e,{html:t,lang:this.lang,data:this.data,ns:this.ns}))})),this.__rows.map((e=>{var l;return t(h||(h=u` <tr class="h-l"> ${0} </tr> `),null===(l=this.columns)||void 0===l?void 0:l.map(((l,s)=>{var a;return t(c||(c=u` <td class="${0}"> ${0} </td> `),r({"text-right":s===this.columns.length-1,"hidden sm-table-cell":"sm"===l.hideBelow,"hidden md-table-cell":"md"===l.hideBelow,"hidden lg-table-cell":"lg"===l.hideBelow,"hidden xl-table-cell":"xl"===l.hideBelow,"truncate h-l text-body":!0}),e?null===(a=l.cell)||void 0===a?void 0:a.call(l,{html:t,lang:this.lang,data:e,ns:this.ns}):"")})))})),this.in({idle:"snapshot"})?"":t(m||(m=u` <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" class="p-m bg-base shadow-xs rounded-t-l rounded-b-l" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> `),this.in("busy")?"busy":this.in("idle")?"empty":"error",this.lang,this.ns,null!==(l=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==l?l:""),this.renderTemplateOrSlot())}get __rows(){var e,t,l;const s=Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{}).reduce(((e,t)=>[...e,...t]),[]);let a;if(0===s.length)try{const e=new URL(null!==(l=this.href)&&void 0!==l?l:"").searchParams.get("limit"),t=parseInt(null!=e?e:"");a=isNaN(t)?20:t}catch(e){a=20}else a=s.length;return new Array(a).fill(null).map(((e,t)=>{var l;return null!==(l=s[t])&&void 0!==l?l:e}))}}export{p as T};
|
|
@@ -542,7 +542,16 @@
|
|
|
542
542
|
"helper_text": "",
|
|
543
543
|
"direct_link": "Direct link",
|
|
544
544
|
"empty": "Modify the item parameters to see the add-to-cart link.",
|
|
545
|
-
"unavailable":
|
|
545
|
+
"unavailable": {
|
|
546
|
+
"loading_extra_data_needed": "Creating direct link...",
|
|
547
|
+
"error_special_characters_present": "At the moment we don't support signed direct links with item parameters that contain the following characters: #, &, %, =.",
|
|
548
|
+
"error_price_configurable": "Direct link is not available when one or more items have configurable price.",
|
|
549
|
+
"error_duplicate_custom_option_names": "Direct link is not available when one or more items have configurable custom options.",
|
|
550
|
+
"paused_code_required": "Direct link will be available once you provide an SKU for each item.",
|
|
551
|
+
"error_option_value_configurable": "Direct link is not available when one or more items have a custom option with a configurable value.",
|
|
552
|
+
"error_html_entities_present": "At the moment we don't support signed links with item parameters that contain HTML entities.",
|
|
553
|
+
"error_double_quotes_present": "At the moment we don't support signed links with item parameters that contain double quotes."
|
|
554
|
+
},
|
|
546
555
|
"copy-to-clipboard": {
|
|
547
556
|
"failed_to_copy": "Failed to copy",
|
|
548
557
|
"click_to_copy": "Copy to clipboard",
|
|
@@ -561,11 +570,10 @@
|
|
|
561
570
|
"submit_caption_cart": "Add to cart",
|
|
562
571
|
"submit_caption_checkout": "Purchase",
|
|
563
572
|
"unavailable": {
|
|
564
|
-
"
|
|
565
|
-
"loading_paused": "Preview paused",
|
|
573
|
+
"loading_extra_data_needed": "Loading direct link...",
|
|
566
574
|
"paused_code_required": "Preview and add-to-cart code will be available once you provide an SKU for each item.",
|
|
567
|
-
"error_html_entities_present": "
|
|
568
|
-
"error_double_quotes_present": "
|
|
575
|
+
"error_html_entities_present": "At the moment we don't support signed forms with item parameters that contain HTML entities.",
|
|
576
|
+
"error_double_quotes_present": "At the moment we don't support signed forms with item parameters that contain double quotes."
|
|
569
577
|
},
|
|
570
578
|
"spinner": {
|
|
571
579
|
"loading_busy": "Signing",
|
|
@@ -112,10 +112,11 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
112
112
|
const addToCartCode = this.__getAddToCartCode();
|
|
113
113
|
const storeUrl = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:store'].href) !== null && _b !== void 0 ? _b : this.store) !== null && _c !== void 0 ? _c : void 0;
|
|
114
114
|
const store = (_d = this.__storeLoader) === null || _d === void 0 ? void 0 : _d.data;
|
|
115
|
+
const formHtmlState = (_f = (_e = addToCartCode.formHTMLError) === null || _e === void 0 ? void 0 : _e.split('_')[0]) !== null && _f !== void 0 ? _f : 'paused';
|
|
115
116
|
return html `
|
|
116
117
|
<div class="grid gap-m items-start sm-grid-cols-2 md-grid-cols-3 h-full overflow-auto">
|
|
117
118
|
<foxy-internal-summary-control layout="section" class="space-y-s" infer="items">
|
|
118
|
-
${(
|
|
119
|
+
${(_g = this.form.items) === null || _g === void 0 ? void 0 : _g.map((product, index) => {
|
|
119
120
|
var _a;
|
|
120
121
|
return html `
|
|
121
122
|
<foxy-internal-summary-control
|
|
@@ -166,9 +167,21 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
166
167
|
</foxy-internal-summary-control>
|
|
167
168
|
|
|
168
169
|
<div class="space-y-m md-col-span-2 sticky top-0">
|
|
169
|
-
|
|
170
|
+
<foxy-internal-summary-control infer="preview">
|
|
171
|
+
${addToCartCode.formHTMLError
|
|
170
172
|
? html `
|
|
171
|
-
|
|
173
|
+
<div class="flex flex-col gap-xs items-center justify-center p-xl">
|
|
174
|
+
<foxy-spinner layout="no-label" infer="unavailable" state=${formHtmlState}>
|
|
175
|
+
</foxy-spinner>
|
|
176
|
+
<foxy-i18n
|
|
177
|
+
class="${formHtmlState === 'error' ? 'text-error' : 'text-tertiary'} text-s"
|
|
178
|
+
infer="unavailable"
|
|
179
|
+
key=${addToCartCode.formHTMLError}
|
|
180
|
+
>
|
|
181
|
+
</foxy-i18n>
|
|
182
|
+
</div>
|
|
183
|
+
`
|
|
184
|
+
: html `
|
|
172
185
|
<div class="flex">
|
|
173
186
|
<iframe
|
|
174
187
|
srcdoc="${previewCSS}${addToCartCode.formHTML}"
|
|
@@ -244,87 +257,66 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
244
257
|
</a>
|
|
245
258
|
</p>
|
|
246
259
|
</div>
|
|
247
|
-
|
|
260
|
+
`}
|
|
261
|
+
</foxy-internal-summary-control>
|
|
248
262
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<foxy-i18n infer="" key="direct_link"></foxy-i18n>
|
|
257
|
-
<a
|
|
258
|
-
target="_blank"
|
|
259
|
-
style="max-width: 30rem"
|
|
260
|
-
href=${addToCartCode.linkHref}
|
|
261
|
-
class=${classMap({
|
|
262
|
-
'font-medium truncate ml-auto min-w-0 rounded-s': true,
|
|
263
|
-
'transition-all filter': true,
|
|
264
|
-
'hover-underline': true,
|
|
265
|
-
'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
|
|
266
|
-
'blur-sm': this.__signingState !== 'idle',
|
|
267
|
-
})}
|
|
268
|
-
>
|
|
269
|
-
${addToCartCode.linkHref}
|
|
270
|
-
</a>
|
|
271
|
-
<div
|
|
272
|
-
style="top: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); right: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
273
|
-
class=${classMap({
|
|
274
|
-
'absolute right-0 bg-base rounded-s transition-opacity': true,
|
|
275
|
-
'opacity-0 pointer-events-none': this.__signingState !== 'busy',
|
|
276
|
-
})}
|
|
277
|
-
>
|
|
278
|
-
<div class="bg-contrast-10 rounded-s">
|
|
279
|
-
<foxy-spinner
|
|
280
|
-
infer="spinner"
|
|
281
|
-
state=${this.__signingState === 'fail' ? 'error' : 'busy'}
|
|
282
|
-
class="-mx-xs"
|
|
283
|
-
style="transform: scale(0.8)"
|
|
284
|
-
>
|
|
285
|
-
</foxy-spinner>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
<foxy-copy-to-clipboard
|
|
289
|
-
infer="copy-to-clipboard"
|
|
290
|
-
text=${addToCartCode.linkHref}
|
|
291
|
-
class=${classMap({
|
|
292
|
-
'flex-shrink-0 text-m transition-opacity': true,
|
|
293
|
-
'opacity-0 pointer-events-none': this.__signingState === 'busy',
|
|
294
|
-
})}
|
|
295
|
-
>
|
|
296
|
-
</foxy-copy-to-clipboard>
|
|
297
|
-
</div>
|
|
298
|
-
`
|
|
299
|
-
: html `
|
|
300
|
-
<p class="text-disabled">
|
|
301
|
-
<foxy-i18n infer="" key="unavailable"></foxy-i18n>
|
|
302
|
-
</p>
|
|
303
|
-
`}
|
|
304
|
-
</foxy-internal-summary-control>
|
|
305
|
-
`
|
|
263
|
+
<foxy-internal-summary-control infer="link">
|
|
264
|
+
${addToCartCode.linkHrefError
|
|
265
|
+
? html `
|
|
266
|
+
<p class="text-tertiary">
|
|
267
|
+
<foxy-i18n infer="unavailable" key=${addToCartCode.linkHrefError}> </foxy-i18n>
|
|
268
|
+
</p>
|
|
269
|
+
`
|
|
306
270
|
: html `
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
271
|
+
<div
|
|
272
|
+
class="flex items-center leading-s min-w-0 relative"
|
|
273
|
+
style="gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
274
|
+
>
|
|
275
|
+
<foxy-i18n infer="" key="direct_link"></foxy-i18n>
|
|
276
|
+
<a
|
|
277
|
+
target="_blank"
|
|
278
|
+
style="max-width: 30rem"
|
|
279
|
+
href=${addToCartCode.linkHref}
|
|
280
|
+
class=${classMap({
|
|
281
|
+
'font-medium truncate ml-auto min-w-0 rounded-s': true,
|
|
282
|
+
'transition-all filter': true,
|
|
283
|
+
'hover-underline': true,
|
|
284
|
+
'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
|
|
285
|
+
'blur-sm': this.__signingState !== 'idle',
|
|
286
|
+
})}
|
|
313
287
|
>
|
|
314
|
-
|
|
315
|
-
|
|
288
|
+
${addToCartCode.linkHref}
|
|
289
|
+
</a>
|
|
290
|
+
<div
|
|
291
|
+
style="top: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); right: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
316
292
|
class=${classMap({
|
|
317
|
-
'
|
|
318
|
-
'
|
|
319
|
-
'text-s': true,
|
|
293
|
+
'absolute right-0 bg-base rounded-s transition-opacity': true,
|
|
294
|
+
'opacity-0 pointer-events-none': this.__signingState !== 'busy',
|
|
320
295
|
})}
|
|
321
|
-
infer="unavailable"
|
|
322
|
-
key="${(_g = addToCartCode === null || addToCartCode === void 0 ? void 0 : addToCartCode.error) !== null && _g !== void 0 ? _g : 'loading_busy'}"
|
|
323
296
|
>
|
|
324
|
-
|
|
297
|
+
<div class="bg-contrast-10 rounded-s">
|
|
298
|
+
<foxy-spinner
|
|
299
|
+
infer="spinner"
|
|
300
|
+
state=${this.__signingState === 'fail' ? 'error' : 'busy'}
|
|
301
|
+
class="-mx-xs"
|
|
302
|
+
style="transform: scale(0.8)"
|
|
303
|
+
>
|
|
304
|
+
</foxy-spinner>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
<foxy-copy-to-clipboard
|
|
308
|
+
infer="copy-to-clipboard"
|
|
309
|
+
text=${addToCartCode.linkHref}
|
|
310
|
+
class=${classMap({
|
|
311
|
+
'flex-shrink-0 text-m transition-opacity': true,
|
|
312
|
+
'opacity-0 pointer-events-none': this.__signingState === 'busy',
|
|
313
|
+
})}
|
|
314
|
+
>
|
|
315
|
+
</foxy-copy-to-clipboard>
|
|
325
316
|
</div>
|
|
326
|
-
|
|
327
|
-
|
|
317
|
+
`}
|
|
318
|
+
</foxy-internal-summary-control>
|
|
319
|
+
|
|
328
320
|
${this.renderTemplateOrSlot()}
|
|
329
321
|
|
|
330
322
|
<foxy-internal-summary-control infer="cart-settings">
|
|
@@ -517,8 +509,9 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
517
509
|
const templateSet = this.__resolvedTemplateSet;
|
|
518
510
|
const cartUrl = this.__resolvedCartUrl;
|
|
519
511
|
const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
|
|
520
|
-
if (!this.defaultDomain || !templateSet || !store || !currencyCode || !cartUrl)
|
|
521
|
-
|
|
512
|
+
if (!this.defaultDomain || !templateSet || !store || !currencyCode || !cartUrl) {
|
|
513
|
+
throw new Error('loading_extra_data_needed');
|
|
514
|
+
}
|
|
522
515
|
const isHmacOn = store.use_cart_validation;
|
|
523
516
|
let hasAtLeastOneFieldset = false;
|
|
524
517
|
let output = `<form action="${weakEncode(cartUrl, isHmacOn)}" method="post" target="_blank">`;
|
|
@@ -546,7 +539,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
546
539
|
const itemCategory = itemCategoryLoader === null || itemCategoryLoader === void 0 ? void 0 : itemCategoryLoader.data;
|
|
547
540
|
const product = items[productIndex];
|
|
548
541
|
if (product.item_category_uri && !itemCategory)
|
|
549
|
-
|
|
542
|
+
throw new Error('loading_extra_data_needed');
|
|
550
543
|
const resolvedMinQty = Math.max(1, (_c = product.quantity_min) !== null && _c !== void 0 ? _c : 1);
|
|
551
544
|
const resolvedMaxQty = Math.max(resolvedMinQty, (_d = product.quantity_max) !== null && _d !== void 0 ? _d : Infinity);
|
|
552
545
|
const varyQty = resolvedMinQty !== resolvedMaxQty &&
|
|
@@ -589,7 +582,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
589
582
|
addHiddenInput(`${prefix}code`, product.code);
|
|
590
583
|
}
|
|
591
584
|
else if (store.use_cart_validation) {
|
|
592
|
-
|
|
585
|
+
throw new Error('paused_code_required');
|
|
593
586
|
}
|
|
594
587
|
if (product.parent_code)
|
|
595
588
|
addHiddenInput(`${prefix}parent_code`, product.parent_code);
|
|
@@ -760,62 +753,81 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
760
753
|
const templateSet = this.__resolvedTemplateSet;
|
|
761
754
|
const cartUrl = this.__resolvedCartUrl;
|
|
762
755
|
const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
|
|
763
|
-
if (!this.defaultDomain || !templateSet || !store || !currencyCode || !cartUrl)
|
|
764
|
-
|
|
765
|
-
|
|
756
|
+
if (!this.defaultDomain || !templateSet || !store || !currencyCode || !cartUrl) {
|
|
757
|
+
throw new Error('loading_extra_data_needed');
|
|
758
|
+
}
|
|
759
|
+
const signedUrlParams = new Map();
|
|
760
|
+
const unsignedUrlParams = new URLSearchParams();
|
|
761
|
+
const setOrThrow = (name, value) => {
|
|
762
|
+
if (store.use_cart_validation) {
|
|
763
|
+
if (name.includes('&') ||
|
|
764
|
+
value.includes('&') ||
|
|
765
|
+
name.includes('%') ||
|
|
766
|
+
value.includes('%') ||
|
|
767
|
+
name.includes('=') ||
|
|
768
|
+
value.includes('='))
|
|
769
|
+
throw new Error('error_special_characters_present');
|
|
770
|
+
signedUrlParams.set(name, value);
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
unsignedUrlParams.set(name, value);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
766
776
|
if (templateSet.code !== 'DEFAULT')
|
|
767
|
-
|
|
777
|
+
setOrThrow('template_set', templateSet.code);
|
|
768
778
|
if (this.form.cart === 'checkout')
|
|
769
|
-
|
|
779
|
+
setOrThrow('cart', 'checkout');
|
|
770
780
|
if (this.form.redirect)
|
|
771
|
-
|
|
781
|
+
setOrThrow('redirect', this.form.redirect);
|
|
772
782
|
if (this.form.coupon)
|
|
773
|
-
|
|
783
|
+
setOrThrow('coupon', this.form.coupon);
|
|
774
784
|
if (this.form.empty && this.form.empty !== 'false') {
|
|
775
|
-
|
|
785
|
+
setOrThrow('empty', this.form.empty);
|
|
776
786
|
}
|
|
777
787
|
for (let index = 0; index < ((_c = (_b = this.form.items) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0); ++index) {
|
|
778
788
|
const product = this.form.items[index];
|
|
779
789
|
const prefix = index === 0 ? '' : `${index + 1}:`;
|
|
780
790
|
const itemCategory = (_d = this.__getItemCategoryLoader(index)) === null || _d === void 0 ? void 0 : _d.data;
|
|
781
|
-
if (product.item_category_uri && !itemCategory)
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
791
|
+
if (product.item_category_uri && !itemCategory) {
|
|
792
|
+
throw new Error('loading_extra_data_needed');
|
|
793
|
+
}
|
|
794
|
+
if (product.price_configurable) {
|
|
795
|
+
throw new Error('error_price_configurable');
|
|
796
|
+
}
|
|
785
797
|
if (new Set(product.custom_options.map(v => v.name)).size < product.custom_options.length) {
|
|
786
|
-
|
|
798
|
+
throw new Error('error_duplicate_custom_option_names');
|
|
787
799
|
}
|
|
788
800
|
if (itemCategory && itemCategory.code !== 'DEFAULT') {
|
|
789
|
-
|
|
801
|
+
setOrThrow(`${prefix}category`, itemCategory.code);
|
|
790
802
|
}
|
|
791
|
-
|
|
792
|
-
|
|
803
|
+
setOrThrow(`${prefix}name`, product.name);
|
|
804
|
+
setOrThrow(`${prefix}price`, `${product.price}${currencyCode}`);
|
|
793
805
|
if (product.code) {
|
|
794
|
-
|
|
806
|
+
setOrThrow(`${prefix}code`, product.code);
|
|
795
807
|
}
|
|
796
808
|
else if (store.use_cart_validation) {
|
|
797
|
-
|
|
809
|
+
throw new Error('paused_code_required');
|
|
798
810
|
}
|
|
799
811
|
if (product.parent_code)
|
|
800
|
-
|
|
812
|
+
setOrThrow(`${prefix}parent_code`, product.parent_code);
|
|
801
813
|
if (product.image) {
|
|
802
|
-
|
|
814
|
+
setOrThrow(`${prefix}image`, product.image);
|
|
803
815
|
if (product.url)
|
|
804
|
-
|
|
816
|
+
setOrThrow(`${prefix}url`, product.url);
|
|
805
817
|
}
|
|
806
818
|
if (product.sub_enabled) {
|
|
807
819
|
if (product.sub_frequency) {
|
|
808
|
-
|
|
820
|
+
setOrThrow(`${prefix}sub_frequency`, product.sub_frequency);
|
|
809
821
|
if (product.sub_startdate) {
|
|
810
822
|
if (product.sub_startdate_format === 'yyyymmdd') {
|
|
811
823
|
const date = new Date(product.sub_startdate);
|
|
812
824
|
const year = date.getFullYear();
|
|
813
825
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
814
826
|
const day = date.getDate().toString().padStart(2, '0');
|
|
815
|
-
|
|
827
|
+
setOrThrow(`${prefix}sub_startdate`, `${year}${month}${day}`);
|
|
816
828
|
}
|
|
817
829
|
else {
|
|
818
|
-
|
|
830
|
+
setOrThrow(`${prefix}sub_startdate`, String(product.sub_startdate));
|
|
819
831
|
}
|
|
820
832
|
}
|
|
821
833
|
if (product.sub_enddate) {
|
|
@@ -824,94 +836,107 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
824
836
|
const year = date.getFullYear();
|
|
825
837
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
826
838
|
const day = date.getDate().toString().padStart(2, '0');
|
|
827
|
-
|
|
839
|
+
setOrThrow(`${prefix}sub_enddate`, `${year}${month}${day}`);
|
|
828
840
|
}
|
|
829
841
|
else {
|
|
830
|
-
|
|
842
|
+
setOrThrow(`${prefix}sub_enddate`, String(product.sub_enddate));
|
|
831
843
|
}
|
|
832
844
|
}
|
|
833
845
|
}
|
|
834
846
|
}
|
|
835
847
|
if (product.discount_name && product.discount_type && product.discount_details) {
|
|
836
|
-
|
|
848
|
+
setOrThrow(`${prefix}discount_${product.discount_type}`, `${product.discount_name}{${product.discount_details}}`);
|
|
837
849
|
}
|
|
838
850
|
if (product.expires_value) {
|
|
839
851
|
if (product.expires_format === 'timestamp') {
|
|
840
|
-
|
|
852
|
+
setOrThrow(`${prefix}expires`, product.expires_value.toFixed(0));
|
|
841
853
|
}
|
|
842
854
|
else {
|
|
843
|
-
|
|
855
|
+
setOrThrow(`${prefix}expires`, product.expires_value.toFixed(0));
|
|
844
856
|
}
|
|
845
857
|
}
|
|
846
858
|
if (((_e = product.quantity) !== null && _e !== void 0 ? _e : 1) > 1) {
|
|
847
|
-
|
|
859
|
+
setOrThrow(`${prefix}quantity`, ((_f = product.quantity) !== null && _f !== void 0 ? _f : 1).toFixed(0));
|
|
848
860
|
}
|
|
849
861
|
if (product.expires_format !== 'minutes') {
|
|
850
862
|
if (product.quantity_min) {
|
|
851
|
-
|
|
863
|
+
setOrThrow(`${prefix}quantity_min`, product.quantity_min.toString());
|
|
852
864
|
}
|
|
853
865
|
if (product.quantity_max) {
|
|
854
|
-
|
|
866
|
+
setOrThrow(`${prefix}quantity_max`, product.quantity_max.toString());
|
|
855
867
|
}
|
|
856
868
|
}
|
|
857
869
|
if (product.weight)
|
|
858
|
-
|
|
870
|
+
setOrThrow(`${prefix}weight`, product.weight.toFixed(3));
|
|
859
871
|
if (product.length)
|
|
860
|
-
|
|
872
|
+
setOrThrow(`${prefix}length`, product.length.toFixed(3));
|
|
861
873
|
if (product.width)
|
|
862
|
-
|
|
874
|
+
setOrThrow(`${prefix}width`, product.width.toFixed(3));
|
|
863
875
|
if (product.height)
|
|
864
|
-
|
|
876
|
+
setOrThrow(`${prefix}height`, product.height.toFixed(3));
|
|
865
877
|
for (let optionIndex = 0; optionIndex < product.custom_options.length; ++optionIndex) {
|
|
866
878
|
const option = product.custom_options[optionIndex];
|
|
867
879
|
if (option.value_configurable)
|
|
868
|
-
|
|
880
|
+
throw new Error('error_option_value_configurable');
|
|
869
881
|
const itemCategory = (_g = this.__getItemCategoryLoader(index, optionIndex)) === null || _g === void 0 ? void 0 : _g.data;
|
|
870
882
|
const modifiers = this.__getOptionModifiers(option, itemCategory !== null && itemCategory !== void 0 ? itemCategory : null, currencyCode);
|
|
871
|
-
|
|
883
|
+
setOrThrow(`${prefix}${option.name}`, `${(_h = option.value) !== null && _h !== void 0 ? _h : ''}${modifiers}`);
|
|
872
884
|
}
|
|
873
885
|
}
|
|
874
|
-
return
|
|
886
|
+
return store.use_cart_validation
|
|
887
|
+
? `${cartUrl}?${Array.from(signedUrlParams.entries())
|
|
888
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
889
|
+
.join('&')}`
|
|
890
|
+
: `${cartUrl}?${unsignedUrlParams.toString()}`;
|
|
875
891
|
}
|
|
876
892
|
__getAddToCartCode() {
|
|
877
893
|
var _a;
|
|
894
|
+
const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
|
|
895
|
+
if (!this.encodeHelper || !store) {
|
|
896
|
+
return {
|
|
897
|
+
linkHref: '',
|
|
898
|
+
linkHrefError: 'loading_extra_data_needed',
|
|
899
|
+
formHTML: '',
|
|
900
|
+
formHTMLError: 'loading_extra_data_needed',
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
const checkEquality = store.use_cart_validation;
|
|
904
|
+
let formHTMLError = null;
|
|
905
|
+
let linkHrefError = null;
|
|
906
|
+
let formHTML = '';
|
|
907
|
+
let linkHref = '';
|
|
908
|
+
try {
|
|
909
|
+
formHTML = this.__getAddToCartFormHTML();
|
|
910
|
+
}
|
|
911
|
+
catch (err) {
|
|
912
|
+
formHTMLError = err.message;
|
|
913
|
+
}
|
|
914
|
+
let unsignedCode = formHTML;
|
|
878
915
|
try {
|
|
879
|
-
|
|
880
|
-
if (!this.encodeHelper || !store)
|
|
881
|
-
return null;
|
|
882
|
-
const checkEquality = store.use_cart_validation;
|
|
883
|
-
const formHTML = this.__getAddToCartFormHTML();
|
|
884
|
-
const linkHref = this.__getAddToCartLinkHref();
|
|
885
|
-
if (!formHTML && !linkHref)
|
|
886
|
-
return null;
|
|
887
|
-
if (typeof formHTML === 'object')
|
|
888
|
-
return { error: formHTML.error };
|
|
889
|
-
if (typeof linkHref === 'object')
|
|
890
|
-
return { error: linkHref.error };
|
|
891
|
-
let unsignedCode;
|
|
916
|
+
linkHref = this.__getAddToCartLinkHref();
|
|
892
917
|
if (linkHref) {
|
|
893
918
|
const linkHTML = `<a href="${weakEncode(linkHref, checkEquality)}">Add to cart</a>`;
|
|
894
919
|
unsignedCode = `${formHTML}${this.__signingSeparator}${linkHTML}`;
|
|
895
920
|
}
|
|
896
|
-
else {
|
|
897
|
-
unsignedCode = formHTML;
|
|
898
|
-
}
|
|
899
|
-
if (unsignedCode === this.__previousUnsignedCode && this.__previousSignedCode) {
|
|
900
|
-
const [formHTML, linkHTML] = this.__previousSignedCode.split(this.__signingSeparator);
|
|
901
|
-
return {
|
|
902
|
-
linkHref: linkHTML ? decode(linkHTML.substring(9, linkHTML.length - 17)) : '',
|
|
903
|
-
formHTML,
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
this.__previousUnsignedCode = unsignedCode;
|
|
907
|
-
this.__previousSignedCode = '';
|
|
908
|
-
if (store.use_cart_validation)
|
|
909
|
-
this.__signAsync(unsignedCode, this.encodeHelper);
|
|
910
|
-
return { formHTML, linkHref };
|
|
911
921
|
}
|
|
912
922
|
catch (err) {
|
|
913
|
-
|
|
923
|
+
linkHrefError = err.message;
|
|
924
|
+
linkHref = '';
|
|
914
925
|
}
|
|
926
|
+
if (unsignedCode === this.__previousUnsignedCode && this.__previousSignedCode) {
|
|
927
|
+
const [formHTML, linkHTML] = this.__previousSignedCode.split(this.__signingSeparator);
|
|
928
|
+
return {
|
|
929
|
+
linkHref: linkHTML ? decode(linkHTML.substring(9, linkHTML.length - 17)) : '',
|
|
930
|
+
linkHrefError,
|
|
931
|
+
formHTML,
|
|
932
|
+
formHTMLError,
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
this.__previousUnsignedCode = unsignedCode;
|
|
936
|
+
this.__previousSignedCode = '';
|
|
937
|
+
if (store.use_cart_validation)
|
|
938
|
+
this.__signAsync(unsignedCode, this.encodeHelper);
|
|
939
|
+
return { formHTML, formHTMLError, linkHref, linkHrefError };
|
|
915
940
|
}
|
|
916
941
|
__getOptionModifiers(option, optionItemCategory, currencyCode) {
|
|
917
942
|
if (option.value_configurable)
|